51805c4457d0c6d16c98b3b9c52a687c10b6ffcf
[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
7327 /**
7328  * SECTION:spawn
7329  * @Short_description: process launching
7330  * @Title: Spawning Processes
7331  *
7332  *
7333  */
7334
7335
7336 /**
7337  * SECTION:string_chunks
7338  * @title: String Chunks
7339  * @short_description: efficient storage of groups of strings
7340  *
7341  * String chunks are used to store groups of strings. Memory is
7342  * allocated in blocks, and as strings are added to the #GStringChunk
7343  * they are copied into the next free position in a block. When a block
7344  * is full a new block is allocated.
7345  *
7346  * When storing a large number of strings, string chunks are more
7347  * efficient than using g_strdup() since fewer calls to malloc() are
7348  * needed, and less memory is wasted in memory allocation overheads.
7349  *
7350  * By adding strings with g_string_chunk_insert_const() it is also
7351  * possible to remove duplicates.
7352  *
7353  * To create a new #GStringChunk use g_string_chunk_new().
7354  *
7355  * To add strings to a #GStringChunk use g_string_chunk_insert().
7356  *
7357  * To add strings to a #GStringChunk, but without duplicating strings
7358  * which are already in the #GStringChunk, use
7359  * g_string_chunk_insert_const().
7360  *
7361  * To free the entire #GStringChunk use g_string_chunk_free(). It is
7362  * not possible to free individual strings.
7363  */
7364
7365
7366 /**
7367  * SECTION:string_utils
7368  * @title: String Utility Functions
7369  * @short_description: various string-related functions
7370  *
7371  * This section describes a number of utility functions for creating,
7372  * duplicating, and manipulating strings.
7373  *
7374  * Note that the functions g_printf(), g_fprintf(), g_sprintf(),
7375  * g_snprintf(), g_vprintf(), g_vfprintf(), g_vsprintf() and g_vsnprintf()
7376  * are declared in the header <filename>gprintf.h</filename> which is
7377  * <emphasis>not</emphasis> included in <filename>glib.h</filename>
7378  * (otherwise using <filename>glib.h</filename> would drag in
7379  * <filename>stdio.h</filename>), so you'll have to explicitly include
7380  * <literal>&lt;glib/gprintf.h&gt;</literal> in order to use the GLib
7381  * printf() functions.
7382  *
7383  * <para id="string-precision">While you may use the printf() functions
7384  * to format UTF-8 strings, notice that the precision of a
7385  * <literal>&percnt;Ns</literal> parameter is interpreted as the
7386  * number of <emphasis>bytes</emphasis>, not <emphasis>characters</emphasis>
7387  * to print. On top of that, the GNU libc implementation of the printf()
7388  * functions has the "feature" that it checks that the string given for
7389  * the <literal>&percnt;Ns</literal> parameter consists of a whole number
7390  * of characters in the current encoding. So, unless you are sure you are
7391  * always going to be in an UTF-8 locale or your know your text is restricted
7392  * to ASCII, avoid using <literal>&percnt;Ns</literal>. If your intention is
7393  * to format strings for a certain number of columns, then
7394  * <literal>&percnt;Ns</literal> is not a correct solution anyway, since it
7395  * fails to take wide characters (see g_unichar_iswide()) into account.
7396  * </para>
7397  */
7398
7399
7400 /**
7401  * SECTION:strings
7402  * @title: Strings
7403  * @short_description: text buffers which grow automatically as text is added
7404  *
7405  * A #GString is an object that handles the memory management of a C
7406  * string for you.  The emphasis of #GString is on text, typically
7407  * UTF-8.  Crucially, the "str" member of a #GString is guaranteed to
7408  * have a trailing nul character, and it is therefore always safe to
7409  * call functions such as strchr() or g_strdup() on it.
7410  *
7411  * However, a #GString can also hold arbitrary binary data, because it
7412  * has a "len" member, which includes any possible embedded nul
7413  * characters in the data.  Conceptually then, #GString is like a
7414  * #GByteArray with the addition of many convenience methods for text,
7415  * and a guaranteed nul terminator.
7416  */
7417
7418
7419 /**
7420  * SECTION:testing
7421  * @title: Testing
7422  * @short_description: a test framework
7423  * @see_also: <link linkend="gtester">gtester</link>, <link linkend="gtester-report">gtester-report</link>
7424  *
7425  * GLib provides a framework for writing and maintaining unit tests
7426  * in parallel to the code they are testing. The API is designed according
7427  * to established concepts found in the other test frameworks (JUnit, NUnit,
7428  * RUnit), which in turn is based on smalltalk unit testing concepts.
7429  *
7430  * <variablelist>
7431  *   <varlistentry>
7432  *     <term>Test case</term>
7433  *     <listitem>Tests (test methods) are grouped together with their
7434  *       fixture into test cases.</listitem>
7435  *   </varlistentry>
7436  *   <varlistentry>
7437  *     <term>Fixture</term>
7438  *     <listitem>A test fixture consists of fixture data and setup and
7439  *       teardown methods to establish the environment for the test
7440  *       functions. We use fresh fixtures, i.e. fixtures are newly set
7441  *       up and torn down around each test invocation to avoid dependencies
7442  *       between tests.</listitem>
7443  *   </varlistentry>
7444  *   <varlistentry>
7445  *     <term>Test suite</term>
7446  *     <listitem>Test cases can be grouped into test suites, to allow
7447  *       subsets of the available tests to be run. Test suites can be
7448  *       grouped into other test suites as well.</listitem>
7449  *   </varlistentry>
7450  * </variablelist>
7451  * The API is designed to handle creation and registration of test suites
7452  * and test cases implicitly. A simple call like
7453  * |[
7454  *   g_test_add_func ("/misc/assertions", test_assertions);
7455  * ]|
7456  * creates a test suite called "misc" with a single test case named
7457  * "assertions", which consists of running the test_assertions function.
7458  *
7459  * In addition to the traditional g_assert(), the test framework provides
7460  * an extended set of assertions for string and numerical comparisons:
7461  * g_assert_cmpfloat(), g_assert_cmpint(), g_assert_cmpuint(),
7462  * g_assert_cmphex(), g_assert_cmpstr(). The advantage of these variants
7463  * over plain g_assert() is that the assertion messages can be more
7464  * elaborate, and include the values of the compared entities.
7465  *
7466  * GLib ships with two utilities called gtester and gtester-report to
7467  * facilitate running tests and producing nicely formatted test reports.
7468  */
7469
7470
7471 /**
7472  * SECTION:thread_pools
7473  * @title: Thread Pools
7474  * @short_description: pools of threads to execute work concurrently
7475  * @see_also: #GThread
7476  *
7477  * Sometimes you wish to asynchronously fork out the execution of work
7478  * and continue working in your own thread. If that will happen often,
7479  * the overhead of starting and destroying a thread each time might be
7480  * too high. In such cases reusing already started threads seems like a
7481  * good idea. And it indeed is, but implementing this can be tedious
7482  * and error-prone.
7483  *
7484  * Therefore GLib provides thread pools for your convenience. An added
7485  * advantage is, that the threads can be shared between the different
7486  * subsystems of your program, when they are using GLib.
7487  *
7488  * To create a new thread pool, you use g_thread_pool_new().
7489  * It is destroyed by g_thread_pool_free().
7490  *
7491  * If you want to execute a certain task within a thread pool,
7492  * you call g_thread_pool_push().
7493  *
7494  * To get the current number of running threads you call
7495  * g_thread_pool_get_num_threads(). To get the number of still
7496  * unprocessed tasks you call g_thread_pool_unprocessed(). To control
7497  * the maximal number of threads for a thread pool, you use
7498  * g_thread_pool_get_max_threads() and g_thread_pool_set_max_threads().
7499  *
7500  * Finally you can control the number of unused threads, that are kept
7501  * alive by GLib for future use. The current number can be fetched with
7502  * g_thread_pool_get_num_unused_threads(). The maximal number can be
7503  * controlled by g_thread_pool_get_max_unused_threads() and
7504  * g_thread_pool_set_max_unused_threads(). All currently unused threads
7505  * can be stopped by calling g_thread_pool_stop_unused_threads().
7506  */
7507
7508
7509 /**
7510  * SECTION:threads
7511  * @title: Threads
7512  * @short_description: portable support for threads, mutexes, locks, conditions and thread private data
7513  * @see_also: #GThreadPool, #GAsyncQueue
7514  *
7515  * Threads act almost like processes, but unlike processes all threads
7516  * of one process share the same memory. This is good, as it provides
7517  * easy communication between the involved threads via this shared
7518  * memory, and it is bad, because strange things (so called
7519  * "Heisenbugs") might happen if the program is not carefully designed.
7520  * In particular, due to the concurrent nature of threads, no
7521  * assumptions on the order of execution of code running in different
7522  * threads can be made, unless order is explicitly forced by the
7523  * programmer through synchronization primitives.
7524  *
7525  * The aim of the thread-related functions in GLib is to provide a
7526  * portable means for writing multi-threaded software. There are
7527  * primitives for mutexes to protect the access to portions of memory
7528  * (#GMutex, #GRecMutex and #GRWLock). There is a facility to use
7529  * individual bits for locks (g_bit_lock()). There are primitives
7530  * for condition variables to allow synchronization of threads (#GCond).
7531  * There are primitives for thread-private data - data that every
7532  * thread has a private instance of (#GPrivate). There are facilities
7533  * for one-time initialization (#GOnce, g_once_init_enter()). Finally,
7534  * there are primitives to create and manage threads (#GThread).
7535  *
7536  * The GLib threading system used to be initialized with g_thread_init().
7537  * This is no longer necessary. Since version 2.32, the GLib threading
7538  * system is automatically initialized at the start of your program,
7539  * and all thread-creation functions and synchronization primitives
7540  * are available right away.
7541  *
7542  * Note that it is not safe to assume that your program has no threads
7543  * even if you don't call g_thread_new() yourself. GLib and GIO can
7544  * and will create threads for their own purposes in some cases, such
7545  * as when using g_unix_signal_source_new() or when using GDBus.
7546  *
7547  * Originally, UNIX did not have threads, and therefore some traditional
7548  * UNIX APIs are problematic in threaded programs. Some notable examples
7549  * are
7550  * <itemizedlist>
7551  *   <listitem>
7552  *     C library functions that return data in statically allocated
7553  *     buffers, such as strtok() or strerror(). For many of these,
7554  *     there are thread-safe variants with a _r suffix, or you can
7555  *     look at corresponding GLib APIs (like g_strsplit() or g_strerror()).
7556  *   </listitem>
7557  *   <listitem>
7558  *     setenv() and unsetenv() manipulate the process environment in
7559  *     a not thread-safe way, and may interfere with getenv() calls
7560  *     in other threads. Note that getenv() calls may be
7561  *     <quote>hidden</quote> behind other APIs. For example, GNU gettext()
7562  *     calls getenv() under the covers. In general, it is best to treat
7563  *     the environment as readonly. If you absolutely have to modify the
7564  *     environment, do it early in main(), when no other threads are around yet.
7565  *   </listitem>
7566  *   <listitem>
7567  *     setlocale() changes the locale for the entire process, affecting
7568  *     all threads. Temporary changes to the locale are often made to
7569  *     change the behavior of string scanning or formatting functions
7570  *     like scanf() or printf(). GLib offers a number of string APIs
7571  *     (like g_ascii_formatd() or g_ascii_strtod()) that can often be
7572  *     used as an alternative. Or you can use the uselocale() function
7573  *     to change the locale only for the current thread.
7574  *   </listitem>
7575  *   <listitem>
7576  *     fork() only takes the calling thread into the child's copy of the
7577  *     process image.  If other threads were executing in critical
7578  *     sections they could have left mutexes locked which could easily
7579  *     cause deadlocks in the new child.  For this reason, you should
7580  *     call exit() or exec() as soon as possible in the child and only
7581  *     make signal-safe library calls before that.
7582  *   </listitem>
7583  *   <listitem>
7584  *     daemon() uses fork() in a way contrary to what is described
7585  *     above.  It should not be used with GLib programs.
7586  *   </listitem>
7587  * </itemizedlist>
7588  *
7589  * GLib itself is internally completely thread-safe (all global data is
7590  * automatically locked), but individual data structure instances are
7591  * not automatically locked for performance reasons. For example,
7592  * you must coordinate accesses to the same #GHashTable from multiple
7593  * threads. The two notable exceptions from this rule are #GMainLoop
7594  * and #GAsyncQueue, which <emphasis>are</emphasis> thread-safe and
7595  * need no further application-level locking to be accessed from
7596  * multiple threads. Most refcounting functions such as g_object_ref()
7597  * are also thread-safe.
7598  */
7599
7600
7601 /**
7602  * SECTION:timers
7603  * @title: Timers
7604  * @short_description: keep track of elapsed time
7605  *
7606  * #GTimer records a start time, and counts microseconds elapsed since
7607  * that time. This is done somewhat differently on different platforms,
7608  * and can be tricky to get exactly right, so #GTimer provides a
7609  * portable/convenient interface.
7610  */
7611
7612
7613 /**
7614  * SECTION:timezone
7615  * @title: GTimeZone
7616  * @short_description: a structure representing a time zone
7617  * @see_also: #GDateTime
7618  *
7619  * #GTimeZone is a structure that represents a time zone, at no
7620  * particular point in time.  It is refcounted and immutable.
7621  *
7622  * A time zone contains a number of intervals.  Each interval has
7623  * an abbreviation to describe it, an offet to UTC and a flag indicating
7624  * if the daylight savings time is in effect during that interval.  A
7625  * time zone always has at least one interval -- interval 0.
7626  *
7627  * Every UTC time is contained within exactly one interval, but a given
7628  * local time may be contained within zero, one or two intervals (due to
7629  * incontinuities associated with daylight savings time).
7630  *
7631  * An interval may refer to a specific period of time (eg: the duration
7632  * of daylight savings time during 2010) or it may refer to many periods
7633  * of time that share the same properties (eg: all periods of daylight
7634  * savings time).  It is also possible (usually for political reasons)
7635  * that some properties (like the abbreviation) change between intervals
7636  * without other properties changing.
7637  *
7638  * #GTimeZone is available since GLib 2.26.
7639  */
7640
7641
7642 /**
7643  * SECTION:trash_stack
7644  * @title: Trash Stacks
7645  * @short_description: maintain a stack of unused allocated memory chunks
7646  *
7647  * A #GTrashStack is an efficient way to keep a stack of unused allocated
7648  * memory chunks. Each memory chunk is required to be large enough to hold
7649  * a #gpointer. This allows the stack to be maintained without any space
7650  * overhead, since the stack pointers can be stored inside the memory chunks.
7651  *
7652  * There is no function to create a #GTrashStack. A %NULL #GTrashStack*
7653  * is a perfectly valid empty stack.
7654  */
7655
7656
7657 /**
7658  * SECTION:trees-binary
7659  * @title: Balanced Binary Trees
7660  * @short_description: a sorted collection of key/value pairs optimized for searching and traversing in order
7661  *
7662  * The #GTree structure and its associated functions provide a sorted
7663  * collection of key/value pairs optimized for searching and traversing
7664  * in order.
7665  *
7666  * To create a new #GTree use g_tree_new().
7667  *
7668  * To insert a key/value pair into a #GTree use g_tree_insert().
7669  *
7670  * To lookup the value corresponding to a given key, use
7671  * g_tree_lookup() and g_tree_lookup_extended().
7672  *
7673  * To find out the number of nodes in a #GTree, use g_tree_nnodes(). To
7674  * get the height of a #GTree, use g_tree_height().
7675  *
7676  * To traverse a #GTree, calling a function for each node visited in
7677  * the traversal, use g_tree_foreach().
7678  *
7679  * To remove a key/value pair use g_tree_remove().
7680  *
7681  * To destroy a #GTree, use g_tree_destroy().
7682  */
7683
7684
7685 /**
7686  * SECTION:trees-nary
7687  * @title: N-ary Trees
7688  * @short_description: trees of data with any number of branches
7689  *
7690  * The #GNode struct and its associated functions provide a N-ary tree
7691  * data structure, where nodes in the tree can contain arbitrary data.
7692  *
7693  * To create a new tree use g_node_new().
7694  *
7695  * To insert a node into a tree use g_node_insert(),
7696  * g_node_insert_before(), g_node_append() and g_node_prepend().
7697  *
7698  * To create a new node and insert it into a tree use
7699  * g_node_insert_data(), g_node_insert_data_after(),
7700  * g_node_insert_data_before(), g_node_append_data()
7701  * and g_node_prepend_data().
7702  *
7703  * To reverse the children of a node use g_node_reverse_children().
7704  *
7705  * To find a node use g_node_get_root(), g_node_find(),
7706  * g_node_find_child(), g_node_child_index(), g_node_child_position(),
7707  * g_node_first_child(), g_node_last_child(), g_node_nth_child(),
7708  * g_node_first_sibling(), g_node_prev_sibling(), g_node_next_sibling()
7709  * or g_node_last_sibling().
7710  *
7711  * To get information about a node or tree use G_NODE_IS_LEAF(),
7712  * G_NODE_IS_ROOT(), g_node_depth(), g_node_n_nodes(),
7713  * g_node_n_children(), g_node_is_ancestor() or g_node_max_height().
7714  *
7715  * To traverse a tree, calling a function for each node visited in the
7716  * traversal, use g_node_traverse() or g_node_children_foreach().
7717  *
7718  * To remove a node or subtree from a tree use g_node_unlink() or
7719  * g_node_destroy().
7720  */
7721
7722
7723 /**
7724  * SECTION:type_conversion
7725  * @title: Type Conversion Macros
7726  * @short_description: portably storing integers in pointer variables
7727  *
7728  * Many times GLib, GTK+, and other libraries allow you to pass "user
7729  * data" to a callback, in the form of a void pointer. From time to time
7730  * you want to pass an integer instead of a pointer. You could allocate
7731  * an integer, with something like:
7732  * |[
7733  *   int *ip = g_new (int, 1);
7734  *   *ip = 42;
7735  * ]|
7736  * But this is inconvenient, and it's annoying to have to free the
7737  * memory at some later time.
7738  *
7739  * Pointers are always at least 32 bits in size (on all platforms GLib
7740  * intends to support). Thus you can store at least 32-bit integer values
7741  * in a pointer value. Naively, you might try this, but it's incorrect:
7742  * |[
7743  *   gpointer p;
7744  *   int i;
7745  *   p = (void*) 42;
7746  *   i = (int) p;
7747  * ]|
7748  * Again, that example was <emphasis>not</emphasis> correct, don't copy it.
7749  * The problem is that on some systems you need to do this:
7750  * |[
7751  *   gpointer p;
7752  *   int i;
7753  *   p = (void*) (long) 42;
7754  *   i = (int) (long) p;
7755  * ]|
7756  * The GLib macros GPOINTER_TO_INT(), GINT_TO_POINTER(), etc. take care
7757  * to do the right thing on the every platform.
7758  *
7759  * <warning><para>You may not store pointers in integers. This is not
7760  * portable in any way, shape or form. These macros <emphasis>only</emphasis>
7761  * allow storing integers in pointers, and only preserve 32 bits of the
7762  * integer; values outside the range of a 32-bit integer will be mangled.
7763  * </para></warning>
7764  */
7765
7766
7767 /**
7768  * SECTION:types
7769  * @title: Basic Types
7770  * @short_description: standard GLib types, defined for ease-of-use and portability
7771  *
7772  * GLib defines a number of commonly used types, which can be divided
7773  * into 4 groups:
7774  * - New types which are not part of standard C (but are defined in
7775  *   various C standard library header files) - #gboolean, #gsize,
7776  *   #gssize, #goffset, #gintptr, #guintptr.
7777  * - Integer types which are guaranteed to be the same size across
7778  *   all platforms - #gint8, #guint8, #gint16, #guint16, #gint32,
7779  *   #guint32, #gint64, #guint64.
7780  * - Types which are easier to use than their standard C counterparts -
7781  *   #gpointer, #gconstpointer, #guchar, #guint, #gushort, #gulong.
7782  * - Types which correspond exactly to standard C types, but are
7783  *   included for completeness - #gchar, #gint, #gshort, #glong,
7784  *   #gfloat, #gdouble.
7785  *
7786  * GLib also defines macros for the limits of some of the standard
7787  * integer and floating point types, as well as macros for suitable
7788  * printf() formats for these types.
7789  */
7790
7791
7792 /**
7793  * SECTION:unicode
7794  * @Title: Unicode Manipulation
7795  * @Short_description: functions operating on Unicode characters and UTF-8 strings
7796  * @See_also: g_locale_to_utf8(), g_locale_from_utf8()
7797  *
7798  * This section describes a number of functions for dealing with
7799  * Unicode characters and strings.  There are analogues of the
7800  * traditional <filename>ctype.h</filename> character classification
7801  * and case conversion functions, UTF-8 analogues of some string utility
7802  * functions, functions to perform normalization, case conversion and
7803  * collation on UTF-8 strings and finally functions to convert between
7804  * the UTF-8, UTF-16 and UCS-4 encodings of Unicode.
7805  *
7806  * The implementations of the Unicode functions in GLib are based
7807  * on the Unicode Character Data tables, which are available from
7808  * <ulink url="http://www.unicode.org/">www.unicode.org</ulink>.
7809  * GLib 2.8 supports Unicode 4.0, GLib 2.10 supports Unicode 4.1,
7810  * GLib 2.12 supports Unicode 5.0, GLib 2.16.3 supports Unicode 5.1,
7811  * GLib 2.30 supports Unicode 6.0.
7812  */
7813
7814
7815 /**
7816  * SECTION:version
7817  * @Title: Version Information
7818  * @Short_description: variables and functions to check the GLib version
7819  *
7820  * GLib provides version information, primarily useful in configure
7821  * checks for builds that have a configure script. Applications will
7822  * not typically use the features described here.
7823  *
7824  * The GLib headers annotate deprecated APIs in a way that produces
7825  * compiler warnings if these deprecated APIs are used. The warnings
7826  * can be turned off by defining the macro %GLIB_DISABLE_DEPRECATION_WARNINGS
7827  * before including the glib.h header.
7828  *
7829  * GLib also provides support for building applications against
7830  * defined subsets of deprecated or new GLib APIs. Define the macro
7831  * %GLIB_VERSION_MIN_REQUIRED to specify up to what version of GLib
7832  * you want to receive warnings about deprecated APIs. Define the
7833  * macro %GLIB_VERSION_MAX_ALLOWED to specify the newest version of
7834  * GLib whose API you want to use.
7835  */
7836
7837
7838 /**
7839  * SECTION:warnings
7840  * @Title: Message Output and Debugging Functions
7841  * @Short_description: functions to output messages and help debug applications
7842  *
7843  * These functions provide support for outputting messages.
7844  *
7845  * The <function>g_return</function> family of macros (g_return_if_fail(),
7846  * g_return_val_if_fail(), g_return_if_reached(), g_return_val_if_reached())
7847  * should only be used for programming errors, a typical use case is
7848  * checking for invalid parameters at the beginning of a public function.
7849  * They should not be used if you just mean "if (error) return", they
7850  * should only be used if you mean "if (bug in program) return".
7851  * The program behavior is generally considered undefined after one
7852  * of these checks fails. They are not intended for normal control
7853  * flow, only to give a perhaps-helpful warning before giving up.
7854  */
7855
7856
7857 /**
7858  * SECTION:windows
7859  * @title: Windows Compatibility Functions
7860  * @short_description: UNIX emulation on Windows
7861  *
7862  * These functions provide some level of UNIX emulation on the
7863  * Windows platform. If your application really needs the POSIX
7864  * APIs, we suggest you try the Cygwin project.
7865  */
7866
7867
7868 /**
7869  * TRUE:
7870  *
7871  * Defines the %TRUE value for the #gboolean type.
7872  */
7873
7874
7875 /**
7876  * _:
7877  * @String: the string to be translated
7878  *
7879  * Marks a string for translation, gets replaced with the translated string
7880  * at runtime.
7881  *
7882  * Since: 2.4
7883  */
7884
7885
7886 /**
7887  * _glib_get_locale_dir:
7888  *
7889  * Return the path to the share\locale or lib\locale subfolder of the
7890  * GLib installation folder. The path is in the system codepage. We
7891  * have to use system codepage as bindtextdomain() doesn't have a
7892  * UTF-8 interface.
7893  */
7894
7895
7896 /**
7897  * g_access:
7898  * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows)
7899  * @mode: as in access()
7900  *
7901  * A wrapper for the POSIX access() function. This function is used to
7902  * test a pathname for one or several of read, write or execute
7903  * permissions, or just existence.
7904  *
7905  * On Windows, the file protection mechanism is not at all POSIX-like,
7906  * and the underlying function in the C library only checks the
7907  * FAT-style READONLY attribute, and does not look at the ACL of a
7908  * file at all. This function is this in practise almost useless on
7909  * Windows. Software that needs to handle file permissions on Windows
7910  * more exactly should use the Win32 API.
7911  *
7912  * See your C library manual for more details about access().
7913  *
7914  * Returns: zero if the pathname refers to an existing file system object that has all the tested permissions, or -1 otherwise or on error.
7915  * Since: 2.8
7916  */
7917
7918
7919 /**
7920  * g_array_append_val:
7921  * @a: a #GArray.
7922  * @v: the value to append to the #GArray.
7923  *
7924  * Adds the value on to the end of the array. The array will grow in
7925  * size automatically if necessary.
7926  *
7927  * <note><para>g_array_append_val() is a macro which uses a reference
7928  * to the value parameter @v. This means that you cannot use it with
7929  * literal values such as "27". You must use variables.</para></note>
7930  *
7931  * Returns: the #GArray.
7932  */
7933
7934
7935 /**
7936  * g_array_append_vals:
7937  * @array: a #GArray.
7938  * @data: a pointer to the elements to append to the end of the array.
7939  * @len: the number of elements to append.
7940  *
7941  * Adds @len elements onto the end of the array.
7942  *
7943  * Returns: the #GArray.
7944  */
7945
7946
7947 /**
7948  * g_array_free:
7949  * @array: a #GArray.
7950  * @free_segment: if %TRUE the actual element data is freed as well.
7951  *
7952  * Frees the memory allocated for the #GArray. If @free_segment is
7953  * %TRUE it frees the memory block holding the elements as well and
7954  * also each element if @array has a @element_free_func set. Pass
7955  * %FALSE if you want to free the #GArray wrapper but preserve the
7956  * underlying array for use elsewhere. If the reference count of @array
7957  * is greater than one, the #GArray wrapper is preserved but the size
7958  * of @array will be set to zero.
7959  *
7960  * <note><para>If array elements contain dynamically-allocated memory,
7961  * they should be freed separately.</para></note>
7962  *
7963  * Returns: the element data if @free_segment is %FALSE, otherwise %NULL.  The element data should be freed using g_free().
7964  */
7965
7966
7967 /**
7968  * g_array_get_element_size:
7969  * @array: A #GArray.
7970  *
7971  * Gets the size of the elements in @array.
7972  *
7973  * Returns: Size of each element, in bytes.
7974  * Since: 2.22
7975  */
7976
7977
7978 /**
7979  * g_array_index:
7980  * @a: a #GArray.
7981  * @t: the type of the elements.
7982  * @i: the index of the element to return.
7983  *
7984  * Returns the element of a #GArray at the given index. The return
7985  * value is cast to the given type.
7986  *
7987  * <example>
7988  *  <title>Getting a pointer to an element in a #GArray</title>
7989  *  <programlisting>
7990  *   EDayViewEvent *event;
7991  *   /<!-- -->* This gets a pointer to the 4th element
7992  *      in the array of EDayViewEvent structs. *<!-- -->/
7993  *   event = &amp;g_array_index (events, EDayViewEvent, 3);
7994  *  </programlisting>
7995  * </example>
7996  *
7997  * Returns: the element of the #GArray at the index given by @i.
7998  */
7999
8000
8001 /**
8002  * g_array_insert_val:
8003  * @a: a #GArray.
8004  * @i: the index to place the element at.
8005  * @v: the value to insert into the array.
8006  *
8007  * Inserts an element into an array at the given index.
8008  *
8009  * <note><para>g_array_insert_val() is a macro which uses a reference
8010  * to the value parameter @v. This means that you cannot use it with
8011  * literal values such as "27". You must use variables.</para></note>
8012  *
8013  * Returns: the #GArray.
8014  */
8015
8016
8017 /**
8018  * g_array_insert_vals:
8019  * @array: a #GArray.
8020  * @index_: the index to place the elements at.
8021  * @data: a pointer to the elements to insert.
8022  * @len: the number of elements to insert.
8023  *
8024  * Inserts @len elements into a #GArray at the given index.
8025  *
8026  * Returns: the #GArray.
8027  */
8028
8029
8030 /**
8031  * g_array_new:
8032  * @zero_terminated: %TRUE if the array should have an extra element at the end which is set to 0.
8033  * @clear_: %TRUE if #GArray elements should be automatically cleared to 0 when they are allocated.
8034  * @element_size: the size of each element in bytes.
8035  *
8036  * Creates a new #GArray with a reference count of 1.
8037  *
8038  * Returns: the new #GArray.
8039  */
8040
8041
8042 /**
8043  * g_array_prepend_val:
8044  * @a: a #GArray.
8045  * @v: the value to prepend to the #GArray.
8046  *
8047  * Adds the value on to the start of the array. The array will grow in
8048  * size automatically if necessary.
8049  *
8050  * This operation is slower than g_array_append_val() since the
8051  * existing elements in the array have to be moved to make space for
8052  * the new element.
8053  *
8054  * <note><para>g_array_prepend_val() is a macro which uses a reference
8055  * to the value parameter @v. This means that you cannot use it with
8056  * literal values such as "27". You must use variables.</para></note>
8057  *
8058  * Returns: the #GArray.
8059  */
8060
8061
8062 /**
8063  * g_array_prepend_vals:
8064  * @array: a #GArray.
8065  * @data: a pointer to the elements to prepend to the start of the array.
8066  * @len: the number of elements to prepend.
8067  *
8068  * Adds @len elements onto the start of the array.
8069  *
8070  * This operation is slower than g_array_append_vals() since the
8071  * existing elements in the array have to be moved to make space for
8072  * the new elements.
8073  *
8074  * Returns: the #GArray.
8075  */
8076
8077
8078 /**
8079  * g_array_ref:
8080  * @array: A #GArray.
8081  *
8082  * Atomically increments the reference count of @array by one. This
8083  * function is MT-safe and may be called from any thread.
8084  *
8085  * Returns: The passed in #GArray.
8086  * Since: 2.22
8087  */
8088
8089
8090 /**
8091  * g_array_remove_index:
8092  * @array: a #GArray.
8093  * @index_: the index of the element to remove.
8094  *
8095  * Removes the element at the given index from a #GArray. The following
8096  * elements are moved down one place.
8097  *
8098  * Returns: the #GArray.
8099  */
8100
8101
8102 /**
8103  * g_array_remove_index_fast:
8104  * @array: a @GArray.
8105  * @index_: the index of the element to remove.
8106  *
8107  * Removes the element at the given index from a #GArray. The last
8108  * element in the array is used to fill in the space, so this function
8109  * does not preserve the order of the #GArray. But it is faster than
8110  * g_array_remove_index().
8111  *
8112  * Returns: the #GArray.
8113  */
8114
8115
8116 /**
8117  * g_array_remove_range:
8118  * @array: a @GArray.
8119  * @index_: the index of the first element to remove.
8120  * @length: the number of elements to remove.
8121  *
8122  * Removes the given number of elements starting at the given index
8123  * from a #GArray.  The following elements are moved to close the gap.
8124  *
8125  * Returns: the #GArray.
8126  * Since: 2.4
8127  */
8128
8129
8130 /**
8131  * g_array_set_clear_func:
8132  * @array: A #GArray
8133  * @clear_func: a function to clear an element of @array
8134  *
8135  * Sets a function to clear an element of @array.
8136  *
8137  * The @clear_func will be called when an element in the array
8138  * data segment is removed and when the array is freed and data
8139  * segment is deallocated as well.
8140  *
8141  * Note that in contrast with other uses of #GDestroyNotify
8142  * functions, @clear_func is expected to clear the contents of
8143  * the array element it is given, but not free the element itself.
8144  *
8145  * Since: 2.32
8146  */
8147
8148
8149 /**
8150  * g_array_set_size:
8151  * @array: a #GArray.
8152  * @length: the new size of the #GArray.
8153  *
8154  * Sets the size of the array, expanding it if necessary. If the array
8155  * was created with @clear_ set to %TRUE, the new elements are set to 0.
8156  *
8157  * Returns: the #GArray.
8158  */
8159
8160
8161 /**
8162  * g_array_sized_new:
8163  * @zero_terminated: %TRUE if the array should have an extra element at the end with all bits cleared.
8164  * @clear_: %TRUE if all bits in the array should be cleared to 0 on allocation.
8165  * @element_size: size of each element in the array.
8166  * @reserved_size: number of elements preallocated.
8167  *
8168  * Creates a new #GArray with @reserved_size elements preallocated and
8169  * a reference count of 1. This avoids frequent reallocation, if you
8170  * are going to add many elements to the array. Note however that the
8171  * size of the array is still 0.
8172  *
8173  * Returns: the new #GArray.
8174  */
8175
8176
8177 /**
8178  * g_array_sort:
8179  * @array: a #GArray.
8180  * @compare_func: comparison function.
8181  *
8182  * Sorts a #GArray using @compare_func which should be a qsort()-style
8183  * comparison function (returns less than zero for first arg is less
8184  * than second arg, zero for equal, greater zero if first arg is
8185  * greater than second arg).
8186  *
8187  * This is guaranteed to be a stable sort since version 2.32.
8188  */
8189
8190
8191 /**
8192  * g_array_sort_with_data:
8193  * @array: a #GArray.
8194  * @compare_func: comparison function.
8195  * @user_data: data to pass to @compare_func.
8196  *
8197  * Like g_array_sort(), but the comparison function receives an extra
8198  * user data argument.
8199  *
8200  * This is guaranteed to be a stable sort since version 2.32.
8201  *
8202  * There used to be a comment here about making the sort stable by
8203  * using the addresses of the elements in the comparison function.
8204  * This did not actually work, so any such code should be removed.
8205  */
8206
8207
8208 /**
8209  * g_array_unref:
8210  * @array: A #GArray.
8211  *
8212  * Atomically decrements the reference count of @array by one. If the
8213  * reference count drops to 0, all memory allocated by the array is
8214  * released. This function is MT-safe and may be called from any
8215  * thread.
8216  *
8217  * Since: 2.22
8218  */
8219
8220
8221 /**
8222  * g_ascii_digit_value:
8223  * @c: an ASCII character.
8224  *
8225  * Determines the numeric value of a character as a decimal
8226  * digit. Differs from g_unichar_digit_value() because it takes
8227  * a char, so there's no worry about sign extension if characters
8228  * are signed.
8229  *
8230  * Returns: If @c is a decimal digit (according to g_ascii_isdigit()), its numeric value. Otherwise, -1.
8231  */
8232
8233
8234 /**
8235  * g_ascii_dtostr:
8236  * @buffer: A buffer to place the resulting string in
8237  * @buf_len: The length of the buffer.
8238  * @d: The #gdouble to convert
8239  *
8240  * Converts a #gdouble to a string, using the '.' as
8241  * decimal point.
8242  *
8243  * This functions generates enough precision that converting
8244  * the string back using g_ascii_strtod() gives the same machine-number
8245  * (on machines with IEEE compatible 64bit doubles). It is
8246  * guaranteed that the size of the resulting string will never
8247  * be larger than @G_ASCII_DTOSTR_BUF_SIZE bytes.
8248  *
8249  * Returns: The pointer to the buffer with the converted string.
8250  */
8251
8252
8253 /**
8254  * g_ascii_formatd:
8255  * @buffer: A buffer to place the resulting string in
8256  * @buf_len: The length of the buffer.
8257  * @format: The printf()-style format to use for the code to use for converting.
8258  * @d: The #gdouble to convert
8259  *
8260  * Converts a #gdouble to a string, using the '.' as
8261  * decimal point. To format the number you pass in
8262  * a printf()-style format string. Allowed conversion
8263  * specifiers are 'e', 'E', 'f', 'F', 'g' and 'G'.
8264  *
8265  * If you just want to want to serialize the value into a
8266  * string, use g_ascii_dtostr().
8267  *
8268  * Returns: The pointer to the buffer with the converted string.
8269  */
8270
8271
8272 /**
8273  * g_ascii_isalnum:
8274  * @c: any character
8275  *
8276  * Determines whether a character is alphanumeric.
8277  *
8278  * Unlike the standard C library isalnum() function, this only
8279  * recognizes standard ASCII letters and ignores the locale,
8280  * returning %FALSE for all non-ASCII characters. Also, unlike
8281  * the standard library function, this takes a <type>char</type>,
8282  * not an <type>int</type>, so don't call it on <literal>EOF</literal>, but no need to
8283  * cast to #guchar before passing a possibly non-ASCII character in.
8284  *
8285  * Returns: %TRUE if @c is an ASCII alphanumeric character
8286  */
8287
8288
8289 /**
8290  * g_ascii_isalpha:
8291  * @c: any character
8292  *
8293  * Determines whether a character is alphabetic (i.e. a letter).
8294  *
8295  * Unlike the standard C library isalpha() function, this only
8296  * recognizes standard ASCII letters and ignores the locale,
8297  * returning %FALSE for all non-ASCII characters. Also, unlike
8298  * the standard library function, this takes a <type>char</type>,
8299  * not an <type>int</type>, so don't call it on <literal>EOF</literal>, but no need to
8300  * cast to #guchar before passing a possibly non-ASCII character in.
8301  *
8302  * Returns: %TRUE if @c is an ASCII alphabetic character
8303  */
8304
8305
8306 /**
8307  * g_ascii_iscntrl:
8308  * @c: any character
8309  *
8310  * Determines whether a character is a control character.
8311  *
8312  * Unlike the standard C library iscntrl() function, this only
8313  * recognizes standard ASCII control characters and ignores the
8314  * locale, returning %FALSE for all non-ASCII characters. Also,
8315  * unlike the standard library function, this takes a <type>char</type>,
8316  * not an <type>int</type>, so don't call it on <literal>EOF</literal>, but no need to
8317  * cast to #guchar before passing a possibly non-ASCII character in.
8318  *
8319  * Returns: %TRUE if @c is an ASCII control character.
8320  */
8321
8322
8323 /**
8324  * g_ascii_isdigit:
8325  * @c: any character
8326  *
8327  * Determines whether a character is digit (0-9).
8328  *
8329  * Unlike the standard C library isdigit() function, this takes
8330  * a <type>char</type>, not an <type>int</type>, so don't call it
8331  * on <literal>EOF</literal>, but no need to cast to #guchar before passing a possibly
8332  * non-ASCII character in.
8333  *
8334  * Returns: %TRUE if @c is an ASCII digit.
8335  */
8336
8337
8338 /**
8339  * g_ascii_isgraph:
8340  * @c: any character
8341  *
8342  * Determines whether a character is a printing character and not a space.
8343  *
8344  * Unlike the standard C library isgraph() function, this only
8345  * recognizes standard ASCII characters and ignores the locale,
8346  * returning %FALSE for all non-ASCII characters. Also, unlike
8347  * the standard library function, this takes a <type>char</type>,
8348  * not an <type>int</type>, so don't call it on <literal>EOF</literal>, but no need
8349  * to cast to #guchar before passing a possibly non-ASCII character in.
8350  *
8351  * Returns: %TRUE if @c is an ASCII printing character other than space.
8352  */
8353
8354
8355 /**
8356  * g_ascii_islower:
8357  * @c: any character
8358  *
8359  * Determines whether a character is an ASCII lower case letter.
8360  *
8361  * Unlike the standard C library islower() function, this only
8362  * recognizes standard ASCII letters and ignores the locale,
8363  * returning %FALSE for all non-ASCII characters. Also, unlike
8364  * the standard library function, this takes a <type>char</type>,
8365  * not an <type>int</type>, so don't call it on <literal>EOF</literal>, but no need
8366  * to worry about casting to #guchar before passing a possibly
8367  * non-ASCII character in.
8368  *
8369  * Returns: %TRUE if @c is an ASCII lower case letter
8370  */
8371
8372
8373 /**
8374  * g_ascii_isprint:
8375  * @c: any character
8376  *
8377  * Determines whether a character is a printing character.
8378  *
8379  * Unlike the standard C library isprint() function, this only
8380  * recognizes standard ASCII characters and ignores the locale,
8381  * returning %FALSE for all non-ASCII characters. Also, unlike
8382  * the standard library function, this takes a <type>char</type>,
8383  * not an <type>int</type>, so don't call it on <literal>EOF</literal>, but no need
8384  * to cast to #guchar before passing a possibly non-ASCII character in.
8385  *
8386  * Returns: %TRUE if @c is an ASCII printing character.
8387  */
8388
8389
8390 /**
8391  * g_ascii_ispunct:
8392  * @c: any character
8393  *
8394  * Determines whether a character is a punctuation character.
8395  *
8396  * Unlike the standard C library ispunct() function, this only
8397  * recognizes standard ASCII letters and ignores the locale,
8398  * returning %FALSE for all non-ASCII characters. Also, unlike
8399  * the standard library function, this takes a <type>char</type>,
8400  * not an <type>int</type>, so don't call it on <literal>EOF</literal>, but no need to
8401  * cast to #guchar before passing a possibly non-ASCII character in.
8402  *
8403  * Returns: %TRUE if @c is an ASCII punctuation character.
8404  */
8405
8406
8407 /**
8408  * g_ascii_isspace:
8409  * @c: any character
8410  *
8411  * Determines whether a character is a white-space character.
8412  *
8413  * Unlike the standard C library isspace() function, this only
8414  * recognizes standard ASCII white-space and ignores the locale,
8415  * returning %FALSE for all non-ASCII characters. Also, unlike
8416  * the standard library function, this takes a <type>char</type>,
8417  * not an <type>int</type>, so don't call it on <literal>EOF</literal>, but no need to
8418  * cast to #guchar before passing a possibly non-ASCII character in.
8419  *
8420  * Returns: %TRUE if @c is an ASCII white-space character
8421  */
8422
8423
8424 /**
8425  * g_ascii_isupper:
8426  * @c: any character
8427  *
8428  * Determines whether a character is an ASCII upper case letter.
8429  *
8430  * Unlike the standard C library isupper() function, this only
8431  * recognizes standard ASCII letters and ignores the locale,
8432  * returning %FALSE for all non-ASCII characters. Also, unlike
8433  * the standard library function, this takes a <type>char</type>,
8434  * not an <type>int</type>, so don't call it on <literal>EOF</literal>, but no need to
8435  * worry about casting to #guchar before passing a possibly non-ASCII
8436  * character in.
8437  *
8438  * Returns: %TRUE if @c is an ASCII upper case letter
8439  */
8440
8441
8442 /**
8443  * g_ascii_isxdigit:
8444  * @c: any character
8445  *
8446  * Determines whether a character is a hexadecimal-digit character.
8447  *
8448  * Unlike the standard C library isxdigit() function, this takes
8449  * a <type>char</type>, not an <type>int</type>, so don't call it
8450  * on <literal>EOF</literal>, but no need to cast to #guchar before passing a
8451  * possibly non-ASCII character in.
8452  *
8453  * Returns: %TRUE if @c is an ASCII hexadecimal-digit character.
8454  */
8455
8456
8457 /**
8458  * g_ascii_strcasecmp:
8459  * @s1: string to compare with @s2.
8460  * @s2: string to compare with @s1.
8461  *
8462  * Compare two strings, ignoring the case of ASCII characters.
8463  *
8464  * Unlike the BSD strcasecmp() function, this only recognizes standard
8465  * ASCII letters and ignores the locale, treating all non-ASCII
8466  * bytes as if they are not letters.
8467  *
8468  * This function should be used only on strings that are known to be
8469  * in encodings where the bytes corresponding to ASCII letters always
8470  * represent themselves. This includes UTF-8 and the ISO-8859-*
8471  * charsets, but not for instance double-byte encodings like the
8472  * Windows Codepage 932, where the trailing bytes of double-byte
8473  * characters include all ASCII letters. If you compare two CP932
8474  * strings using this function, you will get false matches.
8475  *
8476  * Returns: 0 if the strings match, a negative value if @s1 &lt; @s2, or a positive value if @s1 &gt; @s2.
8477  */
8478
8479
8480 /**
8481  * g_ascii_strdown:
8482  * @str: a string.
8483  * @len: length of @str in bytes, or -1 if @str is nul-terminated.
8484  *
8485  * Converts all upper case ASCII letters to lower case ASCII letters.
8486  *
8487  * 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.)
8488  */
8489
8490
8491 /**
8492  * g_ascii_strncasecmp:
8493  * @s1: string to compare with @s2.
8494  * @s2: string to compare with @s1.
8495  * @n: number of characters to compare.
8496  *
8497  * Compare @s1 and @s2, ignoring the case of ASCII characters and any
8498  * characters after the first @n in each string.
8499  *
8500  * Unlike the BSD strcasecmp() function, this only recognizes standard
8501  * ASCII letters and ignores the locale, treating all non-ASCII
8502  * characters as if they are not letters.
8503  *
8504  * The same warning as in g_ascii_strcasecmp() applies: Use this
8505  * function only on strings known to be in encodings where bytes
8506  * corresponding to ASCII letters always represent themselves.
8507  *
8508  * Returns: 0 if the strings match, a negative value if @s1 &lt; @s2, or a positive value if @s1 &gt; @s2.
8509  */
8510
8511
8512 /**
8513  * g_ascii_strtod:
8514  * @nptr: the string to convert to a numeric value.
8515  * @endptr: if non-%NULL, it returns the character after the last character used in the conversion.
8516  *
8517  * Converts a string to a #gdouble value.
8518  *
8519  * This function behaves like the standard strtod() function
8520  * does in the C locale. It does this without actually changing
8521  * the current locale, since that would not be thread-safe.
8522  * A limitation of the implementation is that this function
8523  * will still accept localized versions of infinities and NANs.
8524  *
8525  * This function is typically used when reading configuration
8526  * files or other non-user input that should be locale independent.
8527  * To handle input from the user you should normally use the
8528  * locale-sensitive system strtod() function.
8529  *
8530  * To convert from a #gdouble to a string in a locale-insensitive
8531  * way, use g_ascii_dtostr().
8532  *
8533  * If the correct value would cause overflow, plus or minus <literal>HUGE_VAL</literal>
8534  * is returned (according to the sign of the value), and <literal>ERANGE</literal> is
8535  * stored in <literal>errno</literal>. If the correct value would cause underflow,
8536  * zero is returned and <literal>ERANGE</literal> is stored in <literal>errno</literal>.
8537  *
8538  * This function resets <literal>errno</literal> before calling strtod() so that
8539  * you can reliably detect overflow and underflow.
8540  *
8541  * Returns: the #gdouble value.
8542  */
8543
8544
8545 /**
8546  * g_ascii_strtoll:
8547  * @nptr: the string to convert to a numeric value.
8548  * @endptr: if non-%NULL, it returns the character after the last character used in the conversion.
8549  * @base: to be used for the conversion, 2..36 or 0
8550  *
8551  * Converts a string to a #gint64 value.
8552  * This function behaves like the standard strtoll() function
8553  * does in the C locale. It does this without actually
8554  * changing the current locale, since that would not be
8555  * thread-safe.
8556  *
8557  * This function is typically used when reading configuration
8558  * files or other non-user input that should be locale independent.
8559  * To handle input from the user you should normally use the
8560  * locale-sensitive system strtoll() function.
8561  *
8562  * If the correct value would cause overflow, %G_MAXINT64 or %G_MININT64
8563  * is returned, and <literal>ERANGE</literal> is stored in <literal>errno</literal>.
8564  * If the base is outside the valid range, zero is returned, and
8565  * <literal>EINVAL</literal> is stored in <literal>errno</literal>. If the
8566  * string conversion fails, zero is returned, and @endptr returns @nptr
8567  * (if @endptr is non-%NULL).
8568  *
8569  * Returns: the #gint64 value or zero on error.
8570  * Since: 2.12
8571  */
8572
8573
8574 /**
8575  * g_ascii_strtoull:
8576  * @nptr: the string to convert to a numeric value.
8577  * @endptr: if non-%NULL, it returns the character after the last character used in the conversion.
8578  * @base: to be used for the conversion, 2..36 or 0
8579  *
8580  * Converts a string to a #guint64 value.
8581  * This function behaves like the standard strtoull() function
8582  * does in the C locale. It does this without actually
8583  * changing the current locale, since that would not be
8584  * thread-safe.
8585  *
8586  * This function is typically used when reading configuration
8587  * files or other non-user input that should be locale independent.
8588  * To handle input from the user you should normally use the
8589  * locale-sensitive system strtoull() function.
8590  *
8591  * If the correct value would cause overflow, %G_MAXUINT64
8592  * is returned, and <literal>ERANGE</literal> is stored in <literal>errno</literal>.
8593  * If the base is outside the valid range, zero is returned, and
8594  * <literal>EINVAL</literal> is stored in <literal>errno</literal>.
8595  * If the string conversion fails, zero is returned, and @endptr returns
8596  * @nptr (if @endptr is non-%NULL).
8597  *
8598  * Returns: the #guint64 value or zero on error.
8599  * Since: 2.2
8600  */
8601
8602
8603 /**
8604  * g_ascii_strup:
8605  * @str: a string.
8606  * @len: length of @str in bytes, or -1 if @str is nul-terminated.
8607  *
8608  * Converts all lower case ASCII letters to upper case ASCII letters.
8609  *
8610  * 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.)
8611  */
8612
8613
8614 /**
8615  * g_ascii_tolower:
8616  * @c: any character.
8617  *
8618  * Convert a character to ASCII lower case.
8619  *
8620  * Unlike the standard C library tolower() function, this only
8621  * recognizes standard ASCII letters and ignores the locale, returning
8622  * all non-ASCII characters unchanged, even if they are lower case
8623  * letters in a particular character set. Also unlike the standard
8624  * library function, this takes and returns a char, not an int, so
8625  * don't call it on <literal>EOF</literal> but no need to worry about casting to #guchar
8626  * before passing a possibly non-ASCII character in.
8627  *
8628  * Returns: the result of converting @c to lower case. If @c is not an ASCII upper case letter, @c is returned unchanged.
8629  */
8630
8631
8632 /**
8633  * g_ascii_toupper:
8634  * @c: any character.
8635  *
8636  * Convert a character to ASCII upper case.
8637  *
8638  * Unlike the standard C library toupper() function, this only
8639  * recognizes standard ASCII letters and ignores the locale, returning
8640  * all non-ASCII characters unchanged, even if they are upper case
8641  * letters in a particular character set. Also unlike the standard
8642  * library function, this takes and returns a char, not an int, so
8643  * don't call it on <literal>EOF</literal> but no need to worry about casting to #guchar
8644  * before passing a possibly non-ASCII character in.
8645  *
8646  * Returns: the result of converting @c to upper case. If @c is not an ASCII lower case letter, @c is returned unchanged.
8647  */
8648
8649
8650 /**
8651  * g_ascii_xdigit_value:
8652  * @c: an ASCII character.
8653  *
8654  * Determines the numeric value of a character as a hexidecimal
8655  * digit. Differs from g_unichar_xdigit_value() because it takes
8656  * a char, so there's no worry about sign extension if characters
8657  * are signed.
8658  *
8659  * Returns: If @c is a hex digit (according to g_ascii_isxdigit()), its numeric value. Otherwise, -1.
8660  */
8661
8662
8663 /**
8664  * g_assert:
8665  * @expr: the expression to check
8666  *
8667  * Debugging macro to terminate the application if the assertion
8668  * fails. If the assertion fails (i.e. the expression is not true),
8669  * an error message is logged and the application is terminated.
8670  *
8671  * The macro can be turned off in final releases of code by defining
8672  * <envar>G_DISABLE_ASSERT</envar> when compiling the application.
8673  */
8674
8675
8676 /**
8677  * g_assert_cmpfloat:
8678  * @n1: an floating point number
8679  * @cmp: The comparison operator to use. One of ==, !=, &lt;, &gt;, &lt;=, &gt;=.
8680  * @n2: another floating point number
8681  *
8682  * Debugging macro to terminate the application with a warning
8683  * message if a floating point number comparison fails.
8684  *
8685  * The effect of <literal>g_assert_cmpfloat (n1, op, n2)</literal> is
8686  * the same as <literal>g_assert (n1 op n2)</literal>. The advantage
8687  * of this macro is that it can produce a message that includes the
8688  * actual values of @n1 and @n2.
8689  *
8690  * Since: 2.16
8691  */
8692
8693
8694 /**
8695  * g_assert_cmphex:
8696  * @n1: an unsigned integer
8697  * @cmp: The comparison operator to use. One of ==, !=, &lt;, &gt;, &lt;=, &gt;=.
8698  * @n2: another unsigned integer
8699  *
8700  * Debugging macro to terminate the application with a warning
8701  * message if an unsigned integer comparison fails.
8702  *
8703  * This is a variant of g_assert_cmpuint() that displays the numbers
8704  * in hexadecimal notation in the message.
8705  *
8706  * Since: 2.16
8707  */
8708
8709
8710 /**
8711  * g_assert_cmpint:
8712  * @n1: an integer
8713  * @cmp: The comparison operator to use. One of ==, !=, &lt;, &gt;, &lt;=, &gt;=.
8714  * @n2: another integer
8715  *
8716  * Debugging macro to terminate the application with a warning
8717  * message if an integer comparison fails.
8718  *
8719  * The effect of <literal>g_assert_cmpint (n1, op, n2)</literal> is
8720  * the same as <literal>g_assert (n1 op n2)</literal>. The advantage
8721  * of this macro is that it can produce a message that includes the
8722  * actual values of @n1 and @n2.
8723  *
8724  * Since: 2.16
8725  */
8726
8727
8728 /**
8729  * g_assert_cmpstr:
8730  * @s1: a string (may be %NULL)
8731  * @cmp: The comparison operator to use. One of ==, !=, &lt;, &gt;, &lt;=, &gt;=.
8732  * @s2: another string (may be %NULL)
8733  *
8734  * Debugging macro to terminate the application with a warning
8735  * message if a string comparison fails. The strings are compared
8736  * using g_strcmp0().
8737  *
8738  * The effect of <literal>g_assert_cmpstr (s1, op, s2)</literal> is
8739  * the same as <literal>g_assert (g_strcmp0 (s1, s2) op 0)</literal>.
8740  * The advantage of this macro is that it can produce a message that
8741  * includes the actual values of @s1 and @s2.
8742  *
8743  * |[
8744  *   g_assert_cmpstr (mystring, ==, "fubar");
8745  * ]|
8746  *
8747  * Since: 2.16
8748  */
8749
8750
8751 /**
8752  * g_assert_cmpuint:
8753  * @n1: an unsigned integer
8754  * @cmp: The comparison operator to use. One of ==, !=, &lt;, &gt;, &lt;=, &gt;=.
8755  * @n2: another unsigned integer
8756  *
8757  * Debugging macro to terminate the application with a warning
8758  * message if an unsigned integer comparison fails.
8759  *
8760  * The effect of <literal>g_assert_cmpuint (n1, op, n2)</literal> is
8761  * the same as <literal>g_assert (n1 op n2)</literal>. The advantage
8762  * of this macro is that it can produce a message that includes the
8763  * actual values of @n1 and @n2.
8764  *
8765  * Since: 2.16
8766  */
8767
8768
8769 /**
8770  * g_assert_error:
8771  * @err: a #GError, possibly %NULL
8772  * @dom: the expected error domain (a #GQuark)
8773  * @c: the expected error code
8774  *
8775  * Debugging macro to terminate the application with a warning
8776  * message if a method has not returned the correct #GError.
8777  *
8778  * The effect of <literal>g_assert_error (err, dom, c)</literal> is
8779  * the same as <literal>g_assert (err != NULL &amp;&amp; err->domain
8780  * == dom &amp;&amp; err->code == c)</literal>. The advantage of this
8781  * macro is that it can produce a message that includes the incorrect
8782  * error message and code.
8783  *
8784  * This can only be used to test for a specific error. If you want to
8785  * test that @err is set, but don't care what it's set to, just use
8786  * <literal>g_assert (err != NULL)</literal>
8787  *
8788  * Since: 2.20
8789  */
8790
8791
8792 /**
8793  * g_assert_no_error:
8794  * @err: a #GError, possibly %NULL
8795  *
8796  * Debugging macro to terminate the application with a warning
8797  * message if a method has returned a #GError.
8798  *
8799  * The effect of <literal>g_assert_no_error (err)</literal> is
8800  * the same as <literal>g_assert (err == NULL)</literal>. The advantage
8801  * of this macro is that it can produce a message that includes
8802  * the error message and code.
8803  *
8804  * Since: 2.20
8805  */
8806
8807
8808 /**
8809  * g_assert_not_reached:
8810  *
8811  * Debugging macro to terminate the application if it is ever
8812  * reached. If it is reached, an error message is logged and the
8813  * application is terminated.
8814  *
8815  * The macro can be turned off in final releases of code by defining
8816  * <envar>G_DISABLE_ASSERT</envar> when compiling the application.
8817  */
8818
8819
8820 /**
8821  * g_async_queue_length:
8822  * @queue: a #GAsyncQueue.
8823  *
8824  * Returns the length of the queue.
8825  *
8826  * Actually this function returns the number of data items in
8827  * the queue minus the number of waiting threads, so a negative
8828  * value means waiting threads, and a positive value means available
8829  * entries in the @queue. A return value of 0 could mean n entries
8830  * in the queue and n threads waiting. This can happen due to locking
8831  * of the queue or due to scheduling.
8832  *
8833  * Returns: the length of the @queue
8834  */
8835
8836
8837 /**
8838  * g_async_queue_length_unlocked:
8839  * @queue: a #GAsyncQueue
8840  *
8841  * Returns the length of the queue.
8842  *
8843  * Actually this function returns the number of data items in
8844  * the queue minus the number of waiting threads, so a negative
8845  * value means waiting threads, and a positive value means available
8846  * entries in the @queue. A return value of 0 could mean n entries
8847  * in the queue and n threads waiting. This can happen due to locking
8848  * of the queue or due to scheduling.
8849  *
8850  * This function must be called while holding the @queue's lock.
8851  *
8852  * Returns: the length of the @queue.
8853  */
8854
8855
8856 /**
8857  * g_async_queue_lock:
8858  * @queue: a #GAsyncQueue
8859  *
8860  * Acquires the @queue's lock. If another thread is already
8861  * holding the lock, this call will block until the lock
8862  * becomes available.
8863  *
8864  * Call g_async_queue_unlock() to drop the lock again.
8865  *
8866  * While holding the lock, you can only call the
8867  * <function>g_async_queue_*_unlocked()</function> functions
8868  * on @queue. Otherwise, deadlock may occur.
8869  */
8870
8871
8872 /**
8873  * g_async_queue_new:
8874  *
8875  * Creates a new asynchronous queue.
8876  *
8877  * Returns: a new #GAsyncQueue. Free with g_async_queue_unref()
8878  */
8879
8880
8881 /**
8882  * g_async_queue_new_full:
8883  * @item_free_func: function to free queue elements
8884  *
8885  * Creates a new asynchronous queue and sets up a destroy notify
8886  * function that is used to free any remaining queue items when
8887  * the queue is destroyed after the final unref.
8888  *
8889  * Returns: a new #GAsyncQueue. Free with g_async_queue_unref()
8890  * Since: 2.16
8891  */
8892
8893
8894 /**
8895  * g_async_queue_pop:
8896  * @queue: a #GAsyncQueue
8897  *
8898  * Pops data from the @queue. If @queue is empty, this function
8899  * blocks until data becomes available.
8900  *
8901  * Returns: data from the queue
8902  */
8903
8904
8905 /**
8906  * g_async_queue_pop_unlocked:
8907  * @queue: a #GAsyncQueue
8908  *
8909  * Pops data from the @queue. If @queue is empty, this function
8910  * blocks until data becomes available.
8911  *
8912  * This function must be called while holding the @queue's lock.
8913  *
8914  * Returns: data from the queue.
8915  */
8916
8917
8918 /**
8919  * g_async_queue_push:
8920  * @queue: a #GAsyncQueue
8921  * @data: @data to push into the @queue
8922  *
8923  * Pushes the @data into the @queue. @data must not be %NULL.
8924  */
8925
8926
8927 /**
8928  * g_async_queue_push_sorted:
8929  * @queue: a #GAsyncQueue
8930  * @data: the @data to push into the @queue
8931  * @func: the #GCompareDataFunc is used to sort @queue
8932  * @user_data: user data passed to @func.
8933  *
8934  * Inserts @data into @queue using @func to determine the new
8935  * position.
8936  *
8937  * This function requires that the @queue is sorted before pushing on
8938  * new elements, see g_async_queue_sort().
8939  *
8940  * This function will lock @queue before it sorts the queue and unlock
8941  * it when it is finished.
8942  *
8943  * For an example of @func see g_async_queue_sort().
8944  *
8945  * Since: 2.10
8946  */
8947
8948
8949 /**
8950  * g_async_queue_push_sorted_unlocked:
8951  * @queue: a #GAsyncQueue
8952  * @data: the @data to push into the @queue
8953  * @func: the #GCompareDataFunc is used to sort @queue
8954  * @user_data: user data passed to @func.
8955  *
8956  * Inserts @data into @queue using @func to determine the new
8957  * position.
8958  *
8959  * The sort function @func is passed two elements of the @queue.
8960  * It should return 0 if they are equal, a negative value if the
8961  * first element should be higher in the @queue or a positive value
8962  * if the first element should be lower in the @queue than the second
8963  * element.
8964  *
8965  * This function requires that the @queue is sorted before pushing on
8966  * new elements, see g_async_queue_sort().
8967  *
8968  * This function must be called while holding the @queue's lock.
8969  *
8970  * For an example of @func see g_async_queue_sort().
8971  *
8972  * Since: 2.10
8973  */
8974
8975
8976 /**
8977  * g_async_queue_push_unlocked:
8978  * @queue: a #GAsyncQueue
8979  * @data: @data to push into the @queue
8980  *
8981  * Pushes the @data into the @queue. @data must not be %NULL.
8982  *
8983  * This function must be called while holding the @queue's lock.
8984  */
8985
8986
8987 /**
8988  * g_async_queue_ref:
8989  * @queue: a #GAsyncQueue
8990  *
8991  * Increases the reference count of the asynchronous @queue by 1.
8992  * You do not need to hold the lock to call this function.
8993  *
8994  * Returns: the @queue that was passed in (since 2.6)
8995  */
8996
8997
8998 /**
8999  * g_async_queue_ref_unlocked:
9000  * @queue: a #GAsyncQueue
9001  *
9002  * Increases the reference count of the asynchronous @queue by 1.
9003  *
9004  * Deprecated: 2.8: Reference counting is done atomically. so g_async_queue_ref() can be used regardless of the @queue's lock.
9005  */
9006
9007
9008 /**
9009  * g_async_queue_sort:
9010  * @queue: a #GAsyncQueue
9011  * @func: the #GCompareDataFunc is used to sort @queue
9012  * @user_data: user data passed to @func
9013  *
9014  * Sorts @queue using @func.
9015  *
9016  * The sort function @func is passed two elements of the @queue.
9017  * It should return 0 if they are equal, a negative value if the
9018  * first element should be higher in the @queue or a positive value
9019  * if the first element should be lower in the @queue than the second
9020  * element.
9021  *
9022  * This function will lock @queue before it sorts the queue and unlock
9023  * it when it is finished.
9024  *
9025  * If you were sorting a list of priority numbers to make sure the
9026  * lowest priority would be at the top of the queue, you could use:
9027  * |[
9028  *  gint32 id1;
9029  *  gint32 id2;
9030  *
9031  *  id1 = GPOINTER_TO_INT (element1);
9032  *  id2 = GPOINTER_TO_INT (element2);
9033  *
9034  *  return (id1 > id2 ? +1 : id1 == id2 ? 0 : -1);
9035  * ]|
9036  *
9037  * Since: 2.10
9038  */
9039
9040
9041 /**
9042  * g_async_queue_sort_unlocked:
9043  * @queue: a #GAsyncQueue
9044  * @func: the #GCompareDataFunc is used to sort @queue
9045  * @user_data: user data passed to @func
9046  *
9047  * Sorts @queue using @func.
9048  *
9049  * The sort function @func is passed two elements of the @queue.
9050  * It should return 0 if they are equal, a negative value if the
9051  * first element should be higher in the @queue or a positive value
9052  * if the first element should be lower in the @queue than the second
9053  * element.
9054  *
9055  * This function must be called while holding the @queue's lock.
9056  *
9057  * Since: 2.10
9058  */
9059
9060
9061 /**
9062  * g_async_queue_timed_pop:
9063  * @queue: a #GAsyncQueue
9064  * @end_time: a #GTimeVal, determining the final time
9065  *
9066  * Pops data from the @queue. If the queue is empty, blocks until
9067  * @end_time or until data becomes available.
9068  *
9069  * If no data is received before @end_time, %NULL is returned.
9070  *
9071  * To easily calculate @end_time, a combination of g_get_current_time()
9072  * and g_time_val_add() can be used.
9073  *
9074  * Returns: data from the queue or %NULL, when no data is received before @end_time.
9075  * Deprecated: use g_async_queue_timeout_pop().
9076  */
9077
9078
9079 /**
9080  * g_async_queue_timed_pop_unlocked:
9081  * @queue: a #GAsyncQueue
9082  * @end_time: a #GTimeVal, determining the final time
9083  *
9084  * Pops data from the @queue. If the queue is empty, blocks until
9085  * @end_time or until data becomes available.
9086  *
9087  * If no data is received before @end_time, %NULL is returned.
9088  *
9089  * To easily calculate @end_time, a combination of g_get_current_time()
9090  * and g_time_val_add() can be used.
9091  *
9092  * This function must be called while holding the @queue's lock.
9093  *
9094  * Returns: data from the queue or %NULL, when no data is received before @end_time.
9095  * Deprecated: use g_async_queue_timeout_pop_unlocked().
9096  */
9097
9098
9099 /**
9100  * g_async_queue_timeout_pop:
9101  * @queue: a #GAsyncQueue
9102  * @timeout: the number of microseconds to wait
9103  *
9104  * Pops data from the @queue. If the queue is empty, blocks for
9105  * @timeout microseconds, or until data becomes available.
9106  *
9107  * If no data is received before the timeout, %NULL is returned.
9108  *
9109  * Returns: data from the queue or %NULL, when no data is received before the timeout.
9110  */
9111
9112
9113 /**
9114  * g_async_queue_timeout_pop_unlocked:
9115  * @queue: a #GAsyncQueue
9116  * @timeout: the number of microseconds to wait
9117  *
9118  * Pops data from the @queue. If the queue is empty, blocks for
9119  * @timeout microseconds, or until data becomes available.
9120  *
9121  * If no data is received before the timeout, %NULL is returned.
9122  *
9123  * This function must be called while holding the @queue's lock.
9124  *
9125  * Returns: data from the queue or %NULL, when no data is received before the timeout.
9126  */
9127
9128
9129 /**
9130  * g_async_queue_try_pop:
9131  * @queue: a #GAsyncQueue
9132  *
9133  * Tries to pop data from the @queue. If no data is available,
9134  * %NULL is returned.
9135  *
9136  * Returns: data from the queue or %NULL, when no data is available immediately.
9137  */
9138
9139
9140 /**
9141  * g_async_queue_try_pop_unlocked:
9142  * @queue: a #GAsyncQueue
9143  *
9144  * Tries to pop data from the @queue. If no data is available,
9145  * %NULL is returned.
9146  *
9147  * This function must be called while holding the @queue's lock.
9148  *
9149  * Returns: data from the queue or %NULL, when no data is available immediately.
9150  */
9151
9152
9153 /**
9154  * g_async_queue_unlock:
9155  * @queue: a #GAsyncQueue
9156  *
9157  * Releases the queue's lock.
9158  *
9159  * Calling this function when you have not acquired
9160  * the with g_async_queue_lock() leads to undefined
9161  * behaviour.
9162  */
9163
9164
9165 /**
9166  * g_async_queue_unref:
9167  * @queue: a #GAsyncQueue.
9168  *
9169  * Decreases the reference count of the asynchronous @queue by 1.
9170  *
9171  * If the reference count went to 0, the @queue will be destroyed
9172  * and the memory allocated will be freed. So you are not allowed
9173  * to use the @queue afterwards, as it might have disappeared.
9174  * You do not need to hold the lock to call this function.
9175  */
9176
9177
9178 /**
9179  * g_async_queue_unref_and_unlock:
9180  * @queue: a #GAsyncQueue
9181  *
9182  * Decreases the reference count of the asynchronous @queue by 1
9183  * and releases the lock. This function must be called while holding
9184  * the @queue's lock. If the reference count went to 0, the @queue
9185  * will be destroyed and the memory allocated will be freed.
9186  *
9187  * Deprecated: 2.8: Reference counting is done atomically. so g_async_queue_unref() can be used regardless of the @queue's lock.
9188  */
9189
9190
9191 /**
9192  * g_atexit:
9193  * @func: (scope async): the function to call on normal program termination.
9194  *
9195  * Specifies a function to be called at normal program termination.
9196  *
9197  * Since GLib 2.8.2, on Windows g_atexit() actually is a preprocessor
9198  * macro that maps to a call to the atexit() function in the C
9199  * library. This means that in case the code that calls g_atexit(),
9200  * i.e. atexit(), is in a DLL, the function will be called when the
9201  * DLL is detached from the program. This typically makes more sense
9202  * than that the function is called when the GLib DLL is detached,
9203  * which happened earlier when g_atexit() was a function in the GLib
9204  * DLL.
9205  *
9206  * The behaviour of atexit() in the context of dynamically loaded
9207  * modules is not formally specified and varies wildly.
9208  *
9209  * On POSIX systems, calling g_atexit() (or atexit()) in a dynamically
9210  * loaded module which is unloaded before the program terminates might
9211  * well cause a crash at program exit.
9212  *
9213  * Some POSIX systems implement atexit() like Windows, and have each
9214  * dynamically loaded module maintain an own atexit chain that is
9215  * called when the module is unloaded.
9216  *
9217  * On other POSIX systems, before a dynamically loaded module is
9218  * unloaded, the registered atexit functions (if any) residing in that
9219  * module are called, regardless where the code that registered them
9220  * resided. This is presumably the most robust approach.
9221  *
9222  * As can be seen from the above, for portability it's best to avoid
9223  * calling g_atexit() (or atexit()) except in the main executable of a
9224  * program.
9225  *
9226  * Deprecated: 2.32: It is best to avoid g_atexit().
9227  */
9228
9229
9230 /**
9231  * g_atomic_int_add:
9232  * @atomic: a pointer to a #gint or #guint
9233  * @val: the value to add
9234  *
9235  * Atomically adds @val to the value of @atomic.
9236  *
9237  * Think of this operation as an atomic version of
9238  * <literal>{ tmp = *atomic; *@atomic += @val; return tmp; }</literal>
9239  *
9240  * This call acts as a full compiler and hardware memory barrier.
9241  *
9242  * Before version 2.30, this function did not return a value
9243  * (but g_atomic_int_exchange_and_add() did, and had the same meaning).
9244  *
9245  * Returns: the value of @atomic before the add, signed
9246  * Since: 2.4
9247  */
9248
9249
9250 /**
9251  * g_atomic_int_and:
9252  * @atomic: a pointer to a #gint or #guint
9253  * @val: the value to 'and'
9254  *
9255  * Performs an atomic bitwise 'and' of the value of @atomic and @val,
9256  * storing the result back in @atomic.
9257  *
9258  * This call acts as a full compiler and hardware memory barrier.
9259  *
9260  * Think of this operation as an atomic version of
9261  * <literal>{ tmp = *atomic; *@atomic &= @val; return tmp; }</literal>
9262  *
9263  * Returns: the value of @atomic before the operation, unsigned
9264  * Since: 2.30
9265  */
9266
9267
9268 /**
9269  * g_atomic_int_compare_and_exchange:
9270  * @atomic: a pointer to a #gint or #guint
9271  * @oldval: the value to compare with
9272  * @newval: the value to conditionally replace with
9273  *
9274  * Compares @atomic to @oldval and, if equal, sets it to @newval.
9275  * If @atomic was not equal to @oldval then no change occurs.
9276  *
9277  * This compare and exchange is done atomically.
9278  *
9279  * Think of this operation as an atomic version of
9280  * <literal>{ if (*@atomic == @oldval) { *@atomic = @newval; return TRUE; } else return FALSE; }</literal>
9281  *
9282  * This call acts as a full compiler and hardware memory barrier.
9283  *
9284  * Returns: %TRUE if the exchange took place
9285  * Since: 2.4
9286  */
9287
9288
9289 /**
9290  * g_atomic_int_dec_and_test:
9291  * @atomic: a pointer to a #gint or #guint
9292  *
9293  * Decrements the value of @atomic by 1.
9294  *
9295  * Think of this operation as an atomic version of
9296  * <literal>{ *@atomic -= 1; return (*@atomic == 0); }</literal>
9297  *
9298  * This call acts as a full compiler and hardware memory barrier.
9299  *
9300  * Returns: %TRUE if the resultant value is zero
9301  * Since: 2.4
9302  */
9303
9304
9305 /**
9306  * g_atomic_int_exchange_and_add:
9307  * @atomic: a pointer to a #gint
9308  * @val: the value to add
9309  *
9310  * This function existed before g_atomic_int_add() returned the prior
9311  * value of the integer (which it now does).  It is retained only for
9312  * compatibility reasons.  Don't use this function in new code.
9313  *
9314  * Returns: the value of @atomic before the add, signed
9315  * Since: 2.4
9316  * Deprecated: 2.30: Use g_atomic_int_add() instead.
9317  */
9318
9319
9320 /**
9321  * g_atomic_int_get:
9322  * @atomic: a pointer to a #gint or #guint
9323  *
9324  * Gets the current value of @atomic.
9325  *
9326  * This call acts as a full compiler and hardware
9327  * memory barrier (before the get).
9328  *
9329  * Returns: the value of the integer
9330  * Since: 2.4
9331  */
9332
9333
9334 /**
9335  * g_atomic_int_inc:
9336  * @atomic: a pointer to a #gint or #guint
9337  *
9338  * Increments the value of @atomic by 1.
9339  *
9340  * Think of this operation as an atomic version of
9341  * <literal>{ *@atomic += 1; }</literal>
9342  *
9343  * This call acts as a full compiler and hardware memory barrier.
9344  *
9345  * Since: 2.4
9346  */
9347
9348
9349 /**
9350  * g_atomic_int_or:
9351  * @atomic: a pointer to a #gint or #guint
9352  * @val: the value to 'or'
9353  *
9354  * Performs an atomic bitwise 'or' of the value of @atomic and @val,
9355  * storing the result back in @atomic.
9356  *
9357  * Think of this operation as an atomic version of
9358  * <literal>{ tmp = *atomic; *@atomic |= @val; return tmp; }</literal>
9359  *
9360  * This call acts as a full compiler and hardware memory barrier.
9361  *
9362  * Returns: the value of @atomic before the operation, unsigned
9363  * Since: 2.30
9364  */
9365
9366
9367 /**
9368  * g_atomic_int_set:
9369  * @atomic: a pointer to a #gint or #guint
9370  * @newval: a new value to store
9371  *
9372  * Sets the value of @atomic to @newval.
9373  *
9374  * This call acts as a full compiler and hardware
9375  * memory barrier (after the set).
9376  *
9377  * Since: 2.4
9378  */
9379
9380
9381 /**
9382  * g_atomic_int_xor:
9383  * @atomic: a pointer to a #gint or #guint
9384  * @val: the value to 'xor'
9385  *
9386  * Performs an atomic bitwise 'xor' of the value of @atomic and @val,
9387  * storing the result back in @atomic.
9388  *
9389  * Think of this operation as an atomic version of
9390  * <literal>{ tmp = *atomic; *@atomic ^= @val; return tmp; }</literal>
9391  *
9392  * This call acts as a full compiler and hardware memory barrier.
9393  *
9394  * Returns: the value of @atomic before the operation, unsigned
9395  * Since: 2.30
9396  */
9397
9398
9399 /**
9400  * g_atomic_pointer_add:
9401  * @atomic: a pointer to a #gpointer-sized value
9402  * @val: the value to add
9403  *
9404  * Atomically adds @val to the value of @atomic.
9405  *
9406  * Think of this operation as an atomic version of
9407  * <literal>{ tmp = *atomic; *@atomic += @val; return tmp; }</literal>
9408  *
9409  * This call acts as a full compiler and hardware memory barrier.
9410  *
9411  * Returns: the value of @atomic before the add, signed
9412  * Since: 2.30
9413  */
9414
9415
9416 /**
9417  * g_atomic_pointer_and:
9418  * @atomic: a pointer to a #gpointer-sized value
9419  * @val: the value to 'and'
9420  *
9421  * Performs an atomic bitwise 'and' of the value of @atomic and @val,
9422  * storing the result back in @atomic.
9423  *
9424  * Think of this operation as an atomic version of
9425  * <literal>{ tmp = *atomic; *@atomic &= @val; return tmp; }</literal>
9426  *
9427  * This call acts as a full compiler and hardware memory barrier.
9428  *
9429  * Returns: the value of @atomic before the operation, unsigned
9430  * Since: 2.30
9431  */
9432
9433
9434 /**
9435  * g_atomic_pointer_compare_and_exchange:
9436  * @atomic: a pointer to a #gpointer-sized value
9437  * @oldval: the value to compare with
9438  * @newval: the value to conditionally replace with
9439  *
9440  * Compares @atomic to @oldval and, if equal, sets it to @newval.
9441  * If @atomic was not equal to @oldval then no change occurs.
9442  *
9443  * This compare and exchange is done atomically.
9444  *
9445  * Think of this operation as an atomic version of
9446  * <literal>{ if (*@atomic == @oldval) { *@atomic = @newval; return TRUE; } else return FALSE; }</literal>
9447  *
9448  * This call acts as a full compiler and hardware memory barrier.
9449  *
9450  * Returns: %TRUE if the exchange took place
9451  * Since: 2.4
9452  */
9453
9454
9455 /**
9456  * g_atomic_pointer_get:
9457  * @atomic: a pointer to a #gpointer-sized value
9458  *
9459  * Gets the current value of @atomic.
9460  *
9461  * This call acts as a full compiler and hardware
9462  * memory barrier (before the get).
9463  *
9464  * Returns: the value of the pointer
9465  * Since: 2.4
9466  */
9467
9468
9469 /**
9470  * g_atomic_pointer_or:
9471  * @atomic: a pointer to a #gpointer-sized value
9472  * @val: the value to 'or'
9473  *
9474  * Performs an atomic bitwise 'or' of the value of @atomic and @val,
9475  * storing the result back in @atomic.
9476  *
9477  * Think of this operation as an atomic version of
9478  * <literal>{ tmp = *atomic; *@atomic |= @val; return tmp; }</literal>
9479  *
9480  * This call acts as a full compiler and hardware memory barrier.
9481  *
9482  * Returns: the value of @atomic before the operation, unsigned
9483  * Since: 2.30
9484  */
9485
9486
9487 /**
9488  * g_atomic_pointer_set:
9489  * @atomic: a pointer to a #gpointer-sized value
9490  * @newval: a new value to store
9491  *
9492  * Sets the value of @atomic to @newval.
9493  *
9494  * This call acts as a full compiler and hardware
9495  * memory barrier (after the set).
9496  *
9497  * Since: 2.4
9498  */
9499
9500
9501 /**
9502  * g_atomic_pointer_xor:
9503  * @atomic: a pointer to a #gpointer-sized value
9504  * @val: the value to 'xor'
9505  *
9506  * Performs an atomic bitwise 'xor' of the value of @atomic and @val,
9507  * storing the result back in @atomic.
9508  *
9509  * Think of this operation as an atomic version of
9510  * <literal>{ tmp = *atomic; *@atomic ^= @val; return tmp; }</literal>
9511  *
9512  * This call acts as a full compiler and hardware memory barrier.
9513  *
9514  * Returns: the value of @atomic before the operation, unsigned
9515  * Since: 2.30
9516  */
9517
9518
9519 /**
9520  * g_base64_decode:
9521  * @text: zero-terminated string with base64 text to decode
9522  * @out_len: (out): The length of the decoded data is written here
9523  *
9524  * Decode a sequence of Base-64 encoded text into binary data
9525  *
9526  * 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().
9527  * Since: 2.12
9528  */
9529
9530
9531 /**
9532  * g_base64_decode_inplace:
9533  * @text: (inout) (array length=out_len) (element-type guint8): zero-terminated string with base64 text to decode
9534  * @out_len: (inout): The length of the decoded data is written here
9535  *
9536  * Decode a sequence of Base-64 encoded text into binary data
9537  * by overwriting the input data.
9538  *
9539  * Returns: (transfer none): The binary data that @text responds. This pointer is the same as the input @text.
9540  * Since: 2.20
9541  */
9542
9543
9544 /**
9545  * g_base64_decode_step:
9546  * @in: (array length=len) (element-type guint8): binary input data
9547  * @len: max length of @in data to decode
9548  * @out: (out) (array) (element-type guint8): output buffer
9549  * @state: (inout): Saved state between steps, initialize to 0
9550  * @save: (inout): Saved state between steps, initialize to 0
9551  *
9552  * Incrementally decode a sequence of binary data from its Base-64 stringified
9553  * representation. By calling this function multiple times you can convert
9554  * data in chunks to avoid having to have the full encoded data in memory.
9555  *
9556  * The output buffer must be large enough to fit all the data that will
9557  * be written to it. Since base64 encodes 3 bytes in 4 chars you need
9558  * at least: (@len / 4) * 3 + 3 bytes (+ 3 may be needed in case of non-zero
9559  * state).
9560  *
9561  * Returns: The number of bytes of output that was written
9562  * Since: 2.12
9563  */
9564
9565
9566 /**
9567  * g_base64_encode:
9568  * @data: (array length=len) (element-type guint8): the binary data to encode
9569  * @len: the length of @data
9570  *
9571  * Encode a sequence of binary data into its Base-64 stringified
9572  * representation.
9573  *
9574  * Returns: (transfer full): a newly allocated, zero-terminated Base-64 encoded string representing @data. The returned string must be freed with g_free().
9575  * Since: 2.12
9576  */
9577
9578
9579 /**
9580  * g_base64_encode_close:
9581  * @break_lines: whether to break long lines
9582  * @out: (out) (array) (element-type guint8): pointer to destination buffer
9583  * @state: (inout): Saved state from g_base64_encode_step()
9584  * @save: (inout): Saved state from g_base64_encode_step()
9585  *
9586  * Flush the status from a sequence of calls to g_base64_encode_step().
9587  *
9588  * The output buffer must be large enough to fit all the data that will
9589  * be written to it. It will need up to 4 bytes, or up to 5 bytes if
9590  * line-breaking is enabled.
9591  *
9592  * Returns: The number of bytes of output that was written
9593  * Since: 2.12
9594  */
9595
9596
9597 /**
9598  * g_base64_encode_step:
9599  * @in: (array length=len) (element-type guint8): the binary data to encode
9600  * @len: the length of @in
9601  * @break_lines: whether to break long lines
9602  * @out: (out) (array) (element-type guint8): pointer to destination buffer
9603  * @state: (inout): Saved state between steps, initialize to 0
9604  * @save: (inout): Saved state between steps, initialize to 0
9605  *
9606  * Incrementally encode a sequence of binary data into its Base-64 stringified
9607  * representation. By calling this function multiple times you can convert
9608  * data in chunks to avoid having to have the full encoded data in memory.
9609  *
9610  * When all of the data has been converted you must call
9611  * g_base64_encode_close() to flush the saved state.
9612  *
9613  * The output buffer must be large enough to fit all the data that will
9614  * be written to it. Due to the way base64 encodes you will need
9615  * at least: (@len / 3 + 1) * 4 + 4 bytes (+ 4 may be needed in case of
9616  * non-zero state). If you enable line-breaking you will need at least:
9617  * ((@len / 3 + 1) * 4 + 4) / 72 + 1 bytes of extra space.
9618  *
9619  * @break_lines is typically used when putting base64-encoded data in emails.
9620  * It breaks the lines at 72 columns instead of putting all of the text on
9621  * the same line. This avoids problems with long lines in the email system.
9622  * Note however that it breaks the lines with <literal>LF</literal>
9623  * characters, not <literal>CR LF</literal> sequences, so the result cannot
9624  * be passed directly to SMTP or certain other protocols.
9625  *
9626  * Returns: The number of bytes of output that was written
9627  * Since: 2.12
9628  */
9629
9630
9631 /**
9632  * g_basename:
9633  * @file_name: the name of the file
9634  *
9635  * Gets the name of the file without any leading directory
9636  * components. It returns a pointer into the given file name
9637  * string.
9638  *
9639  * Returns: the name of the file without any leading directory components
9640  * 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.
9641  */
9642
9643
9644 /**
9645  * g_bit_lock:
9646  * @address: a pointer to an integer
9647  * @lock_bit: a bit value between 0 and 31
9648  *
9649  * Sets the indicated @lock_bit in @address.  If the bit is already
9650  * set, this call will block until g_bit_unlock() unsets the
9651  * corresponding bit.
9652  *
9653  * Attempting to lock on two different bits within the same integer is
9654  * not supported and will very probably cause deadlocks.
9655  *
9656  * The value of the bit that is set is (1u << @bit).  If @bit is not
9657  * between 0 and 31 then the result is undefined.
9658  *
9659  * This function accesses @address atomically.  All other accesses to
9660  * @address must be atomic in order for this function to work
9661  * reliably.
9662  *
9663  * Since: 2.24
9664  */
9665
9666
9667 /**
9668  * g_bit_nth_lsf:
9669  * @mask: a #gulong containing flags
9670  * @nth_bit: the index of the bit to start the search from
9671  *
9672  * Find the position of the first bit set in @mask, searching
9673  * from (but not including) @nth_bit upwards. Bits are numbered
9674  * from 0 (least significant) to sizeof(#gulong) * 8 - 1 (31 or 63,
9675  * usually). To start searching from the 0th bit, set @nth_bit to -1.
9676  *
9677  * Returns: the index of the first bit set which is higher than @nth_bit
9678  */
9679
9680
9681 /**
9682  * g_bit_nth_msf:
9683  * @mask: a #gulong containing flags
9684  * @nth_bit: the index of the bit to start the search from
9685  *
9686  * Find the position of the first bit set in @mask, searching
9687  * from (but not including) @nth_bit downwards. Bits are numbered
9688  * from 0 (least significant) to sizeof(#gulong) * 8 - 1 (31 or 63,
9689  * usually). To start searching from the last bit, set @nth_bit to
9690  * -1 or GLIB_SIZEOF_LONG * 8.
9691  *
9692  * Returns: the index of the first bit set which is lower than @nth_bit
9693  */
9694
9695
9696 /**
9697  * g_bit_storage:
9698  * @number: a #guint
9699  *
9700  * Gets the number of bits used to hold @number,
9701  * e.g. if @number is 4, 3 bits are needed.
9702  *
9703  * Returns: the number of bits used to hold @number
9704  */
9705
9706
9707 /**
9708  * g_bit_trylock:
9709  * @address: a pointer to an integer
9710  * @lock_bit: a bit value between 0 and 31
9711  *
9712  * Sets the indicated @lock_bit in @address, returning %TRUE if
9713  * successful.  If the bit is already set, returns %FALSE immediately.
9714  *
9715  * Attempting to lock on two different bits within the same integer is
9716  * not supported.
9717  *
9718  * The value of the bit that is set is (1u << @bit).  If @bit is not
9719  * between 0 and 31 then the result is undefined.
9720  *
9721  * This function accesses @address atomically.  All other accesses to
9722  * @address must be atomic in order for this function to work
9723  * reliably.
9724  *
9725  * Returns: %TRUE if the lock was acquired
9726  * Since: 2.24
9727  */
9728
9729
9730 /**
9731  * g_bit_unlock:
9732  * @address: a pointer to an integer
9733  * @lock_bit: a bit value between 0 and 31
9734  *
9735  * Clears the indicated @lock_bit in @address.  If another thread is
9736  * currently blocked in g_bit_lock() on this same bit then it will be
9737  * woken up.
9738  *
9739  * This function accesses @address atomically.  All other accesses to
9740  * @address must be atomic in order for this function to work
9741  * reliably.
9742  *
9743  * Since: 2.24
9744  */
9745
9746
9747 /**
9748  * g_bookmark_file_add_application:
9749  * @bookmark: a #GBookmarkFile
9750  * @uri: a valid URI
9751  * @name: (allow-none): the name of the application registering the bookmark or %NULL
9752  * @exec: (allow-none): command line to be used to launch the bookmark or %NULL
9753  *
9754  * Adds the application with @name and @exec to the list of
9755  * applications that have registered a bookmark for @uri into
9756  * @bookmark.
9757  *
9758  * Every bookmark inside a #GBookmarkFile must have at least an
9759  * application registered.  Each application must provide a name, a
9760  * command line useful for launching the bookmark, the number of times
9761  * the bookmark has been registered by the application and the last
9762  * time the application registered this bookmark.
9763  *
9764  * If @name is %NULL, the name of the application will be the
9765  * same returned by g_get_application_name(); if @exec is %NULL, the
9766  * command line will be a composition of the program name as
9767  * returned by g_get_prgname() and the "\%u" modifier, which will be
9768  * expanded to the bookmark's URI.
9769  *
9770  * This function will automatically take care of updating the
9771  * registrations count and timestamping in case an application
9772  * with the same @name had already registered a bookmark for
9773  * @uri inside @bookmark.
9774  *
9775  * If no bookmark for @uri is found, one is created.
9776  *
9777  * Since: 2.12
9778  */
9779
9780
9781 /**
9782  * g_bookmark_file_add_group:
9783  * @bookmark: a #GBookmarkFile
9784  * @uri: a valid URI
9785  * @group: the group name to be added
9786  *
9787  * Adds @group to the list of groups to which the bookmark for @uri
9788  * belongs to.
9789  *
9790  * If no bookmark for @uri is found then it is created.
9791  *
9792  * Since: 2.12
9793  */
9794
9795
9796 /**
9797  * g_bookmark_file_free:
9798  * @bookmark: a #GBookmarkFile
9799  *
9800  * Frees a #GBookmarkFile.
9801  *
9802  * Since: 2.12
9803  */
9804
9805
9806 /**
9807  * g_bookmark_file_get_added:
9808  * @bookmark: a #GBookmarkFile
9809  * @uri: a valid URI
9810  * @error: return location for a #GError, or %NULL
9811  *
9812  * Gets the time the bookmark for @uri was added to @bookmark
9813  *
9814  * In the event the URI cannot be found, -1 is returned and
9815  * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
9816  *
9817  * Returns: a timestamp
9818  * Since: 2.12
9819  */
9820
9821
9822 /**
9823  * g_bookmark_file_get_app_info:
9824  * @bookmark: a #GBookmarkFile
9825  * @uri: a valid URI
9826  * @name: an application's name
9827  * @exec: (allow-none): location for the command line of the application, or %NULL
9828  * @count: (allow-none): return location for the registration count, or %NULL
9829  * @stamp: (allow-none): return location for the last registration time, or %NULL
9830  * @error: return location for a #GError, or %NULL
9831  *
9832  * Gets the registration informations of @app_name for the bookmark for
9833  * @uri.  See g_bookmark_file_set_app_info() for more informations about
9834  * the returned data.
9835  *
9836  * The string returned in @app_exec must be freed.
9837  *
9838  * In the event the URI cannot be found, %FALSE is returned and
9839  * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.  In the
9840  * event that no application with name @app_name has registered a bookmark
9841  * for @uri,  %FALSE is returned and error is set to
9842  * #G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED. In the event that unquoting
9843  * the command line fails, an error of the #G_SHELL_ERROR domain is
9844  * set and %FALSE is returned.
9845  *
9846  * Returns: %TRUE on success.
9847  * Since: 2.12
9848  */
9849
9850
9851 /**
9852  * g_bookmark_file_get_applications:
9853  * @bookmark: a #GBookmarkFile
9854  * @uri: a valid URI
9855  * @length: (allow-none): return location of the length of the returned list, or %NULL
9856  * @error: return location for a #GError, or %NULL
9857  *
9858  * Retrieves the names of the applications that have registered the
9859  * bookmark for @uri.
9860  *
9861  * In the event the URI cannot be found, %NULL is returned and
9862  * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
9863  *
9864  * Returns: a newly allocated %NULL-terminated array of strings. Use g_strfreev() to free it.
9865  * Since: 2.12
9866  */
9867
9868
9869 /**
9870  * g_bookmark_file_get_description:
9871  * @bookmark: a #GBookmarkFile
9872  * @uri: a valid URI
9873  * @error: return location for a #GError, or %NULL
9874  *
9875  * Retrieves the description of the bookmark for @uri.
9876  *
9877  * In the event the URI cannot be found, %NULL is returned and
9878  * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
9879  *
9880  * Returns: a newly allocated string or %NULL if the specified URI cannot be found.
9881  * Since: 2.12
9882  */
9883
9884
9885 /**
9886  * g_bookmark_file_get_groups:
9887  * @bookmark: a #GBookmarkFile
9888  * @uri: a valid URI
9889  * @length: (allow-none): return location for the length of the returned string, or %NULL
9890  * @error: return location for a #GError, or %NULL
9891  *
9892  * Retrieves the list of group names of the bookmark for @uri.
9893  *
9894  * In the event the URI cannot be found, %NULL is returned and
9895  * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
9896  *
9897  * The returned array is %NULL terminated, so @length may optionally
9898  * be %NULL.
9899  *
9900  * Returns: a newly allocated %NULL-terminated array of group names. Use g_strfreev() to free it.
9901  * Since: 2.12
9902  */
9903
9904
9905 /**
9906  * g_bookmark_file_get_icon:
9907  * @bookmark: a #GBookmarkFile
9908  * @uri: a valid URI
9909  * @href: (allow-none): return location for the icon's location or %NULL
9910  * @mime_type: (allow-none): return location for the icon's MIME type or %NULL
9911  * @error: return location for a #GError or %NULL
9912  *
9913  * Gets the icon of the bookmark for @uri.
9914  *
9915  * In the event the URI cannot be found, %FALSE is returned and
9916  * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
9917  *
9918  * Returns: %TRUE if the icon for the bookmark for the URI was found. You should free the returned strings.
9919  * Since: 2.12
9920  */
9921
9922
9923 /**
9924  * g_bookmark_file_get_is_private:
9925  * @bookmark: a #GBookmarkFile
9926  * @uri: a valid URI
9927  * @error: return location for a #GError, or %NULL
9928  *
9929  * Gets whether the private flag of the bookmark for @uri is set.
9930  *
9931  * In the event the URI cannot be found, %FALSE is returned and
9932  * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.  In the
9933  * event that the private flag cannot be found, %FALSE is returned and
9934  * @error is set to #G_BOOKMARK_FILE_ERROR_INVALID_VALUE.
9935  *
9936  * Returns: %TRUE if the private flag is set, %FALSE otherwise.
9937  * Since: 2.12
9938  */
9939
9940
9941 /**
9942  * g_bookmark_file_get_mime_type:
9943  * @bookmark: a #GBookmarkFile
9944  * @uri: a valid URI
9945  * @error: return location for a #GError, or %NULL
9946  *
9947  * Retrieves the MIME type of the resource pointed by @uri.
9948  *
9949  * In the event the URI cannot be found, %NULL is returned and
9950  * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.  In the
9951  * event that the MIME type cannot be found, %NULL is returned and
9952  * @error is set to #G_BOOKMARK_FILE_ERROR_INVALID_VALUE.
9953  *
9954  * Returns: a newly allocated string or %NULL if the specified URI cannot be found.
9955  * Since: 2.12
9956  */
9957
9958
9959 /**
9960  * g_bookmark_file_get_modified:
9961  * @bookmark: a #GBookmarkFile
9962  * @uri: a valid URI
9963  * @error: return location for a #GError, or %NULL
9964  *
9965  * Gets the time when the bookmark for @uri was last modified.
9966  *
9967  * In the event the URI cannot be found, -1 is returned and
9968  * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
9969  *
9970  * Returns: a timestamp
9971  * Since: 2.12
9972  */
9973
9974
9975 /**
9976  * g_bookmark_file_get_size:
9977  * @bookmark: a #GBookmarkFile
9978  *
9979  * Gets the number of bookmarks inside @bookmark.
9980  *
9981  * Returns: the number of bookmarks
9982  * Since: 2.12
9983  */
9984
9985
9986 /**
9987  * g_bookmark_file_get_title:
9988  * @bookmark: a #GBookmarkFile
9989  * @uri: (allow-none): a valid URI or %NULL
9990  * @error: return location for a #GError, or %NULL
9991  *
9992  * Returns the title of the bookmark for @uri.
9993  *
9994  * If @uri is %NULL, the title of @bookmark is returned.
9995  *
9996  * In the event the URI cannot be found, %NULL is returned and
9997  * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
9998  *
9999  * Returns: a newly allocated string or %NULL if the specified URI cannot be found.
10000  * Since: 2.12
10001  */
10002
10003
10004 /**
10005  * g_bookmark_file_get_uris:
10006  * @bookmark: a #GBookmarkFile
10007  * @length: (allow-none): return location for the number of returned URIs, or %NULL
10008  *
10009  * Returns all URIs of the bookmarks in the bookmark file @bookmark.
10010  * The array of returned URIs will be %NULL-terminated, so @length may
10011  * optionally be %NULL.
10012  *
10013  * Returns: a newly allocated %NULL-terminated array of strings. Use g_strfreev() to free it.
10014  * Since: 2.12
10015  */
10016
10017
10018 /**
10019  * g_bookmark_file_get_visited:
10020  * @bookmark: a #GBookmarkFile
10021  * @uri: a valid URI
10022  * @error: return location for a #GError, or %NULL
10023  *
10024  * Gets the time the bookmark for @uri was last visited.
10025  *
10026  * In the event the URI cannot be found, -1 is returned and
10027  * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
10028  *
10029  * Returns: a timestamp.
10030  * Since: 2.12
10031  */
10032
10033
10034 /**
10035  * g_bookmark_file_has_application:
10036  * @bookmark: a #GBookmarkFile
10037  * @uri: a valid URI
10038  * @name: the name of the application
10039  * @error: return location for a #GError or %NULL
10040  *
10041  * Checks whether the bookmark for @uri inside @bookmark has been
10042  * registered by application @name.
10043  *
10044  * In the event the URI cannot be found, %FALSE is returned and
10045  * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
10046  *
10047  * Returns: %TRUE if the application @name was found
10048  * Since: 2.12
10049  */
10050
10051
10052 /**
10053  * g_bookmark_file_has_group:
10054  * @bookmark: a #GBookmarkFile
10055  * @uri: a valid URI
10056  * @group: the group name to be searched
10057  * @error: return location for a #GError, or %NULL
10058  *
10059  * Checks whether @group appears in the list of groups to which
10060  * the bookmark for @uri belongs to.
10061  *
10062  * In the event the URI cannot be found, %FALSE is returned and
10063  * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
10064  *
10065  * Returns: %TRUE if @group was found.
10066  * Since: 2.12
10067  */
10068
10069
10070 /**
10071  * g_bookmark_file_has_item:
10072  * @bookmark: a #GBookmarkFile
10073  * @uri: a valid URI
10074  *
10075  * Looks whether the desktop bookmark has an item with its URI set to @uri.
10076  *
10077  * Returns: %TRUE if @uri is inside @bookmark, %FALSE otherwise
10078  * Since: 2.12
10079  */
10080
10081
10082 /**
10083  * g_bookmark_file_load_from_data:
10084  * @bookmark: an empty #GBookmarkFile struct
10085  * @data: desktop bookmarks loaded in memory
10086  * @length: the length of @data in bytes
10087  * @error: return location for a #GError, or %NULL
10088  *
10089  * Loads a bookmark file from memory into an empty #GBookmarkFile
10090  * structure.  If the object cannot be created then @error is set to a
10091  * #GBookmarkFileError.
10092  *
10093  * Returns: %TRUE if a desktop bookmark could be loaded.
10094  * Since: 2.12
10095  */
10096
10097
10098 /**
10099  * g_bookmark_file_load_from_data_dirs:
10100  * @bookmark: a #GBookmarkFile
10101  * @file: a relative path to a filename to open and parse
10102  * @full_path: (allow-none): return location for a string containing the full path of the file, or %NULL
10103  * @error: return location for a #GError, or %NULL
10104  *
10105  * This function looks for a desktop bookmark file named @file in the
10106  * paths returned from g_get_user_data_dir() and g_get_system_data_dirs(),
10107  * loads the file into @bookmark and returns the file's full path in
10108  * @full_path.  If the file could not be loaded then an %error is
10109  * set to either a #GFileError or #GBookmarkFileError.
10110  *
10111  * Returns: %TRUE if a key file could be loaded, %FALSE otherwise
10112  * Since: 2.12
10113  */
10114
10115
10116 /**
10117  * g_bookmark_file_load_from_file:
10118  * @bookmark: an empty #GBookmarkFile struct
10119  * @filename: the path of a filename to load, in the GLib file name encoding
10120  * @error: return location for a #GError, or %NULL
10121  *
10122  * Loads a desktop bookmark file into an empty #GBookmarkFile structure.
10123  * If the file could not be loaded then @error is set to either a #GFileError
10124  * or #GBookmarkFileError.
10125  *
10126  * Returns: %TRUE if a desktop bookmark file could be loaded
10127  * Since: 2.12
10128  */
10129
10130
10131 /**
10132  * g_bookmark_file_move_item:
10133  * @bookmark: a #GBookmarkFile
10134  * @old_uri: a valid URI
10135  * @new_uri: (allow-none): a valid URI, or %NULL
10136  * @error: return location for a #GError or %NULL
10137  *
10138  * Changes the URI of a bookmark item from @old_uri to @new_uri.  Any
10139  * existing bookmark for @new_uri will be overwritten.  If @new_uri is
10140  * %NULL, then the bookmark is removed.
10141  *
10142  * In the event the URI cannot be found, %FALSE is returned and
10143  * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
10144  *
10145  * Returns: %TRUE if the URI was successfully changed
10146  * Since: 2.12
10147  */
10148
10149
10150 /**
10151  * g_bookmark_file_new:
10152  *
10153  * Creates a new empty #GBookmarkFile object.
10154  *
10155  * Use g_bookmark_file_load_from_file(), g_bookmark_file_load_from_data()
10156  * or g_bookmark_file_load_from_data_dirs() to read an existing bookmark
10157  * file.
10158  *
10159  * Returns: an empty #GBookmarkFile
10160  * Since: 2.12
10161  */
10162
10163
10164 /**
10165  * g_bookmark_file_remove_application:
10166  * @bookmark: a #GBookmarkFile
10167  * @uri: a valid URI
10168  * @name: the name of the application
10169  * @error: return location for a #GError or %NULL
10170  *
10171  * Removes application registered with @name from the list of applications
10172  * that have registered a bookmark for @uri inside @bookmark.
10173  *
10174  * In the event the URI cannot be found, %FALSE is returned and
10175  * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
10176  * In the event that no application with name @app_name has registered
10177  * a bookmark for @uri,  %FALSE is returned and error is set to
10178  * #G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED.
10179  *
10180  * Returns: %TRUE if the application was successfully removed.
10181  * Since: 2.12
10182  */
10183
10184
10185 /**
10186  * g_bookmark_file_remove_group:
10187  * @bookmark: a #GBookmarkFile
10188  * @uri: a valid URI
10189  * @group: the group name to be removed
10190  * @error: return location for a #GError, or %NULL
10191  *
10192  * Removes @group from the list of groups to which the bookmark
10193  * for @uri belongs to.
10194  *
10195  * In the event the URI cannot be found, %FALSE is returned and
10196  * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
10197  * In the event no group was defined, %FALSE is returned and
10198  * @error is set to #G_BOOKMARK_FILE_ERROR_INVALID_VALUE.
10199  *
10200  * Returns: %TRUE if @group was successfully removed.
10201  * Since: 2.12
10202  */
10203
10204
10205 /**
10206  * g_bookmark_file_remove_item:
10207  * @bookmark: a #GBookmarkFile
10208  * @uri: a valid URI
10209  * @error: return location for a #GError, or %NULL
10210  *
10211  * Removes the bookmark for @uri from the bookmark file @bookmark.
10212  *
10213  * Returns: %TRUE if the bookmark was removed successfully.
10214  * Since: 2.12
10215  */
10216
10217
10218 /**
10219  * g_bookmark_file_set_added:
10220  * @bookmark: a #GBookmarkFile
10221  * @uri: a valid URI
10222  * @added: a timestamp or -1 to use the current time
10223  *
10224  * Sets the time the bookmark for @uri was added into @bookmark.
10225  *
10226  * If no bookmark for @uri is found then it is created.
10227  *
10228  * Since: 2.12
10229  */
10230
10231
10232 /**
10233  * g_bookmark_file_set_app_info:
10234  * @bookmark: a #GBookmarkFile
10235  * @uri: a valid URI
10236  * @name: an application's name
10237  * @exec: an application's command line
10238  * @count: the number of registrations done for this application
10239  * @stamp: the time of the last registration for this application
10240  * @error: return location for a #GError or %NULL
10241  *
10242  * Sets the meta-data of application @name inside the list of
10243  * applications that have registered a bookmark for @uri inside
10244  * @bookmark.
10245  *
10246  * You should rarely use this function; use g_bookmark_file_add_application()
10247  * and g_bookmark_file_remove_application() instead.
10248  *
10249  * @name can be any UTF-8 encoded string used to identify an
10250  * application.
10251  * @exec can have one of these two modifiers: "\%f", which will
10252  * be expanded as the local file name retrieved from the bookmark's
10253  * URI; "\%u", which will be expanded as the bookmark's URI.
10254  * The expansion is done automatically when retrieving the stored
10255  * command line using the g_bookmark_file_get_app_info() function.
10256  * @count is the number of times the application has registered the
10257  * bookmark; if is < 0, the current registration count will be increased
10258  * by one, if is 0, the application with @name will be removed from
10259  * the list of registered applications.
10260  * @stamp is the Unix time of the last registration; if it is -1, the
10261  * current time will be used.
10262  *
10263  * If you try to remove an application by setting its registration count to
10264  * zero, and no bookmark for @uri is found, %FALSE is returned and
10265  * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND; similarly,
10266  * in the event that no application @name has registered a bookmark
10267  * for @uri,  %FALSE is returned and error is set to
10268  * #G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED.  Otherwise, if no bookmark
10269  * for @uri is found, one is created.
10270  *
10271  * Returns: %TRUE if the application's meta-data was successfully changed.
10272  * Since: 2.12
10273  */
10274
10275
10276 /**
10277  * g_bookmark_file_set_description:
10278  * @bookmark: a #GBookmarkFile
10279  * @uri: (allow-none): a valid URI or %NULL
10280  * @description: a string
10281  *
10282  * Sets @description as the description of the bookmark for @uri.
10283  *
10284  * If @uri is %NULL, the description of @bookmark is set.
10285  *
10286  * If a bookmark for @uri cannot be found then it is created.
10287  *
10288  * Since: 2.12
10289  */
10290
10291
10292 /**
10293  * g_bookmark_file_set_groups:
10294  * @bookmark: a #GBookmarkFile
10295  * @uri: an item's URI
10296  * @groups: (allow-none): an array of group names, or %NULL to remove all groups
10297  * @length: number of group name values in @groups
10298  *
10299  * Sets a list of group names for the item with URI @uri.  Each previously
10300  * set group name list is removed.
10301  *
10302  * If @uri cannot be found then an item for it is created.
10303  *
10304  * Since: 2.12
10305  */
10306
10307
10308 /**
10309  * g_bookmark_file_set_icon:
10310  * @bookmark: a #GBookmarkFile
10311  * @uri: a valid URI
10312  * @href: (allow-none): the URI of the icon for the bookmark, or %NULL
10313  * @mime_type: the MIME type of the icon for the bookmark
10314  *
10315  * Sets the icon for the bookmark for @uri. If @href is %NULL, unsets
10316  * the currently set icon. @href can either be a full URL for the icon
10317  * file or the icon name following the Icon Naming specification.
10318  *
10319  * If no bookmark for @uri is found one is created.
10320  *
10321  * Since: 2.12
10322  */
10323
10324
10325 /**
10326  * g_bookmark_file_set_is_private:
10327  * @bookmark: a #GBookmarkFile
10328  * @uri: a valid URI
10329  * @is_private: %TRUE if the bookmark should be marked as private
10330  *
10331  * Sets the private flag of the bookmark for @uri.
10332  *
10333  * If a bookmark for @uri cannot be found then it is created.
10334  *
10335  * Since: 2.12
10336  */
10337
10338
10339 /**
10340  * g_bookmark_file_set_mime_type:
10341  * @bookmark: a #GBookmarkFile
10342  * @uri: a valid URI
10343  * @mime_type: a MIME type
10344  *
10345  * Sets @mime_type as the MIME type of the bookmark for @uri.
10346  *
10347  * If a bookmark for @uri cannot be found then it is created.
10348  *
10349  * Since: 2.12
10350  */
10351
10352
10353 /**
10354  * g_bookmark_file_set_modified:
10355  * @bookmark: a #GBookmarkFile
10356  * @uri: a valid URI
10357  * @modified: a timestamp or -1 to use the current time
10358  *
10359  * Sets the last time the bookmark for @uri was last modified.
10360  *
10361  * If no bookmark for @uri is found then it is created.
10362  *
10363  * The "modified" time should only be set when the bookmark's meta-data
10364  * was actually changed.  Every function of #GBookmarkFile that
10365  * modifies a bookmark also changes the modification time, except for
10366  * g_bookmark_file_set_visited().
10367  *
10368  * Since: 2.12
10369  */
10370
10371
10372 /**
10373  * g_bookmark_file_set_title:
10374  * @bookmark: a #GBookmarkFile
10375  * @uri: (allow-none): a valid URI or %NULL
10376  * @title: a UTF-8 encoded string
10377  *
10378  * Sets @title as the title of the bookmark for @uri inside the
10379  * bookmark file @bookmark.
10380  *
10381  * If @uri is %NULL, the title of @bookmark is set.
10382  *
10383  * If a bookmark for @uri cannot be found then it is created.
10384  *
10385  * Since: 2.12
10386  */
10387
10388
10389 /**
10390  * g_bookmark_file_set_visited:
10391  * @bookmark: a #GBookmarkFile
10392  * @uri: a valid URI
10393  * @visited: a timestamp or -1 to use the current time
10394  *
10395  * Sets the time the bookmark for @uri was last visited.
10396  *
10397  * If no bookmark for @uri is found then it is created.
10398  *
10399  * The "visited" time should only be set if the bookmark was launched,
10400  * either using the command line retrieved by g_bookmark_file_get_app_info()
10401  * or by the default application for the bookmark's MIME type, retrieved
10402  * using g_bookmark_file_get_mime_type().  Changing the "visited" time
10403  * does not affect the "modified" time.
10404  *
10405  * Since: 2.12
10406  */
10407
10408
10409 /**
10410  * g_bookmark_file_to_data:
10411  * @bookmark: a #GBookmarkFile
10412  * @length: (allow-none): return location for the length of the returned string, or %NULL
10413  * @error: return location for a #GError, or %NULL
10414  *
10415  * This function outputs @bookmark as a string.
10416  *
10417  * Returns: a newly allocated string holding the contents of the #GBookmarkFile
10418  * Since: 2.12
10419  */
10420
10421
10422 /**
10423  * g_bookmark_file_to_file:
10424  * @bookmark: a #GBookmarkFile
10425  * @filename: path of the output file
10426  * @error: return location for a #GError, or %NULL
10427  *
10428  * This function outputs @bookmark into a file.  The write process is
10429  * guaranteed to be atomic by using g_file_set_contents() internally.
10430  *
10431  * Returns: %TRUE if the file was successfully written.
10432  * Since: 2.12
10433  */
10434
10435
10436 /**
10437  * g_build_filename:
10438  * @first_element: the first element in the path
10439  * @...: remaining elements in path, terminated by %NULL
10440  *
10441  * Creates a filename from a series of elements using the correct
10442  * separator for filenames.
10443  *
10444  * On Unix, this function behaves identically to <literal>g_build_path
10445  * (G_DIR_SEPARATOR_S, first_element, ....)</literal>.
10446  *
10447  * On Windows, it takes into account that either the backslash
10448  * (<literal>\</literal> or slash (<literal>/</literal>) can be used
10449  * as separator in filenames, but otherwise behaves as on Unix. When
10450  * file pathname separators need to be inserted, the one that last
10451  * previously occurred in the parameters (reading from left to right)
10452  * is used.
10453  *
10454  * No attempt is made to force the resulting filename to be an absolute
10455  * path. If the first element is a relative path, the result will
10456  * be a relative path.
10457  *
10458  * Returns: a newly-allocated string that must be freed with g_free().
10459  */
10460
10461
10462 /**
10463  * g_build_filenamev:
10464  * @args: (array zero-terminated=1): %NULL-terminated array of strings containing the path elements.
10465  *
10466  * Behaves exactly like g_build_filename(), but takes the path elements
10467  * as a string array, instead of varargs. This function is mainly
10468  * meant for language bindings.
10469  *
10470  * Returns: a newly-allocated string that must be freed with g_free().
10471  * Since: 2.8
10472  */
10473
10474
10475 /**
10476  * g_build_path:
10477  * @separator: a string used to separator the elements of the path.
10478  * @first_element: the first element in the path
10479  * @...: remaining elements in path, terminated by %NULL
10480  *
10481  * Creates a path from a series of elements using @separator as the
10482  * separator between elements. At the boundary between two elements,
10483  * any trailing occurrences of separator in the first element, or
10484  * leading occurrences of separator in the second element are removed
10485  * and exactly one copy of the separator is inserted.
10486  *
10487  * Empty elements are ignored.
10488  *
10489  * The number of leading copies of the separator on the result is
10490  * the same as the number of leading copies of the separator on
10491  * the first non-empty element.
10492  *
10493  * The number of trailing copies of the separator on the result is
10494  * the same as the number of trailing copies of the separator on
10495  * the last non-empty element. (Determination of the number of
10496  * trailing copies is done without stripping leading copies, so
10497  * if the separator is <literal>ABA</literal>, <literal>ABABA</literal>
10498  * has 1 trailing copy.)
10499  *
10500  * However, if there is only a single non-empty element, and there
10501  * are no characters in that element not part of the leading or
10502  * trailing separators, then the result is exactly the original value
10503  * of that element.
10504  *
10505  * Other than for determination of the number of leading and trailing
10506  * copies of the separator, elements consisting only of copies
10507  * of the separator are ignored.
10508  *
10509  * Returns: a newly-allocated string that must be freed with g_free().
10510  */
10511
10512
10513 /**
10514  * g_build_pathv:
10515  * @separator: a string used to separator the elements of the path.
10516  * @args: (array zero-terminated=1): %NULL-terminated array of strings containing the path elements.
10517  *
10518  * Behaves exactly like g_build_path(), but takes the path elements
10519  * as a string array, instead of varargs. This function is mainly
10520  * meant for language bindings.
10521  *
10522  * Returns: a newly-allocated string that must be freed with g_free().
10523  * Since: 2.8
10524  */
10525
10526
10527 /**
10528  * g_byte_array_append:
10529  * @array: a #GByteArray.
10530  * @data: the byte data to be added.
10531  * @len: the number of bytes to add.
10532  *
10533  * Adds the given bytes to the end of the #GByteArray. The array will
10534  * grow in size automatically if necessary.
10535  *
10536  * Returns: the #GByteArray.
10537  */
10538
10539
10540 /**
10541  * g_byte_array_free:
10542  * @array: a #GByteArray.
10543  * @free_segment: if %TRUE the actual byte data is freed as well.
10544  *
10545  * Frees the memory allocated by the #GByteArray. If @free_segment is
10546  * %TRUE it frees the actual byte data. If the reference count of
10547  * @array is greater than one, the #GByteArray wrapper is preserved but
10548  * the size of @array will be set to zero.
10549  *
10550  * Returns: the element data if @free_segment is %FALSE, otherwise %NULL.  The element data should be freed using g_free().
10551  */
10552
10553
10554 /**
10555  * g_byte_array_free_to_bytes:
10556  * @array: (transfer full): a #GByteArray
10557  *
10558  * Transfers the data from the #GByteArray into a new immutable #GBytes.
10559  *
10560  * The #GByteArray is freed unless the reference count of @array is greater
10561  * than one, the #GByteArray wrapper is preserved but the size of @array
10562  * will be set to zero.
10563  *
10564  * This is identical to using g_bytes_new_take() and g_byte_array_free()
10565  * together.
10566  *
10567  * Since: 2.32
10568  * Returns: (transfer full): a new immutable #GBytes representing same byte data that was in the array
10569  */
10570
10571
10572 /**
10573  * g_byte_array_new:
10574  *
10575  * Creates a new #GByteArray with a reference count of 1.
10576  *
10577  * Returns: (transfer full): the new #GByteArray.
10578  */
10579
10580
10581 /**
10582  * g_byte_array_new_take:
10583  * @data: (transfer full) (array length=len): byte data for the array
10584  * @len: length of @data
10585  *
10586  * Create byte array containing the data. The data will be owned by the array
10587  * and will be freed with g_free(), i.e. it could be allocated using g_strdup().
10588  *
10589  * Since: 2.32
10590  * Returns: (transfer full): a new #GByteArray
10591  */
10592
10593
10594 /**
10595  * g_byte_array_prepend:
10596  * @array: a #GByteArray.
10597  * @data: the byte data to be added.
10598  * @len: the number of bytes to add.
10599  *
10600  * Adds the given data to the start of the #GByteArray. The array will
10601  * grow in size automatically if necessary.
10602  *
10603  * Returns: the #GByteArray.
10604  */
10605
10606
10607 /**
10608  * g_byte_array_ref:
10609  * @array: A #GByteArray.
10610  *
10611  * Atomically increments the reference count of @array by one. This
10612  * function is MT-safe and may be called from any thread.
10613  *
10614  * Returns: The passed in #GByteArray.
10615  * Since: 2.22
10616  */
10617
10618
10619 /**
10620  * g_byte_array_remove_index:
10621  * @array: a #GByteArray.
10622  * @index_: the index of the byte to remove.
10623  *
10624  * Removes the byte at the given index from a #GByteArray. The
10625  * following bytes are moved down one place.
10626  *
10627  * Returns: the #GByteArray.
10628  */
10629
10630
10631 /**
10632  * g_byte_array_remove_index_fast:
10633  * @array: a #GByteArray.
10634  * @index_: the index of the byte to remove.
10635  *
10636  * Removes the byte at the given index from a #GByteArray. The last
10637  * element in the array is used to fill in the space, so this function
10638  * does not preserve the order of the #GByteArray. But it is faster
10639  * than g_byte_array_remove_index().
10640  *
10641  * Returns: the #GByteArray.
10642  */
10643
10644
10645 /**
10646  * g_byte_array_remove_range:
10647  * @array: a @GByteArray.
10648  * @index_: the index of the first byte to remove.
10649  * @length: the number of bytes to remove.
10650  *
10651  * Removes the given number of bytes starting at the given index from a
10652  * #GByteArray.  The following elements are moved to close the gap.
10653  *
10654  * Returns: the #GByteArray.
10655  * Since: 2.4
10656  */
10657
10658
10659 /**
10660  * g_byte_array_set_size:
10661  * @array: a #GByteArray.
10662  * @length: the new size of the #GByteArray.
10663  *
10664  * Sets the size of the #GByteArray, expanding it if necessary.
10665  *
10666  * Returns: the #GByteArray.
10667  */
10668
10669
10670 /**
10671  * g_byte_array_sized_new:
10672  * @reserved_size: number of bytes preallocated.
10673  *
10674  * Creates a new #GByteArray with @reserved_size bytes preallocated.
10675  * This avoids frequent reallocation, if you are going to add many
10676  * bytes to the array. Note however that the size of the array is still
10677  * 0.
10678  *
10679  * Returns: the new #GByteArray.
10680  */
10681
10682
10683 /**
10684  * g_byte_array_sort:
10685  * @array: a #GByteArray.
10686  * @compare_func: comparison function.
10687  *
10688  * Sorts a byte array, using @compare_func which should be a
10689  * qsort()-style comparison function (returns less than zero for first
10690  * arg is less than second arg, zero for equal, greater than zero if
10691  * first arg is greater than second arg).
10692  *
10693  * If two array elements compare equal, their order in the sorted array
10694  * is undefined. If you want equal elements to keep their order (i.e.
10695  * you want a stable sort) you can write a comparison function that,
10696  * if two elements would otherwise compare equal, compares them by
10697  * their addresses.
10698  */
10699
10700
10701 /**
10702  * g_byte_array_sort_with_data:
10703  * @array: a #GByteArray.
10704  * @compare_func: comparison function.
10705  * @user_data: data to pass to @compare_func.
10706  *
10707  * Like g_byte_array_sort(), but the comparison function takes an extra
10708  * user data argument.
10709  */
10710
10711
10712 /**
10713  * g_byte_array_unref:
10714  * @array: A #GByteArray.
10715  *
10716  * Atomically decrements the reference count of @array by one. If the
10717  * reference count drops to 0, all memory allocated by the array is
10718  * released. This function is MT-safe and may be called from any
10719  * thread.
10720  *
10721  * Since: 2.22
10722  */
10723
10724
10725 /**
10726  * g_bytes_compare:
10727  * @bytes1: (type GLib.Bytes): a pointer to a #GBytes
10728  * @bytes2: (type GLib.Bytes): a pointer to a #GBytes to compare with @bytes1
10729  *
10730  * Compares the two #GBytes values.
10731  *
10732  * This function can be used to sort GBytes instances in lexographical order.
10733  *
10734  * Returns: a negative value if bytes2 is lesser, a positive value if bytes2 is greater, and zero if bytes2 is equal to bytes1
10735  * Since: 2.32
10736  */
10737
10738
10739 /**
10740  * g_bytes_equal:
10741  * @bytes1: (type GLib.Bytes): a pointer to a #GBytes
10742  * @bytes2: (type GLib.Bytes): a pointer to a #GBytes to compare with @bytes1
10743  *
10744  * Compares the two #GBytes values being pointed to and returns
10745  * %TRUE if they are equal.
10746  *
10747  * This function can be passed to g_hash_table_new() as the @key_equal_func
10748  * parameter, when using non-%NULL #GBytes pointers as keys in a #GHashTable.
10749  *
10750  * Returns: %TRUE if the two keys match.
10751  * Since: 2.32
10752  */
10753
10754
10755 /**
10756  * g_bytes_get_data:
10757  * @bytes: a #GBytes
10758  * @size: (out) (allow-none): location to return size of byte data
10759  *
10760  * Get the byte data in the #GBytes. This data should not be modified.
10761  *
10762  * This function will always return the same pointer for a given #GBytes.
10763  *
10764  * Returns: (transfer none) (array length=size) (type guint8): a pointer to the byte data
10765  * Since: 2.32
10766  */
10767
10768
10769 /**
10770  * g_bytes_get_size:
10771  * @bytes: a #GBytes
10772  *
10773  * Get the size of the byte data in the #GBytes.
10774  *
10775  * This function will always return the same value for a given #GBytes.
10776  *
10777  * Returns: the size
10778  * Since: 2.32
10779  */
10780
10781
10782 /**
10783  * g_bytes_hash:
10784  * @bytes: (type GLib.Bytes): a pointer to a #GBytes key
10785  *
10786  * Creates an integer hash code for the byte data in the #GBytes.
10787  *
10788  * This function can be passed to g_hash_table_new() as the @key_equal_func
10789  * parameter, when using non-%NULL #GBytes pointers as keys in a #GHashTable.
10790  *
10791  * Returns: a hash value corresponding to the key.
10792  * Since: 2.32
10793  */
10794
10795
10796 /**
10797  * g_bytes_new:
10798  * @data: (transfer none) (array length=size) (element-type guint8): the data to be used for the bytes
10799  * @size: the size of @data
10800  *
10801  * Creates a new #GBytes from @data.
10802  *
10803  * @data is copied.
10804  *
10805  * Returns: (transfer full): a new #GBytes
10806  * Since: 2.32
10807  */
10808
10809
10810 /**
10811  * g_bytes_new_from_bytes:
10812  * @bytes: a #GBytes
10813  * @offset: offset which subsection starts at
10814  * @length: length of subsection
10815  *
10816  * Creates a #GBytes which is a subsection of another #GBytes. The @offset +
10817  * @length may not be longer than the size of @bytes.
10818  *
10819  * A reference to @bytes will be held by the newly created #GBytes until
10820  * the byte data is no longer needed.
10821  *
10822  * Returns: (transfer full): a new #GBytes
10823  * Since: 2.32
10824  */
10825
10826
10827 /**
10828  * g_bytes_new_static: (skip)
10829  * @data: (transfer full) (array length=size) (element-type guint8): the data to be used for the bytes
10830  * @size: the size of @data
10831  *
10832  * Creates a new #GBytes from static data.
10833  *
10834  * @data must be static (ie: never modified or freed).
10835  *
10836  * Returns: (transfer full): a new #GBytes
10837  * Since: 2.32
10838  */
10839
10840
10841 /**
10842  * g_bytes_new_take:
10843  * @data: (transfer full) (array length=size) (element-type guint8): the data to be used for the bytes
10844  * @size: the size of @data
10845  *
10846  * Creates a new #GBytes from @data.
10847  *
10848  * After this call, @data belongs to the bytes and may no longer be
10849  * modified by the caller.  g_free() will be called on @data when the
10850  * bytes is no longer in use. Because of this @data must have been created by
10851  * a call to g_malloc(), g_malloc0() or g_realloc() or by one of the many
10852  * functions that wrap these calls (such as g_new(), g_strdup(), etc).
10853  *
10854  * For creating #GBytes with memory from other allocators, see
10855  * g_bytes_new_with_free_func().
10856  *
10857  * Returns: (transfer full): a new #GBytes
10858  * Since: 2.32
10859  */
10860
10861
10862 /**
10863  * g_bytes_new_with_free_func:
10864  * @data: (array length=size): the data to be used for the bytes
10865  * @size: the size of @data
10866  * @free_func: the function to call to release the data
10867  * @user_data: data to pass to @free_func
10868  *
10869  * Creates a #GBytes from @data.
10870  *
10871  * When the last reference is dropped, @free_func will be called with the
10872  * @user_data argument.
10873  *
10874  * @data must not be modified after this call is made until @free_func has
10875  * been called to indicate that the bytes is no longer in use.
10876  *
10877  * Returns: (transfer full): a new #GBytes
10878  * Since: 2.32
10879  */
10880
10881
10882 /**
10883  * g_bytes_ref:
10884  * @bytes: a #GBytes
10885  *
10886  * Increase the reference count on @bytes.
10887  *
10888  * Returns: the #GBytes
10889  * Since: 2.32
10890  */
10891
10892
10893 /**
10894  * g_bytes_unref:
10895  * @bytes: (allow-none): a #GBytes
10896  *
10897  * Releases a reference on @bytes.  This may result in the bytes being
10898  * freed.
10899  *
10900  * Since: 2.32
10901  */
10902
10903
10904 /**
10905  * g_bytes_unref_to_array:
10906  * @bytes: (transfer full): a #GBytes
10907  *
10908  * Unreferences the bytes, and returns a new mutable #GByteArray containing
10909  * the same byte data.
10910  *
10911  * As an optimization, the byte data is transferred to the array without copying
10912  * if this was the last reference to bytes and bytes was created with
10913  * g_bytes_new(), g_bytes_new_take() or g_byte_array_free_to_bytes(). In all
10914  * other cases the data is copied.
10915  *
10916  * Returns: (transfer full): a new mutable #GByteArray containing the same byte data
10917  * Since: 2.32
10918  */
10919
10920
10921 /**
10922  * g_bytes_unref_to_data:
10923  * @bytes: (transfer full): a #GBytes
10924  * @size: location to place the length of the returned data
10925  *
10926  * Unreferences the bytes, and returns a pointer the same byte data
10927  * contents.
10928  *
10929  * As an optimization, the byte data is returned without copying if this was
10930  * the last reference to bytes and bytes was created with g_bytes_new(),
10931  * g_bytes_new_take() or g_byte_array_free_to_bytes(). In all other cases the
10932  * data is copied.
10933  *
10934  * Returns: (transfer full): a pointer to the same byte data, which should be freed with g_free()
10935  * Since: 2.32
10936  */
10937
10938
10939 /**
10940  * g_chdir:
10941  * @path: a pathname in the GLib file name encoding (UTF-8 on Windows)
10942  *
10943  * A wrapper for the POSIX chdir() function. The function changes the
10944  * current directory of the process to @path.
10945  *
10946  * See your C library manual for more details about chdir().
10947  *
10948  * Returns: 0 on success, -1 if an error occurred.
10949  * Since: 2.8
10950  */
10951
10952
10953 /**
10954  * g_checksum_copy:
10955  * @checksum: the #GChecksum to copy
10956  *
10957  * Copies a #GChecksum. If @checksum has been closed, by calling
10958  * g_checksum_get_string() or g_checksum_get_digest(), the copied
10959  * checksum will be closed as well.
10960  *
10961  * Returns: the copy of the passed #GChecksum. Use g_checksum_free() when finished using it.
10962  * Since: 2.16
10963  */
10964
10965
10966 /**
10967  * g_checksum_free:
10968  * @checksum: a #GChecksum
10969  *
10970  * Frees the memory allocated for @checksum.
10971  *
10972  * Since: 2.16
10973  */
10974
10975
10976 /**
10977  * g_checksum_get_digest:
10978  * @checksum: a #GChecksum
10979  * @buffer: output buffer
10980  * @digest_len: an inout parameter. The caller initializes it to the size of @buffer. After the call it contains the length of the digest.
10981  *
10982  * Gets the digest from @checksum as a raw binary vector and places it
10983  * into @buffer. The size of the digest depends on the type of checksum.
10984  *
10985  * Once this function has been called, the #GChecksum is closed and can
10986  * no longer be updated with g_checksum_update().
10987  *
10988  * Since: 2.16
10989  */
10990
10991
10992 /**
10993  * g_checksum_get_string:
10994  * @checksum: a #GChecksum
10995  *
10996  * Gets the digest as an hexadecimal string.
10997  *
10998  * Once this function has been called the #GChecksum can no longer be
10999  * updated with g_checksum_update().
11000  *
11001  * The hexadecimal characters will be lower case.
11002  *
11003  * Returns: the hexadecimal representation of the checksum. The returned string is owned by the checksum and should not be modified or freed.
11004  * Since: 2.16
11005  */
11006
11007
11008 /**
11009  * g_checksum_new:
11010  * @checksum_type: the desired type of checksum
11011  *
11012  * Creates a new #GChecksum, using the checksum algorithm @checksum_type.
11013  * If the @checksum_type is not known, %NULL is returned.
11014  * A #GChecksum can be used to compute the checksum, or digest, of an
11015  * arbitrary binary blob, using different hashing algorithms.
11016  *
11017  * A #GChecksum works by feeding a binary blob through g_checksum_update()
11018  * until there is data to be checked; the digest can then be extracted
11019  * using g_checksum_get_string(), which will return the checksum as a
11020  * hexadecimal string; or g_checksum_get_digest(), which will return a
11021  * vector of raw bytes. Once either g_checksum_get_string() or
11022  * g_checksum_get_digest() have been called on a #GChecksum, the checksum
11023  * will be closed and it won't be possible to call g_checksum_update()
11024  * on it anymore.
11025  *
11026  * Returns: the newly created #GChecksum, or %NULL. Use g_checksum_free() to free the memory allocated by it.
11027  * Since: 2.16
11028  */
11029
11030
11031 /**
11032  * g_checksum_reset:
11033  * @checksum: the #GChecksum to reset
11034  *
11035  * Resets the state of the @checksum back to its initial state.
11036  *
11037  * Since: 2.18
11038  */
11039
11040
11041 /**
11042  * g_checksum_type_get_length:
11043  * @checksum_type: a #GChecksumType
11044  *
11045  * Gets the length in bytes of digests of type @checksum_type
11046  *
11047  * Returns: the checksum length, or -1 if @checksum_type is not supported.
11048  * Since: 2.16
11049  */
11050
11051
11052 /**
11053  * g_checksum_update:
11054  * @checksum: a #GChecksum
11055  * @data: buffer used to compute the checksum
11056  * @length: size of the buffer, or -1 if it is a null-terminated string.
11057  *
11058  * Feeds @data into an existing #GChecksum. The checksum must still be
11059  * open, that is g_checksum_get_string() or g_checksum_get_digest() must
11060  * not have been called on @checksum.
11061  *
11062  * Since: 2.16
11063  */
11064
11065
11066 /**
11067  * g_child_watch_add:
11068  * @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).
11069  * @function: function to call
11070  * @data: data to pass to @function
11071  *
11072  * Sets a function to be called when the child indicated by @pid
11073  * exits, at a default priority, #G_PRIORITY_DEFAULT.
11074  *
11075  * If you obtain @pid from g_spawn_async() or g_spawn_async_with_pipes()
11076  * you will need to pass #G_SPAWN_DO_NOT_REAP_CHILD as flag to
11077  * the spawn function for the child watching to work.
11078  *
11079  * Note that on platforms where #GPid must be explicitly closed
11080  * (see g_spawn_close_pid()) @pid must not be closed while the
11081  * source is still active. Typically, you will want to call
11082  * g_spawn_close_pid() in the callback function for the source.
11083  *
11084  * GLib supports only a single callback per process id.
11085  *
11086  * This internally creates a main loop source using
11087  * g_child_watch_source_new() and attaches it to the main loop context
11088  * using g_source_attach(). You can do these steps manually if you
11089  * need greater control.
11090  *
11091  * Returns: the ID (greater than 0) of the event source.
11092  * Since: 2.4
11093  */
11094
11095
11096 /**
11097  * g_child_watch_add_full:
11098  * @priority: the priority of the idle source. Typically this will be in the range between #G_PRIORITY_DEFAULT_IDLE and #G_PRIORITY_HIGH_IDLE.
11099  * @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).
11100  * @function: function to call
11101  * @data: data to pass to @function
11102  * @notify: (allow-none): function to call when the idle is removed, or %NULL
11103  *
11104  * Sets a function to be called when the child indicated by @pid
11105  * exits, at the priority @priority.
11106  *
11107  * If you obtain @pid from g_spawn_async() or g_spawn_async_with_pipes()
11108  * you will need to pass #G_SPAWN_DO_NOT_REAP_CHILD as flag to
11109  * the spawn function for the child watching to work.
11110  *
11111  * In many programs, you will want to call g_spawn_check_exit_status()
11112  * in the callback to determine whether or not the child exited
11113  * successfully.
11114  *
11115  * Also, note that on platforms where #GPid must be explicitly closed
11116  * (see g_spawn_close_pid()) @pid must not be closed while the source
11117  * is still active.  Typically, you should invoke g_spawn_close_pid()
11118  * in the callback function for the source.
11119  *
11120  * GLib supports only a single callback per process id.
11121  *
11122  * This internally creates a main loop source using
11123  * g_child_watch_source_new() and attaches it to the main loop context
11124  * using g_source_attach(). You can do these steps manually if you
11125  * need greater control.
11126  *
11127  * Returns: the ID (greater than 0) of the event source.
11128  * Rename to: g_child_watch_add
11129  * Since: 2.4
11130  */
11131
11132
11133 /**
11134  * g_child_watch_source_new:
11135  * @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).
11136  *
11137  * Creates a new child_watch source.
11138  *
11139  * The source will not initially be associated with any #GMainContext
11140  * and must be added to one with g_source_attach() before it will be
11141  * executed.
11142  *
11143  * Note that child watch sources can only be used in conjunction with
11144  * <literal>g_spawn...</literal> when the %G_SPAWN_DO_NOT_REAP_CHILD
11145  * flag is used.
11146  *
11147  * Note that on platforms where #GPid must be explicitly closed
11148  * (see g_spawn_close_pid()) @pid must not be closed while the
11149  * source is still active. Typically, you will want to call
11150  * g_spawn_close_pid() in the callback function for the source.
11151  *
11152  * Note further that using g_child_watch_source_new() is not
11153  * compatible with calling <literal>waitpid</literal> with a
11154  * nonpositive first argument in the application. Calling waitpid()
11155  * for individual pids will still work fine.
11156  *
11157  * Returns: the newly-created child watch source
11158  * Since: 2.4
11159  */
11160
11161
11162 /**
11163  * g_chmod:
11164  * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows)
11165  * @mode: as in chmod()
11166  *
11167  * A wrapper for the POSIX chmod() function. The chmod() function is
11168  * used to set the permissions of a file system object.
11169  *
11170  * On Windows the file protection mechanism is not at all POSIX-like,
11171  * and the underlying chmod() function in the C library just sets or
11172  * clears the FAT-style READONLY attribute. It does not touch any
11173  * ACL. Software that needs to manage file permissions on Windows
11174  * exactly should use the Win32 API.
11175  *
11176  * See your C library manual for more details about chmod().
11177  *
11178  * Returns: zero if the operation succeeded, -1 on error.
11179  * Since: 2.8
11180  */
11181
11182
11183 /**
11184  * g_clear_error:
11185  * @err: a #GError return location
11186  *
11187  * If @err is %NULL, does nothing. If @err is non-%NULL,
11188  * calls g_error_free() on *@err and sets *@err to %NULL.
11189  */
11190
11191
11192 /**
11193  * g_clear_pointer: (skip)
11194  * @pp: a pointer to a variable, struct member etc. holding a pointer
11195  * @destroy: a function to which a gpointer can be passed, to destroy *@pp
11196  *
11197  * Clears a reference to a variable.
11198  *
11199  * @pp must not be %NULL.
11200  *
11201  * If the reference is %NULL then this function does nothing.
11202  * Otherwise, the variable is destroyed using @destroy and the
11203  * pointer is set to %NULL.
11204  *
11205  * This function is threadsafe and modifies the pointer atomically,
11206  * using memory barriers where needed.
11207  *
11208  * A macro is also included that allows this function to be used without
11209  * pointer casts.
11210  *
11211  * Since: 2.34
11212  */
11213
11214
11215 /**
11216  * g_compute_checksum_for_bytes:
11217  * @checksum_type: a #GChecksumType
11218  * @data: binary blob to compute the digest of
11219  *
11220  * Computes the checksum for a binary @data. This is a
11221  * convenience wrapper for g_checksum_new(), g_checksum_get_string()
11222  * and g_checksum_free().
11223  *
11224  * The hexadecimal string returned will be in lower case.
11225  *
11226  * 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.
11227  * Since: 2.34
11228  */
11229
11230
11231 /**
11232  * g_compute_checksum_for_data:
11233  * @checksum_type: a #GChecksumType
11234  * @data: binary blob to compute the digest of
11235  * @length: length of @data
11236  *
11237  * Computes the checksum for a binary @data of @length. This is a
11238  * convenience wrapper for g_checksum_new(), g_checksum_get_string()
11239  * and g_checksum_free().
11240  *
11241  * The hexadecimal string returned will be in lower case.
11242  *
11243  * 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.
11244  * Since: 2.16
11245  */
11246
11247
11248 /**
11249  * g_compute_checksum_for_string:
11250  * @checksum_type: a #GChecksumType
11251  * @str: the string to compute the checksum of
11252  * @length: the length of the string, or -1 if the string is null-terminated.
11253  *
11254  * Computes the checksum of a string.
11255  *
11256  * The hexadecimal string returned will be in lower case.
11257  *
11258  * Returns: the checksum as a hexadecimal string. The returned string should be freed with g_free() when done using it.
11259  * Since: 2.16
11260  */
11261
11262
11263 /**
11264  * g_compute_hmac_for_data:
11265  * @digest_type: a #GChecksumType to use for the HMAC
11266  * @key: (array length=key_len): the key to use in the HMAC
11267  * @key_len: the length of the key
11268  * @data: binary blob to compute the HMAC of
11269  * @length: length of @data
11270  *
11271  * Computes the HMAC for a binary @data of @length. This is a
11272  * convenience wrapper for g_hmac_new(), g_hmac_get_string()
11273  * and g_hmac_unref().
11274  *
11275  * The hexadecimal string returned will be in lower case.
11276  *
11277  * 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.
11278  * Since: 2.30
11279  */
11280
11281
11282 /**
11283  * g_compute_hmac_for_string:
11284  * @digest_type: a #GChecksumType to use for the HMAC
11285  * @key: (array length=key_len): the key to use in the HMAC
11286  * @key_len: the length of the key
11287  * @str: the string to compute the HMAC for
11288  * @length: the length of the string, or -1 if the string is nul-terminated
11289  *
11290  * Computes the HMAC for a string.
11291  *
11292  * The hexadecimal string returned will be in lower case.
11293  *
11294  * Returns: the HMAC as a hexadecimal string. The returned string should be freed with g_free() when done using it.
11295  * Since: 2.30
11296  */
11297
11298
11299 /**
11300  * g_cond_broadcast:
11301  * @cond: a #GCond
11302  *
11303  * If threads are waiting for @cond, all of them are unblocked.
11304  * If no threads are waiting for @cond, this function has no effect.
11305  * It is good practice to lock the same mutex as the waiting threads
11306  * while calling this function, though not required.
11307  */
11308
11309
11310 /**
11311  * g_cond_clear:
11312  * @cond: an initialised #GCond
11313  *
11314  * Frees the resources allocated to a #GCond with g_cond_init().
11315  *
11316  * This function should not be used with a #GCond that has been
11317  * statically allocated.
11318  *
11319  * Calling g_cond_clear() for a #GCond on which threads are
11320  * blocking leads to undefined behaviour.
11321  *
11322  * Since: 2.32
11323  */
11324
11325
11326 /**
11327  * g_cond_init:
11328  * @cond: an uninitialized #GCond
11329  *
11330  * Initialises a #GCond so that it can be used.
11331  *
11332  * This function is useful to initialise a #GCond that has been
11333  * allocated as part of a larger structure.  It is not necessary to
11334  * initialise a #GCond that has been statically allocated.
11335  *
11336  * To undo the effect of g_cond_init() when a #GCond is no longer
11337  * needed, use g_cond_clear().
11338  *
11339  * Calling g_cond_init() on an already-initialised #GCond leads
11340  * to undefined behaviour.
11341  *
11342  * Since: 2.32
11343  */
11344
11345
11346 /**
11347  * g_cond_signal:
11348  * @cond: a #GCond
11349  *
11350  * If threads are waiting for @cond, at least one of them is unblocked.
11351  * If no threads are waiting for @cond, this function has no effect.
11352  * It is good practice to hold the same lock as the waiting thread
11353  * while calling this function, though not required.
11354  */
11355
11356
11357 /**
11358  * g_cond_wait:
11359  * @cond: a #GCond
11360  * @mutex: a #GMutex that is currently locked
11361  *
11362  * Atomically releases @mutex and waits until @cond is signalled.
11363  *
11364  * When using condition variables, it is possible that a spurious wakeup
11365  * may occur (ie: g_cond_wait() returns even though g_cond_signal() was
11366  * not called).  It's also possible that a stolen wakeup may occur.
11367  * This is when g_cond_signal() is called, but another thread acquires
11368  * @mutex before this thread and modifies the state of the program in
11369  * such a way that when g_cond_wait() is able to return, the expected
11370  * condition is no longer met.
11371  *
11372  * For this reason, g_cond_wait() must always be used in a loop.  See
11373  * the documentation for #GCond for a complete example.
11374  */
11375
11376
11377 /**
11378  * g_cond_wait_until:
11379  * @cond: a #GCond
11380  * @mutex: a #GMutex that is currently locked
11381  * @end_time: the monotonic time to wait until
11382  *
11383  * Waits until either @cond is signalled or @end_time has passed.
11384  *
11385  * As with g_cond_wait() it is possible that a spurious or stolen wakeup
11386  * could occur.  For that reason, waiting on a condition variable should
11387  * always be in a loop, based on an explicitly-checked predicate.
11388  *
11389  * %TRUE is returned if the condition variable was signalled (or in the
11390  * case of a spurious wakeup).  %FALSE is returned if @end_time has
11391  * passed.
11392  *
11393  * The following code shows how to correctly perform a timed wait on a
11394  * condition variable (extended the example presented in the
11395  * documentation for #GCond):
11396  *
11397  * |[
11398  * gpointer
11399  * pop_data_timed (void)
11400  * {
11401  *   gint64 end_time;
11402  *   gpointer data;
11403  *
11404  *   g_mutex_lock (&data_mutex);
11405  *
11406  *   end_time = g_get_monotonic_time () + 5 * G_TIME_SPAN_SECOND;
11407  *   while (!current_data)
11408  *     if (!g_cond_wait_until (&data_cond, &data_mutex, end_time))
11409  *       {
11410  *         // timeout has passed.
11411  *         g_mutex_unlock (&data_mutex);
11412  *         return NULL;
11413  *       }
11414  *
11415  *   // there is data for us
11416  *   data = current_data;
11417  *   current_data = NULL;
11418  *
11419  *   g_mutex_unlock (&data_mutex);
11420  *
11421  *   return data;
11422  * }
11423  * ]|
11424  *
11425  * Notice that the end time is calculated once, before entering the
11426  * loop and reused.  This is the motivation behind the use of absolute
11427  * time on this API -- if a relative time of 5 seconds were passed
11428  * directly to the call and a spurious wakeup occurred, the program would
11429  * have to start over waiting again (which would lead to a total wait
11430  * time of more than 5 seconds).
11431  *
11432  * Returns: %TRUE on a signal, %FALSE on a timeout
11433  * Since: 2.32
11434  */
11435
11436
11437 /**
11438  * g_convert:
11439  * @str: the string to convert
11440  * @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>.
11441  * @to_codeset: name of character set into which to convert @str
11442  * @from_codeset: character set of @str.
11443  * @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.
11444  * @bytes_written: (out): the number of bytes stored in the output buffer (not including the terminating nul).
11445  * @error: location to store the error occurring, or %NULL to ignore errors. Any of the errors in #GConvertError may occur.
11446  *
11447  * Converts a string from one character set to another.
11448  *
11449  * Note that you should use g_iconv() for streaming
11450  * conversions<footnoteref linkend="streaming-state"/>.
11451  *
11452  * 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.
11453  */
11454
11455
11456 /**
11457  * g_convert_with_fallback:
11458  * @str: the string to convert
11459  * @len: the length of the string, or -1 if the string is nul-terminated<footnoteref linkend="nul-unsafe"/>.
11460  * @to_codeset: name of character set into which to convert @str
11461  * @from_codeset: character set of @str.
11462  * @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.
11463  * @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.
11464  * @bytes_written: the number of bytes stored in the output buffer (not including the terminating nul).
11465  * @error: location to store the error occurring, or %NULL to ignore errors. Any of the errors in #GConvertError may occur.
11466  *
11467  * Converts a string from one character set to another, possibly
11468  * including fallback sequences for characters not representable
11469  * in the output. Note that it is not guaranteed that the specification
11470  * for the fallback sequences in @fallback will be honored. Some
11471  * systems may do an approximate conversion from @from_codeset
11472  * to @to_codeset in their iconv() functions,
11473  * in which case GLib will simply return that approximate conversion.
11474  *
11475  * Note that you should use g_iconv() for streaming
11476  * conversions<footnoteref linkend="streaming-state"/>.
11477  *
11478  * 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.
11479  */
11480
11481
11482 /**
11483  * g_convert_with_iconv:
11484  * @str: the string to convert
11485  * @len: the length of the string, or -1 if the string is nul-terminated<footnoteref linkend="nul-unsafe"/>.
11486  * @converter: conversion descriptor from g_iconv_open()
11487  * @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.
11488  * @bytes_written: the number of bytes stored in the output buffer (not including the terminating nul).
11489  * @error: location to store the error occurring, or %NULL to ignore errors. Any of the errors in #GConvertError may occur.
11490  *
11491  * Converts a string from one character set to another.
11492  *
11493  * Note that you should use g_iconv() for streaming
11494  * conversions<footnote id="streaming-state">
11495  *  <para>
11496  * Despite the fact that @byes_read can return information about partial
11497  * characters, the <literal>g_convert_...</literal> functions
11498  * are not generally suitable for streaming. If the underlying converter
11499  * being used maintains internal state, then this won't be preserved
11500  * across successive calls to g_convert(), g_convert_with_iconv() or
11501  * g_convert_with_fallback(). (An example of this is the GNU C converter
11502  * for CP1255 which does not emit a base character until it knows that
11503  * the next character is not a mark that could combine with the base
11504  * character.)
11505  *  </para>
11506  * </footnote>.
11507  *
11508  * 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.
11509  */
11510
11511
11512 /**
11513  * g_creat:
11514  * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows)
11515  * @mode: as in creat()
11516  *
11517  * A wrapper for the POSIX creat() function. The creat() function is
11518  * used to convert a pathname into a file descriptor, creating a file
11519  * if necessary.
11520  *
11521  * On POSIX systems file descriptors are implemented by the operating
11522  * system. On Windows, it's the C library that implements creat() and
11523  * file descriptors. The actual Windows API for opening files is
11524  * different, see MSDN documentation for CreateFile(). The Win32 API
11525  * uses file handles, which are more randomish integers, not small
11526  * integers like file descriptors.
11527  *
11528  * Because file descriptors are specific to the C library on Windows,
11529  * the file descriptor returned by this function makes sense only to
11530  * functions in the same C library. Thus if the GLib-using code uses a
11531  * different C library than GLib does, the file descriptor returned by
11532  * this function cannot be passed to C library functions like write()
11533  * or read().
11534  *
11535  * See your C library manual for more details about creat().
11536  *
11537  * Returns: a new file descriptor, or -1 if an error occurred. The return value can be used exactly like the return value from creat().
11538  * Since: 2.8
11539  */
11540
11541
11542 /**
11543  * g_critical:
11544  * @...: format string, followed by parameters to insert into the format string (as with printf())
11545  *
11546  * Logs a "critical warning" (#G_LOG_LEVEL_CRITICAL).
11547  * It's more or less application-defined what constitutes
11548  * a critical vs. a regular warning. You could call
11549  * g_log_set_always_fatal() to make critical warnings exit
11550  * the program, then use g_critical() for fatal errors, for
11551  * example.
11552  *
11553  * You can also make critical warnings fatal at runtime by
11554  * setting the <envar>G_DEBUG</envar> environment variable (see
11555  * <ulink url="glib-running.html">Running GLib Applications</ulink>).
11556  */
11557
11558
11559 /**
11560  * g_datalist_clear:
11561  * @datalist: a datalist.
11562  *
11563  * Frees all the data elements of the datalist.
11564  * The data elements' destroy functions are called
11565  * if they have been set.
11566  */
11567
11568
11569 /**
11570  * g_datalist_foreach:
11571  * @datalist: a datalist.
11572  * @func: the function to call for each data element.
11573  * @user_data: user data to pass to the function.
11574  *
11575  * Calls the given function for each data element of the datalist. The
11576  * function is called with each data element's #GQuark id and data,
11577  * together with the given @user_data parameter. Note that this
11578  * function is NOT thread-safe. So unless @datalist can be protected
11579  * from any modifications during invocation of this function, it should
11580  * not be called.
11581  */
11582
11583
11584 /**
11585  * g_datalist_get_data:
11586  * @datalist: a datalist.
11587  * @key: the string identifying a data element.
11588  *
11589  * Gets a data element, using its string identifier. This is slower than
11590  * g_datalist_id_get_data() because it compares strings.
11591  *
11592  * Returns: the data element, or %NULL if it is not found.
11593  */
11594
11595
11596 /**
11597  * g_datalist_get_flags:
11598  * @datalist: pointer to the location that holds a list
11599  *
11600  * Gets flags values packed in together with the datalist.
11601  * See g_datalist_set_flags().
11602  *
11603  * Returns: the flags of the datalist
11604  * Since: 2.8
11605  */
11606
11607
11608 /**
11609  * g_datalist_id_dup_data:
11610  * @datalist: location of a datalist
11611  * @key_id: the #GQuark identifying a data element
11612  * @dup_func: (allow-none): function to duplicate the old value
11613  * @user_data: (allow-none): passed as user_data to @dup_func
11614  *
11615  * This is a variant of g_datalist_id_get_data() which
11616  * returns a 'duplicate' of the value. @dup_func defines the
11617  * meaning of 'duplicate' in this context, it could e.g.
11618  * take a reference on a ref-counted object.
11619  *
11620  * If the @key_id is not set in the datalist then @dup_func
11621  * will be called with a %NULL argument.
11622  *
11623  * Note that @dup_func is called while the datalist is locked, so it
11624  * is not allowed to read or modify the datalist.
11625  *
11626  * This function can be useful to avoid races when multiple
11627  * threads are using the same datalist and the same key.
11628  *
11629  * 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.
11630  * Since: 2.34
11631  */
11632
11633
11634 /**
11635  * g_datalist_id_get_data:
11636  * @datalist: a datalist.
11637  * @key_id: the #GQuark identifying a data element.
11638  *
11639  * Retrieves the data element corresponding to @key_id.
11640  *
11641  * Returns: the data element, or %NULL if it is not found.
11642  */
11643
11644
11645 /**
11646  * g_datalist_id_remove_data:
11647  * @dl: a datalist.
11648  * @q: the #GQuark identifying the data element.
11649  *
11650  * Removes an element, using its #GQuark identifier.
11651  */
11652
11653
11654 /**
11655  * g_datalist_id_remove_no_notify:
11656  * @datalist: a datalist.
11657  * @key_id: the #GQuark identifying a data element.
11658  *
11659  * Removes an element, without calling its destroy notification
11660  * function.
11661  *
11662  * Returns: the data previously stored at @key_id, or %NULL if none.
11663  */
11664
11665
11666 /**
11667  * g_datalist_id_replace_data:
11668  * @datalist: location of a datalist
11669  * @key_id: the #GQuark identifying a data element
11670  * @oldval: (allow-none): the old value to compare against
11671  * @newval: (allow-none): the new value to replace it with
11672  * @destroy: (allow-none): destroy notify for the new value
11673  * @old_destroy: (allow-none): destroy notify for the existing value
11674  *
11675  * Compares the member that is associated with @key_id in
11676  * @datalist to @oldval, and if they are the same, replace
11677  * @oldval with @newval.
11678  *
11679  * This is like a typical atomic compare-and-exchange
11680  * operation, for a member of @datalist.
11681  *
11682  * If the previous value was replaced then ownership of the
11683  * old value (@oldval) is passed to the caller, including
11684  * the registred destroy notify for it (passed out in @old_destroy).
11685  * Its up to the caller to free this as he wishes, which may
11686  * or may not include using @old_destroy as sometimes replacement
11687  * should not destroy the object in the normal way.
11688  *
11689  * Return: %TRUE if the existing value for @key_id was replaced
11690  *  by @newval, %FALSE otherwise.
11691  *
11692  * Since: 2.34
11693  */
11694
11695
11696 /**
11697  * g_datalist_id_set_data:
11698  * @dl: a datalist.
11699  * @q: the #GQuark to identify the data element.
11700  * @d: (allow-none): the data element, or %NULL to remove any previous element corresponding to @q.
11701  *
11702  * Sets the data corresponding to the given #GQuark id. Any previous
11703  * data with the same key is removed, and its destroy function is
11704  * called.
11705  */
11706
11707
11708 /**
11709  * g_datalist_id_set_data_full:
11710  * @datalist: a datalist.
11711  * @key_id: the #GQuark to identify the data element.
11712  * @data: (allow-none): the data element or %NULL to remove any previous element corresponding to @key_id.
11713  * @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.
11714  *
11715  * Sets the data corresponding to the given #GQuark id, and the
11716  * function to be called when the element is removed from the datalist.
11717  * Any previous data with the same key is removed, and its destroy
11718  * function is called.
11719  */
11720
11721
11722 /**
11723  * g_datalist_init:
11724  * @datalist: a pointer to a pointer to a datalist.
11725  *
11726  * Resets the datalist to %NULL. It does not free any memory or call
11727  * any destroy functions.
11728  */
11729
11730
11731 /**
11732  * g_datalist_remove_data:
11733  * @dl: a datalist.
11734  * @k: the string identifying the data element.
11735  *
11736  * Removes an element using its string identifier. The data element's
11737  * destroy function is called if it has been set.
11738  */
11739
11740
11741 /**
11742  * g_datalist_remove_no_notify:
11743  * @dl: a datalist.
11744  * @k: the string identifying the data element.
11745  *
11746  * Removes an element, without calling its destroy notifier.
11747  */
11748
11749
11750 /**
11751  * g_datalist_set_data:
11752  * @dl: a datalist.
11753  * @k: the string to identify the data element.
11754  * @d: (allow-none): the data element, or %NULL to remove any previous element corresponding to @k.
11755  *
11756  * Sets the data element corresponding to the given string identifier.
11757  */
11758
11759
11760 /**
11761  * g_datalist_set_data_full:
11762  * @dl: a datalist.
11763  * @k: the string to identify the data element.
11764  * @d: (allow-none): the data element, or %NULL to remove any previous element corresponding to @k.
11765  * @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.
11766  *
11767  * Sets the data element corresponding to the given string identifier,
11768  * and the function to be called when the data element is removed.
11769  */
11770
11771
11772 /**
11773  * g_datalist_set_flags:
11774  * @datalist: pointer to the location that holds a list
11775  * @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.
11776  *
11777  * Turns on flag values for a data list. This function is used
11778  * to keep a small number of boolean flags in an object with
11779  * a data list without using any additional space. It is
11780  * not generally useful except in circumstances where space
11781  * is very tight. (It is used in the base #GObject type, for
11782  * example.)
11783  *
11784  * Since: 2.8
11785  */
11786
11787
11788 /**
11789  * g_datalist_unset_flags:
11790  * @datalist: pointer to the location that holds a list
11791  * @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.
11792  *
11793  * Turns off flag values for a data list. See g_datalist_unset_flags()
11794  *
11795  * Since: 2.8
11796  */
11797
11798
11799 /**
11800  * g_dataset_destroy:
11801  * @dataset_location: the location identifying the dataset.
11802  *
11803  * Destroys the dataset, freeing all memory allocated, and calling any
11804  * destroy functions set for data elements.
11805  */
11806
11807
11808 /**
11809  * g_dataset_foreach:
11810  * @dataset_location: the location identifying the dataset.
11811  * @func: the function to call for each data element.
11812  * @user_data: user data to pass to the function.
11813  *
11814  * Calls the given function for each data element which is associated
11815  * with the given location. Note that this function is NOT thread-safe.
11816  * So unless @datalist can be protected from any modifications during
11817  * invocation of this function, it should not be called.
11818  */
11819
11820
11821 /**
11822  * g_dataset_get_data:
11823  * @l: the location identifying the dataset.
11824  * @k: the string identifying the data element.
11825  *
11826  * Gets the data element corresponding to a string.
11827  *
11828  * Returns: the data element corresponding to the string, or %NULL if it is not found.
11829  */
11830
11831
11832 /**
11833  * g_dataset_id_get_data:
11834  * @dataset_location: the location identifying the dataset.
11835  * @key_id: the #GQuark id to identify the data element.
11836  *
11837  * Gets the data element corresponding to a #GQuark.
11838  *
11839  * Returns: the data element corresponding to the #GQuark, or %NULL if it is not found.
11840  */
11841
11842
11843 /**
11844  * g_dataset_id_remove_data:
11845  * @l: the location identifying the dataset.
11846  * @k: the #GQuark id identifying the data element.
11847  *
11848  * Removes a data element from a dataset. The data element's destroy
11849  * function is called if it has been set.
11850  */
11851
11852
11853 /**
11854  * g_dataset_id_remove_no_notify:
11855  * @dataset_location: the location identifying the dataset.
11856  * @key_id: the #GQuark ID identifying the data element.
11857  *
11858  * Removes an element, without calling its destroy notification
11859  * function.
11860  *
11861  * Returns: the data previously stored at @key_id, or %NULL if none.
11862  */
11863
11864
11865 /**
11866  * g_dataset_id_set_data:
11867  * @l: the location identifying the dataset.
11868  * @k: the #GQuark id to identify the data element.
11869  * @d: the data element.
11870  *
11871  * Sets the data element associated with the given #GQuark id. Any
11872  * previous data with the same key is removed, and its destroy function
11873  * is called.
11874  */
11875
11876
11877 /**
11878  * g_dataset_id_set_data_full:
11879  * @dataset_location: the location identifying the dataset.
11880  * @key_id: the #GQuark id to identify the data element.
11881  * @data: the data element.
11882  * @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.
11883  *
11884  * Sets the data element associated with the given #GQuark id, and also
11885  * the function to call when the data element is destroyed. Any
11886  * previous data with the same key is removed, and its destroy function
11887  * is called.
11888  */
11889
11890
11891 /**
11892  * g_dataset_remove_data:
11893  * @l: the location identifying the dataset.
11894  * @k: the string identifying the data element.
11895  *
11896  * Removes a data element corresponding to a string. Its destroy
11897  * function is called if it has been set.
11898  */
11899
11900
11901 /**
11902  * g_dataset_remove_no_notify:
11903  * @l: the location identifying the dataset.
11904  * @k: the string identifying the data element.
11905  *
11906  * Removes an element, without calling its destroy notifier.
11907  */
11908
11909
11910 /**
11911  * g_dataset_set_data:
11912  * @l: the location identifying the dataset.
11913  * @k: the string to identify the data element.
11914  * @d: the data element.
11915  *
11916  * Sets the data corresponding to the given string identifier.
11917  */
11918
11919
11920 /**
11921  * g_dataset_set_data_full:
11922  * @l: the location identifying the dataset.
11923  * @k: the string to identify the data element.
11924  * @d: the data element.
11925  * @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.
11926  *
11927  * Sets the data corresponding to the given string identifier, and the
11928  * function to call when the data element is destroyed.
11929  */
11930
11931
11932 /**
11933  * g_date_add_days:
11934  * @date: a #GDate to increment
11935  * @n_days: number of days to move the date forward
11936  *
11937  * Increments a date some number of days.
11938  * To move forward by weeks, add weeks*7 days.
11939  * The date must be valid.
11940  */
11941
11942
11943 /**
11944  * g_date_add_months:
11945  * @date: a #GDate to increment
11946  * @n_months: number of months to move forward
11947  *
11948  * Increments a date by some number of months.
11949  * If the day of the month is greater than 28,
11950  * this routine may change the day of the month
11951  * (because the destination month may not have
11952  * the current day in it). The date must be valid.
11953  */
11954
11955
11956 /**
11957  * g_date_add_years:
11958  * @date: a #GDate to increment
11959  * @n_years: number of years to move forward
11960  *
11961  * Increments a date by some number of years.
11962  * If the date is February 29, and the destination
11963  * year is not a leap year, the date will be changed
11964  * to February 28. The date must be valid.
11965  */
11966
11967
11968 /**
11969  * g_date_clamp:
11970  * @date: a #GDate to clamp
11971  * @min_date: minimum accepted value for @date
11972  * @max_date: maximum accepted value for @date
11973  *
11974  * If @date is prior to @min_date, sets @date equal to @min_date.
11975  * If @date falls after @max_date, sets @date equal to @max_date.
11976  * Otherwise, @date is unchanged.
11977  * Either of @min_date and @max_date may be %NULL.
11978  * All non-%NULL dates must be valid.
11979  */
11980
11981
11982 /**
11983  * g_date_clear:
11984  * @date: pointer to one or more dates to clear
11985  * @n_dates: number of dates to clear
11986  *
11987  * Initializes one or more #GDate structs to a sane but invalid
11988  * state. The cleared dates will not represent an existing date, but will
11989  * not contain garbage. Useful to init a date declared on the stack.
11990  * Validity can be tested with g_date_valid().
11991  */
11992
11993
11994 /**
11995  * g_date_compare:
11996  * @lhs: first date to compare
11997  * @rhs: second date to compare
11998  *
11999  * qsort()-style comparison function for dates.
12000  * Both dates must be valid.
12001  *
12002  * Returns: 0 for equal, less than zero if @lhs is less than @rhs, greater than zero if @lhs is greater than @rhs
12003  */
12004
12005
12006 /**
12007  * g_date_days_between:
12008  * @date1: the first date
12009  * @date2: the second date
12010  *
12011  * Computes the number of days between two dates.
12012  * If @date2 is prior to @date1, the returned value is negative.
12013  * Both dates must be valid.
12014  *
12015  * Returns: the number of days between @date1 and @date2
12016  */
12017
12018
12019 /**
12020  * g_date_free:
12021  * @date: a #GDate to free
12022  *
12023  * Frees a #GDate returned from g_date_new().
12024  */
12025
12026
12027 /**
12028  * g_date_get_day:
12029  * @date: a #GDate to extract the day of the month from
12030  *
12031  * Returns the day of the month. The date must be valid.
12032  *
12033  * Returns: day of the month
12034  */
12035
12036
12037 /**
12038  * g_date_get_day_of_year:
12039  * @date: a #GDate to extract day of year from
12040  *
12041  * Returns the day of the year, where Jan 1 is the first day of the
12042  * year. The date must be valid.
12043  *
12044  * Returns: day of the year
12045  */
12046
12047
12048 /**
12049  * g_date_get_days_in_month:
12050  * @month: month
12051  * @year: year
12052  *
12053  * Returns the number of days in a month, taking leap
12054  * years into account.
12055  *
12056  * Returns: number of days in @month during the @year
12057  */
12058
12059
12060 /**
12061  * g_date_get_iso8601_week_of_year:
12062  * @date: a valid #GDate
12063  *
12064  * Returns the week of the year, where weeks are interpreted according
12065  * to ISO 8601.
12066  *
12067  * Returns: ISO 8601 week number of the year.
12068  * Since: 2.6
12069  */
12070
12071
12072 /**
12073  * g_date_get_julian:
12074  * @date: a #GDate to extract the Julian day from
12075  *
12076  * Returns the Julian day or "serial number" of the #GDate. The
12077  * Julian day is simply the number of days since January 1, Year 1; i.e.,
12078  * January 1, Year 1 is Julian day 1; January 2, Year 1 is Julian day 2,
12079  * etc. The date must be valid.
12080  *
12081  * Returns: Julian day
12082  */
12083
12084
12085 /**
12086  * g_date_get_monday_week_of_year:
12087  * @date: a #GDate
12088  *
12089  * Returns the week of the year, where weeks are understood to start on
12090  * Monday. If the date is before the first Monday of the year, return
12091  * 0. The date must be valid.
12092  *
12093  * Returns: week of the year
12094  */
12095
12096
12097 /**
12098  * g_date_get_monday_weeks_in_year:
12099  * @year: a year
12100  *
12101  * Returns the number of weeks in the year, where weeks
12102  * are taken to start on Monday. Will be 52 or 53. The
12103  * date must be valid. (Years always have 52 7-day periods,
12104  * plus 1 or 2 extra days depending on whether it's a leap
12105  * year. This function is basically telling you how many
12106  * Mondays are in the year, i.e. there are 53 Mondays if
12107  * one of the extra days happens to be a Monday.)
12108  *
12109  * Returns: number of Mondays in the year
12110  */
12111
12112
12113 /**
12114  * g_date_get_month:
12115  * @date: a #GDate to get the month from
12116  *
12117  * Returns the month of the year. The date must be valid.
12118  *
12119  * Returns: month of the year as a #GDateMonth
12120  */
12121
12122
12123 /**
12124  * g_date_get_sunday_week_of_year:
12125  * @date: a #GDate
12126  *
12127  * Returns the week of the year during which this date falls, if weeks
12128  * are understood to being on Sunday. The date must be valid. Can return
12129  * 0 if the day is before the first Sunday of the year.
12130  *
12131  * Returns: week number
12132  */
12133
12134
12135 /**
12136  * g_date_get_sunday_weeks_in_year:
12137  * @year: year to count weeks in
12138  *
12139  * Returns the number of weeks in the year, where weeks
12140  * are taken to start on Sunday. Will be 52 or 53. The
12141  * date must be valid. (Years always have 52 7-day periods,
12142  * plus 1 or 2 extra days depending on whether it's a leap
12143  * year. This function is basically telling you how many
12144  * Sundays are in the year, i.e. there are 53 Sundays if
12145  * one of the extra days happens to be a Sunday.)
12146  *
12147  * Returns: the number of weeks in @year
12148  */
12149
12150
12151 /**
12152  * g_date_get_weekday:
12153  * @date: a #GDate
12154  *
12155  * Returns the day of the week for a #GDate. The date must be valid.
12156  *
12157  * Returns: day of the week as a #GDateWeekday.
12158  */
12159
12160
12161 /**
12162  * g_date_get_year:
12163  * @date: a #GDate
12164  *
12165  * Returns the year of a #GDate. The date must be valid.
12166  *
12167  * Returns: year in which the date falls
12168  */
12169
12170
12171 /**
12172  * g_date_is_first_of_month:
12173  * @date: a #GDate to check
12174  *
12175  * Returns %TRUE if the date is on the first of a month.
12176  * The date must be valid.
12177  *
12178  * Returns: %TRUE if the date is the first of the month
12179  */
12180
12181
12182 /**
12183  * g_date_is_last_of_month:
12184  * @date: a #GDate to check
12185  *
12186  * Returns %TRUE if the date is the last day of the month.
12187  * The date must be valid.
12188  *
12189  * Returns: %TRUE if the date is the last day of the month
12190  */
12191
12192
12193 /**
12194  * g_date_is_leap_year:
12195  * @year: year to check
12196  *
12197  * Returns %TRUE if the year is a leap year.
12198  * <footnote><para>For the purposes of this function,
12199  * leap year is every year divisible by 4 unless that year
12200  * is divisible by 100. If it is divisible by 100 it would
12201  * be a leap year only if that year is also divisible
12202  * by 400.</para></footnote>
12203  *
12204  * Returns: %TRUE if the year is a leap year
12205  */
12206
12207
12208 /**
12209  * g_date_new:
12210  *
12211  * Allocates a #GDate and initializes
12212  * it to a sane state. The new date will
12213  * be cleared (as if you'd called g_date_clear()) but invalid (it won't
12214  * represent an existing day). Free the return value with g_date_free().
12215  *
12216  * Returns: a newly-allocated #GDate
12217  */
12218
12219
12220 /**
12221  * g_date_new_dmy:
12222  * @day: day of the month
12223  * @month: month of the year
12224  * @year: year
12225  *
12226  * Like g_date_new(), but also sets the value of the date. Assuming the
12227  * day-month-year triplet you pass in represents an existing day, the
12228  * returned date will be valid.
12229  *
12230  * Returns: a newly-allocated #GDate initialized with @day, @month, and @year
12231  */
12232
12233
12234 /**
12235  * g_date_new_julian:
12236  * @julian_day: days since January 1, Year 1
12237  *
12238  * Like g_date_new(), but also sets the value of the date. Assuming the
12239  * Julian day number you pass in is valid (greater than 0, less than an
12240  * unreasonably large number), the returned date will be valid.
12241  *
12242  * Returns: a newly-allocated #GDate initialized with @julian_day
12243  */
12244
12245
12246 /**
12247  * g_date_order:
12248  * @date1: the first date
12249  * @date2: the second date
12250  *
12251  * Checks if @date1 is less than or equal to @date2,
12252  * and swap the values if this is not the case.
12253  */
12254
12255
12256 /**
12257  * g_date_set_day:
12258  * @date: a #GDate
12259  * @day: day to set
12260  *
12261  * Sets the day of the month for a #GDate. If the resulting
12262  * day-month-year triplet is invalid, the date will be invalid.
12263  */
12264
12265
12266 /**
12267  * g_date_set_dmy:
12268  * @date: a #GDate
12269  * @day: day
12270  * @month: month
12271  * @y: year
12272  *
12273  * Sets the value of a #GDate from a day, month, and year.
12274  * The day-month-year triplet must be valid; if you aren't
12275  * sure it is, call g_date_valid_dmy() to check before you
12276  * set it.
12277  */
12278
12279
12280 /**
12281  * g_date_set_julian:
12282  * @date: a #GDate
12283  * @julian_date: Julian day number (days since January 1, Year 1)
12284  *
12285  * Sets the value of a #GDate from a Julian day number.
12286  */
12287
12288
12289 /**
12290  * g_date_set_month:
12291  * @date: a #GDate
12292  * @month: month to set
12293  *
12294  * Sets the month of the year for a #GDate.  If the resulting
12295  * day-month-year triplet is invalid, the date will be invalid.
12296  */
12297
12298
12299 /**
12300  * g_date_set_parse:
12301  * @date: a #GDate to fill in
12302  * @str: string to parse
12303  *
12304  * Parses a user-inputted string @str, and try to figure out what date it
12305  * represents, taking the <link linkend="setlocale">current locale</link>
12306  * into account. If the string is successfully parsed, the date will be
12307  * valid after the call. Otherwise, it will be invalid. You should check
12308  * using g_date_valid() to see whether the parsing succeeded.
12309  *
12310  * This function is not appropriate for file formats and the like; it
12311  * isn't very precise, and its exact behavior varies with the locale.
12312  * It's intended to be a heuristic routine that guesses what the user
12313  * means by a given string (and it does work pretty well in that
12314  * capacity).
12315  */
12316
12317
12318 /**
12319  * g_date_set_time:
12320  * @date: a #GDate.
12321  * @time_: #GTime value to set.
12322  *
12323  * Sets the value of a date from a #GTime value.
12324  * The time to date conversion is done using the user's current timezone.
12325  *
12326  * Deprecated: 2.10: Use g_date_set_time_t() instead.
12327  */
12328
12329
12330 /**
12331  * g_date_set_time_t:
12332  * @date: a #GDate
12333  * @timet: <type>time_t</type> value to set
12334  *
12335  * Sets the value of a date to the date corresponding to a time
12336  * specified as a time_t. The time to date conversion is done using
12337  * the user's current timezone.
12338  *
12339  * To set the value of a date to the current day, you could write:
12340  * |[
12341  *  g_date_set_time_t (date, time (NULL));
12342  * ]|
12343  *
12344  * Since: 2.10
12345  */
12346
12347
12348 /**
12349  * g_date_set_time_val:
12350  * @date: a #GDate
12351  * @timeval: #GTimeVal value to set
12352  *
12353  * Sets the value of a date from a #GTimeVal value.  Note that the
12354  * @tv_usec member is ignored, because #GDate can't make use of the
12355  * additional precision.
12356  *
12357  * The time to date conversion is done using the user's current timezone.
12358  *
12359  * Since: 2.10
12360  */
12361
12362
12363 /**
12364  * g_date_set_year:
12365  * @date: a #GDate
12366  * @year: year to set
12367  *
12368  * Sets the year for a #GDate. If the resulting day-month-year
12369  * triplet is invalid, the date will be invalid.
12370  */
12371
12372
12373 /**
12374  * g_date_strftime:
12375  * @s: destination buffer
12376  * @slen: buffer size
12377  * @format: format string
12378  * @date: valid #GDate
12379  *
12380  * Generates a printed representation of the date, in a
12381  * <link linkend="setlocale">locale</link>-specific way.
12382  * Works just like the platform's C library strftime() function,
12383  * but only accepts date-related formats; time-related formats
12384  * give undefined results. Date must be valid. Unlike strftime()
12385  * (which uses the locale encoding), works on a UTF-8 format
12386  * string and stores a UTF-8 result.
12387  *
12388  * This function does not provide any conversion specifiers in
12389  * addition to those implemented by the platform's C library.
12390  * For example, don't expect that using g_date_strftime() would
12391  * make the \%F provided by the C99 strftime() work on Windows
12392  * where the C library only complies to C89.
12393  *
12394  * Returns: number of characters written to the buffer, or 0 the buffer was too small
12395  */
12396
12397
12398 /**
12399  * g_date_subtract_days:
12400  * @date: a #GDate to decrement
12401  * @n_days: number of days to move
12402  *
12403  * Moves a date some number of days into the past.
12404  * To move by weeks, just move by weeks*7 days.
12405  * The date must be valid.
12406  */
12407
12408
12409 /**
12410  * g_date_subtract_months:
12411  * @date: a #GDate to decrement
12412  * @n_months: number of months to move
12413  *
12414  * Moves a date some number of months into the past.
12415  * If the current day of the month doesn't exist in
12416  * the destination month, the day of the month
12417  * may change. The date must be valid.
12418  */
12419
12420
12421 /**
12422  * g_date_subtract_years:
12423  * @date: a #GDate to decrement
12424  * @n_years: number of years to move
12425  *
12426  * Moves a date some number of years into the past.
12427  * If the current day doesn't exist in the destination
12428  * year (i.e. it's February 29 and you move to a non-leap-year)
12429  * then the day is changed to February 29. The date
12430  * must be valid.
12431  */
12432
12433
12434 /**
12435  * g_date_time_add:
12436  * @datetime: a #GDateTime
12437  * @timespan: a #GTimeSpan
12438  *
12439  * Creates a copy of @datetime and adds the specified timespan to the copy.
12440  *
12441  * Returns: the newly created #GDateTime which should be freed with g_date_time_unref().
12442  * Since: 2.26
12443  */
12444
12445
12446 /**
12447  * g_date_time_add_days:
12448  * @datetime: a #GDateTime
12449  * @days: the number of days
12450  *
12451  * Creates a copy of @datetime and adds the specified number of days to the
12452  * copy.
12453  *
12454  * Returns: the newly created #GDateTime which should be freed with g_date_time_unref().
12455  * Since: 2.26
12456  */
12457
12458
12459 /**
12460  * g_date_time_add_full:
12461  * @datetime: a #GDateTime
12462  * @years: the number of years to add
12463  * @months: the number of months to add
12464  * @days: the number of days to add
12465  * @hours: the number of hours to add
12466  * @minutes: the number of minutes to add
12467  * @seconds: the number of seconds to add
12468  *
12469  * Creates a new #GDateTime adding the specified values to the current date and
12470  * time in @datetime.
12471  *
12472  * Returns: the newly created #GDateTime that should be freed with g_date_time_unref().
12473  * Since: 2.26
12474  */
12475
12476
12477 /**
12478  * g_date_time_add_hours:
12479  * @datetime: a #GDateTime
12480  * @hours: the number of hours to add
12481  *
12482  * Creates a copy of @datetime and adds the specified number of hours
12483  *
12484  * Returns: the newly created #GDateTime which should be freed with g_date_time_unref().
12485  * Since: 2.26
12486  */
12487
12488
12489 /**
12490  * g_date_time_add_minutes:
12491  * @datetime: a #GDateTime
12492  * @minutes: the number of minutes to add
12493  *
12494  * Creates a copy of @datetime adding the specified number of minutes.
12495  *
12496  * Returns: the newly created #GDateTime which should be freed with g_date_time_unref().
12497  * Since: 2.26
12498  */
12499
12500
12501 /**
12502  * g_date_time_add_months:
12503  * @datetime: a #GDateTime
12504  * @months: the number of months
12505  *
12506  * Creates a copy of @datetime and adds the specified number of months to the
12507  * copy.
12508  *
12509  * Returns: the newly created #GDateTime which should be freed with g_date_time_unref().
12510  * Since: 2.26
12511  */
12512
12513
12514 /**
12515  * g_date_time_add_seconds:
12516  * @datetime: a #GDateTime
12517  * @seconds: the number of seconds to add
12518  *
12519  * Creates a copy of @datetime and adds the specified number of seconds.
12520  *
12521  * Returns: the newly created #GDateTime which should be freed with g_date_time_unref().
12522  * Since: 2.26
12523  */
12524
12525
12526 /**
12527  * g_date_time_add_weeks:
12528  * @datetime: a #GDateTime
12529  * @weeks: the number of weeks
12530  *
12531  * Creates a copy of @datetime and adds the specified number of weeks to the
12532  * copy.
12533  *
12534  * Returns: the newly created #GDateTime which should be freed with g_date_time_unref().
12535  * Since: 2.26
12536  */
12537
12538
12539 /**
12540  * g_date_time_add_years:
12541  * @datetime: a #GDateTime
12542  * @years: the number of years
12543  *
12544  * Creates a copy of @datetime and adds the specified number of years to the
12545  * copy.
12546  *
12547  * Returns: the newly created #GDateTime which should be freed with g_date_time_unref().
12548  * Since: 2.26
12549  */
12550
12551
12552 /**
12553  * g_date_time_compare:
12554  * @dt1: first #GDateTime to compare
12555  * @dt2: second #GDateTime to compare
12556  *
12557  * A comparison function for #GDateTimes that is suitable
12558  * as a #GCompareFunc. Both #GDateTimes must be non-%NULL.
12559  *
12560  * Returns: -1, 0 or 1 if @dt1 is less than, equal to or greater than @dt2.
12561  * Since: 2.26
12562  */
12563
12564
12565 /**
12566  * g_date_time_difference:
12567  * @end: a #GDateTime
12568  * @begin: a #GDateTime
12569  *
12570  * Calculates the difference in time between @end and @begin.  The
12571  * #GTimeSpan that is returned is effectively @end - @begin (ie:
12572  * positive if the first simparameter is larger).
12573  *
12574  * Returns: the difference between the two #GDateTime, as a time span expressed in microseconds.
12575  * Since: 2.26
12576  */
12577
12578
12579 /**
12580  * g_date_time_equal:
12581  * @dt1: a #GDateTime
12582  * @dt2: a #GDateTime
12583  *
12584  * Checks to see if @dt1 and @dt2 are equal.
12585  *
12586  * Equal here means that they represent the same moment after converting
12587  * them to the same time zone.
12588  *
12589  * Returns: %TRUE if @dt1 and @dt2 are equal
12590  * Since: 2.26
12591  */
12592
12593
12594 /**
12595  * g_date_time_format:
12596  * @datetime: A #GDateTime
12597  * @format: a valid UTF-8 string, containing the format for the #GDateTime
12598  *
12599  * Creates a newly allocated string representing the requested @format.
12600  *
12601  * The format strings understood by this function are a subset of the
12602  * strftime() format language as specified by C99.  The \%D, \%U and \%W
12603  * conversions are not supported, nor is the 'E' modifier.  The GNU
12604  * extensions \%k, \%l, \%s and \%P are supported, however, as are the
12605  * '0', '_' and '-' modifiers.
12606  *
12607  * In contrast to strftime(), this function always produces a UTF-8
12608  * string, regardless of the current locale.  Note that the rendering of
12609  * many formats is locale-dependent and may not match the strftime()
12610  * output exactly.
12611  *
12612  * The following format specifiers are supported:
12613  *
12614  * <variablelist>
12615  *  <varlistentry><term>
12616  *    <literal>\%a</literal>:
12617  *   </term><listitem><simpara>
12618  *    the abbreviated weekday name according to the current locale
12619  *  </simpara></listitem></varlistentry>
12620  *  <varlistentry><term>
12621  *    <literal>\%A</literal>:
12622  *   </term><listitem><simpara>
12623  *    the full weekday name according to the current locale
12624  *  </simpara></listitem></varlistentry>
12625  *  <varlistentry><term>
12626  *    <literal>\%b</literal>:
12627  *   </term><listitem><simpara>
12628  *    the abbreviated month name according to the current locale
12629  *  </simpara></listitem></varlistentry>
12630  *  <varlistentry><term>
12631  *    <literal>\%B</literal>:
12632  *   </term><listitem><simpara>
12633  *    the full month name according to the current locale
12634  *  </simpara></listitem></varlistentry>
12635  *  <varlistentry><term>
12636  *    <literal>\%c</literal>:
12637  *   </term><listitem><simpara>
12638  *    the  preferred  date  and  time  representation  for the current locale
12639  *  </simpara></listitem></varlistentry>
12640  *  <varlistentry><term>
12641  *    <literal>\%C</literal>:
12642  *   </term><listitem><simpara>
12643  *    The century number (year/100) as a 2-digit integer (00-99)
12644  *  </simpara></listitem></varlistentry>
12645  *  <varlistentry><term>
12646  *    <literal>\%d</literal>:
12647  *   </term><listitem><simpara>
12648  *    the day of the month as a decimal number (range 01 to 31)
12649  *  </simpara></listitem></varlistentry>
12650  *  <varlistentry><term>
12651  *    <literal>\%e</literal>:
12652  *   </term><listitem><simpara>
12653  *    the day of the month as a decimal number (range  1 to 31)
12654  *  </simpara></listitem></varlistentry>
12655  *  <varlistentry><term>
12656  *    <literal>\%F</literal>:
12657  *   </term><listitem><simpara>
12658  *    equivalent to <literal>\%Y-\%m-\%d</literal> (the ISO 8601 date
12659  *    format)
12660  *  </simpara></listitem></varlistentry>
12661  *  <varlistentry><term>
12662  *    <literal>\%g</literal>:
12663  *   </term><listitem><simpara>
12664  *    the last two digits of the ISO 8601 week-based year as a decimal
12665  *    number (00-99).  This works well with \%V and \%u.
12666  *  </simpara></listitem></varlistentry>
12667  *  <varlistentry><term>
12668  *    <literal>\%G</literal>:
12669  *   </term><listitem><simpara>
12670  *    the ISO 8601 week-based year as a decimal number.  This works well
12671  *    with \%V and \%u.
12672  *  </simpara></listitem></varlistentry>
12673  *  <varlistentry><term>
12674  *    <literal>\%h</literal>:
12675  *   </term><listitem><simpara>
12676  *    equivalent to <literal>\%b</literal>
12677  *  </simpara></listitem></varlistentry>
12678  *  <varlistentry><term>
12679  *    <literal>\%H</literal>:
12680  *   </term><listitem><simpara>
12681  *    the hour as a decimal number using a 24-hour clock (range 00 to
12682  *    23)
12683  *  </simpara></listitem></varlistentry>
12684  *  <varlistentry><term>
12685  *    <literal>\%I</literal>:
12686  *   </term><listitem><simpara>
12687  *    the hour as a decimal number using a 12-hour clock (range 01 to
12688  *    12)
12689  *  </simpara></listitem></varlistentry>
12690  *  <varlistentry><term>
12691  *    <literal>\%j</literal>:
12692  *   </term><listitem><simpara>
12693  *    the day of the year as a decimal number (range 001 to 366)
12694  *  </simpara></listitem></varlistentry>
12695  *  <varlistentry><term>
12696  *    <literal>\%k</literal>:
12697  *   </term><listitem><simpara>
12698  *    the hour (24-hour clock) as a decimal number (range 0 to 23);
12699  *    single digits are preceded by a blank
12700  *  </simpara></listitem></varlistentry>
12701  *  <varlistentry><term>
12702  *    <literal>\%l</literal>:
12703  *   </term><listitem><simpara>
12704  *    the hour (12-hour clock) as a decimal number (range 1 to 12);
12705  *    single digits are preceded by a blank
12706  *  </simpara></listitem></varlistentry>
12707  *  <varlistentry><term>
12708  *    <literal>\%m</literal>:
12709  *   </term><listitem><simpara>
12710  *    the month as a decimal number (range 01 to 12)
12711  *  </simpara></listitem></varlistentry>
12712  *  <varlistentry><term>
12713  *    <literal>\%M</literal>:
12714  *   </term><listitem><simpara>
12715  *    the minute as a decimal number (range 00 to 59)
12716  *  </simpara></listitem></varlistentry>
12717  *  <varlistentry><term>
12718  *    <literal>\%p</literal>:
12719  *   </term><listitem><simpara>
12720  *    either "AM" or "PM" according to the given time value, or the
12721  *    corresponding  strings for the current locale.  Noon is treated as
12722  *    "PM" and midnight as "AM".
12723  *  </simpara></listitem></varlistentry>
12724  *  <varlistentry><term>
12725  *    <literal>\%P</literal>:
12726  *   </term><listitem><simpara>
12727  *    like \%p but lowercase: "am" or "pm" or a corresponding string for
12728  *    the current locale
12729  *  </simpara></listitem></varlistentry>
12730  *  <varlistentry><term>
12731  *    <literal>\%r</literal>:
12732  *   </term><listitem><simpara>
12733  *    the time in a.m. or p.m. notation
12734  *  </simpara></listitem></varlistentry>
12735  *  <varlistentry><term>
12736  *    <literal>\%R</literal>:
12737  *   </term><listitem><simpara>
12738  *    the time in 24-hour notation (<literal>\%H:\%M</literal>)
12739  *  </simpara></listitem></varlistentry>
12740  *  <varlistentry><term>
12741  *    <literal>\%s</literal>:
12742  *   </term><listitem><simpara>
12743  *    the number of seconds since the Epoch, that is, since 1970-01-01
12744  *    00:00:00 UTC
12745  *  </simpara></listitem></varlistentry>
12746  *  <varlistentry><term>
12747  *    <literal>\%S</literal>:
12748  *   </term><listitem><simpara>
12749  *    the second as a decimal number (range 00 to 60)
12750  *  </simpara></listitem></varlistentry>
12751  *  <varlistentry><term>
12752  *    <literal>\%t</literal>:
12753  *   </term><listitem><simpara>
12754  *    a tab character
12755  *  </simpara></listitem></varlistentry>
12756  *  <varlistentry><term>
12757  *    <literal>\%T</literal>:
12758  *   </term><listitem><simpara>
12759  *    the time in 24-hour notation with seconds (<literal>\%H:\%M:\%S</literal>)
12760  *  </simpara></listitem></varlistentry>
12761  *  <varlistentry><term>
12762  *    <literal>\%u</literal>:
12763  *   </term><listitem><simpara>
12764  *    the ISO 8601 standard day of the week as a decimal, range 1 to 7,
12765  *    Monday being 1.  This works well with \%G and \%V.
12766  *  </simpara></listitem></varlistentry>
12767  *  <varlistentry><term>
12768  *    <literal>\%V</literal>:
12769  *   </term><listitem><simpara>
12770  *    the ISO 8601 standard week number of the current year as a decimal
12771  *    number, range 01 to 53, where week 1 is the first week that has at
12772  *    least 4 days in the new year. See g_date_time_get_week_of_year().
12773  *    This works well with \%G and \%u.
12774  *  </simpara></listitem></varlistentry>
12775  *  <varlistentry><term>
12776  *    <literal>\%w</literal>:
12777  *   </term><listitem><simpara>
12778  *    the day of the week as a decimal, range 0 to 6, Sunday being 0.
12779  *    This is not the ISO 8601 standard format -- use \%u instead.
12780  *  </simpara></listitem></varlistentry>
12781  *  <varlistentry><term>
12782  *    <literal>\%x</literal>:
12783  *   </term><listitem><simpara>
12784  *    the preferred date representation for the current locale without
12785  *    the time
12786  *  </simpara></listitem></varlistentry>
12787  *  <varlistentry><term>
12788  *    <literal>\%X</literal>:
12789  *   </term><listitem><simpara>
12790  *    the preferred time representation for the current locale without
12791  *    the date
12792  *  </simpara></listitem></varlistentry>
12793  *  <varlistentry><term>
12794  *    <literal>\%y</literal>:
12795  *   </term><listitem><simpara>
12796  *    the year as a decimal number without the century
12797  *  </simpara></listitem></varlistentry>
12798  *  <varlistentry><term>
12799  *    <literal>\%Y</literal>:
12800  *   </term><listitem><simpara>
12801  *    the year as a decimal number including the century
12802  *  </simpara></listitem></varlistentry>
12803  *  <varlistentry><term>
12804  *    <literal>\%z</literal>:
12805  *   </term><listitem><simpara>
12806  *    the time-zone as hour offset from UTC
12807  *  </simpara></listitem></varlistentry>
12808  *  <varlistentry><term>
12809  *    <literal>\%Z</literal>:
12810  *   </term><listitem><simpara>
12811  *    the time zone or name or abbreviation
12812  *  </simpara></listitem></varlistentry>
12813  *  <varlistentry><term>
12814  *    <literal>\%\%</literal>:
12815  *   </term><listitem><simpara>
12816  *    a literal <literal>\%</literal> character
12817  *  </simpara></listitem></varlistentry>
12818  * </variablelist>
12819  *
12820  * Some conversion specifications can be modified by preceding the
12821  * conversion specifier by one or more modifier characters. The
12822  * following modifiers are supported for many of the numeric
12823  * conversions:
12824  * <variablelist>
12825  *   <varlistentry>
12826  *     <term>O</term>
12827  *     <listitem>
12828  *       Use alternative numeric symbols, if the current locale
12829  *       supports those.
12830  *     </listitem>
12831  *   </varlistentry>
12832  *   <varlistentry>
12833  *     <term>_</term>
12834  *     <listitem>
12835  *       Pad a numeric result with spaces.
12836  *       This overrides the default padding for the specifier.
12837  *     </listitem>
12838  *   </varlistentry>
12839  *   <varlistentry>
12840  *     <term>-</term>
12841  *     <listitem>
12842  *       Do not pad a numeric result.
12843  *       This overrides the default padding for the specifier.
12844  *     </listitem>
12845  *   </varlistentry>
12846  *   <varlistentry>
12847  *     <term>0</term>
12848  *     <listitem>
12849  *       Pad a numeric result with zeros.
12850  *       This overrides the default padding for the specifier.
12851  *     </listitem>
12852  *   </varlistentry>
12853  * </variablelist>
12854  *
12855  * 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().
12856  * Since: 2.26
12857  */
12858
12859
12860 /**
12861  * g_date_time_get_day_of_month:
12862  * @datetime: a #GDateTime
12863  *
12864  * Retrieves the day of the month represented by @datetime in the gregorian
12865  * calendar.
12866  *
12867  * Returns: the day of the month
12868  * Since: 2.26
12869  */
12870
12871
12872 /**
12873  * g_date_time_get_day_of_week:
12874  * @datetime: a #GDateTime
12875  *
12876  * Retrieves the ISO 8601 day of the week on which @datetime falls (1 is
12877  * Monday, 2 is Tuesday... 7 is Sunday).
12878  *
12879  * Returns: the day of the week
12880  * Since: 2.26
12881  */
12882
12883
12884 /**
12885  * g_date_time_get_day_of_year:
12886  * @datetime: a #GDateTime
12887  *
12888  * Retrieves the day of the year represented by @datetime in the Gregorian
12889  * calendar.
12890  *
12891  * Returns: the day of the year
12892  * Since: 2.26
12893  */
12894
12895
12896 /**
12897  * g_date_time_get_hour:
12898  * @datetime: a #GDateTime
12899  *
12900  * Retrieves the hour of the day represented by @datetime
12901  *
12902  * Returns: the hour of the day
12903  * Since: 2.26
12904  */
12905
12906
12907 /**
12908  * g_date_time_get_microsecond:
12909  * @datetime: a #GDateTime
12910  *
12911  * Retrieves the microsecond of the date represented by @datetime
12912  *
12913  * Returns: the microsecond of the second
12914  * Since: 2.26
12915  */
12916
12917
12918 /**
12919  * g_date_time_get_minute:
12920  * @datetime: a #GDateTime
12921  *
12922  * Retrieves the minute of the hour represented by @datetime
12923  *
12924  * Returns: the minute of the hour
12925  * Since: 2.26
12926  */
12927
12928
12929 /**
12930  * g_date_time_get_month:
12931  * @datetime: a #GDateTime
12932  *
12933  * Retrieves the month of the year represented by @datetime in the Gregorian
12934  * calendar.
12935  *
12936  * Returns: the month represented by @datetime
12937  * Since: 2.26
12938  */
12939
12940
12941 /**
12942  * g_date_time_get_second:
12943  * @datetime: a #GDateTime
12944  *
12945  * Retrieves the second of the minute represented by @datetime
12946  *
12947  * Returns: the second represented by @datetime
12948  * Since: 2.26
12949  */
12950
12951
12952 /**
12953  * g_date_time_get_seconds:
12954  * @datetime: a #GDateTime
12955  *
12956  * Retrieves the number of seconds since the start of the last minute,
12957  * including the fractional part.
12958  *
12959  * Returns: the number of seconds
12960  * Since: 2.26
12961  */
12962
12963
12964 /**
12965  * g_date_time_get_timezone_abbreviation:
12966  * @datetime: a #GDateTime
12967  *
12968  * Determines the time zone abbreviation to be used at the time and in
12969  * the time zone of @datetime.
12970  *
12971  * For example, in Toronto this is currently "EST" during the winter
12972  * months and "EDT" during the summer months when daylight savings
12973  * time is in effect.
12974  *
12975  * Returns: (transfer none): the time zone abbreviation. The returned string is owned by the #GDateTime and it should not be modified or freed
12976  * Since: 2.26
12977  */
12978
12979
12980 /**
12981  * g_date_time_get_utc_offset:
12982  * @datetime: a #GDateTime
12983  *
12984  * Determines the offset to UTC in effect at the time and in the time
12985  * zone of @datetime.
12986  *
12987  * The offset is the number of microseconds that you add to UTC time to
12988  * arrive at local time for the time zone (ie: negative numbers for time
12989  * zones west of GMT, positive numbers for east).
12990  *
12991  * If @datetime represents UTC time, then the offset is always zero.
12992  *
12993  * Returns: the number of microseconds that should be added to UTC to get the local time
12994  * Since: 2.26
12995  */
12996
12997
12998 /**
12999  * g_date_time_get_week_numbering_year:
13000  * @datetime: a #GDateTime
13001  *
13002  * Returns the ISO 8601 week-numbering year in which the week containing
13003  * @datetime falls.
13004  *
13005  * This function, taken together with g_date_time_get_week_of_year() and
13006  * g_date_time_get_day_of_week() can be used to determine the full ISO
13007  * week date on which @datetime falls.
13008  *
13009  * This is usually equal to the normal Gregorian year (as returned by
13010  * g_date_time_get_year()), except as detailed below:
13011  *
13012  * For Thursday, the week-numbering year is always equal to the usual
13013  * calendar year.  For other days, the number is such that every day
13014  * within a complete week (Monday to Sunday) is contained within the
13015  * same week-numbering year.
13016  *
13017  * For Monday, Tuesday and Wednesday occurring near the end of the year,
13018  * this may mean that the week-numbering year is one greater than the
13019  * calendar year (so that these days have the same week-numbering year
13020  * as the Thursday occurring early in the next year).
13021  *
13022  * For Friday, Saturaday and Sunday occurring near the start of the year,
13023  * this may mean that the week-numbering year is one less than the
13024  * calendar year (so that these days have the same week-numbering year
13025  * as the Thursday occurring late in the previous year).
13026  *
13027  * An equivalent description is that the week-numbering year is equal to
13028  * the calendar year containing the majority of the days in the current
13029  * week (Monday to Sunday).
13030  *
13031  * Note that January 1 0001 in the proleptic Gregorian calendar is a
13032  * Monday, so this function never returns 0.
13033  *
13034  * Returns: the ISO 8601 week-numbering year for @datetime
13035  * Since: 2.26
13036  */
13037
13038
13039 /**
13040  * g_date_time_get_week_of_year:
13041  * @datetime: a #GDateTime
13042  *
13043  * Returns the ISO 8601 week number for the week containing @datetime.
13044  * The ISO 8601 week number is the same for every day of the week (from
13045  * Moday through Sunday).  That can produce some unusual results
13046  * (described below).
13047  *
13048  * The first week of the year is week 1.  This is the week that contains
13049  * the first Thursday of the year.  Equivalently, this is the first week
13050  * that has more than 4 of its days falling within the calendar year.
13051  *
13052  * The value 0 is never returned by this function.  Days contained
13053  * within a year but occurring before the first ISO 8601 week of that
13054  * year are considered as being contained in the last week of the
13055  * previous year.  Similarly, the final days of a calendar year may be
13056  * considered as being part of the first ISO 8601 week of the next year
13057  * if 4 or more days of that week are contained within the new year.
13058  *
13059  * Returns: the ISO 8601 week number for @datetime.
13060  * Since: 2.26
13061  */
13062
13063
13064 /**
13065  * g_date_time_get_year:
13066  * @datetime: A #GDateTime
13067  *
13068  * Retrieves the year represented by @datetime in the Gregorian calendar.
13069  *
13070  * Returns: the year represented by @datetime
13071  * Since: 2.26
13072  */
13073
13074
13075 /**
13076  * g_date_time_get_ymd:
13077  * @datetime: a #GDateTime.
13078  * @year: (out) (allow-none): the return location for the gregorian year, or %NULL.
13079  * @month: (out) (allow-none): the return location for the month of the year, or %NULL.
13080  * @day: (out) (allow-none): the return location for the day of the month, or %NULL.
13081  *
13082  * Retrieves the Gregorian day, month, and year of a given #GDateTime.
13083  *
13084  * Since: 2.26
13085  */
13086
13087
13088 /**
13089  * g_date_time_hash:
13090  * @datetime: a #GDateTime
13091  *
13092  * Hashes @datetime into a #guint, suitable for use within #GHashTable.
13093  *
13094  * Returns: a #guint containing the hash
13095  * Since: 2.26
13096  */
13097
13098
13099 /**
13100  * g_date_time_is_daylight_savings:
13101  * @datetime: a #GDateTime
13102  *
13103  * Determines if daylight savings time is in effect at the time and in
13104  * the time zone of @datetime.
13105  *
13106  * Returns: %TRUE if daylight savings time is in effect
13107  * Since: 2.26
13108  */
13109
13110
13111 /**
13112  * g_date_time_new:
13113  * @tz: a #GTimeZone
13114  * @year: the year component of the date
13115  * @month: the month component of the date
13116  * @day: the day component of the date
13117  * @hour: the hour component of the date
13118  * @minute: the minute component of the date
13119  * @seconds: the number of seconds past the minute
13120  *
13121  * Creates a new #GDateTime corresponding to the given date and time in
13122  * the time zone @tz.
13123  *
13124  * The @year must be between 1 and 9999, @month between 1 and 12 and @day
13125  * between 1 and 28, 29, 30 or 31 depending on the month and the year.
13126  *
13127  * @hour must be between 0 and 23 and @minute must be between 0 and 59.
13128  *
13129  * @seconds must be at least 0.0 and must be strictly less than 60.0.
13130  * It will be rounded down to the nearest microsecond.
13131  *
13132  * If the given time is not representable in the given time zone (for
13133  * example, 02:30 on March 14th 2010 in Toronto, due to daylight savings
13134  * time) then the time will be rounded up to the nearest existing time
13135  * (in this case, 03:00).  If this matters to you then you should verify
13136  * the return value for containing the same as the numbers you gave.
13137  *
13138  * In the case that the given time is ambiguous in the given time zone
13139  * (for example, 01:30 on November 7th 2010 in Toronto, due to daylight
13140  * savings time) then the time falling within standard (ie:
13141  * non-daylight) time is taken.
13142  *
13143  * It not considered a programmer error for the values to this function
13144  * to be out of range, but in the case that they are, the function will
13145  * return %NULL.
13146  *
13147  * You should release the return value by calling g_date_time_unref()
13148  * when you are done with it.
13149  *
13150  * Returns: a new #GDateTime, or %NULL
13151  * Since: 2.26
13152  */
13153
13154
13155 /**
13156  * g_date_time_new_from_timeval_local:
13157  * @tv: a #GTimeVal
13158  *
13159  * Creates a #GDateTime corresponding to the given #GTimeVal @tv in the
13160  * local time zone.
13161  *
13162  * The time contained in a #GTimeVal is always stored in the form of
13163  * seconds elapsed since 1970-01-01 00:00:00 UTC, regardless of the
13164  * local time offset.
13165  *
13166  * This call can fail (returning %NULL) if @tv represents a time outside
13167  * of the supported range of #GDateTime.
13168  *
13169  * You should release the return value by calling g_date_time_unref()
13170  * when you are done with it.
13171  *
13172  * Returns: a new #GDateTime, or %NULL
13173  * Since: 2.26
13174  */
13175
13176
13177 /**
13178  * g_date_time_new_from_timeval_utc:
13179  * @tv: a #GTimeVal
13180  *
13181  * Creates a #GDateTime corresponding to the given #GTimeVal @tv in UTC.
13182  *
13183  * The time contained in a #GTimeVal is always stored in the form of
13184  * seconds elapsed since 1970-01-01 00:00:00 UTC.
13185  *
13186  * This call can fail (returning %NULL) if @tv represents a time outside
13187  * of the supported range of #GDateTime.
13188  *
13189  * You should release the return value by calling g_date_time_unref()
13190  * when you are done with it.
13191  *
13192  * Returns: a new #GDateTime, or %NULL
13193  * Since: 2.26
13194  */
13195
13196
13197 /**
13198  * g_date_time_new_from_unix_local:
13199  * @t: the Unix time
13200  *
13201  * Creates a #GDateTime corresponding to the given Unix time @t in the
13202  * local time zone.
13203  *
13204  * Unix time is the number of seconds that have elapsed since 1970-01-01
13205  * 00:00:00 UTC, regardless of the local time offset.
13206  *
13207  * This call can fail (returning %NULL) if @t represents a time outside
13208  * of the supported range of #GDateTime.
13209  *
13210  * You should release the return value by calling g_date_time_unref()
13211  * when you are done with it.
13212  *
13213  * Returns: a new #GDateTime, or %NULL
13214  * Since: 2.26
13215  */
13216
13217
13218 /**
13219  * g_date_time_new_from_unix_utc:
13220  * @t: the Unix time
13221  *
13222  * Creates a #GDateTime corresponding to the given Unix time @t in UTC.
13223  *
13224  * Unix time is the number of seconds that have elapsed since 1970-01-01
13225  * 00:00:00 UTC.
13226  *
13227  * This call can fail (returning %NULL) if @t represents a time outside
13228  * of the supported range of #GDateTime.
13229  *
13230  * You should release the return value by calling g_date_time_unref()
13231  * when you are done with it.
13232  *
13233  * Returns: a new #GDateTime, or %NULL
13234  * Since: 2.26
13235  */
13236
13237
13238 /**
13239  * g_date_time_new_local:
13240  * @year: the year component of the date
13241  * @month: the month component of the date
13242  * @day: the day component of the date
13243  * @hour: the hour component of the date
13244  * @minute: the minute component of the date
13245  * @seconds: the number of seconds past the minute
13246  *
13247  * Creates a new #GDateTime corresponding to the given date and time in
13248  * the local time zone.
13249  *
13250  * This call is equivalent to calling g_date_time_new() with the time
13251  * zone returned by g_time_zone_new_local().
13252  *
13253  * Returns: a #GDateTime, or %NULL
13254  * Since: 2.26
13255  */
13256
13257
13258 /**
13259  * g_date_time_new_now:
13260  * @tz: a #GTimeZone
13261  *
13262  * Creates a #GDateTime corresponding to this exact instant in the given
13263  * time zone @tz.  The time is as accurate as the system allows, to a
13264  * maximum accuracy of 1 microsecond.
13265  *
13266  * This function will always succeed unless the system clock is set to
13267  * truly insane values (or unless GLib is still being used after the
13268  * year 9999).
13269  *
13270  * You should release the return value by calling g_date_time_unref()
13271  * when you are done with it.
13272  *
13273  * Returns: a new #GDateTime, or %NULL
13274  * Since: 2.26
13275  */
13276
13277
13278 /**
13279  * g_date_time_new_now_local:
13280  *
13281  * Creates a #GDateTime corresponding to this exact instant in the local
13282  * time zone.
13283  *
13284  * This is equivalent to calling g_date_time_new_now() with the time
13285  * zone returned by g_time_zone_new_local().
13286  *
13287  * Returns: a new #GDateTime, or %NULL
13288  * Since: 2.26
13289  */
13290
13291
13292 /**
13293  * g_date_time_new_now_utc:
13294  *
13295  * Creates a #GDateTime corresponding to this exact instant in UTC.
13296  *
13297  * This is equivalent to calling g_date_time_new_now() with the time
13298  * zone returned by g_time_zone_new_utc().
13299  *
13300  * Returns: a new #GDateTime, or %NULL
13301  * Since: 2.26
13302  */
13303
13304
13305 /**
13306  * g_date_time_new_utc:
13307  * @year: the year component of the date
13308  * @month: the month component of the date
13309  * @day: the day component of the date
13310  * @hour: the hour component of the date
13311  * @minute: the minute component of the date
13312  * @seconds: the number of seconds past the minute
13313  *
13314  * Creates a new #GDateTime corresponding to the given date and time in
13315  * UTC.
13316  *
13317  * This call is equivalent to calling g_date_time_new() with the time
13318  * zone returned by g_time_zone_new_utc().
13319  *
13320  * Returns: a #GDateTime, or %NULL
13321  * Since: 2.26
13322  */
13323
13324
13325 /**
13326  * g_date_time_ref:
13327  * @datetime: a #GDateTime
13328  *
13329  * Atomically increments the reference count of @datetime by one.
13330  *
13331  * Returns: the #GDateTime with the reference count increased
13332  * Since: 2.26
13333  */
13334
13335
13336 /**
13337  * g_date_time_to_local:
13338  * @datetime: a #GDateTime
13339  *
13340  * Creates a new #GDateTime corresponding to the same instant in time as
13341  * @datetime, but in the local time zone.
13342  *
13343  * This call is equivalent to calling g_date_time_to_timezone() with the
13344  * time zone returned by g_time_zone_new_local().
13345  *
13346  * Returns: the newly created #GDateTime
13347  * Since: 2.26
13348  */
13349
13350
13351 /**
13352  * g_date_time_to_timeval:
13353  * @datetime: a #GDateTime
13354  * @tv: a #GTimeVal to modify
13355  *
13356  * Stores the instant in time that @datetime represents into @tv.
13357  *
13358  * The time contained in a #GTimeVal is always stored in the form of
13359  * seconds elapsed since 1970-01-01 00:00:00 UTC, regardless of the time
13360  * zone associated with @datetime.
13361  *
13362  * On systems where 'long' is 32bit (ie: all 32bit systems and all
13363  * Windows systems), a #GTimeVal is incapable of storing the entire
13364  * range of values that #GDateTime is capable of expressing.  On those
13365  * systems, this function returns %FALSE to indicate that the time is
13366  * out of range.
13367  *
13368  * On systems where 'long' is 64bit, this function never fails.
13369  *
13370  * Returns: %TRUE if successful, else %FALSE
13371  * Since: 2.26
13372  */
13373
13374
13375 /**
13376  * g_date_time_to_timezone:
13377  * @datetime: a #GDateTime
13378  * @tz: the new #GTimeZone
13379  *
13380  * Create a new #GDateTime corresponding to the same instant in time as
13381  * @datetime, but in the time zone @tz.
13382  *
13383  * This call can fail in the case that the time goes out of bounds.  For
13384  * example, converting 0001-01-01 00:00:00 UTC to a time zone west of
13385  * Greenwich will fail (due to the year 0 being out of range).
13386  *
13387  * You should release the return value by calling g_date_time_unref()
13388  * when you are done with it.
13389  *
13390  * Returns: a new #GDateTime, or %NULL
13391  * Since: 2.26
13392  */
13393
13394
13395 /**
13396  * g_date_time_to_unix:
13397  * @datetime: a #GDateTime
13398  *
13399  * Gives the Unix time corresponding to @datetime, rounding down to the
13400  * nearest second.
13401  *
13402  * Unix time is the number of seconds that have elapsed since 1970-01-01
13403  * 00:00:00 UTC, regardless of the time zone associated with @datetime.
13404  *
13405  * Returns: the Unix time corresponding to @datetime
13406  * Since: 2.26
13407  */
13408
13409
13410 /**
13411  * g_date_time_to_utc:
13412  * @datetime: a #GDateTime
13413  *
13414  * Creates a new #GDateTime corresponding to the same instant in time as
13415  * @datetime, but in UTC.
13416  *
13417  * This call is equivalent to calling g_date_time_to_timezone() with the
13418  * time zone returned by g_time_zone_new_utc().
13419  *
13420  * Returns: the newly created #GDateTime
13421  * Since: 2.26
13422  */
13423
13424
13425 /**
13426  * g_date_time_unref:
13427  * @datetime: a #GDateTime
13428  *
13429  * Atomically decrements the reference count of @datetime by one.
13430  *
13431  * When the reference count reaches zero, the resources allocated by
13432  * @datetime are freed
13433  *
13434  * Since: 2.26
13435  */
13436
13437
13438 /**
13439  * g_date_to_struct_tm:
13440  * @date: a #GDate to set the <structname>struct tm</structname> from
13441  * @tm: <structname>struct tm</structname> to fill
13442  *
13443  * Fills in the date-related bits of a <structname>struct tm</structname>
13444  * using the @date value. Initializes the non-date parts with something
13445  * sane but meaningless.
13446  */
13447
13448
13449 /**
13450  * g_date_valid:
13451  * @date: a #GDate to check
13452  *
13453  * Returns %TRUE if the #GDate represents an existing day. The date must not
13454  * contain garbage; it should have been initialized with g_date_clear()
13455  * if it wasn't allocated by one of the g_date_new() variants.
13456  *
13457  * Returns: Whether the date is valid
13458  */
13459
13460
13461 /**
13462  * g_date_valid_day:
13463  * @day: day to check
13464  *
13465  * Returns %TRUE if the day of the month is valid (a day is valid if it's
13466  * between 1 and 31 inclusive).
13467  *
13468  * Returns: %TRUE if the day is valid
13469  */
13470
13471
13472 /**
13473  * g_date_valid_dmy:
13474  * @day: day
13475  * @month: month
13476  * @year: year
13477  *
13478  * Returns %TRUE if the day-month-year triplet forms a valid, existing day
13479  * in the range of days #GDate understands (Year 1 or later, no more than
13480  * a few thousand years in the future).
13481  *
13482  * Returns: %TRUE if the date is a valid one
13483  */
13484
13485
13486 /**
13487  * g_date_valid_julian:
13488  * @julian_date: Julian day to check
13489  *
13490  * Returns %TRUE if the Julian day is valid. Anything greater than zero
13491  * is basically a valid Julian, though there is a 32-bit limit.
13492  *
13493  * Returns: %TRUE if the Julian day is valid
13494  */
13495
13496
13497 /**
13498  * g_date_valid_month:
13499  * @month: month
13500  *
13501  * Returns %TRUE if the month value is valid. The 12 #GDateMonth
13502  * enumeration values are the only valid months.
13503  *
13504  * Returns: %TRUE if the month is valid
13505  */
13506
13507
13508 /**
13509  * g_date_valid_weekday:
13510  * @weekday: weekday
13511  *
13512  * Returns %TRUE if the weekday is valid. The seven #GDateWeekday enumeration
13513  * values are the only valid weekdays.
13514  *
13515  * Returns: %TRUE if the weekday is valid
13516  */
13517
13518
13519 /**
13520  * g_date_valid_year:
13521  * @year: year
13522  *
13523  * Returns %TRUE if the year is valid. Any year greater than 0 is valid,
13524  * though there is a 16-bit limit to what #GDate will understand.
13525  *
13526  * Returns: %TRUE if the year is valid
13527  */
13528
13529
13530 /**
13531  * g_dcgettext:
13532  * @domain: (allow-none): the translation domain to use, or %NULL to use the domain set with textdomain()
13533  * @msgid: message to translate
13534  * @category: a locale category
13535  *
13536  * This is a variant of g_dgettext() that allows specifying a locale
13537  * category instead of always using <envar>LC_MESSAGES</envar>. See g_dgettext() for
13538  * more information about how this functions differs from calling
13539  * dcgettext() directly.
13540  *
13541  * Returns: the translated string for the given locale category
13542  * Since: 2.26
13543  */
13544
13545
13546 /**
13547  * g_debug:
13548  * @...: format string, followed by parameters to insert into the format string (as with printf())
13549  *
13550  * A convenience function/macro to log a debug message.
13551  *
13552  * Since: 2.6
13553  */
13554
13555
13556 /**
13557  * g_dgettext:
13558  * @domain: (allow-none): the translation domain to use, or %NULL to use the domain set with textdomain()
13559  * @msgid: message to translate
13560  *
13561  * This function is a wrapper of dgettext() which does not translate
13562  * the message if the default domain as set with textdomain() has no
13563  * translations for the current locale.
13564  *
13565  * The advantage of using this function over dgettext() proper is that
13566  * libraries using this function (like GTK+) will not use translations
13567  * if the application using the library does not have translations for
13568  * the current locale.  This results in a consistent English-only
13569  * interface instead of one having partial translations.  For this
13570  * feature to work, the call to textdomain() and setlocale() should
13571  * precede any g_dgettext() invocations.  For GTK+, it means calling
13572  * textdomain() before gtk_init or its variants.
13573  *
13574  * This function disables translations if and only if upon its first
13575  * call all the following conditions hold:
13576  * <itemizedlist>
13577  * <listitem>@domain is not %NULL</listitem>
13578  * <listitem>textdomain() has been called to set a default text domain</listitem>
13579  * <listitem>there is no translations available for the default text domain
13580  *           and the current locale</listitem>
13581  * <listitem>current locale is not "C" or any English locales (those
13582  *           starting with "en_")</listitem>
13583  * </itemizedlist>
13584  *
13585  * Note that this behavior may not be desired for example if an application
13586  * has its untranslated messages in a language other than English.  In those
13587  * cases the application should call textdomain() after initializing GTK+.
13588  *
13589  * Applications should normally not use this function directly,
13590  * but use the _() macro for translations.
13591  *
13592  * Returns: The translated string
13593  * Since: 2.18
13594  */
13595
13596
13597 /**
13598  * g_dir_close:
13599  * @dir: a #GDir* created by g_dir_open()
13600  *
13601  * Closes the directory and deallocates all related resources.
13602  */
13603
13604
13605 /**
13606  * g_dir_make_tmp:
13607  * @tmpl: (type filename) (allow-none): Template for directory name, as in g_mkdtemp(), basename only, or %NULL for a default template
13608  * @error: return location for a #GError
13609  *
13610  * Creates a subdirectory in the preferred directory for temporary
13611  * files (as returned by g_get_tmp_dir()).
13612  *
13613  * @tmpl should be a string in the GLib file name encoding containing
13614  * a sequence of six 'X' characters, as the parameter to g_mkstemp().
13615  * However, unlike these functions, the template should only be a
13616  * basename, no directory components are allowed. If template is
13617  * %NULL, a default template is used.
13618  *
13619  * Note that in contrast to g_mkdtemp() (and mkdtemp()) @tmpl is not
13620  * modified, and might thus be a read-only literal string.
13621  *
13622  * 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.
13623  * Since: 2.30
13624  */
13625
13626
13627 /**
13628  * g_dir_open:
13629  * @path: the path to the directory you are interested in. On Unix in the on-disk encoding. On Windows in UTF-8
13630  * @flags: Currently must be set to 0. Reserved for future use.
13631  * @error: return location for a #GError, or %NULL. If non-%NULL, an error will be set if and only if g_dir_open() fails.
13632  *
13633  * Opens a directory for reading. The names of the files in the
13634  * directory can then be retrieved using g_dir_read_name().  Note
13635  * that the ordering is not defined.
13636  *
13637  * 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.
13638  */
13639
13640
13641 /**
13642  * g_dir_read_name:
13643  * @dir: a #GDir* created by g_dir_open()
13644  *
13645  * Retrieves the name of another entry in the directory, or %NULL.
13646  * The order of entries returned from this function is not defined,
13647  * and may vary by file system or other operating-system dependent
13648  * factors.
13649  *
13650  * %NULL may also be returned in case of errors. On Unix, you can
13651  * check <literal>errno</literal> to find out if %NULL was returned
13652  * because of an error.
13653  *
13654  * On Unix, the '.' and '..' entries are omitted, and the returned
13655  * name is in the on-disk encoding.
13656  *
13657  * On Windows, as is true of all GLib functions which operate on
13658  * filenames, the returned name is in UTF-8.
13659  *
13660  * 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.
13661  */
13662
13663
13664 /**
13665  * g_dir_rewind:
13666  * @dir: a #GDir* created by g_dir_open()
13667  *
13668  * Resets the given directory. The next call to g_dir_read_name()
13669  * will return the first entry again.
13670  */
13671
13672
13673 /**
13674  * g_direct_equal:
13675  * @v1: (allow-none): a key
13676  * @v2: (allow-none): a key to compare with @v1
13677  *
13678  * Compares two #gpointer arguments and returns %TRUE if they are equal.
13679  * It can be passed to g_hash_table_new() as the @key_equal_func
13680  * parameter, when using opaque pointers compared by pointer value as keys
13681  * in a #GHashTable.
13682  *
13683  * This equality function is also appropriate for keys that are integers stored
13684  * in pointers, such as <literal>GINT_TO_POINTER (n)</literal>.
13685  *
13686  * Returns: %TRUE if the two keys match.
13687  */
13688
13689
13690 /**
13691  * g_direct_hash:
13692  * @v: (allow-none): a #gpointer key
13693  *
13694  * Converts a gpointer to a hash value.
13695  * It can be passed to g_hash_table_new() as the @hash_func parameter,
13696  * when using opaque pointers compared by pointer value as keys in a
13697  * #GHashTable.
13698  *
13699  * This hash function is also appropriate for keys that are integers stored
13700  * in pointers, such as <literal>GINT_TO_POINTER (n)</literal>.
13701  *
13702  * Returns: a hash value corresponding to the key.
13703  */
13704
13705
13706 /**
13707  * g_dirname:
13708  * @file_name: the name of the file
13709  *
13710  * Gets the directory components of a file name.
13711  *
13712  * If the file name has no directory components "." is returned.
13713  * The returned string should be freed when no longer needed.
13714  *
13715  * Returns: the directory components of the file
13716  * Deprecated: use g_path_get_dirname() instead
13717  */
13718
13719
13720 /**
13721  * g_dngettext:
13722  * @domain: (allow-none): the translation domain to use, or %NULL to use the domain set with textdomain()
13723  * @msgid: message to translate
13724  * @msgid_plural: plural form of the message
13725  * @n: the quantity for which translation is needed
13726  *
13727  * This function is a wrapper of dngettext() which does not translate
13728  * the message if the default domain as set with textdomain() has no
13729  * translations for the current locale.
13730  *
13731  * See g_dgettext() for details of how this differs from dngettext()
13732  * proper.
13733  *
13734  * Returns: The translated string
13735  * Since: 2.18
13736  */
13737
13738
13739 /**
13740  * g_double_equal:
13741  * @v1: a pointer to a #gdouble key
13742  * @v2: a pointer to a #gdouble key to compare with @v1
13743  *
13744  * Compares the two #gdouble values being pointed to and returns
13745  * %TRUE if they are equal.
13746  * It can be passed to g_hash_table_new() as the @key_equal_func
13747  * parameter, when using non-%NULL pointers to doubles as keys in a
13748  * #GHashTable.
13749  *
13750  * Returns: %TRUE if the two keys match.
13751  * Since: 2.22
13752  */
13753
13754
13755 /**
13756  * g_double_hash:
13757  * @v: a pointer to a #gdouble key
13758  *
13759  * Converts a pointer to a #gdouble to a hash value.
13760  * It can be passed to g_hash_table_new() as the @hash_func parameter,
13761  * It can be passed to g_hash_table_new() as the @hash_func parameter,
13762  * when using non-%NULL pointers to doubles as keys in a #GHashTable.
13763  *
13764  * Returns: a hash value corresponding to the key.
13765  * Since: 2.22
13766  */
13767
13768
13769 /**
13770  * g_dpgettext:
13771  * @domain: (allow-none): the translation domain to use, or %NULL to use the domain set with textdomain()
13772  * @msgctxtid: a combined message context and message id, separated by a \004 character
13773  * @msgidoffset: the offset of the message id in @msgctxid
13774  *
13775  * This function is a variant of g_dgettext() which supports
13776  * a disambiguating message context. GNU gettext uses the
13777  * '\004' character to separate the message context and
13778  * message id in @msgctxtid.
13779  * If 0 is passed as @msgidoffset, this function will fall back to
13780  * trying to use the deprecated convention of using "|" as a separation
13781  * character.
13782  *
13783  * This uses g_dgettext() internally. See that functions for differences
13784  * with dgettext() proper.
13785  *
13786  * Applications should normally not use this function directly,
13787  * but use the C_() macro for translations with context.
13788  *
13789  * Returns: The translated string
13790  * Since: 2.16
13791  */
13792
13793
13794 /**
13795  * g_dpgettext2:
13796  * @domain: (allow-none): the translation domain to use, or %NULL to use the domain set with textdomain()
13797  * @context: the message context
13798  * @msgid: the message
13799  *
13800  * This function is a variant of g_dgettext() which supports
13801  * a disambiguating message context. GNU gettext uses the
13802  * '\004' character to separate the message context and
13803  * message id in @msgctxtid.
13804  *
13805  * This uses g_dgettext() internally. See that functions for differences
13806  * with dgettext() proper.
13807  *
13808  * This function differs from C_() in that it is not a macro and
13809  * thus you may use non-string-literals as context and msgid arguments.
13810  *
13811  * Returns: The translated string
13812  * Since: 2.18
13813  */
13814
13815
13816 /**
13817  * g_environ_getenv:
13818  * @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
13819  * @variable: the environment variable to get, in the GLib file name encoding
13820  *
13821  * Returns the value of the environment variable @variable in the
13822  * provided list @envp.
13823  *
13824  * The name and value are in the GLib file name encoding.
13825  * On UNIX, this means the actual bytes which might or might not
13826  * be in some consistent character set and encoding. On Windows,
13827  * it is in UTF-8. On Windows, in case the environment variable's
13828  * value contains references to other environment variables, they
13829  * are expanded.
13830  *
13831  * 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.
13832  * Since: 2.32
13833  */
13834
13835
13836 /**
13837  * g_environ_setenv:
13838  * @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
13839  * @variable: the environment variable to set, must not contain '='
13840  * @value: the value for to set the variable to
13841  * @overwrite: whether to change the variable if it already exists
13842  *
13843  * Sets the environment variable @variable in the provided list
13844  * @envp to @value.
13845  *
13846  * Both the variable's name and value should be in the GLib
13847  * file name encoding. On UNIX, this means that they can be
13848  * arbitrary byte strings. On Windows, they should be in UTF-8.
13849  *
13850  * Returns: (array zero-terminated=1) (transfer full): the updated environment list. Free it using g_strfreev().
13851  * Since: 2.32
13852  */
13853
13854
13855 /**
13856  * g_environ_unsetenv:
13857  * @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
13858  * @variable: the environment variable to remove, must not contain '='
13859  *
13860  * Removes the environment variable @variable from the provided
13861  * environment @envp.
13862  *
13863  * Returns: (array zero-terminated=1) (transfer full): the updated environment list. Free it using g_strfreev().
13864  * Since: 2.32
13865  */
13866
13867
13868 /**
13869  * g_error:
13870  * @...: format string, followed by parameters to insert into the format string (as with printf())
13871  *
13872  * A convenience function/macro to log an error message.
13873  *
13874  * Error messages are always fatal, resulting in a call to
13875  * abort() to terminate the application. This function will
13876  * result in a core dump; don't use it for errors you expect.
13877  * Using this function indicates a bug in your program, i.e.
13878  * an assertion failure.
13879  */
13880
13881
13882 /**
13883  * g_error_copy:
13884  * @error: a #GError
13885  *
13886  * Makes a copy of @error.
13887  *
13888  * Returns: a new #GError
13889  */
13890
13891
13892 /**
13893  * g_error_free:
13894  * @error: a #GError
13895  *
13896  * Frees a #GError and associated resources.
13897  */
13898
13899
13900 /**
13901  * g_error_matches:
13902  * @error: (allow-none): a #GError or %NULL
13903  * @domain: an error domain
13904  * @code: an error code
13905  *
13906  * Returns %TRUE if @error matches @domain and @code, %FALSE
13907  * otherwise. In particular, when @error is %NULL, %FALSE will
13908  * be returned.
13909  *
13910  * Returns: whether @error has @domain and @code
13911  */
13912
13913
13914 /**
13915  * g_error_new:
13916  * @domain: error domain
13917  * @code: error code
13918  * @format: printf()-style format for error message
13919  * @...: parameters for message format
13920  *
13921  * Creates a new #GError with the given @domain and @code,
13922  * and a message formatted with @format.
13923  *
13924  * Returns: a new #GError
13925  */
13926
13927
13928 /**
13929  * g_error_new_literal:
13930  * @domain: error domain
13931  * @code: error code
13932  * @message: error message
13933  *
13934  * Creates a new #GError; unlike g_error_new(), @message is
13935  * not a printf()-style format string. Use this function if
13936  * @message contains text you don't have control over,
13937  * that could include printf() escape sequences.
13938  *
13939  * Returns: a new #GError
13940  */
13941
13942
13943 /**
13944  * g_error_new_valist:
13945  * @domain: error domain
13946  * @code: error code
13947  * @format: printf()-style format for error message
13948  * @args: #va_list of parameters for the message format
13949  *
13950  * Creates a new #GError with the given @domain and @code,
13951  * and a message formatted with @format.
13952  *
13953  * Returns: a new #GError
13954  * Since: 2.22
13955  */
13956
13957
13958 /**
13959  * g_file_error_from_errno:
13960  * @err_no: an "errno" value
13961  *
13962  * Gets a #GFileError constant based on the passed-in @err_no.
13963  * For example, if you pass in <literal>EEXIST</literal> this function returns
13964  * #G_FILE_ERROR_EXIST. Unlike <literal>errno</literal> values, you can portably
13965  * assume that all #GFileError values will exist.
13966  *
13967  * Normally a #GFileError value goes into a #GError returned
13968  * from a function that manipulates files. So you would use
13969  * g_file_error_from_errno() when constructing a #GError.
13970  *
13971  * Returns: #GFileError corresponding to the given @errno
13972  */
13973
13974
13975 /**
13976  * g_file_get_contents:
13977  * @filename: (type filename): name of a file to read contents from, in the GLib file name encoding
13978  * @contents: (out) (array length=length) (element-type guint8): location to store an allocated string, use g_free() to free the returned string
13979  * @length: (allow-none): location to store length in bytes of the contents, or %NULL
13980  * @error: return location for a #GError, or %NULL
13981  *
13982  * Reads an entire file into allocated memory, with good error
13983  * checking.
13984  *
13985  * If the call was successful, it returns %TRUE and sets @contents to the file
13986  * contents and @length to the length of the file contents in bytes. The string
13987  * stored in @contents will be nul-terminated, so for text files you can pass
13988  * %NULL for the @length argument. If the call was not successful, it returns
13989  * %FALSE and sets @error. The error domain is #G_FILE_ERROR. Possible error
13990  * codes are those in the #GFileError enumeration. In the error case,
13991  * @contents is set to %NULL and @length is set to zero.
13992  *
13993  * Returns: %TRUE on success, %FALSE if an error occurred
13994  */
13995
13996
13997 /**
13998  * g_file_open_tmp:
13999  * @tmpl: (type filename) (allow-none): Template for file name, as in g_mkstemp(), basename only, or %NULL for a default template
14000  * @name_used: (out) (type filename): location to store actual name used, or %NULL
14001  * @error: return location for a #GError
14002  *
14003  * Opens a file for writing in the preferred directory for temporary
14004  * files (as returned by g_get_tmp_dir()).
14005  *
14006  * @tmpl should be a string in the GLib file name encoding containing
14007  * a sequence of six 'X' characters, as the parameter to g_mkstemp().
14008  * However, unlike these functions, the template should only be a
14009  * basename, no directory components are allowed. If template is
14010  * %NULL, a default template is used.
14011  *
14012  * Note that in contrast to g_mkstemp() (and mkstemp()) @tmpl is not
14013  * modified, and might thus be a read-only literal string.
14014  *
14015  * Upon success, and if @name_used is non-%NULL, the actual name used
14016  * is returned in @name_used. This string should be freed with g_free()
14017  * when not needed any longer. The returned name is in the GLib file
14018  * name encoding.
14019  *
14020  * 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.
14021  */
14022
14023
14024 /**
14025  * g_file_read_link:
14026  * @filename: the symbolic link
14027  * @error: return location for a #GError
14028  *
14029  * Reads the contents of the symbolic link @filename like the POSIX
14030  * readlink() function.  The returned string is in the encoding used
14031  * for filenames. Use g_filename_to_utf8() to convert it to UTF-8.
14032  *
14033  * Returns: A newly-allocated string with the contents of the symbolic link, or %NULL if an error occurred.
14034  * Since: 2.4
14035  */
14036
14037
14038 /**
14039  * g_file_set_contents:
14040  * @filename: (type filename): name of a file to write @contents to, in the GLib file name encoding
14041  * @contents: (array length=length) (element-type guint8): string to write to the file
14042  * @length: length of @contents, or -1 if @contents is a nul-terminated string
14043  * @error: return location for a #GError, or %NULL
14044  *
14045  * Writes all of @contents to a file named @filename, with good error checking.
14046  * If a file called @filename already exists it will be overwritten.
14047  *
14048  * This write is atomic in the sense that it is first written to a temporary
14049  * file which is then renamed to the final name. Notes:
14050  * <itemizedlist>
14051  * <listitem>
14052  *    On Unix, if @filename already exists hard links to @filename will break.
14053  *    Also since the file is recreated, existing permissions, access control
14054  *    lists, metadata etc. may be lost. If @filename is a symbolic link,
14055  *    the link itself will be replaced, not the linked file.
14056  * </listitem>
14057  * <listitem>
14058  *   On Windows renaming a file will not remove an existing file with the
14059  *   new name, so on Windows there is a race condition between the existing
14060  *   file being removed and the temporary file being renamed.
14061  * </listitem>
14062  * <listitem>
14063  *   On Windows there is no way to remove a file that is open to some
14064  *   process, or mapped into memory. Thus, this function will fail if
14065  *   @filename already exists and is open.
14066  * </listitem>
14067  * </itemizedlist>
14068  *
14069  * If the call was successful, it returns %TRUE. If the call was not successful,
14070  * it returns %FALSE and sets @error. The error domain is #G_FILE_ERROR.
14071  * Possible error codes are those in the #GFileError enumeration.
14072  *
14073  * Note that the name for the temporary file is constructed by appending up
14074  * to 7 characters to @filename.
14075  *
14076  * Returns: %TRUE on success, %FALSE if an error occurred
14077  * Since: 2.8
14078  */
14079
14080
14081 /**
14082  * g_file_test:
14083  * @filename: a filename to test in the GLib file name encoding
14084  * @test: bitfield of #GFileTest flags
14085  *
14086  * Returns %TRUE if any of the tests in the bitfield @test are
14087  * %TRUE. For example, <literal>(G_FILE_TEST_EXISTS |
14088  * G_FILE_TEST_IS_DIR)</literal> will return %TRUE if the file exists;
14089  * the check whether it's a directory doesn't matter since the existence
14090  * test is %TRUE. With the current set of available tests, there's no point
14091  * passing in more than one test at a time.
14092  *
14093  * Apart from %G_FILE_TEST_IS_SYMLINK all tests follow symbolic links,
14094  * so for a symbolic link to a regular file g_file_test() will return
14095  * %TRUE for both %G_FILE_TEST_IS_SYMLINK and %G_FILE_TEST_IS_REGULAR.
14096  *
14097  * Note, that for a dangling symbolic link g_file_test() will return
14098  * %TRUE for %G_FILE_TEST_IS_SYMLINK and %FALSE for all other flags.
14099  *
14100  * You should never use g_file_test() to test whether it is safe
14101  * to perform an operation, because there is always the possibility
14102  * of the condition changing before you actually perform the operation.
14103  * For example, you might think you could use %G_FILE_TEST_IS_SYMLINK
14104  * to know whether it is safe to write to a file without being
14105  * tricked into writing into a different location. It doesn't work!
14106  * |[
14107  * /&ast; DON'T DO THIS &ast;/
14108  *  if (!g_file_test (filename, G_FILE_TEST_IS_SYMLINK))
14109  *    {
14110  *      fd = g_open (filename, O_WRONLY);
14111  *      /&ast; write to fd &ast;/
14112  *    }
14113  * ]|
14114  *
14115  * Another thing to note is that %G_FILE_TEST_EXISTS and
14116  * %G_FILE_TEST_IS_EXECUTABLE are implemented using the access()
14117  * system call. This usually doesn't matter, but if your program
14118  * is setuid or setgid it means that these tests will give you
14119  * the answer for the real user ID and group ID, rather than the
14120  * effective user ID and group ID.
14121  *
14122  * On Windows, there are no symlinks, so testing for
14123  * %G_FILE_TEST_IS_SYMLINK will always return %FALSE. Testing for
14124  * %G_FILE_TEST_IS_EXECUTABLE will just check that the file exists and
14125  * its name indicates that it is executable, checking for well-known
14126  * extensions and those listed in the <envar>PATHEXT</envar> environment variable.
14127  *
14128  * Returns: whether a test was %TRUE
14129  */
14130
14131
14132 /**
14133  * g_filename_display_basename:
14134  * @filename: an absolute pathname in the GLib file name encoding
14135  *
14136  * Returns the display basename for the particular filename, guaranteed
14137  * to be valid UTF-8. The display name might not be identical to the filename,
14138  * for instance there might be problems converting it to UTF-8, and some files
14139  * can be translated in the display.
14140  *
14141  * If GLib cannot make sense of the encoding of @filename, as a last resort it
14142  * replaces unknown characters with U+FFFD, the Unicode replacement character.
14143  * You can search the result for the UTF-8 encoding of this character (which is
14144  * "\357\277\275" in octal notation) to find out if @filename was in an invalid
14145  * encoding.
14146  *
14147  * You must pass the whole absolute pathname to this functions so that
14148  * translation of well known locations can be done.
14149  *
14150  * This function is preferred over g_filename_display_name() if you know the
14151  * whole path, as it allows translation.
14152  *
14153  * Returns: a newly allocated string containing a rendition of the basename of the filename in valid UTF-8
14154  * Since: 2.6
14155  */
14156
14157
14158 /**
14159  * g_filename_display_name:
14160  * @filename: a pathname hopefully in the GLib file name encoding
14161  *
14162  * Converts a filename into a valid UTF-8 string. The conversion is
14163  * not necessarily reversible, so you should keep the original around
14164  * and use the return value of this function only for display purposes.
14165  * Unlike g_filename_to_utf8(), the result is guaranteed to be non-%NULL
14166  * even if the filename actually isn't in the GLib file name encoding.
14167  *
14168  * If GLib cannot make sense of the encoding of @filename, as a last resort it
14169  * replaces unknown characters with U+FFFD, the Unicode replacement character.
14170  * You can search the result for the UTF-8 encoding of this character (which is
14171  * "\357\277\275" in octal notation) to find out if @filename was in an invalid
14172  * encoding.
14173  *
14174  * If you know the whole pathname of the file you should use
14175  * g_filename_display_basename(), since that allows location-based
14176  * translation of filenames.
14177  *
14178  * Returns: a newly allocated string containing a rendition of the filename in valid UTF-8
14179  * Since: 2.6
14180  */
14181
14182
14183 /**
14184  * g_filename_from_uri:
14185  * @uri: a uri describing a filename (escaped, encoded in ASCII).
14186  * @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.
14187  * @error: location to store the error occurring, or %NULL to ignore errors. Any of the errors in #GConvertError may occur.
14188  *
14189  * Converts an escaped ASCII-encoded URI to a local filename in the
14190  * encoding used for filenames.
14191  *
14192  * Returns: (type filename): a newly-allocated string holding the resulting filename, or %NULL on an error.
14193  */
14194
14195
14196 /**
14197  * g_filename_from_utf8:
14198  * @utf8string: a UTF-8 encoded string.
14199  * @len: the length of the string, or -1 if the string is nul-terminated.
14200  * @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.
14201  * @bytes_written: (out): the number of bytes stored in the output buffer (not including the terminating nul).
14202  * @error: location to store the error occurring, or %NULL to ignore errors. Any of the errors in #GConvertError may occur.
14203  *
14204  * Converts a string from UTF-8 to the encoding GLib uses for
14205  * filenames. Note that on Windows GLib uses UTF-8 for filenames;
14206  * on other platforms, this function indirectly depends on the
14207  * <link linkend="setlocale">current locale</link>.
14208  *
14209  * Returns: (array length=bytes_written) (element-type guint8) (transfer full): The converted string, or %NULL on an error.
14210  */
14211
14212
14213 /**
14214  * g_filename_to_uri:
14215  * @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
14216  * @hostname: (allow-none): A UTF-8 encoded hostname, or %NULL for none.
14217  * @error: location to store the error occurring, or %NULL to ignore errors. Any of the errors in #GConvertError may occur.
14218  *
14219  * Converts an absolute filename to an escaped ASCII-encoded URI, with the path
14220  * component following Section 3.3. of RFC 2396.
14221  *
14222  * Returns: a newly-allocated string holding the resulting URI, or %NULL on an error.
14223  */
14224
14225
14226 /**
14227  * g_filename_to_utf8:
14228  * @opsysstring: a string in the encoding for filenames
14229  * @len: the length of the string, or -1 if the string is nul-terminated<footnoteref linkend="nul-unsafe"/>.
14230  * @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.
14231  * @bytes_written: the number of bytes stored in the output buffer (not including the terminating nul).
14232  * @error: location to store the error occurring, or %NULL to ignore errors. Any of the errors in #GConvertError may occur.
14233  *
14234  * Converts a string which is in the encoding used by GLib for
14235  * filenames into a UTF-8 string. Note that on Windows GLib uses UTF-8
14236  * for filenames; on other platforms, this function indirectly depends on
14237  * the <link linkend="setlocale">current locale</link>.
14238  *
14239  * Returns: The converted string, or %NULL on an error.
14240  */
14241
14242
14243 /**
14244  * g_find_program_in_path:
14245  * @program: a program name in the GLib file name encoding
14246  *
14247  * Locates the first executable named @program in the user's path, in the
14248  * same way that execvp() would locate it. Returns an allocated string
14249  * with the absolute path name, or %NULL if the program is not found in
14250  * the path. If @program is already an absolute path, returns a copy of
14251  * @program if @program exists and is executable, and %NULL otherwise.
14252  *
14253  * On Windows, if @program does not have a file type suffix, tries
14254  * with the suffixes .exe, .cmd, .bat and .com, and the suffixes in
14255  * the <envar>PATHEXT</envar> environment variable.
14256  *
14257  * On Windows, it looks for the file in the same way as CreateProcess()
14258  * would. This means first in the directory where the executing
14259  * program was loaded from, then in the current directory, then in the
14260  * Windows 32-bit system directory, then in the Windows directory, and
14261  * finally in the directories in the <envar>PATH</envar> environment
14262  * variable. If the program is found, the return value contains the
14263  * full name including the type suffix.
14264  *
14265  * Returns: a newly-allocated string with the absolute path, or %NULL
14266  */
14267
14268
14269 /**
14270  * g_fopen:
14271  * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows)
14272  * @mode: a string describing the mode in which the file should be opened
14273  *
14274  * A wrapper for the stdio fopen() function. The fopen() function
14275  * opens a file and associates a new stream with it.
14276  *
14277  * Because file descriptors are specific to the C library on Windows,
14278  * and a file descriptor is partof the <type>FILE</type> struct, the
14279  * <type>FILE</type> pointer returned by this function makes sense
14280  * only to functions in the same C library. Thus if the GLib-using
14281  * code uses a different C library than GLib does, the
14282  * <type>FILE</type> pointer returned by this function cannot be
14283  * passed to C library functions like fprintf() or fread().
14284  *
14285  * See your C library manual for more details about fopen().
14286  *
14287  * Returns: A <type>FILE</type> pointer if the file was successfully opened, or %NULL if an error occurred
14288  * Since: 2.6
14289  */
14290
14291
14292 /**
14293  * g_format_size:
14294  * @size: a size in bytes
14295  *
14296  * Formats a size (for example the size of a file) into a human readable
14297  * string.  Sizes are rounded to the nearest size prefix (kB, MB, GB)
14298  * and are displayed rounded to the nearest tenth. E.g. the file size
14299  * 3292528 bytes will be converted into the string "3.2 MB".
14300  *
14301  * The prefix units base is 1000 (i.e. 1 kB is 1000 bytes).
14302  *
14303  * This string should be freed with g_free() when not needed any longer.
14304  *
14305  * See g_format_size_full() for more options about how the size might be
14306  * formatted.
14307  *
14308  * Returns: a newly-allocated formatted string containing a human readable file size
14309  * Since: 2.30
14310  */
14311
14312
14313 /**
14314  * g_format_size_for_display:
14315  * @size: a size in bytes
14316  *
14317  * Formats a size (for example the size of a file) into a human
14318  * readable string. Sizes are rounded to the nearest size prefix
14319  * (KB, MB, GB) and are displayed rounded to the nearest tenth.
14320  * E.g. the file size 3292528 bytes will be converted into the
14321  * string "3.1 MB".
14322  *
14323  * The prefix units base is 1024 (i.e. 1 KB is 1024 bytes).
14324  *
14325  * This string should be freed with g_free() when not needed any longer.
14326  *
14327  * Returns: a newly-allocated formatted string containing a human readable file size
14328  * Since: 2.16
14329  * Deprecated: 2.30: This function is broken due to its use of SI suffixes to denote IEC units. Use g_format_size() instead.
14330  */
14331
14332
14333 /**
14334  * g_format_size_full:
14335  * @size: a size in bytes
14336  * @flags: #GFormatSizeFlags to modify the output
14337  *
14338  * Formats a size.
14339  *
14340  * This function is similar to g_format_size() but allows for flags
14341  * that modify the output. See #GFormatSizeFlags.
14342  *
14343  * Returns: a newly-allocated formatted string containing a human readable file size
14344  * Since: 2.30
14345  */
14346
14347
14348 /**
14349  * g_fprintf:
14350  * @file: the stream to write to.
14351  * @format: a standard printf() format string, but notice <link linkend="string-precision">string precision pitfalls</link>.
14352  * @...: the arguments to insert in the output.
14353  *
14354  * An implementation of the standard fprintf() function which supports
14355  * positional parameters, as specified in the Single Unix Specification.
14356  *
14357  * Returns: the number of bytes printed.
14358  * Since: 2.2
14359  */
14360
14361
14362 /**
14363  * g_free:
14364  * @mem: the memory to free
14365  *
14366  * Frees the memory pointed to by @mem.
14367  * If @mem is %NULL it simply returns.
14368  */
14369
14370
14371 /**
14372  * g_freopen:
14373  * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows)
14374  * @mode: a string describing the mode in which the file should be opened
14375  * @stream: (allow-none): an existing stream which will be reused, or %NULL
14376  *
14377  * A wrapper for the POSIX freopen() function. The freopen() function
14378  * opens a file and associates it with an existing stream.
14379  *
14380  * See your C library manual for more details about freopen().
14381  *
14382  * Returns: A <literal>FILE</literal> pointer if the file was successfully opened, or %NULL if an error occurred.
14383  * Since: 2.6
14384  */
14385
14386
14387 /**
14388  * g_get_application_name:
14389  *
14390  * Gets a human-readable name for the application, as set by
14391  * g_set_application_name(). This name should be localized if
14392  * possible, and is intended for display to the user.  Contrast with
14393  * g_get_prgname(), which gets a non-localized name. If
14394  * g_set_application_name() has not been called, returns the result of
14395  * g_get_prgname() (which may be %NULL if g_set_prgname() has also not
14396  * been called).
14397  *
14398  * Returns: human-readable application name. may return %NULL
14399  * Since: 2.2
14400  */
14401
14402
14403 /**
14404  * g_get_charset:
14405  * @charset: return location for character set name
14406  *
14407  * Obtains the character set for the <link linkend="setlocale">current
14408  * locale</link>; you might use this character set as an argument to
14409  * g_convert(), to convert from the current locale's encoding to some
14410  * other encoding. (Frequently g_locale_to_utf8() and g_locale_from_utf8()
14411  * are nice shortcuts, though.)
14412  *
14413  * On Windows the character set returned by this function is the
14414  * so-called system default ANSI code-page. That is the character set
14415  * used by the "narrow" versions of C library and Win32 functions that
14416  * handle file names. It might be different from the character set
14417  * used by the C library's current locale.
14418  *
14419  * The return value is %TRUE if the locale's encoding is UTF-8, in that
14420  * case you can perhaps avoid calling g_convert().
14421  *
14422  * The string returned in @charset is not allocated, and should not be
14423  * freed.
14424  *
14425  * Returns: %TRUE if the returned charset is UTF-8
14426  */
14427
14428
14429 /**
14430  * g_get_codeset:
14431  *
14432  * Gets the character set for the current locale.
14433  *
14434  * Returns: a newly allocated string containing the name of the character set. This string must be freed with g_free().
14435  */
14436
14437
14438 /**
14439  * g_get_current_dir:
14440  *
14441  * Gets the current directory.
14442  *
14443  * The returned string should be freed when no longer needed.
14444  * The encoding of the returned string is system defined.
14445  * On Windows, it is always UTF-8.
14446  *
14447  * Returns: the current directory
14448  */
14449
14450
14451 /**
14452  * g_get_current_time:
14453  * @result: #GTimeVal structure in which to store current time.
14454  *
14455  * Equivalent to the UNIX gettimeofday() function, but portable.
14456  *
14457  * You may find g_get_real_time() to be more convenient.
14458  */
14459
14460
14461 /**
14462  * g_get_environ:
14463  *
14464  * Gets the list of environment variables for the current process.
14465  *
14466  * The list is %NULL terminated and each item in the list is of the
14467  * form 'NAME=VALUE'.
14468  *
14469  * This is equivalent to direct access to the 'environ' global variable,
14470  * except portable.
14471  *
14472  * The return value is freshly allocated and it should be freed with
14473  * g_strfreev() when it is no longer needed.
14474  *
14475  * Returns: (array zero-terminated=1) (transfer full): the list of environment variables
14476  * Since: 2.28
14477  */
14478
14479
14480 /**
14481  * g_get_filename_charsets:
14482  * @charsets: return location for the %NULL-terminated list of encoding names
14483  *
14484  * Determines the preferred character sets used for filenames.
14485  * The first character set from the @charsets is the filename encoding, the
14486  * subsequent character sets are used when trying to generate a displayable
14487  * representation of a filename, see g_filename_display_name().
14488  *
14489  * On Unix, the character sets are determined by consulting the
14490  * environment variables <envar>G_FILENAME_ENCODING</envar> and
14491  * <envar>G_BROKEN_FILENAMES</envar>. On Windows, the character set
14492  * used in the GLib API is always UTF-8 and said environment variables
14493  * have no effect.
14494  *
14495  * <envar>G_FILENAME_ENCODING</envar> may be set to a comma-separated list
14496  * of character set names. The special token "&commat;locale" is taken to
14497  * mean the character set for the <link linkend="setlocale">current
14498  * locale</link>. If <envar>G_FILENAME_ENCODING</envar> is not set, but
14499  * <envar>G_BROKEN_FILENAMES</envar> is, the character set of the current
14500  * locale is taken as the filename encoding. If neither environment variable
14501  * is set, UTF-8 is taken as the filename encoding, but the character
14502  * set of the current locale is also put in the list of encodings.
14503  *
14504  * The returned @charsets belong to GLib and must not be freed.
14505  *
14506  * Note that on Unix, regardless of the locale character set or
14507  * <envar>G_FILENAME_ENCODING</envar> value, the actual file names present
14508  * on a system might be in any random encoding or just gibberish.
14509  *
14510  * Returns: %TRUE if the filename encoding is UTF-8.
14511  * Since: 2.6
14512  */
14513
14514
14515 /**
14516  * g_get_home_dir:
14517  *
14518  * Gets the current user's home directory as defined in the
14519  * password database.
14520  *
14521  * Note that in contrast to traditional UNIX tools, this function
14522  * prefers <filename>passwd</filename> entries over the <envar>HOME</envar>
14523  * environment variable.
14524  *
14525  * One of the reasons for this decision is that applications in many
14526  * cases need special handling to deal with the case where
14527  * <envar>HOME</envar> is
14528  * <simplelist>
14529  *   <member>Not owned by the user</member>
14530  *   <member>Not writeable</member>
14531  *   <member>Not even readable</member>
14532  * </simplelist>
14533  * Since applications are in general <emphasis>not</emphasis> written
14534  * to deal with these situations it was considered better to make
14535  * g_get_home_dir() not pay attention to <envar>HOME</envar> and to
14536  * return the real home directory for the user. If applications
14537  * want to pay attention to <envar>HOME</envar>, they can do:
14538  * |[
14539  *  const char *homedir = g_getenv ("HOME");
14540  *   if (!homedir)
14541  *      homedir = g_get_home_dir (<!-- -->);
14542  * ]|
14543  *
14544  * Returns: the current user's home directory
14545  */
14546
14547
14548 /**
14549  * g_get_host_name:
14550  *
14551  * Return a name for the machine.
14552  *
14553  * The returned name is not necessarily a fully-qualified domain name,
14554  * or even present in DNS or some other name service at all. It need
14555  * not even be unique on your local network or site, but usually it
14556  * is. Callers should not rely on the return value having any specific
14557  * properties like uniqueness for security purposes. Even if the name
14558  * of the machine is changed while an application is running, the
14559  * return value from this function does not change. The returned
14560  * string is owned by GLib and should not be modified or freed. If no
14561  * name can be determined, a default fixed string "localhost" is
14562  * returned.
14563  *
14564  * Returns: the host name of the machine.
14565  * Since: 2.8
14566  */
14567
14568
14569 /**
14570  * g_get_language_names:
14571  *
14572  * Computes a list of applicable locale names, which can be used to
14573  * e.g. construct locale-dependent filenames or search paths. The returned
14574  * list is sorted from most desirable to least desirable and always contains
14575  * the default locale "C".
14576  *
14577  * For example, if LANGUAGE=de:en_US, then the returned list is
14578  * "de", "en_US", "en", "C".
14579  *
14580  * This function consults the environment variables <envar>LANGUAGE</envar>,
14581  * <envar>LC_ALL</envar>, <envar>LC_MESSAGES</envar> and <envar>LANG</envar>
14582  * to find the list of locales specified by the user.
14583  *
14584  * Returns: (array zero-terminated=1) (transfer none): a %NULL-terminated array of strings owned by GLib that must not be modified or freed.
14585  * Since: 2.6
14586  */
14587
14588
14589 /**
14590  * g_get_locale_variants:
14591  * @locale: a locale identifier
14592  *
14593  * Returns a list of derived variants of @locale, which can be used to
14594  * e.g. construct locale-dependent filenames or search paths. The returned
14595  * list is sorted from most desirable to least desirable.
14596  * This function handles territory, charset and extra locale modifiers.
14597  *
14598  * For example, if @locale is "fr_BE", then the returned list
14599  * is "fr_BE", "fr".
14600  *
14601  * If you need the list of variants for the <emphasis>current locale</emphasis>,
14602  * use g_get_language_names().
14603  *
14604  * 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().
14605  * Since: 2.28
14606  */
14607
14608
14609 /**
14610  * g_get_monotonic_time:
14611  *
14612  * Queries the system monotonic time, if available.
14613  *
14614  * On POSIX systems with clock_gettime() and <literal>CLOCK_MONOTONIC</literal> this call
14615  * is a very shallow wrapper for that.  Otherwise, we make a best effort
14616  * that probably involves returning the wall clock time (with at least
14617  * microsecond accuracy, subject to the limitations of the OS kernel).
14618  *
14619  * It's important to note that POSIX <literal>CLOCK_MONOTONIC</literal> does
14620  * not count time spent while the machine is suspended.
14621  *
14622  * On Windows, "limitations of the OS kernel" is a rather substantial
14623  * statement.  Depending on the configuration of the system, the wall
14624  * clock time is updated as infrequently as 64 times a second (which
14625  * is approximately every 16ms). Also, on XP (but not on Vista or later)
14626  * the monotonic clock is locally monotonic, but may differ in exact
14627  * value between processes due to timer wrap handling.
14628  *
14629  * Returns: the monotonic time, in microseconds
14630  * Since: 2.28
14631  */
14632
14633
14634 /**
14635  * g_get_prgname:
14636  *
14637  * Gets the name of the program. This name should <emphasis>not</emphasis>
14638  * be localized, contrast with g_get_application_name().
14639  * (If you are using GDK or GTK+ the program name is set in gdk_init(),
14640  * which is called by gtk_init(). The program name is found by taking
14641  * the last component of <literal>argv[0]</literal>.)
14642  *
14643  * Returns: the name of the program. The returned string belongs to GLib and must not be modified or freed.
14644  */
14645
14646
14647 /**
14648  * g_get_real_name:
14649  *
14650  * Gets the real name of the user. This usually comes from the user's entry
14651  * in the <filename>passwd</filename> file. The encoding of the returned
14652  * string is system-defined. (On Windows, it is, however, always UTF-8.)
14653  * If the real user name cannot be determined, the string "Unknown" is
14654  * returned.
14655  *
14656  * Returns: the user's real name.
14657  */
14658
14659
14660 /**
14661  * g_get_real_time:
14662  *
14663  * Queries the system wall-clock time.
14664  *
14665  * This call is functionally equivalent to g_get_current_time() except
14666  * that the return value is often more convenient than dealing with a
14667  * #GTimeVal.
14668  *
14669  * You should only use this call if you are actually interested in the real
14670  * wall-clock time.  g_get_monotonic_time() is probably more useful for
14671  * measuring intervals.
14672  *
14673  * Returns: the number of microseconds since January 1, 1970 UTC.
14674  * Since: 2.28
14675  */
14676
14677
14678 /**
14679  * g_get_system_config_dirs:
14680  *
14681  * Returns an ordered list of base directories in which to access
14682  * system-wide configuration information.
14683  *
14684  * On UNIX platforms this is determined using the mechanisms described in
14685  * the <ulink url="http://www.freedesktop.org/Standards/basedir-spec">
14686  * XDG Base Directory Specification</ulink>.
14687  * In this case the list of directories retrieved will be XDG_CONFIG_DIRS.
14688  *
14689  * On Windows is the directory that contains application data for all users.
14690  * A typical path is C:\Documents and Settings\All Users\Application Data.
14691  * This folder is used for application data that is not user specific.
14692  * For example, an application can store a spell-check dictionary, a database
14693  * of clip art, or a log file in the CSIDL_COMMON_APPDATA folder.
14694  * This information will not roam and is available to anyone using the computer.
14695  *
14696  * Returns: (array zero-terminated=1) (transfer none): a %NULL-terminated array of strings owned by GLib that must not be modified or freed.
14697  * Since: 2.6
14698  */
14699
14700
14701 /**
14702  * g_get_system_data_dirs:
14703  *
14704  * Returns an ordered list of base directories in which to access
14705  * system-wide application data.
14706  *
14707  * On UNIX platforms this is determined using the mechanisms described in
14708  * the <ulink url="http://www.freedesktop.org/Standards/basedir-spec">
14709  * XDG Base Directory Specification</ulink>
14710  * In this case the list of directories retrieved will be XDG_DATA_DIRS.
14711  *
14712  * On Windows the first elements in the list are the Application Data
14713  * and Documents folders for All Users. (These can be determined only
14714  * on Windows 2000 or later and are not present in the list on other
14715  * Windows versions.) See documentation for CSIDL_COMMON_APPDATA and
14716  * CSIDL_COMMON_DOCUMENTS.
14717  *
14718  * Then follows the "share" subfolder in the installation folder for
14719  * the package containing the DLL that calls this function, if it can
14720  * be determined.
14721  *
14722  * Finally the list contains the "share" subfolder in the installation
14723  * folder for GLib, and in the installation folder for the package the
14724  * application's .exe file belongs to.
14725  *
14726  * The installation folders above are determined by looking up the
14727  * folder where the module (DLL or EXE) in question is located. If the
14728  * folder's name is "bin", its parent is used, otherwise the folder
14729  * itself.
14730  *
14731  * Note that on Windows the returned list can vary depending on where
14732  * this function is called.
14733  *
14734  * Returns: (array zero-terminated=1) (transfer none): a %NULL-terminated array of strings owned by GLib that must not be modified or freed.
14735  * Since: 2.6
14736  */
14737
14738
14739 /**
14740  * g_get_tmp_dir:
14741  *
14742  * Gets the directory to use for temporary files. This is found from
14743  * inspecting the environment variables <envar>TMPDIR</envar>,
14744  * <envar>TMP</envar>, and <envar>TEMP</envar> in that order. If none
14745  * of those are defined "/tmp" is returned on UNIX and "C:\" on Windows.
14746  * The encoding of the returned string is system-defined. On Windows,
14747  * it is always UTF-8. The return value is never %NULL or the empty string.
14748  *
14749  * Returns: the directory to use for temporary files.
14750  */
14751
14752
14753 /**
14754  * g_get_user_cache_dir:
14755  *
14756  * Returns a base directory in which to store non-essential, cached
14757  * data specific to particular user.
14758  *
14759  * On UNIX platforms this is determined using the mechanisms described in
14760  * the <ulink url="http://www.freedesktop.org/Standards/basedir-spec">
14761  * XDG Base Directory Specification</ulink>.
14762  * In this case the directory retrieved will be XDG_CACHE_HOME.
14763  *
14764  * On Windows is the directory that serves as a common repository for
14765  * temporary Internet files. A typical path is
14766  * C:\Documents and Settings\username\Local Settings\Temporary Internet Files.
14767  * See documentation for CSIDL_INTERNET_CACHE.
14768  *
14769  * Returns: a string owned by GLib that must not be modified or freed.
14770  * Since: 2.6
14771  */
14772
14773
14774 /**
14775  * g_get_user_config_dir:
14776  *
14777  * Returns a base directory in which to store user-specific application
14778  * configuration information such as user preferences and settings.
14779  *
14780  * On UNIX platforms this is determined using the mechanisms described in
14781  * the <ulink url="http://www.freedesktop.org/Standards/basedir-spec">
14782  * XDG Base Directory Specification</ulink>.
14783  * In this case the directory retrieved will be XDG_CONFIG_HOME.
14784  *
14785  * On Windows this is the folder to use for local (as opposed to
14786  * roaming) application data. See documentation for
14787  * CSIDL_LOCAL_APPDATA. Note that on Windows it thus is the same as
14788  * what g_get_user_data_dir() returns.
14789  *
14790  * Returns: a string owned by GLib that must not be modified or freed.
14791  * Since: 2.6
14792  */
14793
14794
14795 /**
14796  * g_get_user_data_dir:
14797  *
14798  * Returns a base directory in which to access application data such
14799  * as icons that is customized for a particular user.
14800  *
14801  * On UNIX platforms this is determined using the mechanisms described in
14802  * the <ulink url="http://www.freedesktop.org/Standards/basedir-spec">
14803  * XDG Base Directory Specification</ulink>.
14804  * In this case the directory retrieved will be XDG_DATA_HOME.
14805  *
14806  * On Windows this is the folder to use for local (as opposed to
14807  * roaming) application data. See documentation for
14808  * CSIDL_LOCAL_APPDATA. Note that on Windows it thus is the same as
14809  * what g_get_user_config_dir() returns.
14810  *
14811  * Returns: a string owned by GLib that must not be modified or freed.
14812  * Since: 2.6
14813  */
14814
14815
14816 /**
14817  * g_get_user_name:
14818  *
14819  * Gets the user name of the current user. The encoding of the returned
14820  * string is system-defined. On UNIX, it might be the preferred file name
14821  * encoding, or something else, and there is no guarantee that it is even
14822  * consistent on a machine. On Windows, it is always UTF-8.
14823  *
14824  * Returns: the user name of the current user.
14825  */
14826
14827
14828 /**
14829  * g_get_user_runtime_dir:
14830  *
14831  * Returns a directory that is unique to the current user on the local
14832  * system.
14833  *
14834  * On UNIX platforms this is determined using the mechanisms described in
14835  * the <ulink url="http://www.freedesktop.org/Standards/basedir-spec">
14836  * XDG Base Directory Specification</ulink>.  This is the directory
14837  * specified in the <envar>XDG_RUNTIME_DIR</envar> environment variable.
14838  * In the case that this variable is not set, GLib will issue a warning
14839  * message to stderr and return the value of g_get_user_cache_dir().
14840  *
14841  * On Windows this is the folder to use for local (as opposed to
14842  * roaming) application data. See documentation for
14843  * CSIDL_LOCAL_APPDATA.  Note that on Windows it thus is the same as
14844  * what g_get_user_config_dir() returns.
14845  *
14846  * Returns: a string owned by GLib that must not be modified or freed.
14847  * Since: 2.28
14848  */
14849
14850
14851 /**
14852  * g_get_user_special_dir:
14853  * @directory: the logical id of special directory
14854  *
14855  * Returns the full path of a special directory using its logical id.
14856  *
14857  * On Unix this is done using the XDG special user directories.
14858  * For compatibility with existing practise, %G_USER_DIRECTORY_DESKTOP
14859  * falls back to <filename>$HOME/Desktop</filename> when XDG special
14860  * user directories have not been set up.
14861  *
14862  * Depending on the platform, the user might be able to change the path
14863  * of the special directory without requiring the session to restart; GLib
14864  * will not reflect any change once the special directories are loaded.
14865  *
14866  * 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.
14867  * Since: 2.14
14868  */
14869
14870
14871 /**
14872  * g_getenv:
14873  * @variable: the environment variable to get, in the GLib file name encoding
14874  *
14875  * Returns the value of an environment variable.
14876  *
14877  * The name and value are in the GLib file name encoding. On UNIX,
14878  * this means the actual bytes which might or might not be in some
14879  * consistent character set and encoding. On Windows, it is in UTF-8.
14880  * On Windows, in case the environment variable's value contains
14881  * references to other environment variables, they are expanded.
14882  *
14883  * 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().
14884  */
14885
14886
14887 /**
14888  * g_hash_table_add:
14889  * @hash_table: a #GHashTable
14890  * @key: a key to insert
14891  *
14892  * This is a convenience function for using a #GHashTable as a set.  It
14893  * is equivalent to calling g_hash_table_replace() with @key as both the
14894  * key and the value.
14895  *
14896  * When a hash table only ever contains keys that have themselves as the
14897  * corresponding value it is able to be stored more efficiently.  See
14898  * the discussion in the section description.
14899  *
14900  * Since: 2.32
14901  */
14902
14903
14904 /**
14905  * g_hash_table_contains:
14906  * @hash_table: a #GHashTable
14907  * @key: a key to check
14908  *
14909  * Checks if @key is in @hash_table.
14910  *
14911  * Since: 2.32
14912  */
14913
14914
14915 /**
14916  * g_hash_table_destroy:
14917  * @hash_table: a #GHashTable
14918  *
14919  * Destroys all keys and values in the #GHashTable and decrements its
14920  * reference count by 1. If keys and/or values are dynamically allocated,
14921  * you should either free them first or create the #GHashTable with destroy
14922  * notifiers using g_hash_table_new_full(). In the latter case the destroy
14923  * functions you supplied will be called on all keys and values during the
14924  * destruction phase.
14925  */
14926
14927
14928 /**
14929  * g_hash_table_find:
14930  * @hash_table: a #GHashTable
14931  * @predicate: function to test the key/value pairs for a certain property
14932  * @user_data: user data to pass to the function
14933  *
14934  * Calls the given function for key/value pairs in the #GHashTable
14935  * until @predicate returns %TRUE. The function is passed the key
14936  * and value of each pair, and the given @user_data parameter. The
14937  * hash table may not be modified while iterating over it (you can't
14938  * add/remove items).
14939  *
14940  * Note, that hash tables are really only optimized for forward
14941  * lookups, i.e. g_hash_table_lookup(). So code that frequently issues
14942  * g_hash_table_find() or g_hash_table_foreach() (e.g. in the order of
14943  * once per every entry in a hash table) should probably be reworked
14944  * to use additional or different data structures for reverse lookups
14945  * (keep in mind that an O(n) find/foreach operation issued for all n
14946  * values in a hash table ends up needing O(n*n) operations).
14947  *
14948  * 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.
14949  * Since: 2.4
14950  */
14951
14952
14953 /**
14954  * g_hash_table_foreach:
14955  * @hash_table: a #GHashTable
14956  * @func: the function to call for each key/value pair
14957  * @user_data: user data to pass to the function
14958  *
14959  * Calls the given function for each of the key/value pairs in the
14960  * #GHashTable.  The function is passed the key and value of each
14961  * pair, and the given @user_data parameter.  The hash table may not
14962  * be modified while iterating over it (you can't add/remove
14963  * items). To remove all items matching a predicate, use
14964  * g_hash_table_foreach_remove().
14965  *
14966  * See g_hash_table_find() for performance caveats for linear
14967  * order searches in contrast to g_hash_table_lookup().
14968  */
14969
14970
14971 /**
14972  * g_hash_table_foreach_remove:
14973  * @hash_table: a #GHashTable
14974  * @func: the function to call for each key/value pair
14975  * @user_data: user data to pass to the function
14976  *
14977  * Calls the given function for each key/value pair in the
14978  * #GHashTable. If the function returns %TRUE, then the key/value
14979  * pair is removed from the #GHashTable. If you supplied key or
14980  * value destroy functions when creating the #GHashTable, they are
14981  * used to free the memory allocated for the removed keys and values.
14982  *
14983  * See #GHashTableIter for an alternative way to loop over the
14984  * key/value pairs in the hash table.
14985  *
14986  * Returns: the number of key/value pairs removed
14987  */
14988
14989
14990 /**
14991  * g_hash_table_foreach_steal:
14992  * @hash_table: a #GHashTable
14993  * @func: the function to call for each key/value pair
14994  * @user_data: user data to pass to the function
14995  *
14996  * Calls the given function for each key/value pair in the
14997  * #GHashTable. If the function returns %TRUE, then the key/value
14998  * pair is removed from the #GHashTable, but no key or value
14999  * destroy functions are called.
15000  *
15001  * See #GHashTableIter for an alternative way to loop over the
15002  * key/value pairs in the hash table.
15003  *
15004  * Returns: the number of key/value pairs removed.
15005  */
15006
15007
15008 /**
15009  * g_hash_table_freeze:
15010  * @hash_table: a #GHashTable
15011  *
15012  * This function is deprecated and will be removed in the next major
15013  * release of GLib. It does nothing.
15014  */
15015
15016
15017 /**
15018  * g_hash_table_get_keys:
15019  * @hash_table: a #GHashTable
15020  *
15021  * Retrieves every key inside @hash_table. The returned data
15022  * is valid until @hash_table is modified.
15023  *
15024  * 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.
15025  * Since: 2.14
15026  */
15027
15028
15029 /**
15030  * g_hash_table_get_values:
15031  * @hash_table: a #GHashTable
15032  *
15033  * Retrieves every value inside @hash_table. The returned data
15034  * is valid until @hash_table is modified.
15035  *
15036  * 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.
15037  * Since: 2.14
15038  */
15039
15040
15041 /**
15042  * g_hash_table_insert:
15043  * @hash_table: a #GHashTable
15044  * @key: a key to insert
15045  * @value: the value to associate with the key
15046  *
15047  * Inserts a new key and value into a #GHashTable.
15048  *
15049  * If the key already exists in the #GHashTable its current
15050  * value is replaced with the new value. If you supplied a
15051  * @value_destroy_func when creating the #GHashTable, the old
15052  * value is freed using that function. If you supplied a
15053  * @key_destroy_func when creating the #GHashTable, the passed
15054  * key is freed using that function.
15055  */
15056
15057
15058 /**
15059  * g_hash_table_iter_get_hash_table:
15060  * @iter: an initialized #GHashTableIter
15061  *
15062  * Returns the #GHashTable associated with @iter.
15063  *
15064  * Returns: the #GHashTable associated with @iter.
15065  * Since: 2.16
15066  */
15067
15068
15069 /**
15070  * g_hash_table_iter_init:
15071  * @iter: an uninitialized #GHashTableIter
15072  * @hash_table: a #GHashTable
15073  *
15074  * Initializes a key/value pair iterator and associates it with
15075  * @hash_table. Modifying the hash table after calling this function
15076  * invalidates the returned iterator.
15077  * |[
15078  * GHashTableIter iter;
15079  * gpointer key, value;
15080  *
15081  * g_hash_table_iter_init (&iter, hash_table);
15082  * while (g_hash_table_iter_next (&iter, &key, &value))
15083  *   {
15084  *     /&ast; do something with key and value &ast;/
15085  *   }
15086  * ]|
15087  *
15088  * Since: 2.16
15089  */
15090
15091
15092 /**
15093  * g_hash_table_iter_next:
15094  * @iter: an initialized #GHashTableIter
15095  * @key: (allow-none): a location to store the key, or %NULL
15096  * @value: (allow-none): a location to store the value, or %NULL
15097  *
15098  * Advances @iter and retrieves the key and/or value that are now
15099  * pointed to as a result of this advancement. If %FALSE is returned,
15100  * @key and @value are not set, and the iterator becomes invalid.
15101  *
15102  * Returns: %FALSE if the end of the #GHashTable has been reached.
15103  * Since: 2.16
15104  */
15105
15106
15107 /**
15108  * g_hash_table_iter_remove:
15109  * @iter: an initialized #GHashTableIter
15110  *
15111  * Removes the key/value pair currently pointed to by the iterator
15112  * from its associated #GHashTable. Can only be called after
15113  * g_hash_table_iter_next() returned %TRUE, and cannot be called
15114  * more than once for the same key/value pair.
15115  *
15116  * If the #GHashTable was created using g_hash_table_new_full(),
15117  * the key and value are freed using the supplied destroy functions,
15118  * otherwise you have to make sure that any dynamically allocated
15119  * values are freed yourself.
15120  *
15121  * Since: 2.16
15122  */
15123
15124
15125 /**
15126  * g_hash_table_iter_replace:
15127  * @iter: an initialized #GHashTableIter
15128  * @value: the value to replace with
15129  *
15130  * Replaces the value currently pointed to by the iterator
15131  * from its associated #GHashTable. Can only be called after
15132  * g_hash_table_iter_next() returned %TRUE.
15133  *
15134  * If you supplied a @value_destroy_func when creating the
15135  * #GHashTable, the old value is freed using that function.
15136  *
15137  * Since: 2.30
15138  */
15139
15140
15141 /**
15142  * g_hash_table_iter_steal:
15143  * @iter: an initialized #GHashTableIter
15144  *
15145  * Removes the key/value pair currently pointed to by the
15146  * iterator from its associated #GHashTable, without calling
15147  * the key and value destroy functions. Can only be called
15148  * after g_hash_table_iter_next() returned %TRUE, and cannot
15149  * be called more than once for the same key/value pair.
15150  *
15151  * Since: 2.16
15152  */
15153
15154
15155 /**
15156  * g_hash_table_lookup:
15157  * @hash_table: a #GHashTable
15158  * @key: the key to look up
15159  *
15160  * Looks up a key in a #GHashTable. Note that this function cannot
15161  * distinguish between a key that is not present and one which is present
15162  * and has the value %NULL. If you need this distinction, use
15163  * g_hash_table_lookup_extended().
15164  *
15165  * Returns: (allow-none): the associated value, or %NULL if the key is not found
15166  */
15167
15168
15169 /**
15170  * g_hash_table_lookup_extended:
15171  * @hash_table: a #GHashTable
15172  * @lookup_key: the key to look up
15173  * @orig_key: (allow-none): return location for the original key, or %NULL
15174  * @value: (allow-none): return location for the value associated with the key, or %NULL
15175  *
15176  * Looks up a key in the #GHashTable, returning the original key and the
15177  * associated value and a #gboolean which is %TRUE if the key was found. This
15178  * is useful if you need to free the memory allocated for the original key,
15179  * for example before calling g_hash_table_remove().
15180  *
15181  * You can actually pass %NULL for @lookup_key to test
15182  * whether the %NULL key exists, provided the hash and equal functions
15183  * of @hash_table are %NULL-safe.
15184  *
15185  * Returns: %TRUE if the key was found in the #GHashTable
15186  */
15187
15188
15189 /**
15190  * g_hash_table_new:
15191  * @hash_func: a function to create a hash value from a key
15192  * @key_equal_func: a function to check two keys for equality
15193  *
15194  * Creates a new #GHashTable with a reference count of 1.
15195  *
15196  * Hash values returned by @hash_func are used to determine where keys
15197  * are stored within the #GHashTable data structure. The g_direct_hash(),
15198  * g_int_hash(), g_int64_hash(), g_double_hash() and g_str_hash()
15199  * functions are provided for some common types of keys.
15200  * If @hash_func is %NULL, g_direct_hash() is used.
15201  *
15202  * @key_equal_func is used when looking up keys in the #GHashTable.
15203  * The g_direct_equal(), g_int_equal(), g_int64_equal(), g_double_equal()
15204  * and g_str_equal() functions are provided for the most common types
15205  * of keys. If @key_equal_func is %NULL, keys are compared directly in
15206  * a similar fashion to g_direct_equal(), but without the overhead of
15207  * a function call.
15208  *
15209  * Returns: a new #GHashTable
15210  */
15211
15212
15213 /**
15214  * g_hash_table_new_full:
15215  * @hash_func: a function to create a hash value from a key
15216  * @key_equal_func: a function to check two keys for equality
15217  * @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.
15218  * @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.
15219  *
15220  * Creates a new #GHashTable like g_hash_table_new() with a reference
15221  * count of 1 and allows to specify functions to free the memory
15222  * allocated for the key and value that get called when removing the
15223  * entry from the #GHashTable.
15224  *
15225  * Returns: a new #GHashTable
15226  */
15227
15228
15229 /**
15230  * g_hash_table_ref:
15231  * @hash_table: a valid #GHashTable
15232  *
15233  * Atomically increments the reference count of @hash_table by one.
15234  * This function is MT-safe and may be called from any thread.
15235  *
15236  * Returns: the passed in #GHashTable
15237  * Since: 2.10
15238  */
15239
15240
15241 /**
15242  * g_hash_table_remove:
15243  * @hash_table: a #GHashTable
15244  * @key: the key to remove
15245  *
15246  * Removes a key and its associated value from a #GHashTable.
15247  *
15248  * If the #GHashTable was created using g_hash_table_new_full(), the
15249  * key and value are freed using the supplied destroy functions, otherwise
15250  * you have to make sure that any dynamically allocated values are freed
15251  * yourself.
15252  *
15253  * Returns: %TRUE if the key was found and removed from the #GHashTable
15254  */
15255
15256
15257 /**
15258  * g_hash_table_remove_all:
15259  * @hash_table: a #GHashTable
15260  *
15261  * Removes all keys and their associated values from a #GHashTable.
15262  *
15263  * If the #GHashTable was created using g_hash_table_new_full(),
15264  * the keys and values are freed using the supplied destroy functions,
15265  * otherwise you have to make sure that any dynamically allocated
15266  * values are freed yourself.
15267  *
15268  * Since: 2.12
15269  */
15270
15271
15272 /**
15273  * g_hash_table_replace:
15274  * @hash_table: a #GHashTable
15275  * @key: a key to insert
15276  * @value: the value to associate with the key
15277  *
15278  * Inserts a new key and value into a #GHashTable similar to
15279  * g_hash_table_insert(). The difference is that if the key
15280  * already exists in the #GHashTable, it gets replaced by the
15281  * new key. If you supplied a @value_destroy_func when creating
15282  * the #GHashTable, the old value is freed using that function.
15283  * If you supplied a @key_destroy_func when creating the
15284  * #GHashTable, the old key is freed using that function.
15285  */
15286
15287
15288 /**
15289  * g_hash_table_size:
15290  * @hash_table: a #GHashTable
15291  *
15292  * Returns the number of elements contained in the #GHashTable.
15293  *
15294  * Returns: the number of key/value pairs in the #GHashTable.
15295  */
15296
15297
15298 /**
15299  * g_hash_table_steal:
15300  * @hash_table: a #GHashTable
15301  * @key: the key to remove
15302  *
15303  * Removes a key and its associated value from a #GHashTable without
15304  * calling the key and value destroy functions.
15305  *
15306  * Returns: %TRUE if the key was found and removed from the #GHashTable
15307  */
15308
15309
15310 /**
15311  * g_hash_table_steal_all:
15312  * @hash_table: a #GHashTable
15313  *
15314  * Removes all keys and their associated values from a #GHashTable
15315  * without calling the key and value destroy functions.
15316  *
15317  * Since: 2.12
15318  */
15319
15320
15321 /**
15322  * g_hash_table_thaw:
15323  * @hash_table: a #GHashTable
15324  *
15325  * This function is deprecated and will be removed in the next major
15326  * release of GLib. It does nothing.
15327  */
15328
15329
15330 /**
15331  * g_hash_table_unref:
15332  * @hash_table: a valid #GHashTable
15333  *
15334  * Atomically decrements the reference count of @hash_table by one.
15335  * If the reference count drops to 0, all keys and values will be
15336  * destroyed, and all memory allocated by the hash table is released.
15337  * This function is MT-safe and may be called from any thread.
15338  *
15339  * Since: 2.10
15340  */
15341
15342
15343 /**
15344  * g_hmac_copy:
15345  * @hmac: the #GHmac to copy
15346  *
15347  * Copies a #GHmac. If @hmac has been closed, by calling
15348  * g_hmac_get_string() or g_hmac_get_digest(), the copied
15349  * HMAC will be closed as well.
15350  *
15351  * Returns: the copy of the passed #GHmac. Use g_hmac_unref() when finished using it.
15352  * Since: 2.30
15353  */
15354
15355
15356 /**
15357  * g_hmac_get_digest:
15358  * @hmac: a #GHmac
15359  * @buffer: output buffer
15360  * @digest_len: an inout parameter. The caller initializes it to the size of @buffer. After the call it contains the length of the digest
15361  *
15362  * Gets the digest from @checksum as a raw binary array and places it
15363  * into @buffer. The size of the digest depends on the type of checksum.
15364  *
15365  * Once this function has been called, the #GHmac is closed and can
15366  * no longer be updated with g_checksum_update().
15367  *
15368  * Since: 2.30
15369  */
15370
15371
15372 /**
15373  * g_hmac_get_string:
15374  * @hmac: a #GHmac
15375  *
15376  * Gets the HMAC as an hexadecimal string.
15377  *
15378  * Once this function has been called the #GHmac can no longer be
15379  * updated with g_hmac_update().
15380  *
15381  * The hexadecimal characters will be lower case.
15382  *
15383  * Returns: the hexadecimal representation of the HMAC. The returned string is owned by the HMAC and should not be modified or freed.
15384  * Since: 2.30
15385  */
15386
15387
15388 /**
15389  * g_hmac_new:
15390  * @digest_type: the desired type of digest
15391  * @key: (array length=key_len): the key for the HMAC
15392  * @key_len: the length of the keys
15393  *
15394  * Creates a new #GHmac, using the digest algorithm @digest_type.
15395  * If the @digest_type is not known, %NULL is returned.
15396  * A #GHmac can be used to compute the HMAC of a key and an
15397  * arbitrary binary blob, using different hashing algorithms.
15398  *
15399  * A #GHmac works by feeding a binary blob through g_hmac_update()
15400  * until the data is complete; the digest can then be extracted
15401  * using g_hmac_get_string(), which will return the checksum as a
15402  * hexadecimal string; or g_hmac_get_digest(), which will return a
15403  * array of raw bytes. Once either g_hmac_get_string() or
15404  * g_hmac_get_digest() have been called on a #GHmac, the HMAC
15405  * will be closed and it won't be possible to call g_hmac_update()
15406  * on it anymore.
15407  *
15408  * Returns: the newly created #GHmac, or %NULL. Use g_hmac_unref() to free the memory allocated by it.
15409  * Since: 2.30
15410  */
15411
15412
15413 /**
15414  * g_hmac_ref:
15415  * @hmac: a valid #GHmac
15416  *
15417  * Atomically increments the reference count of @hmac by one.
15418  *
15419  * This function is MT-safe and may be called from any thread.
15420  *
15421  * Returns: the passed in #GHmac.
15422  * Since: 2.30
15423  */
15424
15425
15426 /**
15427  * g_hmac_unref:
15428  * @hmac: a #GHmac
15429  *
15430  * Atomically decrements the reference count of @hmac by one.
15431  *
15432  * If the reference count drops to 0, all keys and values will be
15433  * destroyed, and all memory allocated by the hash table is released.
15434  * This function is MT-safe and may be called from any thread.
15435  * Frees the memory allocated for @hmac.
15436  *
15437  * Since: 2.30
15438  */
15439
15440
15441 /**
15442  * g_hmac_update:
15443  * @hmac: a #GHmac
15444  * @data: (array length=length): buffer used to compute the checksum
15445  * @length: size of the buffer, or -1 if it is a nul-terminated string
15446  *
15447  * Feeds @data into an existing #GHmac.
15448  *
15449  * The HMAC must still be open, that is g_hmac_get_string() or
15450  * g_hmac_get_digest() must not have been called on @hmac.
15451  *
15452  * Since: 2.30
15453  */
15454
15455
15456 /**
15457  * g_hook_alloc:
15458  * @hook_list: a #GHookList
15459  *
15460  * Allocates space for a #GHook and initializes it.
15461  *
15462  * Returns: a new #GHook
15463  */
15464
15465
15466 /**
15467  * g_hook_append:
15468  * @hook_list: a #GHookList
15469  * @hook: the #GHook to add to the end of @hook_list
15470  *
15471  * Appends a #GHook onto the end of a #GHookList.
15472  */
15473
15474
15475 /**
15476  * g_hook_compare_ids:
15477  * @new_hook: a #GHook
15478  * @sibling: a #GHook to compare with @new_hook
15479  *
15480  * Compares the ids of two #GHook elements, returning a negative value
15481  * if the second id is greater than the first.
15482  *
15483  * Returns: a value &lt;= 0 if the id of @sibling is >= the id of @new_hook
15484  */
15485
15486
15487 /**
15488  * g_hook_destroy:
15489  * @hook_list: a #GHookList
15490  * @hook_id: a hook ID
15491  *
15492  * Destroys a #GHook, given its ID.
15493  *
15494  * Returns: %TRUE if the #GHook was found in the #GHookList and destroyed
15495  */
15496
15497
15498 /**
15499  * g_hook_destroy_link:
15500  * @hook_list: a #GHookList
15501  * @hook: the #GHook to remove
15502  *
15503  * Removes one #GHook from a #GHookList, marking it
15504  * inactive and calling g_hook_unref() on it.
15505  */
15506
15507
15508 /**
15509  * g_hook_find:
15510  * @hook_list: a #GHookList
15511  * @need_valids: %TRUE if #GHook elements which have been destroyed should be skipped
15512  * @func: the function to call for each #GHook, which should return %TRUE when the #GHook has been found
15513  * @data: the data to pass to @func
15514  *
15515  * Finds a #GHook in a #GHookList using the given function to
15516  * test for a match.
15517  *
15518  * Returns: the found #GHook or %NULL if no matching #GHook is found
15519  */
15520
15521
15522 /**
15523  * g_hook_find_data:
15524  * @hook_list: a #GHookList
15525  * @need_valids: %TRUE if #GHook elements which have been destroyed should be skipped
15526  * @data: the data to find
15527  *
15528  * Finds a #GHook in a #GHookList with the given data.
15529  *
15530  * Returns: the #GHook with the given @data or %NULL if no matching #GHook is found
15531  */
15532
15533
15534 /**
15535  * g_hook_find_func:
15536  * @hook_list: a #GHookList
15537  * @need_valids: %TRUE if #GHook elements which have been destroyed should be skipped
15538  * @func: the function to find
15539  *
15540  * Finds a #GHook in a #GHookList with the given function.
15541  *
15542  * Returns: the #GHook with the given @func or %NULL if no matching #GHook is found
15543  */
15544
15545
15546 /**
15547  * g_hook_find_func_data:
15548  * @hook_list: a #GHookList
15549  * @need_valids: %TRUE if #GHook elements which have been destroyed should be skipped
15550  * @func: the function to find
15551  * @data: the data to find
15552  *
15553  * Finds a #GHook in a #GHookList with the given function and data.
15554  *
15555  * Returns: the #GHook with the given @func and @data or %NULL if no matching #GHook is found
15556  */
15557
15558
15559 /**
15560  * g_hook_first_valid:
15561  * @hook_list: a #GHookList
15562  * @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
15563  *
15564  * Returns the first #GHook in a #GHookList which has not been destroyed.
15565  * The reference count for the #GHook is incremented, so you must call
15566  * g_hook_unref() to restore it when no longer needed. (Or call
15567  * g_hook_next_valid() if you are stepping through the #GHookList.)
15568  *
15569  * Returns: the first valid #GHook, or %NULL if none are valid
15570  */
15571
15572
15573 /**
15574  * g_hook_free:
15575  * @hook_list: a #GHookList
15576  * @hook: the #GHook to free
15577  *
15578  * Calls the #GHookList @finalize_hook function if it exists,
15579  * and frees the memory allocated for the #GHook.
15580  */
15581
15582
15583 /**
15584  * g_hook_get:
15585  * @hook_list: a #GHookList
15586  * @hook_id: a hook id
15587  *
15588  * Returns the #GHook with the given id, or %NULL if it is not found.
15589  *
15590  * Returns: the #GHook with the given id, or %NULL if it is not found
15591  */
15592
15593
15594 /**
15595  * g_hook_insert_before:
15596  * @hook_list: a #GHookList
15597  * @sibling: the #GHook to insert the new #GHook before
15598  * @hook: the #GHook to insert
15599  *
15600  * Inserts a #GHook into a #GHookList, before a given #GHook.
15601  */
15602
15603
15604 /**
15605  * g_hook_insert_sorted:
15606  * @hook_list: a #GHookList
15607  * @hook: the #GHook to insert
15608  * @func: the comparison function used to sort the #GHook elements
15609  *
15610  * Inserts a #GHook into a #GHookList, sorted by the given function.
15611  */
15612
15613
15614 /**
15615  * g_hook_list_clear:
15616  * @hook_list: a #GHookList
15617  *
15618  * Removes all the #GHook elements from a #GHookList.
15619  */
15620
15621
15622 /**
15623  * g_hook_list_init:
15624  * @hook_list: a #GHookList
15625  * @hook_size: the size of each element in the #GHookList, typically <literal>sizeof (GHook)</literal>
15626  *
15627  * Initializes a #GHookList.
15628  * This must be called before the #GHookList is used.
15629  */
15630
15631
15632 /**
15633  * g_hook_list_invoke:
15634  * @hook_list: a #GHookList
15635  * @may_recurse: %TRUE if functions which are already running (e.g. in another thread) can be called. If set to %FALSE, these are skipped
15636  *
15637  * Calls all of the #GHook functions in a #GHookList.
15638  */
15639
15640
15641 /**
15642  * g_hook_list_invoke_check:
15643  * @hook_list: a #GHookList
15644  * @may_recurse: %TRUE if functions which are already running (e.g. in another thread) can be called. If set to %FALSE, these are skipped
15645  *
15646  * Calls all of the #GHook functions in a #GHookList.
15647  * Any function which returns %FALSE is removed from the #GHookList.
15648  */
15649
15650
15651 /**
15652  * g_hook_list_marshal:
15653  * @hook_list: a #GHookList
15654  * @may_recurse: %TRUE if hooks which are currently running (e.g. in another thread) are considered valid. If set to %FALSE, these are skipped
15655  * @marshaller: the function to call for each #GHook
15656  * @marshal_data: data to pass to @marshaller
15657  *
15658  * Calls a function on each valid #GHook.
15659  */
15660
15661
15662 /**
15663  * g_hook_list_marshal_check:
15664  * @hook_list: a #GHookList
15665  * @may_recurse: %TRUE if hooks which are currently running (e.g. in another thread) are considered valid. If set to %FALSE, these are skipped
15666  * @marshaller: the function to call for each #GHook
15667  * @marshal_data: data to pass to @marshaller
15668  *
15669  * Calls a function on each valid #GHook and destroys it if the
15670  * function returns %FALSE.
15671  */
15672
15673
15674 /**
15675  * g_hook_next_valid:
15676  * @hook_list: a #GHookList
15677  * @hook: the current #GHook
15678  * @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
15679  *
15680  * Returns the next #GHook in a #GHookList which has not been destroyed.
15681  * The reference count for the #GHook is incremented, so you must call
15682  * g_hook_unref() to restore it when no longer needed. (Or continue to call
15683  * g_hook_next_valid() until %NULL is returned.)
15684  *
15685  * Returns: the next valid #GHook, or %NULL if none are valid
15686  */
15687
15688
15689 /**
15690  * g_hook_prepend:
15691  * @hook_list: a #GHookList
15692  * @hook: the #GHook to add to the start of @hook_list
15693  *
15694  * Prepends a #GHook on the start of a #GHookList.
15695  */
15696
15697
15698 /**
15699  * g_hook_ref:
15700  * @hook_list: a #GHookList
15701  * @hook: the #GHook to increment the reference count of
15702  *
15703  * Increments the reference count for a #GHook.
15704  *
15705  * Returns: the @hook that was passed in (since 2.6)
15706  */
15707
15708
15709 /**
15710  * g_hook_unref:
15711  * @hook_list: a #GHookList
15712  * @hook: the #GHook to unref
15713  *
15714  * Decrements the reference count of a #GHook.
15715  * If the reference count falls to 0, the #GHook is removed
15716  * from the #GHookList and g_hook_free() is called to free it.
15717  */
15718
15719
15720 /**
15721  * g_hostname_is_ascii_encoded:
15722  * @hostname: a hostname
15723  *
15724  * Tests if @hostname contains segments with an ASCII-compatible
15725  * encoding of an Internationalized Domain Name. If this returns
15726  * %TRUE, you should decode the hostname with g_hostname_to_unicode()
15727  * before displaying it to the user.
15728  *
15729  * Note that a hostname might contain a mix of encoded and unencoded
15730  * segments, and so it is possible for g_hostname_is_non_ascii() and
15731  * g_hostname_is_ascii_encoded() to both return %TRUE for a name.
15732  *
15733  * Returns: %TRUE if @hostname contains any ASCII-encoded segments.
15734  * Since: 2.22
15735  */
15736
15737
15738 /**
15739  * g_hostname_is_ip_address:
15740  * @hostname: a hostname (or IP address in string form)
15741  *
15742  * Tests if @hostname is the string form of an IPv4 or IPv6 address.
15743  * (Eg, "192.168.0.1".)
15744  *
15745  * Returns: %TRUE if @hostname is an IP address
15746  * Since: 2.22
15747  */
15748
15749
15750 /**
15751  * g_hostname_is_non_ascii:
15752  * @hostname: a hostname
15753  *
15754  * Tests if @hostname contains Unicode characters. If this returns
15755  * %TRUE, you need to encode the hostname with g_hostname_to_ascii()
15756  * before using it in non-IDN-aware contexts.
15757  *
15758  * Note that a hostname might contain a mix of encoded and unencoded
15759  * segments, and so it is possible for g_hostname_is_non_ascii() and
15760  * g_hostname_is_ascii_encoded() to both return %TRUE for a name.
15761  *
15762  * Returns: %TRUE if @hostname contains any non-ASCII characters
15763  * Since: 2.22
15764  */
15765
15766
15767 /**
15768  * g_hostname_to_ascii:
15769  * @hostname: a valid UTF-8 or ASCII hostname
15770  *
15771  * Converts @hostname to its canonical ASCII form; an ASCII-only
15772  * string containing no uppercase letters and not ending with a
15773  * trailing dot.
15774  *
15775  * Returns: an ASCII hostname, which must be freed, or %NULL if @hostname is in some way invalid.
15776  * Since: 2.22
15777  */
15778
15779
15780 /**
15781  * g_hostname_to_unicode:
15782  * @hostname: a valid UTF-8 or ASCII hostname
15783  *
15784  * Converts @hostname to its canonical presentation form; a UTF-8
15785  * string in Unicode normalization form C, containing no uppercase
15786  * letters, no forbidden characters, and no ASCII-encoded segments,
15787  * and not ending with a trailing dot.
15788  *
15789  * Of course if @hostname is not an internationalized hostname, then
15790  * the canonical presentation form will be entirely ASCII.
15791  *
15792  * Returns: a UTF-8 hostname, which must be freed, or %NULL if @hostname is in some way invalid.
15793  * Since: 2.22
15794  */
15795
15796
15797 /**
15798  * g_htonl:
15799  * @val: a 32-bit integer value in host byte order
15800  *
15801  * Converts a 32-bit integer value from host to network byte order.
15802  *
15803  * Returns: @val converted to network byte order
15804  */
15805
15806
15807 /**
15808  * g_htons:
15809  * @val: a 16-bit integer value in host byte order
15810  *
15811  * Converts a 16-bit integer value from host to network byte order.
15812  *
15813  * Returns: @val converted to network byte order
15814  */
15815
15816
15817 /**
15818  * g_iconv:
15819  * @converter: conversion descriptor from g_iconv_open()
15820  * @inbuf: bytes to convert
15821  * @inbytes_left: inout parameter, bytes remaining to convert in @inbuf
15822  * @outbuf: converted output bytes
15823  * @outbytes_left: inout parameter, bytes available to fill in @outbuf
15824  *
15825  * Same as the standard UNIX routine iconv(), but
15826  * may be implemented via libiconv on UNIX flavors that lack
15827  * a native implementation.
15828  *
15829  * GLib provides g_convert() and g_locale_to_utf8() which are likely
15830  * more convenient than the raw iconv wrappers.
15831  *
15832  * Returns: count of non-reversible conversions, or -1 on error
15833  */
15834
15835
15836 /**
15837  * g_iconv_close:
15838  * @converter: a conversion descriptor from g_iconv_open()
15839  *
15840  * Same as the standard UNIX routine iconv_close(), but
15841  * may be implemented via libiconv on UNIX flavors that lack
15842  * a native implementation. Should be called to clean up
15843  * the conversion descriptor from g_iconv_open() when
15844  * you are done converting things.
15845  *
15846  * GLib provides g_convert() and g_locale_to_utf8() which are likely
15847  * more convenient than the raw iconv wrappers.
15848  *
15849  * Returns: -1 on error, 0 on success
15850  */
15851
15852
15853 /**
15854  * g_iconv_open:
15855  * @to_codeset: destination codeset
15856  * @from_codeset: source codeset
15857  *
15858  * Same as the standard UNIX routine iconv_open(), but
15859  * may be implemented via libiconv on UNIX flavors that lack
15860  * a native implementation.
15861  *
15862  * GLib provides g_convert() and g_locale_to_utf8() which are likely
15863  * more convenient than the raw iconv wrappers.
15864  *
15865  * Returns: a "conversion descriptor", or (GIConv)-1 if opening the converter failed.
15866  */
15867
15868
15869 /**
15870  * g_idle_add:
15871  * @function: function to call
15872  * @data: data to pass to @function.
15873  *
15874  * Adds a function to be called whenever there are no higher priority
15875  * events pending to the default main loop. The function is given the
15876  * default idle priority, #G_PRIORITY_DEFAULT_IDLE.  If the function
15877  * returns %FALSE it is automatically removed from the list of event
15878  * sources and will not be called again.
15879  *
15880  * This internally creates a main loop source using g_idle_source_new()
15881  * and attaches it to the main loop context using g_source_attach().
15882  * You can do these steps manually if you need greater control.
15883  *
15884  * Returns: the ID (greater than 0) of the event source.
15885  */
15886
15887
15888 /**
15889  * g_idle_add_full:
15890  * @priority: the priority of the idle source. Typically this will be in the range between #G_PRIORITY_DEFAULT_IDLE and #G_PRIORITY_HIGH_IDLE.
15891  * @function: function to call
15892  * @data: data to pass to @function
15893  * @notify: (allow-none): function to call when the idle is removed, or %NULL
15894  *
15895  * Adds a function to be called whenever there are no higher priority
15896  * events pending.  If the function returns %FALSE it is automatically
15897  * removed from the list of event sources and will not be called again.
15898  *
15899  * This internally creates a main loop source using g_idle_source_new()
15900  * and attaches it to the main loop context using g_source_attach().
15901  * You can do these steps manually if you need greater control.
15902  *
15903  * Returns: the ID (greater than 0) of the event source.
15904  * Rename to: g_idle_add
15905  */
15906
15907
15908 /**
15909  * g_idle_remove_by_data:
15910  * @data: the data for the idle source's callback.
15911  *
15912  * Removes the idle function with the given data.
15913  *
15914  * Returns: %TRUE if an idle source was found and removed.
15915  */
15916
15917
15918 /**
15919  * g_idle_source_new:
15920  *
15921  * Creates a new idle source.
15922  *
15923  * The source will not initially be associated with any #GMainContext
15924  * and must be added to one with g_source_attach() before it will be
15925  * executed. Note that the default priority for idle sources is
15926  * %G_PRIORITY_DEFAULT_IDLE, as compared to other sources which
15927  * have a default priority of %G_PRIORITY_DEFAULT.
15928  *
15929  * Returns: the newly-created idle source
15930  */
15931
15932
15933 /**
15934  * g_int64_equal:
15935  * @v1: a pointer to a #gint64 key
15936  * @v2: a pointer to a #gint64 key to compare with @v1
15937  *
15938  * Compares the two #gint64 values being pointed to and returns
15939  * %TRUE if they are equal.
15940  * It can be passed to g_hash_table_new() as the @key_equal_func
15941  * parameter, when using non-%NULL pointers to 64-bit integers as keys in a
15942  * #GHashTable.
15943  *
15944  * Returns: %TRUE if the two keys match.
15945  * Since: 2.22
15946  */
15947
15948
15949 /**
15950  * g_int64_hash:
15951  * @v: a pointer to a #gint64 key
15952  *
15953  * Converts a pointer to a #gint64 to a hash value.
15954  *
15955  * It can be passed to g_hash_table_new() as the @hash_func parameter,
15956  * when using non-%NULL pointers to 64-bit integer values as keys in a
15957  * #GHashTable.
15958  *
15959  * Returns: a hash value corresponding to the key.
15960  * Since: 2.22
15961  */
15962
15963
15964 /**
15965  * g_int_equal:
15966  * @v1: a pointer to a #gint key
15967  * @v2: a pointer to a #gint key to compare with @v1
15968  *
15969  * Compares the two #gint values being pointed to and returns
15970  * %TRUE if they are equal.
15971  * It can be passed to g_hash_table_new() as the @key_equal_func
15972  * parameter, when using non-%NULL pointers to integers as keys in a
15973  * #GHashTable.
15974  *
15975  * Note that this function acts on pointers to #gint, not on #gint directly:
15976  * if your hash table's keys are of the form
15977  * <literal>GINT_TO_POINTER (n)</literal>, use g_direct_equal() instead.
15978  *
15979  * Returns: %TRUE if the two keys match.
15980  */
15981
15982
15983 /**
15984  * g_int_hash:
15985  * @v: a pointer to a #gint key
15986  *
15987  * Converts a pointer to a #gint to a hash value.
15988  * It can be passed to g_hash_table_new() as the @hash_func parameter,
15989  * when using non-%NULL pointers to integer values as keys in a #GHashTable.
15990  *
15991  * Note that this function acts on pointers to #gint, not on #gint directly:
15992  * if your hash table's keys are of the form
15993  * <literal>GINT_TO_POINTER (n)</literal>, use g_direct_hash() instead.
15994  *
15995  * Returns: a hash value corresponding to the key.
15996  */
15997
15998
15999 /**
16000  * g_intern_static_string:
16001  * @string: (allow-none): a static string
16002  *
16003  * Returns a canonical representation for @string. Interned strings
16004  * can be compared for equality by comparing the pointers, instead of
16005  * using strcmp(). g_intern_static_string() does not copy the string,
16006  * therefore @string must not be freed or modified.
16007  *
16008  * Returns: a canonical representation for the string
16009  * Since: 2.10
16010  */
16011
16012
16013 /**
16014  * g_intern_string:
16015  * @string: (allow-none): a string
16016  *
16017  * Returns a canonical representation for @string. Interned strings
16018  * can be compared for equality by comparing the pointers, instead of
16019  * using strcmp().
16020  *
16021  * Returns: a canonical representation for the string
16022  * Since: 2.10
16023  */
16024
16025
16026 /**
16027  * g_io_add_watch:
16028  * @channel: a #GIOChannel
16029  * @condition: the condition to watch for
16030  * @func: the function to call when the condition is satisfied
16031  * @user_data: user data to pass to @func
16032  *
16033  * Adds the #GIOChannel into the default main loop context
16034  * with the default priority.
16035  *
16036  * Returns: the event source id
16037  */
16038
16039
16040 /**
16041  * g_io_add_watch_full:
16042  * @channel: a #GIOChannel
16043  * @priority: the priority of the #GIOChannel source
16044  * @condition: the condition to watch for
16045  * @func: the function to call when the condition is satisfied
16046  * @user_data: user data to pass to @func
16047  * @notify: the function to call when the source is removed
16048  *
16049  * Adds the #GIOChannel into the default main loop context
16050  * with the given priority.
16051  *
16052  * This internally creates a main loop source using g_io_create_watch()
16053  * and attaches it to the main loop context with g_source_attach().
16054  * You can do these steps manually if you need greater control.
16055  *
16056  * Returns: the event source id
16057  * Rename to: g_io_add_watch
16058  */
16059
16060
16061 /**
16062  * g_io_channel_close:
16063  * @channel: A #GIOChannel
16064  *
16065  * Close an IO channel. Any pending data to be written will be
16066  * flushed, ignoring errors. The channel will not be freed until the
16067  * last reference is dropped using g_io_channel_unref().
16068  *
16069  * Deprecated: 2.2: Use g_io_channel_shutdown() instead.
16070  */
16071
16072
16073 /**
16074  * g_io_channel_error_from_errno:
16075  * @en: an <literal>errno</literal> error number, e.g. <literal>EINVAL</literal>
16076  *
16077  * Converts an <literal>errno</literal> error number to a #GIOChannelError.
16078  *
16079  * Returns: a #GIOChannelError error number, e.g. %G_IO_CHANNEL_ERROR_INVAL.
16080  */
16081
16082
16083 /**
16084  * g_io_channel_error_quark:
16085  *
16086  *
16087  *
16088  * Returns: the quark used as %G_IO_CHANNEL_ERROR
16089  */
16090
16091
16092 /**
16093  * g_io_channel_flush:
16094  * @channel: a #GIOChannel
16095  * @error: location to store an error of type #GIOChannelError
16096  *
16097  * Flushes the write buffer for the GIOChannel.
16098  *
16099  * Returns: the status of the operation: One of #G_IO_STATUS_NORMAL, #G_IO_STATUS_AGAIN, or #G_IO_STATUS_ERROR.
16100  */
16101
16102
16103 /**
16104  * g_io_channel_get_buffer_condition:
16105  * @channel: A #GIOChannel
16106  *
16107  * This function returns a #GIOCondition depending on whether there
16108  * is data to be read/space to write data in the internal buffers in
16109  * the #GIOChannel. Only the flags %G_IO_IN and %G_IO_OUT may be set.
16110  *
16111  * Returns: A #GIOCondition
16112  */
16113
16114
16115 /**
16116  * g_io_channel_get_buffer_size:
16117  * @channel: a #GIOChannel
16118  *
16119  * Gets the buffer size.
16120  *
16121  * Returns: the size of the buffer.
16122  */
16123
16124
16125 /**
16126  * g_io_channel_get_buffered:
16127  * @channel: a #GIOChannel
16128  *
16129  * Returns whether @channel is buffered.
16130  *
16131  * Returns: %TRUE if the @channel is buffered.
16132  */
16133
16134
16135 /**
16136  * g_io_channel_get_close_on_unref:
16137  * @channel: a #GIOChannel.
16138  *
16139  * Returns whether the file/socket/whatever associated with @channel
16140  * will be closed when @channel receives its final unref and is
16141  * destroyed. The default value of this is %TRUE for channels created
16142  * by g_io_channel_new_file (), and %FALSE for all other channels.
16143  *
16144  * Returns: Whether the channel will be closed on the final unref of the GIOChannel data structure.
16145  */
16146
16147
16148 /**
16149  * g_io_channel_get_encoding:
16150  * @channel: a #GIOChannel
16151  *
16152  * Gets the encoding for the input/output of the channel.
16153  * The internal encoding is always UTF-8. The encoding %NULL
16154  * makes the channel safe for binary data.
16155  *
16156  * Returns: A string containing the encoding, this string is owned by GLib and must not be freed.
16157  */
16158
16159
16160 /**
16161  * g_io_channel_get_flags:
16162  * @channel: a #GIOChannel
16163  *
16164  * Gets the current flags for a #GIOChannel, including read-only
16165  * flags such as %G_IO_FLAG_IS_READABLE.
16166  *
16167  * The values of the flags %G_IO_FLAG_IS_READABLE and %G_IO_FLAG_IS_WRITABLE
16168  * are cached for internal use by the channel when it is created.
16169  * If they should change at some later point (e.g. partial shutdown
16170  * of a socket with the UNIX shutdown() function), the user
16171  * should immediately call g_io_channel_get_flags() to update
16172  * the internal values of these flags.
16173  *
16174  * Returns: the flags which are set on the channel
16175  */
16176
16177
16178 /**
16179  * g_io_channel_get_line_term:
16180  * @channel: a #GIOChannel
16181  * @length: a location to return the length of the line terminator
16182  *
16183  * This returns the string that #GIOChannel uses to determine
16184  * where in the file a line break occurs. A value of %NULL
16185  * indicates autodetection.
16186  *
16187  * Returns: The line termination string. This value is owned by GLib and must not be freed.
16188  */
16189
16190
16191 /**
16192  * g_io_channel_init:
16193  * @channel: a #GIOChannel
16194  *
16195  * Initializes a #GIOChannel struct.
16196  *
16197  * This is called by each of the above functions when creating a
16198  * #GIOChannel, and so is not often needed by the application
16199  * programmer (unless you are creating a new type of #GIOChannel).
16200  */
16201
16202
16203 /**
16204  * g_io_channel_new_file:
16205  * @filename: A string containing the name of a file
16206  * @mode: One of "r", "w", "a", "r+", "w+", "a+". These have the same meaning as in fopen()
16207  * @error: A location to return an error of type %G_FILE_ERROR
16208  *
16209  * Open a file @filename as a #GIOChannel using mode @mode. This
16210  * channel will be closed when the last reference to it is dropped,
16211  * so there is no need to call g_io_channel_close() (though doing
16212  * so will not cause problems, as long as no attempt is made to
16213  * access the channel after it is closed).
16214  *
16215  * Returns: A #GIOChannel on success, %NULL on failure.
16216  */
16217
16218
16219 /**
16220  * g_io_channel_read:
16221  * @channel: a #GIOChannel
16222  * @buf: a buffer to read the data into (which should be at least count bytes long)
16223  * @count: the number of bytes to read from the #GIOChannel
16224  * @bytes_read: returns the number of bytes actually read
16225  *
16226  * Reads data from a #GIOChannel.
16227  *
16228  * Returns: %G_IO_ERROR_NONE if the operation was successful.
16229  * Deprecated: 2.2: Use g_io_channel_read_chars() instead.
16230  */
16231
16232
16233 /**
16234  * g_io_channel_read_chars:
16235  * @channel: a #GIOChannel
16236  * @buf: (out caller-allocates) (array length=count) (element-type guint8): a buffer to read data into
16237  * @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.
16238  * @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.
16239  * @error: a location to return an error of type #GConvertError or #GIOChannelError.
16240  *
16241  * Replacement for g_io_channel_read() with the new API.
16242  *
16243  * Returns: the status of the operation.
16244  */
16245
16246
16247 /**
16248  * g_io_channel_read_line:
16249  * @channel: a #GIOChannel
16250  * @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.
16251  * @length: (allow-none) (out): location to store length of the read data, or %NULL
16252  * @terminator_pos: (allow-none) (out): location to store position of line terminator, or %NULL
16253  * @error: A location to return an error of type #GConvertError or #GIOChannelError
16254  *
16255  * Reads a line, including the terminating character(s),
16256  * from a #GIOChannel into a newly-allocated string.
16257  * @str_return will contain allocated memory if the return
16258  * is %G_IO_STATUS_NORMAL.
16259  *
16260  * Returns: the status of the operation.
16261  */
16262
16263
16264 /**
16265  * g_io_channel_read_line_string:
16266  * @channel: a #GIOChannel
16267  * @buffer: a #GString into which the line will be written. If @buffer already contains data, the old data will be overwritten.
16268  * @terminator_pos: (allow-none): location to store position of line terminator, or %NULL
16269  * @error: a location to store an error of type #GConvertError or #GIOChannelError
16270  *
16271  * Reads a line from a #GIOChannel, using a #GString as a buffer.
16272  *
16273  * Returns: the status of the operation.
16274  */
16275
16276
16277 /**
16278  * g_io_channel_read_to_end:
16279  * @channel: a #GIOChannel
16280  * @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.
16281  * @length: (out): location to store length of the data
16282  * @error: location to return an error of type #GConvertError or #GIOChannelError
16283  *
16284  * Reads all the remaining data from the file.
16285  *
16286  * Returns: %G_IO_STATUS_NORMAL on success. This function never returns %G_IO_STATUS_EOF.
16287  */
16288
16289
16290 /**
16291  * g_io_channel_read_unichar:
16292  * @channel: a #GIOChannel
16293  * @thechar: a location to return a character
16294  * @error: a location to return an error of type #GConvertError or #GIOChannelError
16295  *
16296  * Reads a Unicode character from @channel.
16297  * This function cannot be called on a channel with %NULL encoding.
16298  *
16299  * Returns: a #GIOStatus
16300  */
16301
16302
16303 /**
16304  * g_io_channel_ref:
16305  * @channel: a #GIOChannel
16306  *
16307  * Increments the reference count of a #GIOChannel.
16308  *
16309  * Returns: the @channel that was passed in (since 2.6)
16310  */
16311
16312
16313 /**
16314  * g_io_channel_seek:
16315  * @channel: a #GIOChannel
16316  * @offset: an offset, in bytes, which is added to the position specified by @type
16317  * @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)
16318  *
16319  * Sets the current position in the #GIOChannel, similar to the standard
16320  * library function fseek().
16321  *
16322  * Returns: %G_IO_ERROR_NONE if the operation was successful.
16323  * Deprecated: 2.2: Use g_io_channel_seek_position() instead.
16324  */
16325
16326
16327 /**
16328  * g_io_channel_seek_position:
16329  * @channel: a #GIOChannel
16330  * @offset: The offset in bytes from the position specified by @type
16331  * @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.
16332  * @error: A location to return an error of type #GIOChannelError
16333  *
16334  * Replacement for g_io_channel_seek() with the new API.
16335  *
16336  * Returns: the status of the operation.
16337  */
16338
16339
16340 /**
16341  * g_io_channel_set_buffer_size:
16342  * @channel: a #GIOChannel
16343  * @size: the size of the buffer, or 0 to let GLib pick a good size
16344  *
16345  * Sets the buffer size.
16346  */
16347
16348
16349 /**
16350  * g_io_channel_set_buffered:
16351  * @channel: a #GIOChannel
16352  * @buffered: whether to set the channel buffered or unbuffered
16353  *
16354  * The buffering state can only be set if the channel's encoding
16355  * is %NULL. For any other encoding, the channel must be buffered.
16356  *
16357  * A buffered channel can only be set unbuffered if the channel's
16358  * internal buffers have been flushed. Newly created channels or
16359  * channels which have returned %G_IO_STATUS_EOF
16360  * not require such a flush. For write-only channels, a call to
16361  * g_io_channel_flush () is sufficient. For all other channels,
16362  * the buffers may be flushed by a call to g_io_channel_seek_position ().
16363  * This includes the possibility of seeking with seek type %G_SEEK_CUR
16364  * and an offset of zero. Note that this means that socket-based
16365  * channels cannot be set unbuffered once they have had data
16366  * read from them.
16367  *
16368  * On unbuffered channels, it is safe to mix read and write
16369  * calls from the new and old APIs, if this is necessary for
16370  * maintaining old code.
16371  *
16372  * The default state of the channel is buffered.
16373  */
16374
16375
16376 /**
16377  * g_io_channel_set_close_on_unref:
16378  * @channel: a #GIOChannel
16379  * @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.
16380  *
16381  * Setting this flag to %TRUE for a channel you have already closed
16382  * can cause problems.
16383  */
16384
16385
16386 /**
16387  * g_io_channel_set_encoding:
16388  * @channel: a #GIOChannel
16389  * @encoding: (allow-none): the encoding type
16390  * @error: location to store an error of type #GConvertError
16391  *
16392  * Sets the encoding for the input/output of the channel.
16393  * The internal encoding is always UTF-8. The default encoding
16394  * for the external file is UTF-8.
16395  *
16396  * The encoding %NULL is safe to use with binary data.
16397  *
16398  * The encoding can only be set if one of the following conditions
16399  * is true:
16400  * <itemizedlist>
16401  * <listitem><para>
16402  *    The channel was just created, and has not been written to or read
16403  *    from yet.
16404  * </para></listitem>
16405  * <listitem><para>
16406  *    The channel is write-only.
16407  * </para></listitem>
16408  * <listitem><para>
16409  *    The channel is a file, and the file pointer was just
16410  *    repositioned by a call to g_io_channel_seek_position().
16411  *    (This flushes all the internal buffers.)
16412  * </para></listitem>
16413  * <listitem><para>
16414  *    The current encoding is %NULL or UTF-8.
16415  * </para></listitem>
16416  * <listitem><para>
16417  *    One of the (new API) read functions has just returned %G_IO_STATUS_EOF
16418  *    (or, in the case of g_io_channel_read_to_end(), %G_IO_STATUS_NORMAL).
16419  * </para></listitem>
16420  * <listitem><para>
16421  *    One of the functions g_io_channel_read_chars() or
16422  *    g_io_channel_read_unichar() has returned %G_IO_STATUS_AGAIN or
16423  *    %G_IO_STATUS_ERROR. This may be useful in the case of
16424  *    %G_CONVERT_ERROR_ILLEGAL_SEQUENCE.
16425  *    Returning one of these statuses from g_io_channel_read_line(),
16426  *    g_io_channel_read_line_string(), or g_io_channel_read_to_end()
16427  *    does <emphasis>not</emphasis> guarantee that the encoding can
16428  *    be changed.
16429  * </para></listitem>
16430  * </itemizedlist>
16431  * Channels which do not meet one of the above conditions cannot call
16432  * g_io_channel_seek_position() with an offset of %G_SEEK_CUR, and, if
16433  * they are "seekable", cannot call g_io_channel_write_chars() after
16434  * calling one of the API "read" functions.
16435  *
16436  * Returns: %G_IO_STATUS_NORMAL if the encoding was successfully set.
16437  */
16438
16439
16440 /**
16441  * g_io_channel_set_flags:
16442  * @channel: a #GIOChannel
16443  * @flags: the flags to set on the IO channel
16444  * @error: A location to return an error of type #GIOChannelError
16445  *
16446  * Sets the (writeable) flags in @channel to (@flags & %G_IO_FLAG_SET_MASK).
16447  *
16448  * Returns: the status of the operation.
16449  */
16450
16451
16452 /**
16453  * g_io_channel_set_line_term:
16454  * @channel: a #GIOChannel
16455  * @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.
16456  * @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.
16457  *
16458  * This sets the string that #GIOChannel uses to determine
16459  * where in the file a line break occurs.
16460  */
16461
16462
16463 /**
16464  * g_io_channel_shutdown:
16465  * @channel: a #GIOChannel
16466  * @flush: if %TRUE, flush pending
16467  * @err: location to store a #GIOChannelError
16468  *
16469  * Close an IO channel. Any pending data to be written will be
16470  * flushed if @flush is %TRUE. The channel will not be freed until the
16471  * last reference is dropped using g_io_channel_unref().
16472  *
16473  * Returns: the status of the operation.
16474  */
16475
16476
16477 /**
16478  * g_io_channel_unix_get_fd:
16479  * @channel: a #GIOChannel, created with g_io_channel_unix_new().
16480  *
16481  * Returns the file descriptor of the #GIOChannel.
16482  *
16483  * On Windows this function returns the file descriptor or socket of
16484  * the #GIOChannel.
16485  *
16486  * Returns: the file descriptor of the #GIOChannel.
16487  */
16488
16489
16490 /**
16491  * g_io_channel_unix_new:
16492  * @fd: a file descriptor.
16493  *
16494  * Creates a new #GIOChannel given a file descriptor. On UNIX systems
16495  * this works for plain files, pipes, and sockets.
16496  *
16497  * The returned #GIOChannel has a reference count of 1.
16498  *
16499  * The default encoding for #GIOChannel is UTF-8. If your application
16500  * is reading output from a command using via pipe, you may need to set
16501  * the encoding to the encoding of the current locale (see
16502  * g_get_charset()) with the g_io_channel_set_encoding() function.
16503  *
16504  * If you want to read raw binary data without interpretation, then
16505  * call the g_io_channel_set_encoding() function with %NULL for the
16506  * encoding argument.
16507  *
16508  * This function is available in GLib on Windows, too, but you should
16509  * avoid using it on Windows. The domain of file descriptors and
16510  * sockets overlap. There is no way for GLib to know which one you mean
16511  * in case the argument you pass to this function happens to be both a
16512  * valid file descriptor and socket. If that happens a warning is
16513  * issued, and GLib assumes that it is the file descriptor you mean.
16514  *
16515  * Returns: a new #GIOChannel.
16516  */
16517
16518
16519 /**
16520  * g_io_channel_unref:
16521  * @channel: a #GIOChannel
16522  *
16523  * Decrements the reference count of a #GIOChannel.
16524  */
16525
16526
16527 /**
16528  * g_io_channel_win32_new_fd:
16529  * @fd: a C library file descriptor.
16530  *
16531  * Creates a new #GIOChannel given a file descriptor on Windows. This
16532  * works for file descriptors from the C runtime.
16533  *
16534  * This function works for file descriptors as returned by the open(),
16535  * creat(), pipe() and fileno() calls in the Microsoft C runtime. In
16536  * order to meaningfully use this function your code should use the
16537  * same C runtime as GLib uses, which is msvcrt.dll. Note that in
16538  * current Microsoft compilers it is near impossible to convince it to
16539  * build code that would use msvcrt.dll. The last Microsoft compiler
16540  * version that supported using msvcrt.dll as the C runtime was version
16541  * 6. The GNU compiler and toolchain for Windows, also known as Mingw,
16542  * fully supports msvcrt.dll.
16543  *
16544  * If you have created a #GIOChannel for a file descriptor and started
16545  * watching (polling) it, you shouldn't call read() on the file
16546  * descriptor. This is because adding polling for a file descriptor is
16547  * implemented in GLib on Windows by starting a thread that sits
16548  * blocked in a read() from the file descriptor most of the time. All
16549  * reads from the file descriptor should be done by this internal GLib
16550  * thread. Your code should call only g_io_channel_read().
16551  *
16552  * This function is available only in GLib on Windows.
16553  *
16554  * Returns: a new #GIOChannel.
16555  */
16556
16557
16558 /**
16559  * g_io_channel_win32_new_messages:
16560  * @hwnd: a window handle.
16561  *
16562  * Creates a new #GIOChannel given a window handle on Windows.
16563  *
16564  * This function creates a #GIOChannel that can be used to poll for
16565  * Windows messages for the window in question.
16566  *
16567  * Returns: a new #GIOChannel.
16568  */
16569
16570
16571 /**
16572  * g_io_channel_win32_new_socket:
16573  * @socket: a Winsock socket
16574  *
16575  * Creates a new #GIOChannel given a socket on Windows.
16576  *
16577  * This function works for sockets created by Winsock. It's available
16578  * only in GLib on Windows.
16579  *
16580  * Polling a #GSource created to watch a channel for a socket puts the
16581  * socket in non-blocking mode. This is a side-effect of the
16582  * implementation and unavoidable.
16583  *
16584  * Returns: a new #GIOChannel
16585  */
16586
16587
16588 /**
16589  * g_io_channel_write:
16590  * @channel: a #GIOChannel
16591  * @buf: the buffer containing the data to write
16592  * @count: the number of bytes to write
16593  * @bytes_written: the number of bytes actually written
16594  *
16595  * Writes data to a #GIOChannel.
16596  *
16597  * Returns: %G_IO_ERROR_NONE if the operation was successful.
16598  * Deprecated: 2.2: Use g_io_channel_write_chars() instead.
16599  */
16600
16601
16602 /**
16603  * g_io_channel_write_chars:
16604  * @channel: a #GIOChannel
16605  * @buf: (array) (element-type guint8): a buffer to write data from
16606  * @count: the size of the buffer. If -1, the buffer is taken to be a nul-terminated string.
16607  * @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.
16608  * @error: a location to return an error of type #GConvertError or #GIOChannelError
16609  *
16610  * Replacement for g_io_channel_write() with the new API.
16611  *
16612  * On seekable channels with encodings other than %NULL or UTF-8, generic
16613  * mixing of reading and writing is not allowed. A call to g_io_channel_write_chars ()
16614  * may only be made on a channel from which data has been read in the
16615  * cases described in the documentation for g_io_channel_set_encoding ().
16616  *
16617  * Returns: the status of the operation.
16618  */
16619
16620
16621 /**
16622  * g_io_channel_write_unichar:
16623  * @channel: a #GIOChannel
16624  * @thechar: a character
16625  * @error: location to return an error of type #GConvertError or #GIOChannelError
16626  *
16627  * Writes a Unicode character to @channel.
16628  * This function cannot be called on a channel with %NULL encoding.
16629  *
16630  * Returns: a #GIOStatus
16631  */
16632
16633
16634 /**
16635  * g_io_create_watch:
16636  * @channel: a #GIOChannel to watch
16637  * @condition: conditions to watch for
16638  *
16639  * Creates a #GSource that's dispatched when @condition is met for the
16640  * given @channel. For example, if condition is #G_IO_IN, the source will
16641  * be dispatched when there's data available for reading.
16642  *
16643  * g_io_add_watch() is a simpler interface to this same functionality, for
16644  * the case where you want to add the source to the default main loop context
16645  * at the default priority.
16646  *
16647  * On Windows, polling a #GSource created to watch a channel for a socket
16648  * puts the socket in non-blocking mode. This is a side-effect of the
16649  * implementation and unavoidable.
16650  *
16651  * Returns: a new #GSource
16652  */
16653
16654
16655 /**
16656  * g_key_file_free: (skip)
16657  * @key_file: a #GKeyFile
16658  *
16659  * Clears all keys and groups from @key_file, and decreases the
16660  * reference count by 1. If the reference count reaches zero,
16661  * frees the key file and all its allocated memory.
16662  *
16663  * Since: 2.6
16664  */
16665
16666
16667 /**
16668  * g_key_file_get_boolean:
16669  * @key_file: a #GKeyFile
16670  * @group_name: a group name
16671  * @key: a key
16672  * @error: return location for a #GError
16673  *
16674  * Returns the value associated with @key under @group_name as a
16675  * boolean.
16676  *
16677  * If @key cannot be found then %FALSE is returned and @error is set
16678  * to #G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the value
16679  * associated with @key cannot be interpreted as a boolean then %FALSE
16680  * is returned and @error is set to #G_KEY_FILE_ERROR_INVALID_VALUE.
16681  *
16682  * Returns: the value associated with the key as a boolean, or %FALSE if the key was not found or could not be parsed.
16683  * Since: 2.6
16684  */
16685
16686
16687 /**
16688  * g_key_file_get_boolean_list:
16689  * @key_file: a #GKeyFile
16690  * @group_name: a group name
16691  * @key: a key
16692  * @length: (out): the number of booleans returned
16693  * @error: return location for a #GError
16694  *
16695  * Returns the values associated with @key under @group_name as
16696  * booleans.
16697  *
16698  * If @key cannot be found then %NULL is returned and @error is set to
16699  * #G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the values associated
16700  * with @key cannot be interpreted as booleans then %NULL is returned
16701  * and @error is set to #G_KEY_FILE_ERROR_INVALID_VALUE.
16702  *
16703  * 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.
16704  * Since: 2.6
16705  */
16706
16707
16708 /**
16709  * g_key_file_get_comment:
16710  * @key_file: a #GKeyFile
16711  * @group_name: (allow-none): a group name, or %NULL
16712  * @key: a key
16713  * @error: return location for a #GError
16714  *
16715  * Retrieves a comment above @key from @group_name.
16716  * If @key is %NULL then @comment will be read from above
16717  * @group_name. If both @key and @group_name are %NULL, then
16718  * @comment will be read from above the first group in the file.
16719  *
16720  * Returns: a comment that should be freed with g_free()
16721  * Since: 2.6
16722  */
16723
16724
16725 /**
16726  * g_key_file_get_double:
16727  * @key_file: a #GKeyFile
16728  * @group_name: a group name
16729  * @key: a key
16730  * @error: return location for a #GError
16731  *
16732  * Returns the value associated with @key under @group_name as a
16733  * double. If @group_name is %NULL, the start_group is used.
16734  *
16735  * If @key cannot be found then 0.0 is returned and @error is set to
16736  * #G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the value associated
16737  * with @key cannot be interpreted as a double then 0.0 is returned
16738  * and @error is set to #G_KEY_FILE_ERROR_INVALID_VALUE.
16739  *
16740  * Returns: the value associated with the key as a double, or 0.0 if the key was not found or could not be parsed.
16741  * Since: 2.12
16742  */
16743
16744
16745 /**
16746  * g_key_file_get_double_list:
16747  * @key_file: a #GKeyFile
16748  * @group_name: a group name
16749  * @key: a key
16750  * @length: (out): the number of doubles returned
16751  * @error: return location for a #GError
16752  *
16753  * Returns the values associated with @key under @group_name as
16754  * doubles.
16755  *
16756  * If @key cannot be found then %NULL is returned and @error is set to
16757  * #G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the values associated
16758  * with @key cannot be interpreted as doubles then %NULL is returned
16759  * and @error is set to #G_KEY_FILE_ERROR_INVALID_VALUE.
16760  *
16761  * 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.
16762  * Since: 2.12
16763  */
16764
16765
16766 /**
16767  * g_key_file_get_groups:
16768  * @key_file: a #GKeyFile
16769  * @length: (out) (allow-none): return location for the number of returned groups, or %NULL
16770  *
16771  * Returns all groups in the key file loaded with @key_file.
16772  * The array of returned groups will be %NULL-terminated, so
16773  * @length may optionally be %NULL.
16774  *
16775  * Returns: (array zero-terminated=1) (transfer full): a newly-allocated %NULL-terminated array of strings. Use g_strfreev() to free it.
16776  * Since: 2.6
16777  */
16778
16779
16780 /**
16781  * g_key_file_get_int64:
16782  * @key_file: a non-%NULL #GKeyFile
16783  * @group_name: a non-%NULL group name
16784  * @key: a non-%NULL key
16785  * @error: return location for a #GError
16786  *
16787  * Returns the value associated with @key under @group_name as a signed
16788  * 64-bit integer. This is similar to g_key_file_get_integer() but can return
16789  * 64-bit results without truncation.
16790  *
16791  * 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.
16792  * Since: 2.26
16793  */
16794
16795
16796 /**
16797  * g_key_file_get_integer:
16798  * @key_file: a #GKeyFile
16799  * @group_name: a group name
16800  * @key: a key
16801  * @error: return location for a #GError
16802  *
16803  * Returns the value associated with @key under @group_name as an
16804  * integer.
16805  *
16806  * If @key cannot be found then 0 is returned and @error is set to
16807  * #G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the value associated
16808  * with @key cannot be interpreted as an integer then 0 is returned
16809  * and @error is set to #G_KEY_FILE_ERROR_INVALID_VALUE.
16810  *
16811  * Returns: the value associated with the key as an integer, or 0 if the key was not found or could not be parsed.
16812  * Since: 2.6
16813  */
16814
16815
16816 /**
16817  * g_key_file_get_integer_list:
16818  * @key_file: a #GKeyFile
16819  * @group_name: a group name
16820  * @key: a key
16821  * @length: (out): the number of integers returned
16822  * @error: return location for a #GError
16823  *
16824  * Returns the values associated with @key under @group_name as
16825  * integers.
16826  *
16827  * If @key cannot be found then %NULL is returned and @error is set to
16828  * #G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the values associated
16829  * with @key cannot be interpreted as integers then %NULL is returned
16830  * and @error is set to #G_KEY_FILE_ERROR_INVALID_VALUE.
16831  *
16832  * 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.
16833  * Since: 2.6
16834  */
16835
16836
16837 /**
16838  * g_key_file_get_keys:
16839  * @key_file: a #GKeyFile
16840  * @group_name: a group name
16841  * @length: (out) (allow-none): return location for the number of keys returned, or %NULL
16842  * @error: return location for a #GError, or %NULL
16843  *
16844  * Returns all keys for the group name @group_name.  The array of
16845  * returned keys will be %NULL-terminated, so @length may
16846  * optionally be %NULL. In the event that the @group_name cannot
16847  * be found, %NULL is returned and @error is set to
16848  * #G_KEY_FILE_ERROR_GROUP_NOT_FOUND.
16849  *
16850  * Returns: (array zero-terminated=1) (transfer full): a newly-allocated %NULL-terminated array of strings. Use g_strfreev() to free it.
16851  * Since: 2.6
16852  */
16853
16854
16855 /**
16856  * g_key_file_get_locale_string:
16857  * @key_file: a #GKeyFile
16858  * @group_name: a group name
16859  * @key: a key
16860  * @locale: (allow-none): a locale identifier or %NULL
16861  * @error: return location for a #GError, or %NULL
16862  *
16863  * Returns the value associated with @key under @group_name
16864  * translated in the given @locale if available.  If @locale is
16865  * %NULL then the current locale is assumed.
16866  *
16867  * If @key cannot be found then %NULL is returned and @error is set
16868  * to #G_KEY_FILE_ERROR_KEY_NOT_FOUND. If the value associated
16869  * with @key cannot be interpreted or no suitable translation can
16870  * be found then the untranslated value is returned.
16871  *
16872  * Returns: a newly allocated string or %NULL if the specified key cannot be found.
16873  * Since: 2.6
16874  */
16875
16876
16877 /**
16878  * g_key_file_get_locale_string_list:
16879  * @key_file: a #GKeyFile
16880  * @group_name: a group name
16881  * @key: a key
16882  * @locale: (allow-none): a locale identifier or %NULL
16883  * @length: (out) (allow-none): return location for the number of returned strings or %NULL
16884  * @error: return location for a #GError or %NULL
16885  *
16886  * Returns the values associated with @key under @group_name
16887  * translated in the given @locale if available.  If @locale is
16888  * %NULL then the current locale is assumed.
16889  *
16890  * If @key cannot be found then %NULL is returned and @error is set
16891  * to #G_KEY_FILE_ERROR_KEY_NOT_FOUND. If the values associated
16892  * with @key cannot be interpreted or no suitable translations
16893  * can be found then the untranslated values are returned. The
16894  * returned array is %NULL-terminated, so @length may optionally
16895  * be %NULL.
16896  *
16897  * 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().
16898  * Since: 2.6
16899  */
16900
16901
16902 /**
16903  * g_key_file_get_start_group:
16904  * @key_file: a #GKeyFile
16905  *
16906  * Returns the name of the start group of the file.
16907  *
16908  * Returns: The start group of the key file.
16909  * Since: 2.6
16910  */
16911
16912
16913 /**
16914  * g_key_file_get_string:
16915  * @key_file: a #GKeyFile
16916  * @group_name: a group name
16917  * @key: a key
16918  * @error: return location for a #GError, or %NULL
16919  *
16920  * Returns the string value associated with @key under @group_name.
16921  * Unlike g_key_file_get_value(), this function handles escape sequences
16922  * like \s.
16923  *
16924  * In the event the key cannot be found, %NULL is returned and
16925  * @error is set to #G_KEY_FILE_ERROR_KEY_NOT_FOUND.  In the
16926  * event that the @group_name cannot be found, %NULL is returned
16927  * and @error is set to #G_KEY_FILE_ERROR_GROUP_NOT_FOUND.
16928  *
16929  * Returns: a newly allocated string or %NULL if the specified key cannot be found.
16930  * Since: 2.6
16931  */
16932
16933
16934 /**
16935  * g_key_file_get_string_list:
16936  * @key_file: a #GKeyFile
16937  * @group_name: a group name
16938  * @key: a key
16939  * @length: (out) (allow-none): return location for the number of returned strings, or %NULL
16940  * @error: return location for a #GError, or %NULL
16941  *
16942  * Returns the values associated with @key under @group_name.
16943  *
16944  * In the event the key cannot be found, %NULL is returned and
16945  * @error is set to #G_KEY_FILE_ERROR_KEY_NOT_FOUND.  In the
16946  * event that the @group_name cannot be found, %NULL is returned
16947  * and @error is set to #G_KEY_FILE_ERROR_GROUP_NOT_FOUND.
16948  *
16949  * 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().
16950  * Since: 2.6
16951  */
16952
16953
16954 /**
16955  * g_key_file_get_uint64:
16956  * @key_file: a non-%NULL #GKeyFile
16957  * @group_name: a non-%NULL group name
16958  * @key: a non-%NULL key
16959  * @error: return location for a #GError
16960  *
16961  * Returns the value associated with @key under @group_name as an unsigned
16962  * 64-bit integer. This is similar to g_key_file_get_integer() but can return
16963  * large positive results without truncation.
16964  *
16965  * 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.
16966  * Since: 2.26
16967  */
16968
16969
16970 /**
16971  * g_key_file_get_value:
16972  * @key_file: a #GKeyFile
16973  * @group_name: a group name
16974  * @key: a key
16975  * @error: return location for a #GError, or %NULL
16976  *
16977  * Returns the raw value associated with @key under @group_name.
16978  * Use g_key_file_get_string() to retrieve an unescaped UTF-8 string.
16979  *
16980  * In the event the key cannot be found, %NULL is returned and
16981  * @error is set to #G_KEY_FILE_ERROR_KEY_NOT_FOUND.  In the
16982  * event that the @group_name cannot be found, %NULL is returned
16983  * and @error is set to #G_KEY_FILE_ERROR_GROUP_NOT_FOUND.
16984  *
16985  * Returns: a newly allocated string or %NULL if the specified key cannot be found.
16986  * Since: 2.6
16987  */
16988
16989
16990 /**
16991  * g_key_file_has_group:
16992  * @key_file: a #GKeyFile
16993  * @group_name: a group name
16994  *
16995  * Looks whether the key file has the group @group_name.
16996  *
16997  * Returns: %TRUE if @group_name is a part of @key_file, %FALSE otherwise.
16998  * Since: 2.6
16999  */
17000
17001
17002 /**
17003  * g_key_file_has_key: (skip)
17004  * @key_file: a #GKeyFile
17005  * @group_name: a group name
17006  * @key: a key name
17007  * @error: return location for a #GError
17008  *
17009  * Looks whether the key file has the key @key in the group
17010  * @group_name.
17011  *
17012  * <note>This function does not follow the rules for #GError strictly;
17013  * the return value both carries meaning and signals an error.  To use
17014  * this function, you must pass a #GError pointer in @error, and check
17015  * whether it is not %NULL to see if an error occurred.</note>
17016  *
17017  * Language bindings should use g_key_file_get_value() to test whether
17018  * or not a key exists.
17019  *
17020  * Returns: %TRUE if @key is a part of @group_name, %FALSE otherwise.
17021  * Since: 2.6
17022  */
17023
17024
17025 /**
17026  * g_key_file_load_from_data:
17027  * @key_file: an empty #GKeyFile struct
17028  * @data: key file loaded in memory
17029  * @length: the length of @data in bytes (or -1 if data is nul-terminated)
17030  * @flags: flags from #GKeyFileFlags
17031  * @error: return location for a #GError, or %NULL
17032  *
17033  * Loads a key file from memory into an empty #GKeyFile structure.
17034  * If the object cannot be created then %error is set to a #GKeyFileError.
17035  *
17036  * Returns: %TRUE if a key file could be loaded, %FALSE otherwise
17037  * Since: 2.6
17038  */
17039
17040
17041 /**
17042  * g_key_file_load_from_data_dirs:
17043  * @key_file: an empty #GKeyFile struct
17044  * @file: (type filename): a relative path to a filename to open and parse
17045  * @full_path: (out) (type filename) (allow-none): return location for a string containing the full path of the file, or %NULL
17046  * @flags: flags from #GKeyFileFlags
17047  * @error: return location for a #GError, or %NULL
17048  *
17049  * This function looks for a key file named @file in the paths
17050  * returned from g_get_user_data_dir() and g_get_system_data_dirs(),
17051  * loads the file into @key_file and returns the file's full path in
17052  * @full_path.  If the file could not be loaded then an %error is
17053  * set to either a #GFileError or #GKeyFileError.
17054  *
17055  * Returns: %TRUE if a key file could be loaded, %FALSE othewise
17056  * Since: 2.6
17057  */
17058
17059
17060 /**
17061  * g_key_file_load_from_dirs:
17062  * @key_file: an empty #GKeyFile struct
17063  * @file: (type filename): a relative path to a filename to open and parse
17064  * @search_dirs: (array zero-terminated=1) (element-type filename): %NULL-terminated array of directories to search
17065  * @full_path: (out) (type filename) (allow-none): return location for a string containing the full path of the file, or %NULL
17066  * @flags: flags from #GKeyFileFlags
17067  * @error: return location for a #GError, or %NULL
17068  *
17069  * This function looks for a key file named @file in the paths
17070  * specified in @search_dirs, loads the file into @key_file and
17071  * returns the file's full path in @full_path.  If the file could not
17072  * be loaded then an %error is set to either a #GFileError or
17073  * #GKeyFileError.
17074  *
17075  * Returns: %TRUE if a key file could be loaded, %FALSE otherwise
17076  * Since: 2.14
17077  */
17078
17079
17080 /**
17081  * g_key_file_load_from_file:
17082  * @key_file: an empty #GKeyFile struct
17083  * @file: (type filename): the path of a filename to load, in the GLib filename encoding
17084  * @flags: flags from #GKeyFileFlags
17085  * @error: return location for a #GError, or %NULL
17086  *
17087  * Loads a key file into an empty #GKeyFile structure.
17088  * If the file could not be loaded then @error is set to
17089  * either a #GFileError or #GKeyFileError.
17090  *
17091  * Returns: %TRUE if a key file could be loaded, %FALSE otherwise
17092  * Since: 2.6
17093  */
17094
17095
17096 /**
17097  * g_key_file_new:
17098  *
17099  * Creates a new empty #GKeyFile object. Use
17100  * g_key_file_load_from_file(), g_key_file_load_from_data(),
17101  * g_key_file_load_from_dirs() or g_key_file_load_from_data_dirs() to
17102  * read an existing key file.
17103  *
17104  * Returns: (transfer full): an empty #GKeyFile.
17105  * Since: 2.6
17106  */
17107
17108
17109 /**
17110  * g_key_file_ref: (skip)
17111  * @key_file: a #GKeyFile
17112  *
17113  * Increases the reference count of @key_file.
17114  *
17115  * Returns: the same @key_file.
17116  * Since: 2.32
17117  */
17118
17119
17120 /**
17121  * g_key_file_remove_comment:
17122  * @key_file: a #GKeyFile
17123  * @group_name: (allow-none): a group name, or %NULL
17124  * @key: (allow-none): a key
17125  * @error: return location for a #GError
17126  *
17127  * Removes a comment above @key from @group_name.
17128  * If @key is %NULL then @comment will be removed above @group_name.
17129  * If both @key and @group_name are %NULL, then @comment will
17130  * be removed above the first group in the file.
17131  *
17132  * Returns: %TRUE if the comment was removed, %FALSE otherwise
17133  * Since: 2.6
17134  */
17135
17136
17137 /**
17138  * g_key_file_remove_group:
17139  * @key_file: a #GKeyFile
17140  * @group_name: a group name
17141  * @error: return location for a #GError or %NULL
17142  *
17143  * Removes the specified group, @group_name,
17144  * from the key file.
17145  *
17146  * Returns: %TRUE if the group was removed, %FALSE otherwise
17147  * Since: 2.6
17148  */
17149
17150
17151 /**
17152  * g_key_file_remove_key:
17153  * @key_file: a #GKeyFile
17154  * @group_name: a group name
17155  * @key: a key name to remove
17156  * @error: return location for a #GError or %NULL
17157  *
17158  * Removes @key in @group_name from the key file.
17159  *
17160  * Returns: %TRUE if the key was removed, %FALSE otherwise
17161  * Since: 2.6
17162  */
17163
17164
17165 /**
17166  * g_key_file_set_boolean:
17167  * @key_file: a #GKeyFile
17168  * @group_name: a group name
17169  * @key: a key
17170  * @value: %TRUE or %FALSE
17171  *
17172  * Associates a new boolean value with @key under @group_name.
17173  * If @key cannot be found then it is created.
17174  *
17175  * Since: 2.6
17176  */
17177
17178
17179 /**
17180  * g_key_file_set_boolean_list:
17181  * @key_file: a #GKeyFile
17182  * @group_name: a group name
17183  * @key: a key
17184  * @list: (array length=length): an array of boolean values
17185  * @length: length of @list
17186  *
17187  * Associates a list of boolean values with @key under @group_name.
17188  * If @key cannot be found then it is created.
17189  * If @group_name is %NULL, the start_group is used.
17190  *
17191  * Since: 2.6
17192  */
17193
17194
17195 /**
17196  * g_key_file_set_comment:
17197  * @key_file: a #GKeyFile
17198  * @group_name: (allow-none): a group name, or %NULL
17199  * @key: (allow-none): a key
17200  * @comment: a comment
17201  * @error: return location for a #GError
17202  *
17203  * Places a comment above @key from @group_name.
17204  * If @key is %NULL then @comment will be written above @group_name.
17205  * If both @key and @group_name  are %NULL, then @comment will be
17206  * written above the first group in the file.
17207  *
17208  * Returns: %TRUE if the comment was written, %FALSE otherwise
17209  * Since: 2.6
17210  */
17211
17212
17213 /**
17214  * g_key_file_set_double:
17215  * @key_file: a #GKeyFile
17216  * @group_name: a group name
17217  * @key: a key
17218  * @value: an double value
17219  *
17220  * Associates a new double value with @key under @group_name.
17221  * If @key cannot be found then it is created.
17222  *
17223  * Since: 2.12
17224  */
17225
17226
17227 /**
17228  * g_key_file_set_double_list:
17229  * @key_file: a #GKeyFile
17230  * @group_name: a group name
17231  * @key: a key
17232  * @list: (array length=length): an array of double values
17233  * @length: number of double values in @list
17234  *
17235  * Associates a list of double values with @key under
17236  * @group_name.  If @key cannot be found then it is created.
17237  *
17238  * Since: 2.12
17239  */
17240
17241
17242 /**
17243  * g_key_file_set_int64:
17244  * @key_file: a #GKeyFile
17245  * @group_name: a group name
17246  * @key: a key
17247  * @value: an integer value
17248  *
17249  * Associates a new integer value with @key under @group_name.
17250  * If @key cannot be found then it is created.
17251  *
17252  * Since: 2.26
17253  */
17254
17255
17256 /**
17257  * g_key_file_set_integer:
17258  * @key_file: a #GKeyFile
17259  * @group_name: a group name
17260  * @key: a key
17261  * @value: an integer value
17262  *
17263  * Associates a new integer value with @key under @group_name.
17264  * If @key cannot be found then it is created.
17265  *
17266  * Since: 2.6
17267  */
17268
17269
17270 /**
17271  * g_key_file_set_integer_list:
17272  * @key_file: a #GKeyFile
17273  * @group_name: a group name
17274  * @key: a key
17275  * @list: (array length=length): an array of integer values
17276  * @length: number of integer values in @list
17277  *
17278  * Associates a list of integer values with @key under @group_name.
17279  * If @key cannot be found then it is created.
17280  *
17281  * Since: 2.6
17282  */
17283
17284
17285 /**
17286  * g_key_file_set_list_separator:
17287  * @key_file: a #GKeyFile
17288  * @separator: the separator
17289  *
17290  * Sets the character which is used to separate
17291  * values in lists. Typically ';' or ',' are used
17292  * as separators. The default list separator is ';'.
17293  *
17294  * Since: 2.6
17295  */
17296
17297
17298 /**
17299  * g_key_file_set_locale_string:
17300  * @key_file: a #GKeyFile
17301  * @group_name: a group name
17302  * @key: a key
17303  * @locale: a locale identifier
17304  * @string: a string
17305  *
17306  * Associates a string value for @key and @locale under @group_name.
17307  * If the translation for @key cannot be found then it is created.
17308  *
17309  * Since: 2.6
17310  */
17311
17312
17313 /**
17314  * g_key_file_set_locale_string_list:
17315  * @key_file: a #GKeyFile
17316  * @group_name: a group name
17317  * @key: a key
17318  * @locale: a locale identifier
17319  * @list: (array zero-terminated=1 length=length): a %NULL-terminated array of locale string values
17320  * @length: the length of @list
17321  *
17322  * Associates a list of string values for @key and @locale under
17323  * @group_name.  If the translation for @key cannot be found then
17324  * it is created.
17325  *
17326  * Since: 2.6
17327  */
17328
17329
17330 /**
17331  * g_key_file_set_string:
17332  * @key_file: a #GKeyFile
17333  * @group_name: a group name
17334  * @key: a key
17335  * @string: a string
17336  *
17337  * Associates a new string value with @key under @group_name.
17338  * If @key cannot be found then it is created.
17339  * If @group_name cannot be found then it is created.
17340  * Unlike g_key_file_set_value(), this function handles characters
17341  * that need escaping, such as newlines.
17342  *
17343  * Since: 2.6
17344  */
17345
17346
17347 /**
17348  * g_key_file_set_string_list:
17349  * @key_file: a #GKeyFile
17350  * @group_name: a group name
17351  * @key: a key
17352  * @list: (array zero-terminated=1 length=length) (element-type utf8): an array of string values
17353  * @length: number of string values in @list
17354  *
17355  * Associates a list of string values for @key under @group_name.
17356  * If @key cannot be found then it is created.
17357  * If @group_name cannot be found then it is created.
17358  *
17359  * Since: 2.6
17360  */
17361
17362
17363 /**
17364  * g_key_file_set_uint64:
17365  * @key_file: a #GKeyFile
17366  * @group_name: a group name
17367  * @key: a key
17368  * @value: an integer value
17369  *
17370  * Associates a new integer value with @key under @group_name.
17371  * If @key cannot be found then it is created.
17372  *
17373  * Since: 2.26
17374  */
17375
17376
17377 /**
17378  * g_key_file_set_value:
17379  * @key_file: a #GKeyFile
17380  * @group_name: a group name
17381  * @key: a key
17382  * @value: a string
17383  *
17384  * Associates a new value with @key under @group_name.
17385  *
17386  * If @key cannot be found then it is created. If @group_name cannot
17387  * be found then it is created. To set an UTF-8 string which may contain
17388  * characters that need escaping (such as newlines or spaces), use
17389  * g_key_file_set_string().
17390  *
17391  * Since: 2.6
17392  */
17393
17394
17395 /**
17396  * g_key_file_to_data:
17397  * @key_file: a #GKeyFile
17398  * @length: (out) (allow-none): return location for the length of the returned string, or %NULL
17399  * @error: return location for a #GError, or %NULL
17400  *
17401  * This function outputs @key_file as a string.
17402  *
17403  * Note that this function never reports an error,
17404  * so it is safe to pass %NULL as @error.
17405  *
17406  * Returns: a newly allocated string holding the contents of the #GKeyFile
17407  * Since: 2.6
17408  */
17409
17410
17411 /**
17412  * g_key_file_unref:
17413  * @key_file: a #GKeyFile
17414  *
17415  * Decreases the reference count of @key_file by 1. If the reference count
17416  * reaches zero, frees the key file and all its allocated memory.
17417  *
17418  * Since: 2.32
17419  */
17420
17421
17422 /**
17423  * g_list_alloc:
17424  *
17425  * Allocates space for one #GList element. It is called by
17426  * g_list_append(), g_list_prepend(), g_list_insert() and
17427  * g_list_insert_sorted() and so is rarely used on its own.
17428  *
17429  * Returns: a pointer to the newly-allocated #GList element.
17430  */
17431
17432
17433 /**
17434  * g_list_append:
17435  * @list: a pointer to a #GList
17436  * @data: the data for the new element
17437  *
17438  * Adds a new element on to the end of the list.
17439  *
17440  * <note><para>
17441  * The return value is the new start of the list, which
17442  * may have changed, so make sure you store the new value.
17443  * </para></note>
17444  *
17445  * <note><para>
17446  * Note that g_list_append() has to traverse the entire list
17447  * to find the end, which is inefficient when adding multiple
17448  * elements. A common idiom to avoid the inefficiency is to prepend
17449  * the elements and reverse the list when all elements have been added.
17450  * </para></note>
17451  *
17452  * |[
17453  * /&ast; Notice that these are initialized to the empty list. &ast;/
17454  * GList *list = NULL, *number_list = NULL;
17455  *
17456  * /&ast; This is a list of strings. &ast;/
17457  * list = g_list_append (list, "first");
17458  * list = g_list_append (list, "second");
17459  *
17460  * /&ast; This is a list of integers. &ast;/
17461  * number_list = g_list_append (number_list, GINT_TO_POINTER (27));
17462  * number_list = g_list_append (number_list, GINT_TO_POINTER (14));
17463  * ]|
17464  *
17465  * Returns: the new start of the #GList
17466  */
17467
17468
17469 /**
17470  * g_list_concat:
17471  * @list1: a #GList
17472  * @list2: the #GList to add to the end of the first #GList
17473  *
17474  * Adds the second #GList onto the end of the first #GList.
17475  * Note that the elements of the second #GList are not copied.
17476  * They are used directly.
17477  *
17478  * Returns: the start of the new #GList
17479  */
17480
17481
17482 /**
17483  * g_list_copy:
17484  * @list: a #GList
17485  *
17486  * Copies a #GList.
17487  *
17488  * <note><para>
17489  * Note that this is a "shallow" copy. If the list elements
17490  * consist of pointers to data, the pointers are copied but
17491  * the actual data is not. See g_list_copy_deep() if you need
17492  * to copy the data as well.
17493  * </para></note>
17494  *
17495  * Returns: a copy of @list
17496  */
17497
17498
17499 /**
17500  * g_list_copy_deep:
17501  * @list: a #GList
17502  * @func: a copy function used to copy every element in the list
17503  * @user_data: user data passed to the copy function @func, or #NULL
17504  *
17505  * Makes a full (deep) copy of a #GList.
17506  *
17507  * In contrast with g_list_copy(), this function uses @func to make a copy of
17508  * each list element, in addition to copying the list container itself.
17509  *
17510  * @func, as a #GCopyFunc, takes two arguments, the data to be copied and a user
17511  * pointer. It's safe to pass #NULL as user_data, if the copy function takes only
17512  * one argument.
17513  *
17514  * For instance, if @list holds a list of GObjects, you can do:
17515  * |[
17516  * another_list = g_list_copy_deep (list, (GCopyFunc) g_object_ref, NULL);
17517  * ]|
17518  *
17519  * And, to entirely free the new list, you could do:
17520  * |[
17521  * g_list_free_full (another_list, g_object_unref);
17522  * ]|
17523  *
17524  * Returns: a full copy of @list, use #g_list_free_full to free it
17525  * Since: 2.34
17526  */
17527
17528
17529 /**
17530  * g_list_delete_link:
17531  * @list: a #GList
17532  * @link_: node to delete from @list
17533  *
17534  * Removes the node link_ from the list and frees it.
17535  * Compare this to g_list_remove_link() which removes the node
17536  * without freeing it.
17537  *
17538  * Returns: the new head of @list
17539  */
17540
17541
17542 /**
17543  * g_list_find:
17544  * @list: a #GList
17545  * @data: the element data to find
17546  *
17547  * Finds the element in a #GList which
17548  * contains the given data.
17549  *
17550  * Returns: the found #GList element, or %NULL if it is not found
17551  */
17552
17553
17554 /**
17555  * g_list_find_custom:
17556  * @list: a #GList
17557  * @data: user data passed to the function
17558  * @func: the function to call for each element. It should return 0 when the desired element is found
17559  *
17560  * Finds an element in a #GList, using a supplied function to
17561  * find the desired element. It iterates over the list, calling
17562  * the given function which should return 0 when the desired
17563  * element is found. The function takes two #gconstpointer arguments,
17564  * the #GList element's data as the first argument and the
17565  * given user data.
17566  *
17567  * Returns: the found #GList element, or %NULL if it is not found
17568  */
17569
17570
17571 /**
17572  * g_list_first:
17573  * @list: a #GList
17574  *
17575  * Gets the first element in a #GList.
17576  *
17577  * Returns: the first element in the #GList, or %NULL if the #GList has no elements
17578  */
17579
17580
17581 /**
17582  * g_list_foreach:
17583  * @list: a #GList
17584  * @func: the function to call with each element's data
17585  * @user_data: user data to pass to the function
17586  *
17587  * Calls a function for each element of a #GList.
17588  */
17589
17590
17591 /**
17592  * g_list_free:
17593  * @list: a #GList
17594  *
17595  * Frees all of the memory used by a #GList.
17596  * The freed elements are returned to the slice allocator.
17597  *
17598  * <note><para>
17599  * If list elements contain dynamically-allocated memory,
17600  * you should either use g_list_free_full() or free them manually
17601  * first.
17602  * </para></note>
17603  */
17604
17605
17606 /**
17607  * g_list_free1:
17608  *
17609  * Another name for g_list_free_1().
17610  */
17611
17612
17613 /**
17614  * g_list_free_1:
17615  * @list: a #GList element
17616  *
17617  * Frees one #GList element.
17618  * It is usually used after g_list_remove_link().
17619  */
17620
17621
17622 /**
17623  * g_list_free_full:
17624  * @list: a pointer to a #GList
17625  * @free_func: the function to be called to free each element's data
17626  *
17627  * Convenience method, which frees all the memory used by a #GList, and
17628  * calls the specified destroy function on every element's data.
17629  *
17630  * Since: 2.28
17631  */
17632
17633
17634 /**
17635  * g_list_index:
17636  * @list: a #GList
17637  * @data: the data to find
17638  *
17639  * Gets the position of the element containing
17640  * the given data (starting from 0).
17641  *
17642  * Returns: the index of the element containing the data, or -1 if the data is not found
17643  */
17644
17645
17646 /**
17647  * g_list_insert:
17648  * @list: a pointer to a #GList
17649  * @data: the data for the new element
17650  * @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.
17651  *
17652  * Inserts a new element into the list at the given position.
17653  *
17654  * Returns: the new start of the #GList
17655  */
17656
17657
17658 /**
17659  * g_list_insert_before:
17660  * @list: a pointer to a #GList
17661  * @sibling: the list element before which the new element is inserted or %NULL to insert at the end of the list
17662  * @data: the data for the new element
17663  *
17664  * Inserts a new element into the list before the given position.
17665  *
17666  * Returns: the new start of the #GList
17667  */
17668
17669
17670 /**
17671  * g_list_insert_sorted:
17672  * @list: a pointer to a #GList
17673  * @data: the data for the new element
17674  * @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.
17675  *
17676  * Inserts a new element into the list, using the given comparison
17677  * function to determine its position.
17678  *
17679  * Returns: the new start of the #GList
17680  */
17681
17682
17683 /**
17684  * g_list_insert_sorted_with_data:
17685  * @list: a pointer to a #GList
17686  * @data: the data for the new element
17687  * @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.
17688  * @user_data: user data to pass to comparison function.
17689  *
17690  * Inserts a new element into the list, using the given comparison
17691  * function to determine its position.
17692  *
17693  * Returns: the new start of the #GList
17694  * Since: 2.10
17695  */
17696
17697
17698 /**
17699  * g_list_last:
17700  * @list: a #GList
17701  *
17702  * Gets the last element in a #GList.
17703  *
17704  * Returns: the last element in the #GList, or %NULL if the #GList has no elements
17705  */
17706
17707
17708 /**
17709  * g_list_length:
17710  * @list: a #GList
17711  *
17712  * Gets the number of elements in a #GList.
17713  *
17714  * <note><para>
17715  * This function iterates over the whole list to
17716  * count its elements.
17717  * </para></note>
17718  *
17719  * Returns: the number of elements in the #GList
17720  */
17721
17722
17723 /**
17724  * g_list_next:
17725  * @list: an element in a #GList.
17726  *
17727  * A convenience macro to get the next element in a #GList.
17728  *
17729  * Returns: the next element, or %NULL if there are no more elements.
17730  */
17731
17732
17733 /**
17734  * g_list_nth:
17735  * @list: a #GList
17736  * @n: the position of the element, counting from 0
17737  *
17738  * Gets the element at the given position in a #GList.
17739  *
17740  * Returns: the element, or %NULL if the position is off the end of the #GList
17741  */
17742
17743
17744 /**
17745  * g_list_nth_data:
17746  * @list: a #GList
17747  * @n: the position of the element
17748  *
17749  * Gets the data of the element at the given position.
17750  *
17751  * Returns: the element's data, or %NULL if the position is off the end of the #GList
17752  */
17753
17754
17755 /**
17756  * g_list_nth_prev:
17757  * @list: a #GList
17758  * @n: the position of the element, counting from 0
17759  *
17760  * Gets the element @n places before @list.
17761  *
17762  * Returns: the element, or %NULL if the position is off the end of the #GList
17763  */
17764
17765
17766 /**
17767  * g_list_position:
17768  * @list: a #GList
17769  * @llink: an element in the #GList
17770  *
17771  * Gets the position of the given element
17772  * in the #GList (starting from 0).
17773  *
17774  * Returns: the position of the element in the #GList, or -1 if the element is not found
17775  */
17776
17777
17778 /**
17779  * g_list_prepend:
17780  * @list: a pointer to a #GList
17781  * @data: the data for the new element
17782  *
17783  * Adds a new element on to the start of the list.
17784  *
17785  * <note><para>
17786  * The return value is the new start of the list, which
17787  * may have changed, so make sure you store the new value.
17788  * </para></note>
17789  *
17790  * |[
17791  * /&ast; Notice that it is initialized to the empty list. &ast;/
17792  * GList *list = NULL;
17793  * list = g_list_prepend (list, "last");
17794  * list = g_list_prepend (list, "first");
17795  * ]|
17796  *
17797  * Returns: the new start of the #GList
17798  */
17799
17800
17801 /**
17802  * g_list_previous:
17803  * @list: an element in a #GList.
17804  *
17805  * A convenience macro to get the previous element in a #GList.
17806  *
17807  * Returns: the previous element, or %NULL if there are no previous elements.
17808  */
17809
17810
17811 /**
17812  * g_list_remove:
17813  * @list: a #GList
17814  * @data: the data of the element to remove
17815  *
17816  * Removes an element from a #GList.
17817  * If two elements contain the same data, only the first is removed.
17818  * If none of the elements contain the data, the #GList is unchanged.
17819  *
17820  * Returns: the new start of the #GList
17821  */
17822
17823
17824 /**
17825  * g_list_remove_all:
17826  * @list: a #GList
17827  * @data: data to remove
17828  *
17829  * Removes all list nodes with data equal to @data.
17830  * Returns the new head of the list. Contrast with
17831  * g_list_remove() which removes only the first node
17832  * matching the given data.
17833  *
17834  * Returns: new head of @list
17835  */
17836
17837
17838 /**
17839  * g_list_remove_link:
17840  * @list: a #GList
17841  * @llink: an element in the #GList
17842  *
17843  * Removes an element from a #GList, without freeing the element.
17844  * The removed element's prev and next links are set to %NULL, so
17845  * that it becomes a self-contained list with one element.
17846  *
17847  * Returns: the new start of the #GList, without the element
17848  */
17849
17850
17851 /**
17852  * g_list_reverse:
17853  * @list: a #GList
17854  *
17855  * Reverses a #GList.
17856  * It simply switches the next and prev pointers of each element.
17857  *
17858  * Returns: the start of the reversed #GList
17859  */
17860
17861
17862 /**
17863  * g_list_sort:
17864  * @list: a #GList
17865  * @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.
17866  *
17867  * Sorts a #GList using the given comparison function. The algorithm
17868  * used is a stable sort.
17869  *
17870  * Returns: the start of the sorted #GList
17871  */
17872
17873
17874 /**
17875  * g_list_sort_with_data:
17876  * @list: a #GList
17877  * @compare_func: comparison function
17878  * @user_data: user data to pass to comparison function
17879  *
17880  * Like g_list_sort(), but the comparison function accepts
17881  * a user data argument.
17882  *
17883  * Returns: the new head of @list
17884  */
17885
17886
17887 /**
17888  * g_listenv:
17889  *
17890  * Gets the names of all variables set in the environment.
17891  *
17892  * Programs that want to be portable to Windows should typically use
17893  * this function and g_getenv() instead of using the environ array
17894  * from the C library directly. On Windows, the strings in the environ
17895  * array are in system codepage encoding, while in most of the typical
17896  * use cases for environment variables in GLib-using programs you want
17897  * the UTF-8 encoding that this function and g_getenv() provide.
17898  *
17899  * Returns: (array zero-terminated=1) (transfer full): a %NULL-terminated list of strings which must be freed with g_strfreev().
17900  * Since: 2.8
17901  */
17902
17903
17904 /**
17905  * g_locale_from_utf8:
17906  * @utf8string: a UTF-8 encoded string
17907  * @len: the length of the string, or -1 if the string is nul-terminated<footnoteref linkend="nul-unsafe"/>.
17908  * @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.
17909  * @bytes_written: the number of bytes stored in the output buffer (not including the terminating nul).
17910  * @error: location to store the error occurring, or %NULL to ignore errors. Any of the errors in #GConvertError may occur.
17911  *
17912  * Converts a string from UTF-8 to the encoding used for strings by
17913  * the C runtime (usually the same as that used by the operating
17914  * system) in the <link linkend="setlocale">current locale</link>. On
17915  * Windows this means the system codepage.
17916  *
17917  * Returns: The converted string, or %NULL on an error.
17918  */
17919
17920
17921 /**
17922  * g_locale_to_utf8:
17923  * @opsysstring: a string in the encoding of the current locale. On Windows this means the system codepage.
17924  * @len: the length of the string, or -1 if the string is nul-terminated<footnoteref linkend="nul-unsafe"/>.
17925  * @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.
17926  * @bytes_written: the number of bytes stored in the output buffer (not including the terminating nul).
17927  * @error: location to store the error occurring, or %NULL to ignore errors. Any of the errors in #GConvertError may occur.
17928  *
17929  * Converts a string which is in the encoding used for strings by
17930  * the C runtime (usually the same as that used by the operating
17931  * system) in the <link linkend="setlocale">current locale</link> into a
17932  * UTF-8 string.
17933  *
17934  * Returns: The converted string, or %NULL on an error.
17935  */
17936
17937
17938 /**
17939  * g_log:
17940  * @log_domain: the log domain, usually #G_LOG_DOMAIN
17941  * @log_level: the log level, either from #GLogLevelFlags or a user-defined level
17942  * @format: the message format. See the printf() documentation
17943  * @...: the parameters to insert into the format string
17944  *
17945  * Logs an error or debugging message.
17946  *
17947  * If the log level has been set as fatal, the abort()
17948  * function is called to terminate the program.
17949  */
17950
17951
17952 /**
17953  * g_log_default_handler:
17954  * @log_domain: the log domain of the message
17955  * @log_level: the level of the message
17956  * @message: the message
17957  * @unused_data: data passed from g_log() which is unused
17958  *
17959  * The default log handler set up by GLib; g_log_set_default_handler()
17960  * allows to install an alternate default log handler.
17961  * This is used if no log handler has been set for the particular log
17962  * domain and log level combination. It outputs the message to stderr
17963  * or stdout and if the log level is fatal it calls abort().
17964  *
17965  * The behavior of this log handler can be influenced by a number of
17966  * environment variables:
17967  * <variablelist>
17968  *   <varlistentry>
17969  *     <term><envar>G_MESSAGES_PREFIXED</envar></term>
17970  *     <listitem>
17971  *       A :-separated list of log levels for which messages should
17972  *       be prefixed by the program name and PID of the aplication.
17973  *     </listitem>
17974  *   </varlistentry>
17975  *   <varlistentry>
17976  *     <term><envar>G_MESSAGES_DEBUG</envar></term>
17977  *     <listitem>
17978  *       A space-separated list of log domains for which debug and
17979  *       informational messages are printed. By default these
17980  *       messages are not printed.
17981  *     </listitem>
17982  *   </varlistentry>
17983  * </variablelist>
17984  *
17985  * stderr is used for levels %G_LOG_LEVEL_ERROR, %G_LOG_LEVEL_CRITICAL,
17986  * %G_LOG_LEVEL_WARNING and %G_LOG_LEVEL_MESSAGE. stdout is used for
17987  * the rest.
17988  */
17989
17990
17991 /**
17992  * g_log_remove_handler:
17993  * @log_domain: the log domain
17994  * @handler_id: the id of the handler, which was returned in g_log_set_handler()
17995  *
17996  * Removes the log handler.
17997  */
17998
17999
18000 /**
18001  * g_log_set_always_fatal:
18002  * @fatal_mask: the mask containing bits set for each level of error which is to be fatal
18003  *
18004  * Sets the message levels which are always fatal, in any log domain.
18005  * When a message with any of these levels is logged the program terminates.
18006  * You can only set the levels defined by GLib to be fatal.
18007  * %G_LOG_LEVEL_ERROR is always fatal.
18008  *
18009  * You can also make some message levels fatal at runtime by setting
18010  * the <envar>G_DEBUG</envar> environment variable (see
18011  * <ulink url="glib-running.html">Running GLib Applications</ulink>).
18012  *
18013  * Returns: the old fatal mask
18014  */
18015
18016
18017 /**
18018  * g_log_set_default_handler:
18019  * @log_func: the log handler function
18020  * @user_data: data passed to the log handler
18021  *
18022  * Installs a default log handler which is used if no
18023  * log handler has been set for the particular log domain
18024  * and log level combination. By default, GLib uses
18025  * g_log_default_handler() as default log handler.
18026  *
18027  * Returns: the previous default log handler
18028  * Since: 2.6
18029  */
18030
18031
18032 /**
18033  * g_log_set_fatal_mask:
18034  * @log_domain: the log domain
18035  * @fatal_mask: the new fatal mask
18036  *
18037  * Sets the log levels which are fatal in the given domain.
18038  * %G_LOG_LEVEL_ERROR is always fatal.
18039  *
18040  * Returns: the old fatal mask for the log domain
18041  */
18042
18043
18044 /**
18045  * g_log_set_handler:
18046  * @log_domain: (allow-none): the log domain, or %NULL for the default "" application domain
18047  * @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.
18048  * @log_func: the log handler function
18049  * @user_data: data passed to the log handler
18050  *
18051  * Sets the log handler for a domain and a set of log levels.
18052  * To handle fatal and recursive messages the @log_levels parameter
18053  * must be combined with the #G_LOG_FLAG_FATAL and #G_LOG_FLAG_RECURSION
18054  * bit flags.
18055  *
18056  * Note that since the #G_LOG_LEVEL_ERROR log level is always fatal, if
18057  * you want to set a handler for this log level you must combine it with
18058  * #G_LOG_FLAG_FATAL.
18059  *
18060  * <example>
18061  * <title>Adding a log handler for all warning messages in the default
18062  * (application) domain</title>
18063  * <programlisting>
18064  * g_log_set_handler (NULL, G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL
18065  *                    | G_LOG_FLAG_RECURSION, my_log_handler, NULL);
18066  * </programlisting>
18067  * </example>
18068  *
18069  * <example>
18070  * <title>Adding a log handler for all critical messages from GTK+</title>
18071  * <programlisting>
18072  * g_log_set_handler ("Gtk", G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL
18073  *                    | G_LOG_FLAG_RECURSION, my_log_handler, NULL);
18074  * </programlisting>
18075  * </example>
18076  *
18077  * <example>
18078  * <title>Adding a log handler for <emphasis>all</emphasis> messages from
18079  * GLib</title>
18080  * <programlisting>
18081  * g_log_set_handler ("GLib", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL
18082  *                    | G_LOG_FLAG_RECURSION, my_log_handler, NULL);
18083  * </programlisting>
18084  * </example>
18085  *
18086  * Returns: the id of the new handler
18087  */
18088
18089
18090 /**
18091  * g_logv:
18092  * @log_domain: the log domain
18093  * @log_level: the log level
18094  * @format: the message format. See the printf() documentation
18095  * @args: the parameters to insert into the format string
18096  *
18097  * Logs an error or debugging message.
18098  *
18099  * If the log level has been set as fatal, the abort()
18100  * function is called to terminate the program.
18101  */
18102
18103
18104 /**
18105  * g_lstat:
18106  * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows)
18107  * @buf: a pointer to a <structname>stat</structname> struct, which will be filled with the file information
18108  *
18109  * A wrapper for the POSIX lstat() function. The lstat() function is
18110  * like stat() except that in the case of symbolic links, it returns
18111  * information about the symbolic link itself and not the file that it
18112  * refers to. If the system does not support symbolic links g_lstat()
18113  * is identical to g_stat().
18114  *
18115  * See your C library manual for more details about lstat().
18116  *
18117  * Returns: 0 if the information was successfully retrieved, -1 if an error occurred
18118  * Since: 2.6
18119  */
18120
18121
18122 /**
18123  * g_main_context_acquire:
18124  * @context: a #GMainContext
18125  *
18126  * Tries to become the owner of the specified context.
18127  * If some other thread is the owner of the context,
18128  * returns %FALSE immediately. Ownership is properly
18129  * recursive: the owner can require ownership again
18130  * and will release ownership when g_main_context_release()
18131  * is called as many times as g_main_context_acquire().
18132  *
18133  * You must be the owner of a context before you
18134  * can call g_main_context_prepare(), g_main_context_query(),
18135  * g_main_context_check(), g_main_context_dispatch().
18136  *
18137  * Returns: %TRUE if the operation succeeded, and this thread is now the owner of @context.
18138  */
18139
18140
18141 /**
18142  * g_main_context_add_poll:
18143  * @context: (allow-none): a #GMainContext (or %NULL for the default context)
18144  * @fd: a #GPollFD structure holding information about a file descriptor to watch.
18145  * @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.
18146  *
18147  * Adds a file descriptor to the set of file descriptors polled for
18148  * this context. This will very seldom be used directly. Instead
18149  * a typical event source will use g_source_add_poll() instead.
18150  */
18151
18152
18153 /**
18154  * g_main_context_check:
18155  * @context: a #GMainContext
18156  * @max_priority: the maximum numerical priority of sources to check
18157  * @fds: (array length=n_fds): array of #GPollFD's that was passed to the last call to g_main_context_query()
18158  * @n_fds: return value of g_main_context_query()
18159  *
18160  * Passes the results of polling back to the main loop.
18161  *
18162  * Returns: %TRUE if some sources are ready to be dispatched.
18163  */
18164
18165
18166 /**
18167  * g_main_context_default:
18168  *
18169  * Returns the global default main context. This is the main context
18170  * used for main loop functions when a main loop is not explicitly
18171  * specified, and corresponds to the "main" main loop. See also
18172  * g_main_context_get_thread_default().
18173  *
18174  * Returns: (transfer none): the global default main context.
18175  */
18176
18177
18178 /**
18179  * g_main_context_dispatch:
18180  * @context: a #GMainContext
18181  *
18182  * Dispatches all pending sources.
18183  */
18184
18185
18186 /**
18187  * g_main_context_find_source_by_funcs_user_data:
18188  * @context: (allow-none): a #GMainContext (if %NULL, the default context will be used).
18189  * @funcs: the @source_funcs passed to g_source_new().
18190  * @user_data: the user data from the callback.
18191  *
18192  * Finds a source with the given source functions and user data.  If
18193  * multiple sources exist with the same source function and user data,
18194  * the first one found will be returned.
18195  *
18196  * Returns: (transfer none): the source, if one was found, otherwise %NULL
18197  */
18198
18199
18200 /**
18201  * g_main_context_find_source_by_id:
18202  * @context: (allow-none): a #GMainContext (if %NULL, the default context will be used)
18203  * @source_id: the source ID, as returned by g_source_get_id().
18204  *
18205  * Finds a #GSource given a pair of context and ID.
18206  *
18207  * Returns: (transfer none): the #GSource if found, otherwise, %NULL
18208  */
18209
18210
18211 /**
18212  * g_main_context_find_source_by_user_data:
18213  * @context: a #GMainContext
18214  * @user_data: the user_data for the callback.
18215  *
18216  * Finds a source with the given user data for the callback.  If
18217  * multiple sources exist with the same user data, the first
18218  * one found will be returned.
18219  *
18220  * Returns: (transfer none): the source, if one was found, otherwise %NULL
18221  */
18222
18223
18224 /**
18225  * g_main_context_get_poll_func:
18226  * @context: a #GMainContext
18227  *
18228  * Gets the poll function set by g_main_context_set_poll_func().
18229  *
18230  * Returns: the poll function
18231  */
18232
18233
18234 /**
18235  * g_main_context_get_thread_default:
18236  *
18237  * Gets the thread-default #GMainContext for this thread. Asynchronous
18238  * operations that want to be able to be run in contexts other than
18239  * the default one should call this method or
18240  * g_main_context_ref_thread_default() to get a #GMainContext to add
18241  * their #GSource<!-- -->s to. (Note that even in single-threaded
18242  * programs applications may sometimes want to temporarily push a
18243  * non-default context, so it is not safe to assume that this will
18244  * always return %NULL if you are running in the default thread.)
18245  *
18246  * If you need to hold a reference on the context, use
18247  * g_main_context_ref_thread_default() instead.
18248  *
18249  * Returns: (transfer none): the thread-default #GMainContext, or %NULL if the thread-default context is the global default context.
18250  * Since: 2.22
18251  */
18252
18253
18254 /**
18255  * g_main_context_invoke:
18256  * @context: (allow-none): a #GMainContext, or %NULL
18257  * @function: function to call
18258  * @data: data to pass to @function
18259  *
18260  * Invokes a function in such a way that @context is owned during the
18261  * invocation of @function.
18262  *
18263  * If @context is %NULL then the global default main context â€” as
18264  * returned by g_main_context_default() â€” is used.
18265  *
18266  * If @context is owned by the current thread, @function is called
18267  * directly.  Otherwise, if @context is the thread-default main context
18268  * of the current thread and g_main_context_acquire() succeeds, then
18269  * @function is called and g_main_context_release() is called
18270  * afterwards.
18271  *
18272  * In any other case, an idle source is created to call @function and
18273  * that source is attached to @context (presumably to be run in another
18274  * thread).  The idle source is attached with #G_PRIORITY_DEFAULT
18275  * priority.  If you want a different priority, use
18276  * g_main_context_invoke_full().
18277  *
18278  * Note that, as with normal idle functions, @function should probably
18279  * return %FALSE.  If it returns %TRUE, it will be continuously run in a
18280  * loop (and may prevent this call from returning).
18281  *
18282  * Since: 2.28
18283  */
18284
18285
18286 /**
18287  * g_main_context_invoke_full:
18288  * @context: (allow-none): a #GMainContext, or %NULL
18289  * @priority: the priority at which to run @function
18290  * @function: function to call
18291  * @data: data to pass to @function
18292  * @notify: (allow-none): a function to call when @data is no longer in use, or %NULL.
18293  *
18294  * Invokes a function in such a way that @context is owned during the
18295  * invocation of @function.
18296  *
18297  * This function is the same as g_main_context_invoke() except that it
18298  * lets you specify the priority incase @function ends up being
18299  * scheduled as an idle and also lets you give a #GDestroyNotify for @data.
18300  *
18301  * @notify should not assume that it is called from any particular
18302  * thread or with any particular context acquired.
18303  *
18304  * Since: 2.28
18305  */
18306
18307
18308 /**
18309  * g_main_context_is_owner:
18310  * @context: a #GMainContext
18311  *
18312  * Determines whether this thread holds the (recursive)
18313  * ownership of this #GMainContext. This is useful to
18314  * know before waiting on another thread that may be
18315  * blocking to get ownership of @context.
18316  *
18317  * Returns: %TRUE if current thread is owner of @context.
18318  * Since: 2.10
18319  */
18320
18321
18322 /**
18323  * g_main_context_iteration:
18324  * @context: (allow-none): a #GMainContext (if %NULL, the default context will be used)
18325  * @may_block: whether the call may block.
18326  *
18327  * Runs a single iteration for the given main loop. This involves
18328  * checking to see if any event sources are ready to be processed,
18329  * then if no events sources are ready and @may_block is %TRUE, waiting
18330  * for a source to become ready, then dispatching the highest priority
18331  * events sources that are ready. Otherwise, if @may_block is %FALSE
18332  * sources are not waited to become ready, only those highest priority
18333  * events sources will be dispatched (if any), that are ready at this
18334  * given moment without further waiting.
18335  *
18336  * Note that even when @may_block is %TRUE, it is still possible for
18337  * g_main_context_iteration() to return %FALSE, since the wait may
18338  * be interrupted for other reasons than an event source becoming ready.
18339  *
18340  * Returns: %TRUE if events were dispatched.
18341  */
18342
18343
18344 /**
18345  * g_main_context_new:
18346  *
18347  * Creates a new #GMainContext structure.
18348  *
18349  * Returns: the new #GMainContext
18350  */
18351
18352
18353 /**
18354  * g_main_context_pending:
18355  * @context: (allow-none): a #GMainContext (if %NULL, the default context will be used)
18356  *
18357  * Checks if any sources have pending events for the given context.
18358  *
18359  * Returns: %TRUE if events are pending.
18360  */
18361
18362
18363 /**
18364  * g_main_context_pop_thread_default:
18365  * @context: (allow-none): a #GMainContext object, or %NULL
18366  *
18367  * Pops @context off the thread-default context stack (verifying that
18368  * it was on the top of the stack).
18369  *
18370  * Since: 2.22
18371  */
18372
18373
18374 /**
18375  * g_main_context_prepare:
18376  * @context: a #GMainContext
18377  * @priority: location to store priority of highest priority source already ready.
18378  *
18379  * Prepares to poll sources within a main loop. The resulting information
18380  * for polling is determined by calling g_main_context_query ().
18381  *
18382  * Returns: %TRUE if some source is ready to be dispatched prior to polling.
18383  */
18384
18385
18386 /**
18387  * g_main_context_push_thread_default:
18388  * @context: (allow-none): a #GMainContext, or %NULL for the global default context
18389  *
18390  * Acquires @context and sets it as the thread-default context for the
18391  * current thread. This will cause certain asynchronous operations
18392  * (such as most <link linkend="gio">gio</link>-based I/O) which are
18393  * started in this thread to run under @context and deliver their
18394  * results to its main loop, rather than running under the global
18395  * default context in the main thread. Note that calling this function
18396  * changes the context returned by
18397  * g_main_context_get_thread_default(), <emphasis>not</emphasis> the
18398  * one returned by g_main_context_default(), so it does not affect the
18399  * context used by functions like g_idle_add().
18400  *
18401  * Normally you would call this function shortly after creating a new
18402  * thread, passing it a #GMainContext which will be run by a
18403  * #GMainLoop in that thread, to set a new default context for all
18404  * async operations in that thread. (In this case, you don't need to
18405  * ever call g_main_context_pop_thread_default().) In some cases
18406  * however, you may want to schedule a single operation in a
18407  * non-default context, or temporarily use a non-default context in
18408  * the main thread. In that case, you can wrap the call to the
18409  * asynchronous operation inside a
18410  * g_main_context_push_thread_default() /
18411  * g_main_context_pop_thread_default() pair, but it is up to you to
18412  * ensure that no other asynchronous operations accidentally get
18413  * started while the non-default context is active.
18414  *
18415  * Beware that libraries that predate this function may not correctly
18416  * handle being used from a thread with a thread-default context. Eg,
18417  * see g_file_supports_thread_contexts().
18418  *
18419  * Since: 2.22
18420  */
18421
18422
18423 /**
18424  * g_main_context_query:
18425  * @context: a #GMainContext
18426  * @max_priority: maximum priority source to check
18427  * @timeout_: (out): location to store timeout to be used in polling
18428  * @fds: (out caller-allocates) (array length=n_fds): location to store #GPollFD records that need to be polled.
18429  * @n_fds: length of @fds.
18430  *
18431  * Determines information necessary to poll this main loop.
18432  *
18433  * 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.
18434  */
18435
18436
18437 /**
18438  * g_main_context_ref:
18439  * @context: a #GMainContext
18440  *
18441  * Increases the reference count on a #GMainContext object by one.
18442  *
18443  * Returns: the @context that was passed in (since 2.6)
18444  */
18445
18446
18447 /**
18448  * g_main_context_ref_thread_default:
18449  *
18450  * Gets the thread-default #GMainContext for this thread, as with
18451  * g_main_context_get_thread_default(), but also adds a reference to
18452  * it with g_main_context_ref(). In addition, unlike
18453  * g_main_context_get_thread_default(), if the thread-default context
18454  * is the global default context, this will return that #GMainContext
18455  * (with a ref added to it) rather than returning %NULL.
18456  *
18457  * Returns: (transfer full): the thread-default #GMainContext. Unref with g_main_context_unref() when you are done with it.
18458  * Since: 2.32
18459  */
18460
18461
18462 /**
18463  * g_main_context_release:
18464  * @context: a #GMainContext
18465  *
18466  * Releases ownership of a context previously acquired by this thread
18467  * with g_main_context_acquire(). If the context was acquired multiple
18468  * times, the ownership will be released only when g_main_context_release()
18469  * is called as many times as it was acquired.
18470  */
18471
18472
18473 /**
18474  * g_main_context_remove_poll:
18475  * @context: a #GMainContext
18476  * @fd: a #GPollFD descriptor previously added with g_main_context_add_poll()
18477  *
18478  * Removes file descriptor from the set of file descriptors to be
18479  * polled for a particular context.
18480  */
18481
18482
18483 /**
18484  * g_main_context_set_poll_func:
18485  * @context: a #GMainContext
18486  * @func: the function to call to poll all file descriptors
18487  *
18488  * Sets the function to use to handle polling of file descriptors. It
18489  * will be used instead of the poll() system call
18490  * (or GLib's replacement function, which is used where
18491  * poll() isn't available).
18492  *
18493  * This function could possibly be used to integrate the GLib event
18494  * loop with an external event loop.
18495  */
18496
18497
18498 /**
18499  * g_main_context_unref:
18500  * @context: a #GMainContext
18501  *
18502  * Decreases the reference count on a #GMainContext object by one. If
18503  * the result is zero, free the context and free all associated memory.
18504  */
18505
18506
18507 /**
18508  * g_main_context_wait:
18509  * @context: a #GMainContext
18510  * @cond: a condition variable
18511  * @mutex: a mutex, currently held
18512  *
18513  * Tries to become the owner of the specified context,
18514  * as with g_main_context_acquire(). But if another thread
18515  * is the owner, atomically drop @mutex and wait on @cond until
18516  * that owner releases ownership or until @cond is signaled, then
18517  * try again (once) to become the owner.
18518  *
18519  * Returns: %TRUE if the operation succeeded, and this thread is now the owner of @context.
18520  */
18521
18522
18523 /**
18524  * g_main_context_wakeup:
18525  * @context: a #GMainContext
18526  *
18527  * If @context is currently waiting in a poll(), interrupt
18528  * the poll(), and continue the iteration process.
18529  */
18530
18531
18532 /**
18533  * g_main_current_source:
18534  *
18535  * Returns the currently firing source for this thread.
18536  *
18537  * Returns: (transfer none): The currently firing source or %NULL.
18538  * Since: 2.12
18539  */
18540
18541
18542 /**
18543  * g_main_depth:
18544  *
18545  * Returns the depth of the stack of calls to
18546  * g_main_context_dispatch() on any #GMainContext in the current thread.
18547  *  That is, when called from the toplevel, it gives 0. When
18548  * called from within a callback from g_main_context_iteration()
18549  * (or g_main_loop_run(), etc.) it returns 1. When called from within
18550  * a callback to a recursive call to g_main_context_iteration(),
18551  * it returns 2. And so forth.
18552  *
18553  * This function is useful in a situation like the following:
18554  * Imagine an extremely simple "garbage collected" system.
18555  *
18556  * |[
18557  * static GList *free_list;
18558  *
18559  * gpointer
18560  * allocate_memory (gsize size)
18561  * {
18562  *   gpointer result = g_malloc (size);
18563  *   free_list = g_list_prepend (free_list, result);
18564  *   return result;
18565  * }
18566  *
18567  * void
18568  * free_allocated_memory (void)
18569  * {
18570  *   GList *l;
18571  *   for (l = free_list; l; l = l->next);
18572  *     g_free (l->data);
18573  *   g_list_free (free_list);
18574  *   free_list = NULL;
18575  *  }
18576  *
18577  * [...]
18578  *
18579  * while (TRUE);
18580  *  {
18581  *    g_main_context_iteration (NULL, TRUE);
18582  *    free_allocated_memory();
18583  *   }
18584  * ]|
18585  *
18586  * This works from an application, however, if you want to do the same
18587  * thing from a library, it gets more difficult, since you no longer
18588  * control the main loop. You might think you can simply use an idle
18589  * function to make the call to free_allocated_memory(), but that
18590  * doesn't work, since the idle function could be called from a
18591  * recursive callback. This can be fixed by using g_main_depth()
18592  *
18593  * |[
18594  * gpointer
18595  * allocate_memory (gsize size)
18596  * {
18597  *   FreeListBlock *block = g_new (FreeListBlock, 1);
18598  *   block->mem = g_malloc (size);
18599  *   block->depth = g_main_depth ();
18600  *   free_list = g_list_prepend (free_list, block);
18601  *   return block->mem;
18602  * }
18603  *
18604  * void
18605  * free_allocated_memory (void)
18606  * {
18607  *   GList *l;
18608  *
18609  *   int depth = g_main_depth ();
18610  *   for (l = free_list; l; );
18611  *     {
18612  *       GList *next = l->next;
18613  *       FreeListBlock *block = l->data;
18614  *       if (block->depth > depth)
18615  *         {
18616  *           g_free (block->mem);
18617  *           g_free (block);
18618  *           free_list = g_list_delete_link (free_list, l);
18619  *         }
18620  *
18621  *       l = next;
18622  *     }
18623  *   }
18624  * ]|
18625  *
18626  * There is a temptation to use g_main_depth() to solve
18627  * problems with reentrancy. For instance, while waiting for data
18628  * to be received from the network in response to a menu item,
18629  * the menu item might be selected again. It might seem that
18630  * one could make the menu item's callback return immediately
18631  * and do nothing if g_main_depth() returns a value greater than 1.
18632  * However, this should be avoided since the user then sees selecting
18633  * the menu item do nothing. Furthermore, you'll find yourself adding
18634  * these checks all over your code, since there are doubtless many,
18635  * many things that the user could do. Instead, you can use the
18636  * following techniques:
18637  *
18638  * <orderedlist>
18639  *  <listitem>
18640  *   <para>
18641  *     Use gtk_widget_set_sensitive() or modal dialogs to prevent
18642  *     the user from interacting with elements while the main
18643  *     loop is recursing.
18644  *   </para>
18645  *  </listitem>
18646  *  <listitem>
18647  *   <para>
18648  *     Avoid main loop recursion in situations where you can't handle
18649  *     arbitrary  callbacks. Instead, structure your code so that you
18650  *     simply return to the main loop and then get called again when
18651  *     there is more work to do.
18652  *   </para>
18653  *  </listitem>
18654  * </orderedlist>
18655  *
18656  * Returns: The main loop recursion level in the current thread
18657  */
18658
18659
18660 /**
18661  * g_main_loop_get_context:
18662  * @loop: a #GMainLoop.
18663  *
18664  * Returns the #GMainContext of @loop.
18665  *
18666  * Returns: (transfer none): the #GMainContext of @loop
18667  */
18668
18669
18670 /**
18671  * g_main_loop_is_running:
18672  * @loop: a #GMainLoop.
18673  *
18674  * Checks to see if the main loop is currently being run via g_main_loop_run().
18675  *
18676  * Returns: %TRUE if the mainloop is currently being run.
18677  */
18678
18679
18680 /**
18681  * g_main_loop_new:
18682  * @context: (allow-none): a #GMainContext  (if %NULL, the default context will be used).
18683  * @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.
18684  *
18685  * Creates a new #GMainLoop structure.
18686  *
18687  * Returns: a new #GMainLoop.
18688  */
18689
18690
18691 /**
18692  * g_main_loop_quit:
18693  * @loop: a #GMainLoop
18694  *
18695  * Stops a #GMainLoop from running. Any calls to g_main_loop_run()
18696  * for the loop will return.
18697  *
18698  * Note that sources that have already been dispatched when
18699  * g_main_loop_quit() is called will still be executed.
18700  */
18701
18702
18703 /**
18704  * g_main_loop_ref:
18705  * @loop: a #GMainLoop
18706  *
18707  * Increases the reference count on a #GMainLoop object by one.
18708  *
18709  * Returns: @loop
18710  */
18711
18712
18713 /**
18714  * g_main_loop_run:
18715  * @loop: a #GMainLoop
18716  *
18717  * Runs a main loop until g_main_loop_quit() is called on the loop.
18718  * If this is called for the thread of the loop's #GMainContext,
18719  * it will process events from the loop, otherwise it will
18720  * simply wait.
18721  */
18722
18723
18724 /**
18725  * g_main_loop_unref:
18726  * @loop: a #GMainLoop
18727  *
18728  * Decreases the reference count on a #GMainLoop object by one. If
18729  * the result is zero, free the loop and free all associated memory.
18730  */
18731
18732
18733 /**
18734  * g_malloc:
18735  * @n_bytes: the number of bytes to allocate
18736  *
18737  * Allocates @n_bytes bytes of memory.
18738  * If @n_bytes is 0 it returns %NULL.
18739  *
18740  * Returns: a pointer to the allocated memory
18741  */
18742
18743
18744 /**
18745  * g_malloc0:
18746  * @n_bytes: the number of bytes to allocate
18747  *
18748  * Allocates @n_bytes bytes of memory, initialized to 0's.
18749  * If @n_bytes is 0 it returns %NULL.
18750  *
18751  * Returns: a pointer to the allocated memory
18752  */
18753
18754
18755 /**
18756  * g_malloc0_n:
18757  * @n_blocks: the number of blocks to allocate
18758  * @n_block_bytes: the size of each block in bytes
18759  *
18760  * This function is similar to g_malloc0(), allocating (@n_blocks * @n_block_bytes) bytes,
18761  * but care is taken to detect possible overflow during multiplication.
18762  *
18763  * Since: 2.24
18764  * Returns: a pointer to the allocated memory
18765  */
18766
18767
18768 /**
18769  * g_malloc_n:
18770  * @n_blocks: the number of blocks to allocate
18771  * @n_block_bytes: the size of each block in bytes
18772  *
18773  * This function is similar to g_malloc(), allocating (@n_blocks * @n_block_bytes) bytes,
18774  * but care is taken to detect possible overflow during multiplication.
18775  *
18776  * Since: 2.24
18777  * Returns: a pointer to the allocated memory
18778  */
18779
18780
18781 /**
18782  * g_mapped_file_free:
18783  * @file: a #GMappedFile
18784  *
18785  * This call existed before #GMappedFile had refcounting and is currently
18786  * exactly the same as g_mapped_file_unref().
18787  *
18788  * Since: 2.8
18789  * Deprecated: 2.22: Use g_mapped_file_unref() instead.
18790  */
18791
18792
18793 /**
18794  * g_mapped_file_get_bytes:
18795  * @file: a #GMappedFile
18796  *
18797  * Creates a new #GBytes which references the data mapped from @file.
18798  * The mapped contents of the file must not be modified after creating this
18799  * bytes object, because a #GBytes should be immutable.
18800  *
18801  * Returns: (transfer full): A newly allocated #GBytes referencing data from @file
18802  * Since: 2.34
18803  */
18804
18805
18806 /**
18807  * g_mapped_file_get_contents:
18808  * @file: a #GMappedFile
18809  *
18810  * Returns the contents of a #GMappedFile.
18811  *
18812  * Note that the contents may not be zero-terminated,
18813  * even if the #GMappedFile is backed by a text file.
18814  *
18815  * If the file is empty then %NULL is returned.
18816  *
18817  * Returns: the contents of @file, or %NULL.
18818  * Since: 2.8
18819  */
18820
18821
18822 /**
18823  * g_mapped_file_get_length:
18824  * @file: a #GMappedFile
18825  *
18826  * Returns the length of the contents of a #GMappedFile.
18827  *
18828  * Returns: the length of the contents of @file.
18829  * Since: 2.8
18830  */
18831
18832
18833 /**
18834  * g_mapped_file_new:
18835  * @filename: The path of the file to load, in the GLib filename encoding
18836  * @writable: whether the mapping should be writable
18837  * @error: return location for a #GError, or %NULL
18838  *
18839  * Maps a file into memory. On UNIX, this is using the mmap() function.
18840  *
18841  * If @writable is %TRUE, the mapped buffer may be modified, otherwise
18842  * it is an error to modify the mapped buffer. Modifications to the buffer
18843  * are not visible to other processes mapping the same file, and are not
18844  * written back to the file.
18845  *
18846  * Note that modifications of the underlying file might affect the contents
18847  * of the #GMappedFile. Therefore, mapping should only be used if the file
18848  * will not be modified, or if all modifications of the file are done
18849  * atomically (e.g. using g_file_set_contents()).
18850  *
18851  * If @filename is the name of an empty, regular file, the function
18852  * will successfully return an empty #GMappedFile. In other cases of
18853  * size 0 (e.g. device files such as /dev/null), @error will be set
18854  * to the #GFileError value #G_FILE_ERROR_INVAL.
18855  *
18856  * Returns: a newly allocated #GMappedFile which must be unref'd with g_mapped_file_unref(), or %NULL if the mapping failed.
18857  * Since: 2.8
18858  */
18859
18860
18861 /**
18862  * g_mapped_file_new_from_fd:
18863  * @fd: The file descriptor of the file to load
18864  * @writable: whether the mapping should be writable
18865  * @error: return location for a #GError, or %NULL
18866  *
18867  * Maps a file into memory. On UNIX, this is using the mmap() function.
18868  *
18869  * If @writable is %TRUE, the mapped buffer may be modified, otherwise
18870  * it is an error to modify the mapped buffer. Modifications to the buffer
18871  * are not visible to other processes mapping the same file, and are not
18872  * written back to the file.
18873  *
18874  * Note that modifications of the underlying file might affect the contents
18875  * of the #GMappedFile. Therefore, mapping should only be used if the file
18876  * will not be modified, or if all modifications of the file are done
18877  * atomically (e.g. using g_file_set_contents()).
18878  *
18879  * Returns: a newly allocated #GMappedFile which must be unref'd with g_mapped_file_unref(), or %NULL if the mapping failed.
18880  * Since: 2.32
18881  */
18882
18883
18884 /**
18885  * g_mapped_file_ref:
18886  * @file: a #GMappedFile
18887  *
18888  * Increments the reference count of @file by one.  It is safe to call
18889  * this function from any thread.
18890  *
18891  * Returns: the passed in #GMappedFile.
18892  * Since: 2.22
18893  */
18894
18895
18896 /**
18897  * g_mapped_file_unref:
18898  * @file: a #GMappedFile
18899  *
18900  * Decrements the reference count of @file by one.  If the reference count
18901  * drops to 0, unmaps the buffer of @file and frees it.
18902  *
18903  * It is safe to call this function from any thread.
18904  *
18905  * Since 2.22
18906  */
18907
18908
18909 /**
18910  * g_markup_collect_attributes:
18911  * @element_name: the current tag name
18912  * @attribute_names: the attribute names
18913  * @attribute_values: the attribute values
18914  * @error: a pointer to a #GError or %NULL
18915  * @first_type: the #GMarkupCollectType of the first attribute
18916  * @first_attr: the name of the first attribute
18917  * @...: 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
18918  *
18919  * Collects the attributes of the element from the data passed to the
18920  * #GMarkupParser start_element function, dealing with common error
18921  * conditions and supporting boolean values.
18922  *
18923  * This utility function is not required to write a parser but can save
18924  * a lot of typing.
18925  *
18926  * The @element_name, @attribute_names, @attribute_values and @error
18927  * parameters passed to the start_element callback should be passed
18928  * unmodified to this function.
18929  *
18930  * Following these arguments is a list of "supported" attributes to collect.
18931  * It is an error to specify multiple attributes with the same name. If any
18932  * attribute not in the list appears in the @attribute_names array then an
18933  * unknown attribute error will result.
18934  *
18935  * The #GMarkupCollectType field allows specifying the type of collection
18936  * to perform and if a given attribute must appear or is optional.
18937  *
18938  * The attribute name is simply the name of the attribute to collect.
18939  *
18940  * The pointer should be of the appropriate type (see the descriptions
18941  * under #GMarkupCollectType) and may be %NULL in case a particular
18942  * attribute is to be allowed but ignored.
18943  *
18944  * This function deals with issuing errors for missing attributes
18945  * (of type %G_MARKUP_ERROR_MISSING_ATTRIBUTE), unknown attributes
18946  * (of type %G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE) and duplicate
18947  * attributes (of type %G_MARKUP_ERROR_INVALID_CONTENT) as well
18948  * as parse errors for boolean-valued attributes (again of type
18949  * %G_MARKUP_ERROR_INVALID_CONTENT). In all of these cases %FALSE
18950  * will be returned and @error will be set as appropriate.
18951  *
18952  * Returns: %TRUE if successful
18953  * Since: 2.16
18954  */
18955
18956
18957 /**
18958  * g_markup_escape_text:
18959  * @text: some valid UTF-8 text
18960  * @length: length of @text in bytes, or -1 if the text is nul-terminated
18961  *
18962  * Escapes text so that the markup parser will parse it verbatim.
18963  * Less than, greater than, ampersand, etc. are replaced with the
18964  * corresponding entities. This function would typically be used
18965  * when writing out a file to be parsed with the markup parser.
18966  *
18967  * Note that this function doesn't protect whitespace and line endings
18968  * from being processed according to the XML rules for normalization
18969  * of line endings and attribute values.
18970  *
18971  * Note also that this function will produce character references in
18972  * the range of &amp;#x1; ... &amp;#x1f; for all control sequences
18973  * except for tabstop, newline and carriage return.  The character
18974  * references in this range are not valid XML 1.0, but they are
18975  * valid XML 1.1 and will be accepted by the GMarkup parser.
18976  *
18977  * Returns: a newly allocated string with the escaped text
18978  */
18979
18980
18981 /**
18982  * g_markup_parse_context_end_parse:
18983  * @context: a #GMarkupParseContext
18984  * @error: return location for a #GError
18985  *
18986  * Signals to the #GMarkupParseContext that all data has been
18987  * fed into the parse context with g_markup_parse_context_parse().
18988  *
18989  * This function reports an error if the document isn't complete,
18990  * for example if elements are still open.
18991  *
18992  * Returns: %TRUE on success, %FALSE if an error was set
18993  */
18994
18995
18996 /**
18997  * g_markup_parse_context_free:
18998  * @context: a #GMarkupParseContext
18999  *
19000  * Frees a #GMarkupParseContext.
19001  *
19002  * This function can't be called from inside one of the
19003  * #GMarkupParser functions or while a subparser is pushed.
19004  */
19005
19006
19007 /**
19008  * g_markup_parse_context_get_element:
19009  * @context: a #GMarkupParseContext
19010  *
19011  * Retrieves the name of the currently open element.
19012  *
19013  * If called from the start_element or end_element handlers this will
19014  * give the element_name as passed to those functions. For the parent
19015  * elements, see g_markup_parse_context_get_element_stack().
19016  *
19017  * Returns: the name of the currently open element, or %NULL
19018  * Since: 2.2
19019  */
19020
19021
19022 /**
19023  * g_markup_parse_context_get_element_stack:
19024  * @context: a #GMarkupParseContext
19025  *
19026  * Retrieves the element stack from the internal state of the parser.
19027  *
19028  * The returned #GSList is a list of strings where the first item is
19029  * the currently open tag (as would be returned by
19030  * g_markup_parse_context_get_element()) and the next item is its
19031  * immediate parent.
19032  *
19033  * This function is intended to be used in the start_element and
19034  * end_element handlers where g_markup_parse_context_get_element()
19035  * would merely return the name of the element that is being
19036  * processed.
19037  *
19038  * Returns: the element stack, which must not be modified
19039  * Since: 2.16
19040  */
19041
19042
19043 /**
19044  * g_markup_parse_context_get_position:
19045  * @context: a #GMarkupParseContext
19046  * @line_number: (allow-none): return location for a line number, or %NULL
19047  * @char_number: (allow-none): return location for a char-on-line number, or %NULL
19048  *
19049  * Retrieves the current line number and the number of the character on
19050  * that line. Intended for use in error messages; there are no strict
19051  * semantics for what constitutes the "current" line number other than
19052  * "the best number we could come up with for error messages."
19053  */
19054
19055
19056 /**
19057  * g_markup_parse_context_get_user_data:
19058  * @context: a #GMarkupParseContext
19059  *
19060  * Returns the user_data associated with @context.
19061  *
19062  * This will either be the user_data that was provided to
19063  * g_markup_parse_context_new() or to the most recent call
19064  * of g_markup_parse_context_push().
19065  *
19066  * 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.
19067  * Since: 2.18
19068  */
19069
19070
19071 /**
19072  * g_markup_parse_context_new:
19073  * @parser: a #GMarkupParser
19074  * @flags: one or more #GMarkupParseFlags
19075  * @user_data: user data to pass to #GMarkupParser functions
19076  * @user_data_dnotify: user data destroy notifier called when the parse context is freed
19077  *
19078  * Creates a new parse context. A parse context is used to parse
19079  * marked-up documents. You can feed any number of documents into
19080  * a context, as long as no errors occur; once an error occurs,
19081  * the parse context can't continue to parse text (you have to
19082  * free it and create a new parse context).
19083  *
19084  * Returns: a new #GMarkupParseContext
19085  */
19086
19087
19088 /**
19089  * g_markup_parse_context_parse:
19090  * @context: a #GMarkupParseContext
19091  * @text: chunk of text to parse
19092  * @text_len: length of @text in bytes
19093  * @error: return location for a #GError
19094  *
19095  * Feed some data to the #GMarkupParseContext.
19096  *
19097  * The data need not be valid UTF-8; an error will be signaled if
19098  * it's invalid. The data need not be an entire document; you can
19099  * feed a document into the parser incrementally, via multiple calls
19100  * to this function. Typically, as you receive data from a network
19101  * connection or file, you feed each received chunk of data into this
19102  * function, aborting the process if an error occurs. Once an error
19103  * is reported, no further data may be fed to the #GMarkupParseContext;
19104  * all errors are fatal.
19105  *
19106  * Returns: %FALSE if an error occurred, %TRUE on success
19107  */
19108
19109
19110 /**
19111  * g_markup_parse_context_pop:
19112  * @context: a #GMarkupParseContext
19113  *
19114  * Completes the process of a temporary sub-parser redirection.
19115  *
19116  * This function exists to collect the user_data allocated by a
19117  * matching call to g_markup_parse_context_push(). It must be called
19118  * in the end_element handler corresponding to the start_element
19119  * handler during which g_markup_parse_context_push() was called.
19120  * You must not call this function from the error callback -- the
19121  * @user_data is provided directly to the callback in that case.
19122  *
19123  * This function is not intended to be directly called by users
19124  * interested in invoking subparsers. Instead, it is intended to
19125  * be used by the subparsers themselves to implement a higher-level
19126  * interface.
19127  *
19128  * Returns: the user data passed to g_markup_parse_context_push()
19129  * Since: 2.18
19130  */
19131
19132
19133 /**
19134  * g_markup_parse_context_push:
19135  * @context: a #GMarkupParseContext
19136  * @parser: a #GMarkupParser
19137  * @user_data: user data to pass to #GMarkupParser functions
19138  *
19139  * Temporarily redirects markup data to a sub-parser.
19140  *
19141  * This function may only be called from the start_element handler of
19142  * a #GMarkupParser. It must be matched with a corresponding call to
19143  * g_markup_parse_context_pop() in the matching end_element handler
19144  * (except in the case that the parser aborts due to an error).
19145  *
19146  * All tags, text and other data between the matching tags is
19147  * redirected to the subparser given by @parser. @user_data is used
19148  * as the user_data for that parser. @user_data is also passed to the
19149  * error callback in the event that an error occurs. This includes
19150  * errors that occur in subparsers of the subparser.
19151  *
19152  * The end tag matching the start tag for which this call was made is
19153  * handled by the previous parser (which is given its own user_data)
19154  * which is why g_markup_parse_context_pop() is provided to allow "one
19155  * last access" to the @user_data provided to this function. In the
19156  * case of error, the @user_data provided here is passed directly to
19157  * the error callback of the subparser and g_markup_parse_context_pop()
19158  * should not be called. In either case, if @user_data was allocated
19159  * then it ought to be freed from both of these locations.
19160  *
19161  * This function is not intended to be directly called by users
19162  * interested in invoking subparsers. Instead, it is intended to be
19163  * used by the subparsers themselves to implement a higher-level
19164  * interface.
19165  *
19166  * As an example, see the following implementation of a simple
19167  * parser that counts the number of tags encountered.
19168  *
19169  * |[
19170  * typedef struct
19171  * {
19172  *   gint tag_count;
19173  * } CounterData;
19174  *
19175  * static void
19176  * counter_start_element (GMarkupParseContext  *context,
19177  *                        const gchar          *element_name,
19178  *                        const gchar         **attribute_names,
19179  *                        const gchar         **attribute_values,
19180  *                        gpointer              user_data,
19181  *                        GError              **error)
19182  * {
19183  *   CounterData *data = user_data;
19184  *
19185  *   data->tag_count++;
19186  * }
19187  *
19188  * static void
19189  * counter_error (GMarkupParseContext *context,
19190  *                GError              *error,
19191  *                gpointer             user_data)
19192  * {
19193  *   CounterData *data = user_data;
19194  *
19195  *   g_slice_free (CounterData, data);
19196  * }
19197  *
19198  * static GMarkupParser counter_subparser =
19199  * {
19200  *   counter_start_element,
19201  *   NULL,
19202  *   NULL,
19203  *   NULL,
19204  *   counter_error
19205  * };
19206  * ]|
19207  *
19208  * In order to allow this parser to be easily used as a subparser, the
19209  * following interface is provided:
19210  *
19211  * |[
19212  * void
19213  * start_counting (GMarkupParseContext *context)
19214  * {
19215  *   CounterData *data = g_slice_new (CounterData);
19216  *
19217  *   data->tag_count = 0;
19218  *   g_markup_parse_context_push (context, &counter_subparser, data);
19219  * }
19220  *
19221  * gint
19222  * end_counting (GMarkupParseContext *context)
19223  * {
19224  *   CounterData *data = g_markup_parse_context_pop (context);
19225  *   int result;
19226  *
19227  *   result = data->tag_count;
19228  *   g_slice_free (CounterData, data);
19229  *
19230  *   return result;
19231  * }
19232  * ]|
19233  *
19234  * The subparser would then be used as follows:
19235  *
19236  * |[
19237  * static void start_element (context, element_name, ...)
19238  * {
19239  *   if (strcmp (element_name, "count-these") == 0)
19240  *     start_counting (context);
19241  *
19242  *   /&ast; else, handle other tags... &ast;/
19243  * }
19244  *
19245  * static void end_element (context, element_name, ...)
19246  * {
19247  *   if (strcmp (element_name, "count-these") == 0)
19248  *     g_print ("Counted %d tags\n", end_counting (context));
19249  *
19250  *   /&ast; else, handle other tags... &ast;/
19251  * }
19252  * ]|
19253  *
19254  * Since: 2.18
19255  */
19256
19257
19258 /**
19259  * g_markup_printf_escaped:
19260  * @format: printf() style format string
19261  * @...: the arguments to insert in the format string
19262  *
19263  * Formats arguments according to @format, escaping
19264  * all string and character arguments in the fashion
19265  * of g_markup_escape_text(). This is useful when you
19266  * want to insert literal strings into XML-style markup
19267  * output, without having to worry that the strings
19268  * might themselves contain markup.
19269  *
19270  * |[
19271  * const char *store = "Fortnum &amp; Mason";
19272  * const char *item = "Tea";
19273  * char *output;
19274  * &nbsp;
19275  * output = g_markup_printf_escaped ("&lt;purchase&gt;"
19276  *                                   "&lt;store&gt;&percnt;s&lt;/store&gt;"
19277  *                                   "&lt;item&gt;&percnt;s&lt;/item&gt;"
19278  *                                   "&lt;/purchase&gt;",
19279  *                                   store, item);
19280  * ]|
19281  *
19282  * Returns: newly allocated result from formatting operation. Free with g_free().
19283  * Since: 2.4
19284  */
19285
19286
19287 /**
19288  * g_markup_vprintf_escaped:
19289  * @format: printf() style format string
19290  * @args: variable argument list, similar to vprintf()
19291  *
19292  * Formats the data in @args according to @format, escaping
19293  * all string and character arguments in the fashion
19294  * of g_markup_escape_text(). See g_markup_printf_escaped().
19295  *
19296  * Returns: newly allocated result from formatting operation. Free with g_free().
19297  * Since: 2.4
19298  */
19299
19300
19301 /**
19302  * g_match_info_expand_references:
19303  * @match_info: (allow-none): a #GMatchInfo or %NULL
19304  * @string_to_expand: the string to expand
19305  * @error: location to store the error occurring, or %NULL to ignore errors
19306  *
19307  * Returns a new string containing the text in @string_to_expand with
19308  * references and escape sequences expanded. References refer to the last
19309  * match done with @string against @regex and have the same syntax used by
19310  * g_regex_replace().
19311  *
19312  * The @string_to_expand must be UTF-8 encoded even if #G_REGEX_RAW was
19313  * passed to g_regex_new().
19314  *
19315  * The backreferences are extracted from the string passed to the match
19316  * function, so you cannot call this function after freeing the string.
19317  *
19318  * @match_info may be %NULL in which case @string_to_expand must not
19319  * contain references. For instance "foo\n" does not refer to an actual
19320  * pattern and '\n' merely will be replaced with \n character,
19321  * while to expand "\0" (whole match) one needs the result of a match.
19322  * Use g_regex_check_replacement() to find out whether @string_to_expand
19323  * contains references.
19324  *
19325  * Returns: (allow-none): the expanded string, or %NULL if an error occurred
19326  * Since: 2.14
19327  */
19328
19329
19330 /**
19331  * g_match_info_fetch:
19332  * @match_info: #GMatchInfo structure
19333  * @match_num: number of the sub expression
19334  *
19335  * Retrieves the text matching the @match_num<!-- -->'th capturing
19336  * parentheses. 0 is the full text of the match, 1 is the first paren
19337  * set, 2 the second, and so on.
19338  *
19339  * If @match_num is a valid sub pattern but it didn't match anything
19340  * (e.g. sub pattern 1, matching "b" against "(a)?b") then an empty
19341  * string is returned.
19342  *
19343  * If the match was obtained using the DFA algorithm, that is using
19344  * g_regex_match_all() or g_regex_match_all_full(), the retrieved
19345  * string is not that of a set of parentheses but that of a matched
19346  * substring. Substrings are matched in reverse order of length, so
19347  * 0 is the longest match.
19348  *
19349  * The string is fetched from the string passed to the match function,
19350  * so you cannot call this function after freeing the string.
19351  *
19352  * Returns: (allow-none): The matched substring, or %NULL if an error occurred. You have to free the string yourself
19353  * Since: 2.14
19354  */
19355
19356
19357 /**
19358  * g_match_info_fetch_all:
19359  * @match_info: a #GMatchInfo structure
19360  *
19361  * Bundles up pointers to each of the matching substrings from a match
19362  * and stores them in an array of gchar pointers. The first element in
19363  * the returned array is the match number 0, i.e. the entire matched
19364  * text.
19365  *
19366  * If a sub pattern didn't match anything (e.g. sub pattern 1, matching
19367  * "b" against "(a)?b") then an empty string is inserted.
19368  *
19369  * If the last match was obtained using the DFA algorithm, that is using
19370  * g_regex_match_all() or g_regex_match_all_full(), the retrieved
19371  * strings are not that matched by sets of parentheses but that of the
19372  * matched substring. Substrings are matched in reverse order of length,
19373  * so the first one is the longest match.
19374  *
19375  * The strings are fetched from the string passed to the match function,
19376  * so you cannot call this function after freeing the string.
19377  *
19378  * 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
19379  * Since: 2.14
19380  */
19381
19382
19383 /**
19384  * g_match_info_fetch_named:
19385  * @match_info: #GMatchInfo structure
19386  * @name: name of the subexpression
19387  *
19388  * Retrieves the text matching the capturing parentheses named @name.
19389  *
19390  * If @name is a valid sub pattern name but it didn't match anything
19391  * (e.g. sub pattern "X", matching "b" against "(?P&lt;X&gt;a)?b")
19392  * then an empty string is returned.
19393  *
19394  * The string is fetched from the string passed to the match function,
19395  * so you cannot call this function after freeing the string.
19396  *
19397  * Returns: (allow-none): The matched substring, or %NULL if an error occurred. You have to free the string yourself
19398  * Since: 2.14
19399  */
19400
19401
19402 /**
19403  * g_match_info_fetch_named_pos:
19404  * @match_info: #GMatchInfo structure
19405  * @name: name of the subexpression
19406  * @start_pos: (out) (allow-none): pointer to location where to store the start position, or %NULL
19407  * @end_pos: (out) (allow-none): pointer to location where to store the end position, or %NULL
19408  *
19409  * Retrieves the position in bytes of the capturing parentheses named @name.
19410  *
19411  * If @name is a valid sub pattern name but it didn't match anything
19412  * (e.g. sub pattern "X", matching "b" against "(?P&lt;X&gt;a)?b")
19413  * then @start_pos and @end_pos are set to -1 and %TRUE is returned.
19414  *
19415  * Returns: %TRUE if the position was fetched, %FALSE otherwise. If the position cannot be fetched, @start_pos and @end_pos are left unchanged.
19416  * Since: 2.14
19417  */
19418
19419
19420 /**
19421  * g_match_info_fetch_pos:
19422  * @match_info: #GMatchInfo structure
19423  * @match_num: number of the sub expression
19424  * @start_pos: (out) (allow-none): pointer to location where to store the start position, or %NULL
19425  * @end_pos: (out) (allow-none): pointer to location where to store the end position, or %NULL
19426  *
19427  * Retrieves the position in bytes of the @match_num<!-- -->'th capturing
19428  * parentheses. 0 is the full text of the match, 1 is the first
19429  * paren set, 2 the second, and so on.
19430  *
19431  * If @match_num is a valid sub pattern but it didn't match anything
19432  * (e.g. sub pattern 1, matching "b" against "(a)?b") then @start_pos
19433  * and @end_pos are set to -1 and %TRUE is returned.
19434  *
19435  * If the match was obtained using the DFA algorithm, that is using
19436  * g_regex_match_all() or g_regex_match_all_full(), the retrieved
19437  * position is not that of a set of parentheses but that of a matched
19438  * substring. Substrings are matched in reverse order of length, so
19439  * 0 is the longest match.
19440  *
19441  * Returns: %TRUE if the position was fetched, %FALSE otherwise. If the position cannot be fetched, @start_pos and @end_pos are left unchanged
19442  * Since: 2.14
19443  */
19444
19445
19446 /**
19447  * g_match_info_free:
19448  * @match_info: (allow-none): a #GMatchInfo, or %NULL
19449  *
19450  * If @match_info is not %NULL, calls g_match_info_unref(); otherwise does
19451  * nothing.
19452  *
19453  * Since: 2.14
19454  */
19455
19456
19457 /**
19458  * g_match_info_get_match_count:
19459  * @match_info: a #GMatchInfo structure
19460  *
19461  * Retrieves the number of matched substrings (including substring 0,
19462  * that is the whole matched text), so 1 is returned if the pattern
19463  * has no substrings in it and 0 is returned if the match failed.
19464  *
19465  * If the last match was obtained using the DFA algorithm, that is
19466  * using g_regex_match_all() or g_regex_match_all_full(), the retrieved
19467  * count is not that of the number of capturing parentheses but that of
19468  * the number of matched substrings.
19469  *
19470  * Returns: Number of matched substrings, or -1 if an error occurred
19471  * Since: 2.14
19472  */
19473
19474
19475 /**
19476  * g_match_info_get_regex:
19477  * @match_info: a #GMatchInfo
19478  *
19479  * Returns #GRegex object used in @match_info. It belongs to Glib
19480  * and must not be freed. Use g_regex_ref() if you need to keep it
19481  * after you free @match_info object.
19482  *
19483  * Returns: #GRegex object used in @match_info
19484  * Since: 2.14
19485  */
19486
19487
19488 /**
19489  * g_match_info_get_string:
19490  * @match_info: a #GMatchInfo
19491  *
19492  * Returns the string searched with @match_info. This is the
19493  * string passed to g_regex_match() or g_regex_replace() so
19494  * you may not free it before calling this function.
19495  *
19496  * Returns: the string searched with @match_info
19497  * Since: 2.14
19498  */
19499
19500
19501 /**
19502  * g_match_info_is_partial_match:
19503  * @match_info: a #GMatchInfo structure
19504  *
19505  * Usually if the string passed to g_regex_match*() matches as far as
19506  * it goes, but is too short to match the entire pattern, %FALSE is
19507  * returned. There are circumstances where it might be helpful to
19508  * distinguish this case from other cases in which there is no match.
19509  *
19510  * Consider, for example, an application where a human is required to
19511  * type in data for a field with specific formatting requirements. An
19512  * example might be a date in the form ddmmmyy, defined by the pattern
19513  * "^\d?\d(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d\d$".
19514  * If the application sees the user’s keystrokes one by one, and can
19515  * check that what has been typed so far is potentially valid, it is
19516  * able to raise an error as soon as a mistake is made.
19517  *
19518  * GRegex supports the concept of partial matching by means of the
19519  * #G_REGEX_MATCH_PARTIAL_SOFT and #G_REGEX_MATCH_PARTIAL_HARD flags.
19520  * When they are used, the return code for
19521  * g_regex_match() or g_regex_match_full() is, as usual, %TRUE
19522  * for a complete match, %FALSE otherwise. But, when these functions
19523  * return %FALSE, you can check if the match was partial calling
19524  * g_match_info_is_partial_match().
19525  *
19526  * The difference between #G_REGEX_MATCH_PARTIAL_SOFT and
19527  * #G_REGEX_MATCH_PARTIAL_HARD is that when a partial match is encountered
19528  * with #G_REGEX_MATCH_PARTIAL_SOFT, matching continues to search for a
19529  * possible complete match, while with #G_REGEX_MATCH_PARTIAL_HARD matching
19530  * stops at the partial match.
19531  * When both #G_REGEX_MATCH_PARTIAL_SOFT and #G_REGEX_MATCH_PARTIAL_HARD
19532  * are set, the latter takes precedence.
19533  * See <ulink>man:pcrepartial</ulink> for more information on partial matching.
19534  *
19535  * Because of the way certain internal optimizations are implemented
19536  * the partial matching algorithm cannot be used with all patterns.
19537  * So repeated single characters such as "a{2,4}" and repeated single
19538  * meta-sequences such as "\d+" are not permitted if the maximum number
19539  * of occurrences is greater than one. Optional items such as "\d?"
19540  * (where the maximum is one) are permitted. Quantifiers with any values
19541  * are permitted after parentheses, so the invalid examples above can be
19542  * coded thus "(a){2,4}" and "(\d)+". If #G_REGEX_MATCH_PARTIAL or
19543  * #G_REGEX_MATCH_PARTIAL_HARD is set
19544  * for a pattern that does not conform to the restrictions, matching
19545  * functions return an error.
19546  *
19547  * Returns: %TRUE if the match was partial, %FALSE otherwise
19548  * Since: 2.14
19549  */
19550
19551
19552 /**
19553  * g_match_info_matches:
19554  * @match_info: a #GMatchInfo structure
19555  *
19556  * Returns whether the previous match operation succeeded.
19557  *
19558  * Returns: %TRUE if the previous match operation succeeded, %FALSE otherwise
19559  * Since: 2.14
19560  */
19561
19562
19563 /**
19564  * g_match_info_next:
19565  * @match_info: a #GMatchInfo structure
19566  * @error: location to store the error occurring, or %NULL to ignore errors
19567  *
19568  * Scans for the next match using the same parameters of the previous
19569  * call to g_regex_match_full() or g_regex_match() that returned
19570  * @match_info.
19571  *
19572  * The match is done on the string passed to the match function, so you
19573  * cannot free it before calling this function.
19574  *
19575  * Returns: %TRUE is the string matched, %FALSE otherwise
19576  * Since: 2.14
19577  */
19578
19579
19580 /**
19581  * g_match_info_ref:
19582  * @match_info: a #GMatchInfo
19583  *
19584  * Increases reference count of @match_info by 1.
19585  *
19586  * Returns: @match_info
19587  * Since: 2.30
19588  */
19589
19590
19591 /**
19592  * g_match_info_unref:
19593  * @match_info: a #GMatchInfo
19594  *
19595  * Decreases reference count of @match_info by 1. When reference count drops
19596  * to zero, it frees all the memory associated with the match_info structure.
19597  *
19598  * Since: 2.30
19599  */
19600
19601
19602 /**
19603  * g_mem_gc_friendly:
19604  *
19605  * This variable is %TRUE if the <envar>G_DEBUG</envar> environment variable
19606  * includes the key <literal>gc-friendly</literal>.
19607  */
19608
19609
19610 /**
19611  * g_mem_is_system_malloc:
19612  *
19613  * Checks whether the allocator used by g_malloc() is the system's
19614  * malloc implementation. If it returns %TRUE memory allocated with
19615  * malloc() can be used interchangeable with memory allocated using g_malloc().
19616  * This function is useful for avoiding an extra copy of allocated memory returned
19617  * by a non-GLib-based API.
19618  *
19619  * A different allocator can be set using g_mem_set_vtable().
19620  *
19621  * Returns: if %TRUE, malloc() and g_malloc() can be mixed.
19622  */
19623
19624
19625 /**
19626  * g_mem_profile:
19627  *
19628  * Outputs a summary of memory usage.
19629  *
19630  * It outputs the frequency of allocations of different sizes,
19631  * the total number of bytes which have been allocated,
19632  * the total number of bytes which have been freed,
19633  * and the difference between the previous two values, i.e. the number of bytes
19634  * still in use.
19635  *
19636  * Note that this function will not output anything unless you have
19637  * previously installed the #glib_mem_profiler_table with g_mem_set_vtable().
19638  */
19639
19640
19641 /**
19642  * g_mem_set_vtable:
19643  * @vtable: table of memory allocation routines.
19644  *
19645  * Sets the #GMemVTable to use for memory allocation. You can use this to provide
19646  * custom memory allocation routines. <emphasis>This function must be called
19647  * before using any other GLib functions.</emphasis> The @vtable only needs to
19648  * provide malloc(), realloc(), and free() functions; GLib can provide default
19649  * implementations of the others. The malloc() and realloc() implementations
19650  * should return %NULL on failure, GLib will handle error-checking for you.
19651  * @vtable is copied, so need not persist after this function has been called.
19652  */
19653
19654
19655 /**
19656  * g_memdup:
19657  * @mem: the memory to copy.
19658  * @byte_size: the number of bytes to copy.
19659  *
19660  * Allocates @byte_size bytes of memory, and copies @byte_size bytes into it
19661  * from @mem. If @mem is %NULL it returns %NULL.
19662  *
19663  * Returns: a pointer to the newly-allocated copy of the memory, or %NULL if @mem is %NULL.
19664  */
19665
19666
19667 /**
19668  * g_memmove:
19669  * @dest: the destination address to copy the bytes to.
19670  * @src: the source address to copy the bytes from.
19671  * @len: the number of bytes to copy.
19672  *
19673  * Copies a block of memory @len bytes long, from @src to @dest.
19674  * The source and destination areas may overlap.
19675  *
19676  * In order to use this function, you must include
19677  * <filename>string.h</filename> yourself, because this macro will
19678  * typically simply resolve to memmove() and GLib does not include
19679  * <filename>string.h</filename> for you.
19680  */
19681
19682
19683 /**
19684  * g_message:
19685  * @...: format string, followed by parameters to insert into the format string (as with printf())
19686  *
19687  * A convenience function/macro to log a normal message.
19688  */
19689
19690
19691 /**
19692  * g_mkdir:
19693  * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows)
19694  * @mode: permissions to use for the newly created directory
19695  *
19696  * A wrapper for the POSIX mkdir() function. The mkdir() function
19697  * attempts to create a directory with the given name and permissions.
19698  * The mode argument is ignored on Windows.
19699  *
19700  * See your C library manual for more details about mkdir().
19701  *
19702  * Returns: 0 if the directory was successfully created, -1 if an error occurred
19703  * Since: 2.6
19704  */
19705
19706
19707 /**
19708  * g_mkdir_with_parents:
19709  * @pathname: a pathname in the GLib file name encoding
19710  * @mode: permissions to use for newly created directories
19711  *
19712  * Create a directory if it doesn't already exist. Create intermediate
19713  * parent directories as needed, too.
19714  *
19715  * Returns: 0 if the directory already exists, or was successfully created. Returns -1 if an error occurred, with errno set.
19716  * Since: 2.8
19717  */
19718
19719
19720 /**
19721  * g_mkdtemp:
19722  * @tmpl: (type filename): template directory name
19723  *
19724  * Creates a temporary directory. See the mkdtemp() documentation
19725  * on most UNIX-like systems.
19726  *
19727  * The parameter is a string that should follow the rules for
19728  * mkdtemp() templates, i.e. contain the string "XXXXXX".
19729  * g_mkdtemp() is slightly more flexible than mkdtemp() in that the
19730  * sequence does not have to occur at the very end of the template
19731  * and you can pass a @mode and additional @flags. The X string will
19732  * be modified to form the name of a directory that didn't exist.
19733  * The string should be in the GLib file name encoding. Most importantly,
19734  * on Windows it should be in UTF-8.
19735  *
19736  * 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.
19737  * Since: 2.30
19738  */
19739
19740
19741 /**
19742  * g_mkdtemp_full:
19743  * @tmpl: (type filename): template directory name
19744  * @mode: permissions to create the temporary directory with
19745  *
19746  * Creates a temporary directory. See the mkdtemp() documentation
19747  * on most UNIX-like systems.
19748  *
19749  * The parameter is a string that should follow the rules for
19750  * mkdtemp() templates, i.e. contain the string "XXXXXX".
19751  * g_mkdtemp() is slightly more flexible than mkdtemp() in that the
19752  * sequence does not have to occur at the very end of the template
19753  * and you can pass a @mode. The X string will be modified to form
19754  * the name of a directory that didn't exist. The string should be
19755  * in the GLib file name encoding. Most importantly, on Windows it
19756  * should be in UTF-8.
19757  *
19758  * 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.
19759  * Since: 2.30
19760  */
19761
19762
19763 /**
19764  * g_mkstemp:
19765  * @tmpl: (type filename): template filename
19766  *
19767  * Opens a temporary file. See the mkstemp() documentation
19768  * on most UNIX-like systems.
19769  *
19770  * The parameter is a string that should follow the rules for
19771  * mkstemp() templates, i.e. contain the string "XXXXXX".
19772  * g_mkstemp() is slightly more flexible than mkstemp() in that the
19773  * sequence does not have to occur at the very end of the template.
19774  * The X string will be modified to form the name of a file that
19775  * didn't exist. The string should be in the GLib file name encoding.
19776  * Most importantly, on Windows it should be in UTF-8.
19777  *
19778  * 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.
19779  */
19780
19781
19782 /**
19783  * g_mkstemp_full:
19784  * @tmpl: (type filename): template filename
19785  * @flags: flags to pass to an open() call in addition to O_EXCL and O_CREAT, which are passed automatically
19786  * @mode: permissions to create the temporary file with
19787  *
19788  * Opens a temporary file. See the mkstemp() documentation
19789  * on most UNIX-like systems.
19790  *
19791  * The parameter is a string that should follow the rules for
19792  * mkstemp() templates, i.e. contain the string "XXXXXX".
19793  * g_mkstemp_full() is slightly more flexible than mkstemp()
19794  * in that the sequence does not have to occur at the very end of the
19795  * template and you can pass a @mode and additional @flags. The X
19796  * string will be modified to form the name of a file that didn't exist.
19797  * The string should be in the GLib file name encoding. Most importantly,
19798  * on Windows it should be in UTF-8.
19799  *
19800  * 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.
19801  * Since: 2.22
19802  */
19803
19804
19805 /**
19806  * g_mutex_clear:
19807  * @mutex: an initialized #GMutex
19808  *
19809  * Frees the resources allocated to a mutex with g_mutex_init().
19810  *
19811  * This function should not be used with a #GMutex that has been
19812  * statically allocated.
19813  *
19814  * Calling g_mutex_clear() on a locked mutex leads to undefined
19815  * behaviour.
19816  *
19817  * Sine: 2.32
19818  */
19819
19820
19821 /**
19822  * g_mutex_init:
19823  * @mutex: an uninitialized #GMutex
19824  *
19825  * Initializes a #GMutex so that it can be used.
19826  *
19827  * This function is useful to initialize a mutex that has been
19828  * allocated on the stack, or as part of a larger structure.
19829  * It is not necessary to initialize a mutex that has been
19830  * statically allocated.
19831  *
19832  * |[
19833  *   typedef struct {
19834  *     GMutex m;
19835  *     ...
19836  *   } Blob;
19837  *
19838  * Blob *b;
19839  *
19840  * b = g_new (Blob, 1);
19841  * g_mutex_init (&b->m);
19842  * ]|
19843  *
19844  * To undo the effect of g_mutex_init() when a mutex is no longer
19845  * needed, use g_mutex_clear().
19846  *
19847  * Calling g_mutex_init() on an already initialized #GMutex leads
19848  * to undefined behaviour.
19849  *
19850  * Since: 2.32
19851  */
19852
19853
19854 /**
19855  * g_mutex_lock:
19856  * @mutex: a #GMutex
19857  *
19858  * Locks @mutex. If @mutex is already locked by another thread, the
19859  * current thread will block until @mutex is unlocked by the other
19860  * thread.
19861  *
19862  * <note>#GMutex is neither guaranteed to be recursive nor to be
19863  * non-recursive.  As such, calling g_mutex_lock() on a #GMutex that has
19864  * already been locked by the same thread results in undefined behaviour
19865  * (including but not limited to deadlocks).</note>
19866  */
19867
19868
19869 /**
19870  * g_mutex_trylock:
19871  * @mutex: a #GMutex
19872  *
19873  * Tries to lock @mutex. If @mutex is already locked by another thread,
19874  * it immediately returns %FALSE. Otherwise it locks @mutex and returns
19875  * %TRUE.
19876  *
19877  * <note>#GMutex is neither guaranteed to be recursive nor to be
19878  * non-recursive.  As such, calling g_mutex_lock() on a #GMutex that has
19879  * already been locked by the same thread results in undefined behaviour
19880  * (including but not limited to deadlocks or arbitrary return values).
19881  * </note>
19882  *
19883  * Returns: %TRUE if @mutex could be locked
19884  */
19885
19886
19887 /**
19888  * g_mutex_unlock:
19889  * @mutex: a #GMutex
19890  *
19891  * Unlocks @mutex. If another thread is blocked in a g_mutex_lock()
19892  * call for @mutex, it will become unblocked and can lock @mutex itself.
19893  *
19894  * Calling g_mutex_unlock() on a mutex that is not locked by the
19895  * current thread leads to undefined behaviour.
19896  */
19897
19898
19899 /**
19900  * g_node_child_index:
19901  * @node: a #GNode
19902  * @data: the data to find
19903  *
19904  * Gets the position of the first child of a #GNode
19905  * which contains the given data.
19906  *
19907  * Returns: the index of the child of @node which contains @data, or -1 if the data is not found
19908  */
19909
19910
19911 /**
19912  * g_node_child_position:
19913  * @node: a #GNode
19914  * @child: a child of @node
19915  *
19916  * Gets the position of a #GNode with respect to its siblings.
19917  * @child must be a child of @node. The first child is numbered 0,
19918  * the second 1, and so on.
19919  *
19920  * Returns: the position of @child with respect to its siblings
19921  */
19922
19923
19924 /**
19925  * g_node_children_foreach:
19926  * @node: a #GNode
19927  * @flags: which types of children are to be visited, one of %G_TRAVERSE_ALL, %G_TRAVERSE_LEAVES and %G_TRAVERSE_NON_LEAVES
19928  * @func: the function to call for each visited node
19929  * @data: user data to pass to the function
19930  *
19931  * Calls a function for each of the children of a #GNode.
19932  * Note that it doesn't descend beneath the child nodes.
19933  */
19934
19935
19936 /**
19937  * g_node_copy:
19938  * @node: a #GNode
19939  *
19940  * Recursively copies a #GNode (but does not deep-copy the data inside the
19941  * nodes, see g_node_copy_deep() if you need that).
19942  *
19943  * Returns: a new #GNode containing the same data pointers
19944  */
19945
19946
19947 /**
19948  * g_node_copy_deep:
19949  * @node: a #GNode
19950  * @copy_func: the function which is called to copy the data inside each node, or %NULL to use the original data.
19951  * @data: data to pass to @copy_func
19952  *
19953  * Recursively copies a #GNode and its data.
19954  *
19955  * Returns: a new #GNode containing copies of the data in @node.
19956  * Since: 2.4
19957  */
19958
19959
19960 /**
19961  * g_node_depth:
19962  * @node: a #GNode
19963  *
19964  * Gets the depth of a #GNode.
19965  *
19966  * If @node is %NULL the depth is 0. The root node has a depth of 1.
19967  * For the children of the root node the depth is 2. And so on.
19968  *
19969  * Returns: the depth of the #GNode
19970  */
19971
19972
19973 /**
19974  * g_node_destroy:
19975  * @root: the root of the tree/subtree to destroy
19976  *
19977  * Removes @root and its children from the tree, freeing any memory
19978  * allocated.
19979  */
19980
19981
19982 /**
19983  * g_node_find:
19984  * @root: the root #GNode of the tree to search
19985  * @order: the order in which nodes are visited - %G_IN_ORDER, %G_PRE_ORDER, %G_POST_ORDER, or %G_LEVEL_ORDER
19986  * @flags: which types of children are to be searched, one of %G_TRAVERSE_ALL, %G_TRAVERSE_LEAVES and %G_TRAVERSE_NON_LEAVES
19987  * @data: the data to find
19988  *
19989  * Finds a #GNode in a tree.
19990  *
19991  * Returns: the found #GNode, or %NULL if the data is not found
19992  */
19993
19994
19995 /**
19996  * g_node_find_child:
19997  * @node: a #GNode
19998  * @flags: which types of children are to be searched, one of %G_TRAVERSE_ALL, %G_TRAVERSE_LEAVES and %G_TRAVERSE_NON_LEAVES
19999  * @data: the data to find
20000  *
20001  * Finds the first child of a #GNode with the given data.
20002  *
20003  * Returns: the found child #GNode, or %NULL if the data is not found
20004  */
20005
20006
20007 /**
20008  * g_node_first_sibling:
20009  * @node: a #GNode
20010  *
20011  * Gets the first sibling of a #GNode.
20012  * This could possibly be the node itself.
20013  *
20014  * Returns: the first sibling of @node
20015  */
20016
20017
20018 /**
20019  * g_node_get_root:
20020  * @node: a #GNode
20021  *
20022  * Gets the root of a tree.
20023  *
20024  * Returns: the root of the tree
20025  */
20026
20027
20028 /**
20029  * g_node_insert:
20030  * @parent: the #GNode to place @node under
20031  * @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
20032  * @node: the #GNode to insert
20033  *
20034  * Inserts a #GNode beneath the parent at the given position.
20035  *
20036  * Returns: the inserted #GNode
20037  */
20038
20039
20040 /**
20041  * g_node_insert_after:
20042  * @parent: the #GNode to place @node under
20043  * @sibling: the sibling #GNode to place @node after. If sibling is %NULL, the node is inserted as the first child of @parent.
20044  * @node: the #GNode to insert
20045  *
20046  * Inserts a #GNode beneath the parent after the given sibling.
20047  *
20048  * Returns: the inserted #GNode
20049  */
20050
20051
20052 /**
20053  * g_node_insert_before:
20054  * @parent: the #GNode to place @node under
20055  * @sibling: the sibling #GNode to place @node before. If sibling is %NULL, the node is inserted as the last child of @parent.
20056  * @node: the #GNode to insert
20057  *
20058  * Inserts a #GNode beneath the parent before the given sibling.
20059  *
20060  * Returns: the inserted #GNode
20061  */
20062
20063
20064 /**
20065  * g_node_is_ancestor:
20066  * @node: a #GNode
20067  * @descendant: a #GNode
20068  *
20069  * Returns %TRUE if @node is an ancestor of @descendant.
20070  * This is true if node is the parent of @descendant,
20071  * or if node is the grandparent of @descendant etc.
20072  *
20073  * Returns: %TRUE if @node is an ancestor of @descendant
20074  */
20075
20076
20077 /**
20078  * g_node_last_child:
20079  * @node: a #GNode (must not be %NULL)
20080  *
20081  * Gets the last child of a #GNode.
20082  *
20083  * Returns: the last child of @node, or %NULL if @node has no children
20084  */
20085
20086
20087 /**
20088  * g_node_last_sibling:
20089  * @node: a #GNode
20090  *
20091  * Gets the last sibling of a #GNode.
20092  * This could possibly be the node itself.
20093  *
20094  * Returns: the last sibling of @node
20095  */
20096
20097
20098 /**
20099  * g_node_max_height:
20100  * @root: a #GNode
20101  *
20102  * Gets the maximum height of all branches beneath a #GNode.
20103  * This is the maximum distance from the #GNode to all leaf nodes.
20104  *
20105  * If @root is %NULL, 0 is returned. If @root has no children,
20106  * 1 is returned. If @root has children, 2 is returned. And so on.
20107  *
20108  * Returns: the maximum height of the tree beneath @root
20109  */
20110
20111
20112 /**
20113  * g_node_n_children:
20114  * @node: a #GNode
20115  *
20116  * Gets the number of children of a #GNode.
20117  *
20118  * Returns: the number of children of @node
20119  */
20120
20121
20122 /**
20123  * g_node_n_nodes:
20124  * @root: a #GNode
20125  * @flags: which types of children are to be counted, one of %G_TRAVERSE_ALL, %G_TRAVERSE_LEAVES and %G_TRAVERSE_NON_LEAVES
20126  *
20127  * Gets the number of nodes in a tree.
20128  *
20129  * Returns: the number of nodes in the tree
20130  */
20131
20132
20133 /**
20134  * g_node_new:
20135  * @data: the data of the new node
20136  *
20137  * Creates a new #GNode containing the given data.
20138  * Used to create the first node in a tree.
20139  *
20140  * Returns: a new #GNode
20141  */
20142
20143
20144 /**
20145  * g_node_nth_child:
20146  * @node: a #GNode
20147  * @n: the index of the desired child
20148  *
20149  * Gets a child of a #GNode, using the given index.
20150  * The first child is at index 0. If the index is
20151  * too big, %NULL is returned.
20152  *
20153  * Returns: the child of @node at index @n
20154  */
20155
20156
20157 /**
20158  * g_node_prepend:
20159  * @parent: the #GNode to place the new #GNode under
20160  * @node: the #GNode to insert
20161  *
20162  * Inserts a #GNode as the first child of the given parent.
20163  *
20164  * Returns: the inserted #GNode
20165  */
20166
20167
20168 /**
20169  * g_node_reverse_children:
20170  * @node: a #GNode.
20171  *
20172  * Reverses the order of the children of a #GNode.
20173  * (It doesn't change the order of the grandchildren.)
20174  */
20175
20176
20177 /**
20178  * g_node_traverse:
20179  * @root: the root #GNode of the tree to traverse
20180  * @order: the order in which nodes are visited - %G_IN_ORDER, %G_PRE_ORDER, %G_POST_ORDER, or %G_LEVEL_ORDER.
20181  * @flags: which types of children are to be visited, one of %G_TRAVERSE_ALL, %G_TRAVERSE_LEAVES and %G_TRAVERSE_NON_LEAVES
20182  * @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.
20183  * @func: the function to call for each visited #GNode
20184  * @data: user data to pass to the function
20185  *
20186  * Traverses a tree starting at the given root #GNode.
20187  * It calls the given function for each node visited.
20188  * The traversal can be halted at any point by returning %TRUE from @func.
20189  */
20190
20191
20192 /**
20193  * g_node_unlink:
20194  * @node: the #GNode to unlink, which becomes the root of a new tree
20195  *
20196  * Unlinks a #GNode from a tree, resulting in two separate trees.
20197  */
20198
20199
20200 /**
20201  * g_ntohl:
20202  * @val: a 32-bit integer value in network byte order
20203  *
20204  * Converts a 32-bit integer value from network to host byte order.
20205  *
20206  * Returns: @val converted to host byte order.
20207  */
20208
20209
20210 /**
20211  * g_ntohs:
20212  * @val: a 16-bit integer value in network byte order
20213  *
20214  * Converts a 16-bit integer value from network to host byte order.
20215  *
20216  * Returns: @val converted to host byte order
20217  */
20218
20219
20220 /**
20221  * g_nullify_pointer:
20222  * @nullify_location: the memory address of the pointer.
20223  *
20224  * Set the pointer at the specified location to %NULL.
20225  */
20226
20227
20228 /**
20229  * g_on_error_query:
20230  * @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)
20231  *
20232  * Prompts the user with
20233  * <computeroutput>[E]xit, [H]alt, show [S]tack trace or [P]roceed</computeroutput>.
20234  * This function is intended to be used for debugging use only.
20235  * The following example shows how it can be used together with
20236  * the g_log() functions.
20237  *
20238  * |[
20239  * &num;include &lt;glib.h&gt;
20240  *
20241  * static void
20242  * log_handler (const gchar   *log_domain,
20243  *              GLogLevelFlags log_level,
20244  *              const gchar   *message,
20245  *              gpointer       user_data)
20246  * {
20247  *   g_log_default_handler (log_domain, log_level, message, user_data);
20248  *
20249  *   g_on_error_query (MY_PROGRAM_NAME);
20250  * }
20251  *
20252  * int
20253  * main (int argc, char *argv[])
20254  * {
20255  *   g_log_set_handler (MY_LOG_DOMAIN,
20256  *                      G_LOG_LEVEL_WARNING |
20257  *                      G_LOG_LEVEL_ERROR |
20258  *                      G_LOG_LEVEL_CRITICAL,
20259  *                      log_handler,
20260  *                      NULL);
20261  *   /&ast; ... &ast;/
20262  * ]|
20263  *
20264  * If [E]xit is selected, the application terminates with a call
20265  * to <literal>_exit(0)</literal>.
20266  *
20267  * If [S]tack trace is selected, g_on_error_stack_trace() is called.
20268  * This invokes <command>gdb</command>, which attaches to the current
20269  * process and shows a stack trace. The prompt is then shown again.
20270  *
20271  * If [P]roceed is selected, the function returns.
20272  *
20273  * This function may cause different actions on non-UNIX platforms.
20274  */
20275
20276
20277 /**
20278  * g_on_error_stack_trace:
20279  * @prg_name: the program name, needed by <command>gdb</command> for the [S]tack trace option.
20280  *
20281  * Invokes <command>gdb</command>, which attaches to the current
20282  * process and shows a stack trace. Called by g_on_error_query()
20283  * when the [S]tack trace option is selected. You can get the current
20284  * process's "program name" with g_get_prgname(), assuming that you
20285  * have called gtk_init() or gdk_init().
20286  *
20287  * This function may cause different actions on non-UNIX platforms.
20288  */
20289
20290
20291 /**
20292  * g_once:
20293  * @once: a #GOnce structure
20294  * @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().
20295  * @arg: data to be passed to @func
20296  *
20297  * The first call to this routine by a process with a given #GOnce
20298  * struct calls @func with the given argument. Thereafter, subsequent
20299  * calls to g_once()  with the same #GOnce struct do not call @func
20300  * again, but return the stored result of the first call. On return
20301  * from g_once(), the status of @once will be %G_ONCE_STATUS_READY.
20302  *
20303  * For example, a mutex or a thread-specific data key must be created
20304  * exactly once. In a threaded environment, calling g_once() ensures
20305  * that the initialization is serialized across multiple threads.
20306  *
20307  * Calling g_once() recursively on the same #GOnce struct in
20308  * @func will lead to a deadlock.
20309  *
20310  * |[
20311  *   gpointer
20312  *   get_debug_flags (void)
20313  *   {
20314  *     static GOnce my_once = G_ONCE_INIT;
20315  *
20316  *     g_once (&my_once, parse_debug_flags, NULL);
20317  *
20318  *     return my_once.retval;
20319  *   }
20320  * ]|
20321  *
20322  * Since: 2.4
20323  */
20324
20325
20326 /**
20327  * g_once_init_enter:
20328  * @location: location of a static initializable variable containing 0
20329  *
20330  * Function to be called when starting a critical initialization
20331  * section. The argument @location must point to a static
20332  * 0-initialized variable that will be set to a value other than 0 at
20333  * the end of the initialization section. In combination with
20334  * g_once_init_leave() and the unique address @value_location, it can
20335  * be ensured that an initialization section will be executed only once
20336  * during a program's life time, and that concurrent threads are
20337  * blocked until initialization completed. To be used in constructs
20338  * like this:
20339  *
20340  * |[
20341  *   static gsize initialization_value = 0;
20342  *
20343  *   if (g_once_init_enter (&amp;initialization_value))
20344  *     {
20345  *       gsize setup_value = 42; /&ast;* initialization code here *&ast;/
20346  *
20347  *       g_once_init_leave (&amp;initialization_value, setup_value);
20348  *     }
20349  *
20350  *   /&ast;* use initialization_value here *&ast;/
20351  * ]|
20352  *
20353  * Returns: %TRUE if the initialization section should be entered, %FALSE and blocks otherwise
20354  * Since: 2.14
20355  */
20356
20357
20358 /**
20359  * g_once_init_leave:
20360  * @location: location of a static initializable variable containing 0
20361  * @result: new non-0 value for *@value_location
20362  *
20363  * Counterpart to g_once_init_enter(). Expects a location of a static
20364  * 0-initialized initialization variable, and an initialization value
20365  * other than 0. Sets the variable to the initialization value, and
20366  * releases concurrent threads blocking in g_once_init_enter() on this
20367  * initialization variable.
20368  *
20369  * Since: 2.14
20370  */
20371
20372
20373 /**
20374  * g_open:
20375  * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows)
20376  * @flags: as in open()
20377  * @mode: as in open()
20378  *
20379  * A wrapper for the POSIX open() function. The open() function is
20380  * used to convert a pathname into a file descriptor.
20381  *
20382  * On POSIX systems file descriptors are implemented by the operating
20383  * system. On Windows, it's the C library that implements open() and
20384  * file descriptors. The actual Win32 API for opening files is quite
20385  * different, see MSDN documentation for CreateFile(). The Win32 API
20386  * uses file handles, which are more randomish integers, not small
20387  * integers like file descriptors.
20388  *
20389  * Because file descriptors are specific to the C library on Windows,
20390  * the file descriptor returned by this function makes sense only to
20391  * functions in the same C library. Thus if the GLib-using code uses a
20392  * different C library than GLib does, the file descriptor returned by
20393  * this function cannot be passed to C library functions like write()
20394  * or read().
20395  *
20396  * See your C library manual for more details about open().
20397  *
20398  * Returns: a new file descriptor, or -1 if an error occurred. The return value can be used exactly like the return value from open().
20399  * Since: 2.6
20400  */
20401
20402
20403 /**
20404  * g_option_context_add_group:
20405  * @context: a #GOptionContext
20406  * @group: the group to add
20407  *
20408  * Adds a #GOptionGroup to the @context, so that parsing with @context
20409  * will recognize the options in the group. Note that the group will
20410  * be freed together with the context when g_option_context_free() is
20411  * called, so you must not free the group yourself after adding it
20412  * to a context.
20413  *
20414  * Since: 2.6
20415  */
20416
20417
20418 /**
20419  * g_option_context_add_main_entries:
20420  * @context: a #GOptionContext
20421  * @entries: a %NULL-terminated array of #GOptionEntry<!-- -->s
20422  * @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
20423  *
20424  * A convenience function which creates a main group if it doesn't
20425  * exist, adds the @entries to it and sets the translation domain.
20426  *
20427  * Since: 2.6
20428  */
20429
20430
20431 /**
20432  * g_option_context_free:
20433  * @context: a #GOptionContext
20434  *
20435  * Frees context and all the groups which have been
20436  * added to it.
20437  *
20438  * Please note that parsed arguments need to be freed separately (see
20439  * #GOptionEntry).
20440  *
20441  * Since: 2.6
20442  */
20443
20444
20445 /**
20446  * g_option_context_get_description:
20447  * @context: a #GOptionContext
20448  *
20449  * Returns the description. See g_option_context_set_description().
20450  *
20451  * Returns: the description
20452  * Since: 2.12
20453  */
20454
20455
20456 /**
20457  * g_option_context_get_help:
20458  * @context: a #GOptionContext
20459  * @main_help: if %TRUE, only include the main group
20460  * @group: (allow-none): the #GOptionGroup to create help for, or %NULL
20461  *
20462  * Returns a formatted, translated help text for the given context.
20463  * To obtain the text produced by <option>--help</option>, call
20464  * <literal>g_option_context_get_help (context, TRUE, NULL)</literal>.
20465  * To obtain the text produced by <option>--help-all</option>, call
20466  * <literal>g_option_context_get_help (context, FALSE, NULL)</literal>.
20467  * To obtain the help text for an option group, call
20468  * <literal>g_option_context_get_help (context, FALSE, group)</literal>.
20469  *
20470  * Returns: A newly allocated string containing the help text
20471  * Since: 2.14
20472  */
20473
20474
20475 /**
20476  * g_option_context_get_help_enabled:
20477  * @context: a #GOptionContext
20478  *
20479  * Returns whether automatic <option>--help</option> generation
20480  * is turned on for @context. See g_option_context_set_help_enabled().
20481  *
20482  * Returns: %TRUE if automatic help generation is turned on.
20483  * Since: 2.6
20484  */
20485
20486
20487 /**
20488  * g_option_context_get_ignore_unknown_options:
20489  * @context: a #GOptionContext
20490  *
20491  * Returns whether unknown options are ignored or not. See
20492  * g_option_context_set_ignore_unknown_options().
20493  *
20494  * Returns: %TRUE if unknown options are ignored.
20495  * Since: 2.6
20496  */
20497
20498
20499 /**
20500  * g_option_context_get_main_group:
20501  * @context: a #GOptionContext
20502  *
20503  * Returns a pointer to the main group of @context.
20504  *
20505  * 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.
20506  * Since: 2.6
20507  */
20508
20509
20510 /**
20511  * g_option_context_get_summary:
20512  * @context: a #GOptionContext
20513  *
20514  * Returns the summary. See g_option_context_set_summary().
20515  *
20516  * Returns: the summary
20517  * Since: 2.12
20518  */
20519
20520
20521 /**
20522  * g_option_context_new:
20523  * @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>
20524  *
20525  * Creates a new option context.
20526  *
20527  * The @parameter_string can serve multiple purposes. It can be used
20528  * to add descriptions for "rest" arguments, which are not parsed by
20529  * the #GOptionContext, typically something like "FILES" or
20530  * "FILE1 FILE2...". If you are using #G_OPTION_REMAINING for
20531  * collecting "rest" arguments, GLib handles this automatically by
20532  * using the @arg_description of the corresponding #GOptionEntry in
20533  * the usage summary.
20534  *
20535  * Another usage is to give a short summary of the program
20536  * functionality, like " - frob the strings", which will be displayed
20537  * in the same line as the usage. For a longer description of the
20538  * program functionality that should be displayed as a paragraph
20539  * below the usage line, use g_option_context_set_summary().
20540  *
20541  * Note that the @parameter_string is translated using the
20542  * function set with g_option_context_set_translate_func(), so
20543  * it should normally be passed untranslated.
20544  *
20545  * Returns: a newly created #GOptionContext, which must be freed with g_option_context_free() after use.
20546  * Since: 2.6
20547  */
20548
20549
20550 /**
20551  * g_option_context_parse:
20552  * @context: a #GOptionContext
20553  * @argc: (inout) (allow-none): a pointer to the number of command line arguments
20554  * @argv: (inout) (array length=argc) (allow-none): a pointer to the array of command line arguments
20555  * @error: a return location for errors
20556  *
20557  * Parses the command line arguments, recognizing options
20558  * which have been added to @context. A side-effect of
20559  * calling this function is that g_set_prgname() will be
20560  * called.
20561  *
20562  * If the parsing is successful, any parsed arguments are
20563  * removed from the array and @argc and @argv are updated
20564  * accordingly. A '--' option is stripped from @argv
20565  * unless there are unparsed options before and after it,
20566  * or some of the options after it start with '-'. In case
20567  * of an error, @argc and @argv are left unmodified.
20568  *
20569  * If automatic <option>--help</option> support is enabled
20570  * (see g_option_context_set_help_enabled()), and the
20571  * @argv array contains one of the recognized help options,
20572  * this function will produce help output to stdout and
20573  * call <literal>exit (0)</literal>.
20574  *
20575  * Note that function depends on the
20576  * <link linkend="setlocale">current locale</link> for
20577  * automatic character set conversion of string and filename
20578  * arguments.
20579  *
20580  * Returns: %TRUE if the parsing was successful, %FALSE if an error occurred
20581  * Since: 2.6
20582  */
20583
20584
20585 /**
20586  * g_option_context_set_description:
20587  * @context: a #GOptionContext
20588  * @description: (allow-none): a string to be shown in <option>--help</option> output after the list of options, or %NULL
20589  *
20590  * Adds a string to be displayed in <option>--help</option> output
20591  * after the list of options. This text often includes a bug reporting
20592  * address.
20593  *
20594  * Note that the summary is translated (see
20595  * g_option_context_set_translate_func()).
20596  *
20597  * Since: 2.12
20598  */
20599
20600
20601 /**
20602  * g_option_context_set_help_enabled:
20603  * @context: a #GOptionContext
20604  * @help_enabled: %TRUE to enable <option>--help</option>, %FALSE to disable it
20605  *
20606  * Enables or disables automatic generation of <option>--help</option>
20607  * output. By default, g_option_context_parse() recognizes
20608  * <option>--help</option>, <option>-h</option>,
20609  * <option>-?</option>, <option>--help-all</option>
20610  * and <option>--help-</option><replaceable>groupname</replaceable> and creates
20611  * suitable output to stdout.
20612  *
20613  * Since: 2.6
20614  */
20615
20616
20617 /**
20618  * g_option_context_set_ignore_unknown_options:
20619  * @context: a #GOptionContext
20620  * @ignore_unknown: %TRUE to ignore unknown options, %FALSE to produce an error when unknown options are met
20621  *
20622  * Sets whether to ignore unknown options or not. If an argument is
20623  * ignored, it is left in the @argv array after parsing. By default,
20624  * g_option_context_parse() treats unknown options as error.
20625  *
20626  * This setting does not affect non-option arguments (i.e. arguments
20627  * which don't start with a dash). But note that GOption cannot reliably
20628  * determine whether a non-option belongs to a preceding unknown option.
20629  *
20630  * Since: 2.6
20631  */
20632
20633
20634 /**
20635  * g_option_context_set_main_group:
20636  * @context: a #GOptionContext
20637  * @group: the group to set as main group
20638  *
20639  * Sets a #GOptionGroup as main group of the @context.
20640  * This has the same effect as calling g_option_context_add_group(),
20641  * the only difference is that the options in the main group are
20642  * treated differently when generating <option>--help</option> output.
20643  *
20644  * Since: 2.6
20645  */
20646
20647
20648 /**
20649  * g_option_context_set_summary:
20650  * @context: a #GOptionContext
20651  * @summary: (allow-none): a string to be shown in <option>--help</option> output before the list of options, or %NULL
20652  *
20653  * Adds a string to be displayed in <option>--help</option> output
20654  * before the list of options. This is typically a summary of the
20655  * program functionality.
20656  *
20657  * Note that the summary is translated (see
20658  * g_option_context_set_translate_func() and
20659  * g_option_context_set_translation_domain()).
20660  *
20661  * Since: 2.12
20662  */
20663
20664
20665 /**
20666  * g_option_context_set_translate_func:
20667  * @context: a #GOptionContext
20668  * @func: (allow-none): the #GTranslateFunc, or %NULL
20669  * @data: (allow-none): user data to pass to @func, or %NULL
20670  * @destroy_notify: (allow-none): a function which gets called to free @data, or %NULL
20671  *
20672  * Sets the function which is used to translate the contexts
20673  * user-visible strings, for <option>--help</option> output.
20674  * If @func is %NULL, strings are not translated.
20675  *
20676  * Note that option groups have their own translation functions,
20677  * this function only affects the @parameter_string (see g_option_context_new()),
20678  * the summary (see g_option_context_set_summary()) and the description
20679  * (see g_option_context_set_description()).
20680  *
20681  * If you are using gettext(), you only need to set the translation
20682  * domain, see g_option_context_set_translation_domain().
20683  *
20684  * Since: 2.12
20685  */
20686
20687
20688 /**
20689  * g_option_context_set_translation_domain:
20690  * @context: a #GOptionContext
20691  * @domain: the domain to use
20692  *
20693  * A convenience function to use gettext() for translating
20694  * user-visible strings.
20695  *
20696  * Since: 2.12
20697  */
20698
20699
20700 /**
20701  * g_option_group_add_entries:
20702  * @group: a #GOptionGroup
20703  * @entries: a %NULL-terminated array of #GOptionEntry<!-- -->s
20704  *
20705  * Adds the options specified in @entries to @group.
20706  *
20707  * Since: 2.6
20708  */
20709
20710
20711 /**
20712  * g_option_group_free:
20713  * @group: a #GOptionGroup
20714  *
20715  * Frees a #GOptionGroup. Note that you must <emphasis>not</emphasis>
20716  * free groups which have been added to a #GOptionContext.
20717  *
20718  * Since: 2.6
20719  */
20720
20721
20722 /**
20723  * g_option_group_new:
20724  * @name: the name for the option group, this is used to provide help for the options in this group with <option>--help-</option>@name
20725  * @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
20726  * @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
20727  * @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
20728  * @destroy: (allow-none): a function that will be called to free @user_data, or %NULL
20729  *
20730  * Creates a new #GOptionGroup.
20731  *
20732  * Returns: a newly created option group. It should be added to a #GOptionContext or freed with g_option_group_free().
20733  * Since: 2.6
20734  */
20735
20736
20737 /**
20738  * g_option_group_set_error_hook:
20739  * @group: a #GOptionGroup
20740  * @error_func: a function to call when an error occurs
20741  *
20742  * Associates a function with @group which will be called
20743  * from g_option_context_parse() when an error occurs.
20744  *
20745  * Note that the user data to be passed to @error_func can be
20746  * specified when constructing the group with g_option_group_new().
20747  *
20748  * Since: 2.6
20749  */
20750
20751
20752 /**
20753  * g_option_group_set_parse_hooks:
20754  * @group: a #GOptionGroup
20755  * @pre_parse_func: (allow-none): a function to call before parsing, or %NULL
20756  * @post_parse_func: (allow-none): a function to call after parsing, or %NULL
20757  *
20758  * Associates two functions with @group which will be called
20759  * from g_option_context_parse() before the first option is parsed
20760  * and after the last option has been parsed, respectively.
20761  *
20762  * Note that the user data to be passed to @pre_parse_func and
20763  * @post_parse_func can be specified when constructing the group
20764  * with g_option_group_new().
20765  *
20766  * Since: 2.6
20767  */
20768
20769
20770 /**
20771  * g_option_group_set_translate_func:
20772  * @group: a #GOptionGroup
20773  * @func: (allow-none): the #GTranslateFunc, or %NULL
20774  * @data: (allow-none): user data to pass to @func, or %NULL
20775  * @destroy_notify: (allow-none): a function which gets called to free @data, or %NULL
20776  *
20777  * Sets the function which is used to translate user-visible
20778  * strings, for <option>--help</option> output. Different
20779  * groups can use different #GTranslateFunc<!-- -->s. If @func
20780  * is %NULL, strings are not translated.
20781  *
20782  * If you are using gettext(), you only need to set the translation
20783  * domain, see g_option_group_set_translation_domain().
20784  *
20785  * Since: 2.6
20786  */
20787
20788
20789 /**
20790  * g_option_group_set_translation_domain:
20791  * @group: a #GOptionGroup
20792  * @domain: the domain to use
20793  *
20794  * A convenience function to use gettext() for translating
20795  * user-visible strings.
20796  *
20797  * Since: 2.6
20798  */
20799
20800
20801 /**
20802  * g_parse_debug_string:
20803  * @string: (allow-none): a list of debug options separated by colons, spaces, or commas, or %NULL.
20804  * @keys: (array length=nkeys): pointer to an array of #GDebugKey which associate strings with bit flags.
20805  * @nkeys: the number of #GDebugKey<!-- -->s in the array.
20806  *
20807  * Parses a string containing debugging options
20808  * into a %guint containing bit flags. This is used
20809  * within GDK and GTK+ to parse the debug options passed on the
20810  * command line or through environment variables.
20811  *
20812  * If @string is equal to <code>"all"</code>, all flags are set. Any flags
20813  * specified along with <code>"all"</code> in @string are inverted; thus,
20814  * <code>"all,foo,bar"</code> or <code>"foo,bar,all"</code> sets all flags
20815  * except those corresponding to <code>"foo"</code> and <code>"bar"</code>.
20816  *
20817  * If @string is equal to <code>"help"</code>, all the available keys in @keys
20818  * are printed out to standard error.
20819  *
20820  * Returns: the combined set of bit flags.
20821  */
20822
20823
20824 /**
20825  * g_path_get_basename:
20826  * @file_name: the name of the file
20827  *
20828  * Gets the last component of the filename.
20829  *
20830  * If @file_name ends with a directory separator it gets the component
20831  * before the last slash. If @file_name consists only of directory
20832  * separators (and on Windows, possibly a drive letter), a single
20833  * separator is returned. If @file_name is empty, it gets ".".
20834  *
20835  * Returns: a newly allocated string containing the last component of the filename
20836  */
20837
20838
20839 /**
20840  * g_path_get_dirname:
20841  * @file_name: the name of the file
20842  *
20843  * Gets the directory components of a file name.
20844  *
20845  * If the file name has no directory components "." is returned.
20846  * The returned string should be freed when no longer needed.
20847  *
20848  * Returns: the directory components of the file
20849  */
20850
20851
20852 /**
20853  * g_path_is_absolute:
20854  * @file_name: a file name
20855  *
20856  * Returns %TRUE if the given @file_name is an absolute file name.
20857  * Note that this is a somewhat vague concept on Windows.
20858  *
20859  * On POSIX systems, an absolute file name is well-defined. It always
20860  * starts from the single root directory. For example "/usr/local".
20861  *
20862  * On Windows, the concepts of current drive and drive-specific
20863  * current directory introduce vagueness. This function interprets as
20864  * an absolute file name one that either begins with a directory
20865  * separator such as "\Users\tml" or begins with the root on a drive,
20866  * for example "C:\Windows". The first case also includes UNC paths
20867  * such as "\\myserver\docs\foo". In all cases, either slashes or
20868  * backslashes are accepted.
20869  *
20870  * Note that a file name relative to the current drive root does not
20871  * truly specify a file uniquely over time and across processes, as
20872  * the current drive is a per-process value and can be changed.
20873  *
20874  * File names relative the current directory on some specific drive,
20875  * such as "D:foo/bar", are not interpreted as absolute by this
20876  * function, but they obviously are not relative to the normal current
20877  * directory as returned by getcwd() or g_get_current_dir()
20878  * either. Such paths should be avoided, or need to be handled using
20879  * Windows-specific code.
20880  *
20881  * Returns: %TRUE if @file_name is absolute
20882  */
20883
20884
20885 /**
20886  * g_path_skip_root:
20887  * @file_name: a file name
20888  *
20889  * Returns a pointer into @file_name after the root component,
20890  * i.e. after the "/" in UNIX or "C:\" under Windows. If @file_name
20891  * is not an absolute path it returns %NULL.
20892  *
20893  * Returns: a pointer into @file_name after the root component
20894  */
20895
20896
20897 /**
20898  * g_pattern_match:
20899  * @pspec: a #GPatternSpec
20900  * @string_length: the length of @string (in bytes, i.e. strlen(), <emphasis>not</emphasis> g_utf8_strlen())
20901  * @string: the UTF-8 encoded string to match
20902  * @string_reversed: (allow-none): the reverse of @string or %NULL
20903  *
20904  * Matches a string against a compiled pattern. Passing the correct
20905  * length of the string given is mandatory. The reversed string can be
20906  * omitted by passing %NULL, this is more efficient if the reversed
20907  * version of the string to be matched is not at hand, as
20908  * g_pattern_match() will only construct it if the compiled pattern
20909  * requires reverse matches.
20910  *
20911  * Note that, if the user code will (possibly) match a string against a
20912  * multitude of patterns containing wildcards, chances are high that
20913  * some patterns will require a reversed string. In this case, it's
20914  * more efficient to provide the reversed string to avoid multiple
20915  * constructions thereof in the various calls to g_pattern_match().
20916  *
20917  * Note also that the reverse of a UTF-8 encoded string can in general
20918  * <emphasis>not</emphasis> be obtained by g_strreverse(). This works
20919  * only if the string doesn't contain any multibyte characters. GLib
20920  * offers the g_utf8_strreverse() function to reverse UTF-8 encoded
20921  * strings.
20922  *
20923  * Returns: %TRUE if @string matches @pspec
20924  */
20925
20926
20927 /**
20928  * g_pattern_match_simple:
20929  * @pattern: the UTF-8 encoded pattern
20930  * @string: the UTF-8 encoded string to match
20931  *
20932  * Matches a string against a pattern given as a string. If this
20933  * function is to be called in a loop, it's more efficient to compile
20934  * the pattern once with g_pattern_spec_new() and call
20935  * g_pattern_match_string() repeatedly.
20936  *
20937  * Returns: %TRUE if @string matches @pspec
20938  */
20939
20940
20941 /**
20942  * g_pattern_match_string:
20943  * @pspec: a #GPatternSpec
20944  * @string: the UTF-8 encoded string to match
20945  *
20946  * Matches a string against a compiled pattern. If the string is to be
20947  * matched against more than one pattern, consider using
20948  * g_pattern_match() instead while supplying the reversed string.
20949  *
20950  * Returns: %TRUE if @string matches @pspec
20951  */
20952
20953
20954 /**
20955  * g_pattern_spec_equal:
20956  * @pspec1: a #GPatternSpec
20957  * @pspec2: another #GPatternSpec
20958  *
20959  * Compares two compiled pattern specs and returns whether they will
20960  * match the same set of strings.
20961  *
20962  * Returns: Whether the compiled patterns are equal
20963  */
20964
20965
20966 /**
20967  * g_pattern_spec_free:
20968  * @pspec: a #GPatternSpec
20969  *
20970  * Frees the memory allocated for the #GPatternSpec.
20971  */
20972
20973
20974 /**
20975  * g_pattern_spec_new:
20976  * @pattern: a zero-terminated UTF-8 encoded string
20977  *
20978  * Compiles a pattern to a #GPatternSpec.
20979  *
20980  * Returns: a newly-allocated #GPatternSpec
20981  */
20982
20983
20984 /**
20985  * g_pointer_bit_lock:
20986  * @address: a pointer to a #gpointer-sized value
20987  * @lock_bit: a bit value between 0 and 31
20988  *
20989  * This is equivalent to g_bit_lock, but working on pointers (or other
20990  * pointer-sized values).
20991  *
20992  * For portability reasons, you may only lock on the bottom 32 bits of
20993  * the pointer.
20994  *
20995  * Since: 2.30
20996  */
20997
20998
20999 /**
21000  * g_pointer_bit_trylock:
21001  * @address: a pointer to a #gpointer-sized value
21002  * @lock_bit: a bit value between 0 and 31
21003  *
21004  * This is equivalent to g_bit_trylock, but working on pointers (or
21005  * other pointer-sized values).
21006  *
21007  * For portability reasons, you may only lock on the bottom 32 bits of
21008  * the pointer.
21009  *
21010  * Returns: %TRUE if the lock was acquired
21011  * Since: 2.30
21012  */
21013
21014
21015 /**
21016  * g_pointer_bit_unlock:
21017  * @address: a pointer to a #gpointer-sized value
21018  * @lock_bit: a bit value between 0 and 31
21019  *
21020  * This is equivalent to g_bit_unlock, but working on pointers (or other
21021  * pointer-sized values).
21022  *
21023  * For portability reasons, you may only lock on the bottom 32 bits of
21024  * the pointer.
21025  *
21026  * Since: 2.30
21027  */
21028
21029
21030 /**
21031  * g_poll:
21032  * @fds: file descriptors to poll
21033  * @nfds: the number of file descriptors in @fds
21034  * @timeout: amount of time to wait, in milliseconds, or -1 to wait forever
21035  *
21036  * Polls @fds, as with the poll() system call, but portably. (On
21037  * systems that don't have poll(), it is emulated using select().)
21038  * This is used internally by #GMainContext, but it can be called
21039  * directly if you need to block until a file descriptor is ready, but
21040  * don't want to run the full main loop.
21041  *
21042  * Each element of @fds is a #GPollFD describing a single file
21043  * descriptor to poll. The %fd field indicates the file descriptor,
21044  * and the %events field indicates the events to poll for. On return,
21045  * the %revents fields will be filled with the events that actually
21046  * occurred.
21047  *
21048  * On POSIX systems, the file descriptors in @fds can be any sort of
21049  * file descriptor, but the situation is much more complicated on
21050  * Windows. If you need to use g_poll() in code that has to run on
21051  * Windows, the easiest solution is to construct all of your
21052  * #GPollFD<!-- -->s with g_io_channel_win32_make_pollfd().
21053  *
21054  * 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.
21055  * Since: 2.20
21056  */
21057
21058
21059 /**
21060  * g_prefix_error:
21061  * @err: (allow-none): a return location for a #GError, or %NULL
21062  * @format: printf()-style format string
21063  * @...: arguments to @format
21064  *
21065  * Formats a string according to @format and
21066  * prefix it to an existing error message.  If
21067  * @err is %NULL (ie: no error variable) then do
21068  * nothing.
21069  *
21070  * If *@err is %NULL (ie: an error variable is
21071  * present but there is no error condition) then
21072  * also do nothing.  Whether or not it makes
21073  * sense to take advantage of this feature is up
21074  * to you.
21075  *
21076  * Since: 2.16
21077  */
21078
21079
21080 /**
21081  * g_print:
21082  * @format: the message format. See the printf() documentation
21083  * @...: the parameters to insert into the format string
21084  *
21085  * Outputs a formatted message via the print handler.
21086  * The default print handler simply outputs the message to stdout.
21087  *
21088  * g_print() should not be used from within libraries for debugging
21089  * messages, since it may be redirected by applications to special
21090  * purpose message windows or even files. Instead, libraries should
21091  * use g_log(), or the convenience functions g_message(), g_warning()
21092  * and g_error().
21093  */
21094
21095
21096 /**
21097  * g_printerr:
21098  * @format: the message format. See the printf() documentation
21099  * @...: the parameters to insert into the format string
21100  *
21101  * Outputs a formatted message via the error message handler.
21102  * The default handler simply outputs the message to stderr.
21103  *
21104  * g_printerr() should not be used from within libraries.
21105  * Instead g_log() should be used, or the convenience functions
21106  * g_message(), g_warning() and g_error().
21107  */
21108
21109
21110 /**
21111  * g_printf:
21112  * @format: a standard printf() format string, but notice <link linkend="string-precision">string precision pitfalls</link>.
21113  * @...: the arguments to insert in the output.
21114  *
21115  * An implementation of the standard printf() function which supports
21116  * positional parameters, as specified in the Single Unix Specification.
21117  *
21118  * Returns: the number of bytes printed.
21119  * Since: 2.2
21120  */
21121
21122
21123 /**
21124  * g_printf_string_upper_bound:
21125  * @format: the format string. See the printf() documentation
21126  * @args: the parameters to be inserted into the format string
21127  *
21128  * Calculates the maximum space needed to store the output
21129  * of the sprintf() function.
21130  *
21131  * Returns: the maximum space needed to store the formatted string
21132  */
21133
21134
21135 /**
21136  * g_private_get:
21137  * @key: a #GPrivate
21138  *
21139  * Returns the current value of the thread local variable @key.
21140  *
21141  * If the value has not yet been set in this thread, %NULL is returned.
21142  * Values are never copied between threads (when a new thread is
21143  * created, for example).
21144  *
21145  * Returns: the thread-local value
21146  */
21147
21148
21149 /**
21150  * g_private_replace:
21151  * @key: a #GPrivate
21152  * @value: the new value
21153  *
21154  * Sets the thread local variable @key to have the value @value in the
21155  * current thread.
21156  *
21157  * This function differs from g_private_set() in the following way: if
21158  * the previous value was non-%NULL then the #GDestroyNotify handler for
21159  * @key is run on it.
21160  *
21161  * Since: 2.32
21162  */
21163
21164
21165 /**
21166  * g_private_set:
21167  * @key: a #GPrivate
21168  * @value: the new value
21169  *
21170  * Sets the thread local variable @key to have the value @value in the
21171  * current thread.
21172  *
21173  * This function differs from g_private_replace() in the following way:
21174  * the #GDestroyNotify for @key is not called on the old value.
21175  */
21176
21177
21178 /**
21179  * g_propagate_error:
21180  * @dest: error return location
21181  * @src: error to move into the return location
21182  *
21183  * If @dest is %NULL, free @src; otherwise, moves @src into *@dest.
21184  * The error variable @dest points to must be %NULL.
21185  */
21186
21187
21188 /**
21189  * g_propagate_prefixed_error:
21190  * @dest: error return location
21191  * @src: error to move into the return location
21192  * @format: printf()-style format string
21193  * @...: arguments to @format
21194  *
21195  * If @dest is %NULL, free @src; otherwise,
21196  * moves @src into *@dest. *@dest must be %NULL.
21197  * After the move, add a prefix as with
21198  * g_prefix_error().
21199  *
21200  * Since: 2.16
21201  */
21202
21203
21204 /**
21205  * g_ptr_array_add:
21206  * @array: a #GPtrArray.
21207  * @data: the pointer to add.
21208  *
21209  * Adds a pointer to the end of the pointer array. The array will grow
21210  * in size automatically if necessary.
21211  */
21212
21213
21214 /**
21215  * g_ptr_array_foreach:
21216  * @array: a #GPtrArray
21217  * @func: the function to call for each array element
21218  * @user_data: user data to pass to the function
21219  *
21220  * Calls a function for each element of a #GPtrArray.
21221  *
21222  * Since: 2.4
21223  */
21224
21225
21226 /**
21227  * g_ptr_array_free:
21228  * @array: a #GPtrArray.
21229  * @free_seg: if %TRUE the actual pointer array is freed as well.
21230  *
21231  * Frees the memory allocated for the #GPtrArray. If @free_seg is %TRUE
21232  * it frees the memory block holding the elements as well. Pass %FALSE
21233  * if you want to free the #GPtrArray wrapper but preserve the
21234  * underlying array for use elsewhere. If the reference count of @array
21235  * is greater than one, the #GPtrArray wrapper is preserved but the
21236  * size of @array will be set to zero.
21237  *
21238  * <note><para>If array contents point to dynamically-allocated
21239  * memory, they should be freed separately if @free_seg is %TRUE and no
21240  * #GDestroyNotify function has been set for @array.</para></note>
21241  *
21242  * Returns: the pointer array if @free_seg is %FALSE, otherwise %NULL. The pointer array should be freed using g_free().
21243  */
21244
21245
21246 /**
21247  * g_ptr_array_index:
21248  * @array: a #GPtrArray.
21249  * @index_: the index of the pointer to return.
21250  *
21251  * Returns the pointer at the given index of the pointer array.
21252  *
21253  * Returns: the pointer at the given index.
21254  */
21255
21256
21257 /**
21258  * g_ptr_array_new:
21259  *
21260  * Creates a new #GPtrArray with a reference count of 1.
21261  *
21262  * Returns: the new #GPtrArray.
21263  */
21264
21265
21266 /**
21267  * g_ptr_array_new_full:
21268  * @reserved_size: number of pointers preallocated.
21269  * @element_free_func: (allow-none): A function to free elements with destroy @array or %NULL.
21270  *
21271  * Creates a new #GPtrArray with @reserved_size pointers preallocated
21272  * and a reference count of 1. This avoids frequent reallocation, if
21273  * you are going to add many pointers to the array. Note however that
21274  * the size of the array is still 0. It also set @element_free_func
21275  * for freeing each element when the array is destroyed either via
21276  * g_ptr_array_unref(), when g_ptr_array_free() is called with @free_segment
21277  * set to %TRUE or when removing elements.
21278  *
21279  * Returns: A new #GPtrArray.
21280  * Since: 2.30
21281  */
21282
21283
21284 /**
21285  * g_ptr_array_new_with_free_func:
21286  * @element_free_func: (allow-none): A function to free elements with destroy @array or %NULL.
21287  *
21288  * Creates a new #GPtrArray with a reference count of 1 and use @element_free_func
21289  * for freeing each element when the array is destroyed either via
21290  * g_ptr_array_unref(), when g_ptr_array_free() is called with @free_segment
21291  * set to %TRUE or when removing elements.
21292  *
21293  * Returns: A new #GPtrArray.
21294  * Since: 2.22
21295  */
21296
21297
21298 /**
21299  * g_ptr_array_ref:
21300  * @array: a #GPtrArray
21301  *
21302  * Atomically increments the reference count of @array by one.
21303  * This function is thread-safe and may be called from any thread.
21304  *
21305  * Returns: The passed in #GPtrArray
21306  * Since: 2.22
21307  */
21308
21309
21310 /**
21311  * g_ptr_array_remove:
21312  * @array: a #GPtrArray.
21313  * @data: the pointer to remove.
21314  *
21315  * Removes the first occurrence of the given pointer from the pointer
21316  * array. The following elements are moved down one place. If @array
21317  * has a non-%NULL #GDestroyNotify function it is called for the
21318  * removed element.
21319  *
21320  * It returns %TRUE if the pointer was removed, or %FALSE if the
21321  * pointer was not found.
21322  *
21323  * Returns: %TRUE if the pointer is removed. %FALSE if the pointer is not found in the array.
21324  */
21325
21326
21327 /**
21328  * g_ptr_array_remove_fast:
21329  * @array: a #GPtrArray.
21330  * @data: the pointer to remove.
21331  *
21332  * Removes the first occurrence of the given pointer from the pointer
21333  * array. The last element in the array is used to fill in the space,
21334  * so this function does not preserve the order of the array. But it is
21335  * faster than g_ptr_array_remove(). If @array has a non-%NULL
21336  * #GDestroyNotify function it is called for the removed element.
21337  *
21338  * It returns %TRUE if the pointer was removed, or %FALSE if the
21339  * pointer was not found.
21340  *
21341  * Returns: %TRUE if the pointer was found in the array.
21342  */
21343
21344
21345 /**
21346  * g_ptr_array_remove_index:
21347  * @array: a #GPtrArray.
21348  * @index_: the index of the pointer to remove.
21349  *
21350  * Removes the pointer at the given index from the pointer array. The
21351  * following elements are moved down one place. If @array has a
21352  * non-%NULL #GDestroyNotify function it is called for the removed
21353  * element.
21354  *
21355  * Returns: the pointer which was removed.
21356  */
21357
21358
21359 /**
21360  * g_ptr_array_remove_index_fast:
21361  * @array: a #GPtrArray.
21362  * @index_: the index of the pointer to remove.
21363  *
21364  * Removes the pointer at the given index from the pointer array. The
21365  * last element in the array is used to fill in the space, so this
21366  * function does not preserve the order of the array. But it is faster
21367  * than g_ptr_array_remove_index(). If @array has a non-%NULL
21368  * #GDestroyNotify function it is called for the removed element.
21369  *
21370  * Returns: the pointer which was removed.
21371  */
21372
21373
21374 /**
21375  * g_ptr_array_remove_range:
21376  * @array: a @GPtrArray.
21377  * @index_: the index of the first pointer to remove.
21378  * @length: the number of pointers to remove.
21379  *
21380  * Removes the given number of pointers starting at the given index
21381  * from a #GPtrArray.  The following elements are moved to close the
21382  * gap. If @array has a non-%NULL #GDestroyNotify function it is called
21383  * for the removed elements.
21384  *
21385  * Since: 2.4
21386  */
21387
21388
21389 /**
21390  * g_ptr_array_set_free_func:
21391  * @array: A #GPtrArray.
21392  * @element_free_func: (allow-none): A function to free elements with destroy @array or %NULL.
21393  *
21394  * Sets a function for freeing each element when @array is destroyed
21395  * either via g_ptr_array_unref(), when g_ptr_array_free() is called
21396  * with @free_segment set to %TRUE or when removing elements.
21397  *
21398  * Since: 2.22
21399  */
21400
21401
21402 /**
21403  * g_ptr_array_set_size:
21404  * @array: a #GPtrArray.
21405  * @length: the new length of the pointer array.
21406  *
21407  * Sets the size of the array. When making the array larger,
21408  * newly-added elements will be set to %NULL. When making it smaller,
21409  * if @array has a non-%NULL #GDestroyNotify function then it will be
21410  * called for the removed elements.
21411  */
21412
21413
21414 /**
21415  * g_ptr_array_sized_new:
21416  * @reserved_size: number of pointers preallocated.
21417  *
21418  * Creates a new #GPtrArray with @reserved_size pointers preallocated
21419  * and a reference count of 1. This avoids frequent reallocation, if
21420  * you are going to add many pointers to the array. Note however that
21421  * the size of the array is still 0.
21422  *
21423  * Returns: the new #GPtrArray.
21424  */
21425
21426
21427 /**
21428  * g_ptr_array_sort:
21429  * @array: a #GPtrArray.
21430  * @compare_func: comparison function.
21431  *
21432  * Sorts the array, using @compare_func which should be a qsort()-style
21433  * comparison function (returns less than zero for first arg is less
21434  * than second arg, zero for equal, greater than zero if irst arg is
21435  * greater than second arg).
21436  *
21437  * <note><para>The comparison function for g_ptr_array_sort() doesn't
21438  * take the pointers from the array as arguments, it takes pointers to
21439  * the pointers in the array.</para></note>
21440  *
21441  * This is guaranteed to be a stable sort since version 2.32.
21442  */
21443
21444
21445 /**
21446  * g_ptr_array_sort_with_data:
21447  * @array: a #GPtrArray.
21448  * @compare_func: comparison function.
21449  * @user_data: data to pass to @compare_func.
21450  *
21451  * Like g_ptr_array_sort(), but the comparison function has an extra
21452  * user data argument.
21453  *
21454  * <note><para>The comparison function for g_ptr_array_sort_with_data()
21455  * doesn't take the pointers from the array as arguments, it takes
21456  * pointers to the pointers in the array.</para></note>
21457  *
21458  * This is guaranteed to be a stable sort since version 2.32.
21459  */
21460
21461
21462 /**
21463  * g_ptr_array_unref:
21464  * @array: A #GPtrArray.
21465  *
21466  * Atomically decrements the reference count of @array by one. If the
21467  * reference count drops to 0, the effect is the same as calling
21468  * g_ptr_array_free() with @free_segment set to %TRUE. This function
21469  * is MT-safe and may be called from any thread.
21470  *
21471  * Since: 2.22
21472  */
21473
21474
21475 /**
21476  * g_qsort_with_data:
21477  * @pbase: start of array to sort
21478  * @total_elems: elements in the array
21479  * @size: size of each element
21480  * @compare_func: function to compare elements
21481  * @user_data: data to pass to @compare_func
21482  *
21483  * This is just like the standard C qsort() function, but
21484  * the comparison routine accepts a user data argument.
21485  *
21486  * This is guaranteed to be a stable sort since version 2.32.
21487  */
21488
21489
21490 /**
21491  * g_quark_from_static_string:
21492  * @string: (allow-none): a string.
21493  *
21494  * Gets the #GQuark identifying the given (static) string. If the
21495  * string does not currently have an associated #GQuark, a new #GQuark
21496  * is created, linked to the given string.
21497  *
21498  * Note that this function is identical to g_quark_from_string() except
21499  * that if a new #GQuark is created the string itself is used rather
21500  * than a copy. This saves memory, but can only be used if the string
21501  * will <emphasis>always</emphasis> exist. It can be used with
21502  * statically allocated strings in the main program, but not with
21503  * statically allocated memory in dynamically loaded modules, if you
21504  * expect to ever unload the module again (e.g. do not use this
21505  * function in GTK+ theme engines).
21506  *
21507  * Returns: the #GQuark identifying the string, or 0 if @string is %NULL.
21508  */
21509
21510
21511 /**
21512  * g_quark_from_string:
21513  * @string: (allow-none): a string.
21514  *
21515  * Gets the #GQuark identifying the given string. If the string does
21516  * not currently have an associated #GQuark, a new #GQuark is created,
21517  * using a copy of the string.
21518  *
21519  * Returns: the #GQuark identifying the string, or 0 if @string is %NULL.
21520  */
21521
21522
21523 /**
21524  * g_quark_to_string:
21525  * @quark: a #GQuark.
21526  *
21527  * Gets the string associated with the given #GQuark.
21528  *
21529  * Returns: the string associated with the #GQuark
21530  */
21531
21532
21533 /**
21534  * g_quark_try_string:
21535  * @string: (allow-none): a string.
21536  *
21537  * Gets the #GQuark associated with the given string, or 0 if string is
21538  * %NULL or it has no associated #GQuark.
21539  *
21540  * If you want the GQuark to be created if it doesn't already exist,
21541  * use g_quark_from_string() or g_quark_from_static_string().
21542  *
21543  * Returns: the #GQuark associated with the string, or 0 if @string is %NULL or there is no #GQuark associated with it.
21544  */
21545
21546
21547 /**
21548  * g_queue_clear:
21549  * @queue: a #GQueue
21550  *
21551  * Removes all the elements in @queue. If queue elements contain
21552  * dynamically-allocated memory, they should be freed first.
21553  *
21554  * Since: 2.14
21555  */
21556
21557
21558 /**
21559  * g_queue_copy:
21560  * @queue: a #GQueue
21561  *
21562  * Copies a @queue. Note that is a shallow copy. If the elements in the
21563  * queue consist of pointers to data, the pointers are copied, but the
21564  * actual data is not.
21565  *
21566  * Returns: A copy of @queue
21567  * Since: 2.4
21568  */
21569
21570
21571 /**
21572  * g_queue_delete_link:
21573  * @queue: a #GQueue
21574  * @link_: a #GList link that <emphasis>must</emphasis> be part of @queue
21575  *
21576  * Removes @link_ from @queue and frees it.
21577  *
21578  * @link_ must be part of @queue.
21579  *
21580  * Since: 2.4
21581  */
21582
21583
21584 /**
21585  * g_queue_find:
21586  * @queue: a #GQueue
21587  * @data: data to find
21588  *
21589  * Finds the first link in @queue which contains @data.
21590  *
21591  * Returns: The first link in @queue which contains @data.
21592  * Since: 2.4
21593  */
21594
21595
21596 /**
21597  * g_queue_find_custom:
21598  * @queue: a #GQueue
21599  * @data: user data passed to @func
21600  * @func: a #GCompareFunc to call for each element. It should return 0 when the desired element is found
21601  *
21602  * Finds an element in a #GQueue, using a supplied function to find the
21603  * desired element. It iterates over the queue, calling the given function
21604  * which should return 0 when the desired element is found. The function
21605  * takes two gconstpointer arguments, the #GQueue element's data as the
21606  * first argument and the given user data as the second argument.
21607  *
21608  * Returns: The found link, or %NULL if it wasn't found
21609  * Since: 2.4
21610  */
21611
21612
21613 /**
21614  * g_queue_foreach:
21615  * @queue: a #GQueue
21616  * @func: the function to call for each element's data
21617  * @user_data: user data to pass to @func
21618  *
21619  * Calls @func for each element in the queue passing @user_data to the
21620  * function.
21621  *
21622  * Since: 2.4
21623  */
21624
21625
21626 /**
21627  * g_queue_free:
21628  * @queue: a #GQueue.
21629  *
21630  * Frees the memory allocated for the #GQueue. Only call this function if
21631  * @queue was created with g_queue_new(). If queue elements contain
21632  * dynamically-allocated memory, they should be freed first.
21633  *
21634  * <note><para>
21635  * If queue elements contain dynamically-allocated memory,
21636  * you should either use g_queue_free_full() or free them manually
21637  * first.
21638  * </para></note>
21639  */
21640
21641
21642 /**
21643  * g_queue_free_full:
21644  * @queue: a pointer to a #GQueue
21645  * @free_func: the function to be called to free each element's data
21646  *
21647  * Convenience method, which frees all the memory used by a #GQueue, and
21648  * calls the specified destroy function on every element's data.
21649  *
21650  * Since: 2.32
21651  */
21652
21653
21654 /**
21655  * g_queue_get_length:
21656  * @queue: a #GQueue
21657  *
21658  * Returns the number of items in @queue.
21659  *
21660  * Returns: The number of items in @queue.
21661  * Since: 2.4
21662  */
21663
21664
21665 /**
21666  * g_queue_index:
21667  * @queue: a #GQueue
21668  * @data: the data to find.
21669  *
21670  * Returns the position of the first element in @queue which contains @data.
21671  *
21672  * Returns: The position of the first element in @queue which contains @data, or -1 if no element in @queue contains @data.
21673  * Since: 2.4
21674  */
21675
21676
21677 /**
21678  * g_queue_init:
21679  * @queue: an uninitialized #GQueue
21680  *
21681  * A statically-allocated #GQueue must be initialized with this function
21682  * before it can be used. Alternatively you can initialize it with
21683  * #G_QUEUE_INIT. It is not necessary to initialize queues created with
21684  * g_queue_new().
21685  *
21686  * Since: 2.14
21687  */
21688
21689
21690 /**
21691  * g_queue_insert_after:
21692  * @queue: a #GQueue
21693  * @sibling: a #GList link that <emphasis>must</emphasis> be part of @queue
21694  * @data: the data to insert
21695  *
21696  * Inserts @data into @queue after @sibling
21697  *
21698  * @sibling must be part of @queue
21699  *
21700  * Since: 2.4
21701  */
21702
21703
21704 /**
21705  * g_queue_insert_before:
21706  * @queue: a #GQueue
21707  * @sibling: a #GList link that <emphasis>must</emphasis> be part of @queue
21708  * @data: the data to insert
21709  *
21710  * Inserts @data into @queue before @sibling.
21711  *
21712  * @sibling must be part of @queue.
21713  *
21714  * Since: 2.4
21715  */
21716
21717
21718 /**
21719  * g_queue_insert_sorted:
21720  * @queue: a #GQueue
21721  * @data: the data to insert
21722  * @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.
21723  * @user_data: user data passed to @func.
21724  *
21725  * Inserts @data into @queue using @func to determine the new position.
21726  *
21727  * Since: 2.4
21728  */
21729
21730
21731 /**
21732  * g_queue_is_empty:
21733  * @queue: a #GQueue.
21734  *
21735  * Returns %TRUE if the queue is empty.
21736  *
21737  * Returns: %TRUE if the queue is empty.
21738  */
21739
21740
21741 /**
21742  * g_queue_link_index:
21743  * @queue: a #GQueue
21744  * @link_: A #GList link
21745  *
21746  * Returns the position of @link_ in @queue.
21747  *
21748  * Returns: The position of @link_, or -1 if the link is not part of @queue
21749  * Since: 2.4
21750  */
21751
21752
21753 /**
21754  * g_queue_new:
21755  *
21756  * Creates a new #GQueue.
21757  *
21758  * Returns: a new #GQueue.
21759  */
21760
21761
21762 /**
21763  * g_queue_peek_head:
21764  * @queue: a #GQueue.
21765  *
21766  * Returns the first element of the queue.
21767  *
21768  * Returns: the data of the first element in the queue, or %NULL if the queue is empty.
21769  */
21770
21771
21772 /**
21773  * g_queue_peek_head_link:
21774  * @queue: a #GQueue
21775  *
21776  * Returns the first link in @queue
21777  *
21778  * Returns: the first link in @queue, or %NULL if @queue is empty
21779  * Since: 2.4
21780  */
21781
21782
21783 /**
21784  * g_queue_peek_nth:
21785  * @queue: a #GQueue
21786  * @n: the position of the element.
21787  *
21788  * Returns the @n'th element of @queue.
21789  *
21790  * Returns: The data for the @n'th element of @queue, or %NULL if @n is off the end of @queue.
21791  * Since: 2.4
21792  */
21793
21794
21795 /**
21796  * g_queue_peek_nth_link:
21797  * @queue: a #GQueue
21798  * @n: the position of the link
21799  *
21800  * Returns the link at the given position
21801  *
21802  * Returns: The link at the @n'th position, or %NULL if @n is off the end of the list
21803  * Since: 2.4
21804  */
21805
21806
21807 /**
21808  * g_queue_peek_tail:
21809  * @queue: a #GQueue.
21810  *
21811  * Returns the last element of the queue.
21812  *
21813  * Returns: the data of the last element in the queue, or %NULL if the queue is empty.
21814  */
21815
21816
21817 /**
21818  * g_queue_peek_tail_link:
21819  * @queue: a #GQueue
21820  *
21821  * Returns the last link @queue.
21822  *
21823  * Returns: the last link in @queue, or %NULL if @queue is empty
21824  * Since: 2.4
21825  */
21826
21827
21828 /**
21829  * g_queue_pop_head:
21830  * @queue: a #GQueue.
21831  *
21832  * Removes the first element of the queue.
21833  *
21834  * Returns: the data of the first element in the queue, or %NULL if the queue is empty.
21835  */
21836
21837
21838 /**
21839  * g_queue_pop_head_link:
21840  * @queue: a #GQueue.
21841  *
21842  * Removes the first element of the queue.
21843  *
21844  * Returns: the #GList element at the head of the queue, or %NULL if the queue is empty.
21845  */
21846
21847
21848 /**
21849  * g_queue_pop_nth:
21850  * @queue: a #GQueue
21851  * @n: the position of the element.
21852  *
21853  * Removes the @n'th element of @queue.
21854  *
21855  * Returns: the element's data, or %NULL if @n is off the end of @queue.
21856  * Since: 2.4
21857  */
21858
21859
21860 /**
21861  * g_queue_pop_nth_link:
21862  * @queue: a #GQueue
21863  * @n: the link's position
21864  *
21865  * Removes and returns the link at the given position.
21866  *
21867  * Returns: The @n'th link, or %NULL if @n is off the end of @queue.
21868  * Since: 2.4
21869  */
21870
21871
21872 /**
21873  * g_queue_pop_tail:
21874  * @queue: a #GQueue.
21875  *
21876  * Removes the last element of the queue.
21877  *
21878  * Returns: the data of the last element in the queue, or %NULL if the queue is empty.
21879  */
21880
21881
21882 /**
21883  * g_queue_pop_tail_link:
21884  * @queue: a #GQueue.
21885  *
21886  * Removes the last element of the queue.
21887  *
21888  * Returns: the #GList element at the tail of the queue, or %NULL if the queue is empty.
21889  */
21890
21891
21892 /**
21893  * g_queue_push_head:
21894  * @queue: a #GQueue.
21895  * @data: the data for the new element.
21896  *
21897  * Adds a new element at the head of the queue.
21898  */
21899
21900
21901 /**
21902  * g_queue_push_head_link:
21903  * @queue: a #GQueue.
21904  * @link_: a single #GList element, <emphasis>not</emphasis> a list with more than one element.
21905  *
21906  * Adds a new element at the head of the queue.
21907  */
21908
21909
21910 /**
21911  * g_queue_push_nth:
21912  * @queue: a #GQueue
21913  * @data: the data for the new element
21914  * @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.
21915  *
21916  * Inserts a new element into @queue at the given position
21917  *
21918  * Since: 2.4
21919  */
21920
21921
21922 /**
21923  * g_queue_push_nth_link:
21924  * @queue: a #GQueue
21925  * @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.
21926  * @link_: the link to add to @queue
21927  *
21928  * Inserts @link into @queue at the given position.
21929  *
21930  * Since: 2.4
21931  */
21932
21933
21934 /**
21935  * g_queue_push_tail:
21936  * @queue: a #GQueue.
21937  * @data: the data for the new element.
21938  *
21939  * Adds a new element at the tail of the queue.
21940  */
21941
21942
21943 /**
21944  * g_queue_push_tail_link:
21945  * @queue: a #GQueue.
21946  * @link_: a single #GList element, <emphasis>not</emphasis> a list with more than one element.
21947  *
21948  * Adds a new element at the tail of the queue.
21949  */
21950
21951
21952 /**
21953  * g_queue_remove:
21954  * @queue: a #GQueue
21955  * @data: data to remove.
21956  *
21957  * Removes the first element in @queue that contains @data.
21958  *
21959  * Returns: %TRUE if @data was found and removed from @queue
21960  * Since: 2.4
21961  */
21962
21963
21964 /**
21965  * g_queue_remove_all:
21966  * @queue: a #GQueue
21967  * @data: data to remove
21968  *
21969  * Remove all elements whose data equals @data from @queue.
21970  *
21971  * Returns: the number of elements removed from @queue
21972  * Since: 2.4
21973  */
21974
21975
21976 /**
21977  * g_queue_reverse:
21978  * @queue: a #GQueue
21979  *
21980  * Reverses the order of the items in @queue.
21981  *
21982  * Since: 2.4
21983  */
21984
21985
21986 /**
21987  * g_queue_sort:
21988  * @queue: a #GQueue
21989  * @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.
21990  * @user_data: user data passed to @compare_func
21991  *
21992  * Sorts @queue using @compare_func.
21993  *
21994  * Since: 2.4
21995  */
21996
21997
21998 /**
21999  * g_queue_unlink:
22000  * @queue: a #GQueue
22001  * @link_: a #GList link that <emphasis>must</emphasis> be part of @queue
22002  *
22003  * Unlinks @link_ so that it will no longer be part of @queue. The link is
22004  * not freed.
22005  *
22006  * @link_ must be part of @queue,
22007  *
22008  * Since: 2.4
22009  */
22010
22011
22012 /**
22013  * g_rand_boolean:
22014  * @rand_: a #GRand.
22015  *
22016  * Returns a random #gboolean from @rand_. This corresponds to a
22017  * unbiased coin toss.
22018  *
22019  * Returns: a random #gboolean.
22020  */
22021
22022
22023 /**
22024  * g_rand_copy:
22025  * @rand_: a #GRand.
22026  *
22027  * Copies a #GRand into a new one with the same exact state as before.
22028  * This way you can take a snapshot of the random number generator for
22029  * replaying later.
22030  *
22031  * Returns: the new #GRand.
22032  * Since: 2.4
22033  */
22034
22035
22036 /**
22037  * g_rand_double:
22038  * @rand_: a #GRand.
22039  *
22040  * Returns the next random #gdouble from @rand_ equally distributed over
22041  * the range [0..1).
22042  *
22043  * Returns: A random number.
22044  */
22045
22046
22047 /**
22048  * g_rand_double_range:
22049  * @rand_: a #GRand.
22050  * @begin: lower closed bound of the interval.
22051  * @end: upper open bound of the interval.
22052  *
22053  * Returns the next random #gdouble from @rand_ equally distributed over
22054  * the range [@begin..@end).
22055  *
22056  * Returns: A random number.
22057  */
22058
22059
22060 /**
22061  * g_rand_free:
22062  * @rand_: a #GRand.
22063  *
22064  * Frees the memory allocated for the #GRand.
22065  */
22066
22067
22068 /**
22069  * g_rand_int:
22070  * @rand_: a #GRand.
22071  *
22072  * Returns the next random #guint32 from @rand_ equally distributed over
22073  * the range [0..2^32-1].
22074  *
22075  * Returns: A random number.
22076  */
22077
22078
22079 /**
22080  * g_rand_int_range:
22081  * @rand_: a #GRand.
22082  * @begin: lower closed bound of the interval.
22083  * @end: upper open bound of the interval.
22084  *
22085  * Returns the next random #gint32 from @rand_ equally distributed over
22086  * the range [@begin..@end-1].
22087  *
22088  * Returns: A random number.
22089  */
22090
22091
22092 /**
22093  * g_rand_new:
22094  *
22095  * Creates a new random number generator initialized with a seed taken
22096  * either from <filename>/dev/urandom</filename> (if existing) or from
22097  * the current time (as a fallback).
22098  *
22099  * Returns: the new #GRand.
22100  */
22101
22102
22103 /**
22104  * g_rand_new_with_seed:
22105  * @seed: a value to initialize the random number generator.
22106  *
22107  * Creates a new random number generator initialized with @seed.
22108  *
22109  * Returns: the new #GRand.
22110  */
22111
22112
22113 /**
22114  * g_rand_new_with_seed_array:
22115  * @seed: an array of seeds to initialize the random number generator.
22116  * @seed_length: an array of seeds to initialize the random number generator.
22117  *
22118  * Creates a new random number generator initialized with @seed.
22119  *
22120  * Returns: the new #GRand.
22121  * Since: 2.4
22122  */
22123
22124
22125 /**
22126  * g_rand_set_seed:
22127  * @rand_: a #GRand.
22128  * @seed: a value to reinitialize the random number generator.
22129  *
22130  * Sets the seed for the random number generator #GRand to @seed.
22131  */
22132
22133
22134 /**
22135  * g_rand_set_seed_array:
22136  * @rand_: a #GRand.
22137  * @seed: array to initialize with
22138  * @seed_length: length of array
22139  *
22140  * Initializes the random number generator by an array of
22141  * longs.  Array can be of arbitrary size, though only the
22142  * first 624 values are taken.  This function is useful
22143  * if you have many low entropy seeds, or if you require more then
22144  * 32bits of actual entropy for your application.
22145  *
22146  * Since: 2.4
22147  */
22148
22149
22150 /**
22151  * g_random_boolean:
22152  *
22153  * Returns a random #gboolean. This corresponds to a unbiased coin toss.
22154  *
22155  * Returns: a random #gboolean.
22156  */
22157
22158
22159 /**
22160  * g_random_double:
22161  *
22162  * Returns a random #gdouble equally distributed over the range [0..1).
22163  *
22164  * Returns: A random number.
22165  */
22166
22167
22168 /**
22169  * g_random_double_range:
22170  * @begin: lower closed bound of the interval.
22171  * @end: upper open bound of the interval.
22172  *
22173  * Returns a random #gdouble equally distributed over the range [@begin..@end).
22174  *
22175  * Returns: A random number.
22176  */
22177
22178
22179 /**
22180  * g_random_int:
22181  *
22182  * Return a random #guint32 equally distributed over the range
22183  * [0..2^32-1].
22184  *
22185  * Returns: A random number.
22186  */
22187
22188
22189 /**
22190  * g_random_int_range:
22191  * @begin: lower closed bound of the interval.
22192  * @end: upper open bound of the interval.
22193  *
22194  * Returns a random #gint32 equally distributed over the range
22195  * [@begin..@end-1].
22196  *
22197  * Returns: A random number.
22198  */
22199
22200
22201 /**
22202  * g_random_set_seed:
22203  * @seed: a value to reinitialize the global random number generator.
22204  *
22205  * Sets the seed for the global random number generator, which is used
22206  * by the <function>g_random_*</function> functions, to @seed.
22207  */
22208
22209
22210 /**
22211  * g_realloc:
22212  * @mem: the memory to reallocate
22213  * @n_bytes: new size of the memory in bytes
22214  *
22215  * Reallocates the memory pointed to by @mem, so that it now has space for
22216  * @n_bytes bytes of memory. It returns the new address of the memory, which may
22217  * have been moved. @mem may be %NULL, in which case it's considered to
22218  * have zero-length. @n_bytes may be 0, in which case %NULL will be returned
22219  * and @mem will be freed unless it is %NULL.
22220  *
22221  * Returns: the new address of the allocated memory
22222  */
22223
22224
22225 /**
22226  * g_realloc_n:
22227  * @mem: the memory to reallocate
22228  * @n_blocks: the number of blocks to allocate
22229  * @n_block_bytes: the size of each block in bytes
22230  *
22231  * This function is similar to g_realloc(), allocating (@n_blocks * @n_block_bytes) bytes,
22232  * but care is taken to detect possible overflow during multiplication.
22233  *
22234  * Since: 2.24
22235  * Returns: the new address of the allocated memory
22236  */
22237
22238
22239 /**
22240  * g_rec_mutex_clear:
22241  * @rec_mutex: an initialized #GRecMutex
22242  *
22243  * Frees the resources allocated to a recursive mutex with
22244  * g_rec_mutex_init().
22245  *
22246  * This function should not be used with a #GRecMutex that has been
22247  * statically allocated.
22248  *
22249  * Calling g_rec_mutex_clear() on a locked recursive mutex leads
22250  * to undefined behaviour.
22251  *
22252  * Sine: 2.32
22253  */
22254
22255
22256 /**
22257  * g_rec_mutex_init:
22258  * @rec_mutex: an uninitialized #GRecMutex
22259  *
22260  * Initializes a #GRecMutex so that it can be used.
22261  *
22262  * This function is useful to initialize a recursive mutex
22263  * that has been allocated on the stack, or as part of a larger
22264  * structure.
22265  *
22266  * It is not necessary to initialise a recursive mutex that has been
22267  * statically allocated.
22268  *
22269  * |[
22270  *   typedef struct {
22271  *     GRecMutex m;
22272  *     ...
22273  *   } Blob;
22274  *
22275  * Blob *b;
22276  *
22277  * b = g_new (Blob, 1);
22278  * g_rec_mutex_init (&b->m);
22279  * ]|
22280  *
22281  * Calling g_rec_mutex_init() on an already initialized #GRecMutex
22282  * leads to undefined behaviour.
22283  *
22284  * To undo the effect of g_rec_mutex_init() when a recursive mutex
22285  * is no longer needed, use g_rec_mutex_clear().
22286  *
22287  * Since: 2.32
22288  */
22289
22290
22291 /**
22292  * g_rec_mutex_lock:
22293  * @rec_mutex: a #GRecMutex
22294  *
22295  * Locks @rec_mutex. If @rec_mutex is already locked by another
22296  * thread, the current thread will block until @rec_mutex is
22297  * unlocked by the other thread. If @rec_mutex is already locked
22298  * by the current thread, the 'lock count' of @rec_mutex is increased.
22299  * The mutex will only become available again when it is unlocked
22300  * as many times as it has been locked.
22301  *
22302  * Since: 2.32
22303  */
22304
22305
22306 /**
22307  * g_rec_mutex_trylock:
22308  * @rec_mutex: a #GRecMutex
22309  *
22310  * Tries to lock @rec_mutex. If @rec_mutex is already locked
22311  * by another thread, it immediately returns %FALSE. Otherwise
22312  * it locks @rec_mutex and returns %TRUE.
22313  *
22314  * Returns: %TRUE if @rec_mutex could be locked
22315  * Since: 2.32
22316  */
22317
22318
22319 /**
22320  * g_rec_mutex_unlock:
22321  * @rec_mutex: a #GRecMutex
22322  *
22323  * Unlocks @rec_mutex. If another thread is blocked in a
22324  * g_rec_mutex_lock() call for @rec_mutex, it will become unblocked
22325  * and can lock @rec_mutex itself.
22326  *
22327  * Calling g_rec_mutex_unlock() on a recursive mutex that is not
22328  * locked by the current thread leads to undefined behaviour.
22329  *
22330  * Since: 2.32
22331  */
22332
22333
22334 /**
22335  * g_regex_check_replacement:
22336  * @replacement: the replacement string
22337  * @has_references: (out) (allow-none): location to store information about references in @replacement or %NULL
22338  * @error: location to store error
22339  *
22340  * Checks whether @replacement is a valid replacement string
22341  * (see g_regex_replace()), i.e. that all escape sequences in
22342  * it are valid.
22343  *
22344  * If @has_references is not %NULL then @replacement is checked
22345  * for pattern references. For instance, replacement text 'foo\n'
22346  * does not contain references and may be evaluated without information
22347  * about actual match, but '\0\1' (whole match followed by first
22348  * subpattern) requires valid #GMatchInfo object.
22349  *
22350  * Returns: whether @replacement is a valid replacement string
22351  * Since: 2.14
22352  */
22353
22354
22355 /**
22356  * g_regex_escape_nul:
22357  * @string: the string to escape
22358  * @length: the length of @string
22359  *
22360  * Escapes the nul characters in @string to "\x00".  It can be used
22361  * to compile a regex with embedded nul characters.
22362  *
22363  * For completeness, @length can be -1 for a nul-terminated string.
22364  * In this case the output string will be of course equal to @string.
22365  *
22366  * Returns: a newly-allocated escaped string
22367  * Since: 2.30
22368  */
22369
22370
22371 /**
22372  * g_regex_escape_string:
22373  * @string: (array length=length): the string to escape
22374  * @length: the length of @string, or -1 if @string is nul-terminated
22375  *
22376  * Escapes the special characters used for regular expressions
22377  * in @string, for instance "a.b*c" becomes "a\.b\*c". This
22378  * function is useful to dynamically generate regular expressions.
22379  *
22380  * @string can contain nul characters that are replaced with "\0",
22381  * in this case remember to specify the correct length of @string
22382  * in @length.
22383  *
22384  * Returns: a newly-allocated escaped string
22385  * Since: 2.14
22386  */
22387
22388
22389 /**
22390  * g_regex_get_capture_count:
22391  * @regex: a #GRegex
22392  *
22393  * Returns the number of capturing subpatterns in the pattern.
22394  *
22395  * Returns: the number of capturing subpatterns
22396  * Since: 2.14
22397  */
22398
22399
22400 /**
22401  * g_regex_get_compile_flags:
22402  * @regex: a #GRegex
22403  *
22404  * Returns the compile options that @regex was created with.
22405  *
22406  * Returns: flags from #GRegexCompileFlags
22407  * Since: 2.26
22408  */
22409
22410
22411 /**
22412  * g_regex_get_has_cr_or_lf:
22413  * @regex: a #GRegex structure
22414  *
22415  * Checks whether the pattern contains explicit CR or LF references.
22416  *
22417  * Returns: %TRUE if the pattern contains explicit CR or LF references
22418  * Since: 2.34
22419  */
22420
22421
22422 /**
22423  * g_regex_get_match_flags:
22424  * @regex: a #GRegex
22425  *
22426  * Returns the match options that @regex was created with.
22427  *
22428  * Returns: flags from #GRegexMatchFlags
22429  * Since: 2.26
22430  */
22431
22432
22433 /**
22434  * g_regex_get_max_backref:
22435  * @regex: a #GRegex
22436  *
22437  * Returns the number of the highest back reference
22438  * in the pattern, or 0 if the pattern does not contain
22439  * back references.
22440  *
22441  * Returns: the number of the highest back reference
22442  * Since: 2.14
22443  */
22444
22445
22446 /**
22447  * g_regex_get_pattern:
22448  * @regex: a #GRegex structure
22449  *
22450  * Gets the pattern string associated with @regex, i.e. a copy of
22451  * the string passed to g_regex_new().
22452  *
22453  * Returns: the pattern of @regex
22454  * Since: 2.14
22455  */
22456
22457
22458 /**
22459  * g_regex_get_string_number:
22460  * @regex: #GRegex structure
22461  * @name: name of the subexpression
22462  *
22463  * Retrieves the number of the subexpression named @name.
22464  *
22465  * Returns: The number of the subexpression or -1 if @name does not exists
22466  * Since: 2.14
22467  */
22468
22469
22470 /**
22471  * g_regex_match:
22472  * @regex: a #GRegex structure from g_regex_new()
22473  * @string: the string to scan for matches
22474  * @match_options: match options
22475  * @match_info: (out) (allow-none): pointer to location where to store the #GMatchInfo, or %NULL if you do not need it
22476  *
22477  * Scans for a match in string for the pattern in @regex.
22478  * The @match_options are combined with the match options specified
22479  * when the @regex structure was created, letting you have more
22480  * flexibility in reusing #GRegex structures.
22481  *
22482  * A #GMatchInfo structure, used to get information on the match,
22483  * is stored in @match_info if not %NULL. Note that if @match_info
22484  * is not %NULL then it is created even if the function returns %FALSE,
22485  * i.e. you must free it regardless if regular expression actually matched.
22486  *
22487  * To retrieve all the non-overlapping matches of the pattern in
22488  * string you can use g_match_info_next().
22489  *
22490  * |[
22491  * static void
22492  * print_uppercase_words (const gchar *string)
22493  * {
22494  *   /&ast; Print all uppercase-only words. &ast;/
22495  *   GRegex *regex;
22496  *   GMatchInfo *match_info;
22497  *   &nbsp;
22498  *   regex = g_regex_new ("[A-Z]+", 0, 0, NULL);
22499  *   g_regex_match (regex, string, 0, &amp;match_info);
22500  *   while (g_match_info_matches (match_info))
22501  *     {
22502  *       gchar *word = g_match_info_fetch (match_info, 0);
22503  *       g_print ("Found: %s\n", word);
22504  *       g_free (word);
22505  *       g_match_info_next (match_info, NULL);
22506  *     }
22507  *   g_match_info_free (match_info);
22508  *   g_regex_unref (regex);
22509  * }
22510  * ]|
22511  *
22512  * @string is not copied and is used in #GMatchInfo internally. If
22513  * you use any #GMatchInfo method (except g_match_info_free()) after
22514  * freeing or modifying @string then the behaviour is undefined.
22515  *
22516  * Returns: %TRUE is the string matched, %FALSE otherwise
22517  * Since: 2.14
22518  */
22519
22520
22521 /**
22522  * g_regex_match_all:
22523  * @regex: a #GRegex structure from g_regex_new()
22524  * @string: the string to scan for matches
22525  * @match_options: match options
22526  * @match_info: (out) (allow-none): pointer to location where to store the #GMatchInfo, or %NULL if you do not need it
22527  *
22528  * Using the standard algorithm for regular expression matching only
22529  * the longest match in the string is retrieved. This function uses
22530  * a different algorithm so it can retrieve all the possible matches.
22531  * For more documentation see g_regex_match_all_full().
22532  *
22533  * A #GMatchInfo structure, used to get information on the match, is
22534  * stored in @match_info if not %NULL. Note that if @match_info is
22535  * not %NULL then it is created even if the function returns %FALSE,
22536  * i.e. you must free it regardless if regular expression actually
22537  * matched.
22538  *
22539  * @string is not copied and is used in #GMatchInfo internally. If
22540  * you use any #GMatchInfo method (except g_match_info_free()) after
22541  * freeing or modifying @string then the behaviour is undefined.
22542  *
22543  * Returns: %TRUE is the string matched, %FALSE otherwise
22544  * Since: 2.14
22545  */
22546
22547
22548 /**
22549  * g_regex_match_all_full:
22550  * @regex: a #GRegex structure from g_regex_new()
22551  * @string: (array length=string_len): the string to scan for matches
22552  * @string_len: the length of @string, or -1 if @string is nul-terminated
22553  * @start_position: starting index of the string to match
22554  * @match_options: match options
22555  * @match_info: (out) (allow-none): pointer to location where to store the #GMatchInfo, or %NULL if you do not need it
22556  * @error: location to store the error occurring, or %NULL to ignore errors
22557  *
22558  * Using the standard algorithm for regular expression matching only
22559  * the longest match in the string is retrieved, it is not possible
22560  * to obtain all the available matches. For instance matching
22561  * "&lt;a&gt; &lt;b&gt; &lt;c&gt;" against the pattern "&lt;.*&gt;"
22562  * you get "&lt;a&gt; &lt;b&gt; &lt;c&gt;".
22563  *
22564  * This function uses a different algorithm (called DFA, i.e. deterministic
22565  * finite automaton), so it can retrieve all the possible matches, all
22566  * starting at the same point in the string. For instance matching
22567  * "&lt;a&gt; &lt;b&gt; &lt;c&gt;" against the pattern "&lt;.*&gt;"
22568  * you would obtain three matches: "&lt;a&gt; &lt;b&gt; &lt;c&gt;",
22569  * "&lt;a&gt; &lt;b&gt;" and "&lt;a&gt;".
22570  *
22571  * The number of matched strings is retrieved using
22572  * g_match_info_get_match_count(). To obtain the matched strings and
22573  * their position you can use, respectively, g_match_info_fetch() and
22574  * g_match_info_fetch_pos(). Note that the strings are returned in
22575  * reverse order of length; that is, the longest matching string is
22576  * given first.
22577  *
22578  * Note that the DFA algorithm is slower than the standard one and it
22579  * is not able to capture substrings, so backreferences do not work.
22580  *
22581  * Setting @start_position differs from just passing over a shortened
22582  * string and setting #G_REGEX_MATCH_NOTBOL in the case of a pattern
22583  * that begins with any kind of lookbehind assertion, such as "\b".
22584  *
22585  * A #GMatchInfo structure, used to get information on the match, is
22586  * stored in @match_info if not %NULL. Note that if @match_info is
22587  * not %NULL then it is created even if the function returns %FALSE,
22588  * i.e. you must free it regardless if regular expression actually
22589  * matched.
22590  *
22591  * @string is not copied and is used in #GMatchInfo internally. If
22592  * you use any #GMatchInfo method (except g_match_info_free()) after
22593  * freeing or modifying @string then the behaviour is undefined.
22594  *
22595  * Returns: %TRUE is the string matched, %FALSE otherwise
22596  * Since: 2.14
22597  */
22598
22599
22600 /**
22601  * g_regex_match_full:
22602  * @regex: a #GRegex structure from g_regex_new()
22603  * @string: (array length=string_len): the string to scan for matches
22604  * @string_len: the length of @string, or -1 if @string is nul-terminated
22605  * @start_position: starting index of the string to match
22606  * @match_options: match options
22607  * @match_info: (out) (allow-none): pointer to location where to store the #GMatchInfo, or %NULL if you do not need it
22608  * @error: location to store the error occurring, or %NULL to ignore errors
22609  *
22610  * Scans for a match in string for the pattern in @regex.
22611  * The @match_options are combined with the match options specified
22612  * when the @regex structure was created, letting you have more
22613  * flexibility in reusing #GRegex structures.
22614  *
22615  * Setting @start_position differs from just passing over a shortened
22616  * string and setting #G_REGEX_MATCH_NOTBOL in the case of a pattern
22617  * that begins with any kind of lookbehind assertion, such as "\b".
22618  *
22619  * A #GMatchInfo structure, used to get information on the match, is
22620  * stored in @match_info if not %NULL. Note that if @match_info is
22621  * not %NULL then it is created even if the function returns %FALSE,
22622  * i.e. you must free it regardless if regular expression actually
22623  * matched.
22624  *
22625  * @string is not copied and is used in #GMatchInfo internally. If
22626  * you use any #GMatchInfo method (except g_match_info_free()) after
22627  * freeing or modifying @string then the behaviour is undefined.
22628  *
22629  * To retrieve all the non-overlapping matches of the pattern in
22630  * string you can use g_match_info_next().
22631  *
22632  * |[
22633  * static void
22634  * print_uppercase_words (const gchar *string)
22635  * {
22636  *   /&ast; Print all uppercase-only words. &ast;/
22637  *   GRegex *regex;
22638  *   GMatchInfo *match_info;
22639  *   GError *error = NULL;
22640  *   &nbsp;
22641  *   regex = g_regex_new ("[A-Z]+", 0, 0, NULL);
22642  *   g_regex_match_full (regex, string, -1, 0, 0, &amp;match_info, &amp;error);
22643  *   while (g_match_info_matches (match_info))
22644  *     {
22645  *       gchar *word = g_match_info_fetch (match_info, 0);
22646  *       g_print ("Found: %s\n", word);
22647  *       g_free (word);
22648  *       g_match_info_next (match_info, &amp;error);
22649  *     }
22650  *   g_match_info_free (match_info);
22651  *   g_regex_unref (regex);
22652  *   if (error != NULL)
22653  *     {
22654  *       g_printerr ("Error while matching: %s\n", error->message);
22655  *       g_error_free (error);
22656  *     }
22657  * }
22658  * ]|
22659  *
22660  * Returns: %TRUE is the string matched, %FALSE otherwise
22661  * Since: 2.14
22662  */
22663
22664
22665 /**
22666  * g_regex_match_simple:
22667  * @pattern: the regular expression
22668  * @string: the string to scan for matches
22669  * @compile_options: compile options for the regular expression, or 0
22670  * @match_options: match options, or 0
22671  *
22672  * Scans for a match in @string for @pattern.
22673  *
22674  * This function is equivalent to g_regex_match() but it does not
22675  * require to compile the pattern with g_regex_new(), avoiding some
22676  * lines of code when you need just to do a match without extracting
22677  * substrings, capture counts, and so on.
22678  *
22679  * If this function is to be called on the same @pattern more than
22680  * once, it's more efficient to compile the pattern once with
22681  * g_regex_new() and then use g_regex_match().
22682  *
22683  * Returns: %TRUE if the string matched, %FALSE otherwise
22684  * Since: 2.14
22685  */
22686
22687
22688 /**
22689  * g_regex_new:
22690  * @pattern: the regular expression
22691  * @compile_options: compile options for the regular expression, or 0
22692  * @match_options: match options for the regular expression, or 0
22693  * @error: return location for a #GError
22694  *
22695  * Compiles the regular expression to an internal form, and does
22696  * the initial setup of the #GRegex structure.
22697  *
22698  * Returns: a #GRegex structure. Call g_regex_unref() when you are done with it
22699  * Since: 2.14
22700  */
22701
22702
22703 /**
22704  * g_regex_ref:
22705  * @regex: a #GRegex
22706  *
22707  * Increases reference count of @regex by 1.
22708  *
22709  * Returns: @regex
22710  * Since: 2.14
22711  */
22712
22713
22714 /**
22715  * g_regex_replace:
22716  * @regex: a #GRegex structure
22717  * @string: (array length=string_len): the string to perform matches against
22718  * @string_len: the length of @string, or -1 if @string is nul-terminated
22719  * @start_position: starting index of the string to match
22720  * @replacement: text to replace each match with
22721  * @match_options: options for the match
22722  * @error: location to store the error occurring, or %NULL to ignore errors
22723  *
22724  * Replaces all occurrences of the pattern in @regex with the
22725  * replacement text. Backreferences of the form '\number' or
22726  * '\g&lt;number&gt;' in the replacement text are interpolated by the
22727  * number-th captured subexpression of the match, '\g&lt;name&gt;' refers
22728  * to the captured subexpression with the given name. '\0' refers to the
22729  * complete match, but '\0' followed by a number is the octal representation
22730  * of a character. To include a literal '\' in the replacement, write '\\'.
22731  * There are also escapes that changes the case of the following text:
22732  *
22733  * <variablelist>
22734  * <varlistentry><term>\l</term>
22735  * <listitem>
22736  * <para>Convert to lower case the next character</para>
22737  * </listitem>
22738  * </varlistentry>
22739  * <varlistentry><term>\u</term>
22740  * <listitem>
22741  * <para>Convert to upper case the next character</para>
22742  * </listitem>
22743  * </varlistentry>
22744  * <varlistentry><term>\L</term>
22745  * <listitem>
22746  * <para>Convert to lower case till \E</para>
22747  * </listitem>
22748  * </varlistentry>
22749  * <varlistentry><term>\U</term>
22750  * <listitem>
22751  * <para>Convert to upper case till \E</para>
22752  * </listitem>
22753  * </varlistentry>
22754  * <varlistentry><term>\E</term>
22755  * <listitem>
22756  * <para>End case modification</para>
22757  * </listitem>
22758  * </varlistentry>
22759  * </variablelist>
22760  *
22761  * If you do not need to use backreferences use g_regex_replace_literal().
22762  *
22763  * The @replacement string must be UTF-8 encoded even if #G_REGEX_RAW was
22764  * passed to g_regex_new(). If you want to use not UTF-8 encoded stings
22765  * you can use g_regex_replace_literal().
22766  *
22767  * Setting @start_position differs from just passing over a shortened
22768  * string and setting #G_REGEX_MATCH_NOTBOL in the case of a pattern that
22769  * begins with any kind of lookbehind assertion, such as "\b".
22770  *
22771  * Returns: a newly allocated string containing the replacements
22772  * Since: 2.14
22773  */
22774
22775
22776 /**
22777  * g_regex_replace_eval:
22778  * @regex: a #GRegex structure from g_regex_new()
22779  * @string: (array length=string_len): string to perform matches against
22780  * @string_len: the length of @string, or -1 if @string is nul-terminated
22781  * @start_position: starting index of the string to match
22782  * @match_options: options for the match
22783  * @eval: a function to call for each match
22784  * @user_data: user data to pass to the function
22785  * @error: location to store the error occurring, or %NULL to ignore errors
22786  *
22787  * Replaces occurrences of the pattern in regex with the output of
22788  * @eval for that occurrence.
22789  *
22790  * Setting @start_position differs from just passing over a shortened
22791  * string and setting #G_REGEX_MATCH_NOTBOL in the case of a pattern
22792  * that begins with any kind of lookbehind assertion, such as "\b".
22793  *
22794  * The following example uses g_regex_replace_eval() to replace multiple
22795  * strings at once:
22796  * |[
22797  * static gboolean
22798  * eval_cb (const GMatchInfo *info,
22799  *          GString          *res,
22800  *          gpointer          data)
22801  * {
22802  *   gchar *match;
22803  *   gchar *r;
22804  *
22805  *    match = g_match_info_fetch (info, 0);
22806  *    r = g_hash_table_lookup ((GHashTable *)data, match);
22807  *    g_string_append (res, r);
22808  *    g_free (match);
22809  *
22810  *    return FALSE;
22811  * }
22812  *
22813  * /&ast; ... &ast;/
22814  *
22815  * GRegex *reg;
22816  * GHashTable *h;
22817  * gchar *res;
22818  *
22819  * h = g_hash_table_new (g_str_hash, g_str_equal);
22820  *
22821  * g_hash_table_insert (h, "1", "ONE");
22822  * g_hash_table_insert (h, "2", "TWO");
22823  * g_hash_table_insert (h, "3", "THREE");
22824  * g_hash_table_insert (h, "4", "FOUR");
22825  *
22826  * reg = g_regex_new ("1|2|3|4", 0, 0, NULL);
22827  * res = g_regex_replace_eval (reg, text, -1, 0, 0, eval_cb, h, NULL);
22828  * g_hash_table_destroy (h);
22829  *
22830  * /&ast; ... &ast;/
22831  * ]|
22832  *
22833  * Returns: a newly allocated string containing the replacements
22834  * Since: 2.14
22835  */
22836
22837
22838 /**
22839  * g_regex_replace_literal:
22840  * @regex: a #GRegex structure
22841  * @string: (array length=string_len): the string to perform matches against
22842  * @string_len: the length of @string, or -1 if @string is nul-terminated
22843  * @start_position: starting index of the string to match
22844  * @replacement: text to replace each match with
22845  * @match_options: options for the match
22846  * @error: location to store the error occurring, or %NULL to ignore errors
22847  *
22848  * Replaces all occurrences of the pattern in @regex with the
22849  * replacement text. @replacement is replaced literally, to
22850  * include backreferences use g_regex_replace().
22851  *
22852  * Setting @start_position differs from just passing over a
22853  * shortened string and setting #G_REGEX_MATCH_NOTBOL in the
22854  * case of a pattern that begins with any kind of lookbehind
22855  * assertion, such as "\b".
22856  *
22857  * Returns: a newly allocated string containing the replacements
22858  * Since: 2.14
22859  */
22860
22861
22862 /**
22863  * g_regex_split:
22864  * @regex: a #GRegex structure
22865  * @string: the string to split with the pattern
22866  * @match_options: match time option flags
22867  *
22868  * Breaks the string on the pattern, and returns an array of the tokens.
22869  * If the pattern contains capturing parentheses, then the text for each
22870  * of the substrings will also be returned. If the pattern does not match
22871  * anywhere in the string, then the whole string is returned as the first
22872  * token.
22873  *
22874  * As a special case, the result of splitting the empty string "" is an
22875  * empty vector, not a vector containing a single string. The reason for
22876  * this special case is that being able to represent a empty vector is
22877  * typically more useful than consistent handling of empty elements. If
22878  * you do need to represent empty elements, you'll need to check for the
22879  * empty string before calling this function.
22880  *
22881  * A pattern that can match empty strings splits @string into separate
22882  * characters wherever it matches the empty string between characters.
22883  * For example splitting "ab c" using as a separator "\s*", you will get
22884  * "a", "b" and "c".
22885  *
22886  * Returns: (transfer full): a %NULL-terminated gchar ** array. Free it using g_strfreev()
22887  * Since: 2.14
22888  */
22889
22890
22891 /**
22892  * g_regex_split_full:
22893  * @regex: a #GRegex structure
22894  * @string: (array length=string_len): the string to split with the pattern
22895  * @string_len: the length of @string, or -1 if @string is nul-terminated
22896  * @start_position: starting index of the string to match
22897  * @match_options: match time option flags
22898  * @max_tokens: the maximum number of tokens to split @string into. If this is less than 1, the string is split completely
22899  * @error: return location for a #GError
22900  *
22901  * Breaks the string on the pattern, and returns an array of the tokens.
22902  * If the pattern contains capturing parentheses, then the text for each
22903  * of the substrings will also be returned. If the pattern does not match
22904  * anywhere in the string, then the whole string is returned as the first
22905  * token.
22906  *
22907  * As a special case, the result of splitting the empty string "" is an
22908  * empty vector, not a vector containing a single string. The reason for
22909  * this special case is that being able to represent a empty vector is
22910  * typically more useful than consistent handling of empty elements. If
22911  * you do need to represent empty elements, you'll need to check for the
22912  * empty string before calling this function.
22913  *
22914  * A pattern that can match empty strings splits @string into separate
22915  * characters wherever it matches the empty string between characters.
22916  * For example splitting "ab c" using as a separator "\s*", you will get
22917  * "a", "b" and "c".
22918  *
22919  * Setting @start_position differs from just passing over a shortened
22920  * string and setting #G_REGEX_MATCH_NOTBOL in the case of a pattern
22921  * that begins with any kind of lookbehind assertion, such as "\b".
22922  *
22923  * Returns: (transfer full): a %NULL-terminated gchar ** array. Free it using g_strfreev()
22924  * Since: 2.14
22925  */
22926
22927
22928 /**
22929  * g_regex_split_simple:
22930  * @pattern: the regular expression
22931  * @string: the string to scan for matches
22932  * @compile_options: compile options for the regular expression, or 0
22933  * @match_options: match options, or 0
22934  *
22935  * Breaks the string on the pattern, and returns an array of
22936  * the tokens. If the pattern contains capturing parentheses,
22937  * then the text for each of the substrings will also be returned.
22938  * If the pattern does not match anywhere in the string, then the
22939  * whole string is returned as the first token.
22940  *
22941  * This function is equivalent to g_regex_split() but it does
22942  * not require to compile the pattern with g_regex_new(), avoiding
22943  * some lines of code when you need just to do a split without
22944  * extracting substrings, capture counts, and so on.
22945  *
22946  * If this function is to be called on the same @pattern more than
22947  * once, it's more efficient to compile the pattern once with
22948  * g_regex_new() and then use g_regex_split().
22949  *
22950  * As a special case, the result of splitting the empty string ""
22951  * is an empty vector, not a vector containing a single string.
22952  * The reason for this special case is that being able to represent
22953  * a empty vector is typically more useful than consistent handling
22954  * of empty elements. If you do need to represent empty elements,
22955  * you'll need to check for the empty string before calling this
22956  * function.
22957  *
22958  * A pattern that can match empty strings splits @string into
22959  * separate characters wherever it matches the empty string between
22960  * characters. For example splitting "ab c" using as a separator
22961  * "\s*", you will get "a", "b" and "c".
22962  *
22963  * Returns: (transfer full): a %NULL-terminated array of strings. Free it using g_strfreev()
22964  * Since: 2.14
22965  */
22966
22967
22968 /**
22969  * g_regex_unref:
22970  * @regex: a #GRegex
22971  *
22972  * Decreases reference count of @regex by 1. When reference count drops
22973  * to zero, it frees all the memory associated with the regex structure.
22974  *
22975  * Since: 2.14
22976  */
22977
22978
22979 /**
22980  * g_reload_user_special_dirs_cache:
22981  *
22982  * Resets the cache used for g_get_user_special_dir(), so
22983  * that the latest on-disk version is used. Call this only
22984  * if you just changed the data on disk yourself.
22985  *
22986  * Due to threadsafety issues this may cause leaking of strings
22987  * that were previously returned from g_get_user_special_dir()
22988  * that can't be freed. We ensure to only leak the data for
22989  * the directories that actually changed value though.
22990  *
22991  * Since: 2.22
22992  */
22993
22994
22995 /**
22996  * g_remove:
22997  * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows)
22998  *
22999  * A wrapper for the POSIX remove() function. The remove() function
23000  * deletes a name from the filesystem.
23001  *
23002  * See your C library manual for more details about how remove() works
23003  * on your system. On Unix, remove() removes also directories, as it
23004  * calls unlink() for files and rmdir() for directories. On Windows,
23005  * although remove() in the C library only works for files, this
23006  * function tries first remove() and then if that fails rmdir(), and
23007  * thus works for both files and directories. Note however, that on
23008  * Windows, it is in general not possible to remove a file that is
23009  * open to some process, or mapped into memory.
23010  *
23011  * If this function fails on Windows you can't infer too much from the
23012  * errno value. rmdir() is tried regardless of what caused remove() to
23013  * fail. Any errno value set by remove() will be overwritten by that
23014  * set by rmdir().
23015  *
23016  * Returns: 0 if the file was successfully removed, -1 if an error occurred
23017  * Since: 2.6
23018  */
23019
23020
23021 /**
23022  * g_rename:
23023  * @oldfilename: a pathname in the GLib file name encoding (UTF-8 on Windows)
23024  * @newfilename: a pathname in the GLib file name encoding
23025  *
23026  * A wrapper for the POSIX rename() function. The rename() function
23027  * renames a file, moving it between directories if required.
23028  *
23029  * See your C library manual for more details about how rename() works
23030  * on your system. It is not possible in general on Windows to rename
23031  * a file that is open to some process.
23032  *
23033  * Returns: 0 if the renaming succeeded, -1 if an error occurred
23034  * Since: 2.6
23035  */
23036
23037
23038 /**
23039  * g_rmdir:
23040  * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows)
23041  *
23042  * A wrapper for the POSIX rmdir() function. The rmdir() function
23043  * deletes a directory from the filesystem.
23044  *
23045  * See your C library manual for more details about how rmdir() works
23046  * on your system.
23047  *
23048  * Returns: 0 if the directory was successfully removed, -1 if an error occurred
23049  * Since: 2.6
23050  */
23051
23052
23053 /**
23054  * g_rw_lock_clear:
23055  * @rw_lock: an initialized #GRWLock
23056  *
23057  * Frees the resources allocated to a lock with g_rw_lock_init().
23058  *
23059  * This function should not be used with a #GRWLock that has been
23060  * statically allocated.
23061  *
23062  * Calling g_rw_lock_clear() when any thread holds the lock
23063  * leads to undefined behaviour.
23064  *
23065  * Sine: 2.32
23066  */
23067
23068
23069 /**
23070  * g_rw_lock_init:
23071  * @rw_lock: an uninitialized #GRWLock
23072  *
23073  * Initializes a #GRWLock so that it can be used.
23074  *
23075  * This function is useful to initialize a lock that has been
23076  * allocated on the stack, or as part of a larger structure.  It is not
23077  * necessary to initialise a reader-writer lock that has been statically
23078  * allocated.
23079  *
23080  * |[
23081  *   typedef struct {
23082  *     GRWLock l;
23083  *     ...
23084  *   } Blob;
23085  *
23086  * Blob *b;
23087  *
23088  * b = g_new (Blob, 1);
23089  * g_rw_lock_init (&b->l);
23090  * ]|
23091  *
23092  * To undo the effect of g_rw_lock_init() when a lock is no longer
23093  * needed, use g_rw_lock_clear().
23094  *
23095  * Calling g_rw_lock_init() on an already initialized #GRWLock leads
23096  * to undefined behaviour.
23097  *
23098  * Since: 2.32
23099  */
23100
23101
23102 /**
23103  * g_rw_lock_reader_lock:
23104  * @rw_lock: a #GRWLock
23105  *
23106  * Obtain a read lock on @rw_lock. If another thread currently holds
23107  * the write lock on @rw_lock or blocks waiting for it, the current
23108  * thread will block. Read locks can be taken recursively.
23109  *
23110  * It is implementation-defined how many threads are allowed to
23111  * hold read locks on the same lock simultaneously.
23112  *
23113  * Since: 2.32
23114  */
23115
23116
23117 /**
23118  * g_rw_lock_reader_trylock:
23119  * @rw_lock: a #GRWLock
23120  *
23121  * Tries to obtain a read lock on @rw_lock and returns %TRUE if
23122  * the read lock was successfully obtained. Otherwise it
23123  * returns %FALSE.
23124  *
23125  * Returns: %TRUE if @rw_lock could be locked
23126  * Since: 2.32
23127  */
23128
23129
23130 /**
23131  * g_rw_lock_reader_unlock:
23132  * @rw_lock: a #GRWLock
23133  *
23134  * Release a read lock on @rw_lock.
23135  *
23136  * Calling g_rw_lock_reader_unlock() on a lock that is not held
23137  * by the current thread leads to undefined behaviour.
23138  *
23139  * Since: 2.32
23140  */
23141
23142
23143 /**
23144  * g_rw_lock_writer_lock:
23145  * @rw_lock: a #GRWLock
23146  *
23147  * Obtain a write lock on @rw_lock. If any thread already holds
23148  * a read or write lock on @rw_lock, the current thread will block
23149  * until all other threads have dropped their locks on @rw_lock.
23150  *
23151  * Since: 2.32
23152  */
23153
23154
23155 /**
23156  * g_rw_lock_writer_trylock:
23157  * @rw_lock: a #GRWLock
23158  *
23159  * Tries to obtain a write lock on @rw_lock. If any other thread holds
23160  * a read or write lock on @rw_lock, it immediately returns %FALSE.
23161  * Otherwise it locks @rw_lock and returns %TRUE.
23162  *
23163  * Returns: %TRUE if @rw_lock could be locked
23164  * Since: 2.32
23165  */
23166
23167
23168 /**
23169  * g_rw_lock_writer_unlock:
23170  * @rw_lock: a #GRWLock
23171  *
23172  * Release a write lock on @rw_lock.
23173  *
23174  * Calling g_rw_lock_writer_unlock() on a lock that is not held
23175  * by the current thread leads to undefined behaviour.
23176  *
23177  * Since: 2.32
23178  */
23179
23180
23181 /**
23182  * g_scanner_add_symbol:
23183  * @scanner: a #GScanner
23184  * @symbol: the symbol to add
23185  * @value: the value of the symbol
23186  *
23187  * Adds a symbol to the default scope.
23188  *
23189  * Deprecated: 2.2: Use g_scanner_scope_add_symbol() instead.
23190  */
23191
23192
23193 /**
23194  * g_scanner_cur_line:
23195  * @scanner: a #GScanner
23196  *
23197  * Returns the current line in the input stream (counting
23198  * from 1). This is the line of the last token parsed via
23199  * g_scanner_get_next_token().
23200  *
23201  * Returns: the current line
23202  */
23203
23204
23205 /**
23206  * g_scanner_cur_position:
23207  * @scanner: a #GScanner
23208  *
23209  * Returns the current position in the current line (counting
23210  * from 0). This is the position of the last token parsed via
23211  * g_scanner_get_next_token().
23212  *
23213  * Returns: the current position on the line
23214  */
23215
23216
23217 /**
23218  * g_scanner_cur_token:
23219  * @scanner: a #GScanner
23220  *
23221  * Gets the current token type. This is simply the @token
23222  * field in the #GScanner structure.
23223  *
23224  * Returns: the current token type
23225  */
23226
23227
23228 /**
23229  * g_scanner_cur_value:
23230  * @scanner: a #GScanner
23231  *
23232  * Gets the current token value. This is simply the @value
23233  * field in the #GScanner structure.
23234  *
23235  * Returns: the current token value
23236  */
23237
23238
23239 /**
23240  * g_scanner_destroy:
23241  * @scanner: a #GScanner
23242  *
23243  * Frees all memory used by the #GScanner.
23244  */
23245
23246
23247 /**
23248  * g_scanner_eof:
23249  * @scanner: a #GScanner
23250  *
23251  * Returns %TRUE if the scanner has reached the end of
23252  * the file or text buffer.
23253  *
23254  * Returns: %TRUE if the scanner has reached the end of the file or text buffer
23255  */
23256
23257
23258 /**
23259  * g_scanner_error:
23260  * @scanner: a #GScanner
23261  * @format: the message format. See the printf() documentation
23262  * @...: the parameters to insert into the format string
23263  *
23264  * Outputs an error message, via the #GScanner message handler.
23265  */
23266
23267
23268 /**
23269  * g_scanner_foreach_symbol:
23270  * @scanner: a #GScanner
23271  * @func: the function to call with each symbol
23272  * @data: data to pass to the function
23273  *
23274  * Calls a function for each symbol in the default scope.
23275  *
23276  * Deprecated: 2.2: Use g_scanner_scope_foreach_symbol() instead.
23277  */
23278
23279
23280 /**
23281  * g_scanner_freeze_symbol_table:
23282  * @scanner: a #GScanner
23283  *
23284  * There is no reason to use this macro, since it does nothing.
23285  *
23286  * Deprecated: 2.2: This macro does nothing.
23287  */
23288
23289
23290 /**
23291  * g_scanner_get_next_token:
23292  * @scanner: a #GScanner
23293  *
23294  * Parses the next token just like g_scanner_peek_next_token()
23295  * and also removes it from the input stream. The token data is
23296  * placed in the @token, @value, @line, and @position fields of
23297  * the #GScanner structure.
23298  *
23299  * Returns: the type of the token
23300  */
23301
23302
23303 /**
23304  * g_scanner_input_file:
23305  * @scanner: a #GScanner
23306  * @input_fd: a file descriptor
23307  *
23308  * Prepares to scan a file.
23309  */
23310
23311
23312 /**
23313  * g_scanner_input_text:
23314  * @scanner: a #GScanner
23315  * @text: the text buffer to scan
23316  * @text_len: the length of the text buffer
23317  *
23318  * Prepares to scan a text buffer.
23319  */
23320
23321
23322 /**
23323  * g_scanner_lookup_symbol:
23324  * @scanner: a #GScanner
23325  * @symbol: the symbol to look up
23326  *
23327  * Looks up a symbol in the current scope and return its value.
23328  * If the symbol is not bound in the current scope, %NULL is
23329  * returned.
23330  *
23331  * Returns: the value of @symbol in the current scope, or %NULL if @symbol is not bound in the current scope
23332  */
23333
23334
23335 /**
23336  * g_scanner_new:
23337  * @config_templ: the initial scanner settings
23338  *
23339  * Creates a new #GScanner.
23340  *
23341  * The @config_templ structure specifies the initial settings
23342  * of the scanner, which are copied into the #GScanner
23343  * @config field. If you pass %NULL then the default settings
23344  * are used.
23345  *
23346  * Returns: the new #GScanner
23347  */
23348
23349
23350 /**
23351  * g_scanner_peek_next_token:
23352  * @scanner: a #GScanner
23353  *
23354  * Parses the next token, without removing it from the input stream.
23355  * The token data is placed in the @next_token, @next_value, @next_line,
23356  * and @next_position fields of the #GScanner structure.
23357  *
23358  * Note that, while the token is not removed from the input stream
23359  * (i.e. the next call to g_scanner_get_next_token() will return the
23360  * same token), it will not be reevaluated. This can lead to surprising
23361  * results when changing scope or the scanner configuration after peeking
23362  * the next token. Getting the next token after switching the scope or
23363  * configuration will return whatever was peeked before, regardless of
23364  * any symbols that may have been added or removed in the new scope.
23365  *
23366  * Returns: the type of the token
23367  */
23368
23369
23370 /**
23371  * g_scanner_remove_symbol:
23372  * @scanner: a #GScanner
23373  * @symbol: the symbol to remove
23374  *
23375  * Removes a symbol from the default scope.
23376  *
23377  * Deprecated: 2.2: Use g_scanner_scope_remove_symbol() instead.
23378  */
23379
23380
23381 /**
23382  * g_scanner_scope_add_symbol:
23383  * @scanner: a #GScanner
23384  * @scope_id: the scope id
23385  * @symbol: the symbol to add
23386  * @value: the value of the symbol
23387  *
23388  * Adds a symbol to the given scope.
23389  */
23390
23391
23392 /**
23393  * g_scanner_scope_foreach_symbol:
23394  * @scanner: a #GScanner
23395  * @scope_id: the scope id
23396  * @func: the function to call for each symbol/value pair
23397  * @user_data: user data to pass to the function
23398  *
23399  * Calls the given function for each of the symbol/value pairs
23400  * in the given scope of the #GScanner. The function is passed
23401  * the symbol and value of each pair, and the given @user_data
23402  * parameter.
23403  */
23404
23405
23406 /**
23407  * g_scanner_scope_lookup_symbol:
23408  * @scanner: a #GScanner
23409  * @scope_id: the scope id
23410  * @symbol: the symbol to look up
23411  *
23412  * Looks up a symbol in a scope and return its value. If the
23413  * symbol is not bound in the scope, %NULL is returned.
23414  *
23415  * Returns: the value of @symbol in the given scope, or %NULL if @symbol is not bound in the given scope.
23416  */
23417
23418
23419 /**
23420  * g_scanner_scope_remove_symbol:
23421  * @scanner: a #GScanner
23422  * @scope_id: the scope id
23423  * @symbol: the symbol to remove
23424  *
23425  * Removes a symbol from a scope.
23426  */
23427
23428
23429 /**
23430  * g_scanner_set_scope:
23431  * @scanner: a #GScanner
23432  * @scope_id: the new scope id
23433  *
23434  * Sets the current scope.
23435  *
23436  * Returns: the old scope id
23437  */
23438
23439
23440 /**
23441  * g_scanner_sync_file_offset:
23442  * @scanner: a #GScanner
23443  *
23444  * Rewinds the filedescriptor to the current buffer position
23445  * and blows the file read ahead buffer. This is useful for
23446  * third party uses of the scanners filedescriptor, which hooks
23447  * onto the current scanning position.
23448  */
23449
23450
23451 /**
23452  * g_scanner_thaw_symbol_table:
23453  * @scanner: a #GScanner
23454  *
23455  * There is no reason to use this macro, since it does nothing.
23456  *
23457  * Deprecated: 2.2: This macro does nothing.
23458  */
23459
23460
23461 /**
23462  * g_scanner_unexp_token:
23463  * @scanner: a #GScanner
23464  * @expected_token: the expected token
23465  * @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.
23466  * @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.
23467  * @symbol_name: the name of the symbol, if the scanner's current token is a symbol.
23468  * @message: a message string to output at the end of the warning/error, or %NULL.
23469  * @is_error: if %TRUE it is output as an error. If %FALSE it is output as a warning.
23470  *
23471  * Outputs a message through the scanner's msg_handler,
23472  * resulting from an unexpected token in the input stream.
23473  * Note that you should not call g_scanner_peek_next_token()
23474  * followed by g_scanner_unexp_token() without an intermediate
23475  * call to g_scanner_get_next_token(), as g_scanner_unexp_token()
23476  * evaluates the scanner's current token (not the peeked token)
23477  * to construct part of the message.
23478  */
23479
23480
23481 /**
23482  * g_scanner_warn:
23483  * @scanner: a #GScanner
23484  * @format: the message format. See the printf() documentation
23485  * @...: the parameters to insert into the format string
23486  *
23487  * Outputs a warning message, via the #GScanner message handler.
23488  */
23489
23490
23491 /**
23492  * g_sequence_append:
23493  * @seq: a #GSequence
23494  * @data: the data for the new item
23495  *
23496  * Adds a new item to the end of @seq.
23497  *
23498  * Returns: an iterator pointing to the new item
23499  * Since: 2.14
23500  */
23501
23502
23503 /**
23504  * g_sequence_foreach:
23505  * @seq: a #GSequence
23506  * @func: the function to call for each item in @seq
23507  * @user_data: user data passed to @func
23508  *
23509  * Calls @func for each item in the sequence passing @user_data
23510  * to the function.
23511  *
23512  * Since: 2.14
23513  */
23514
23515
23516 /**
23517  * g_sequence_foreach_range:
23518  * @begin: a #GSequenceIter
23519  * @end: a #GSequenceIter
23520  * @func: a #GFunc
23521  * @user_data: user data passed to @func
23522  *
23523  * Calls @func for each item in the range (@begin, @end) passing
23524  * @user_data to the function.
23525  *
23526  * Since: 2.14
23527  */
23528
23529
23530 /**
23531  * g_sequence_free:
23532  * @seq: a #GSequence
23533  *
23534  * Frees the memory allocated for @seq. If @seq has a data destroy
23535  * function associated with it, that function is called on all items in
23536  * @seq.
23537  *
23538  * Since: 2.14
23539  */
23540
23541
23542 /**
23543  * g_sequence_get:
23544  * @iter: a #GSequenceIter
23545  *
23546  * Returns the data that @iter points to.
23547  *
23548  * Returns: the data that @iter points to
23549  * Since: 2.14
23550  */
23551
23552
23553 /**
23554  * g_sequence_get_begin_iter:
23555  * @seq: a #GSequence
23556  *
23557  * Returns the begin iterator for @seq.
23558  *
23559  * Returns: the begin iterator for @seq.
23560  * Since: 2.14
23561  */
23562
23563
23564 /**
23565  * g_sequence_get_end_iter:
23566  * @seq: a #GSequence
23567  *
23568  * Returns the end iterator for @seg
23569  *
23570  * Returns: the end iterator for @seq
23571  * Since: 2.14
23572  */
23573
23574
23575 /**
23576  * g_sequence_get_iter_at_pos:
23577  * @seq: a #GSequence
23578  * @pos: a position in @seq, or -1 for the end.
23579  *
23580  * Returns the iterator at position @pos. If @pos is negative or larger
23581  * than the number of items in @seq, the end iterator is returned.
23582  *
23583  * Returns: The #GSequenceIter at position @pos
23584  * Since: 2.14
23585  */
23586
23587
23588 /**
23589  * g_sequence_get_length:
23590  * @seq: a #GSequence
23591  *
23592  * Returns the length of @seq
23593  *
23594  * Returns: the length of @seq
23595  * Since: 2.14
23596  */
23597
23598
23599 /**
23600  * g_sequence_insert_before:
23601  * @iter: a #GSequenceIter
23602  * @data: the data for the new item
23603  *
23604  * Inserts a new item just before the item pointed to by @iter.
23605  *
23606  * Returns: an iterator pointing to the new item
23607  * Since: 2.14
23608  */
23609
23610
23611 /**
23612  * g_sequence_insert_sorted:
23613  * @seq: a #GSequence
23614  * @data: the data to insert
23615  * @cmp_func: the function used to compare items in the sequence
23616  * @cmp_data: user data passed to @cmp_func.
23617  *
23618  * Inserts @data into @sequence using @func to determine the new
23619  * position. The sequence must already be sorted according to @cmp_func;
23620  * otherwise the new position of @data is undefined.
23621  *
23622  * @cmp_func is called with two items of the @seq and @user_data.
23623  * It should return 0 if the items are equal, a negative value
23624  * if the first item comes before the second, and a positive value
23625  * if the second  item comes before the first.
23626  *
23627  * Returns: a #GSequenceIter pointing to the new item.
23628  * Since: 2.14
23629  */
23630
23631
23632 /**
23633  * g_sequence_insert_sorted_iter:
23634  * @seq: a #GSequence
23635  * @data: data for the new item
23636  * @iter_cmp: the function used to compare iterators in the sequence
23637  * @cmp_data: user data passed to @cmp_func
23638  *
23639  * Like g_sequence_insert_sorted(), but uses
23640  * a #GSequenceIterCompareFunc instead of a #GCompareDataFunc as
23641  * the compare function.
23642  *
23643  * @iter_cmp is called with two iterators pointing into @seq.
23644  * It should return 0 if the iterators are equal, a negative
23645  * value if the first iterator comes before the second, and a
23646  * positive value if the second iterator comes before the first.
23647  *
23648  * It is called with two iterators pointing into @seq. It should
23649  * return 0 if the iterators are equal, a negative value if the
23650  * first iterator comes before the second, and a positive value
23651  * if the second iterator comes before the first.
23652  *
23653  * Returns: a #GSequenceIter pointing to the new item
23654  * Since: 2.14
23655  */
23656
23657
23658 /**
23659  * g_sequence_iter_compare:
23660  * @a: a #GSequenceIter
23661  * @b: a #GSequenceIter
23662  *
23663  * Returns a negative number if @a comes before @b, 0 if they are equal,
23664  * and a positive number if @a comes after @b.
23665  *
23666  * The @a and @b iterators must point into the same sequence.
23667  *
23668  * Returns: A negative number if @a comes before @b, 0 if they are equal, and a positive number if @a comes after @b.
23669  * Since: 2.14
23670  */
23671
23672
23673 /**
23674  * g_sequence_iter_get_position:
23675  * @iter: a #GSequenceIter
23676  *
23677  * Returns the position of @iter
23678  *
23679  * Returns: the position of @iter
23680  * Since: 2.14
23681  */
23682
23683
23684 /**
23685  * g_sequence_iter_get_sequence:
23686  * @iter: a #GSequenceIter
23687  *
23688  * Returns the #GSequence that @iter points into.
23689  *
23690  * Returns: the #GSequence that @iter points into.
23691  * Since: 2.14
23692  */
23693
23694
23695 /**
23696  * g_sequence_iter_is_begin:
23697  * @iter: a #GSequenceIter
23698  *
23699  * Returns whether @iter is the begin iterator
23700  *
23701  * Returns: whether @iter is the begin iterator
23702  * Since: 2.14
23703  */
23704
23705
23706 /**
23707  * g_sequence_iter_is_end:
23708  * @iter: a #GSequenceIter
23709  *
23710  * Returns whether @iter is the end iterator
23711  *
23712  * Returns: Whether @iter is the end iterator.
23713  * Since: 2.14
23714  */
23715
23716
23717 /**
23718  * g_sequence_iter_move:
23719  * @iter: a #GSequenceIter
23720  * @delta: A positive or negative number indicating how many positions away from @iter the returned #GSequenceIter will be.
23721  *
23722  * Returns the #GSequenceIter which is @delta positions away from @iter.
23723  * If @iter is closer than -@delta positions to the beginning of the sequence,
23724  * the begin iterator is returned. If @iter is closer than @delta positions
23725  * to the end of the sequence, the end iterator is returned.
23726  *
23727  * Returns: a #GSequenceIter which is @delta positions away from @iter.
23728  * Since: 2.14
23729  */
23730
23731
23732 /**
23733  * g_sequence_iter_next:
23734  * @iter: a #GSequenceIter
23735  *
23736  * Returns an iterator pointing to the next position after @iter. If
23737  * @iter is the end iterator, the end iterator is returned.
23738  *
23739  * Returns: a #GSequenceIter pointing to the next position after @iter.
23740  * Since: 2.14
23741  */
23742
23743
23744 /**
23745  * g_sequence_iter_prev:
23746  * @iter: a #GSequenceIter
23747  *
23748  * Returns an iterator pointing to the previous position before @iter. If
23749  * @iter is the begin iterator, the begin iterator is returned.
23750  *
23751  * Returns: a #GSequenceIter pointing to the previous position before @iter.
23752  * Since: 2.14
23753  */
23754
23755
23756 /**
23757  * g_sequence_lookup:
23758  * @seq: a #GSequence
23759  * @data: data to lookup
23760  * @cmp_func: the function used to compare items in the sequence
23761  * @cmp_data: user data passed to @cmp_func.
23762  *
23763  * Returns an iterator pointing to the position of the first item found
23764  * equal to @data according to @cmp_func and @cmp_data. If more than one
23765  * item is equal, it is not guaranteed that it is the first which is
23766  * returned. In that case, you can use g_sequence_iter_next() and
23767  * g_sequence_iter_prev() to get others.
23768  *
23769  * @cmp_func is called with two items of the @seq and @user_data.
23770  * It should return 0 if the items are equal, a negative value if
23771  * the first item comes before the second, and a positive value if
23772  * the second item comes before the first.
23773  *
23774  * <note><para>
23775  * This function will fail if the data contained in the sequence is
23776  * unsorted.  Use g_sequence_insert_sorted() or
23777  * g_sequence_insert_sorted_iter() to add data to your sequence or, if
23778  * you want to add a large amount of data, call g_sequence_sort() after
23779  * doing unsorted insertions.
23780  * </para></note>
23781  *
23782  * Returns: an #GSequenceIter pointing to the position of the first item found equal to @data according to @cmp_func and @cmp_data.
23783  * Since: 2.28
23784  */
23785
23786
23787 /**
23788  * g_sequence_lookup_iter:
23789  * @seq: a #GSequence
23790  * @data: data to lookup
23791  * @iter_cmp: the function used to compare iterators in the sequence
23792  * @cmp_data: user data passed to @iter_cmp
23793  *
23794  * Like g_sequence_lookup(), but uses a #GSequenceIterCompareFunc
23795  * instead of a #GCompareDataFunc as the compare function.
23796  *
23797  * @iter_cmp is called with two iterators pointing into @seq.
23798  * It should return 0 if the iterators are equal, a negative value
23799  * if the first iterator comes before the second, and a positive
23800  * value if the second iterator comes before the first.
23801  *
23802  * <note><para>
23803  * This function will fail if the data contained in the sequence is
23804  * unsorted.  Use g_sequence_insert_sorted() or
23805  * g_sequence_insert_sorted_iter() to add data to your sequence or, if
23806  * you want to add a large amount of data, call g_sequence_sort() after
23807  * doing unsorted insertions.
23808  * </para></note>
23809  *
23810  * Returns: an #GSequenceIter pointing to the position of the first item found equal to @data according to @cmp_func and @cmp_data.
23811  * Since: 2.28
23812  */
23813
23814
23815 /**
23816  * g_sequence_move:
23817  * @src: a #GSequenceIter pointing to the item to move
23818  * @dest: a #GSequenceIter pointing to the position to which the item is moved.
23819  *
23820  * Moves the item pointed to by @src to the position indicated by @dest.
23821  * After calling this function @dest will point to the position immediately
23822  * after @src. It is allowed for @src and @dest to point into different
23823  * sequences.
23824  *
23825  * Since: 2.14
23826  */
23827
23828
23829 /**
23830  * g_sequence_move_range:
23831  * @dest: a #GSequenceIter
23832  * @begin: a #GSequenceIter
23833  * @end: a #GSequenceIter
23834  *
23835  * Inserts the (@begin, @end) range at the destination pointed to by ptr.
23836  * The @begin and @end iters must point into the same sequence. It is
23837  * allowed for @dest to point to a different sequence than the one pointed
23838  * into by @begin and @end.
23839  *
23840  * If @dest is NULL, the range indicated by @begin and @end is
23841  * removed from the sequence. If @dest iter points to a place within
23842  * the (@begin, @end) range, the range does not move.
23843  *
23844  * Since: 2.14
23845  */
23846
23847
23848 /**
23849  * g_sequence_new:
23850  * @data_destroy: (allow-none): a #GDestroyNotify function, or %NULL
23851  *
23852  * Creates a new GSequence. The @data_destroy function, if non-%NULL will
23853  * be called on all items when the sequence is destroyed and on items that
23854  * are removed from the sequence.
23855  *
23856  * Returns: a new #GSequence
23857  * Since: 2.14
23858  */
23859
23860
23861 /**
23862  * g_sequence_prepend:
23863  * @seq: a #GSequence
23864  * @data: the data for the new item
23865  *
23866  * Adds a new item to the front of @seq
23867  *
23868  * Returns: an iterator pointing to the new item
23869  * Since: 2.14
23870  */
23871
23872
23873 /**
23874  * g_sequence_range_get_midpoint:
23875  * @begin: a #GSequenceIter
23876  * @end: a #GSequenceIter
23877  *
23878  * Finds an iterator somewhere in the range (@begin, @end). This
23879  * iterator will be close to the middle of the range, but is not
23880  * guaranteed to be <emphasis>exactly</emphasis> in the middle.
23881  *
23882  * The @begin and @end iterators must both point to the same sequence and
23883  * @begin must come before or be equal to @end in the sequence.
23884  *
23885  * Returns: A #GSequenceIter pointing somewhere in the (@begin, @end) range.
23886  * Since: 2.14
23887  */
23888
23889
23890 /**
23891  * g_sequence_remove:
23892  * @iter: a #GSequenceIter
23893  *
23894  * Removes the item pointed to by @iter. It is an error to pass the
23895  * end iterator to this function.
23896  *
23897  * If the sequence has a data destroy function associated with it, this
23898  * function is called on the data for the removed item.
23899  *
23900  * Since: 2.14
23901  */
23902
23903
23904 /**
23905  * g_sequence_remove_range:
23906  * @begin: a #GSequenceIter
23907  * @end: a #GSequenceIter
23908  *
23909  * Removes all items in the (@begin, @end) range.
23910  *
23911  * If the sequence has a data destroy function associated with it, this
23912  * function is called on the data for the removed items.
23913  *
23914  * Since: 2.14
23915  */
23916
23917
23918 /**
23919  * g_sequence_search:
23920  * @seq: a #GSequence
23921  * @data: data for the new item
23922  * @cmp_func: the function used to compare items in the sequence
23923  * @cmp_data: user data passed to @cmp_func.
23924  *
23925  * Returns an iterator pointing to the position where @data would
23926  * be inserted according to @cmp_func and @cmp_data.
23927  *
23928  * @cmp_func is called with two items of the @seq and @user_data.
23929  * It should return 0 if the items are equal, a negative value if
23930  * the first item comes before the second, and a positive value if
23931  * the second item comes before the first.
23932  *
23933  * If you are simply searching for an existing element of the sequence,
23934  * consider using g_sequence_lookup().
23935  *
23936  * <note><para>
23937  * This function will fail if the data contained in the sequence is
23938  * unsorted.  Use g_sequence_insert_sorted() or
23939  * g_sequence_insert_sorted_iter() to add data to your sequence or, if
23940  * you want to add a large amount of data, call g_sequence_sort() after
23941  * doing unsorted insertions.
23942  * </para></note>
23943  *
23944  * Returns: an #GSequenceIter pointing to the position where @data would have been inserted according to @cmp_func and @cmp_data.
23945  * Since: 2.14
23946  */
23947
23948
23949 /**
23950  * g_sequence_search_iter:
23951  * @seq: a #GSequence
23952  * @data: data for the new item
23953  * @iter_cmp: the function used to compare iterators in the sequence
23954  * @cmp_data: user data passed to @iter_cmp
23955  *
23956  * Like g_sequence_search(), but uses a #GSequenceIterCompareFunc
23957  * instead of a #GCompareDataFunc as the compare function.
23958  *
23959  * @iter_cmp is called with two iterators pointing into @seq.
23960  * It should return 0 if the iterators are equal, a negative value
23961  * if the first iterator comes before the second, and a positive
23962  * value if the second iterator comes before the first.
23963  *
23964  * If you are simply searching for an existing element of the sequence,
23965  * consider using g_sequence_lookup_iter().
23966  *
23967  * <note><para>
23968  * This function will fail if the data contained in the sequence is
23969  * unsorted.  Use g_sequence_insert_sorted() or
23970  * g_sequence_insert_sorted_iter() to add data to your sequence or, if
23971  * you want to add a large amount of data, call g_sequence_sort() after
23972  * doing unsorted insertions.
23973  * </para></note>
23974  *
23975  * Returns: a #GSequenceIter pointing to the position in @seq where @data would have been inserted according to @iter_cmp and @cmp_data.
23976  * Since: 2.14
23977  */
23978
23979
23980 /**
23981  * g_sequence_set:
23982  * @iter: a #GSequenceIter
23983  * @data: new data for the item
23984  *
23985  * Changes the data for the item pointed to by @iter to be @data. If
23986  * the sequence has a data destroy function associated with it, that
23987  * function is called on the existing data that @iter pointed to.
23988  *
23989  * Since: 2.14
23990  */
23991
23992
23993 /**
23994  * g_sequence_sort:
23995  * @seq: a #GSequence
23996  * @cmp_func: the function used to sort the sequence
23997  * @cmp_data: user data passed to @cmp_func
23998  *
23999  * Sorts @seq using @cmp_func.
24000  *
24001  * @cmp_func is passed two items of @seq and should
24002  * return 0 if they are equal, a negative value if the
24003  * first comes before the second, and a positive value
24004  * if the second comes before the first.
24005  *
24006  * Since: 2.14
24007  */
24008
24009
24010 /**
24011  * g_sequence_sort_changed:
24012  * @iter: A #GSequenceIter
24013  * @cmp_func: the function used to compare items in the sequence
24014  * @cmp_data: user data passed to @cmp_func.
24015  *
24016  * Moves the data pointed to a new position as indicated by @cmp_func. This
24017  * function should be called for items in a sequence already sorted according
24018  * to @cmp_func whenever some aspect of an item changes so that @cmp_func
24019  * may return different values for that item.
24020  *
24021  * @cmp_func is called with two items of the @seq and @user_data.
24022  * It should return 0 if the items are equal, a negative value if
24023  * the first item comes before the second, and a positive value if
24024  * the second item comes before the first.
24025  *
24026  * Since: 2.14
24027  */
24028
24029
24030 /**
24031  * g_sequence_sort_changed_iter:
24032  * @iter: a #GSequenceIter
24033  * @iter_cmp: the function used to compare iterators in the sequence
24034  * @cmp_data: user data passed to @cmp_func
24035  *
24036  * Like g_sequence_sort_changed(), but uses
24037  * a #GSequenceIterCompareFunc instead of a #GCompareDataFunc as
24038  * the compare function.
24039  *
24040  * @iter_cmp is called with two iterators pointing into @seq. It should
24041  * return 0 if the iterators are equal, a negative value if the first
24042  * iterator comes before the second, and a positive value if the second
24043  * iterator comes before the first.
24044  *
24045  * Since: 2.14
24046  */
24047
24048
24049 /**
24050  * g_sequence_sort_iter:
24051  * @seq: a #GSequence
24052  * @cmp_func: the function used to compare iterators in the sequence
24053  * @cmp_data: user data passed to @cmp_func
24054  *
24055  * Like g_sequence_sort(), but uses a #GSequenceIterCompareFunc instead
24056  * of a GCompareDataFunc as the compare function
24057  *
24058  * @cmp_func is called with two iterators pointing into @seq. It should
24059  * return 0 if the iterators are equal, a negative value if the first
24060  * iterator comes before the second, and a positive value if the second
24061  * iterator comes before the first.
24062  *
24063  * Since: 2.14
24064  */
24065
24066
24067 /**
24068  * g_sequence_swap:
24069  * @a: a #GSequenceIter
24070  * @b: a #GSequenceIter
24071  *
24072  * Swaps the items pointed to by @a and @b. It is allowed for @a and @b
24073  * to point into difference sequences.
24074  *
24075  * Since: 2.14
24076  */
24077
24078
24079 /**
24080  * g_set_application_name:
24081  * @application_name: localized name of the application
24082  *
24083  * Sets a human-readable name for the application. This name should be
24084  * localized if possible, and is intended for display to the user.
24085  * Contrast with g_set_prgname(), which sets a non-localized name.
24086  * g_set_prgname() will be called automatically by gtk_init(),
24087  * but g_set_application_name() will not.
24088  *
24089  * Note that for thread safety reasons, this function can only
24090  * be called once.
24091  *
24092  * The application name will be used in contexts such as error messages,
24093  * or when displaying an application's name in the task list.
24094  *
24095  * Since: 2.2
24096  */
24097
24098
24099 /**
24100  * g_set_error:
24101  * @err: (allow-none): a return location for a #GError, or %NULL
24102  * @domain: error domain
24103  * @code: error code
24104  * @format: printf()-style format
24105  * @...: args for @format
24106  *
24107  * Does nothing if @err is %NULL; if @err is non-%NULL, then *@err
24108  * must be %NULL. A new #GError is created and assigned to *@err.
24109  */
24110
24111
24112 /**
24113  * g_set_error_literal:
24114  * @err: (allow-none): a return location for a #GError, or %NULL
24115  * @domain: error domain
24116  * @code: error code
24117  * @message: error message
24118  *
24119  * Does nothing if @err is %NULL; if @err is non-%NULL, then *@err
24120  * must be %NULL. A new #GError is created and assigned to *@err.
24121  * Unlike g_set_error(), @message is not a printf()-style format string.
24122  * Use this function if @message contains text you don't have control over,
24123  * that could include printf() escape sequences.
24124  *
24125  * Since: 2.18
24126  */
24127
24128
24129 /**
24130  * g_set_prgname:
24131  * @prgname: the name of the program.
24132  *
24133  * Sets the name of the program. This name should <emphasis>not</emphasis>
24134  * be localized, contrast with g_set_application_name(). Note that for
24135  * thread-safety reasons this function can only be called once.
24136  */
24137
24138
24139 /**
24140  * g_set_print_handler:
24141  * @func: the new print handler
24142  *
24143  * Sets the print handler.
24144  *
24145  * Any messages passed to g_print() will be output via
24146  * the new handler. The default handler simply outputs
24147  * the message to stdout. By providing your own handler
24148  * you can redirect the output, to a GTK+ widget or a
24149  * log file for example.
24150  *
24151  * Returns: the old print handler
24152  */
24153
24154
24155 /**
24156  * g_set_printerr_handler:
24157  * @func: the new error message handler
24158  *
24159  * Sets the handler for printing error messages.
24160  *
24161  * Any messages passed to g_printerr() will be output via
24162  * the new handler. The default handler simply outputs the
24163  * message to stderr. By providing your own handler you can
24164  * redirect the output, to a GTK+ widget or a log file for
24165  * example.
24166  *
24167  * Returns: the old error message handler
24168  */
24169
24170
24171 /**
24172  * g_setenv:
24173  * @variable: the environment variable to set, must not contain '='.
24174  * @value: the value for to set the variable to.
24175  * @overwrite: whether to change the variable if it already exists.
24176  *
24177  * Sets an environment variable. Both the variable's name and value
24178  * should be in the GLib file name encoding. On UNIX, this means that
24179  * they can be arbitrary byte strings. On Windows, they should be in
24180  * UTF-8.
24181  *
24182  * Note that on some systems, when variables are overwritten, the memory
24183  * used for the previous variables and its value isn't reclaimed.
24184  *
24185  * <warning><para>
24186  * Environment variable handling in UNIX is not thread-safe, and your
24187  * program may crash if one thread calls g_setenv() while another
24188  * thread is calling getenv(). (And note that many functions, such as
24189  * gettext(), call getenv() internally.) This function is only safe to
24190  * use at the very start of your program, before creating any other
24191  * threads (or creating objects that create worker threads of their
24192  * own).
24193  * </para><para>
24194  * If you need to set up the environment for a child process, you can
24195  * use g_get_environ() to get an environment array, modify that with
24196  * g_environ_setenv() and g_environ_unsetenv(), and then pass that
24197  * array directly to execvpe(), g_spawn_async(), or the like.
24198  * </para></warning>
24199  *
24200  * Returns: %FALSE if the environment variable couldn't be set.
24201  * Since: 2.4
24202  */
24203
24204
24205 /**
24206  * g_shell_parse_argv:
24207  * @command_line: command line to parse
24208  * @argcp: (out): return location for number of args
24209  * @argvp: (out) (array length=argcp zero-terminated=1): return location for array of args
24210  * @error: return location for error
24211  *
24212  * Parses a command line into an argument vector, in much the same way
24213  * the shell would, but without many of the expansions the shell would
24214  * perform (variable expansion, globs, operators, filename expansion,
24215  * etc. are not supported). The results are defined to be the same as
24216  * those you would get from a UNIX98 /bin/sh, as long as the input
24217  * contains none of the unsupported shell expansions. If the input
24218  * does contain such expansions, they are passed through
24219  * literally. Possible errors are those from the #G_SHELL_ERROR
24220  * domain. Free the returned vector with g_strfreev().
24221  *
24222  * Returns: %TRUE on success, %FALSE if error set
24223  */
24224
24225
24226 /**
24227  * g_shell_quote:
24228  * @unquoted_string: a literal string
24229  *
24230  * Quotes a string so that the shell (/bin/sh) will interpret the
24231  * quoted string to mean @unquoted_string. If you pass a filename to
24232  * the shell, for example, you should first quote it with this
24233  * function.  The return value must be freed with g_free(). The
24234  * quoting style used is undefined (single or double quotes may be
24235  * used).
24236  *
24237  * Returns: quoted string
24238  */
24239
24240
24241 /**
24242  * g_shell_unquote:
24243  * @quoted_string: shell-quoted string
24244  * @error: error return location or NULL
24245  *
24246  * Unquotes a string as the shell (/bin/sh) would. Only handles
24247  * quotes; if a string contains file globs, arithmetic operators,
24248  * variables, backticks, redirections, or other special-to-the-shell
24249  * features, the result will be different from the result a real shell
24250  * would produce (the variables, backticks, etc. will be passed
24251  * through literally instead of being expanded). This function is
24252  * guaranteed to succeed if applied to the result of
24253  * g_shell_quote(). If it fails, it returns %NULL and sets the
24254  * error. The @quoted_string need not actually contain quoted or
24255  * escaped text; g_shell_unquote() simply goes through the string and
24256  * unquotes/unescapes anything that the shell would. Both single and
24257  * double quotes are handled, as are escapes including escaped
24258  * newlines. The return value must be freed with g_free(). Possible
24259  * errors are in the #G_SHELL_ERROR domain.
24260  *
24261  * Shell quoting rules are a bit strange. Single quotes preserve the
24262  * literal string exactly. escape sequences are not allowed; not even
24263  * \' - if you want a ' in the quoted text, you have to do something
24264  * like 'foo'\''bar'.  Double quotes allow $, `, ", \, and newline to
24265  * be escaped with backslash. Otherwise double quotes preserve things
24266  * literally.
24267  *
24268  * Returns: an unquoted string
24269  */
24270
24271
24272 /**
24273  * g_slice_alloc:
24274  * @block_size: the number of bytes to allocate
24275  *
24276  * Allocates a block of memory from the slice allocator.
24277  * The block adress handed out can be expected to be aligned
24278  * to at least <literal>1 * sizeof (void*)</literal>,
24279  * though in general slices are 2 * sizeof (void*) bytes aligned,
24280  * if a malloc() fallback implementation is used instead,
24281  * the alignment may be reduced in a libc dependent fashion.
24282  * Note that the underlying slice allocation mechanism can
24283  * be changed with the <link linkend="G_SLICE">G_SLICE=always-malloc</link>
24284  * environment variable.
24285  *
24286  * Returns: a pointer to the allocated memory block
24287  * Since: 2.10
24288  */
24289
24290
24291 /**
24292  * g_slice_alloc0:
24293  * @block_size: the number of bytes to allocate
24294  *
24295  * Allocates a block of memory via g_slice_alloc() and initializes
24296  * the returned memory to 0. Note that the underlying slice allocation
24297  * mechanism can be changed with the
24298  * <link linkend="G_SLICE">G_SLICE=always-malloc</link>
24299  * environment variable.
24300  *
24301  * Returns: a pointer to the allocated block
24302  * Since: 2.10
24303  */
24304
24305
24306 /**
24307  * g_slice_copy:
24308  * @block_size: the number of bytes to allocate
24309  * @mem_block: the memory to copy
24310  *
24311  * Allocates a block of memory from the slice allocator
24312  * and copies @block_size bytes into it from @mem_block.
24313  *
24314  * Returns: a pointer to the allocated memory block
24315  * Since: 2.14
24316  */
24317
24318
24319 /**
24320  * g_slice_dup:
24321  * @type: the type to duplicate, typically a structure name
24322  * @mem: the memory to copy into the allocated block
24323  *
24324  * A convenience macro to duplicate a block of memory using
24325  * the slice allocator.
24326  *
24327  * It calls g_slice_copy() with <literal>sizeof (@type)</literal>
24328  * and casts the returned pointer to a pointer of the given type,
24329  * avoiding a type cast in the source code.
24330  * Note that the underlying slice allocation mechanism can
24331  * be changed with the <link linkend="G_SLICE">G_SLICE=always-malloc</link>
24332  * environment variable.
24333  *
24334  * Returns: a pointer to the allocated block, cast to a pointer to @type
24335  * Since: 2.14
24336  */
24337
24338
24339 /**
24340  * g_slice_free:
24341  * @type: the type of the block to free, typically a structure name
24342  * @mem: a pointer to the block to free
24343  *
24344  * A convenience macro to free a block of memory that has
24345  * been allocated from the slice allocator.
24346  *
24347  * It calls g_slice_free1() using <literal>sizeof (type)</literal>
24348  * as the block size.
24349  * Note that the exact release behaviour can be changed with the
24350  * <link linkend="G_DEBUG">G_DEBUG=gc-friendly</link> environment
24351  * variable, also see <link linkend="G_SLICE">G_SLICE</link> for
24352  * related debugging options.
24353  *
24354  * Since: 2.10
24355  */
24356
24357
24358 /**
24359  * g_slice_free1:
24360  * @block_size: the size of the block
24361  * @mem_block: a pointer to the block to free
24362  *
24363  * Frees a block of memory.
24364  *
24365  * The memory must have been allocated via g_slice_alloc() or
24366  * g_slice_alloc0() and the @block_size has to match the size
24367  * specified upon allocation. Note that the exact release behaviour
24368  * can be changed with the
24369  * <link linkend="G_DEBUG">G_DEBUG=gc-friendly</link> environment
24370  * variable, also see <link linkend="G_SLICE">G_SLICE</link> for
24371  * related debugging options.
24372  *
24373  * Since: 2.10
24374  */
24375
24376
24377 /**
24378  * g_slice_free_chain:
24379  * @type: the type of the @mem_chain blocks
24380  * @mem_chain: a pointer to the first block of the chain
24381  * @next: the field name of the next pointer in @type
24382  *
24383  * Frees a linked list of memory blocks of structure type @type.
24384  * The memory blocks must be equal-sized, allocated via
24385  * g_slice_alloc() or g_slice_alloc0() and linked together by
24386  * a @next pointer (similar to #GSList). The name of the
24387  * @next field in @type is passed as third argument.
24388  * Note that the exact release behaviour can be changed with the
24389  * <link linkend="G_DEBUG">G_DEBUG=gc-friendly</link> environment
24390  * variable, also see <link linkend="G_SLICE">G_SLICE</link> for
24391  * related debugging options.
24392  *
24393  * Since: 2.10
24394  */
24395
24396
24397 /**
24398  * g_slice_free_chain_with_offset:
24399  * @block_size: the size of the blocks
24400  * @mem_chain: a pointer to the first block of the chain
24401  * @next_offset: the offset of the @next field in the blocks
24402  *
24403  * Frees a linked list of memory blocks of structure type @type.
24404  *
24405  * The memory blocks must be equal-sized, allocated via
24406  * g_slice_alloc() or g_slice_alloc0() and linked together by a
24407  * @next pointer (similar to #GSList). The offset of the @next
24408  * field in each block is passed as third argument.
24409  * Note that the exact release behaviour can be changed with the
24410  * <link linkend="G_DEBUG">G_DEBUG=gc-friendly</link> environment
24411  * variable, also see <link linkend="G_SLICE">G_SLICE</link> for
24412  * related debugging options.
24413  *
24414  * Since: 2.10
24415  */
24416
24417
24418 /**
24419  * g_slice_new:
24420  * @type: the type to allocate, typically a structure name
24421  *
24422  * A convenience macro to allocate a block of memory from the
24423  * slice allocator.
24424  *
24425  * It calls g_slice_alloc() with <literal>sizeof (@type)</literal>
24426  * and casts the returned pointer to a pointer of the given type,
24427  * avoiding a type cast in the source code.
24428  * Note that the underlying slice allocation mechanism can
24429  * be changed with the <link linkend="G_SLICE">G_SLICE=always-malloc</link>
24430  * environment variable.
24431  *
24432  * Returns: a pointer to the allocated block, cast to a pointer to @type
24433  * Since: 2.10
24434  */
24435
24436
24437 /**
24438  * g_slice_new0:
24439  * @type: the type to allocate, typically a structure name
24440  *
24441  * A convenience macro to allocate a block of memory from the
24442  * slice allocator and set the memory to 0.
24443  *
24444  * It calls g_slice_alloc0() with <literal>sizeof (@type)</literal>
24445  * and casts the returned pointer to a pointer of the given type,
24446  * avoiding a type cast in the source code.
24447  * Note that the underlying slice allocation mechanism can
24448  * be changed with the <link linkend="G_SLICE">G_SLICE=always-malloc</link>
24449  * environment variable.
24450  *
24451  * Since: 2.10
24452  */
24453
24454
24455 /**
24456  * g_slist_alloc:
24457  *
24458  * Allocates space for one #GSList element. It is called by the
24459  * g_slist_append(), g_slist_prepend(), g_slist_insert() and
24460  * g_slist_insert_sorted() functions and so is rarely used on its own.
24461  *
24462  * Returns: a pointer to the newly-allocated #GSList element.
24463  */
24464
24465
24466 /**
24467  * g_slist_append:
24468  * @list: a #GSList
24469  * @data: the data for the new element
24470  *
24471  * Adds a new element on to the end of the list.
24472  *
24473  * <note><para>
24474  * The return value is the new start of the list, which may
24475  * have changed, so make sure you store the new value.
24476  * </para></note>
24477  *
24478  * <note><para>
24479  * Note that g_slist_append() has to traverse the entire list
24480  * to find the end, which is inefficient when adding multiple
24481  * elements. A common idiom to avoid the inefficiency is to prepend
24482  * the elements and reverse the list when all elements have been added.
24483  * </para></note>
24484  *
24485  * |[
24486  * /&ast; Notice that these are initialized to the empty list. &ast;/
24487  * GSList *list = NULL, *number_list = NULL;
24488  *
24489  * /&ast; This is a list of strings. &ast;/
24490  * list = g_slist_append (list, "first");
24491  * list = g_slist_append (list, "second");
24492  *
24493  * /&ast; This is a list of integers. &ast;/
24494  * number_list = g_slist_append (number_list, GINT_TO_POINTER (27));
24495  * number_list = g_slist_append (number_list, GINT_TO_POINTER (14));
24496  * ]|
24497  *
24498  * Returns: the new start of the #GSList
24499  */
24500
24501
24502 /**
24503  * g_slist_concat:
24504  * @list1: a #GSList
24505  * @list2: the #GSList to add to the end of the first #GSList
24506  *
24507  * Adds the second #GSList onto the end of the first #GSList.
24508  * Note that the elements of the second #GSList are not copied.
24509  * They are used directly.
24510  *
24511  * Returns: the start of the new #GSList
24512  */
24513
24514
24515 /**
24516  * g_slist_copy:
24517  * @list: a #GSList
24518  *
24519  * Copies a #GSList.
24520  *
24521  * <note><para>
24522  * Note that this is a "shallow" copy. If the list elements
24523  * consist of pointers to data, the pointers are copied but
24524  * the actual data isn't. See g_slist_copy_deep() if you need
24525  * to copy the data as well.
24526  * </para></note>
24527  *
24528  * Returns: a copy of @list
24529  */
24530
24531
24532 /**
24533  * g_slist_copy_deep:
24534  * @list: a #GSList
24535  * @func: a copy function used to copy every element in the list
24536  * @user_data: user data passed to the copy function @func, or #NULL
24537  *
24538  * Makes a full (deep) copy of a #GSList.
24539  *
24540  * In contrast with g_slist_copy(), this function uses @func to make a copy of
24541  * each list element, in addition to copying the list container itself.
24542  *
24543  * @func, as a #GCopyFunc, takes two arguments, the data to be copied and a user
24544  * pointer. It's safe to pass #NULL as user_data, if the copy function takes only
24545  * one argument.
24546  *
24547  * For instance, if @list holds a list of GObjects, you can do:
24548  * |[
24549  * another_list = g_slist_copy_deep (list, (GCopyFunc) g_object_ref, NULL);
24550  * ]|
24551  *
24552  * And, to entirely free the new list, you could do:
24553  * |[
24554  * g_slist_free_full (another_list, g_object_unref);
24555  * ]|
24556  *
24557  * Returns: a full copy of @list, use #g_slist_free_full to free it
24558  * Since: 2.34
24559  */
24560
24561
24562 /**
24563  * g_slist_delete_link:
24564  * @list: a #GSList
24565  * @link_: node to delete
24566  *
24567  * Removes the node link_ from the list and frees it.
24568  * Compare this to g_slist_remove_link() which removes the node
24569  * without freeing it.
24570  *
24571  * <note>Removing arbitrary nodes from a singly-linked list
24572  * requires time that is proportional to the length of the list
24573  * (ie. O(n)). If you find yourself using g_slist_delete_link()
24574  * frequently, you should consider a different data structure, such
24575  * as the doubly-linked #GList.</note>
24576  *
24577  * Returns: the new head of @list
24578  */
24579
24580
24581 /**
24582  * g_slist_find:
24583  * @list: a #GSList
24584  * @data: the element data to find
24585  *
24586  * Finds the element in a #GSList which
24587  * contains the given data.
24588  *
24589  * Returns: the found #GSList element, or %NULL if it is not found
24590  */
24591
24592
24593 /**
24594  * g_slist_find_custom:
24595  * @list: a #GSList
24596  * @data: user data passed to the function
24597  * @func: the function to call for each element. It should return 0 when the desired element is found
24598  *
24599  * Finds an element in a #GSList, using a supplied function to
24600  * find the desired element. It iterates over the list, calling
24601  * the given function which should return 0 when the desired
24602  * element is found. The function takes two #gconstpointer arguments,
24603  * the #GSList element's data as the first argument and the
24604  * given user data.
24605  *
24606  * Returns: the found #GSList element, or %NULL if it is not found
24607  */
24608
24609
24610 /**
24611  * g_slist_foreach:
24612  * @list: a #GSList
24613  * @func: the function to call with each element's data
24614  * @user_data: user data to pass to the function
24615  *
24616  * Calls a function for each element of a #GSList.
24617  */
24618
24619
24620 /**
24621  * g_slist_free:
24622  * @list: a #GSList
24623  *
24624  * Frees all of the memory used by a #GSList.
24625  * The freed elements are returned to the slice allocator.
24626  *
24627  * <note><para>
24628  * If list elements contain dynamically-allocated memory,
24629  * you should either use g_slist_free_full() or free them manually
24630  * first.
24631  * </para></note>
24632  */
24633
24634
24635 /**
24636  * g_slist_free1:
24637  *
24638  * A macro which does the same as g_slist_free_1().
24639  *
24640  * Since: 2.10
24641  */
24642
24643
24644 /**
24645  * g_slist_free_1:
24646  * @list: a #GSList element
24647  *
24648  * Frees one #GSList element.
24649  * It is usually used after g_slist_remove_link().
24650  */
24651
24652
24653 /**
24654  * g_slist_free_full:
24655  * @list: a pointer to a #GSList
24656  * @free_func: the function to be called to free each element's data
24657  *
24658  * Convenience method, which frees all the memory used by a #GSList, and
24659  * calls the specified destroy function on every element's data.
24660  *
24661  * Since: 2.28
24662  */
24663
24664
24665 /**
24666  * g_slist_index:
24667  * @list: a #GSList
24668  * @data: the data to find
24669  *
24670  * Gets the position of the element containing
24671  * the given data (starting from 0).
24672  *
24673  * Returns: the index of the element containing the data, or -1 if the data is not found
24674  */
24675
24676
24677 /**
24678  * g_slist_insert:
24679  * @list: a #GSList
24680  * @data: the data for the new element
24681  * @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.
24682  *
24683  * Inserts a new element into the list at the given position.
24684  *
24685  * Returns: the new start of the #GSList
24686  */
24687
24688
24689 /**
24690  * g_slist_insert_before:
24691  * @slist: a #GSList
24692  * @sibling: node to insert @data before
24693  * @data: data to put in the newly-inserted node
24694  *
24695  * Inserts a node before @sibling containing @data.
24696  *
24697  * Returns: the new head of the list.
24698  */
24699
24700
24701 /**
24702  * g_slist_insert_sorted:
24703  * @list: a #GSList
24704  * @data: the data for the new element
24705  * @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.
24706  *
24707  * Inserts a new element into the list, using the given
24708  * comparison function to determine its position.
24709  *
24710  * Returns: the new start of the #GSList
24711  */
24712
24713
24714 /**
24715  * g_slist_insert_sorted_with_data:
24716  * @list: a #GSList
24717  * @data: the data for the new element
24718  * @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.
24719  * @user_data: data to pass to comparison function
24720  *
24721  * Inserts a new element into the list, using the given
24722  * comparison function to determine its position.
24723  *
24724  * Returns: the new start of the #GSList
24725  * Since: 2.10
24726  */
24727
24728
24729 /**
24730  * g_slist_last:
24731  * @list: a #GSList
24732  *
24733  * Gets the last element in a #GSList.
24734  *
24735  * <note><para>
24736  * This function iterates over the whole list.
24737  * </para></note>
24738  *
24739  * Returns: the last element in the #GSList, or %NULL if the #GSList has no elements
24740  */
24741
24742
24743 /**
24744  * g_slist_length:
24745  * @list: a #GSList
24746  *
24747  * Gets the number of elements in a #GSList.
24748  *
24749  * <note><para>
24750  * This function iterates over the whole list to
24751  * count its elements.
24752  * </para></note>
24753  *
24754  * Returns: the number of elements in the #GSList
24755  */
24756
24757
24758 /**
24759  * g_slist_next:
24760  * @slist: an element in a #GSList.
24761  *
24762  * A convenience macro to get the next element in a #GSList.
24763  *
24764  * Returns: the next element, or %NULL if there are no more elements.
24765  */
24766
24767
24768 /**
24769  * g_slist_nth:
24770  * @list: a #GSList
24771  * @n: the position of the element, counting from 0
24772  *
24773  * Gets the element at the given position in a #GSList.
24774  *
24775  * Returns: the element, or %NULL if the position is off the end of the #GSList
24776  */
24777
24778
24779 /**
24780  * g_slist_nth_data:
24781  * @list: a #GSList
24782  * @n: the position of the element
24783  *
24784  * Gets the data of the element at the given position.
24785  *
24786  * Returns: the element's data, or %NULL if the position is off the end of the #GSList
24787  */
24788
24789
24790 /**
24791  * g_slist_position:
24792  * @list: a #GSList
24793  * @llink: an element in the #GSList
24794  *
24795  * Gets the position of the given element
24796  * in the #GSList (starting from 0).
24797  *
24798  * Returns: the position of the element in the #GSList, or -1 if the element is not found
24799  */
24800
24801
24802 /**
24803  * g_slist_prepend:
24804  * @list: a #GSList
24805  * @data: the data for the new element
24806  *
24807  * Adds a new element on to the start of the list.
24808  *
24809  * <note><para>
24810  * The return value is the new start of the list, which
24811  * may have changed, so make sure you store the new value.
24812  * </para></note>
24813  *
24814  * |[
24815  * /&ast; Notice that it is initialized to the empty list. &ast;/
24816  * GSList *list = NULL;
24817  * list = g_slist_prepend (list, "last");
24818  * list = g_slist_prepend (list, "first");
24819  * ]|
24820  *
24821  * Returns: the new start of the #GSList
24822  */
24823
24824
24825 /**
24826  * g_slist_remove:
24827  * @list: a #GSList
24828  * @data: the data of the element to remove
24829  *
24830  * Removes an element from a #GSList.
24831  * If two elements contain the same data, only the first is removed.
24832  * If none of the elements contain the data, the #GSList is unchanged.
24833  *
24834  * Returns: the new start of the #GSList
24835  */
24836
24837
24838 /**
24839  * g_slist_remove_all:
24840  * @list: a #GSList
24841  * @data: data to remove
24842  *
24843  * Removes all list nodes with data equal to @data.
24844  * Returns the new head of the list. Contrast with
24845  * g_slist_remove() which removes only the first node
24846  * matching the given data.
24847  *
24848  * Returns: new head of @list
24849  */
24850
24851
24852 /**
24853  * g_slist_remove_link:
24854  * @list: a #GSList
24855  * @link_: an element in the #GSList
24856  *
24857  * Removes an element from a #GSList, without
24858  * freeing the element. The removed element's next
24859  * link is set to %NULL, so that it becomes a
24860  * self-contained list with one element.
24861  *
24862  * <note>Removing arbitrary nodes from a singly-linked list
24863  * requires time that is proportional to the length of the list
24864  * (ie. O(n)). If you find yourself using g_slist_remove_link()
24865  * frequently, you should consider a different data structure, such
24866  * as the doubly-linked #GList.</note>
24867  *
24868  * Returns: the new start of the #GSList, without the element
24869  */
24870
24871
24872 /**
24873  * g_slist_reverse:
24874  * @list: a #GSList
24875  *
24876  * Reverses a #GSList.
24877  *
24878  * Returns: the start of the reversed #GSList
24879  */
24880
24881
24882 /**
24883  * g_slist_sort:
24884  * @list: a #GSList
24885  * @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.
24886  *
24887  * Sorts a #GSList using the given comparison function.
24888  *
24889  * Returns: the start of the sorted #GSList
24890  */
24891
24892
24893 /**
24894  * g_slist_sort_with_data:
24895  * @list: a #GSList
24896  * @compare_func: comparison function
24897  * @user_data: data to pass to comparison function
24898  *
24899  * Like g_slist_sort(), but the sort function accepts a user data argument.
24900  *
24901  * Returns: new head of the list
24902  */
24903
24904
24905 /**
24906  * g_snprintf:
24907  * @string: the buffer to hold the output.
24908  * @n: the maximum number of bytes to produce (including the terminating nul character).
24909  * @format: a standard printf() format string, but notice <link linkend="string-precision">string precision pitfalls</link>.
24910  * @...: the arguments to insert in the output.
24911  *
24912  * A safer form of the standard sprintf() function. The output is guaranteed
24913  * to not exceed @n characters (including the terminating nul character), so
24914  * it is easy to ensure that a buffer overflow cannot occur.
24915  *
24916  * See also g_strdup_printf().
24917  *
24918  * In versions of GLib prior to 1.2.3, this function may return -1 if the
24919  * output was truncated, and the truncated string may not be nul-terminated.
24920  * In versions prior to 1.3.12, this function returns the length of the output
24921  * string.
24922  *
24923  * The return value of g_snprintf() conforms to the snprintf()
24924  * function as standardized in ISO C99. Note that this is different from
24925  * traditional snprintf(), which returns the length of the output string.
24926  *
24927  * The format string may contain positional parameters, as specified in
24928  * the Single Unix Specification.
24929  *
24930  * Returns: the number of bytes which would be produced if the buffer was large enough.
24931  */
24932
24933
24934 /**
24935  * g_source_add_child_source:
24936  * @source: a #GSource
24937  * @child_source: a second #GSource that @source should "poll"
24938  *
24939  * Adds @child_source to @source as a "polled" source; when @source is
24940  * added to a #GMainContext, @child_source will be automatically added
24941  * with the same priority, when @child_source is triggered, it will
24942  * cause @source to dispatch (in addition to calling its own
24943  * callback), and when @source is destroyed, it will destroy
24944  * @child_source as well. (@source will also still be dispatched if
24945  * its own prepare/check functions indicate that it is ready.)
24946  *
24947  * If you don't need @child_source to do anything on its own when it
24948  * triggers, you can call g_source_set_dummy_callback() on it to set a
24949  * callback that does nothing (except return %TRUE if appropriate).
24950  *
24951  * @source will hold a reference on @child_source while @child_source
24952  * is attached to it.
24953  *
24954  * Since: 2.28
24955  */
24956
24957
24958 /**
24959  * g_source_add_poll:
24960  * @source: a #GSource
24961  * @fd: a #GPollFD structure holding information about a file descriptor to watch.
24962  *
24963  * Adds a file descriptor to the set of file descriptors polled for
24964  * this source. This is usually combined with g_source_new() to add an
24965  * event source. The event source's check function will typically test
24966  * the @revents field in the #GPollFD struct and return %TRUE if events need
24967  * to be processed.
24968  */
24969
24970
24971 /**
24972  * g_source_attach:
24973  * @source: a #GSource
24974  * @context: (allow-none): a #GMainContext (if %NULL, the default context will be used)
24975  *
24976  * Adds a #GSource to a @context so that it will be executed within
24977  * that context. Remove it by calling g_source_destroy().
24978  *
24979  * Returns: the ID (greater than 0) for the source within the #GMainContext.
24980  */
24981
24982
24983 /**
24984  * g_source_destroy:
24985  * @source: a #GSource
24986  *
24987  * Removes a source from its #GMainContext, if any, and mark it as
24988  * destroyed.  The source cannot be subsequently added to another
24989  * context.
24990  */
24991
24992
24993 /**
24994  * g_source_get_can_recurse:
24995  * @source: a #GSource
24996  *
24997  * Checks whether a source is allowed to be called recursively.
24998  * see g_source_set_can_recurse().
24999  *
25000  * Returns: whether recursion is allowed.
25001  */
25002
25003
25004 /**
25005  * g_source_get_context:
25006  * @source: a #GSource
25007  *
25008  * Gets the #GMainContext with which the source is associated.
25009  *
25010  * You can call this on a source that has been destroyed, provided
25011  * that the #GMainContext it was attached to still exists (in which
25012  * case it will return that #GMainContext). In particular, you can
25013  * always call this function on the source returned from
25014  * g_main_current_source(). But calling this function on a source
25015  * whose #GMainContext has been destroyed is an error.
25016  *
25017  * 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.
25018  */
25019
25020
25021 /**
25022  * g_source_get_current_time:
25023  * @source: a #GSource
25024  * @timeval: #GTimeVal structure in which to store current time.
25025  *
25026  * This function ignores @source and is otherwise the same as
25027  * g_get_current_time().
25028  *
25029  * Deprecated: 2.28: use g_source_get_time() instead
25030  */
25031
25032
25033 /**
25034  * g_source_get_id:
25035  * @source: a #GSource
25036  *
25037  * Returns the numeric ID for a particular source. The ID of a source
25038  * is a positive integer which is unique within a particular main loop
25039  * context. The reverse
25040  * mapping from ID to source is done by g_main_context_find_source_by_id().
25041  *
25042  * Returns: the ID (greater than 0) for the source
25043  */
25044
25045
25046 /**
25047  * g_source_get_name:
25048  * @source: a #GSource
25049  *
25050  * Gets a name for the source, used in debugging and profiling.
25051  * The name may be #NULL if it has never been set with
25052  * g_source_set_name().
25053  *
25054  * Returns: the name of the source
25055  * Since: 2.26
25056  */
25057
25058
25059 /**
25060  * g_source_get_priority:
25061  * @source: a #GSource
25062  *
25063  * Gets the priority of a source.
25064  *
25065  * Returns: the priority of the source
25066  */
25067
25068
25069 /**
25070  * g_source_get_time:
25071  * @source: a #GSource
25072  *
25073  * Gets the time to be used when checking this source. The advantage of
25074  * calling this function over calling g_get_monotonic_time() directly is
25075  * that when checking multiple sources, GLib can cache a single value
25076  * instead of having to repeatedly get the system monotonic time.
25077  *
25078  * The time here is the system monotonic time, if available, or some
25079  * other reasonable alternative otherwise.  See g_get_monotonic_time().
25080  *
25081  * Returns: the monotonic time in microseconds
25082  * Since: 2.28
25083  */
25084
25085
25086 /**
25087  * g_source_is_destroyed:
25088  * @source: a #GSource
25089  *
25090  * Returns whether @source has been destroyed.
25091  *
25092  * This is important when you operate upon your objects
25093  * from within idle handlers, but may have freed the object
25094  * before the dispatch of your idle handler.
25095  *
25096  * |[
25097  * static gboolean
25098  * idle_callback (gpointer data)
25099  * {
25100  *   SomeWidget *self = data;
25101  *
25102  *   GDK_THREADS_ENTER (<!-- -->);
25103  *   /<!-- -->* do stuff with self *<!-- -->/
25104  *   self->idle_id = 0;
25105  *   GDK_THREADS_LEAVE (<!-- -->);
25106  *
25107  *   return G_SOURCE_REMOVE;
25108  * }
25109  *
25110  * static void
25111  * some_widget_do_stuff_later (SomeWidget *self)
25112  * {
25113  *   self->idle_id = g_idle_add (idle_callback, self);
25114  * }
25115  *
25116  * static void
25117  * some_widget_finalize (GObject *object)
25118  * {
25119  *   SomeWidget *self = SOME_WIDGET (object);
25120  *
25121  *   if (self->idle_id)
25122  *     g_source_remove (self->idle_id);
25123  *
25124  *   G_OBJECT_CLASS (parent_class)->finalize (object);
25125  * }
25126  * ]|
25127  *
25128  * This will fail in a multi-threaded application if the
25129  * widget is destroyed before the idle handler fires due
25130  * to the use after free in the callback. A solution, to
25131  * this particular problem, is to check to if the source
25132  * has already been destroy within the callback.
25133  *
25134  * |[
25135  * static gboolean
25136  * idle_callback (gpointer data)
25137  * {
25138  *   SomeWidget *self = data;
25139  *
25140  *   GDK_THREADS_ENTER ();
25141  *   if (!g_source_is_destroyed (g_main_current_source ()))
25142  *     {
25143  *       /<!-- -->* do stuff with self *<!-- -->/
25144  *     }
25145  *   GDK_THREADS_LEAVE ();
25146  *
25147  *   return FALSE;
25148  * }
25149  * ]|
25150  *
25151  * Returns: %TRUE if the source has been destroyed
25152  * Since: 2.12
25153  */
25154
25155
25156 /**
25157  * g_source_new:
25158  * @source_funcs: structure containing functions that implement the sources behavior.
25159  * @struct_size: size of the #GSource structure to create.
25160  *
25161  * Creates a new #GSource structure. The size is specified to
25162  * allow creating structures derived from #GSource that contain
25163  * additional data. The size passed in must be at least
25164  * <literal>sizeof (GSource)</literal>.
25165  *
25166  * The source will not initially be associated with any #GMainContext
25167  * and must be added to one with g_source_attach() before it will be
25168  * executed.
25169  *
25170  * Returns: the newly-created #GSource.
25171  */
25172
25173
25174 /**
25175  * g_source_ref:
25176  * @source: a #GSource
25177  *
25178  * Increases the reference count on a source by one.
25179  *
25180  * Returns: @source
25181  */
25182
25183
25184 /**
25185  * g_source_remove:
25186  * @tag: the ID of the source to remove.
25187  *
25188  * Removes the source with the given id from the default main context.
25189  * The id of
25190  * a #GSource is given by g_source_get_id(), or will be returned by the
25191  * functions g_source_attach(), g_idle_add(), g_idle_add_full(),
25192  * g_timeout_add(), g_timeout_add_full(), g_child_watch_add(),
25193  * g_child_watch_add_full(), g_io_add_watch(), and g_io_add_watch_full().
25194  *
25195  * See also g_source_destroy(). You must use g_source_destroy() for sources
25196  * added to a non-default main context.
25197  *
25198  * Returns: %TRUE if the source was found and removed.
25199  */
25200
25201
25202 /**
25203  * g_source_remove_by_funcs_user_data:
25204  * @funcs: The @source_funcs passed to g_source_new()
25205  * @user_data: the user data for the callback
25206  *
25207  * Removes a source from the default main loop context given the
25208  * source functions and user data. If multiple sources exist with the
25209  * same source functions and user data, only one will be destroyed.
25210  *
25211  * Returns: %TRUE if a source was found and removed.
25212  */
25213
25214
25215 /**
25216  * g_source_remove_by_user_data:
25217  * @user_data: the user_data for the callback.
25218  *
25219  * Removes a source from the default main loop context given the user
25220  * data for the callback. If multiple sources exist with the same user
25221  * data, only one will be destroyed.
25222  *
25223  * Returns: %TRUE if a source was found and removed.
25224  */
25225
25226
25227 /**
25228  * g_source_remove_child_source:
25229  * @source: a #GSource
25230  * @child_source: a #GSource previously passed to g_source_add_child_source().
25231  *
25232  * Detaches @child_source from @source and destroys it.
25233  *
25234  * Since: 2.28
25235  */
25236
25237
25238 /**
25239  * g_source_remove_poll:
25240  * @source: a #GSource
25241  * @fd: a #GPollFD structure previously passed to g_source_add_poll().
25242  *
25243  * Removes a file descriptor from the set of file descriptors polled for
25244  * this source.
25245  */
25246
25247
25248 /**
25249  * g_source_set_callback:
25250  * @source: the source
25251  * @func: a callback function
25252  * @data: the data to pass to callback function
25253  * @notify: (allow-none): a function to call when @data is no longer in use, or %NULL.
25254  *
25255  * Sets the callback function for a source. The callback for a source is
25256  * called from the source's dispatch function.
25257  *
25258  * The exact type of @func depends on the type of source; ie. you
25259  * should not count on @func being called with @data as its first
25260  * parameter.
25261  *
25262  * Typically, you won't use this function. Instead use functions specific
25263  * to the type of source you are using.
25264  */
25265
25266
25267 /**
25268  * g_source_set_callback_indirect:
25269  * @source: the source
25270  * @callback_data: pointer to callback data "object"
25271  * @callback_funcs: functions for reference counting @callback_data and getting the callback and data
25272  *
25273  * Sets the callback function storing the data as a refcounted callback
25274  * "object". This is used internally. Note that calling
25275  * g_source_set_callback_indirect() assumes
25276  * an initial reference count on @callback_data, and thus
25277  * @callback_funcs->unref will eventually be called once more
25278  * than @callback_funcs->ref.
25279  */
25280
25281
25282 /**
25283  * g_source_set_can_recurse:
25284  * @source: a #GSource
25285  * @can_recurse: whether recursion is allowed for this source
25286  *
25287  * Sets whether a source can be called recursively. If @can_recurse is
25288  * %TRUE, then while the source is being dispatched then this source
25289  * will be processed normally. Otherwise, all processing of this
25290  * source is blocked until the dispatch function returns.
25291  */
25292
25293
25294 /**
25295  * g_source_set_funcs:
25296  * @source: a #GSource
25297  * @funcs: the new #GSourceFuncs
25298  *
25299  * Sets the source functions (can be used to override
25300  * default implementations) of an unattached source.
25301  *
25302  * Since: 2.12
25303  */
25304
25305
25306 /**
25307  * g_source_set_name:
25308  * @source: a #GSource
25309  * @name: debug name for the source
25310  *
25311  * Sets a name for the source, used in debugging and profiling.
25312  * The name defaults to #NULL.
25313  *
25314  * The source name should describe in a human-readable way
25315  * what the source does. For example, "X11 event queue"
25316  * or "GTK+ repaint idle handler" or whatever it is.
25317  *
25318  * It is permitted to call this function multiple times, but is not
25319  * recommended due to the potential performance impact.  For example,
25320  * one could change the name in the "check" function of a #GSourceFuncs
25321  * to include details like the event type in the source name.
25322  *
25323  * Since: 2.26
25324  */
25325
25326
25327 /**
25328  * g_source_set_name_by_id:
25329  * @tag: a #GSource ID
25330  * @name: debug name for the source
25331  *
25332  * Sets the name of a source using its ID.
25333  *
25334  * This is a convenience utility to set source names from the return
25335  * value of g_idle_add(), g_timeout_add(), etc.
25336  *
25337  * Since: 2.26
25338  */
25339
25340
25341 /**
25342  * g_source_set_priority:
25343  * @source: a #GSource
25344  * @priority: the new priority.
25345  *
25346  * Sets the priority of a source. While the main loop is being run, a
25347  * source will be dispatched if it is ready to be dispatched and no
25348  * sources at a higher (numerically smaller) priority are ready to be
25349  * dispatched.
25350  */
25351
25352
25353 /**
25354  * g_source_unref:
25355  * @source: a #GSource
25356  *
25357  * Decreases the reference count of a source by one. If the
25358  * resulting reference count is zero the source and associated
25359  * memory will be destroyed.
25360  */
25361
25362
25363 /**
25364  * g_spaced_primes_closest:
25365  * @num: a #guint
25366  *
25367  * Gets the smallest prime number from a built-in array of primes which
25368  * is larger than @num. This is used within GLib to calculate the optimum
25369  * size of a #GHashTable.
25370  *
25371  * The built-in array of primes ranges from 11 to 13845163 such that
25372  * each prime is approximately 1.5-2 times the previous prime.
25373  *
25374  * Returns: the smallest prime number from a built-in array of primes which is larger than @num
25375  */
25376
25377
25378 /**
25379  * g_spawn_async:
25380  * @working_directory: (allow-none): child's current working directory, or %NULL to inherit parent's
25381  * @argv: (array zero-terminated=1): child's argument vector
25382  * @envp: (array zero-terminated=1) (allow-none): child's environment, or %NULL to inherit parent's
25383  * @flags: flags from #GSpawnFlags
25384  * @child_setup: (scope async) (allow-none): function to run in the child just before exec()
25385  * @user_data: (closure): user data for @child_setup
25386  * @child_pid: (out) (allow-none): return location for child process reference, or %NULL
25387  * @error: return location for error
25388  *
25389  * See g_spawn_async_with_pipes() for a full description; this function
25390  * simply calls the g_spawn_async_with_pipes() without any pipes.
25391  *
25392  * You should call g_spawn_close_pid() on the returned child process
25393  * reference when you don't need it any more.
25394  *
25395  * <note><para>
25396  * If you are writing a GTK+ application, and the program you
25397  * are spawning is a graphical application, too, then you may
25398  * want to use gdk_spawn_on_screen() instead to ensure that
25399  * the spawned program opens its windows on the right screen.
25400  * </para></note>
25401  *
25402  * <note><para> Note that the returned @child_pid on Windows is a
25403  * handle to the child process and not its identifier. Process handles
25404  * and process identifiers are different concepts on Windows.
25405  * </para></note>
25406  *
25407  * Returns: %TRUE on success, %FALSE if error is set
25408  */
25409
25410
25411 /**
25412  * g_spawn_async_with_pipes:
25413  * @working_directory: (allow-none): child's current working directory, or %NULL to inherit parent's, in the GLib file name encoding
25414  * @argv: (array zero-terminated=1): child's argument vector, in the GLib file name encoding
25415  * @envp: (array zero-terminated=1) (allow-none): child's environment, or %NULL to inherit parent's, in the GLib file name encoding
25416  * @flags: flags from #GSpawnFlags
25417  * @child_setup: (scope async) (allow-none): function to run in the child just before exec()
25418  * @user_data: (closure): user data for @child_setup
25419  * @child_pid: (out) (allow-none): return location for child process ID, or %NULL
25420  * @standard_input: (out) (allow-none): return location for file descriptor to write to child's stdin, or %NULL
25421  * @standard_output: (out) (allow-none): return location for file descriptor to read child's stdout, or %NULL
25422  * @standard_error: (out) (allow-none): return location for file descriptor to read child's stderr, or %NULL
25423  * @error: return location for error
25424  *
25425  * Executes a child program asynchronously (your program will not
25426  * block waiting for the child to exit). The child program is
25427  * specified by the only argument that must be provided, @argv. @argv
25428  * should be a %NULL-terminated array of strings, to be passed as the
25429  * argument vector for the child. The first string in @argv is of
25430  * course the name of the program to execute. By default, the name of
25431  * the program must be a full path. If @flags contains the
25432  * %G_SPAWN_SEARCH_PATH flag, the <envar>PATH</envar> environment variable
25433  * is used to search for the executable. If @flags contains the
25434  * %G_SPAWN_SEARCH_PATH_FROM_ENVP flag, the <envar>PATH</envar> variable from
25435  * @envp is used to search for the executable.
25436  * If both the %G_SPAWN_SEARCH_PATH and %G_SPAWN_SEARCH_PATH_FROM_ENVP
25437  * flags are set, the <envar>PATH</envar> variable from @envp takes precedence
25438  * over the environment variable.
25439  *
25440  * If the program name is not a full path and %G_SPAWN_SEARCH_PATH flag is not
25441  * used, then the program will be run from the current directory (or
25442  * @working_directory, if specified); this might be unexpected or even
25443  * dangerous in some cases when the current directory is world-writable.
25444  *
25445  * On Windows, note that all the string or string vector arguments to
25446  * this function and the other g_spawn*() functions are in UTF-8, the
25447  * GLib file name encoding. Unicode characters that are not part of
25448  * the system codepage passed in these arguments will be correctly
25449  * available in the spawned program only if it uses wide character API
25450  * to retrieve its command line. For C programs built with Microsoft's
25451  * tools it is enough to make the program have a wmain() instead of
25452  * main(). wmain() has a wide character argument vector as parameter.
25453  *
25454  * At least currently, mingw doesn't support wmain(), so if you use
25455  * mingw to develop the spawned program, it will have to call the
25456  * undocumented function __wgetmainargs() to get the wide character
25457  * argument vector and environment. See gspawn-win32-helper.c in the
25458  * GLib sources or init.c in the mingw runtime sources for a prototype
25459  * for that function. Alternatively, you can retrieve the Win32 system
25460  * level wide character command line passed to the spawned program
25461  * using the GetCommandLineW() function.
25462  *
25463  * On Windows the low-level child process creation API
25464  * <function>CreateProcess()</function> doesn't use argument vectors,
25465  * but a command line. The C runtime library's
25466  * <function>spawn*()</function> family of functions (which
25467  * g_spawn_async_with_pipes() eventually calls) paste the argument
25468  * vector elements together into a command line, and the C runtime startup code
25469  * does a corresponding reconstruction of an argument vector from the
25470  * command line, to be passed to main(). Complications arise when you have
25471  * argument vector elements that contain spaces of double quotes. The
25472  * <function>spawn*()</function> functions don't do any quoting or
25473  * escaping, but on the other hand the startup code does do unquoting
25474  * and unescaping in order to enable receiving arguments with embedded
25475  * spaces or double quotes. To work around this asymmetry,
25476  * g_spawn_async_with_pipes() will do quoting and escaping on argument
25477  * vector elements that need it before calling the C runtime
25478  * spawn() function.
25479  *
25480  * The returned @child_pid on Windows is a handle to the child
25481  * process, not its identifier. Process handles and process
25482  * identifiers are different concepts on Windows.
25483  *
25484  * @envp is a %NULL-terminated array of strings, where each string
25485  * has the form <literal>KEY=VALUE</literal>. This will become
25486  * the child's environment. If @envp is %NULL, the child inherits its
25487  * parent's environment.
25488  *
25489  * @flags should be the bitwise OR of any flags you want to affect the
25490  * function's behaviour. The %G_SPAWN_DO_NOT_REAP_CHILD means that the
25491  * child will not automatically be reaped; you must use a child watch to
25492  * be notified about the death of the child process. Eventually you must
25493  * call g_spawn_close_pid() on the @child_pid, in order to free
25494  * resources which may be associated with the child process. (On Unix,
25495  * using a child watch is equivalent to calling waitpid() or handling
25496  * the <literal>SIGCHLD</literal> signal manually. On Windows, calling g_spawn_close_pid()
25497  * is equivalent to calling CloseHandle() on the process handle returned
25498  * in @child_pid).  See g_child_watch_add().
25499  *
25500  * %G_SPAWN_LEAVE_DESCRIPTORS_OPEN means that the parent's open file
25501  * descriptors will be inherited by the child; otherwise all
25502  * descriptors except stdin/stdout/stderr will be closed before
25503  * calling exec() in the child. %G_SPAWN_SEARCH_PATH
25504  * means that <literal>argv[0]</literal> need not be an absolute path, it
25505  * will be looked for in the <envar>PATH</envar> environment variable.
25506  * %G_SPAWN_SEARCH_PATH_FROM_ENVP means need not be an absolute path, it
25507  * will be looked for in the <envar>PATH</envar> variable from @envp. If
25508  * both %G_SPAWN_SEARCH_PATH and %G_SPAWN_SEARCH_PATH_FROM_ENVP are used,
25509  * the value from @envp takes precedence over the environment.
25510  * %G_SPAWN_STDOUT_TO_DEV_NULL means that the child's standard output will
25511  * be discarded, instead of going to the same location as the parent's
25512  * standard output. If you use this flag, @standard_output must be %NULL.
25513  * %G_SPAWN_STDERR_TO_DEV_NULL means that the child's standard error
25514  * will be discarded, instead of going to the same location as the parent's
25515  * standard error. If you use this flag, @standard_error must be %NULL.
25516  * %G_SPAWN_CHILD_INHERITS_STDIN means that the child will inherit the parent's
25517  * standard input (by default, the child's standard input is attached to
25518  * /dev/null). If you use this flag, @standard_input must be %NULL.
25519  * %G_SPAWN_FILE_AND_ARGV_ZERO means that the first element of @argv is
25520  * the file to execute, while the remaining elements are the
25521  * actual argument vector to pass to the file. Normally
25522  * g_spawn_async_with_pipes() uses @argv[0] as the file to execute, and
25523  * passes all of @argv to the child.
25524  *
25525  * @child_setup and @user_data are a function and user data. On POSIX
25526  * platforms, the function is called in the child after GLib has
25527  * performed all the setup it plans to perform (including creating
25528  * pipes, closing file descriptors, etc.) but before calling
25529  * exec(). That is, @child_setup is called just
25530  * before calling exec() in the child. Obviously
25531  * actions taken in this function will only affect the child, not the
25532  * parent.
25533  *
25534  * On Windows, there is no separate fork() and exec()
25535  * functionality. Child processes are created and run with a single
25536  * API call, CreateProcess(). There is no sensible thing @child_setup
25537  * could be used for on Windows so it is ignored and not called.
25538  *
25539  * If non-%NULL, @child_pid will on Unix be filled with the child's
25540  * process ID. You can use the process ID to send signals to the
25541  * child, or to use g_child_watch_add() (or waitpid()) if you specified the
25542  * %G_SPAWN_DO_NOT_REAP_CHILD flag. On Windows, @child_pid will be
25543  * filled with a handle to the child process only if you specified the
25544  * %G_SPAWN_DO_NOT_REAP_CHILD flag. You can then access the child
25545  * process using the Win32 API, for example wait for its termination
25546  * with the <function>WaitFor*()</function> functions, or examine its
25547  * exit code with GetExitCodeProcess(). You should close the handle
25548  * with CloseHandle() or g_spawn_close_pid() when you no longer need it.
25549  *
25550  * If non-%NULL, the @standard_input, @standard_output, @standard_error
25551  * locations will be filled with file descriptors for writing to the child's
25552  * standard input or reading from its standard output or standard error.
25553  * The caller of g_spawn_async_with_pipes() must close these file descriptors
25554  * when they are no longer in use. If these parameters are %NULL, the corresponding
25555  * pipe won't be created.
25556  *
25557  * If @standard_input is NULL, the child's standard input is attached to
25558  * /dev/null unless %G_SPAWN_CHILD_INHERITS_STDIN is set.
25559  *
25560  * If @standard_error is NULL, the child's standard error goes to the same
25561  * location as the parent's standard error unless %G_SPAWN_STDERR_TO_DEV_NULL
25562  * is set.
25563  *
25564  * If @standard_output is NULL, the child's standard output goes to the same
25565  * location as the parent's standard output unless %G_SPAWN_STDOUT_TO_DEV_NULL
25566  * is set.
25567  *
25568  * @error can be %NULL to ignore errors, or non-%NULL to report errors.
25569  * If an error is set, the function returns %FALSE. Errors
25570  * are reported even if they occur in the child (for example if the
25571  * executable in <literal>argv[0]</literal> is not found). Typically
25572  * the <literal>message</literal> field of returned errors should be displayed
25573  * to users. Possible errors are those from the #G_SPAWN_ERROR domain.
25574  *
25575  * If an error occurs, @child_pid, @standard_input, @standard_output,
25576  * and @standard_error will not be filled with valid values.
25577  *
25578  * If @child_pid is not %NULL and an error does not occur then the returned
25579  * process reference must be closed using g_spawn_close_pid().
25580  *
25581  * <note><para>
25582  * If you are writing a GTK+ application, and the program you
25583  * are spawning is a graphical application, too, then you may
25584  * want to use gdk_spawn_on_screen_with_pipes() instead to ensure that
25585  * the spawned program opens its windows on the right screen.
25586  * </para></note>
25587  *
25588  * Returns: %TRUE on success, %FALSE if an error was set
25589  */
25590
25591
25592 /**
25593  * g_spawn_check_exit_status:
25594  * @exit_status: An exit code as returned from g_spawn_sync()
25595  * @error: a #GError
25596  *
25597  * Set @error if @exit_status indicates the child exited abnormally
25598  * (e.g. with a nonzero exit code, or via a fatal signal).
25599  *
25600  * The g_spawn_sync() and g_child_watch_add() family of APIs return an
25601  * exit status for subprocesses encoded in a platform-specific way.
25602  * On Unix, this is guaranteed to be in the same format
25603  * <literal>waitpid(2)</literal> returns, and on Windows it is
25604  * guaranteed to be the result of
25605  * <literal>GetExitCodeProcess()</literal>.  Prior to the introduction
25606  * of this function in GLib 2.34, interpreting @exit_status required
25607  * use of platform-specific APIs, which is problematic for software
25608  * using GLib as a cross-platform layer.
25609  *
25610  * Additionally, many programs simply want to determine whether or not
25611  * the child exited successfully, and either propagate a #GError or
25612  * print a message to standard error.  In that common case, this
25613  * function can be used.  Note that the error message in @error will
25614  * contain human-readable information about the exit status.
25615  *
25616  * The <literal>domain</literal> and <literal>code</literal> of @error
25617  * have special semantics in the case where the process has an "exit
25618  * code", as opposed to being killed by a signal.  On Unix, this
25619  * happens if <literal>WIFEXITED</literal> would be true of
25620  * @exit_status.  On Windows, it is always the case.
25621  *
25622  * The special semantics are that the actual exit code will be the
25623  * code set in @error, and the domain will be %G_SPAWN_EXIT_ERROR.
25624  * This allows you to differentiate between different exit codes.
25625  *
25626  * If the process was terminated by some means other than an exit
25627  * status, the domain will be %G_SPAWN_ERROR, and the code will be
25628  * %G_SPAWN_ERROR_FAILED.
25629  *
25630  * This function just offers convenience; you can of course also check
25631  * the available platform via a macro such as %G_OS_UNIX, and use
25632  * <literal>WIFEXITED()</literal> and <literal>WEXITSTATUS()</literal>
25633  * on @exit_status directly.  Do not attempt to scan or parse the
25634  * error message string; it may be translated and/or change in future
25635  * versions of GLib.
25636  *
25637  * Returns: %TRUE if child exited successfully, %FALSE otherwise (and @error will be set)
25638  * Since: 2.34
25639  */
25640
25641
25642 /**
25643  * g_spawn_close_pid:
25644  * @pid: The process reference to close
25645  *
25646  * On some platforms, notably Windows, the #GPid type represents a resource
25647  * which must be closed to prevent resource leaking. g_spawn_close_pid()
25648  * is provided for this purpose. It should be used on all platforms, even
25649  * though it doesn't do anything under UNIX.
25650  */
25651
25652
25653 /**
25654  * g_spawn_command_line_async:
25655  * @command_line: a command line
25656  * @error: return location for errors
25657  *
25658  * A simple version of g_spawn_async() that parses a command line with
25659  * g_shell_parse_argv() and passes it to g_spawn_async(). Runs a
25660  * command line in the background. Unlike g_spawn_async(), the
25661  * %G_SPAWN_SEARCH_PATH flag is enabled, other flags are not. Note
25662  * that %G_SPAWN_SEARCH_PATH can have security implications, so
25663  * consider using g_spawn_async() directly if appropriate. Possible
25664  * errors are those from g_shell_parse_argv() and g_spawn_async().
25665  *
25666  * The same concerns on Windows apply as for g_spawn_command_line_sync().
25667  *
25668  * Returns: %TRUE on success, %FALSE if error is set.
25669  */
25670
25671
25672 /**
25673  * g_spawn_command_line_sync:
25674  * @command_line: a command line
25675  * @standard_output: (out) (array zero-terminated=1) (element-type guint8) (allow-none): return location for child output
25676  * @standard_error: (out) (array zero-terminated=1) (element-type guint8) (allow-none): return location for child errors
25677  * @exit_status: (out) (allow-none): return location for child exit status, as returned by waitpid()
25678  * @error: return location for errors
25679  *
25680  * A simple version of g_spawn_sync() with little-used parameters
25681  * removed, taking a command line instead of an argument vector.  See
25682  * g_spawn_sync() for full details. @command_line will be parsed by
25683  * g_shell_parse_argv(). Unlike g_spawn_sync(), the %G_SPAWN_SEARCH_PATH flag
25684  * is enabled. Note that %G_SPAWN_SEARCH_PATH can have security
25685  * implications, so consider using g_spawn_sync() directly if
25686  * appropriate. Possible errors are those from g_spawn_sync() and those
25687  * from g_shell_parse_argv().
25688  *
25689  * If @exit_status is non-%NULL, the platform-specific exit status of
25690  * the child is stored there; see the documentation of
25691  * g_spawn_check_exit_status() for how to use and interpret this.
25692  *
25693  * On Windows, please note the implications of g_shell_parse_argv()
25694  * parsing @command_line. Parsing is done according to Unix shell rules, not
25695  * Windows command interpreter rules.
25696  * Space is a separator, and backslashes are
25697  * special. Thus you cannot simply pass a @command_line containing
25698  * canonical Windows paths, like "c:\\program files\\app\\app.exe", as
25699  * the backslashes will be eaten, and the space will act as a
25700  * separator. You need to enclose such paths with single quotes, like
25701  * "'c:\\program files\\app\\app.exe' 'e:\\folder\\argument.txt'".
25702  *
25703  * Returns: %TRUE on success, %FALSE if an error was set
25704  */
25705
25706
25707 /**
25708  * g_spawn_sync:
25709  * @working_directory: (allow-none): child's current working directory, or %NULL to inherit parent's
25710  * @argv: (array zero-terminated=1): child's argument vector
25711  * @envp: (array zero-terminated=1) (allow-none): child's environment, or %NULL to inherit parent's
25712  * @flags: flags from #GSpawnFlags
25713  * @child_setup: (scope async) (allow-none): function to run in the child just before exec()
25714  * @user_data: (closure): user data for @child_setup
25715  * @standard_output: (out) (array zero-terminated=1) (element-type guint8) (allow-none): return location for child output, or %NULL
25716  * @standard_error: (out) (array zero-terminated=1) (element-type guint8) (allow-none): return location for child error messages, or %NULL
25717  * @exit_status: (out) (allow-none): return location for child exit status, as returned by waitpid(), or %NULL
25718  * @error: return location for error, or %NULL
25719  *
25720  * Executes a child synchronously (waits for the child to exit before returning).
25721  * All output from the child is stored in @standard_output and @standard_error,
25722  * if those parameters are non-%NULL. Note that you must set the
25723  * %G_SPAWN_STDOUT_TO_DEV_NULL and %G_SPAWN_STDERR_TO_DEV_NULL flags when
25724  * passing %NULL for @standard_output and @standard_error.
25725  *
25726  * If @exit_status is non-%NULL, the platform-specific exit status of
25727  * the child is stored there; see the doucumentation of
25728  * g_spawn_check_exit_status() for how to use and interpret this.
25729  * Note that it is invalid to pass %G_SPAWN_DO_NOT_REAP_CHILD in
25730  * @flags.
25731  *
25732  * If an error occurs, no data is returned in @standard_output,
25733  * @standard_error, or @exit_status.
25734  *
25735  * This function calls g_spawn_async_with_pipes() internally; see that
25736  * function for full details on the other parameters and details on
25737  * how these functions work on Windows.
25738  *
25739  * Returns: %TRUE on success, %FALSE if an error was set.
25740  */
25741
25742
25743 /**
25744  * g_sprintf:
25745  * @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
25746  * @format: a standard printf() format string, but notice <link linkend="string-precision">string precision pitfalls</link>.
25747  * @...: the arguments to insert in the output.
25748  *
25749  * An implementation of the standard sprintf() function which supports
25750  * positional parameters, as specified in the Single Unix Specification.
25751  *
25752  * Note that it is usually better to use g_snprintf(), to avoid the
25753  * risk of buffer overflow.
25754  *
25755  * See also g_strdup_printf().
25756  *
25757  * Returns: the number of bytes printed.
25758  * Since: 2.2
25759  */
25760
25761
25762 /**
25763  * g_stat:
25764  * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows)
25765  * @buf: a pointer to a <structname>stat</structname> struct, which will be filled with the file information
25766  *
25767  * A wrapper for the POSIX stat() function. The stat() function
25768  * returns information about a file. On Windows the stat() function in
25769  * the C library checks only the FAT-style READONLY attribute and does
25770  * not look at the ACL at all. Thus on Windows the protection bits in
25771  * the st_mode field are a fabrication of little use.
25772  *
25773  * On Windows the Microsoft C libraries have several variants of the
25774  * <structname>stat</structname> struct and stat() function with names
25775  * like "_stat", "_stat32", "_stat32i64" and "_stat64i32". The one
25776  * used here is for 32-bit code the one with 32-bit size and time
25777  * fields, specifically called "_stat32".
25778  *
25779  * In Microsoft's compiler, by default "struct stat" means one with
25780  * 64-bit time fields while in MinGW "struct stat" is the legacy one
25781  * with 32-bit fields. To hopefully clear up this messs, the gstdio.h
25782  * header defines a type GStatBuf which is the appropriate struct type
25783  * depending on the platform and/or compiler being used. On POSIX it
25784  * is just "struct stat", but note that even on POSIX platforms,
25785  * "stat" might be a macro.
25786  *
25787  * See your C library manual for more details about stat().
25788  *
25789  * Returns: 0 if the information was successfully retrieved, -1 if an error occurred
25790  * Since: 2.6
25791  */
25792
25793
25794 /**
25795  * g_stpcpy:
25796  * @dest: destination buffer.
25797  * @src: source string.
25798  *
25799  * Copies a nul-terminated string into the dest buffer, include the
25800  * trailing nul, and return a pointer to the trailing nul byte.
25801  * This is useful for concatenating multiple strings together
25802  * without having to repeatedly scan for the end.
25803  *
25804  * Returns: a pointer to trailing nul byte.
25805  */
25806
25807
25808 /**
25809  * g_str_equal:
25810  * @v1: a key
25811  * @v2: a key to compare with @v1
25812  *
25813  * Compares two strings for byte-by-byte equality and returns %TRUE
25814  * if they are equal. It can be passed to g_hash_table_new() as the
25815  * @key_equal_func parameter, when using non-%NULL strings as keys in a
25816  * #GHashTable.
25817  *
25818  * Note that this function is primarily meant as a hash table comparison
25819  * function. For a general-purpose, %NULL-safe string comparison function,
25820  * see g_strcmp0().
25821  *
25822  * Returns: %TRUE if the two keys match
25823  */
25824
25825
25826 /**
25827  * g_str_has_prefix:
25828  * @str: a nul-terminated string
25829  * @prefix: the nul-terminated prefix to look for
25830  *
25831  * Looks whether the string @str begins with @prefix.
25832  *
25833  * Returns: %TRUE if @str begins with @prefix, %FALSE otherwise.
25834  * Since: 2.2
25835  */
25836
25837
25838 /**
25839  * g_str_has_suffix:
25840  * @str: a nul-terminated string
25841  * @suffix: the nul-terminated suffix to look for
25842  *
25843  * Looks whether the string @str ends with @suffix.
25844  *
25845  * Returns: %TRUE if @str end with @suffix, %FALSE otherwise.
25846  * Since: 2.2
25847  */
25848
25849
25850 /**
25851  * g_str_hash:
25852  * @v: a string key
25853  *
25854  * Converts a string to a hash value.
25855  *
25856  * This function implements the widely used "djb" hash apparently posted
25857  * by Daniel Bernstein to comp.lang.c some time ago.  The 32 bit
25858  * unsigned hash value starts at 5381 and for each byte 'c' in the
25859  * string, is updated: <literal>hash = hash * 33 + c</literal>.  This
25860  * function uses the signed value of each byte.
25861  *
25862  * It can be passed to g_hash_table_new() as the @hash_func parameter,
25863  * when using non-%NULL strings as keys in a #GHashTable.
25864  *
25865  * Returns: a hash value corresponding to the key
25866  */
25867
25868
25869 /**
25870  * g_strcanon:
25871  * @string: a nul-terminated array of bytes
25872  * @valid_chars: bytes permitted in @string
25873  * @substitutor: replacement character for disallowed bytes
25874  *
25875  * For each character in @string, if the character is not in
25876  * @valid_chars, replaces the character with @substitutor.
25877  * Modifies @string in place, and return @string itself, not
25878  * a copy. The return value is to allow nesting such as
25879  * |[
25880  *   g_ascii_strup (g_strcanon (str, "abc", '?'))
25881  * ]|
25882  *
25883  * Returns: @string
25884  */
25885
25886
25887 /**
25888  * g_strcasecmp:
25889  * @s1: a string.
25890  * @s2: a string to compare with @s1.
25891  *
25892  * A case-insensitive string comparison, corresponding to the standard
25893  * strcasecmp() function on platforms which support it.
25894  *
25895  * Returns: 0 if the strings match, a negative value if @s1 &lt; @s2, or a positive value if @s1 &gt; @s2.
25896  * Deprecated: 2.2: See g_strncasecmp() for a discussion of why this function is deprecated and how to replace it.
25897  */
25898
25899
25900 /**
25901  * g_strchomp:
25902  * @string: a string to remove the trailing whitespace from
25903  *
25904  * Removes trailing whitespace from a string.
25905  *
25906  * This function doesn't allocate or reallocate any memory;
25907  * it modifies @string in place. The pointer to @string is
25908  * returned to allow the nesting of functions.
25909  *
25910  * Also see g_strchug() and g_strstrip().
25911  *
25912  * Returns: @string.
25913  */
25914
25915
25916 /**
25917  * g_strchug:
25918  * @string: a string to remove the leading whitespace from
25919  *
25920  * Removes leading whitespace from a string, by moving the rest
25921  * of the characters forward.
25922  *
25923  * This function doesn't allocate or reallocate any memory;
25924  * it modifies @string in place. The pointer to @string is
25925  * returned to allow the nesting of functions.
25926  *
25927  * Also see g_strchomp() and g_strstrip().
25928  *
25929  * Returns: @string
25930  */
25931
25932
25933 /**
25934  * g_strcmp0:
25935  * @str1: (allow-none): a C string or %NULL
25936  * @str2: (allow-none): another C string or %NULL
25937  *
25938  * Compares @str1 and @str2 like strcmp(). Handles %NULL
25939  * gracefully by sorting it before non-%NULL strings.
25940  * Comparing two %NULL pointers returns 0.
25941  *
25942  * Returns: an integer less than, equal to, or greater than zero, if @str1 is <, == or > than @str2.
25943  * Since: 2.16
25944  */
25945
25946
25947 /**
25948  * g_strcompress:
25949  * @source: a string to compress
25950  *
25951  * Replaces all escaped characters with their one byte equivalent.
25952  *
25953  * This function does the reverse conversion of g_strescape().
25954  *
25955  * Returns: a newly-allocated copy of @source with all escaped character compressed
25956  */
25957
25958
25959 /**
25960  * g_strconcat:
25961  * @string1: the first string to add, which must not be %NULL
25962  * @...: a %NULL-terminated list of strings to append to the string
25963  *
25964  * Concatenates all of the given strings into one long string.
25965  * The returned string should be freed with g_free() when no longer needed.
25966  *
25967  * Note that this function is usually not the right function to use to
25968  * assemble a translated message from pieces, since proper translation
25969  * often requires the pieces to be reordered.
25970  *
25971  * <warning><para>The variable argument list <emphasis>must</emphasis> end
25972  * with %NULL. If you forget the %NULL, g_strconcat() will start appending
25973  * random memory junk to your string.</para></warning>
25974  *
25975  * Returns: a newly-allocated string containing all the string arguments
25976  */
25977
25978
25979 /**
25980  * g_strdelimit:
25981  * @string: the string to convert
25982  * @delimiters: (allow-none): a string containing the current delimiters, or %NULL to use the standard delimiters defined in #G_STR_DELIMITERS
25983  * @new_delimiter: the new delimiter character
25984  *
25985  * Converts any delimiter characters in @string to @new_delimiter.
25986  * Any characters in @string which are found in @delimiters are
25987  * changed to the @new_delimiter character. Modifies @string in place,
25988  * and returns @string itself, not a copy. The return value is to
25989  * allow nesting such as
25990  * |[
25991  *   g_ascii_strup (g_strdelimit (str, "abc", '?'))
25992  * ]|
25993  *
25994  * Returns: @string
25995  */
25996
25997
25998 /**
25999  * g_strdown:
26000  * @string: the string to convert.
26001  *
26002  * Converts a string to lower case.
26003  *
26004  * Returns: the string
26005  * 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.
26006  */
26007
26008
26009 /**
26010  * g_strdup:
26011  * @str: the string to duplicate
26012  *
26013  * Duplicates a string. If @str is %NULL it returns %NULL.
26014  * The returned string should be freed with g_free()
26015  * when no longer needed.
26016  *
26017  * Returns: a newly-allocated copy of @str
26018  */
26019
26020
26021 /**
26022  * g_strdup_printf:
26023  * @format: a standard printf() format string, but notice <link linkend="string-precision">string precision pitfalls</link>
26024  * @...: the parameters to insert into the format string
26025  *
26026  * Similar to the standard C sprintf() function but safer, since it
26027  * calculates the maximum space required and allocates memory to hold
26028  * the result. The returned string should be freed with g_free() when no
26029  * longer needed.
26030  *
26031  * Returns: a newly-allocated string holding the result
26032  */
26033
26034
26035 /**
26036  * g_strdup_vprintf:
26037  * @format: a standard printf() format string, but notice <link linkend="string-precision">string precision pitfalls</link>
26038  * @args: the list of parameters to insert into the format string
26039  *
26040  * Similar to the standard C vsprintf() function but safer, since it
26041  * calculates the maximum space required and allocates memory to hold
26042  * the result. The returned string should be freed with g_free() when
26043  * no longer needed.
26044  *
26045  * See also g_vasprintf(), which offers the same functionality, but
26046  * additionally returns the length of the allocated string.
26047  *
26048  * Returns: a newly-allocated string holding the result
26049  */
26050
26051
26052 /**
26053  * g_strdupv:
26054  * @str_array: a %NULL-terminated array of strings
26055  *
26056  * Copies %NULL-terminated array of strings. The copy is a deep copy;
26057  * the new array should be freed by first freeing each string, then
26058  * the array itself. g_strfreev() does this for you. If called
26059  * on a %NULL value, g_strdupv() simply returns %NULL.
26060  *
26061  * Returns: a new %NULL-terminated array of strings.
26062  */
26063
26064
26065 /**
26066  * g_strerror:
26067  * @errnum: the system error number. See the standard C %errno documentation
26068  *
26069  * Returns a string corresponding to the given error code, e.g.
26070  * "no such process". You should use this function in preference to
26071  * strerror(), because it returns a string in UTF-8 encoding, and since
26072  * not all platforms support the strerror() function.
26073  *
26074  * Returns: a UTF-8 string describing the error code. If the error code is unknown, it returns "unknown error (&lt;code&gt;)".
26075  */
26076
26077
26078 /**
26079  * g_strescape:
26080  * @source: a string to escape
26081  * @exceptions: a string of characters not to escape in @source
26082  *
26083  * Escapes the special characters '\b', '\f', '\n', '\r', '\t', '\v', '\'
26084  * and '&quot;' in the string @source by inserting a '\' before
26085  * them. Additionally all characters in the range 0x01-0x1F (everything
26086  * below SPACE) and in the range 0x7F-0xFF (all non-ASCII chars) are
26087  * replaced with a '\' followed by their octal representation.
26088  * Characters supplied in @exceptions are not escaped.
26089  *
26090  * g_strcompress() does the reverse conversion.
26091  *
26092  * Returns: a newly-allocated copy of @source with certain characters escaped. See above.
26093  */
26094
26095
26096 /**
26097  * g_strfreev:
26098  * @str_array: a %NULL-terminated array of strings to free
26099  *
26100  * Frees a %NULL-terminated array of strings, and the array itself.
26101  * If called on a %NULL value, g_strfreev() simply returns.
26102  */
26103
26104
26105 /**
26106  * g_string_append:
26107  * @string: a #GString
26108  * @val: the string to append onto the end of @string
26109  *
26110  * Adds a string onto the end of a #GString, expanding
26111  * it if necessary.
26112  *
26113  * Returns: @string
26114  */
26115
26116
26117 /**
26118  * g_string_append_c:
26119  * @string: a #GString
26120  * @c: the byte to append onto the end of @string
26121  *
26122  * Adds a byte onto the end of a #GString, expanding
26123  * it if necessary.
26124  *
26125  * Returns: @string
26126  */
26127
26128
26129 /**
26130  * g_string_append_len:
26131  * @string: a #GString
26132  * @val: bytes to append
26133  * @len: number of bytes of @val to use
26134  *
26135  * Appends @len bytes of @val to @string. Because @len is
26136  * provided, @val may contain embedded nuls and need not
26137  * be nul-terminated.
26138  *
26139  * Since this function does not stop at nul bytes, it is
26140  * the caller's responsibility to ensure that @val has at
26141  * least @len addressable bytes.
26142  *
26143  * Returns: @string
26144  */
26145
26146
26147 /**
26148  * g_string_append_printf:
26149  * @string: a #GString
26150  * @format: the string format. See the printf() documentation
26151  * @...: the parameters to insert into the format string
26152  *
26153  * Appends a formatted string onto the end of a #GString.
26154  * This function is similar to g_string_printf() except
26155  * that the text is appended to the #GString.
26156  */
26157
26158
26159 /**
26160  * g_string_append_unichar:
26161  * @string: a #GString
26162  * @wc: a Unicode character
26163  *
26164  * Converts a Unicode character into UTF-8, and appends it
26165  * to the string.
26166  *
26167  * Returns: @string
26168  */
26169
26170
26171 /**
26172  * g_string_append_uri_escaped:
26173  * @string: a #GString
26174  * @unescaped: a string
26175  * @reserved_chars_allowed: a string of reserved characters allowed to be used, or %NULL
26176  * @allow_utf8: set %TRUE if the escaped string may include UTF8 characters
26177  *
26178  * Appends @unescaped to @string, escaped any characters that
26179  * are reserved in URIs using URI-style escape sequences.
26180  *
26181  * Returns: @string
26182  * Since: 2.16
26183  */
26184
26185
26186 /**
26187  * g_string_append_vprintf:
26188  * @string: a #GString
26189  * @format: the string format. See the printf() documentation
26190  * @args: the list of arguments to insert in the output
26191  *
26192  * Appends a formatted string onto the end of a #GString.
26193  * This function is similar to g_string_append_printf()
26194  * except that the arguments to the format string are passed
26195  * as a va_list.
26196  *
26197  * Since: 2.14
26198  */
26199
26200
26201 /**
26202  * g_string_ascii_down:
26203  * @string: a GString
26204  *
26205  * Converts all uppercase ASCII letters to lowercase ASCII letters.
26206  *
26207  * Returns: passed-in @string pointer, with all the uppercase characters converted to lowercase in place, with semantics that exactly match g_ascii_tolower().
26208  */
26209
26210
26211 /**
26212  * g_string_ascii_up:
26213  * @string: a GString
26214  *
26215  * Converts all lowercase ASCII letters to uppercase ASCII letters.
26216  *
26217  * Returns: passed-in @string pointer, with all the lowercase characters converted to uppercase in place, with semantics that exactly match g_ascii_toupper().
26218  */
26219
26220
26221 /**
26222  * g_string_assign:
26223  * @string: the destination #GString. Its current contents are destroyed.
26224  * @rval: the string to copy into @string
26225  *
26226  * Copies the bytes from a string into a #GString,
26227  * destroying any previous contents. It is rather like
26228  * the standard strcpy() function, except that you do not
26229  * have to worry about having enough space to copy the string.
26230  *
26231  * Returns: @string
26232  */
26233
26234
26235 /**
26236  * g_string_chunk_clear:
26237  * @chunk: a #GStringChunk
26238  *
26239  * Frees all strings contained within the #GStringChunk.
26240  * After calling g_string_chunk_clear() it is not safe to
26241  * access any of the strings which were contained within it.
26242  *
26243  * Since: 2.14
26244  */
26245
26246
26247 /**
26248  * g_string_chunk_free:
26249  * @chunk: a #GStringChunk
26250  *
26251  * Frees all memory allocated by the #GStringChunk.
26252  * After calling g_string_chunk_free() it is not safe to
26253  * access any of the strings which were contained within it.
26254  */
26255
26256
26257 /**
26258  * g_string_chunk_insert:
26259  * @chunk: a #GStringChunk
26260  * @string: the string to add
26261  *
26262  * Adds a copy of @string to the #GStringChunk.
26263  * It returns a pointer to the new copy of the string
26264  * in the #GStringChunk. The characters in the string
26265  * can be changed, if necessary, though you should not
26266  * change anything after the end of the string.
26267  *
26268  * Unlike g_string_chunk_insert_const(), this function
26269  * does not check for duplicates. Also strings added
26270  * with g_string_chunk_insert() will not be searched
26271  * by g_string_chunk_insert_const() when looking for
26272  * duplicates.
26273  *
26274  * Returns: a pointer to the copy of @string within the #GStringChunk
26275  */
26276
26277
26278 /**
26279  * g_string_chunk_insert_const:
26280  * @chunk: a #GStringChunk
26281  * @string: the string to add
26282  *
26283  * Adds a copy of @string to the #GStringChunk, unless the same
26284  * string has already been added to the #GStringChunk with
26285  * g_string_chunk_insert_const().
26286  *
26287  * This function is useful if you need to copy a large number
26288  * of strings but do not want to waste space storing duplicates.
26289  * But you must remember that there may be several pointers to
26290  * the same string, and so any changes made to the strings
26291  * should be done very carefully.
26292  *
26293  * Note that g_string_chunk_insert_const() will not return a
26294  * pointer to a string added with g_string_chunk_insert(), even
26295  * if they do match.
26296  *
26297  * Returns: a pointer to the new or existing copy of @string within the #GStringChunk
26298  */
26299
26300
26301 /**
26302  * g_string_chunk_insert_len:
26303  * @chunk: a #GStringChunk
26304  * @string: bytes to insert
26305  * @len: number of bytes of @string to insert, or -1 to insert a nul-terminated string
26306  *
26307  * Adds a copy of the first @len bytes of @string to the #GStringChunk.
26308  * The copy is nul-terminated.
26309  *
26310  * Since this function does not stop at nul bytes, it is the caller's
26311  * responsibility to ensure that @string has at least @len addressable
26312  * bytes.
26313  *
26314  * The characters in the returned string can be changed, if necessary,
26315  * though you should not change anything after the end of the string.
26316  *
26317  * Returns: a pointer to the copy of @string within the #GStringChunk
26318  * Since: 2.4
26319  */
26320
26321
26322 /**
26323  * g_string_chunk_new:
26324  * @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.
26325  *
26326  * Creates a new #GStringChunk.
26327  *
26328  * Returns: a new #GStringChunk
26329  */
26330
26331
26332 /**
26333  * g_string_down:
26334  * @string: a #GString
26335  *
26336  * Converts a #GString to lowercase.
26337  *
26338  * Returns: the #GString
26339  * 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.
26340  */
26341
26342
26343 /**
26344  * g_string_equal:
26345  * @v: a #GString
26346  * @v2: another #GString
26347  *
26348  * Compares two strings for equality, returning %TRUE if they are equal.
26349  * For use with #GHashTable.
26350  *
26351  * Returns: %TRUE if they strings are the same length and contain the same bytes
26352  */
26353
26354
26355 /**
26356  * g_string_erase:
26357  * @string: a #GString
26358  * @pos: the position of the content to remove
26359  * @len: the number of bytes to remove, or -1 to remove all following bytes
26360  *
26361  * Removes @len bytes from a #GString, starting at position @pos.
26362  * The rest of the #GString is shifted down to fill the gap.
26363  *
26364  * Returns: @string
26365  */
26366
26367
26368 /**
26369  * g_string_free:
26370  * @string: a #GString
26371  * @free_segment: if %TRUE, the actual character data is freed as well
26372  *
26373  * Frees the memory allocated for the #GString.
26374  * If @free_segment is %TRUE it also frees the character data.  If
26375  * it's %FALSE, the caller gains ownership of the buffer and must
26376  * free it after use with g_free().
26377  *
26378  * Returns: the character data of @string (i.e. %NULL if @free_segment is %TRUE)
26379  */
26380
26381
26382 /**
26383  * g_string_free_to_bytes:
26384  * @string: (transfer full): a #GString
26385  *
26386  * Transfers ownership of the contents of @string to a newly allocated
26387  * #GBytes.  The #GString structure itself is deallocated, and it is
26388  * therefore invalid to use @string after invoking this function.
26389  *
26390  * Note that while #GString ensures that its buffer always has a
26391  * trailing nul character (not reflected in its "len"), the returned
26392  * #GBytes does not include this extra nul; i.e. it has length exactly
26393  * equal to the "len" member.
26394  *
26395  * Returns: A newly allocated #GBytes containing contents of @string; @string itself is freed
26396  * Since: 2.34
26397  */
26398
26399
26400 /**
26401  * g_string_hash:
26402  * @str: a string to hash
26403  *
26404  * Creates a hash code for @str; for use with #GHashTable.
26405  *
26406  * Returns: hash code for @str
26407  */
26408
26409
26410 /**
26411  * g_string_insert:
26412  * @string: a #GString
26413  * @pos: the position to insert the copy of the string
26414  * @val: the string to insert
26415  *
26416  * Inserts a copy of a string into a #GString,
26417  * expanding it if necessary.
26418  *
26419  * Returns: @string
26420  */
26421
26422
26423 /**
26424  * g_string_insert_c:
26425  * @string: a #GString
26426  * @pos: the position to insert the byte
26427  * @c: the byte to insert
26428  *
26429  * Inserts a byte into a #GString, expanding it if necessary.
26430  *
26431  * Returns: @string
26432  */
26433
26434
26435 /**
26436  * g_string_insert_len:
26437  * @string: a #GString
26438  * @pos: position in @string where insertion should happen, or -1 for at the end
26439  * @val: bytes to insert
26440  * @len: number of bytes of @val to insert
26441  *
26442  * Inserts @len bytes of @val into @string at @pos.
26443  * Because @len is provided, @val may contain embedded
26444  * nuls and need not be nul-terminated. If @pos is -1,
26445  * bytes are inserted at the end of the string.
26446  *
26447  * Since this function does not stop at nul bytes, it is
26448  * the caller's responsibility to ensure that @val has at
26449  * least @len addressable bytes.
26450  *
26451  * Returns: @string
26452  */
26453
26454
26455 /**
26456  * g_string_insert_unichar:
26457  * @string: a #GString
26458  * @pos: the position at which to insert character, or -1 to append at the end of the string
26459  * @wc: a Unicode character
26460  *
26461  * Converts a Unicode character into UTF-8, and insert it
26462  * into the string at the given position.
26463  *
26464  * Returns: @string
26465  */
26466
26467
26468 /**
26469  * g_string_new:
26470  * @init: the initial text to copy into the string
26471  *
26472  * Creates a new #GString, initialized with the given string.
26473  *
26474  * Returns: the new #GString
26475  */
26476
26477
26478 /**
26479  * g_string_new_len:
26480  * @init: initial contents of the string
26481  * @len: length of @init to use
26482  *
26483  * Creates a new #GString with @len bytes of the @init buffer.
26484  * Because a length is provided, @init need not be nul-terminated,
26485  * and can contain embedded nul bytes.
26486  *
26487  * Since this function does not stop at nul bytes, it is the caller's
26488  * responsibility to ensure that @init has at least @len addressable
26489  * bytes.
26490  *
26491  * Returns: a new #GString
26492  */
26493
26494
26495 /**
26496  * g_string_overwrite:
26497  * @string: a #GString
26498  * @pos: the position at which to start overwriting
26499  * @val: the string that will overwrite the @string starting at @pos
26500  *
26501  * Overwrites part of a string, lengthening it if necessary.
26502  *
26503  * Returns: @string
26504  * Since: 2.14
26505  */
26506
26507
26508 /**
26509  * g_string_overwrite_len:
26510  * @string: a #GString
26511  * @pos: the position at which to start overwriting
26512  * @val: the string that will overwrite the @string starting at @pos
26513  * @len: the number of bytes to write from @val
26514  *
26515  * Overwrites part of a string, lengthening it if necessary.
26516  * This function will work with embedded nuls.
26517  *
26518  * Returns: @string
26519  * Since: 2.14
26520  */
26521
26522
26523 /**
26524  * g_string_prepend:
26525  * @string: a #GString
26526  * @val: the string to prepend on the start of @string
26527  *
26528  * Adds a string on to the start of a #GString,
26529  * expanding it if necessary.
26530  *
26531  * Returns: @string
26532  */
26533
26534
26535 /**
26536  * g_string_prepend_c:
26537  * @string: a #GString
26538  * @c: the byte to prepend on the start of the #GString
26539  *
26540  * Adds a byte onto the start of a #GString,
26541  * expanding it if necessary.
26542  *
26543  * Returns: @string
26544  */
26545
26546
26547 /**
26548  * g_string_prepend_len:
26549  * @string: a #GString
26550  * @val: bytes to prepend
26551  * @len: number of bytes in @val to prepend
26552  *
26553  * Prepends @len bytes of @val to @string.
26554  * Because @len is provided, @val may contain
26555  * embedded nuls and need not be nul-terminated.
26556  *
26557  * Since this function does not stop at nul bytes,
26558  * it is the caller's responsibility to ensure that
26559  * @val has at least @len addressable bytes.
26560  *
26561  * Returns: @string
26562  */
26563
26564
26565 /**
26566  * g_string_prepend_unichar:
26567  * @string: a #GString
26568  * @wc: a Unicode character
26569  *
26570  * Converts a Unicode character into UTF-8, and prepends it
26571  * to the string.
26572  *
26573  * Returns: @string
26574  */
26575
26576
26577 /**
26578  * g_string_printf:
26579  * @string: a #GString
26580  * @format: the string format. See the printf() documentation
26581  * @...: the parameters to insert into the format string
26582  *
26583  * Writes a formatted string into a #GString.
26584  * This is similar to the standard sprintf() function,
26585  * except that the #GString buffer automatically expands
26586  * to contain the results. The previous contents of the
26587  * #GString are destroyed.
26588  */
26589
26590
26591 /**
26592  * g_string_set_size:
26593  * @string: a #GString
26594  * @len: the new length
26595  *
26596  * Sets the length of a #GString. If the length is less than
26597  * the current length, the string will be truncated. If the
26598  * length is greater than the current length, the contents
26599  * of the newly added area are undefined. (However, as
26600  * always, string->str[string->len] will be a nul byte.)
26601  *
26602  * Returns: @string
26603  */
26604
26605
26606 /**
26607  * g_string_sized_new:
26608  * @dfl_size: the default size of the space allocated to hold the string
26609  *
26610  * Creates a new #GString, with enough space for @dfl_size
26611  * bytes. This is useful if you are going to add a lot of
26612  * text to the string and don't want it to be reallocated
26613  * too often.
26614  *
26615  * Returns: the new #GString
26616  */
26617
26618
26619 /**
26620  * g_string_sprintf:
26621  * @string: a #GString
26622  * @format: the string format. See the sprintf() documentation
26623  * @...: the parameters to insert into the format string
26624  *
26625  * Writes a formatted string into a #GString.
26626  * This is similar to the standard sprintf() function,
26627  * except that the #GString buffer automatically expands
26628  * to contain the results. The previous contents of the
26629  * #GString are destroyed.
26630  *
26631  * Deprecated: This function has been renamed to g_string_printf().
26632  */
26633
26634
26635 /**
26636  * g_string_sprintfa:
26637  * @string: a #GString
26638  * @format: the string format. See the sprintf() documentation
26639  * @...: the parameters to insert into the format string
26640  *
26641  * Appends a formatted string onto the end of a #GString.
26642  * This function is similar to g_string_sprintf() except that
26643  * the text is appended to the #GString.
26644  *
26645  * Deprecated: This function has been renamed to g_string_append_printf()
26646  */
26647
26648
26649 /**
26650  * g_string_truncate:
26651  * @string: a #GString
26652  * @len: the new size of @string
26653  *
26654  * Cuts off the end of the GString, leaving the first @len bytes.
26655  *
26656  * Returns: @string
26657  */
26658
26659
26660 /**
26661  * g_string_up:
26662  * @string: a #GString
26663  *
26664  * Converts a #GString to uppercase.
26665  *
26666  * Returns: @string
26667  * 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.
26668  */
26669
26670
26671 /**
26672  * g_string_vprintf:
26673  * @string: a #GString
26674  * @format: the string format. See the printf() documentation
26675  * @args: the parameters to insert into the format string
26676  *
26677  * Writes a formatted string into a #GString.
26678  * This function is similar to g_string_printf() except that
26679  * the arguments to the format string are passed as a va_list.
26680  *
26681  * Since: 2.14
26682  */
26683
26684
26685 /**
26686  * g_strip_context:
26687  * @msgid: a string
26688  * @msgval: another string
26689  *
26690  * An auxiliary function for gettext() support (see Q_()).
26691  *
26692  * 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.
26693  * Since: 2.4
26694  */
26695
26696
26697 /**
26698  * g_strjoin:
26699  * @separator: (allow-none): a string to insert between each of the strings, or %NULL
26700  * @...: a %NULL-terminated list of strings to join
26701  *
26702  * Joins a number of strings together to form one long string, with the
26703  * optional @separator inserted between each of them. The returned string
26704  * should be freed with g_free().
26705  *
26706  * Returns: a newly-allocated string containing all of the strings joined together, with @separator between them
26707  */
26708
26709
26710 /**
26711  * g_strjoinv:
26712  * @separator: (allow-none): a string to insert between each of the strings, or %NULL
26713  * @str_array: a %NULL-terminated array of strings to join
26714  *
26715  * Joins a number of strings together to form one long string, with the
26716  * optional @separator inserted between each of them. The returned string
26717  * should be freed with g_free().
26718  *
26719  * Returns: a newly-allocated string containing all of the strings joined together, with @separator between them
26720  */
26721
26722
26723 /**
26724  * g_strlcat:
26725  * @dest: destination buffer, already containing one nul-terminated string
26726  * @src: source buffer
26727  * @dest_size: length of @dest buffer in bytes (not length of existing string inside @dest)
26728  *
26729  * Portability wrapper that calls strlcat() on systems which have it,
26730  * and emulates it otherwise. Appends nul-terminated @src string to @dest,
26731  * guaranteeing nul-termination for @dest. The total size of @dest won't
26732  * exceed @dest_size.
26733  *
26734  * At most dest_size - 1 characters will be copied.
26735  * Unlike strncat, dest_size is the full size of dest, not the space left over.
26736  * This function does NOT allocate memory.
26737  * This always NUL terminates (unless siz == 0 or there were no NUL characters
26738  * in the dest_size characters of dest to start with).
26739  *
26740  * <note><para>Caveat: this is supposedly a more secure alternative to
26741  * strcat() or strncat(), but for real security g_strconcat() is harder
26742  * to mess up.</para></note>
26743  *
26744  * Returns: size of attempted result, which is MIN (dest_size, strlen (original dest)) + strlen (src), so if retval >= dest_size, truncation occurred.
26745  */
26746
26747
26748 /**
26749  * g_strlcpy:
26750  * @dest: destination buffer
26751  * @src: source buffer
26752  * @dest_size: length of @dest in bytes
26753  *
26754  * Portability wrapper that calls strlcpy() on systems which have it,
26755  * and emulates strlcpy() otherwise. Copies @src to @dest; @dest is
26756  * guaranteed to be nul-terminated; @src must be nul-terminated;
26757  * @dest_size is the buffer size, not the number of chars to copy.
26758  *
26759  * At most dest_size - 1 characters will be copied. Always nul-terminates
26760  * (unless dest_size == 0). This function does <emphasis>not</emphasis>
26761  * allocate memory. Unlike strncpy(), this function doesn't pad dest (so
26762  * it's often faster). It returns the size of the attempted result,
26763  * strlen (src), so if @retval >= @dest_size, truncation occurred.
26764  *
26765  * <note><para>Caveat: strlcpy() is supposedly more secure than
26766  * strcpy() or strncpy(), but if you really want to avoid screwups,
26767  * g_strdup() is an even better idea.</para></note>
26768  *
26769  * Returns: length of @src
26770  */
26771
26772
26773 /**
26774  * g_strncasecmp:
26775  * @s1: a string.
26776  * @s2: a string to compare with @s1.
26777  * @n: the maximum number of characters to compare.
26778  *
26779  * A case-insensitive string comparison, corresponding to the standard
26780  * strncasecmp() function on platforms which support it.
26781  * It is similar to g_strcasecmp() except it only compares the first @n
26782  * characters of the strings.
26783  *
26784  * Returns: 0 if the strings match, a negative value if @s1 &lt; @s2, or a positive value if @s1 &gt; @s2.
26785  * 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.
26786  */
26787
26788
26789 /**
26790  * g_strndup:
26791  * @str: the string to duplicate
26792  * @n: the maximum number of bytes to copy from @str
26793  *
26794  * Duplicates the first @n bytes of a string, returning a newly-allocated
26795  * buffer @n + 1 bytes long which will always be nul-terminated.
26796  * If @str is less than @n bytes long the buffer is padded with nuls.
26797  * If @str is %NULL it returns %NULL.
26798  * The returned value should be freed when no longer needed.
26799  *
26800  * <note><para>
26801  * To copy a number of characters from a UTF-8 encoded string, use
26802  * g_utf8_strncpy() instead.
26803  * </para></note>
26804  *
26805  * Returns: a newly-allocated buffer containing the first @n bytes of @str, nul-terminated
26806  */
26807
26808
26809 /**
26810  * g_strnfill:
26811  * @length: the length of the new string
26812  * @fill_char: the byte to fill the string with
26813  *
26814  * Creates a new string @length bytes long filled with @fill_char.
26815  * The returned string should be freed when no longer needed.
26816  *
26817  * Returns: a newly-allocated string filled the @fill_char
26818  */
26819
26820
26821 /**
26822  * g_strreverse:
26823  * @string: the string to reverse
26824  *
26825  * Reverses all of the bytes in a string. For example,
26826  * <literal>g_strreverse ("abcdef")</literal> will result
26827  * in "fedcba".
26828  *
26829  * Note that g_strreverse() doesn't work on UTF-8 strings
26830  * containing multibyte characters. For that purpose, use
26831  * g_utf8_strreverse().
26832  *
26833  * Returns: the same pointer passed in as @string
26834  */
26835
26836
26837 /**
26838  * g_strrstr:
26839  * @haystack: a nul-terminated string
26840  * @needle: the nul-terminated string to search for
26841  *
26842  * Searches the string @haystack for the last occurrence
26843  * of the string @needle.
26844  *
26845  * Returns: a pointer to the found occurrence, or %NULL if not found.
26846  */
26847
26848
26849 /**
26850  * g_strrstr_len:
26851  * @haystack: a nul-terminated string
26852  * @haystack_len: the maximum length of @haystack
26853  * @needle: the nul-terminated string to search for
26854  *
26855  * Searches the string @haystack for the last occurrence
26856  * of the string @needle, limiting the length of the search
26857  * to @haystack_len.
26858  *
26859  * Returns: a pointer to the found occurrence, or %NULL if not found.
26860  */
26861
26862
26863 /**
26864  * g_strsignal:
26865  * @signum: the signal number. See the <literal>signal</literal> documentation
26866  *
26867  * Returns a string describing the given signal, e.g. "Segmentation fault".
26868  * You should use this function in preference to strsignal(), because it
26869  * returns a string in UTF-8 encoding, and since not all platforms support
26870  * the strsignal() function.
26871  *
26872  * Returns: a UTF-8 string describing the signal. If the signal is unknown, it returns "unknown signal (&lt;signum&gt;)".
26873  */
26874
26875
26876 /**
26877  * g_strsplit:
26878  * @string: a string to split
26879  * @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.
26880  * @max_tokens: the maximum number of pieces to split @string into. If this is less than 1, the string is split completely.
26881  *
26882  * Splits a string into a maximum of @max_tokens pieces, using the given
26883  * @delimiter. If @max_tokens is reached, the remainder of @string is
26884  * appended to the last token.
26885  *
26886  * As a special case, the result of splitting the empty string "" is an empty
26887  * vector, not a vector containing a single string. The reason for this
26888  * special case is that being able to represent a empty vector is typically
26889  * more useful than consistent handling of empty elements. If you do need
26890  * to represent empty elements, you'll need to check for the empty string
26891  * before calling g_strsplit().
26892  *
26893  * Returns: a newly-allocated %NULL-terminated array of strings. Use g_strfreev() to free it.
26894  */
26895
26896
26897 /**
26898  * g_strsplit_set:
26899  * @string: The string to be tokenized
26900  * @delimiters: A nul-terminated string containing bytes that are used to split the string.
26901  * @max_tokens: The maximum number of tokens to split @string into. If this is less than 1, the string is split completely
26902  *
26903  * Splits @string into a number of tokens not containing any of the characters
26904  * in @delimiter. A token is the (possibly empty) longest string that does not
26905  * contain any of the characters in @delimiters. If @max_tokens is reached, the
26906  * remainder is appended to the last token.
26907  *
26908  * For example the result of g_strsplit_set ("abc:def/ghi", ":/", -1) is a
26909  * %NULL-terminated vector containing the three strings "abc", "def",
26910  * and "ghi".
26911  *
26912  * The result if g_strsplit_set (":def/ghi:", ":/", -1) is a %NULL-terminated
26913  * vector containing the four strings "", "def", "ghi", and "".
26914  *
26915  * As a special case, the result of splitting the empty string "" is an empty
26916  * vector, not a vector containing a single string. The reason for this
26917  * special case is that being able to represent a empty vector is typically
26918  * more useful than consistent handling of empty elements. If you do need
26919  * to represent empty elements, you'll need to check for the empty string
26920  * before calling g_strsplit_set().
26921  *
26922  * Note that this function works on bytes not characters, so it can't be used
26923  * to delimit UTF-8 strings for anything but ASCII characters.
26924  *
26925  * Returns: a newly-allocated %NULL-terminated array of strings. Use g_strfreev() to free it.
26926  * Since: 2.4
26927  */
26928
26929
26930 /**
26931  * g_strstr_len:
26932  * @haystack: a string
26933  * @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.
26934  * @needle: the string to search for
26935  *
26936  * Searches the string @haystack for the first occurrence
26937  * of the string @needle, limiting the length of the search
26938  * to @haystack_len.
26939  *
26940  * Returns: a pointer to the found occurrence, or %NULL if not found.
26941  */
26942
26943
26944 /**
26945  * g_strstrip:
26946  * @string: a string to remove the leading and trailing whitespace from
26947  *
26948  * Removes leading and trailing whitespace from a string.
26949  * See g_strchomp() and g_strchug().
26950  *
26951  * Returns: @string
26952  */
26953
26954
26955 /**
26956  * g_strtod:
26957  * @nptr: the string to convert to a numeric value.
26958  * @endptr: if non-%NULL, it returns the character after the last character used in the conversion.
26959  *
26960  * Converts a string to a #gdouble value.
26961  * It calls the standard strtod() function to handle the conversion, but
26962  * if the string is not completely converted it attempts the conversion
26963  * again with g_ascii_strtod(), and returns the best match.
26964  *
26965  * This function should seldom be used. The normal situation when reading
26966  * numbers not for human consumption is to use g_ascii_strtod(). Only when
26967  * you know that you must expect both locale formatted and C formatted numbers
26968  * should you use this. Make sure that you don't pass strings such as comma
26969  * separated lists of values, since the commas may be interpreted as a decimal
26970  * point in some locales, causing unexpected results.
26971  *
26972  * Returns: the #gdouble value.
26973  */
26974
26975
26976 /**
26977  * g_strup:
26978  * @string: the string to convert.
26979  *
26980  * Converts a string to upper case.
26981  *
26982  * Returns: the string
26983  * 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.
26984  */
26985
26986
26987 /**
26988  * g_strv_length:
26989  * @str_array: a %NULL-terminated array of strings
26990  *
26991  * Returns the length of the given %NULL-terminated
26992  * string array @str_array.
26993  *
26994  * Returns: length of @str_array.
26995  * Since: 2.6
26996  */
26997
26998
26999 /**
27000  * g_test_add:
27001  * @testpath: The test path for a new test case.
27002  * @Fixture: The type of a fixture data structure.
27003  * @tdata: Data argument for the test functions.
27004  * @fsetup: The function to set up the fixture data.
27005  * @ftest: The actual test function.
27006  * @fteardown: The function to tear down the fixture data.
27007  *
27008  * Hook up a new test case at @testpath, similar to g_test_add_func().
27009  * A fixture data structure with setup and teardown function may be provided
27010  * though, similar to g_test_create_case().
27011  * g_test_add() is implemented as a macro, so that the fsetup(), ftest() and
27012  * fteardown() callbacks can expect a @Fixture pointer as first argument in
27013  * a type safe manner.
27014  *
27015  * Since: 2.16
27016  */
27017
27018
27019 /**
27020  * g_test_add_data_func:
27021  * @testpath: /-separated test case path name for the test.
27022  * @test_data: Test data argument for the test function.
27023  * @test_func: The test function to invoke for this test.
27024  *
27025  * Create a new test case, similar to g_test_create_case(). However
27026  * the test is assumed to use no fixture, and test suites are automatically
27027  * created on the fly and added to the root fixture, based on the
27028  * slash-separated portions of @testpath. The @test_data argument
27029  * will be passed as first argument to @test_func.
27030  *
27031  * Since: 2.16
27032  */
27033
27034
27035 /**
27036  * g_test_add_data_func_full:
27037  * @testpath: /-separated test case path name for the test.
27038  * @test_data: Test data argument for the test function.
27039  * @test_func: The test function to invoke for this test.
27040  * @data_free_func: #GDestroyNotify for @test_data.
27041  *
27042  * Create a new test case, as with g_test_add_data_func(), but freeing
27043  * @test_data after the test run is complete.
27044  *
27045  * Since: 2.34
27046  */
27047
27048
27049 /**
27050  * g_test_add_func:
27051  * @testpath: /-separated test case path name for the test.
27052  * @test_func: The test function to invoke for this test.
27053  *
27054  * Create a new test case, similar to g_test_create_case(). However
27055  * the test is assumed to use no fixture, and test suites are automatically
27056  * created on the fly and added to the root fixture, based on the
27057  * slash-separated portions of @testpath.
27058  *
27059  * Since: 2.16
27060  */
27061
27062
27063 /**
27064  * g_test_assert_expected_messages:
27065  *
27066  * Asserts that all messages previously indicated via
27067  * g_test_expect_message() have been seen and suppressed.
27068  *
27069  * Since: 2.34
27070  */
27071
27072
27073 /**
27074  * g_test_bug:
27075  * @bug_uri_snippet: Bug specific bug tracker URI portion.
27076  *
27077  * This function adds a message to test reports that
27078  * associates a bug URI with a test case.
27079  * Bug URIs are constructed from a base URI set with g_test_bug_base()
27080  * and @bug_uri_snippet.
27081  *
27082  * Since: 2.16
27083  */
27084
27085
27086 /**
27087  * g_test_bug_base:
27088  * @uri_pattern: the base pattern for bug URIs
27089  *
27090  * Specify the base URI for bug reports.
27091  *
27092  * The base URI is used to construct bug report messages for
27093  * g_test_message() when g_test_bug() is called.
27094  * Calling this function outside of a test case sets the
27095  * default base URI for all test cases. Calling it from within
27096  * a test case changes the base URI for the scope of the test
27097  * case only.
27098  * Bug URIs are constructed by appending a bug specific URI
27099  * portion to @uri_pattern, or by replacing the special string
27100  * '\%s' within @uri_pattern if that is present.
27101  *
27102  * Since: 2.16
27103  */
27104
27105
27106 /**
27107  * g_test_create_case:
27108  * @test_name: the name for the test case
27109  * @data_size: the size of the fixture data structure
27110  * @test_data: test data argument for the test functions
27111  * @data_setup: the function to set up the fixture data
27112  * @data_test: the actual test function
27113  * @data_teardown: the function to teardown the fixture data
27114  *
27115  * Create a new #GTestCase, named @test_name, this API is fairly
27116  * low level, calling g_test_add() or g_test_add_func() is preferable.
27117  * When this test is executed, a fixture structure of size @data_size
27118  * will be allocated and filled with 0s. Then @data_setup is called
27119  * to initialize the fixture. After fixture setup, the actual test
27120  * function @data_test is called. Once the test run completed, the
27121  * fixture structure is torn down  by calling @data_teardown and
27122  * after that the memory is released.
27123  *
27124  * Splitting up a test run into fixture setup, test function and
27125  * fixture teardown is most usful if the same fixture is used for
27126  * multiple tests. In this cases, g_test_create_case() will be
27127  * called with the same fixture, but varying @test_name and
27128  * @data_test arguments.
27129  *
27130  * Returns: a newly allocated #GTestCase.
27131  * Since: 2.16
27132  */
27133
27134
27135 /**
27136  * g_test_create_suite:
27137  * @suite_name: a name for the suite
27138  *
27139  * Create a new test suite with the name @suite_name.
27140  *
27141  * Returns: A newly allocated #GTestSuite instance.
27142  * Since: 2.16
27143  */
27144
27145
27146 /**
27147  * g_test_expect_message:
27148  * @log_domain: the log domain of the message
27149  * @log_level: the log level of the message
27150  * @pattern: a glob-style <link linkend="glib-Glob-style-pattern-matching">pattern</link>
27151  *
27152  * Indicates that a message with the given @log_domain and @log_level,
27153  * with text matching @pattern, is expected to be logged. When this
27154  * message is logged, it will not be printed, and the test case will
27155  * not abort.
27156  *
27157  * Use g_test_assert_expected_messages() to assert that all
27158  * previously-expected messages have been seen and suppressed.
27159  *
27160  * You can call this multiple times in a row, if multiple messages are
27161  * expected as a result of a single call. (The messages must appear in
27162  * the same order as the calls to g_test_expect_message().)
27163  *
27164  * For example:
27165  *
27166  * |[
27167  *   /&ast; g_main_context_push_thread_default() should fail if the
27168  *    &ast; context is already owned by another thread.
27169  *    &ast;/
27170  *   g_test_expect_message (G_LOG_DOMAIN,
27171  *                          G_LOG_LEVEL_CRITICAL,
27172  *                          "assertion.*acquired_context.*failed");
27173  *   g_main_context_push_thread_default (bad_context);
27174  *   g_test_assert_expected_messages ();
27175  * ]|
27176  *
27177  * Note that you cannot use this to test g_error() messages, since
27178  * g_error() intentionally never returns even if the program doesn't
27179  * abort; use g_test_trap_fork() in this case.
27180  *
27181  * Since: 2.34
27182  */
27183
27184
27185 /**
27186  * g_test_fail:
27187  *
27188  * Indicates that a test failed. This function can be called
27189  * multiple times from the same test. You can use this function
27190  * if your test failed in a recoverable way.
27191  *
27192  * Do not use this function if the failure of a test could cause
27193  * other tests to malfunction.
27194  *
27195  * Calling this function will not stop the test from running, you
27196  * need to return from the test function yourself. So you can
27197  * produce additional diagnostic messages or even continue running
27198  * the test.
27199  *
27200  * If not called from inside a test, this function does nothing.
27201  *
27202  * Since: 2.30
27203  */
27204
27205
27206 /**
27207  * g_test_get_root:
27208  *
27209  * Get the toplevel test suite for the test path API.
27210  *
27211  * Returns: the toplevel #GTestSuite
27212  * Since: 2.16
27213  */
27214
27215
27216 /**
27217  * g_test_init:
27218  * @argc: Address of the @argc parameter of the main() function. Changed if any arguments were handled.
27219  * @argv: Address of the @argv parameter of main(). Any parameters understood by g_test_init() stripped before return.
27220  * @...: Reserved for future extension. Currently, you must pass %NULL.
27221  *
27222  * Initialize the GLib testing framework, e.g. by seeding the
27223  * test random number generator, the name for g_get_prgname()
27224  * and parsing test related command line args.
27225  * So far, the following arguments are understood:
27226  * <variablelist>
27227  *   <varlistentry>
27228  *     <term><option>-l</option></term>
27229  *     <listitem><para>
27230  *       List test cases available in a test executable.
27231  *     </para></listitem>
27232  *   </varlistentry>
27233  *   <varlistentry>
27234  *     <term><option>--seed=<replaceable>RANDOMSEED</replaceable></option></term>
27235  *     <listitem><para>
27236  *       Provide a random seed to reproduce test runs using random numbers.
27237  *     </para></listitem>
27238  *     </varlistentry>
27239  *     <varlistentry>
27240  *       <term><option>--verbose</option></term>
27241  *       <listitem><para>Run tests verbosely.</para></listitem>
27242  *     </varlistentry>
27243  *     <varlistentry>
27244  *       <term><option>-q</option>, <option>--quiet</option></term>
27245  *       <listitem><para>Run tests quietly.</para></listitem>
27246  *     </varlistentry>
27247  *     <varlistentry>
27248  *       <term><option>-p <replaceable>TESTPATH</replaceable></option></term>
27249  *       <listitem><para>
27250  *         Execute all tests matching <replaceable>TESTPATH</replaceable>.
27251  *       </para></listitem>
27252  *     </varlistentry>
27253  *     <varlistentry>
27254  *       <term><option>-m {perf|slow|thorough|quick|undefined|no-undefined}</option></term>
27255  *       <listitem><para>
27256  *         Execute tests according to these test modes:
27257  *         <variablelist>
27258  *           <varlistentry>
27259  *             <term>perf</term>
27260  *             <listitem><para>
27261  *               Performance tests, may take long and report results.
27262  *             </para></listitem>
27263  *           </varlistentry>
27264  *           <varlistentry>
27265  *             <term>slow, thorough</term>
27266  *             <listitem><para>
27267  *               Slow and thorough tests, may take quite long and
27268  *               maximize coverage.
27269  *             </para></listitem>
27270  *           </varlistentry>
27271  *           <varlistentry>
27272  *             <term>quick</term>
27273  *             <listitem><para>
27274  *               Quick tests, should run really quickly and give good coverage.
27275  *             </para></listitem>
27276  *           </varlistentry>
27277  *           <varlistentry>
27278  *             <term>undefined</term>
27279  *             <listitem><para>
27280  *               Tests for undefined behaviour, may provoke programming errors
27281  *               under g_test_trap_fork() to check that appropriate assertions
27282  *               or warnings are given
27283  *             </para></listitem>
27284  *           </varlistentry>
27285  *           <varlistentry>
27286  *             <term>no-undefined</term>
27287  *             <listitem><para>
27288  *               Avoid tests for undefined behaviour
27289  *             </para></listitem>
27290  *           </varlistentry>
27291  *         </variablelist>
27292  *       </para></listitem>
27293  *     </varlistentry>
27294  *     <varlistentry>
27295  *       <term><option>--debug-log</option></term>
27296  *       <listitem><para>Debug test logging output.</para></listitem>
27297  *     </varlistentry>
27298  *  </variablelist>
27299  *
27300  * Since: 2.16
27301  */
27302
27303
27304 /**
27305  * g_test_log_buffer_free:
27306  *
27307  * Internal function for gtester to free test log messages, no ABI guarantees provided.
27308  */
27309
27310
27311 /**
27312  * g_test_log_buffer_new:
27313  *
27314  * Internal function for gtester to decode test log messages, no ABI guarantees provided.
27315  */
27316
27317
27318 /**
27319  * g_test_log_buffer_pop:
27320  *
27321  * Internal function for gtester to retrieve test log messages, no ABI guarantees provided.
27322  */
27323
27324
27325 /**
27326  * g_test_log_buffer_push:
27327  *
27328  * Internal function for gtester to decode test log messages, no ABI guarantees provided.
27329  */
27330
27331
27332 /**
27333  * g_test_log_msg_free:
27334  *
27335  * Internal function for gtester to free test log messages, no ABI guarantees provided.
27336  */
27337
27338
27339 /**
27340  * g_test_log_set_fatal_handler:
27341  * @log_func: the log handler function.
27342  * @user_data: data passed to the log handler.
27343  *
27344  * Installs a non-error fatal log handler which can be
27345  * used to decide whether log messages which are counted
27346  * as fatal abort the program.
27347  *
27348  * The use case here is that you are running a test case
27349  * that depends on particular libraries or circumstances
27350  * and cannot prevent certain known critical or warning
27351  * messages. So you install a handler that compares the
27352  * domain and message to precisely not abort in such a case.
27353  *
27354  * Note that the handler is reset at the beginning of
27355  * any test case, so you have to set it inside each test
27356  * function which needs the special behavior.
27357  *
27358  * This handler has no effect on g_error messages.
27359  *
27360  * Since: 2.22
27361  */
27362
27363
27364 /**
27365  * g_test_maximized_result:
27366  * @maximized_quantity: the reported value
27367  * @format: the format string of the report message
27368  * @...: arguments to pass to the printf() function
27369  *
27370  * Report the result of a performance or measurement test.
27371  * The test should generally strive to maximize the reported
27372  * quantities (larger values are better than smaller ones),
27373  * this and @maximized_quantity can determine sorting
27374  * order for test result reports.
27375  *
27376  * Since: 2.16
27377  */
27378
27379
27380 /**
27381  * g_test_message:
27382  * @format: the format string
27383  * @...: printf-like arguments to @format
27384  *
27385  * Add a message to the test report.
27386  *
27387  * Since: 2.16
27388  */
27389
27390
27391 /**
27392  * g_test_minimized_result:
27393  * @minimized_quantity: the reported value
27394  * @format: the format string of the report message
27395  * @...: arguments to pass to the printf() function
27396  *
27397  * Report the result of a performance or measurement test.
27398  * The test should generally strive to minimize the reported
27399  * quantities (smaller values are better than larger ones),
27400  * this and @minimized_quantity can determine sorting
27401  * order for test result reports.
27402  *
27403  * Since: 2.16
27404  */
27405
27406
27407 /**
27408  * g_test_perf:
27409  *
27410  * Returns %TRUE if tests are run in performance mode.
27411  *
27412  * Returns: %TRUE if in performance mode
27413  */
27414
27415
27416 /**
27417  * g_test_queue_destroy:
27418  * @destroy_func: Destroy callback for teardown phase.
27419  * @destroy_data: Destroy callback data.
27420  *
27421  * This function enqueus a callback @destroy_func to be executed
27422  * during the next test case teardown phase. This is most useful
27423  * to auto destruct allocted test resources at the end of a test run.
27424  * Resources are released in reverse queue order, that means enqueueing
27425  * callback A before callback B will cause B() to be called before
27426  * A() during teardown.
27427  *
27428  * Since: 2.16
27429  */
27430
27431
27432 /**
27433  * g_test_queue_free:
27434  * @gfree_pointer: the pointer to be stored.
27435  *
27436  * Enqueue a pointer to be released with g_free() during the next
27437  * teardown phase. This is equivalent to calling g_test_queue_destroy()
27438  * with a destroy callback of g_free().
27439  *
27440  * Since: 2.16
27441  */
27442
27443
27444 /**
27445  * g_test_queue_unref:
27446  * @gobject: the object to unref
27447  *
27448  * Enqueue an object to be released with g_object_unref() during
27449  * the next teardown phase. This is equivalent to calling
27450  * g_test_queue_destroy() with a destroy callback of g_object_unref().
27451  *
27452  * Since: 2.16
27453  */
27454
27455
27456 /**
27457  * g_test_quick:
27458  *
27459  * Returns %TRUE if tests are run in quick mode.
27460  * Exactly one of g_test_quick() and g_test_slow() is active in any run;
27461  * there is no "medium speed".
27462  *
27463  * Returns: %TRUE if in quick mode
27464  */
27465
27466
27467 /**
27468  * g_test_quiet:
27469  *
27470  * Returns %TRUE if tests are run in quiet mode.
27471  * The default is neither g_test_verbose() nor g_test_quiet().
27472  *
27473  * Returns: %TRUE if in quiet mode
27474  */
27475
27476
27477 /**
27478  * g_test_rand_bit:
27479  *
27480  * Get a reproducible random bit (0 or 1), see g_test_rand_int()
27481  * for details on test case random numbers.
27482  *
27483  * Since: 2.16
27484  */
27485
27486
27487 /**
27488  * g_test_rand_double:
27489  *
27490  * Get a reproducible random floating point number,
27491  * see g_test_rand_int() for details on test case random numbers.
27492  *
27493  * Returns: a random number from the seeded random number generator.
27494  * Since: 2.16
27495  */
27496
27497
27498 /**
27499  * g_test_rand_double_range:
27500  * @range_start: the minimum value returned by this function
27501  * @range_end: the minimum value not returned by this function
27502  *
27503  * Get a reproducible random floating pointer number out of a specified range,
27504  * see g_test_rand_int() for details on test case random numbers.
27505  *
27506  * Returns: a number with @range_start <= number < @range_end.
27507  * Since: 2.16
27508  */
27509
27510
27511 /**
27512  * g_test_rand_int:
27513  *
27514  * Get a reproducible random integer number.
27515  *
27516  * The random numbers generated by the g_test_rand_*() family of functions
27517  * change with every new test program start, unless the --seed option is
27518  * given when starting test programs.
27519  *
27520  * For individual test cases however, the random number generator is
27521  * reseeded, to avoid dependencies between tests and to make --seed
27522  * effective for all test cases.
27523  *
27524  * Returns: a random number from the seeded random number generator.
27525  * Since: 2.16
27526  */
27527
27528
27529 /**
27530  * g_test_rand_int_range:
27531  * @begin: the minimum value returned by this function
27532  * @end: the smallest value not to be returned by this function
27533  *
27534  * Get a reproducible random integer number out of a specified range,
27535  * see g_test_rand_int() for details on test case random numbers.
27536  *
27537  * Returns: a number with @begin <= number < @end.
27538  * Since: 2.16
27539  */
27540
27541
27542 /**
27543  * g_test_run:
27544  *
27545  * Runs all tests under the toplevel suite which can be retrieved
27546  * with g_test_get_root(). Similar to g_test_run_suite(), the test
27547  * cases to be run are filtered according to
27548  * test path arguments (-p <replaceable>testpath</replaceable>) as
27549  * parsed by g_test_init().
27550  * g_test_run_suite() or g_test_run() may only be called once
27551  * in a program.
27552  *
27553  * Returns: 0 on success
27554  * Since: 2.16
27555  */
27556
27557
27558 /**
27559  * g_test_run_suite:
27560  * @suite: a #GTestSuite
27561  *
27562  * Execute the tests within @suite and all nested #GTestSuites.
27563  * The test suites to be executed are filtered according to
27564  * test path arguments (-p <replaceable>testpath</replaceable>)
27565  * as parsed by g_test_init().
27566  * g_test_run_suite() or g_test_run() may only be called once
27567  * in a program.
27568  *
27569  * Returns: 0 on success
27570  * Since: 2.16
27571  */
27572
27573
27574 /**
27575  * g_test_slow:
27576  *
27577  * Returns %TRUE if tests are run in slow mode.
27578  * Exactly one of g_test_quick() and g_test_slow() is active in any run;
27579  * there is no "medium speed".
27580  *
27581  * Returns: the opposite of g_test_quick()
27582  */
27583
27584
27585 /**
27586  * g_test_suite_add:
27587  * @suite: a #GTestSuite
27588  * @test_case: a #GTestCase
27589  *
27590  * Adds @test_case to @suite.
27591  *
27592  * Since: 2.16
27593  */
27594
27595
27596 /**
27597  * g_test_suite_add_suite:
27598  * @suite: a #GTestSuite
27599  * @nestedsuite: another #GTestSuite
27600  *
27601  * Adds @nestedsuite to @suite.
27602  *
27603  * Since: 2.16
27604  */
27605
27606
27607 /**
27608  * g_test_thorough:
27609  *
27610  * Returns %TRUE if tests are run in thorough mode, equivalent to
27611  * g_test_slow().
27612  *
27613  * Returns: the same thing as g_test_slow()
27614  */
27615
27616
27617 /**
27618  * g_test_timer_elapsed:
27619  *
27620  * Get the time since the last start of the timer with g_test_timer_start().
27621  *
27622  * Returns: the time since the last start of the timer, as a double
27623  * Since: 2.16
27624  */
27625
27626
27627 /**
27628  * g_test_timer_last:
27629  *
27630  * Report the last result of g_test_timer_elapsed().
27631  *
27632  * Returns: the last result of g_test_timer_elapsed(), as a double
27633  * Since: 2.16
27634  */
27635
27636
27637 /**
27638  * g_test_timer_start:
27639  *
27640  * Start a timing test. Call g_test_timer_elapsed() when the task is supposed
27641  * to be done. Call this function again to restart the timer.
27642  *
27643  * Since: 2.16
27644  */
27645
27646
27647 /**
27648  * g_test_trap_assert_failed:
27649  *
27650  * Assert that the last forked test failed.
27651  * See g_test_trap_fork().
27652  *
27653  * This is sometimes used to test situations that are formally considered to
27654  * be undefined behaviour, like inputs that fail a g_return_if_fail()
27655  * check. In these situations you should skip the entire test, including the
27656  * call to g_test_trap_fork(), unless g_test_undefined() returns %TRUE
27657  * to indicate that undefined behaviour may be tested.
27658  *
27659  * Since: 2.16
27660  */
27661
27662
27663 /**
27664  * g_test_trap_assert_passed:
27665  *
27666  * Assert that the last forked test passed.
27667  * See g_test_trap_fork().
27668  *
27669  * Since: 2.16
27670  */
27671
27672
27673 /**
27674  * g_test_trap_assert_stderr:
27675  * @serrpattern: a glob-style <link linkend="glib-Glob-style-pattern-matching">pattern</link>
27676  *
27677  * Assert that the stderr output of the last forked test
27678  * matches @serrpattern. See  g_test_trap_fork().
27679  *
27680  * This is sometimes used to test situations that are formally considered to
27681  * be undefined behaviour, like inputs that fail a g_return_if_fail()
27682  * check. In these situations you should skip the entire test, including the
27683  * call to g_test_trap_fork(), unless g_test_undefined() returns %TRUE
27684  * to indicate that undefined behaviour may be tested.
27685  *
27686  * Since: 2.16
27687  */
27688
27689
27690 /**
27691  * g_test_trap_assert_stderr_unmatched:
27692  * @serrpattern: a glob-style <link linkend="glib-Glob-style-pattern-matching">pattern</link>
27693  *
27694  * Assert that the stderr output of the last forked test
27695  * does not match @serrpattern. See g_test_trap_fork().
27696  *
27697  * Since: 2.16
27698  */
27699
27700
27701 /**
27702  * g_test_trap_assert_stdout:
27703  * @soutpattern: a glob-style <link linkend="glib-Glob-style-pattern-matching">pattern</link>
27704  *
27705  * Assert that the stdout output of the last forked test matches
27706  * @soutpattern. See g_test_trap_fork().
27707  *
27708  * Since: 2.16
27709  */
27710
27711
27712 /**
27713  * g_test_trap_assert_stdout_unmatched:
27714  * @soutpattern: a glob-style <link linkend="glib-Glob-style-pattern-matching">pattern</link>
27715  *
27716  * Assert that the stdout output of the last forked test
27717  * does not match @soutpattern. See g_test_trap_fork().
27718  *
27719  * Since: 2.16
27720  */
27721
27722
27723 /**
27724  * g_test_trap_fork:
27725  * @usec_timeout: Timeout for the forked test in micro seconds.
27726  * @test_trap_flags: Flags to modify forking behaviour.
27727  *
27728  * Fork the current test program to execute a test case that might
27729  * not return or that might abort. The forked test case is aborted
27730  * and considered failing if its run time exceeds @usec_timeout.
27731  *
27732  * The forking behavior can be configured with the #GTestTrapFlags flags.
27733  *
27734  * In the following example, the test code forks, the forked child
27735  * process produces some sample output and exits successfully.
27736  * The forking parent process then asserts successful child program
27737  * termination and validates child program outputs.
27738  *
27739  * |[
27740  *   static void
27741  *   test_fork_patterns (void)
27742  *   {
27743  *     if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR))
27744  *       {
27745  *         g_print ("some stdout text: somagic17\n");
27746  *         g_printerr ("some stderr text: semagic43\n");
27747  *         exit (0); /&ast; successful test run &ast;/
27748  *       }
27749  *     g_test_trap_assert_passed();
27750  *     g_test_trap_assert_stdout ("*somagic17*");
27751  *     g_test_trap_assert_stderr ("*semagic43*");
27752  *   }
27753  * ]|
27754  *
27755  * This function is implemented only on Unix platforms.
27756  *
27757  * Returns: %TRUE for the forked child and %FALSE for the executing parent process.
27758  * Since: 2.16
27759  */
27760
27761
27762 /**
27763  * g_test_trap_has_passed:
27764  *
27765  * Check the result of the last g_test_trap_fork() call.
27766  *
27767  * Returns: %TRUE if the last forked child terminated successfully.
27768  * Since: 2.16
27769  */
27770
27771
27772 /**
27773  * g_test_trap_reached_timeout:
27774  *
27775  * Check the result of the last g_test_trap_fork() call.
27776  *
27777  * Returns: %TRUE if the last forked child got killed due to a fork timeout.
27778  * Since: 2.16
27779  */
27780
27781
27782 /**
27783  * g_test_undefined:
27784  *
27785  * Returns %TRUE if tests may provoke assertions and other formally-undefined
27786  * behaviour under g_test_trap_fork(), to verify that appropriate warnings
27787  * are given. It can be useful to turn this off if running tests under
27788  * valgrind.
27789  *
27790  * Returns: %TRUE if tests may provoke programming errors
27791  */
27792
27793
27794 /**
27795  * g_test_verbose:
27796  *
27797  * Returns %TRUE if tests are run in verbose mode.
27798  * The default is neither g_test_verbose() nor g_test_quiet().
27799  *
27800  * Returns: %TRUE if in verbose mode
27801  */
27802
27803
27804 /**
27805  * g_thread_exit:
27806  * @retval: the return value of this thread
27807  *
27808  * Terminates the current thread.
27809  *
27810  * If another thread is waiting for us using g_thread_join() then the
27811  * waiting thread will be woken up and get @retval as the return value
27812  * of g_thread_join().
27813  *
27814  * Calling <literal>g_thread_exit (retval)</literal> is equivalent to
27815  * returning @retval from the function @func, as given to g_thread_new().
27816  *
27817  * <note><para>
27818  *   You must only call g_thread_exit() from a thread that you created
27819  *   yourself with g_thread_new() or related APIs.  You must not call
27820  *   this function from a thread created with another threading library
27821  *   or or from within a #GThreadPool.
27822  * </para></note>
27823  */
27824
27825
27826 /**
27827  * g_thread_join:
27828  * @thread: a #GThread
27829  *
27830  * Waits until @thread finishes, i.e. the function @func, as
27831  * given to g_thread_new(), returns or g_thread_exit() is called.
27832  * If @thread has already terminated, then g_thread_join()
27833  * returns immediately.
27834  *
27835  * Any thread can wait for any other thread by calling g_thread_join(),
27836  * not just its 'creator'. Calling g_thread_join() from multiple threads
27837  * for the same @thread leads to undefined behaviour.
27838  *
27839  * The value returned by @func or given to g_thread_exit() is
27840  * returned by this function.
27841  *
27842  * g_thread_join() consumes the reference to the passed-in @thread.
27843  * This will usually cause the #GThread struct and associated resources
27844  * to be freed. Use g_thread_ref() to obtain an extra reference if you
27845  * want to keep the GThread alive beyond the g_thread_join() call.
27846  *
27847  * Returns: the return value of the thread
27848  */
27849
27850
27851 /**
27852  * g_thread_new:
27853  * @name: a name for the new thread
27854  * @func: a function to execute in the new thread
27855  * @data: an argument to supply to the new thread
27856  *
27857  * This function creates a new thread. The new thread starts by invoking
27858  * @func with the argument data. The thread will run until @func returns
27859  * or until g_thread_exit() is called from the new thread. The return value
27860  * of @func becomes the return value of the thread, which can be obtained
27861  * with g_thread_join().
27862  *
27863  * The @name can be useful for discriminating threads in a debugger.
27864  * Some systems restrict the length of @name to 16 bytes.
27865  *
27866  * If the thread can not be created the program aborts. See
27867  * g_thread_try_new() if you want to attempt to deal with failures.
27868  *
27869  * To free the struct returned by this function, use g_thread_unref().
27870  * Note that g_thread_join() implicitly unrefs the #GThread as well.
27871  *
27872  * Returns: the new #GThread
27873  * Since: 2.32
27874  */
27875
27876
27877 /**
27878  * g_thread_pool_free:
27879  * @pool: a #GThreadPool
27880  * @immediate: should @pool shut down immediately?
27881  * @wait_: should the function wait for all tasks to be finished?
27882  *
27883  * Frees all resources allocated for @pool.
27884  *
27885  * If @immediate is %TRUE, no new task is processed for @pool.
27886  * Otherwise @pool is not freed before the last task is processed.
27887  * Note however, that no thread of this pool is interrupted while
27888  * processing a task. Instead at least all still running threads
27889  * can finish their tasks before the @pool is freed.
27890  *
27891  * If @wait_ is %TRUE, the functions does not return before all
27892  * tasks to be processed (dependent on @immediate, whether all
27893  * or only the currently running) are ready.
27894  * Otherwise the function returns immediately.
27895  *
27896  * After calling this function @pool must not be used anymore.
27897  */
27898
27899
27900 /**
27901  * g_thread_pool_get_max_idle_time:
27902  *
27903  * This function will return the maximum @interval that a
27904  * thread will wait in the thread pool for new tasks before
27905  * being stopped.
27906  *
27907  * If this function returns 0, threads waiting in the thread
27908  * pool for new work are not stopped.
27909  *
27910  * Returns: the maximum @interval (milliseconds) to wait for new tasks in the thread pool before stopping the thread
27911  * Since: 2.10
27912  */
27913
27914
27915 /**
27916  * g_thread_pool_get_max_threads:
27917  * @pool: a #GThreadPool
27918  *
27919  * Returns the maximal number of threads for @pool.
27920  *
27921  * Returns: the maximal number of threads
27922  */
27923
27924
27925 /**
27926  * g_thread_pool_get_max_unused_threads:
27927  *
27928  * Returns the maximal allowed number of unused threads.
27929  *
27930  * Returns: the maximal number of unused threads
27931  */
27932
27933
27934 /**
27935  * g_thread_pool_get_num_threads:
27936  * @pool: a #GThreadPool
27937  *
27938  * Returns the number of threads currently running in @pool.
27939  *
27940  * Returns: the number of threads currently running
27941  */
27942
27943
27944 /**
27945  * g_thread_pool_get_num_unused_threads:
27946  *
27947  * Returns the number of currently unused threads.
27948  *
27949  * Returns: the number of currently unused threads
27950  */
27951
27952
27953 /**
27954  * g_thread_pool_new:
27955  * @func: a function to execute in the threads of the new thread pool
27956  * @user_data: user data that is handed over to @func every time it is called
27957  * @max_threads: the maximal number of threads to execute concurrently in  the new thread pool, -1 means no limit
27958  * @exclusive: should this thread pool be exclusive?
27959  * @error: return location for error, or %NULL
27960  *
27961  * This function creates a new thread pool.
27962  *
27963  * Whenever you call g_thread_pool_push(), either a new thread is
27964  * created or an unused one is reused. At most @max_threads threads
27965  * are running concurrently for this thread pool. @max_threads = -1
27966  * allows unlimited threads to be created for this thread pool. The
27967  * newly created or reused thread now executes the function @func
27968  * with the two arguments. The first one is the parameter to
27969  * g_thread_pool_push() and the second one is @user_data.
27970  *
27971  * The parameter @exclusive determines whether the thread pool owns
27972  * all threads exclusive or shares them with other thread pools.
27973  * If @exclusive is %TRUE, @max_threads threads are started
27974  * immediately and they will run exclusively for this thread pool
27975  * until it is destroyed by g_thread_pool_free(). If @exclusive is
27976  * %FALSE, threads are created when needed and shared between all
27977  * non-exclusive thread pools. This implies that @max_threads may
27978  * not be -1 for exclusive thread pools.
27979  *
27980  * @error can be %NULL to ignore errors, or non-%NULL to report
27981  * errors. An error can only occur when @exclusive is set to %TRUE
27982  * and not all @max_threads threads could be created.
27983  *
27984  * Returns: the new #GThreadPool
27985  */
27986
27987
27988 /**
27989  * g_thread_pool_push:
27990  * @pool: a #GThreadPool
27991  * @data: a new task for @pool
27992  * @error: return location for error, or %NULL
27993  *
27994  * Inserts @data into the list of tasks to be executed by @pool.
27995  *
27996  * When the number of currently running threads is lower than the
27997  * maximal allowed number of threads, a new thread is started (or
27998  * reused) with the properties given to g_thread_pool_new().
27999  * Otherwise, @data stays in the queue until a thread in this pool
28000  * finishes its previous task and processes @data.
28001  *
28002  * @error can be %NULL to ignore errors, or non-%NULL to report
28003  * errors. An error can only occur when a new thread couldn't be
28004  * created. In that case @data is simply appended to the queue of
28005  * work to do.
28006  *
28007  * Before version 2.32, this function did not return a success status.
28008  *
28009  * Returns: %TRUE on success, %FALSE if an error occurred
28010  */
28011
28012
28013 /**
28014  * g_thread_pool_set_max_idle_time:
28015  * @interval: the maximum @interval (in milliseconds) a thread can be idle
28016  *
28017  * This function will set the maximum @interval that a thread
28018  * waiting in the pool for new tasks can be idle for before
28019  * being stopped. This function is similar to calling
28020  * g_thread_pool_stop_unused_threads() on a regular timeout,
28021  * except this is done on a per thread basis.
28022  *
28023  * By setting @interval to 0, idle threads will not be stopped.
28024  *
28025  * The default value is 15000 (15 seconds).
28026  *
28027  * Since: 2.10
28028  */
28029
28030
28031 /**
28032  * g_thread_pool_set_max_threads:
28033  * @pool: a #GThreadPool
28034  * @max_threads: a new maximal number of threads for @pool, or -1 for unlimited
28035  * @error: return location for error, or %NULL
28036  *
28037  * Sets the maximal allowed number of threads for @pool.
28038  * A value of -1 means that the maximal number of threads
28039  * is unlimited. If @pool is an exclusive thread pool, setting
28040  * the maximal number of threads to -1 is not allowed.
28041  *
28042  * Setting @max_threads to 0 means stopping all work for @pool.
28043  * It is effectively frozen until @max_threads is set to a non-zero
28044  * value again.
28045  *
28046  * A thread is never terminated while calling @func, as supplied by
28047  * g_thread_pool_new(). Instead the maximal number of threads only
28048  * has effect for the allocation of new threads in g_thread_pool_push().
28049  * A new thread is allocated, whenever the number of currently
28050  * running threads in @pool is smaller than the maximal number.
28051  *
28052  * @error can be %NULL to ignore errors, or non-%NULL to report
28053  * errors. An error can only occur when a new thread couldn't be
28054  * created.
28055  *
28056  * Before version 2.32, this function did not return a success status.
28057  *
28058  * Returns: %TRUE on success, %FALSE if an error occurred
28059  */
28060
28061
28062 /**
28063  * g_thread_pool_set_max_unused_threads:
28064  * @max_threads: maximal number of unused threads
28065  *
28066  * Sets the maximal number of unused threads to @max_threads.
28067  * If @max_threads is -1, no limit is imposed on the number
28068  * of unused threads.
28069  *
28070  * The default value is 2.
28071  */
28072
28073
28074 /**
28075  * g_thread_pool_set_sort_function:
28076  * @pool: a #GThreadPool
28077  * @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.
28078  * @user_data: user data passed to @func
28079  *
28080  * Sets the function used to sort the list of tasks. This allows the
28081  * tasks to be processed by a priority determined by @func, and not
28082  * just in the order in which they were added to the pool.
28083  *
28084  * Note, if the maximum number of threads is more than 1, the order
28085  * that threads are executed cannot be guaranteed 100%. Threads are
28086  * scheduled by the operating system and are executed at random. It
28087  * cannot be assumed that threads are executed in the order they are
28088  * created.
28089  *
28090  * Since: 2.10
28091  */
28092
28093
28094 /**
28095  * g_thread_pool_stop_unused_threads:
28096  *
28097  * Stops all currently unused threads. This does not change the
28098  * maximal number of unused threads. This function can be used to
28099  * regularly stop all unused threads e.g. from g_timeout_add().
28100  */
28101
28102
28103 /**
28104  * g_thread_pool_unprocessed:
28105  * @pool: a #GThreadPool
28106  *
28107  * Returns the number of tasks still unprocessed in @pool.
28108  *
28109  * Returns: the number of unprocessed tasks
28110  */
28111
28112
28113 /**
28114  * g_thread_ref:
28115  * @thread: a #GThread
28116  *
28117  * Increase the reference count on @thread.
28118  *
28119  * Returns: a new reference to @thread
28120  * Since: 2.32
28121  */
28122
28123
28124 /**
28125  * g_thread_self:
28126  *
28127  * This functions returns the #GThread corresponding to the
28128  * current thread. Note that this function does not increase
28129  * the reference count of the returned struct.
28130  *
28131  * This function will return a #GThread even for threads that
28132  * were not created by GLib (i.e. those created by other threading
28133  * APIs). This may be useful for thread identification purposes
28134  * (i.e. comparisons) but you must not use GLib functions (such
28135  * as g_thread_join()) on these threads.
28136  *
28137  * Returns: the #GThread representing the current thread
28138  */
28139
28140
28141 /**
28142  * g_thread_supported:
28143  *
28144  * This macro returns %TRUE if the thread system is initialized,
28145  * and %FALSE if it is not.
28146  *
28147  * For language bindings, g_thread_get_initialized() provides
28148  * the same functionality as a function.
28149  *
28150  * Returns: %TRUE, if the thread system is initialized
28151  */
28152
28153
28154 /**
28155  * g_thread_try_new:
28156  * @name: a name for the new thread
28157  * @func: a function to execute in the new thread
28158  * @data: an argument to supply to the new thread
28159  * @error: return location for error, or %NULL
28160  *
28161  * This function is the same as g_thread_new() except that
28162  * it allows for the possibility of failure.
28163  *
28164  * If a thread can not be created (due to resource limits),
28165  * @error is set and %NULL is returned.
28166  *
28167  * Returns: the new #GThread, or %NULL if an error occurred
28168  * Since: 2.32
28169  */
28170
28171
28172 /**
28173  * g_thread_unref:
28174  * @thread: a #GThread
28175  *
28176  * Decrease the reference count on @thread, possibly freeing all
28177  * resources associated with it.
28178  *
28179  * Note that each thread holds a reference to its #GThread while
28180  * it is running, so it is safe to drop your own reference to it
28181  * if you don't need it anymore.
28182  *
28183  * Since: 2.32
28184  */
28185
28186
28187 /**
28188  * g_thread_yield:
28189  *
28190  * Causes the calling thread to voluntarily relinquish the CPU, so
28191  * that other threads can run.
28192  *
28193  * This function is often used as a method to make busy wait less evil.
28194  */
28195
28196
28197 /**
28198  * g_time_val_add:
28199  * @time_: a #GTimeVal
28200  * @microseconds: number of microseconds to add to @time
28201  *
28202  * Adds the given number of microseconds to @time_. @microseconds can
28203  * also be negative to decrease the value of @time_.
28204  */
28205
28206
28207 /**
28208  * g_time_val_from_iso8601:
28209  * @iso_date: an ISO 8601 encoded date string
28210  * @time_: (out): a #GTimeVal
28211  *
28212  * Converts a string containing an ISO 8601 encoded date and time
28213  * to a #GTimeVal and puts it into @time_.
28214  *
28215  * @iso_date must include year, month, day, hours, minutes, and
28216  * seconds. It can optionally include fractions of a second and a time
28217  * zone indicator. (In the absence of any time zone indication, the
28218  * timestamp is assumed to be in local time.)
28219  *
28220  * Returns: %TRUE if the conversion was successful.
28221  * Since: 2.12
28222  */
28223
28224
28225 /**
28226  * g_time_val_to_iso8601:
28227  * @time_: a #GTimeVal
28228  *
28229  * Converts @time_ into an RFC 3339 encoded string, relative to the
28230  * Coordinated Universal Time (UTC). This is one of the many formats
28231  * allowed by ISO 8601.
28232  *
28233  * ISO 8601 allows a large number of date/time formats, with or without
28234  * punctuation and optional elements. The format returned by this function
28235  * is a complete date and time, with optional punctuation included, the
28236  * UTC time zone represented as "Z", and the @tv_usec part included if
28237  * and only if it is nonzero, i.e. either
28238  * "YYYY-MM-DDTHH:MM:SSZ" or "YYYY-MM-DDTHH:MM:SS.fffffZ".
28239  *
28240  * This corresponds to the Internet date/time format defined by
28241  * <ulink url="https://www.ietf.org/rfc/rfc3339.txt">RFC 3339</ulink>, and
28242  * to either of the two most-precise formats defined by
28243  * <ulink url="http://www.w3.org/TR/NOTE-datetime-19980827">the W3C Note
28244  * "Date and Time Formats"</ulink>. Both of these documents are profiles of
28245  * ISO 8601.
28246  *
28247  * Use g_date_time_format() or g_strdup_printf() if a different
28248  * variation of ISO 8601 format is required.
28249  *
28250  * Returns: a newly allocated string containing an ISO 8601 date
28251  * Since: 2.12
28252  */
28253
28254
28255 /**
28256  * g_time_zone_adjust_time:
28257  * @tz: a #GTimeZone
28258  * @type: the #GTimeType of @time_
28259  * @time_: a pointer to a number of seconds since January 1, 1970
28260  *
28261  * Finds an interval within @tz that corresponds to the given @time_,
28262  * possibly adjusting @time_ if required to fit into an interval.
28263  * The meaning of @time_ depends on @type.
28264  *
28265  * This function is similar to g_time_zone_find_interval(), with the
28266  * difference that it always succeeds (by making the adjustments
28267  * described below).
28268  *
28269  * In any of the cases where g_time_zone_find_interval() succeeds then
28270  * this function returns the same value, without modifying @time_.
28271  *
28272  * This function may, however, modify @time_ in order to deal with
28273  * non-existent times.  If the non-existent local @time_ of 02:30 were
28274  * requested on March 14th 2010 in Toronto then this function would
28275  * adjust @time_ to be 03:00 and return the interval containing the
28276  * adjusted time.
28277  *
28278  * Returns: the interval containing @time_, never -1
28279  * Since: 2.26
28280  */
28281
28282
28283 /**
28284  * g_time_zone_find_interval:
28285  * @tz: a #GTimeZone
28286  * @type: the #GTimeType of @time_
28287  * @time_: a number of seconds since January 1, 1970
28288  *
28289  * Finds an the interval within @tz that corresponds to the given @time_.
28290  * The meaning of @time_ depends on @type.
28291  *
28292  * If @type is %G_TIME_TYPE_UNIVERSAL then this function will always
28293  * succeed (since universal time is monotonic and continuous).
28294  *
28295  * Otherwise @time_ is treated is local time.  The distinction between
28296  * %G_TIME_TYPE_STANDARD and %G_TIME_TYPE_DAYLIGHT is ignored except in
28297  * the case that the given @time_ is ambiguous.  In Toronto, for example,
28298  * 01:30 on November 7th 2010 occurred twice (once inside of daylight
28299  * savings time and the next, an hour later, outside of daylight savings
28300  * time).  In this case, the different value of @type would result in a
28301  * different interval being returned.
28302  *
28303  * It is still possible for this function to fail.  In Toronto, for
28304  * example, 02:00 on March 14th 2010 does not exist (due to the leap
28305  * forward to begin daylight savings time).  -1 is returned in that
28306  * case.
28307  *
28308  * Returns: the interval containing @time_, or -1 in case of failure
28309  * Since: 2.26
28310  */
28311
28312
28313 /**
28314  * g_time_zone_get_abbreviation:
28315  * @tz: a #GTimeZone
28316  * @interval: an interval within the timezone
28317  *
28318  * Determines the time zone abbreviation to be used during a particular
28319  * @interval of time in the time zone @tz.
28320  *
28321  * For example, in Toronto this is currently "EST" during the winter
28322  * months and "EDT" during the summer months when daylight savings time
28323  * is in effect.
28324  *
28325  * Returns: the time zone abbreviation, which belongs to @tz
28326  * Since: 2.26
28327  */
28328
28329
28330 /**
28331  * g_time_zone_get_offset:
28332  * @tz: a #GTimeZone
28333  * @interval: an interval within the timezone
28334  *
28335  * Determines the offset to UTC in effect during a particular @interval
28336  * of time in the time zone @tz.
28337  *
28338  * The offset is the number of seconds that you add to UTC time to
28339  * arrive at local time for @tz (ie: negative numbers for time zones
28340  * west of GMT, positive numbers for east).
28341  *
28342  * Returns: the number of seconds that should be added to UTC to get the local time in @tz
28343  * Since: 2.26
28344  */
28345
28346
28347 /**
28348  * g_time_zone_is_dst:
28349  * @tz: a #GTimeZone
28350  * @interval: an interval within the timezone
28351  *
28352  * Determines if daylight savings time is in effect during a particular
28353  * @interval of time in the time zone @tz.
28354  *
28355  * Returns: %TRUE if daylight savings time is in effect
28356  * Since: 2.26
28357  */
28358
28359
28360 /**
28361  * g_time_zone_new:
28362  * @identifier: (allow-none): a timezone identifier
28363  *
28364  * Creates a #GTimeZone corresponding to @identifier.
28365  *
28366  * @identifier can either be an RFC3339/ISO 8601 time offset or
28367  * something that would pass as a valid value for the
28368  * <varname>TZ</varname> environment variable (including %NULL).
28369  *
28370  * Valid RFC3339 time offsets are <literal>"Z"</literal> (for UTC) or
28371  * <literal>"±hh:mm"</literal>.  ISO 8601 additionally specifies
28372  * <literal>"±hhmm"</literal> and <literal>"±hh"</literal>.
28373  *
28374  * The <varname>TZ</varname> environment variable typically corresponds
28375  * to the name of a file in the zoneinfo database, but there are many
28376  * other possibilities.  Note that those other possibilities are not
28377  * currently implemented, but are planned.
28378  *
28379  * g_time_zone_new_local() calls this function with the value of the
28380  * <varname>TZ</varname> environment variable.  This function itself is
28381  * independent of the value of <varname>TZ</varname>, but if @identifier
28382  * is %NULL then <filename>/etc/localtime</filename> will be consulted
28383  * to discover the correct timezone.
28384  *
28385  * See <ulink
28386  * url='http://tools.ietf.org/html/rfc3339#section-5.6'>RFC3339
28387  * Â§5.6</ulink> for a precise definition of valid RFC3339 time offsets
28388  * (the <varname>time-offset</varname> expansion) and ISO 8601 for the
28389  * full list of valid time offsets.  See <ulink
28390  * url='http://www.gnu.org/s/libc/manual/html_node/TZ-Variable.html'>The
28391  * GNU C Library manual</ulink> for an explanation of the possible
28392  * values of the <varname>TZ</varname> environment variable.
28393  *
28394  * You should release the return value by calling g_time_zone_unref()
28395  * when you are done with it.
28396  *
28397  * Returns: the requested timezone
28398  * Since: 2.26
28399  */
28400
28401
28402 /**
28403  * g_time_zone_new_local:
28404  *
28405  * Creates a #GTimeZone corresponding to local time.  The local time
28406  * zone may change between invocations to this function; for example,
28407  * if the system administrator changes it.
28408  *
28409  * This is equivalent to calling g_time_zone_new() with the value of the
28410  * <varname>TZ</varname> environment variable (including the possibility
28411  * of %NULL).
28412  *
28413  * You should release the return value by calling g_time_zone_unref()
28414  * when you are done with it.
28415  *
28416  * Returns: the local timezone
28417  * Since: 2.26
28418  */
28419
28420
28421 /**
28422  * g_time_zone_new_utc:
28423  *
28424  * Creates a #GTimeZone corresponding to UTC.
28425  *
28426  * This is equivalent to calling g_time_zone_new() with a value like
28427  * "Z", "UTC", "+00", etc.
28428  *
28429  * You should release the return value by calling g_time_zone_unref()
28430  * when you are done with it.
28431  *
28432  * Returns: the universal timezone
28433  * Since: 2.26
28434  */
28435
28436
28437 /**
28438  * g_time_zone_ref:
28439  * @tz: a #GTimeZone
28440  *
28441  * Increases the reference count on @tz.
28442  *
28443  * Returns: a new reference to @tz.
28444  * Since: 2.26
28445  */
28446
28447
28448 /**
28449  * g_time_zone_unref:
28450  * @tz: a #GTimeZone
28451  *
28452  * Decreases the reference count on @tz.
28453  *
28454  * Since: 2.26
28455  */
28456
28457
28458 /**
28459  * g_timeout_add:
28460  * @interval: the time between calls to the function, in milliseconds (1/1000ths of a second)
28461  * @function: function to call
28462  * @data: data to pass to @function
28463  *
28464  * Sets a function to be called at regular intervals, with the default
28465  * priority, #G_PRIORITY_DEFAULT.  The function is called repeatedly
28466  * until it returns %FALSE, at which point the timeout is automatically
28467  * destroyed and the function will not be called again.  The first call
28468  * to the function will be at the end of the first @interval.
28469  *
28470  * Note that timeout functions may be delayed, due to the processing of other
28471  * event sources. Thus they should not be relied on for precise timing.
28472  * After each call to the timeout function, the time of the next
28473  * timeout is recalculated based on the current time and the given interval
28474  * (it does not try to 'catch up' time lost in delays).
28475  *
28476  * If you want to have a timer in the "seconds" range and do not care
28477  * about the exact time of the first call of the timer, use the
28478  * g_timeout_add_seconds() function; this function allows for more
28479  * optimizations and more efficient system power usage.
28480  *
28481  * This internally creates a main loop source using g_timeout_source_new()
28482  * and attaches it to the main loop context using g_source_attach(). You can
28483  * do these steps manually if you need greater control.
28484  *
28485  * The interval given is in terms of monotonic time, not wall clock
28486  * time.  See g_get_monotonic_time().
28487  *
28488  * Returns: the ID (greater than 0) of the event source.
28489  */
28490
28491
28492 /**
28493  * g_timeout_add_full:
28494  * @priority: the priority of the timeout source. Typically this will be in the range between #G_PRIORITY_DEFAULT and #G_PRIORITY_HIGH.
28495  * @interval: the time between calls to the function, in milliseconds (1/1000ths of a second)
28496  * @function: function to call
28497  * @data: data to pass to @function
28498  * @notify: (allow-none): function to call when the timeout is removed, or %NULL
28499  *
28500  * Sets a function to be called at regular intervals, with the given
28501  * priority.  The function is called repeatedly until it returns
28502  * %FALSE, at which point the timeout is automatically destroyed and
28503  * the function will not be called again.  The @notify function is
28504  * called when the timeout is destroyed.  The first call to the
28505  * function will be at the end of the first @interval.
28506  *
28507  * Note that timeout functions may be delayed, due to the processing of other
28508  * event sources. Thus they should not be relied on for precise timing.
28509  * After each call to the timeout function, the time of the next
28510  * timeout is recalculated based on the current time and the given interval
28511  * (it does not try to 'catch up' time lost in delays).
28512  *
28513  * This internally creates a main loop source using g_timeout_source_new()
28514  * and attaches it to the main loop context using g_source_attach(). You can
28515  * do these steps manually if you need greater control.
28516  *
28517  * The interval given in terms of monotonic time, not wall clock time.
28518  * See g_get_monotonic_time().
28519  *
28520  * Returns: the ID (greater than 0) of the event source.
28521  * Rename to: g_timeout_add
28522  */
28523
28524
28525 /**
28526  * g_timeout_add_seconds:
28527  * @interval: the time between calls to the function, in seconds
28528  * @function: function to call
28529  * @data: data to pass to @function
28530  *
28531  * Sets a function to be called at regular intervals with the default
28532  * priority, #G_PRIORITY_DEFAULT. The function is called repeatedly until
28533  * it returns %FALSE, at which point the timeout is automatically destroyed
28534  * and the function will not be called again.
28535  *
28536  * This internally creates a main loop source using
28537  * g_timeout_source_new_seconds() and attaches it to the main loop context
28538  * using g_source_attach(). You can do these steps manually if you need
28539  * greater control. Also see g_timeout_add_seconds_full().
28540  *
28541  * Note that the first call of the timer may not be precise for timeouts
28542  * of one second. If you need finer precision and have such a timeout,
28543  * you may want to use g_timeout_add() instead.
28544  *
28545  * The interval given is in terms of monotonic time, not wall clock
28546  * time.  See g_get_monotonic_time().
28547  *
28548  * Returns: the ID (greater than 0) of the event source.
28549  * Since: 2.14
28550  */
28551
28552
28553 /**
28554  * g_timeout_add_seconds_full:
28555  * @priority: the priority of the timeout source. Typically this will be in the range between #G_PRIORITY_DEFAULT and #G_PRIORITY_HIGH.
28556  * @interval: the time between calls to the function, in seconds
28557  * @function: function to call
28558  * @data: data to pass to @function
28559  * @notify: (allow-none): function to call when the timeout is removed, or %NULL
28560  *
28561  * Sets a function to be called at regular intervals, with @priority.
28562  * The function is called repeatedly until it returns %FALSE, at which
28563  * point the timeout is automatically destroyed and the function will
28564  * not be called again.
28565  *
28566  * Unlike g_timeout_add(), this function operates at whole second granularity.
28567  * The initial starting point of the timer is determined by the implementation
28568  * and the implementation is expected to group multiple timers together so that
28569  * they fire all at the same time.
28570  * To allow this grouping, the @interval to the first timer is rounded
28571  * and can deviate up to one second from the specified interval.
28572  * Subsequent timer iterations will generally run at the specified interval.
28573  *
28574  * Note that timeout functions may be delayed, due to the processing of other
28575  * event sources. Thus they should not be relied on for precise timing.
28576  * After each call to the timeout function, the time of the next
28577  * timeout is recalculated based on the current time and the given @interval
28578  *
28579  * If you want timing more precise than whole seconds, use g_timeout_add()
28580  * instead.
28581  *
28582  * The grouping of timers to fire at the same time results in a more power
28583  * and CPU efficient behavior so if your timer is in multiples of seconds
28584  * and you don't require the first timer exactly one second from now, the
28585  * use of g_timeout_add_seconds() is preferred over g_timeout_add().
28586  *
28587  * This internally creates a main loop source using
28588  * g_timeout_source_new_seconds() and attaches it to the main loop context
28589  * using g_source_attach(). You can do these steps manually if you need
28590  * greater control.
28591  *
28592  * The interval given is in terms of monotonic time, not wall clock
28593  * time.  See g_get_monotonic_time().
28594  *
28595  * Returns: the ID (greater than 0) of the event source.
28596  * Rename to: g_timeout_add_seconds
28597  * Since: 2.14
28598  */
28599
28600
28601 /**
28602  * g_timeout_source_new:
28603  * @interval: the timeout interval in milliseconds.
28604  *
28605  * Creates a new timeout source.
28606  *
28607  * The source will not initially be associated with any #GMainContext
28608  * and must be added to one with g_source_attach() before it will be
28609  * executed.
28610  *
28611  * The interval given is in terms of monotonic time, not wall clock
28612  * time.  See g_get_monotonic_time().
28613  *
28614  * Returns: the newly-created timeout source
28615  */
28616
28617
28618 /**
28619  * g_timeout_source_new_seconds:
28620  * @interval: the timeout interval in seconds
28621  *
28622  * Creates a new timeout source.
28623  *
28624  * The source will not initially be associated with any #GMainContext
28625  * and must be added to one with g_source_attach() before it will be
28626  * executed.
28627  *
28628  * The scheduling granularity/accuracy of this timeout source will be
28629  * in seconds.
28630  *
28631  * The interval given in terms of monotonic time, not wall clock time.
28632  * See g_get_monotonic_time().
28633  *
28634  * Returns: the newly-created timeout source
28635  * Since: 2.14
28636  */
28637
28638
28639 /**
28640  * g_timer_continue:
28641  * @timer: a #GTimer.
28642  *
28643  * Resumes a timer that has previously been stopped with
28644  * g_timer_stop(). g_timer_stop() must be called before using this
28645  * function.
28646  *
28647  * Since: 2.4
28648  */
28649
28650
28651 /**
28652  * g_timer_destroy:
28653  * @timer: a #GTimer to destroy.
28654  *
28655  * Destroys a timer, freeing associated resources.
28656  */
28657
28658
28659 /**
28660  * g_timer_elapsed:
28661  * @timer: a #GTimer.
28662  * @microseconds: return location for the fractional part of seconds elapsed, in microseconds (that is, the total number of microseconds elapsed, modulo 1000000), or %NULL
28663  *
28664  * If @timer has been started but not stopped, obtains the time since
28665  * the timer was started. If @timer has been stopped, obtains the
28666  * elapsed time between the time it was started and the time it was
28667  * stopped. The return value is the number of seconds elapsed,
28668  * including any fractional part. The @microseconds out parameter is
28669  * essentially useless.
28670  *
28671  * Returns: seconds elapsed as a floating point value, including any fractional part.
28672  */
28673
28674
28675 /**
28676  * g_timer_new:
28677  *
28678  * Creates a new timer, and starts timing (i.e. g_timer_start() is
28679  * implicitly called for you).
28680  *
28681  * Returns: a new #GTimer.
28682  */
28683
28684
28685 /**
28686  * g_timer_reset:
28687  * @timer: a #GTimer.
28688  *
28689  * This function is useless; it's fine to call g_timer_start() on an
28690  * already-started timer to reset the start time, so g_timer_reset()
28691  * serves no purpose.
28692  */
28693
28694
28695 /**
28696  * g_timer_start:
28697  * @timer: a #GTimer.
28698  *
28699  * Marks a start time, so that future calls to g_timer_elapsed() will
28700  * report the time since g_timer_start() was called. g_timer_new()
28701  * automatically marks the start time, so no need to call
28702  * g_timer_start() immediately after creating the timer.
28703  */
28704
28705
28706 /**
28707  * g_timer_stop:
28708  * @timer: a #GTimer.
28709  *
28710  * Marks an end time, so calls to g_timer_elapsed() will return the
28711  * difference between this end time and the start time.
28712  */
28713
28714
28715 /**
28716  * g_trash_stack_height:
28717  * @stack_p: a #GTrashStack
28718  *
28719  * Returns the height of a #GTrashStack.
28720  *
28721  * Note that execution of this function is of O(N) complexity
28722  * where N denotes the number of items on the stack.
28723  *
28724  * Returns: the height of the stack
28725  */
28726
28727
28728 /**
28729  * g_trash_stack_peek:
28730  * @stack_p: a #GTrashStack
28731  *
28732  * Returns the element at the top of a #GTrashStack
28733  * which may be %NULL.
28734  *
28735  * Returns: the element at the top of the stack
28736  */
28737
28738
28739 /**
28740  * g_trash_stack_pop:
28741  * @stack_p: a #GTrashStack
28742  *
28743  * Pops a piece of memory off a #GTrashStack.
28744  *
28745  * Returns: the element at the top of the stack
28746  */
28747
28748
28749 /**
28750  * g_trash_stack_push:
28751  * @stack_p: a #GTrashStack
28752  * @data_p: the piece of memory to push on the stack
28753  *
28754  * Pushes a piece of memory onto a #GTrashStack.
28755  */
28756
28757
28758 /**
28759  * g_tree_destroy:
28760  * @tree: a #GTree.
28761  *
28762  * Removes all keys and values from the #GTree and decreases its
28763  * reference count by one. If keys and/or values are dynamically
28764  * allocated, you should either free them first or create the #GTree
28765  * using g_tree_new_full().  In the latter case the destroy functions
28766  * you supplied will be called on all keys and values before destroying
28767  * the #GTree.
28768  */
28769
28770
28771 /**
28772  * g_tree_foreach:
28773  * @tree: a #GTree.
28774  * @func: the function to call for each node visited. If this function returns %TRUE, the traversal is stopped.
28775  * @user_data: user data to pass to the function.
28776  *
28777  * Calls the given function for each of the key/value pairs in the #GTree.
28778  * The function is passed the key and value of each pair, and the given
28779  * @data parameter. The tree is traversed in sorted order.
28780  *
28781  * The tree may not be modified while iterating over it (you can't
28782  * add/remove items). To remove all items matching a predicate, you need
28783  * to add each item to a list in your #GTraverseFunc as you walk over
28784  * the tree, then walk the list and remove each item.
28785  */
28786
28787
28788 /**
28789  * g_tree_height:
28790  * @tree: a #GTree.
28791  *
28792  * Gets the height of a #GTree.
28793  *
28794  * If the #GTree contains no nodes, the height is 0.
28795  * If the #GTree contains only one root node the height is 1.
28796  * If the root node has children the height is 2, etc.
28797  *
28798  * Returns: the height of the #GTree.
28799  */
28800
28801
28802 /**
28803  * g_tree_insert:
28804  * @tree: a #GTree.
28805  * @key: the key to insert.
28806  * @value: the value corresponding to the key.
28807  *
28808  * Inserts a key/value pair into a #GTree. If the given key already exists
28809  * in the #GTree its corresponding value is set to the new value. If you
28810  * supplied a value_destroy_func when creating the #GTree, the old value is
28811  * freed using that function. If you supplied a @key_destroy_func when
28812  * creating the #GTree, the passed key is freed using that function.
28813  *
28814  * The tree is automatically 'balanced' as new key/value pairs are added,
28815  * so that the distance from the root to every leaf is as small as possible.
28816  */
28817
28818
28819 /**
28820  * g_tree_lookup:
28821  * @tree: a #GTree.
28822  * @key: the key to look up.
28823  *
28824  * Gets the value corresponding to the given key. Since a #GTree is
28825  * automatically balanced as key/value pairs are added, key lookup is very
28826  * fast.
28827  *
28828  * Returns: the value corresponding to the key, or %NULL if the key was not found.
28829  */
28830
28831
28832 /**
28833  * g_tree_lookup_extended:
28834  * @tree: a #GTree.
28835  * @lookup_key: the key to look up.
28836  * @orig_key: returns the original key.
28837  * @value: returns the value associated with the key.
28838  *
28839  * Looks up a key in the #GTree, returning the original key and the
28840  * associated value and a #gboolean which is %TRUE if the key was found. This
28841  * is useful if you need to free the memory allocated for the original key,
28842  * for example before calling g_tree_remove().
28843  *
28844  * Returns: %TRUE if the key was found in the #GTree.
28845  */
28846
28847
28848 /**
28849  * g_tree_new:
28850  * @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.
28851  *
28852  * Creates a new #GTree.
28853  *
28854  * Returns: a new #GTree.
28855  */
28856
28857
28858 /**
28859  * g_tree_new_full:
28860  * @key_compare_func: qsort()-style comparison function.
28861  * @key_compare_data: data to pass to comparison function.
28862  * @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.
28863  * @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.
28864  *
28865  * Creates a new #GTree like g_tree_new() and allows to specify functions
28866  * to free the memory allocated for the key and value that get called when
28867  * removing the entry from the #GTree.
28868  *
28869  * Returns: a new #GTree.
28870  */
28871
28872
28873 /**
28874  * g_tree_new_with_data:
28875  * @key_compare_func: qsort()-style comparison function.
28876  * @key_compare_data: data to pass to comparison function.
28877  *
28878  * Creates a new #GTree with a comparison function that accepts user data.
28879  * See g_tree_new() for more details.
28880  *
28881  * Returns: a new #GTree.
28882  */
28883
28884
28885 /**
28886  * g_tree_nnodes:
28887  * @tree: a #GTree.
28888  *
28889  * Gets the number of nodes in a #GTree.
28890  *
28891  * Returns: the number of nodes in the #GTree.
28892  */
28893
28894
28895 /**
28896  * g_tree_ref:
28897  * @tree: a #GTree.
28898  *
28899  * Increments the reference count of @tree by one.  It is safe to call
28900  * this function from any thread.
28901  *
28902  * Returns: the passed in #GTree.
28903  * Since: 2.22
28904  */
28905
28906
28907 /**
28908  * g_tree_remove:
28909  * @tree: a #GTree.
28910  * @key: the key to remove.
28911  *
28912  * Removes a key/value pair from a #GTree.
28913  *
28914  * If the #GTree was created using g_tree_new_full(), the key and value
28915  * are freed using the supplied destroy functions, otherwise you have to
28916  * make sure that any dynamically allocated values are freed yourself.
28917  * If the key does not exist in the #GTree, the function does nothing.
28918  *
28919  * Returns: %TRUE if the key was found (prior to 2.8, this function returned nothing)
28920  */
28921
28922
28923 /**
28924  * g_tree_replace:
28925  * @tree: a #GTree.
28926  * @key: the key to insert.
28927  * @value: the value corresponding to the key.
28928  *
28929  * Inserts a new key and value into a #GTree similar to g_tree_insert().
28930  * The difference is that if the key already exists in the #GTree, it gets
28931  * replaced by the new key. If you supplied a @value_destroy_func when
28932  * creating the #GTree, the old value is freed using that function. If you
28933  * supplied a @key_destroy_func when creating the #GTree, the old key is
28934  * freed using that function.
28935  *
28936  * The tree is automatically 'balanced' as new key/value pairs are added,
28937  * so that the distance from the root to every leaf is as small as possible.
28938  */
28939
28940
28941 /**
28942  * g_tree_search:
28943  * @tree: a #GTree
28944  * @search_func: a function used to search the #GTree
28945  * @user_data: the data passed as the second argument to @search_func
28946  *
28947  * Searches a #GTree using @search_func.
28948  *
28949  * The @search_func is called with a pointer to the key of a key/value
28950  * pair in the tree, and the passed in @user_data. If @search_func returns
28951  * 0 for a key/value pair, then the corresponding value is returned as
28952  * the result of g_tree_search(). If @search_func returns -1, searching
28953  * will proceed among the key/value pairs that have a smaller key; if
28954  * @search_func returns 1, searching will proceed among the key/value
28955  * pairs that have a larger key.
28956  *
28957  * Returns: the value corresponding to the found key, or %NULL if the key was not found.
28958  */
28959
28960
28961 /**
28962  * g_tree_steal:
28963  * @tree: a #GTree.
28964  * @key: the key to remove.
28965  *
28966  * Removes a key and its associated value from a #GTree without calling
28967  * the key and value destroy functions.
28968  *
28969  * If the key does not exist in the #GTree, the function does nothing.
28970  *
28971  * Returns: %TRUE if the key was found (prior to 2.8, this function returned nothing)
28972  */
28973
28974
28975 /**
28976  * g_tree_traverse:
28977  * @tree: a #GTree.
28978  * @traverse_func: the function to call for each node visited. If this function returns %TRUE, the traversal is stopped.
28979  * @traverse_type: the order in which nodes are visited, one of %G_IN_ORDER, %G_PRE_ORDER and %G_POST_ORDER.
28980  * @user_data: user data to pass to the function.
28981  *
28982  * Calls the given function for each node in the #GTree.
28983  *
28984  * 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>.
28985  */
28986
28987
28988 /**
28989  * g_tree_unref:
28990  * @tree: a #GTree.
28991  *
28992  * Decrements the reference count of @tree by one.  If the reference count
28993  * drops to 0, all keys and values will be destroyed (if destroy
28994  * functions were specified) and all memory allocated by @tree will be
28995  * released.
28996  *
28997  * It is safe to call this function from any thread.
28998  *
28999  * Since: 2.22
29000  */
29001
29002
29003 /**
29004  * g_try_malloc:
29005  * @n_bytes: number of bytes to allocate.
29006  *
29007  * Attempts to allocate @n_bytes, and returns %NULL on failure.
29008  * Contrast with g_malloc(), which aborts the program on failure.
29009  *
29010  * Returns: the allocated memory, or %NULL.
29011  */
29012
29013
29014 /**
29015  * g_try_malloc0:
29016  * @n_bytes: number of bytes to allocate
29017  *
29018  * Attempts to allocate @n_bytes, initialized to 0's, and returns %NULL on
29019  * failure. Contrast with g_malloc0(), which aborts the program on failure.
29020  *
29021  * Since: 2.8
29022  * Returns: the allocated memory, or %NULL
29023  */
29024
29025
29026 /**
29027  * g_try_malloc0_n:
29028  * @n_blocks: the number of blocks to allocate
29029  * @n_block_bytes: the size of each block in bytes
29030  *
29031  * This function is similar to g_try_malloc0(), allocating (@n_blocks * @n_block_bytes) bytes,
29032  * but care is taken to detect possible overflow during multiplication.
29033  *
29034  * Since: 2.24
29035  * Returns: the allocated memory, or %NULL
29036  */
29037
29038
29039 /**
29040  * g_try_malloc_n:
29041  * @n_blocks: the number of blocks to allocate
29042  * @n_block_bytes: the size of each block in bytes
29043  *
29044  * This function is similar to g_try_malloc(), allocating (@n_blocks * @n_block_bytes) bytes,
29045  * but care is taken to detect possible overflow during multiplication.
29046  *
29047  * Since: 2.24
29048  * Returns: the allocated memory, or %NULL.
29049  */
29050
29051
29052 /**
29053  * g_try_realloc:
29054  * @mem: (allow-none): previously-allocated memory, or %NULL.
29055  * @n_bytes: number of bytes to allocate.
29056  *
29057  * Attempts to realloc @mem to a new size, @n_bytes, and returns %NULL
29058  * on failure. Contrast with g_realloc(), which aborts the program
29059  * on failure. If @mem is %NULL, behaves the same as g_try_malloc().
29060  *
29061  * Returns: the allocated memory, or %NULL.
29062  */
29063
29064
29065 /**
29066  * g_try_realloc_n:
29067  * @mem: (allow-none): previously-allocated memory, or %NULL.
29068  * @n_blocks: the number of blocks to allocate
29069  * @n_block_bytes: the size of each block in bytes
29070  *
29071  * This function is similar to g_try_realloc(), allocating (@n_blocks * @n_block_bytes) bytes,
29072  * but care is taken to detect possible overflow during multiplication.
29073  *
29074  * Since: 2.24
29075  * Returns: the allocated memory, or %NULL.
29076  */
29077
29078
29079 /**
29080  * g_ucs4_to_utf16:
29081  * @str: a UCS-4 encoded string
29082  * @len: the maximum length (number of characters) of @str to use. If @len < 0, then the string is nul-terminated.
29083  * @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.
29084  * @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.
29085  * @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.
29086  *
29087  * Convert a string from UCS-4 to UTF-16. A 0 character will be
29088  * added to the result after the converted text.
29089  *
29090  * 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.
29091  */
29092
29093
29094 /**
29095  * g_ucs4_to_utf8:
29096  * @str: a UCS-4 encoded string
29097  * @len: the maximum length (number of characters) of @str to use. If @len < 0, then the string is nul-terminated.
29098  * @items_read: (allow-none): location to store number of characters read, or %NULL.
29099  * @items_written: (allow-none): location to store number of bytes written or %NULL. The value here stored does not include the trailing 0 byte.
29100  * @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.
29101  *
29102  * Convert a string from a 32-bit fixed width representation as UCS-4.
29103  * to UTF-8. The result will be terminated with a 0 byte.
29104  *
29105  * 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.
29106  */
29107
29108
29109 /**
29110  * g_unichar_break_type:
29111  * @c: a Unicode character
29112  *
29113  * Determines the break type of @c. @c should be a Unicode character
29114  * (to derive a character from UTF-8 encoded text, use
29115  * g_utf8_get_char()). The break type is used to find word and line
29116  * breaks ("text boundaries"), Pango implements the Unicode boundary
29117  * resolution algorithms and normally you would use a function such
29118  * as pango_break() instead of caring about break types yourself.
29119  *
29120  * Returns: the break type of @c
29121  */
29122
29123
29124 /**
29125  * g_unichar_combining_class:
29126  * @uc: a Unicode character
29127  *
29128  * Determines the canonical combining class of a Unicode character.
29129  *
29130  * Returns: the combining class of the character
29131  * Since: 2.14
29132  */
29133
29134
29135 /**
29136  * g_unichar_compose:
29137  * @a: a Unicode character
29138  * @b: a Unicode character
29139  * @ch: return location for the composed character
29140  *
29141  * Performs a single composition step of the
29142  * Unicode canonical composition algorithm.
29143  *
29144  * This function includes algorithmic Hangul Jamo composition,
29145  * but it is not exactly the inverse of g_unichar_decompose().
29146  * No composition can have either of @a or @b equal to zero.
29147  * To be precise, this function composes if and only if
29148  * there exists a Primary Composite P which is canonically
29149  * equivalent to the sequence <@a,@b>.  See the Unicode
29150  * Standard for the definition of Primary Composite.
29151  *
29152  * If @a and @b do not compose a new character, @ch is set to zero.
29153  *
29154  * See <ulink url="http://unicode.org/reports/tr15/">UAX#15</ulink>
29155  * for details.
29156  *
29157  * Returns: %TRUE if the characters could be composed
29158  * Since: 2.30
29159  */
29160
29161
29162 /**
29163  * g_unichar_decompose:
29164  * @ch: a Unicode character
29165  * @a: return location for the first component of @ch
29166  * @b: return location for the second component of @ch
29167  *
29168  * Performs a single decomposition step of the
29169  * Unicode canonical decomposition algorithm.
29170  *
29171  * This function does not include compatibility
29172  * decompositions. It does, however, include algorithmic
29173  * Hangul Jamo decomposition, as well as 'singleton'
29174  * decompositions which replace a character by a single
29175  * other character. In the case of singletons *@b will
29176  * be set to zero.
29177  *
29178  * If @ch is not decomposable, *@a is set to @ch and *@b
29179  * is set to zero.
29180  *
29181  * Note that the way Unicode decomposition pairs are
29182  * defined, it is guaranteed that @b would not decompose
29183  * further, but @a may itself decompose.  To get the full
29184  * canonical decomposition for @ch, one would need to
29185  * recursively call this function on @a.  Or use
29186  * g_unichar_fully_decompose().
29187  *
29188  * See <ulink url="http://unicode.org/reports/tr15/">UAX#15</ulink>
29189  * for details.
29190  *
29191  * Returns: %TRUE if the character could be decomposed
29192  * Since: 2.30
29193  */
29194
29195
29196 /**
29197  * g_unichar_digit_value:
29198  * @c: a Unicode character
29199  *
29200  * Determines the numeric value of a character as a decimal
29201  * digit.
29202  *
29203  * Returns: If @c is a decimal digit (according to g_unichar_isdigit()), its numeric value. Otherwise, -1.
29204  */
29205
29206
29207 /**
29208  * g_unichar_fully_decompose:
29209  * @ch: a Unicode character.
29210  * @compat: whether perform canonical or compatibility decomposition
29211  * @result: (allow-none): location to store decomposed result, or %NULL
29212  * @result_len: length of @result
29213  *
29214  * Computes the canonical or compatibility decomposition of a
29215  * Unicode character.  For compatibility decomposition,
29216  * pass %TRUE for @compat; for canonical decomposition
29217  * pass %FALSE for @compat.
29218  *
29219  * The decomposed sequence is placed in @result.  Only up to
29220  * @result_len characters are written into @result.  The length
29221  * of the full decomposition (irrespective of @result_len) is
29222  * returned by the function.  For canonical decomposition,
29223  * currently all decompositions are of length at most 4, but
29224  * this may change in the future (very unlikely though).
29225  * At any rate, Unicode does guarantee that a buffer of length
29226  * 18 is always enough for both compatibility and canonical
29227  * decompositions, so that is the size recommended. This is provided
29228  * as %G_UNICHAR_MAX_DECOMPOSITION_LENGTH.
29229  *
29230  * See <ulink url="http://unicode.org/reports/tr15/">UAX#15</ulink>
29231  * for details.
29232  *
29233  * Returns: the length of the full decomposition.
29234  * Since: 2.30
29235  */
29236
29237
29238 /**
29239  * g_unichar_get_mirror_char:
29240  * @ch: a Unicode character
29241  * @mirrored_ch: location to store the mirrored character
29242  *
29243  * In Unicode, some characters are <firstterm>mirrored</firstterm>. This
29244  * means that their images are mirrored horizontally in text that is laid
29245  * out from right to left. For instance, "(" would become its mirror image,
29246  * ")", in right-to-left text.
29247  *
29248  * If @ch has the Unicode mirrored property and there is another unicode
29249  * character that typically has a glyph that is the mirror image of @ch's
29250  * glyph and @mirrored_ch is set, it puts that character in the address
29251  * pointed to by @mirrored_ch.  Otherwise the original character is put.
29252  *
29253  * Returns: %TRUE if @ch has a mirrored character, %FALSE otherwise
29254  * Since: 2.4
29255  */
29256
29257
29258 /**
29259  * g_unichar_get_script:
29260  * @ch: a Unicode character
29261  *
29262  * Looks up the #GUnicodeScript for a particular character (as defined
29263  * by Unicode Standard Annex \#24). No check is made for @ch being a
29264  * valid Unicode character; if you pass in invalid character, the
29265  * result is undefined.
29266  *
29267  * This function is equivalent to pango_script_for_unichar() and the
29268  * two are interchangeable.
29269  *
29270  * Returns: the #GUnicodeScript for the character.
29271  * Since: 2.14
29272  */
29273
29274
29275 /**
29276  * g_unichar_isalnum:
29277  * @c: a Unicode character
29278  *
29279  * Determines whether a character is alphanumeric.
29280  * Given some UTF-8 text, obtain a character value
29281  * with g_utf8_get_char().
29282  *
29283  * Returns: %TRUE if @c is an alphanumeric character
29284  */
29285
29286
29287 /**
29288  * g_unichar_isalpha:
29289  * @c: a Unicode character
29290  *
29291  * Determines whether a character is alphabetic (i.e. a letter).
29292  * Given some UTF-8 text, obtain a character value with
29293  * g_utf8_get_char().
29294  *
29295  * Returns: %TRUE if @c is an alphabetic character
29296  */
29297
29298
29299 /**
29300  * g_unichar_iscntrl:
29301  * @c: a Unicode character
29302  *
29303  * Determines whether a character is a control character.
29304  * Given some UTF-8 text, obtain a character value with
29305  * g_utf8_get_char().
29306  *
29307  * Returns: %TRUE if @c is a control character
29308  */
29309
29310
29311 /**
29312  * g_unichar_isdefined:
29313  * @c: a Unicode character
29314  *
29315  * Determines if a given character is assigned in the Unicode
29316  * standard.
29317  *
29318  * Returns: %TRUE if the character has an assigned value
29319  */
29320
29321
29322 /**
29323  * g_unichar_isdigit:
29324  * @c: a Unicode character
29325  *
29326  * Determines whether a character is numeric (i.e. a digit).  This
29327  * covers ASCII 0-9 and also digits in other languages/scripts.  Given
29328  * some UTF-8 text, obtain a character value with g_utf8_get_char().
29329  *
29330  * Returns: %TRUE if @c is a digit
29331  */
29332
29333
29334 /**
29335  * g_unichar_isgraph:
29336  * @c: a Unicode character
29337  *
29338  * Determines whether a character is printable and not a space
29339  * (returns %FALSE for control characters, format characters, and
29340  * spaces). g_unichar_isprint() is similar, but returns %TRUE for
29341  * spaces. Given some UTF-8 text, obtain a character value with
29342  * g_utf8_get_char().
29343  *
29344  * Returns: %TRUE if @c is printable unless it's a space
29345  */
29346
29347
29348 /**
29349  * g_unichar_islower:
29350  * @c: a Unicode character
29351  *
29352  * Determines whether a character is a lowercase letter.
29353  * Given some UTF-8 text, obtain a character value with
29354  * g_utf8_get_char().
29355  *
29356  * Returns: %TRUE if @c is a lowercase letter
29357  */
29358
29359
29360 /**
29361  * g_unichar_ismark:
29362  * @c: a Unicode character
29363  *
29364  * Determines whether a character is a mark (non-spacing mark,
29365  * combining mark, or enclosing mark in Unicode speak).
29366  * Given some UTF-8 text, obtain a character value
29367  * with g_utf8_get_char().
29368  *
29369  * Note: in most cases where isalpha characters are allowed,
29370  * ismark characters should be allowed to as they are essential
29371  * for writing most European languages as well as many non-Latin
29372  * scripts.
29373  *
29374  * Returns: %TRUE if @c is a mark character
29375  * Since: 2.14
29376  */
29377
29378
29379 /**
29380  * g_unichar_isprint:
29381  * @c: a Unicode character
29382  *
29383  * Determines whether a character is printable.
29384  * Unlike g_unichar_isgraph(), returns %TRUE for spaces.
29385  * Given some UTF-8 text, obtain a character value with
29386  * g_utf8_get_char().
29387  *
29388  * Returns: %TRUE if @c is printable
29389  */
29390
29391
29392 /**
29393  * g_unichar_ispunct:
29394  * @c: a Unicode character
29395  *
29396  * Determines whether a character is punctuation or a symbol.
29397  * Given some UTF-8 text, obtain a character value with
29398  * g_utf8_get_char().
29399  *
29400  * Returns: %TRUE if @c is a punctuation or symbol character
29401  */
29402
29403
29404 /**
29405  * g_unichar_isspace:
29406  * @c: a Unicode character
29407  *
29408  * Determines whether a character is a space, tab, or line separator
29409  * (newline, carriage return, etc.).  Given some UTF-8 text, obtain a
29410  * character value with g_utf8_get_char().
29411  *
29412  * (Note: don't use this to do word breaking; you have to use
29413  * Pango or equivalent to get word breaking right, the algorithm
29414  * is fairly complex.)
29415  *
29416  * Returns: %TRUE if @c is a space character
29417  */
29418
29419
29420 /**
29421  * g_unichar_istitle:
29422  * @c: a Unicode character
29423  *
29424  * Determines if a character is titlecase. Some characters in
29425  * Unicode which are composites, such as the DZ digraph
29426  * have three case variants instead of just two. The titlecase
29427  * form is used at the beginning of a word where only the
29428  * first letter is capitalized. The titlecase form of the DZ
29429  * digraph is U+01F2 LATIN CAPITAL LETTTER D WITH SMALL LETTER Z.
29430  *
29431  * Returns: %TRUE if the character is titlecase
29432  */
29433
29434
29435 /**
29436  * g_unichar_isupper:
29437  * @c: a Unicode character
29438  *
29439  * Determines if a character is uppercase.
29440  *
29441  * Returns: %TRUE if @c is an uppercase character
29442  */
29443
29444
29445 /**
29446  * g_unichar_iswide:
29447  * @c: a Unicode character
29448  *
29449  * Determines if a character is typically rendered in a double-width
29450  * cell.
29451  *
29452  * Returns: %TRUE if the character is wide
29453  */
29454
29455
29456 /**
29457  * g_unichar_iswide_cjk:
29458  * @c: a Unicode character
29459  *
29460  * Determines if a character is typically rendered in a double-width
29461  * cell under legacy East Asian locales.  If a character is wide according to
29462  * g_unichar_iswide(), then it is also reported wide with this function, but
29463  * the converse is not necessarily true.  See the
29464  * <ulink url="http://www.unicode.org/reports/tr11/">Unicode Standard
29465  * Annex #11</ulink> for details.
29466  *
29467  * If a character passes the g_unichar_iswide() test then it will also pass
29468  * this test, but not the other way around.  Note that some characters may
29469  * pas both this test and g_unichar_iszerowidth().
29470  *
29471  * Returns: %TRUE if the character is wide in legacy East Asian locales
29472  * Since: 2.12
29473  */
29474
29475
29476 /**
29477  * g_unichar_isxdigit:
29478  * @c: a Unicode character.
29479  *
29480  * Determines if a character is a hexidecimal digit.
29481  *
29482  * Returns: %TRUE if the character is a hexadecimal digit
29483  */
29484
29485
29486 /**
29487  * g_unichar_iszerowidth:
29488  * @c: a Unicode character
29489  *
29490  * Determines if a given character typically takes zero width when rendered.
29491  * The return value is %TRUE for all non-spacing and enclosing marks
29492  * (e.g., combining accents), format characters, zero-width
29493  * space, but not U+00AD SOFT HYPHEN.
29494  *
29495  * A typical use of this function is with one of g_unichar_iswide() or
29496  * g_unichar_iswide_cjk() to determine the number of cells a string occupies
29497  * when displayed on a grid display (terminals).  However, note that not all
29498  * terminals support zero-width rendering of zero-width marks.
29499  *
29500  * Returns: %TRUE if the character has zero width
29501  * Since: 2.14
29502  */
29503
29504
29505 /**
29506  * g_unichar_to_utf8:
29507  * @c: a Unicode character code
29508  * @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.
29509  *
29510  * Converts a single character to UTF-8.
29511  *
29512  * Returns: number of bytes written
29513  */
29514
29515
29516 /**
29517  * g_unichar_tolower:
29518  * @c: a Unicode character.
29519  *
29520  * Converts a character to lower case.
29521  *
29522  * 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.
29523  */
29524
29525
29526 /**
29527  * g_unichar_totitle:
29528  * @c: a Unicode character
29529  *
29530  * Converts a character to the titlecase.
29531  *
29532  * Returns: the result of converting @c to titlecase. If @c is not an uppercase or lowercase character, @c is returned unchanged.
29533  */
29534
29535
29536 /**
29537  * g_unichar_toupper:
29538  * @c: a Unicode character
29539  *
29540  * Converts a character to uppercase.
29541  *
29542  * 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.
29543  */
29544
29545
29546 /**
29547  * g_unichar_type:
29548  * @c: a Unicode character
29549  *
29550  * Classifies a Unicode character by type.
29551  *
29552  * Returns: the type of the character.
29553  */
29554
29555
29556 /**
29557  * g_unichar_validate:
29558  * @ch: a Unicode character
29559  *
29560  * Checks whether @ch is a valid Unicode character. Some possible
29561  * integer values of @ch will not be valid. 0 is considered a valid
29562  * character, though it's normally a string terminator.
29563  *
29564  * Returns: %TRUE if @ch is a valid Unicode character
29565  */
29566
29567
29568 /**
29569  * g_unichar_xdigit_value:
29570  * @c: a Unicode character
29571  *
29572  * Determines the numeric value of a character as a hexidecimal
29573  * digit.
29574  *
29575  * Returns: If @c is a hex digit (according to g_unichar_isxdigit()), its numeric value. Otherwise, -1.
29576  */
29577
29578
29579 /**
29580  * g_unicode_canonical_decomposition:
29581  * @ch: a Unicode character.
29582  * @result_len: location to store the length of the return value.
29583  *
29584  * Computes the canonical decomposition of a Unicode character.
29585  *
29586  * Returns: a newly allocated string of Unicode characters. @result_len is set to the resulting length of the string.
29587  * Deprecated: 2.30: Use the more flexible g_unichar_fully_decompose() instead.
29588  */
29589
29590
29591 /**
29592  * g_unicode_canonical_ordering:
29593  * @string: a UCS-4 encoded string.
29594  * @len: the maximum length of @string to use.
29595  *
29596  * Computes the canonical ordering of a string in-place.
29597  * This rearranges decomposed characters in the string
29598  * according to their combining classes.  See the Unicode
29599  * manual for more information.
29600  */
29601
29602
29603 /**
29604  * g_unicode_script_from_iso15924:
29605  * @iso15924: a Unicode script
29606  *
29607  * Looks up the Unicode script for @iso15924.  ISO 15924 assigns four-letter
29608  * codes to scripts.  For example, the code for Arabic is 'Arab'.
29609  * This function accepts four letter codes encoded as a @guint32 in a
29610  * big-endian fashion.  That is, the code expected for Arabic is
29611  * 0x41726162 (0x41 is ASCII code for 'A', 0x72 is ASCII code for 'r', etc).
29612  *
29613  * See <ulink url="http://unicode.org/iso15924/codelists.html">Codes for the
29614  * representation of names of scripts</ulink> for details.
29615  *
29616  * 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.
29617  * Since: 2.30
29618  */
29619
29620
29621 /**
29622  * g_unicode_script_to_iso15924:
29623  * @script: a Unicode script
29624  *
29625  * Looks up the ISO 15924 code for @script.  ISO 15924 assigns four-letter
29626  * codes to scripts.  For example, the code for Arabic is 'Arab'.  The
29627  * four letter codes are encoded as a @guint32 by this function in a
29628  * big-endian fashion.  That is, the code returned for Arabic is
29629  * 0x41726162 (0x41 is ASCII code for 'A', 0x72 is ASCII code for 'r', etc).
29630  *
29631  * See <ulink url="http://unicode.org/iso15924/codelists.html">Codes for the
29632  * representation of names of scripts</ulink> for details.
29633  *
29634  * 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.
29635  * Since: 2.30
29636  */
29637
29638
29639 /**
29640  * g_unix_open_pipe:
29641  * @fds: Array of two integers
29642  * @flags: Bitfield of file descriptor flags, see "man 2 fcntl"
29643  * @error: a #GError
29644  *
29645  * Similar to the UNIX pipe() call, but on modern systems like Linux
29646  * uses the pipe2() system call, which atomically creates a pipe with
29647  * the configured flags.  The only supported flag currently is
29648  * <literal>FD_CLOEXEC</literal>.  If for example you want to configure
29649  * <literal>O_NONBLOCK</literal>, that must still be done separately with
29650  * fcntl().
29651  *
29652  * <note>This function does *not* take <literal>O_CLOEXEC</literal>, it takes
29653  * <literal>FD_CLOEXEC</literal> as if for fcntl(); these are
29654  * different on Linux/glibc.</note>
29655  *
29656  * Returns: %TRUE on success, %FALSE if not (and errno will be set).
29657  * Since: 2.30
29658  */
29659
29660
29661 /**
29662  * g_unix_set_fd_nonblocking:
29663  * @fd: A file descriptor
29664  * @nonblock: If %TRUE, set the descriptor to be non-blocking
29665  * @error: a #GError
29666  *
29667  * Control the non-blocking state of the given file descriptor,
29668  * according to @nonblock.  On most systems this uses <literal>O_NONBLOCK</literal>, but
29669  * on some older ones may use <literal>O_NDELAY</literal>.
29670  *
29671  * Returns: %TRUE if successful
29672  * Since: 2.30
29673  */
29674
29675
29676 /**
29677  * g_unix_signal_add:
29678  * @signum: Signal number
29679  * @handler: Callback
29680  * @user_data: Data for @handler
29681  *
29682  * A convenience function for g_unix_signal_source_new(), which
29683  * attaches to the default #GMainContext.  You can remove the watch
29684  * using g_source_remove().
29685  *
29686  * Returns: An ID (greater than 0) for the event source
29687  * Since: 2.30
29688  */
29689
29690
29691 /**
29692  * g_unix_signal_add_full:
29693  * @priority: the priority of the signal source. Typically this will be in the range between #G_PRIORITY_DEFAULT and #G_PRIORITY_HIGH.
29694  * @signum: Signal number
29695  * @handler: Callback
29696  * @user_data: Data for @handler
29697  * @notify: #GDestroyNotify for @handler
29698  *
29699  * A convenience function for g_unix_signal_source_new(), which
29700  * attaches to the default #GMainContext.  You can remove the watch
29701  * using g_source_remove().
29702  *
29703  * Returns: An ID (greater than 0) for the event source
29704  * Since: 2.30
29705  */
29706
29707
29708 /**
29709  * g_unix_signal_source_new:
29710  * @signum: A signal number
29711  *
29712  * Create a #GSource that will be dispatched upon delivery of the UNIX
29713  * signal @signum.  In GLib versions before 2.36, only
29714  * <literal>SIGHUP</literal>, <literal>SIGINT</literal>,
29715  * <literal>SIGTERM</literal> can be monitored.  In GLib 2.36,
29716  * <literal>SIGUSR1</literal> and <literal>SIGUSR2</literal> were
29717  * added.
29718  *
29719  * Note that unlike the UNIX default, all sources which have created a
29720  * watch will be dispatched, regardless of which underlying thread
29721  * invoked g_unix_signal_source_new().
29722  *
29723  * For example, an effective use of this function is to handle <literal>SIGTERM</literal>
29724  * cleanly; flushing any outstanding files, and then calling
29725  * g_main_loop_quit ().  It is not safe to do any of this a regular
29726  * UNIX signal handler; your handler may be invoked while malloc() or
29727  * another library function is running, causing reentrancy if you
29728  * attempt to use it from the handler.  None of the GLib/GObject API
29729  * is safe against this kind of reentrancy.
29730  *
29731  * The interaction of this source when combined with native UNIX
29732  * functions like sigprocmask() is not defined.
29733  *
29734  * The source will not initially be associated with any #GMainContext
29735  * and must be added to one with g_source_attach() before it will be
29736  * executed.
29737  *
29738  * Returns: A newly created #GSource
29739  * Since: 2.30
29740  */
29741
29742
29743 /**
29744  * g_unlink:
29745  * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows)
29746  *
29747  * A wrapper for the POSIX unlink() function. The unlink() function
29748  * deletes a name from the filesystem. If this was the last link to the
29749  * file and no processes have it opened, the diskspace occupied by the
29750  * file is freed.
29751  *
29752  * See your C library manual for more details about unlink(). Note
29753  * that on Windows, it is in general not possible to delete files that
29754  * are open to some process, or mapped into memory.
29755  *
29756  * Returns: 0 if the name was successfully deleted, -1 if an error occurred
29757  * Since: 2.6
29758  */
29759
29760
29761 /**
29762  * g_unsetenv:
29763  * @variable: the environment variable to remove, must not contain '='
29764  *
29765  * Removes an environment variable from the environment.
29766  *
29767  * Note that on some systems, when variables are overwritten, the
29768  * memory used for the previous variables and its value isn't reclaimed.
29769  *
29770  * <warning><para>
29771  * Environment variable handling in UNIX is not thread-safe, and your
29772  * program may crash if one thread calls g_unsetenv() while another
29773  * thread is calling getenv(). (And note that many functions, such as
29774  * gettext(), call getenv() internally.) This function is only safe
29775  * to use at the very start of your program, before creating any other
29776  * threads (or creating objects that create worker threads of their
29777  * own).
29778  * </para><para>
29779  * If you need to set up the environment for a child process, you can
29780  * use g_get_environ() to get an environment array, modify that with
29781  * g_environ_setenv() and g_environ_unsetenv(), and then pass that
29782  * array directly to execvpe(), g_spawn_async(), or the like.
29783  * </para></warning>
29784  *
29785  * Since: 2.4
29786  */
29787
29788
29789 /**
29790  * g_uri_escape_string:
29791  * @unescaped: the unescaped input string.
29792  * @reserved_chars_allowed: a string of reserved characters that are allowed to be used, or %NULL.
29793  * @allow_utf8: %TRUE if the result can include UTF-8 characters.
29794  *
29795  * Escapes a string for use in a URI.
29796  *
29797  * Normally all characters that are not "unreserved" (i.e. ASCII alphanumerical
29798  * characters plus dash, dot, underscore and tilde) are escaped.
29799  * But if you specify characters in @reserved_chars_allowed they are not
29800  * escaped. This is useful for the "reserved" characters in the URI
29801  * specification, since those are allowed unescaped in some portions of
29802  * a URI.
29803  *
29804  * Returns: an escaped version of @unescaped. The returned string should be freed when no longer needed.
29805  * Since: 2.16
29806  */
29807
29808
29809 /**
29810  * g_uri_list_extract_uris:
29811  * @uri_list: an URI list
29812  *
29813  * Splits an URI list conforming to the text/uri-list
29814  * mime type defined in RFC 2483 into individual URIs,
29815  * discarding any comments. The URIs are not validated.
29816  *
29817  * Returns: (transfer full): a newly allocated %NULL-terminated list of strings holding the individual URIs. The array should be freed with g_strfreev().
29818  * Since: 2.6
29819  */
29820
29821
29822 /**
29823  * g_uri_parse_scheme:
29824  * @uri: a valid URI.
29825  *
29826  * Gets the scheme portion of a URI string. RFC 3986 decodes the scheme as:
29827  * <programlisting>
29828  * URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
29829  * </programlisting>
29830  * Common schemes include "file", "http", "svn+ssh", etc.
29831  *
29832  * Returns: The "Scheme" component of the URI, or %NULL on error. The returned string should be freed when no longer needed.
29833  * Since: 2.16
29834  */
29835
29836
29837 /**
29838  * g_uri_unescape_segment:
29839  * @escaped_string: (allow-none): A string, may be %NULL
29840  * @escaped_string_end: (allow-none): Pointer to end of @escaped_string, may be %NULL
29841  * @illegal_characters: (allow-none): An optional string of illegal characters not to be allowed, may be %NULL
29842  *
29843  * Unescapes a segment of an escaped string.
29844  *
29845  * If any of the characters in @illegal_characters or the character zero appears
29846  * as an escaped character in @escaped_string then that is an error and %NULL
29847  * will be returned. This is useful it you want to avoid for instance having a
29848  * slash being expanded in an escaped path element, which might confuse pathname
29849  * handling.
29850  *
29851  * 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.
29852  * Since: 2.16
29853  */
29854
29855
29856 /**
29857  * g_uri_unescape_string:
29858  * @escaped_string: an escaped string to be unescaped.
29859  * @illegal_characters: an optional string of illegal characters not to be allowed.
29860  *
29861  * Unescapes a whole escaped string.
29862  *
29863  * If any of the characters in @illegal_characters or the character zero appears
29864  * as an escaped character in @escaped_string then that is an error and %NULL
29865  * will be returned. This is useful it you want to avoid for instance having a
29866  * slash being expanded in an escaped path element, which might confuse pathname
29867  * handling.
29868  *
29869  * Returns: an unescaped version of @escaped_string. The returned string should be freed when no longer needed.
29870  * Since: 2.16
29871  */
29872
29873
29874 /**
29875  * g_usleep:
29876  * @microseconds: number of microseconds to pause
29877  *
29878  * Pauses the current thread for the given number of microseconds.
29879  *
29880  * There are 1 million microseconds per second (represented by the
29881  * #G_USEC_PER_SEC macro). g_usleep() may have limited precision,
29882  * depending on hardware and operating system; don't rely on the exact
29883  * length of the sleep.
29884  */
29885
29886
29887 /**
29888  * g_utf16_to_ucs4:
29889  * @str: a UTF-16 encoded string
29890  * @len: the maximum length (number of <type>gunichar2</type>) of @str to use. If @len < 0, then the string is nul-terminated.
29891  * @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.
29892  * @items_written: (allow-none): location to store number of characters written, or %NULL. The value stored here does not include the trailing 0 character.
29893  * @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.
29894  *
29895  * Convert a string from UTF-16 to UCS-4. The result will be
29896  * nul-terminated.
29897  *
29898  * 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.
29899  */
29900
29901
29902 /**
29903  * g_utf16_to_utf8:
29904  * @str: a UTF-16 encoded string
29905  * @len: the maximum length (number of <type>gunichar2</type>) of @str to use. If @len < 0, then the string is nul-terminated.
29906  * @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.
29907  * @items_written: (allow-none): location to store number of bytes written, or %NULL. The value stored here does not include the trailing 0 byte.
29908  * @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.
29909  *
29910  * Convert a string from UTF-16 to UTF-8. The result will be
29911  * terminated with a 0 byte.
29912  *
29913  * Note that the input is expected to be already in native endianness,
29914  * an initial byte-order-mark character is not handled specially.
29915  * g_convert() can be used to convert a byte buffer of UTF-16 data of
29916  * ambiguous endianess.
29917  *
29918  * Further note that this function does not validate the result
29919  * string; it may e.g. include embedded NUL characters. The only
29920  * validation done by this function is to ensure that the input can
29921  * be correctly interpreted as UTF-16, i.e. it doesn't contain
29922  * things unpaired surrogates.
29923  *
29924  * 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.
29925  */
29926
29927
29928 /**
29929  * g_utf8_casefold:
29930  * @str: a UTF-8 encoded string
29931  * @len: length of @str, in bytes, or -1 if @str is nul-terminated.
29932  *
29933  * Converts a string into a form that is independent of case. The
29934  * result will not correspond to any particular case, but can be
29935  * compared for equality or ordered with the results of calling
29936  * g_utf8_casefold() on other strings.
29937  *
29938  * Note that calling g_utf8_casefold() followed by g_utf8_collate() is
29939  * only an approximation to the correct linguistic case insensitive
29940  * ordering, though it is a fairly good one. Getting this exactly
29941  * right would require a more sophisticated collation function that
29942  * takes case sensitivity into account. GLib does not currently
29943  * provide such a function.
29944  *
29945  * Returns: a newly allocated string, that is a case independent form of @str.
29946  */
29947
29948
29949 /**
29950  * g_utf8_collate:
29951  * @str1: a UTF-8 encoded string
29952  * @str2: a UTF-8 encoded string
29953  *
29954  * Compares two strings for ordering using the linguistically
29955  * correct rules for the <link linkend="setlocale">current locale</link>.
29956  * When sorting a large number of strings, it will be significantly
29957  * faster to obtain collation keys with g_utf8_collate_key() and
29958  * compare the keys with strcmp() when sorting instead of sorting
29959  * the original strings.
29960  *
29961  * Returns: &lt; 0 if @str1 compares before @str2, 0 if they compare equal, &gt; 0 if @str1 compares after @str2.
29962  */
29963
29964
29965 /**
29966  * g_utf8_collate_key:
29967  * @str: a UTF-8 encoded string.
29968  * @len: length of @str, in bytes, or -1 if @str is nul-terminated.
29969  *
29970  * Converts a string into a collation key that can be compared
29971  * with other collation keys produced by the same function using
29972  * strcmp().
29973  *
29974  * The results of comparing the collation keys of two strings
29975  * with strcmp() will always be the same as comparing the two
29976  * original keys with g_utf8_collate().
29977  *
29978  * Note that this function depends on the
29979  * <link linkend="setlocale">current locale</link>.
29980  *
29981  * Returns: a newly allocated string. This string should be freed with g_free() when you are done with it.
29982  */
29983
29984
29985 /**
29986  * g_utf8_collate_key_for_filename:
29987  * @str: a UTF-8 encoded string.
29988  * @len: length of @str, in bytes, or -1 if @str is nul-terminated.
29989  *
29990  * Converts a string into a collation key that can be compared
29991  * with other collation keys produced by the same function using strcmp().
29992  *
29993  * In order to sort filenames correctly, this function treats the dot '.'
29994  * as a special case. Most dictionary orderings seem to consider it
29995  * insignificant, thus producing the ordering "event.c" "eventgenerator.c"
29996  * "event.h" instead of "event.c" "event.h" "eventgenerator.c". Also, we
29997  * would like to treat numbers intelligently so that "file1" "file10" "file5"
29998  * is sorted as "file1" "file5" "file10".
29999  *
30000  * Note that this function depends on the
30001  * <link linkend="setlocale">current locale</link>.
30002  *
30003  * Returns: a newly allocated string. This string should be freed with g_free() when you are done with it.
30004  * Since: 2.8
30005  */
30006
30007
30008 /**
30009  * g_utf8_find_next_char:
30010  * @p: a pointer to a position within a UTF-8 encoded string
30011  * @end: a pointer to the byte following the end of the string, or %NULL to indicate that the string is nul-terminated.
30012  *
30013  * Finds the start of the next UTF-8 character in the string after @p.
30014  *
30015  * @p does not have to be at the beginning of a UTF-8 character. No check
30016  * is made to see if the character found is actually valid other than
30017  * it starts with an appropriate byte.
30018  *
30019  * Returns: a pointer to the found character or %NULL
30020  */
30021
30022
30023 /**
30024  * g_utf8_find_prev_char:
30025  * @str: pointer to the beginning of a UTF-8 encoded string
30026  * @p: pointer to some position within @str
30027  *
30028  * Given a position @p with a UTF-8 encoded string @str, find the start
30029  * of the previous UTF-8 character starting before @p. Returns %NULL if no
30030  * UTF-8 characters are present in @str before @p.
30031  *
30032  * @p does not have to be at the beginning of a UTF-8 character. No check
30033  * is made to see if the character found is actually valid other than
30034  * it starts with an appropriate byte.
30035  *
30036  * Returns: a pointer to the found character or %NULL.
30037  */
30038
30039
30040 /**
30041  * g_utf8_get_char:
30042  * @p: a pointer to Unicode character encoded as UTF-8
30043  *
30044  * Converts a sequence of bytes encoded as UTF-8 to a Unicode character.
30045  * If @p does not point to a valid UTF-8 encoded character, results are
30046  * undefined. If you are not sure that the bytes are complete
30047  * valid Unicode characters, you should use g_utf8_get_char_validated()
30048  * instead.
30049  *
30050  * Returns: the resulting character
30051  */
30052
30053
30054 /**
30055  * g_utf8_get_char_validated:
30056  * @p: a pointer to Unicode character encoded as UTF-8
30057  * @max_len: the maximum number of bytes to read, or -1, for no maximum or if @p is nul-terminated
30058  *
30059  * Convert a sequence of bytes encoded as UTF-8 to a Unicode character.
30060  * This function checks for incomplete characters, for invalid characters
30061  * such as characters that are out of the range of Unicode, and for
30062  * overlong encodings of valid characters.
30063  *
30064  * 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.
30065  */
30066
30067
30068 /**
30069  * g_utf8_normalize:
30070  * @str: a UTF-8 encoded string.
30071  * @len: length of @str, in bytes, or -1 if @str is nul-terminated.
30072  * @mode: the type of normalization to perform.
30073  *
30074  * Converts a string into canonical form, standardizing
30075  * such issues as whether a character with an accent
30076  * is represented as a base character and combining
30077  * accent or as a single precomposed character. The
30078  * string has to be valid UTF-8, otherwise %NULL is
30079  * returned. You should generally call g_utf8_normalize()
30080  * before comparing two Unicode strings.
30081  *
30082  * The normalization mode %G_NORMALIZE_DEFAULT only
30083  * standardizes differences that do not affect the
30084  * text content, such as the above-mentioned accent
30085  * representation. %G_NORMALIZE_ALL also standardizes
30086  * the "compatibility" characters in Unicode, such
30087  * as SUPERSCRIPT THREE to the standard forms
30088  * (in this case DIGIT THREE). Formatting information
30089  * may be lost but for most text operations such
30090  * characters should be considered the same.
30091  *
30092  * %G_NORMALIZE_DEFAULT_COMPOSE and %G_NORMALIZE_ALL_COMPOSE
30093  * are like %G_NORMALIZE_DEFAULT and %G_NORMALIZE_ALL,
30094  * but returned a result with composed forms rather
30095  * than a maximally decomposed form. This is often
30096  * useful if you intend to convert the string to
30097  * a legacy encoding or pass it to a system with
30098  * less capable Unicode handling.
30099  *
30100  * Returns: a newly allocated string, that is the normalized form of @str, or %NULL if @str is not valid UTF-8.
30101  */
30102
30103
30104 /**
30105  * g_utf8_offset_to_pointer:
30106  * @str: a UTF-8 encoded string
30107  * @offset: a character offset within @str
30108  *
30109  * Converts from an integer character offset to a pointer to a position
30110  * within the string.
30111  *
30112  * Since 2.10, this function allows to pass a negative @offset to
30113  * step backwards. It is usually worth stepping backwards from the end
30114  * instead of forwards if @offset is in the last fourth of the string,
30115  * since moving forward is about 3 times faster than moving backward.
30116  *
30117  * <note><para>
30118  * This function doesn't abort when reaching the end of @str. Therefore
30119  * you should be sure that @offset is within string boundaries before
30120  * calling that function. Call g_utf8_strlen() when unsure.
30121  *
30122  * This limitation exists as this function is called frequently during
30123  * text rendering and therefore has to be as fast as possible.
30124  * </para></note>
30125  *
30126  * Returns: the resulting pointer
30127  */
30128
30129
30130 /**
30131  * g_utf8_pointer_to_offset:
30132  * @str: a UTF-8 encoded string
30133  * @pos: a pointer to a position within @str
30134  *
30135  * Converts from a pointer to position within a string to a integer
30136  * character offset.
30137  *
30138  * Since 2.10, this function allows @pos to be before @str, and returns
30139  * a negative offset in this case.
30140  *
30141  * Returns: the resulting character offset
30142  */
30143
30144
30145 /**
30146  * g_utf8_prev_char:
30147  * @p: a pointer to a position within a UTF-8 encoded string
30148  *
30149  * Finds the previous UTF-8 character in the string before @p.
30150  *
30151  * @p does not have to be at the beginning of a UTF-8 character. No check
30152  * is made to see if the character found is actually valid other than
30153  * it starts with an appropriate byte. If @p might be the first
30154  * character of the string, you must use g_utf8_find_prev_char() instead.
30155  *
30156  * Returns: a pointer to the found character.
30157  */
30158
30159
30160 /**
30161  * g_utf8_strchr:
30162  * @p: a nul-terminated UTF-8 encoded string
30163  * @len: the maximum length of @p
30164  * @c: a Unicode character
30165  *
30166  * Finds the leftmost occurrence of the given Unicode character
30167  * in a UTF-8 encoded string, while limiting the search to @len bytes.
30168  * If @len is -1, allow unbounded search.
30169  *
30170  * 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.
30171  */
30172
30173
30174 /**
30175  * g_utf8_strdown:
30176  * @str: a UTF-8 encoded string
30177  * @len: length of @str, in bytes, or -1 if @str is nul-terminated.
30178  *
30179  * Converts all Unicode characters in the string that have a case
30180  * to lowercase. The exact manner that this is done depends
30181  * on the current locale, and may result in the number of
30182  * characters in the string changing.
30183  *
30184  * Returns: a newly allocated string, with all characters converted to lowercase.
30185  */
30186
30187
30188 /**
30189  * g_utf8_strlen:
30190  * @p: pointer to the start of a UTF-8 encoded string
30191  * @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
30192  *
30193  * Computes the length of the string in characters, not including
30194  * the terminating nul character. If the @max'th byte falls in the
30195  * middle of a character, the last (partial) character is not counted.
30196  *
30197  * Returns: the length of the string in characters
30198  */
30199
30200
30201 /**
30202  * g_utf8_strncpy:
30203  * @dest: buffer to fill with characters from @src
30204  * @src: UTF-8 encoded string
30205  * @n: character count
30206  *
30207  * Like the standard C strncpy() function, but
30208  * copies a given number of characters instead of a given number of
30209  * bytes. The @src string must be valid UTF-8 encoded text.
30210  * (Use g_utf8_validate() on all text before trying to use UTF-8
30211  * utility functions with it.)
30212  *
30213  * Returns: @dest
30214  */
30215
30216
30217 /**
30218  * g_utf8_strrchr:
30219  * @p: a nul-terminated UTF-8 encoded string
30220  * @len: the maximum length of @p
30221  * @c: a Unicode character
30222  *
30223  * Find the rightmost occurrence of the given Unicode character
30224  * in a UTF-8 encoded string, while limiting the search to @len bytes.
30225  * If @len is -1, allow unbounded search.
30226  *
30227  * 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.
30228  */
30229
30230
30231 /**
30232  * g_utf8_strreverse:
30233  * @str: a UTF-8 encoded string
30234  * @len: the maximum length of @str to use, in bytes. If @len < 0, then the string is nul-terminated.
30235  *
30236  * Reverses a UTF-8 string. @str must be valid UTF-8 encoded text.
30237  * (Use g_utf8_validate() on all text before trying to use UTF-8
30238  * utility functions with it.)
30239  *
30240  * This function is intended for programmatic uses of reversed strings.
30241  * It pays no attention to decomposed characters, combining marks, byte
30242  * order marks, directional indicators (LRM, LRO, etc) and similar
30243  * characters which might need special handling when reversing a string
30244  * for display purposes.
30245  *
30246  * Note that unlike g_strreverse(), this function returns
30247  * newly-allocated memory, which should be freed with g_free() when
30248  * no longer needed.
30249  *
30250  * Returns: a newly-allocated string which is the reverse of @str.
30251  * Since: 2.2
30252  */
30253
30254
30255 /**
30256  * g_utf8_strup:
30257  * @str: a UTF-8 encoded string
30258  * @len: length of @str, in bytes, or -1 if @str is nul-terminated.
30259  *
30260  * Converts all Unicode characters in the string that have a case
30261  * to uppercase. The exact manner that this is done depends
30262  * on the current locale, and may result in the number of
30263  * characters in the string increasing. (For instance, the
30264  * German ess-zet will be changed to SS.)
30265  *
30266  * Returns: a newly allocated string, with all characters converted to uppercase.
30267  */
30268
30269
30270 /**
30271  * g_utf8_substring:
30272  * @str: a UTF-8 encoded string
30273  * @start_pos: a character offset within @str
30274  * @end_pos: another character offset within @str
30275  *
30276  * Copies a substring out of a UTF-8 encoded string.
30277  * The substring will contain @end_pos - @start_pos
30278  * characters.
30279  *
30280  * Returns: a newly allocated copy of the requested substring. Free with g_free() when no longer needed.
30281  * Since: 2.30
30282  */
30283
30284
30285 /**
30286  * g_utf8_to_ucs4:
30287  * @str: a UTF-8 encoded string
30288  * @len: the maximum length of @str to use, in bytes. If @len < 0, then the string is nul-terminated.
30289  * @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.
30290  * @items_written: (allow-none): location to store number of characters written or %NULL. The value here stored does not include the trailing 0 character.
30291  * @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.
30292  *
30293  * Convert a string from UTF-8 to a 32-bit fixed width
30294  * representation as UCS-4. A trailing 0 character will be added to the
30295  * string after the converted text.
30296  *
30297  * 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.
30298  */
30299
30300
30301 /**
30302  * g_utf8_to_ucs4_fast:
30303  * @str: a UTF-8 encoded string
30304  * @len: the maximum length of @str to use, in bytes. If @len < 0, then the string is nul-terminated.
30305  * @items_written: (allow-none): location to store the number of characters in the result, or %NULL.
30306  *
30307  * Convert a string from UTF-8 to a 32-bit fixed width
30308  * representation as UCS-4, assuming valid UTF-8 input.
30309  * This function is roughly twice as fast as g_utf8_to_ucs4()
30310  * but does no error checking on the input. A trailing 0 character
30311  * will be added to the string after the converted text.
30312  *
30313  * Returns: a pointer to a newly allocated UCS-4 string. This value must be freed with g_free().
30314  */
30315
30316
30317 /**
30318  * g_utf8_to_utf16:
30319  * @str: a UTF-8 encoded string
30320  * @len: the maximum length (number of bytes) of @str to use. If @len < 0, then the string is nul-terminated.
30321  * @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.
30322  * @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.
30323  * @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.
30324  *
30325  * Convert a string from UTF-8 to UTF-16. A 0 character will be
30326  * added to the result after the converted text.
30327  *
30328  * 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.
30329  */
30330
30331
30332 /**
30333  * g_utf8_validate:
30334  * @str: (array length=max_len) (element-type guint8): a pointer to character data
30335  * @max_len: max bytes to validate, or -1 to go until NUL
30336  * @end: (allow-none) (out) (transfer none): return location for end of valid data
30337  *
30338  * Validates UTF-8 encoded text. @str is the text to validate;
30339  * if @str is nul-terminated, then @max_len can be -1, otherwise
30340  * @max_len should be the number of bytes to validate.
30341  * If @end is non-%NULL, then the end of the valid range
30342  * will be stored there (i.e. the start of the first invalid
30343  * character if some bytes were invalid, or the end of the text
30344  * being validated otherwise).
30345  *
30346  * Note that g_utf8_validate() returns %FALSE if @max_len is
30347  * positive and any of the @max_len bytes are NUL.
30348  *
30349  * Returns %TRUE if all of @str was valid. Many GLib and GTK+
30350  * routines <emphasis>require</emphasis> valid UTF-8 as input;
30351  * so data read from a file or the network should be checked
30352  * with g_utf8_validate() before doing anything else with it.
30353  *
30354  * Returns: %TRUE if the text was valid UTF-8
30355  */
30356
30357
30358 /**
30359  * g_utime:
30360  * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows)
30361  * @utb: a pointer to a struct utimbuf.
30362  *
30363  * A wrapper for the POSIX utime() function. The utime() function
30364  * sets the access and modification timestamps of a file.
30365  *
30366  * See your C library manual for more details about how utime() works
30367  * on your system.
30368  *
30369  * Returns: 0 if the operation was successful, -1 if an error occurred
30370  * Since: 2.18
30371  */
30372
30373
30374 /**
30375  * g_variant_builder_add: (skp)
30376  * @builder: a #GVariantBuilder
30377  * @format_string: a #GVariant varargs format string
30378  * @...: arguments, as per @format_string
30379  *
30380  * Adds to a #GVariantBuilder.
30381  *
30382  * This call is a convenience wrapper that is exactly equivalent to
30383  * calling g_variant_new() followed by g_variant_builder_add_value().
30384  *
30385  * This function might be used as follows:
30386  *
30387  * <programlisting>
30388  * GVariant *
30389  * make_pointless_dictionary (void)
30390  * {
30391  *   GVariantBuilder *builder;
30392  *   int i;
30393  *
30394  *   builder = g_variant_builder_new (G_VARIANT_TYPE_ARRAY);
30395  *   for (i = 0; i < 16; i++)
30396  *     {
30397  *       gchar buf[3];
30398  *
30399  *       sprintf (buf, "%d", i);
30400  *       g_variant_builder_add (builder, "{is}", i, buf);
30401  *     }
30402  *
30403  *   return g_variant_builder_end (builder);
30404  * }
30405  * </programlisting>
30406  *
30407  * Since: 2.24
30408  */
30409
30410
30411 /**
30412  * g_variant_builder_add_parsed:
30413  * @builder: a #GVariantBuilder
30414  * @format: a text format #GVariant
30415  * @...: arguments as per @format
30416  *
30417  * Adds to a #GVariantBuilder.
30418  *
30419  * This call is a convenience wrapper that is exactly equivalent to
30420  * calling g_variant_new_parsed() followed by
30421  * g_variant_builder_add_value().
30422  *
30423  * This function might be used as follows:
30424  *
30425  * <programlisting>
30426  * GVariant *
30427  * make_pointless_dictionary (void)
30428  * {
30429  *   GVariantBuilder *builder;
30430  *   int i;
30431  *
30432  *   builder = g_variant_builder_new (G_VARIANT_TYPE_ARRAY);
30433  *   g_variant_builder_add_parsed (builder, "{'width', <%i>}", 600);
30434  *   g_variant_builder_add_parsed (builder, "{'title', <%s>}", "foo");
30435  *   g_variant_builder_add_parsed (builder, "{'transparency', <0.5>}");
30436  *   return g_variant_builder_end (builder);
30437  * }
30438  * </programlisting>
30439  *
30440  * Since: 2.26
30441  */
30442
30443
30444 /**
30445  * g_variant_builder_add_value:
30446  * @builder: a #GVariantBuilder
30447  * @value: a #GVariant
30448  *
30449  * Adds @value to @builder.
30450  *
30451  * It is an error to call this function in any way that would create an
30452  * inconsistent value to be constructed.  Some examples of this are
30453  * putting different types of items into an array, putting the wrong
30454  * types or number of items in a tuple, putting more than one value into
30455  * a variant, etc.
30456  *
30457  * If @value is a floating reference (see g_variant_ref_sink()),
30458  * the @builder instance takes ownership of @value.
30459  *
30460  * Since: 2.24
30461  */
30462
30463
30464 /**
30465  * g_variant_builder_clear: (skip)
30466  * @builder: a #GVariantBuilder
30467  *
30468  * Releases all memory associated with a #GVariantBuilder without
30469  * freeing the #GVariantBuilder structure itself.
30470  *
30471  * It typically only makes sense to do this on a stack-allocated
30472  * #GVariantBuilder if you want to abort building the value part-way
30473  * through.  This function need not be called if you call
30474  * g_variant_builder_end() and it also doesn't need to be called on
30475  * builders allocated with g_variant_builder_new (see
30476  * g_variant_builder_unref() for that).
30477  *
30478  * This function leaves the #GVariantBuilder structure set to all-zeros.
30479  * It is valid to call this function on either an initialised
30480  * #GVariantBuilder or one that is set to all-zeros but it is not valid
30481  * to call this function on uninitialised memory.
30482  *
30483  * Since: 2.24
30484  */
30485
30486
30487 /**
30488  * g_variant_builder_close:
30489  * @builder: a #GVariantBuilder
30490  *
30491  * Closes the subcontainer inside the given @builder that was opened by
30492  * the most recent call to g_variant_builder_open().
30493  *
30494  * It is an error to call this function in any way that would create an
30495  * inconsistent value to be constructed (ie: too few values added to the
30496  * subcontainer).
30497  *
30498  * Since: 2.24
30499  */
30500
30501
30502 /**
30503  * g_variant_builder_end:
30504  * @builder: a #GVariantBuilder
30505  *
30506  * Ends the builder process and returns the constructed value.
30507  *
30508  * It is not permissible to use @builder in any way after this call
30509  * except for reference counting operations (in the case of a
30510  * heap-allocated #GVariantBuilder) or by reinitialising it with
30511  * g_variant_builder_init() (in the case of stack-allocated).
30512  *
30513  * It is an error to call this function in any way that would create an
30514  * inconsistent value to be constructed (ie: insufficient number of
30515  * items added to a container with a specific number of children
30516  * required).  It is also an error to call this function if the builder
30517  * was created with an indefinite array or maybe type and no children
30518  * have been added; in this case it is impossible to infer the type of
30519  * the empty array.
30520  *
30521  * Returns: (transfer none): a new, floating, #GVariant
30522  * Since: 2.24
30523  */
30524
30525
30526 /**
30527  * g_variant_builder_init: (skip)
30528  * @builder: a #GVariantBuilder
30529  * @type: a container type
30530  *
30531  * Initialises a #GVariantBuilder structure.
30532  *
30533  * @type must be non-%NULL.  It specifies the type of container to
30534  * construct.  It can be an indefinite type such as
30535  * %G_VARIANT_TYPE_ARRAY or a definite type such as "as" or "(ii)".
30536  * Maybe, array, tuple, dictionary entry and variant-typed values may be
30537  * constructed.
30538  *
30539  * After the builder is initialised, values are added using
30540  * g_variant_builder_add_value() or g_variant_builder_add().
30541  *
30542  * After all the child values are added, g_variant_builder_end() frees
30543  * the memory associated with the builder and returns the #GVariant that
30544  * was created.
30545  *
30546  * This function completely ignores the previous contents of @builder.
30547  * On one hand this means that it is valid to pass in completely
30548  * uninitialised memory.  On the other hand, this means that if you are
30549  * initialising over top of an existing #GVariantBuilder you need to
30550  * first call g_variant_builder_clear() in order to avoid leaking
30551  * memory.
30552  *
30553  * You must not call g_variant_builder_ref() or
30554  * g_variant_builder_unref() on a #GVariantBuilder that was initialised
30555  * with this function.  If you ever pass a reference to a
30556  * #GVariantBuilder outside of the control of your own code then you
30557  * should assume that the person receiving that reference may try to use
30558  * reference counting; you should use g_variant_builder_new() instead of
30559  * this function.
30560  *
30561  * Since: 2.24
30562  */
30563
30564
30565 /**
30566  * g_variant_builder_new:
30567  * @type: a container type
30568  *
30569  * Allocates and initialises a new #GVariantBuilder.
30570  *
30571  * You should call g_variant_builder_unref() on the return value when it
30572  * is no longer needed.  The memory will not be automatically freed by
30573  * any other call.
30574  *
30575  * In most cases it is easier to place a #GVariantBuilder directly on
30576  * the stack of the calling function and initialise it with
30577  * g_variant_builder_init().
30578  *
30579  * Returns: (transfer full): a #GVariantBuilder
30580  * Since: 2.24
30581  */
30582
30583
30584 /**
30585  * g_variant_builder_open:
30586  * @builder: a #GVariantBuilder
30587  * @type: a #GVariantType
30588  *
30589  * Opens a subcontainer inside the given @builder.  When done adding
30590  * items to the subcontainer, g_variant_builder_close() must be called.
30591  *
30592  * It is an error to call this function in any way that would cause an
30593  * inconsistent value to be constructed (ie: adding too many values or
30594  * a value of an incorrect type).
30595  *
30596  * Since: 2.24
30597  */
30598
30599
30600 /**
30601  * g_variant_builder_ref:
30602  * @builder: a #GVariantBuilder allocated by g_variant_builder_new()
30603  *
30604  * Increases the reference count on @builder.
30605  *
30606  * Don't call this on stack-allocated #GVariantBuilder instances or bad
30607  * things will happen.
30608  *
30609  * Returns: (transfer full): a new reference to @builder
30610  * Since: 2.24
30611  */
30612
30613
30614 /**
30615  * g_variant_builder_unref:
30616  * @builder: (transfer full): a #GVariantBuilder allocated by g_variant_builder_new()
30617  *
30618  * Decreases the reference count on @builder.
30619  *
30620  * In the event that there are no more references, releases all memory
30621  * associated with the #GVariantBuilder.
30622  *
30623  * Don't call this on stack-allocated #GVariantBuilder instances or bad
30624  * things will happen.
30625  *
30626  * Since: 2.24
30627  */
30628
30629
30630 /**
30631  * g_variant_byteswap:
30632  * @value: a #GVariant
30633  *
30634  * Performs a byteswapping operation on the contents of @value.  The
30635  * result is that all multi-byte numeric data contained in @value is
30636  * byteswapped.  That includes 16, 32, and 64bit signed and unsigned
30637  * integers as well as file handles and double precision floating point
30638  * values.
30639  *
30640  * This function is an identity mapping on any value that does not
30641  * contain multi-byte numeric data.  That include strings, booleans,
30642  * bytes and containers containing only these things (recursively).
30643  *
30644  * The returned value is always in normal form and is marked as trusted.
30645  *
30646  * Returns: (transfer full): the byteswapped form of @value
30647  * Since: 2.24
30648  */
30649
30650
30651 /**
30652  * g_variant_check_format_string:
30653  * @value: a #GVariant
30654  * @format_string: a valid #GVariant format string
30655  * @copy_only: %TRUE to ensure the format string makes deep copies
30656  *
30657  * Checks if calling g_variant_get() with @format_string on @value would
30658  * be valid from a type-compatibility standpoint.  @format_string is
30659  * assumed to be a valid format string (from a syntactic standpoint).
30660  *
30661  * If @copy_only is %TRUE then this function additionally checks that it
30662  * would be safe to call g_variant_unref() on @value immediately after
30663  * the call to g_variant_get() without invalidating the result.  This is
30664  * only possible if deep copies are made (ie: there are no pointers to
30665  * the data inside of the soon-to-be-freed #GVariant instance).  If this
30666  * check fails then a g_critical() is printed and %FALSE is returned.
30667  *
30668  * This function is meant to be used by functions that wish to provide
30669  * varargs accessors to #GVariant values of uncertain values (eg:
30670  * g_variant_lookup() or g_menu_model_get_item_attribute()).
30671  *
30672  * Returns: %TRUE if @format_string is safe to use
30673  * Since: 2.34
30674  */
30675
30676
30677 /**
30678  * g_variant_classify:
30679  * @value: a #GVariant
30680  *
30681  * Classifies @value according to its top-level type.
30682  *
30683  * Returns: the #GVariantClass of @value
30684  * Since: 2.24
30685  */
30686
30687
30688 /**
30689  * g_variant_compare:
30690  * @one: (type GVariant): a basic-typed #GVariant instance
30691  * @two: (type GVariant): a #GVariant instance of the same type
30692  *
30693  * Compares @one and @two.
30694  *
30695  * The types of @one and @two are #gconstpointer only to allow use of
30696  * this function with #GTree, #GPtrArray, etc.  They must each be a
30697  * #GVariant.
30698  *
30699  * Comparison is only defined for basic types (ie: booleans, numbers,
30700  * strings).  For booleans, %FALSE is less than %TRUE.  Numbers are
30701  * ordered in the usual way.  Strings are in ASCII lexographical order.
30702  *
30703  * It is a programmer error to attempt to compare container values or
30704  * two values that have types that are not exactly equal.  For example,
30705  * you cannot compare a 32-bit signed integer with a 32-bit unsigned
30706  * integer.  Also note that this function is not particularly
30707  * well-behaved when it comes to comparison of doubles; in particular,
30708  * the handling of incomparable values (ie: NaN) is undefined.
30709  *
30710  * If you only require an equality comparison, g_variant_equal() is more
30711  * general.
30712  *
30713  * Returns: negative value if a &lt; b; zero if a = b; positive value if a &gt; b.
30714  * Since: 2.26
30715  */
30716
30717
30718 /**
30719  * g_variant_dup_bytestring:
30720  * @value: an array-of-bytes #GVariant instance
30721  * @length: (out) (allow-none) (default NULL): a pointer to a #gsize, to store the length (not including the nul terminator)
30722  *
30723  * Similar to g_variant_get_bytestring() except that instead of
30724  * returning a constant string, the string is duplicated.
30725  *
30726  * The return value must be freed using g_free().
30727  *
30728  * Returns: (transfer full) (array zero-terminated=1 length=length) (element-type guint8): a newly allocated string
30729  * Since: 2.26
30730  */
30731
30732
30733 /**
30734  * g_variant_dup_bytestring_array:
30735  * @value: an array of array of bytes #GVariant ('aay')
30736  * @length: (out) (allow-none): the length of the result, or %NULL
30737  *
30738  * Gets the contents of an array of array of bytes #GVariant.  This call
30739  * makes a deep copy; the return result should be released with
30740  * g_strfreev().
30741  *
30742  * If @length is non-%NULL then the number of elements in the result is
30743  * stored there.  In any case, the resulting array will be
30744  * %NULL-terminated.
30745  *
30746  * For an empty array, @length will be set to 0 and a pointer to a
30747  * %NULL pointer will be returned.
30748  *
30749  * Returns: (array length=length) (transfer full): an array of strings
30750  * Since: 2.26
30751  */
30752
30753
30754 /**
30755  * g_variant_dup_objv:
30756  * @value: an array of object paths #GVariant
30757  * @length: (out) (allow-none): the length of the result, or %NULL
30758  *
30759  * Gets the contents of an array of object paths #GVariant.  This call
30760  * makes a deep copy; the return result should be released with
30761  * g_strfreev().
30762  *
30763  * If @length is non-%NULL then the number of elements in the result
30764  * is stored there.  In any case, the resulting array will be
30765  * %NULL-terminated.
30766  *
30767  * For an empty array, @length will be set to 0 and a pointer to a
30768  * %NULL pointer will be returned.
30769  *
30770  * Returns: (array length=length zero-terminated=1) (transfer full): an array of strings
30771  * Since: 2.30
30772  */
30773
30774
30775 /**
30776  * g_variant_dup_string:
30777  * @value: a string #GVariant instance
30778  * @length: (out): a pointer to a #gsize, to store the length
30779  *
30780  * Similar to g_variant_get_string() except that instead of returning
30781  * a constant string, the string is duplicated.
30782  *
30783  * The string will always be utf8 encoded.
30784  *
30785  * The return value must be freed using g_free().
30786  *
30787  * Returns: (transfer full): a newly allocated string, utf8 encoded
30788  * Since: 2.24
30789  */
30790
30791
30792 /**
30793  * g_variant_dup_strv:
30794  * @value: an array of strings #GVariant
30795  * @length: (out) (allow-none): the length of the result, or %NULL
30796  *
30797  * Gets the contents of an array of strings #GVariant.  This call
30798  * makes a deep copy; the return result should be released with
30799  * g_strfreev().
30800  *
30801  * If @length is non-%NULL then the number of elements in the result
30802  * is stored there.  In any case, the resulting array will be
30803  * %NULL-terminated.
30804  *
30805  * For an empty array, @length will be set to 0 and a pointer to a
30806  * %NULL pointer will be returned.
30807  *
30808  * Returns: (array length=length zero-terminated=1) (transfer full): an array of strings
30809  * Since: 2.24
30810  */
30811
30812
30813 /**
30814  * g_variant_equal:
30815  * @one: (type GVariant): a #GVariant instance
30816  * @two: (type GVariant): a #GVariant instance
30817  *
30818  * Checks if @one and @two have the same type and value.
30819  *
30820  * The types of @one and @two are #gconstpointer only to allow use of
30821  * this function with #GHashTable.  They must each be a #GVariant.
30822  *
30823  * Returns: %TRUE if @one and @two are equal
30824  * Since: 2.24
30825  */
30826
30827
30828 /**
30829  * g_variant_get: (skip)
30830  * @value: a #GVariant instance
30831  * @format_string: a #GVariant format string
30832  * @...: arguments, as per @format_string
30833  *
30834  * Deconstructs a #GVariant instance.
30835  *
30836  * Think of this function as an analogue to scanf().
30837  *
30838  * The arguments that are expected by this function are entirely
30839  * determined by @format_string.  @format_string also restricts the
30840  * permissible types of @value.  It is an error to give a value with
30841  * an incompatible type.  See the section on <link
30842  * linkend='gvariant-format-strings'>GVariant Format Strings</link>.
30843  * Please note that the syntax of the format string is very likely to be
30844  * extended in the future.
30845  *
30846  * @format_string determines the C types that are used for unpacking
30847  * the values and also determines if the values are copied or borrowed,
30848  * see the section on
30849  * <link linkend='gvariant-format-strings-pointers'>GVariant Format Strings</link>.
30850  *
30851  * Since: 2.24
30852  */
30853
30854
30855 /**
30856  * g_variant_get_boolean:
30857  * @value: a boolean #GVariant instance
30858  *
30859  * Returns the boolean value of @value.
30860  *
30861  * It is an error to call this function with a @value of any type
30862  * other than %G_VARIANT_TYPE_BOOLEAN.
30863  *
30864  * Returns: %TRUE or %FALSE
30865  * Since: 2.24
30866  */
30867
30868
30869 /**
30870  * g_variant_get_byte:
30871  * @value: a byte #GVariant instance
30872  *
30873  * Returns the byte value of @value.
30874  *
30875  * It is an error to call this function with a @value of any type
30876  * other than %G_VARIANT_TYPE_BYTE.
30877  *
30878  * Returns: a #guchar
30879  * Since: 2.24
30880  */
30881
30882
30883 /**
30884  * g_variant_get_bytestring:
30885  * @value: an array-of-bytes #GVariant instance
30886  *
30887  * Returns the string value of a #GVariant instance with an
30888  * array-of-bytes type.  The string has no particular encoding.
30889  *
30890  * If the array does not end with a nul terminator character, the empty
30891  * string is returned.  For this reason, you can always trust that a
30892  * non-%NULL nul-terminated string will be returned by this function.
30893  *
30894  * If the array contains a nul terminator character somewhere other than
30895  * the last byte then the returned string is the string, up to the first
30896  * such nul character.
30897  *
30898  * It is an error to call this function with a @value that is not an
30899  * array of bytes.
30900  *
30901  * The return value remains valid as long as @value exists.
30902  *
30903  * Returns: (transfer none) (array zero-terminated=1) (element-type guint8): the constant string
30904  * Since: 2.26
30905  */
30906
30907
30908 /**
30909  * g_variant_get_bytestring_array:
30910  * @value: an array of array of bytes #GVariant ('aay')
30911  * @length: (out) (allow-none): the length of the result, or %NULL
30912  *
30913  * Gets the contents of an array of array of bytes #GVariant.  This call
30914  * makes a shallow copy; the return result should be released with
30915  * g_free(), but the individual strings must not be modified.
30916  *
30917  * If @length is non-%NULL then the number of elements in the result is
30918  * stored there.  In any case, the resulting array will be
30919  * %NULL-terminated.
30920  *
30921  * For an empty array, @length will be set to 0 and a pointer to a
30922  * %NULL pointer will be returned.
30923  *
30924  * Returns: (array length=length) (transfer container): an array of constant strings
30925  * Since: 2.26
30926  */
30927
30928
30929 /**
30930  * g_variant_get_child: (skip)
30931  * @value: a container #GVariant
30932  * @index_: the index of the child to deconstruct
30933  * @format_string: a #GVariant format string
30934  * @...: arguments, as per @format_string
30935  *
30936  * Reads a child item out of a container #GVariant instance and
30937  * deconstructs it according to @format_string.  This call is
30938  * essentially a combination of g_variant_get_child_value() and
30939  * g_variant_get().
30940  *
30941  * @format_string determines the C types that are used for unpacking
30942  * the values and also determines if the values are copied or borrowed,
30943  * see the section on
30944  * <link linkend='gvariant-format-strings-pointers'>GVariant Format Strings</link>.
30945  *
30946  * Since: 2.24
30947  */
30948
30949
30950 /**
30951  * g_variant_get_child_value:
30952  * @value: a container #GVariant
30953  * @index_: the index of the child to fetch
30954  *
30955  * Reads a child item out of a container #GVariant instance.  This
30956  * includes variants, maybes, arrays, tuples and dictionary
30957  * entries.  It is an error to call this function on any other type of
30958  * #GVariant.
30959  *
30960  * It is an error if @index_ is greater than the number of child items
30961  * in the container.  See g_variant_n_children().
30962  *
30963  * The returned value is never floating.  You should free it with
30964  * g_variant_unref() when you're done with it.
30965  *
30966  * This function is O(1).
30967  *
30968  * Returns: (transfer full): the child at the specified index
30969  * Since: 2.24
30970  */
30971
30972
30973 /**
30974  * g_variant_get_data:
30975  * @value: a #GVariant instance
30976  *
30977  * Returns a pointer to the serialised form of a #GVariant instance.
30978  * The returned data may not be in fully-normalised form if read from an
30979  * untrusted source.  The returned data must not be freed; it remains
30980  * valid for as long as @value exists.
30981  *
30982  * If @value is a fixed-sized value that was deserialised from a
30983  * corrupted serialised container then %NULL may be returned.  In this
30984  * case, the proper thing to do is typically to use the appropriate
30985  * number of nul bytes in place of @value.  If @value is not fixed-sized
30986  * then %NULL is never returned.
30987  *
30988  * In the case that @value is already in serialised form, this function
30989  * is O(1).  If the value is not already in serialised form,
30990  * serialisation occurs implicitly and is approximately O(n) in the size
30991  * of the result.
30992  *
30993  * To deserialise the data returned by this function, in addition to the
30994  * serialised data, you must know the type of the #GVariant, and (if the
30995  * machine might be different) the endianness of the machine that stored
30996  * it. As a result, file formats or network messages that incorporate
30997  * serialised #GVariant<!---->s must include this information either
30998  * implicitly (for instance "the file always contains a
30999  * %G_VARIANT_TYPE_VARIANT and it is always in little-endian order") or
31000  * explicitly (by storing the type and/or endianness in addition to the
31001  * serialised data).
31002  *
31003  * Returns: (transfer none): the serialised form of @value, or %NULL
31004  * Since: 2.24
31005  */
31006
31007
31008 /**
31009  * g_variant_get_data_as_bytes:
31010  * @value: a #GVariant
31011  *
31012  * Returns a pointer to the serialised form of a #GVariant instance.
31013  * The semantics of this function are exactly the same as
31014  * g_variant_get_data(), except that the returned #GBytes holds
31015  * a reference to the variant data.
31016  *
31017  * Returns: (transfer full): A new #GBytes representing the variant data
31018  * Since: 2.36
31019  */
31020
31021
31022 /**
31023  * g_variant_get_double:
31024  * @value: a double #GVariant instance
31025  *
31026  * Returns the double precision floating point value of @value.
31027  *
31028  * It is an error to call this function with a @value of any type
31029  * other than %G_VARIANT_TYPE_DOUBLE.
31030  *
31031  * Returns: a #gdouble
31032  * Since: 2.24
31033  */
31034
31035
31036 /**
31037  * g_variant_get_fixed_array:
31038  * @value: a #GVariant array with fixed-sized elements
31039  * @n_elements: (out): a pointer to the location to store the number of items
31040  * @element_size: the size of each element
31041  *
31042  * Provides access to the serialised data for an array of fixed-sized
31043  * items.
31044  *
31045  * @value must be an array with fixed-sized elements.  Numeric types are
31046  * fixed-size, as are tuples containing only other fixed-sized types.
31047  *
31048  * @element_size must be the size of a single element in the array,
31049  * as given by the section on
31050  * <link linkend='gvariant-serialised-data-memory'>Serialised Data
31051  * Memory</link>.
31052  *
31053  * In particular, arrays of these fixed-sized types can be interpreted
31054  * as an array of the given C type, with @element_size set to
31055  * <code>sizeof</code> the appropriate type:
31056  *
31057  * <informaltable>
31058  * <tgroup cols='2'>
31059  * <thead><row><entry>element type</entry> <entry>C type</entry></row></thead>
31060  * <tbody>
31061  * <row><entry>%G_VARIANT_TYPE_INT16 (etc.)</entry>
31062  *   <entry>#gint16 (etc.)</entry></row>
31063  * <row><entry>%G_VARIANT_TYPE_BOOLEAN</entry>
31064  *   <entry>#guchar (not #gboolean!)</entry></row>
31065  * <row><entry>%G_VARIANT_TYPE_BYTE</entry> <entry>#guchar</entry></row>
31066  * <row><entry>%G_VARIANT_TYPE_HANDLE</entry> <entry>#guint32</entry></row>
31067  * <row><entry>%G_VARIANT_TYPE_DOUBLE</entry> <entry>#gdouble</entry></row>
31068  * </tbody>
31069  * </tgroup>
31070  * </informaltable>
31071  *
31072  * For example, if calling this function for an array of 32 bit integers,
31073  * you might say <code>sizeof (gint32)</code>.  This value isn't used
31074  * except for the purpose of a double-check that the form of the
31075  * serialised data matches the caller's expectation.
31076  *
31077  * @n_elements, which must be non-%NULL is set equal to the number of
31078  * items in the array.
31079  *
31080  * Returns: (array length=n_elements) (transfer none): a pointer to the fixed array
31081  * Since: 2.24
31082  */
31083
31084
31085 /**
31086  * g_variant_get_handle:
31087  * @value: a handle #GVariant instance
31088  *
31089  * Returns the 32-bit signed integer value of @value.
31090  *
31091  * It is an error to call this function with a @value of any type other
31092  * than %G_VARIANT_TYPE_HANDLE.
31093  *
31094  * By convention, handles are indexes into an array of file descriptors
31095  * that are sent alongside a D-Bus message.  If you're not interacting
31096  * with D-Bus, you probably don't need them.
31097  *
31098  * Returns: a #gint32
31099  * Since: 2.24
31100  */
31101
31102
31103 /**
31104  * g_variant_get_int16:
31105  * @value: a int16 #GVariant instance
31106  *
31107  * Returns the 16-bit signed integer value of @value.
31108  *
31109  * It is an error to call this function with a @value of any type
31110  * other than %G_VARIANT_TYPE_INT16.
31111  *
31112  * Returns: a #gint16
31113  * Since: 2.24
31114  */
31115
31116
31117 /**
31118  * g_variant_get_int32:
31119  * @value: a int32 #GVariant instance
31120  *
31121  * Returns the 32-bit signed integer value of @value.
31122  *
31123  * It is an error to call this function with a @value of any type
31124  * other than %G_VARIANT_TYPE_INT32.
31125  *
31126  * Returns: a #gint32
31127  * Since: 2.24
31128  */
31129
31130
31131 /**
31132  * g_variant_get_int64:
31133  * @value: a int64 #GVariant instance
31134  *
31135  * Returns the 64-bit signed integer value of @value.
31136  *
31137  * It is an error to call this function with a @value of any type
31138  * other than %G_VARIANT_TYPE_INT64.
31139  *
31140  * Returns: a #gint64
31141  * Since: 2.24
31142  */
31143
31144
31145 /**
31146  * g_variant_get_maybe:
31147  * @value: a maybe-typed value
31148  *
31149  * Given a maybe-typed #GVariant instance, extract its value.  If the
31150  * value is Nothing, then this function returns %NULL.
31151  *
31152  * Returns: (allow-none) (transfer full): the contents of @value, or %NULL
31153  * Since: 2.24
31154  */
31155
31156
31157 /**
31158  * g_variant_get_normal_form:
31159  * @value: a #GVariant
31160  *
31161  * Gets a #GVariant instance that has the same value as @value and is
31162  * trusted to be in normal form.
31163  *
31164  * If @value is already trusted to be in normal form then a new
31165  * reference to @value is returned.
31166  *
31167  * If @value is not already trusted, then it is scanned to check if it
31168  * is in normal form.  If it is found to be in normal form then it is
31169  * marked as trusted and a new reference to it is returned.
31170  *
31171  * If @value is found not to be in normal form then a new trusted
31172  * #GVariant is created with the same value as @value.
31173  *
31174  * It makes sense to call this function if you've received #GVariant
31175  * data from untrusted sources and you want to ensure your serialised
31176  * output is definitely in normal form.
31177  *
31178  * Returns: (transfer full): a trusted #GVariant
31179  * Since: 2.24
31180  */
31181
31182
31183 /**
31184  * g_variant_get_objv:
31185  * @value: an array of object paths #GVariant
31186  * @length: (out) (allow-none): the length of the result, or %NULL
31187  *
31188  * Gets the contents of an array of object paths #GVariant.  This call
31189  * makes a shallow copy; the return result should be released with
31190  * g_free(), but the individual strings must not be modified.
31191  *
31192  * If @length is non-%NULL then the number of elements in the result
31193  * is stored there.  In any case, the resulting array will be
31194  * %NULL-terminated.
31195  *
31196  * For an empty array, @length will be set to 0 and a pointer to a
31197  * %NULL pointer will be returned.
31198  *
31199  * Returns: (array length=length zero-terminated=1) (transfer container): an array of constant strings
31200  * Since: 2.30
31201  */
31202
31203
31204 /**
31205  * g_variant_get_size:
31206  * @value: a #GVariant instance
31207  *
31208  * Determines the number of bytes that would be required to store @value
31209  * with g_variant_store().
31210  *
31211  * If @value has a fixed-sized type then this function always returned
31212  * that fixed size.
31213  *
31214  * In the case that @value is already in serialised form or the size has
31215  * already been calculated (ie: this function has been called before)
31216  * then this function is O(1).  Otherwise, the size is calculated, an
31217  * operation which is approximately O(n) in the number of values
31218  * involved.
31219  *
31220  * Returns: the serialised size of @value
31221  * Since: 2.24
31222  */
31223
31224
31225 /**
31226  * g_variant_get_string:
31227  * @value: a string #GVariant instance
31228  * @length: (allow-none) (default 0) (out): a pointer to a #gsize, to store the length
31229  *
31230  * Returns the string value of a #GVariant instance with a string
31231  * type.  This includes the types %G_VARIANT_TYPE_STRING,
31232  * %G_VARIANT_TYPE_OBJECT_PATH and %G_VARIANT_TYPE_SIGNATURE.
31233  *
31234  * The string will always be utf8 encoded.
31235  *
31236  * If @length is non-%NULL then the length of the string (in bytes) is
31237  * returned there.  For trusted values, this information is already
31238  * known.  For untrusted values, a strlen() will be performed.
31239  *
31240  * It is an error to call this function with a @value of any type
31241  * other than those three.
31242  *
31243  * The return value remains valid as long as @value exists.
31244  *
31245  * Returns: (transfer none): the constant string, utf8 encoded
31246  * Since: 2.24
31247  */
31248
31249
31250 /**
31251  * g_variant_get_strv:
31252  * @value: an array of strings #GVariant
31253  * @length: (out) (allow-none): the length of the result, or %NULL
31254  *
31255  * Gets the contents of an array of strings #GVariant.  This call
31256  * makes a shallow copy; the return result should be released with
31257  * g_free(), but the individual strings must not be modified.
31258  *
31259  * If @length is non-%NULL then the number of elements in the result
31260  * is stored there.  In any case, the resulting array will be
31261  * %NULL-terminated.
31262  *
31263  * For an empty array, @length will be set to 0 and a pointer to a
31264  * %NULL pointer will be returned.
31265  *
31266  * Returns: (array length=length zero-terminated=1) (transfer container): an array of constant strings
31267  * Since: 2.24
31268  */
31269
31270
31271 /**
31272  * g_variant_get_type:
31273  * @value: a #GVariant
31274  *
31275  * Determines the type of @value.
31276  *
31277  * The return value is valid for the lifetime of @value and must not
31278  * be freed.
31279  *
31280  * Returns: a #GVariantType
31281  * Since: 2.24
31282  */
31283
31284
31285 /**
31286  * g_variant_get_type_string:
31287  * @value: a #GVariant
31288  *
31289  * Returns the type string of @value.  Unlike the result of calling
31290  * g_variant_type_peek_string(), this string is nul-terminated.  This
31291  * string belongs to #GVariant and must not be freed.
31292  *
31293  * Returns: the type string for the type of @value
31294  * Since: 2.24
31295  */
31296
31297
31298 /**
31299  * g_variant_get_uint16:
31300  * @value: a uint16 #GVariant instance
31301  *
31302  * Returns the 16-bit unsigned integer value of @value.
31303  *
31304  * It is an error to call this function with a @value of any type
31305  * other than %G_VARIANT_TYPE_UINT16.
31306  *
31307  * Returns: a #guint16
31308  * Since: 2.24
31309  */
31310
31311
31312 /**
31313  * g_variant_get_uint32:
31314  * @value: a uint32 #GVariant instance
31315  *
31316  * Returns the 32-bit unsigned integer value of @value.
31317  *
31318  * It is an error to call this function with a @value of any type
31319  * other than %G_VARIANT_TYPE_UINT32.
31320  *
31321  * Returns: a #guint32
31322  * Since: 2.24
31323  */
31324
31325
31326 /**
31327  * g_variant_get_uint64:
31328  * @value: a uint64 #GVariant instance
31329  *
31330  * Returns the 64-bit unsigned integer value of @value.
31331  *
31332  * It is an error to call this function with a @value of any type
31333  * other than %G_VARIANT_TYPE_UINT64.
31334  *
31335  * Returns: a #guint64
31336  * Since: 2.24
31337  */
31338
31339
31340 /**
31341  * g_variant_get_va: (skip)
31342  * @value: a #GVariant
31343  * @format_string: a string that is prefixed with a format string
31344  * @endptr: (allow-none) (default NULL): location to store the end pointer, or %NULL
31345  * @app: a pointer to a #va_list
31346  *
31347  * This function is intended to be used by libraries based on #GVariant
31348  * that want to provide g_variant_get()-like functionality to their
31349  * users.
31350  *
31351  * The API is more general than g_variant_get() to allow a wider range
31352  * of possible uses.
31353  *
31354  * @format_string must still point to a valid format string, but it only
31355  * need to be nul-terminated if @endptr is %NULL.  If @endptr is
31356  * non-%NULL then it is updated to point to the first character past the
31357  * end of the format string.
31358  *
31359  * @app is a pointer to a #va_list.  The arguments, according to
31360  * @format_string, are collected from this #va_list and the list is left
31361  * pointing to the argument following the last.
31362  *
31363  * These two generalisations allow mixing of multiple calls to
31364  * g_variant_new_va() and g_variant_get_va() within a single actual
31365  * varargs call by the user.
31366  *
31367  * @format_string determines the C types that are used for unpacking
31368  * the values and also determines if the values are copied or borrowed,
31369  * see the section on
31370  * <link linkend='gvariant-format-strings-pointers'>GVariant Format Strings</link>.
31371  *
31372  * Since: 2.24
31373  */
31374
31375
31376 /**
31377  * g_variant_get_variant:
31378  * @value: a variant #GVariant instance
31379  *
31380  * Unboxes @value.  The result is the #GVariant instance that was
31381  * contained in @value.
31382  *
31383  * Returns: (transfer full): the item contained in the variant
31384  * Since: 2.24
31385  */
31386
31387
31388 /**
31389  * g_variant_hash:
31390  * @value: (type GVariant): a basic #GVariant value as a #gconstpointer
31391  *
31392  * Generates a hash value for a #GVariant instance.
31393  *
31394  * The output of this function is guaranteed to be the same for a given
31395  * value only per-process.  It may change between different processor
31396  * architectures or even different versions of GLib.  Do not use this
31397  * function as a basis for building protocols or file formats.
31398  *
31399  * The type of @value is #gconstpointer only to allow use of this
31400  * function with #GHashTable.  @value must be a #GVariant.
31401  *
31402  * Returns: a hash value corresponding to @value
31403  * Since: 2.24
31404  */
31405
31406
31407 /**
31408  * g_variant_is_container:
31409  * @value: a #GVariant instance
31410  *
31411  * Checks if @value is a container.
31412  *
31413  * Returns: %TRUE if @value is a container
31414  * Since: 2.24
31415  */
31416
31417
31418 /**
31419  * g_variant_is_floating:
31420  * @value: a #GVariant
31421  *
31422  * Checks whether @value has a floating reference count.
31423  *
31424  * This function should only ever be used to assert that a given variant
31425  * is or is not floating, or for debug purposes. To acquire a reference
31426  * to a variant that might be floating, always use g_variant_ref_sink()
31427  * or g_variant_take_ref().
31428  *
31429  * See g_variant_ref_sink() for more information about floating reference
31430  * counts.
31431  *
31432  * Returns: whether @value is floating
31433  * Since: 2.26
31434  */
31435
31436
31437 /**
31438  * g_variant_is_normal_form:
31439  * @value: a #GVariant instance
31440  *
31441  * Checks if @value is in normal form.
31442  *
31443  * The main reason to do this is to detect if a given chunk of
31444  * serialised data is in normal form: load the data into a #GVariant
31445  * using g_variant_new_from_data() and then use this function to
31446  * check.
31447  *
31448  * If @value is found to be in normal form then it will be marked as
31449  * being trusted.  If the value was already marked as being trusted then
31450  * this function will immediately return %TRUE.
31451  *
31452  * Returns: %TRUE if @value is in normal form
31453  * Since: 2.24
31454  */
31455
31456
31457 /**
31458  * g_variant_is_object_path:
31459  * @string: a normal C nul-terminated string
31460  *
31461  * Determines if a given string is a valid D-Bus object path.  You
31462  * should ensure that a string is a valid D-Bus object path before
31463  * passing it to g_variant_new_object_path().
31464  *
31465  * A valid object path starts with '/' followed by zero or more
31466  * sequences of characters separated by '/' characters.  Each sequence
31467  * must contain only the characters "[A-Z][a-z][0-9]_".  No sequence
31468  * (including the one following the final '/' character) may be empty.
31469  *
31470  * Returns: %TRUE if @string is a D-Bus object path
31471  * Since: 2.24
31472  */
31473
31474
31475 /**
31476  * g_variant_is_of_type:
31477  * @value: a #GVariant instance
31478  * @type: a #GVariantType
31479  *
31480  * Checks if a value has a type matching the provided type.
31481  *
31482  * Returns: %TRUE if the type of @value matches @type
31483  * Since: 2.24
31484  */
31485
31486
31487 /**
31488  * g_variant_is_signature:
31489  * @string: a normal C nul-terminated string
31490  *
31491  * Determines if a given string is a valid D-Bus type signature.  You
31492  * should ensure that a string is a valid D-Bus type signature before
31493  * passing it to g_variant_new_signature().
31494  *
31495  * D-Bus type signatures consist of zero or more definite #GVariantType
31496  * strings in sequence.
31497  *
31498  * Returns: %TRUE if @string is a D-Bus type signature
31499  * Since: 2.24
31500  */
31501
31502
31503 /**
31504  * g_variant_iter_copy:
31505  * @iter: a #GVariantIter
31506  *
31507  * Creates a new heap-allocated #GVariantIter to iterate over the
31508  * container that was being iterated over by @iter.  Iteration begins on
31509  * the new iterator from the current position of the old iterator but
31510  * the two copies are independent past that point.
31511  *
31512  * Use g_variant_iter_free() to free the return value when you no longer
31513  * need it.
31514  *
31515  * A reference is taken to the container that @iter is iterating over
31516  * and will be releated only when g_variant_iter_free() is called.
31517  *
31518  * Returns: (transfer full): a new heap-allocated #GVariantIter
31519  * Since: 2.24
31520  */
31521
31522
31523 /**
31524  * g_variant_iter_free:
31525  * @iter: (transfer full): a heap-allocated #GVariantIter
31526  *
31527  * Frees a heap-allocated #GVariantIter.  Only call this function on
31528  * iterators that were returned by g_variant_iter_new() or
31529  * g_variant_iter_copy().
31530  *
31531  * Since: 2.24
31532  */
31533
31534
31535 /**
31536  * g_variant_iter_init: (skip)
31537  * @iter: a pointer to a #GVariantIter
31538  * @value: a container #GVariant
31539  *
31540  * Initialises (without allocating) a #GVariantIter.  @iter may be
31541  * completely uninitialised prior to this call; its old value is
31542  * ignored.
31543  *
31544  * The iterator remains valid for as long as @value exists, and need not
31545  * be freed in any way.
31546  *
31547  * Returns: the number of items in @value
31548  * Since: 2.24
31549  */
31550
31551
31552 /**
31553  * g_variant_iter_loop: (skip)
31554  * @iter: a #GVariantIter
31555  * @format_string: a GVariant format string
31556  * @...: the arguments to unpack the value into
31557  *
31558  * Gets the next item in the container and unpacks it into the variable
31559  * argument list according to @format_string, returning %TRUE.
31560  *
31561  * If no more items remain then %FALSE is returned.
31562  *
31563  * On the first call to this function, the pointers appearing on the
31564  * variable argument list are assumed to point at uninitialised memory.
31565  * On the second and later calls, it is assumed that the same pointers
31566  * will be given and that they will point to the memory as set by the
31567  * previous call to this function.  This allows the previous values to
31568  * be freed, as appropriate.
31569  *
31570  * This function is intended to be used with a while loop as
31571  * demonstrated in the following example.  This function can only be
31572  * used when iterating over an array.  It is only valid to call this
31573  * function with a string constant for the format string and the same
31574  * string constant must be used each time.  Mixing calls to this
31575  * function and g_variant_iter_next() or g_variant_iter_next_value() on
31576  * the same iterator causes undefined behavior.
31577  *
31578  * If you break out of a such a while loop using g_variant_iter_loop() then
31579  * you must free or unreference all the unpacked values as you would with
31580  * g_variant_get(). Failure to do so will cause a memory leak.
31581  *
31582  * See the section on <link linkend='gvariant-format-strings'>GVariant
31583  * Format Strings</link>.
31584  *
31585  * <example>
31586  *  <title>Memory management with g_variant_iter_loop()</title>
31587  *  <programlisting>
31588  *   /<!-- -->* Iterates a dictionary of type 'a{sv}' *<!-- -->/
31589  *   void
31590  *   iterate_dictionary (GVariant *dictionary)
31591  *   {
31592  *     GVariantIter iter;
31593  *     GVariant *value;
31594  *     gchar *key;
31595  *
31596  *     g_variant_iter_init (&iter, dictionary);
31597  *     while (g_variant_iter_loop (&iter, "{sv}", &key, &value))
31598  *       {
31599  *         g_print ("Item '%s' has type '%s'\n", key,
31600  *                  g_variant_get_type_string (value));
31601  *
31602  *         /<!-- -->* no need to free 'key' and 'value' here *<!-- -->/
31603  *         /<!-- -->* unless breaking out of this loop *<!-- -->/
31604  *       }
31605  *   }
31606  *  </programlisting>
31607  * </example>
31608  *
31609  * For most cases you should use g_variant_iter_next().
31610  *
31611  * This function is really only useful when unpacking into #GVariant or
31612  * #GVariantIter in order to allow you to skip the call to
31613  * g_variant_unref() or g_variant_iter_free().
31614  *
31615  * For example, if you are only looping over simple integer and string
31616  * types, g_variant_iter_next() is definitely preferred.  For string
31617  * types, use the '&' prefix to avoid allocating any memory at all (and
31618  * thereby avoiding the need to free anything as well).
31619  *
31620  * @format_string determines the C types that are used for unpacking
31621  * the values and also determines if the values are copied or borrowed,
31622  * see the section on
31623  * <link linkend='gvariant-format-strings-pointers'>GVariant Format Strings</link>.
31624  *
31625  * Returns: %TRUE if a value was unpacked, or %FALSE if there was no value
31626  * Since: 2.24
31627  */
31628
31629
31630 /**
31631  * g_variant_iter_n_children:
31632  * @iter: a #GVariantIter
31633  *
31634  * Queries the number of child items in the container that we are
31635  * iterating over.  This is the total number of items -- not the number
31636  * of items remaining.
31637  *
31638  * This function might be useful for preallocation of arrays.
31639  *
31640  * Returns: the number of children in the container
31641  * Since: 2.24
31642  */
31643
31644
31645 /**
31646  * g_variant_iter_new:
31647  * @value: a container #GVariant
31648  *
31649  * Creates a heap-allocated #GVariantIter for iterating over the items
31650  * in @value.
31651  *
31652  * Use g_variant_iter_free() to free the return value when you no longer
31653  * need it.
31654  *
31655  * A reference is taken to @value and will be released only when
31656  * g_variant_iter_free() is called.
31657  *
31658  * Returns: (transfer full): a new heap-allocated #GVariantIter
31659  * Since: 2.24
31660  */
31661
31662
31663 /**
31664  * g_variant_iter_next: (skip)
31665  * @iter: a #GVariantIter
31666  * @format_string: a GVariant format string
31667  * @...: the arguments to unpack the value into
31668  *
31669  * Gets the next item in the container and unpacks it into the variable
31670  * argument list according to @format_string, returning %TRUE.
31671  *
31672  * If no more items remain then %FALSE is returned.
31673  *
31674  * All of the pointers given on the variable arguments list of this
31675  * function are assumed to point at uninitialised memory.  It is the
31676  * responsibility of the caller to free all of the values returned by
31677  * the unpacking process.
31678  *
31679  * See the section on <link linkend='gvariant-format-strings'>GVariant
31680  * Format Strings</link>.
31681  *
31682  * <example>
31683  *  <title>Memory management with g_variant_iter_next()</title>
31684  *  <programlisting>
31685  *   /<!-- -->* Iterates a dictionary of type 'a{sv}' *<!-- -->/
31686  *   void
31687  *   iterate_dictionary (GVariant *dictionary)
31688  *   {
31689  *     GVariantIter iter;
31690  *     GVariant *value;
31691  *     gchar *key;
31692  *
31693  *     g_variant_iter_init (&iter, dictionary);
31694  *     while (g_variant_iter_next (&iter, "{sv}", &key, &value))
31695  *       {
31696  *         g_print ("Item '%s' has type '%s'\n", key,
31697  *                  g_variant_get_type_string (value));
31698  *
31699  *         /<!-- -->* must free data for ourselves *<!-- -->/
31700  *         g_variant_unref (value);
31701  *         g_free (key);
31702  *       }
31703  *   }
31704  *  </programlisting>
31705  * </example>
31706  *
31707  * For a solution that is likely to be more convenient to C programmers
31708  * when dealing with loops, see g_variant_iter_loop().
31709  *
31710  * @format_string determines the C types that are used for unpacking
31711  * the values and also determines if the values are copied or borrowed,
31712  * see the section on
31713  * <link linkend='gvariant-format-strings-pointers'>GVariant Format Strings</link>.
31714  *
31715  * Returns: %TRUE if a value was unpacked, or %FALSE if there as no value
31716  * Since: 2.24
31717  */
31718
31719
31720 /**
31721  * g_variant_iter_next_value:
31722  * @iter: a #GVariantIter
31723  *
31724  * Gets the next item in the container.  If no more items remain then
31725  * %NULL is returned.
31726  *
31727  * Use g_variant_unref() to drop your reference on the return value when
31728  * you no longer need it.
31729  *
31730  * <example>
31731  *  <title>Iterating with g_variant_iter_next_value()</title>
31732  *  <programlisting>
31733  *   /<!-- -->* recursively iterate a container *<!-- -->/
31734  *   void
31735  *   iterate_container_recursive (GVariant *container)
31736  *   {
31737  *     GVariantIter iter;
31738  *     GVariant *child;
31739  *
31740  *     g_variant_iter_init (&iter, container);
31741  *     while ((child = g_variant_iter_next_value (&iter)))
31742  *       {
31743  *         g_print ("type '%s'\n", g_variant_get_type_string (child));
31744  *
31745  *         if (g_variant_is_container (child))
31746  *           iterate_container_recursive (child);
31747  *
31748  *         g_variant_unref (child);
31749  *       }
31750  *   }
31751  * </programlisting>
31752  * </example>
31753  *
31754  * Returns: (allow-none) (transfer full): a #GVariant, or %NULL
31755  * Since: 2.24
31756  */
31757
31758
31759 /**
31760  * g_variant_lookup: (skip)
31761  * @dictionary: a dictionary #GVariant
31762  * @key: the key to lookup in the dictionary
31763  * @format_string: a GVariant format string
31764  * @...: the arguments to unpack the value into
31765  *
31766  * Looks up a value in a dictionary #GVariant.
31767  *
31768  * This function is a wrapper around g_variant_lookup_value() and
31769  * g_variant_get().  In the case that %NULL would have been returned,
31770  * this function returns %FALSE.  Otherwise, it unpacks the returned
31771  * value and returns %TRUE.
31772  *
31773  * @format_string determines the C types that are used for unpacking
31774  * the values and also determines if the values are copied or borrowed,
31775  * see the section on
31776  * <link linkend='gvariant-format-strings-pointers'>GVariant Format Strings</link>.
31777  *
31778  * Returns: %TRUE if a value was unpacked
31779  * Since: 2.28
31780  */
31781
31782
31783 /**
31784  * g_variant_lookup_value:
31785  * @dictionary: a dictionary #GVariant
31786  * @key: the key to lookup in the dictionary
31787  * @expected_type: (allow-none): a #GVariantType, or %NULL
31788  *
31789  * Looks up a value in a dictionary #GVariant.
31790  *
31791  * This function works with dictionaries of the type
31792  * <literal>a{s*}</literal> (and equally well with type
31793  * <literal>a{o*}</literal>, but we only further discuss the string case
31794  * for sake of clarity).
31795  *
31796  * In the event that @dictionary has the type <literal>a{sv}</literal>,
31797  * the @expected_type string specifies what type of value is expected to
31798  * be inside of the variant.  If the value inside the variant has a
31799  * different type then %NULL is returned.  In the event that @dictionary
31800  * has a value type other than <literal>v</literal> then @expected_type
31801  * must directly match the key type and it is used to unpack the value
31802  * directly or an error occurs.
31803  *
31804  * In either case, if @key is not found in @dictionary, %NULL is
31805  * returned.
31806  *
31807  * If the key is found and the value has the correct type, it is
31808  * returned.  If @expected_type was specified then any non-%NULL return
31809  * value will have this type.
31810  *
31811  * Returns: (transfer full): the value of the dictionary key, or %NULL
31812  * Since: 2.28
31813  */
31814
31815
31816 /**
31817  * g_variant_n_children:
31818  * @value: a container #GVariant
31819  *
31820  * Determines the number of children in a container #GVariant instance.
31821  * This includes variants, maybes, arrays, tuples and dictionary
31822  * entries.  It is an error to call this function on any other type of
31823  * #GVariant.
31824  *
31825  * For variants, the return value is always 1.  For values with maybe
31826  * types, it is always zero or one.  For arrays, it is the length of the
31827  * array.  For tuples it is the number of tuple items (which depends
31828  * only on the type).  For dictionary entries, it is always 2
31829  *
31830  * This function is O(1).
31831  *
31832  * Returns: the number of children in the container
31833  * Since: 2.24
31834  */
31835
31836
31837 /**
31838  * g_variant_new: (skip)
31839  * @format_string: a #GVariant format string
31840  * @...: arguments, as per @format_string
31841  *
31842  * Creates a new #GVariant instance.
31843  *
31844  * Think of this function as an analogue to g_strdup_printf().
31845  *
31846  * The type of the created instance and the arguments that are
31847  * expected by this function are determined by @format_string.  See the
31848  * section on <link linkend='gvariant-format-strings'>GVariant Format
31849  * Strings</link>.  Please note that the syntax of the format string is
31850  * very likely to be extended in the future.
31851  *
31852  * The first character of the format string must not be '*' '?' '@' or
31853  * 'r'; in essence, a new #GVariant must always be constructed by this
31854  * function (and not merely passed through it unmodified).
31855  *
31856  * Returns: a new floating #GVariant instance
31857  * Since: 2.24
31858  */
31859
31860
31861 /**
31862  * g_variant_new_array:
31863  * @child_type: (allow-none): the element type of the new array
31864  * @children: (allow-none) (array length=n_children): an array of #GVariant pointers, the children
31865  * @n_children: the length of @children
31866  *
31867  * Creates a new #GVariant array from @children.
31868  *
31869  * @child_type must be non-%NULL if @n_children is zero.  Otherwise, the
31870  * child type is determined by inspecting the first element of the
31871  * @children array.  If @child_type is non-%NULL then it must be a
31872  * definite type.
31873  *
31874  * The items of the array are taken from the @children array.  No entry
31875  * in the @children array may be %NULL.
31876  *
31877  * All items in the array must have the same type, which must be the
31878  * same as @child_type, if given.
31879  *
31880  * If the @children are floating references (see g_variant_ref_sink()), the
31881  * new instance takes ownership of them as if via g_variant_ref_sink().
31882  *
31883  * Returns: (transfer none): a floating reference to a new #GVariant array
31884  * Since: 2.24
31885  */
31886
31887
31888 /**
31889  * g_variant_new_boolean:
31890  * @value: a #gboolean value
31891  *
31892  * Creates a new boolean #GVariant instance -- either %TRUE or %FALSE.
31893  *
31894  * Returns: (transfer none): a floating reference to a new boolean #GVariant instance
31895  * Since: 2.24
31896  */
31897
31898
31899 /**
31900  * g_variant_new_byte:
31901  * @value: a #guint8 value
31902  *
31903  * Creates a new byte #GVariant instance.
31904  *
31905  * Returns: (transfer none): a floating reference to a new byte #GVariant instance
31906  * Since: 2.24
31907  */
31908
31909
31910 /**
31911  * g_variant_new_bytestring:
31912  * @string: (array zero-terminated=1) (element-type guint8): a normal nul-terminated string in no particular encoding
31913  *
31914  * Creates an array-of-bytes #GVariant with the contents of @string.
31915  * This function is just like g_variant_new_string() except that the
31916  * string need not be valid utf8.
31917  *
31918  * The nul terminator character at the end of the string is stored in
31919  * the array.
31920  *
31921  * Returns: (transfer none): a floating reference to a new bytestring #GVariant instance
31922  * Since: 2.26
31923  */
31924
31925
31926 /**
31927  * g_variant_new_bytestring_array:
31928  * @strv: (array length=length): an array of strings
31929  * @length: the length of @strv, or -1
31930  *
31931  * Constructs an array of bytestring #GVariant from the given array of
31932  * strings.
31933  *
31934  * If @length is -1 then @strv is %NULL-terminated.
31935  *
31936  * Returns: (transfer none): a new floating #GVariant instance
31937  * Since: 2.26
31938  */
31939
31940
31941 /**
31942  * g_variant_new_dict_entry: (constructor)
31943  * @key: a basic #GVariant, the key
31944  * @value: a #GVariant, the value
31945  *
31946  * Creates a new dictionary entry #GVariant. @key and @value must be
31947  * non-%NULL. @key must be a value of a basic type (ie: not a container).
31948  *
31949  * If the @key or @value are floating references (see g_variant_ref_sink()),
31950  * the new instance takes ownership of them as if via g_variant_ref_sink().
31951  *
31952  * Returns: (transfer none): a floating reference to a new dictionary entry #GVariant
31953  * Since: 2.24
31954  */
31955
31956
31957 /**
31958  * g_variant_new_double:
31959  * @value: a #gdouble floating point value
31960  *
31961  * Creates a new double #GVariant instance.
31962  *
31963  * Returns: (transfer none): a floating reference to a new double #GVariant instance
31964  * Since: 2.24
31965  */
31966
31967
31968 /**
31969  * g_variant_new_fixed_array:
31970  * @element_type: the #GVariantType of each element
31971  * @elements: a pointer to the fixed array of contiguous elements
31972  * @n_elements: the number of elements
31973  * @element_size: the size of each element
31974  *
31975  * Provides access to the serialised data for an array of fixed-sized
31976  * items.
31977  *
31978  * @value must be an array with fixed-sized elements.  Numeric types are
31979  * fixed-size as are tuples containing only other fixed-sized types.
31980  *
31981  * @element_size must be the size of a single element in the array.  For
31982  * example, if calling this function for an array of 32 bit integers,
31983  * you might say <code>sizeof (gint32)</code>.  This value isn't used
31984  * except for the purpose of a double-check that the form of the
31985  * serialised data matches the caller's expectation.
31986  *
31987  * @n_elements, which must be non-%NULL is set equal to the number of
31988  * items in the array.
31989  *
31990  * Returns: (transfer none): a floating reference to a new array #GVariant instance
31991  * Since: 2.32
31992  */
31993
31994
31995 /**
31996  * g_variant_new_from_bytes:
31997  * @type: a #GVariantType
31998  * @bytes: a #GBytes
31999  * @trusted: if the contents of @bytes are trusted
32000  *
32001  * Constructs a new serialised-mode #GVariant instance.  This is the
32002  * inner interface for creation of new serialised values that gets
32003  * called from various functions in gvariant.c.
32004  *
32005  * A reference is taken on @bytes.
32006  *
32007  * Returns: a new #GVariant with a floating reference
32008  * Since: 2.36
32009  */
32010
32011
32012 /**
32013  * g_variant_new_from_data:
32014  * @type: a definite #GVariantType
32015  * @data: (array length=size) (element-type guint8): the serialised data
32016  * @size: the size of @data
32017  * @trusted: %TRUE if @data is definitely in normal form
32018  * @notify: (scope async): function to call when @data is no longer needed
32019  * @user_data: data for @notify
32020  *
32021  * Creates a new #GVariant instance from serialised data.
32022  *
32023  * @type is the type of #GVariant instance that will be constructed.
32024  * The interpretation of @data depends on knowing the type.
32025  *
32026  * @data is not modified by this function and must remain valid with an
32027  * unchanging value until such a time as @notify is called with
32028  * @user_data.  If the contents of @data change before that time then
32029  * the result is undefined.
32030  *
32031  * If @data is trusted to be serialised data in normal form then
32032  * @trusted should be %TRUE.  This applies to serialised data created
32033  * within this process or read from a trusted location on the disk (such
32034  * as a file installed in /usr/lib alongside your application).  You
32035  * should set trusted to %FALSE if @data is read from the network, a
32036  * file in the user's home directory, etc.
32037  *
32038  * If @data was not stored in this machine's native endianness, any multi-byte
32039  * numeric values in the returned variant will also be in non-native
32040  * endianness. g_variant_byteswap() can be used to recover the original values.
32041  *
32042  * @notify will be called with @user_data when @data is no longer
32043  * needed.  The exact time of this call is unspecified and might even be
32044  * before this function returns.
32045  *
32046  * Returns: (transfer none): a new floating #GVariant of type @type
32047  * Since: 2.24
32048  */
32049
32050
32051 /**
32052  * g_variant_new_handle:
32053  * @value: a #gint32 value
32054  *
32055  * Creates a new handle #GVariant instance.
32056  *
32057  * By convention, handles are indexes into an array of file descriptors
32058  * that are sent alongside a D-Bus message.  If you're not interacting
32059  * with D-Bus, you probably don't need them.
32060  *
32061  * Returns: (transfer none): a floating reference to a new handle #GVariant instance
32062  * Since: 2.24
32063  */
32064
32065
32066 /**
32067  * g_variant_new_int16:
32068  * @value: a #gint16 value
32069  *
32070  * Creates a new int16 #GVariant instance.
32071  *
32072  * Returns: (transfer none): a floating reference to a new int16 #GVariant instance
32073  * Since: 2.24
32074  */
32075
32076
32077 /**
32078  * g_variant_new_int32:
32079  * @value: a #gint32 value
32080  *
32081  * Creates a new int32 #GVariant instance.
32082  *
32083  * Returns: (transfer none): a floating reference to a new int32 #GVariant instance
32084  * Since: 2.24
32085  */
32086
32087
32088 /**
32089  * g_variant_new_int64:
32090  * @value: a #gint64 value
32091  *
32092  * Creates a new int64 #GVariant instance.
32093  *
32094  * Returns: (transfer none): a floating reference to a new int64 #GVariant instance
32095  * Since: 2.24
32096  */
32097
32098
32099 /**
32100  * g_variant_new_maybe:
32101  * @child_type: (allow-none): the #GVariantType of the child, or %NULL
32102  * @child: (allow-none): the child value, or %NULL
32103  *
32104  * Depending on if @child is %NULL, either wraps @child inside of a
32105  * maybe container or creates a Nothing instance for the given @type.
32106  *
32107  * At least one of @child_type and @child must be non-%NULL.
32108  * If @child_type is non-%NULL then it must be a definite type.
32109  * If they are both non-%NULL then @child_type must be the type
32110  * of @child.
32111  *
32112  * If @child is a floating reference (see g_variant_ref_sink()), the new
32113  * instance takes ownership of @child.
32114  *
32115  * Returns: (transfer none): a floating reference to a new #GVariant maybe instance
32116  * Since: 2.24
32117  */
32118
32119
32120 /**
32121  * g_variant_new_object_path:
32122  * @object_path: a normal C nul-terminated string
32123  *
32124  * Creates a D-Bus object path #GVariant with the contents of @string.
32125  * @string must be a valid D-Bus object path.  Use
32126  * g_variant_is_object_path() if you're not sure.
32127  *
32128  * Returns: (transfer none): a floating reference to a new object path #GVariant instance
32129  * Since: 2.24
32130  */
32131
32132
32133 /**
32134  * g_variant_new_objv:
32135  * @strv: (array length=length) (element-type utf8): an array of strings
32136  * @length: the length of @strv, or -1
32137  *
32138  * Constructs an array of object paths #GVariant from the given array of
32139  * strings.
32140  *
32141  * Each string must be a valid #GVariant object path; see
32142  * g_variant_is_object_path().
32143  *
32144  * If @length is -1 then @strv is %NULL-terminated.
32145  *
32146  * Returns: (transfer none): a new floating #GVariant instance
32147  * Since: 2.30
32148  */
32149
32150
32151 /**
32152  * g_variant_new_parsed:
32153  * @format: a text format #GVariant
32154  * @...: arguments as per @format
32155  *
32156  * Parses @format and returns the result.
32157  *
32158  * @format must be a text format #GVariant with one extension: at any
32159  * point that a value may appear in the text, a '%' character followed
32160  * by a GVariant format string (as per g_variant_new()) may appear.  In
32161  * that case, the same arguments are collected from the argument list as
32162  * g_variant_new() would have collected.
32163  *
32164  * Consider this simple example:
32165  *
32166  * <informalexample><programlisting>
32167  *  g_variant_new_parsed ("[('one', 1), ('two', %i), (%s, 3)]", 2, "three");
32168  * </programlisting></informalexample>
32169  *
32170  * In the example, the variable argument parameters are collected and
32171  * filled in as if they were part of the original string to produce the
32172  * result of <code>[('one', 1), ('two', 2), ('three', 3)]</code>.
32173  *
32174  * This function is intended only to be used with @format as a string
32175  * literal.  Any parse error is fatal to the calling process.  If you
32176  * want to parse data from untrusted sources, use g_variant_parse().
32177  *
32178  * You may not use this function to return, unmodified, a single
32179  * #GVariant pointer from the argument list.  ie: @format may not solely
32180  * be anything along the lines of "%*", "%?", "\%r", or anything starting
32181  * with "%@".
32182  *
32183  * Returns: a new floating #GVariant instance
32184  */
32185
32186
32187 /**
32188  * g_variant_new_parsed_va:
32189  * @format: a text format #GVariant
32190  * @app: a pointer to a #va_list
32191  *
32192  * Parses @format and returns the result.
32193  *
32194  * This is the version of g_variant_new_parsed() intended to be used
32195  * from libraries.
32196  *
32197  * The return value will be floating if it was a newly created GVariant
32198  * instance.  In the case that @format simply specified the collection
32199  * of a #GVariant pointer (eg: @format was "%*") then the collected
32200  * #GVariant pointer will be returned unmodified, without adding any
32201  * additional references.
32202  *
32203  * In order to behave correctly in all cases it is necessary for the
32204  * calling function to g_variant_ref_sink() the return result before
32205  * returning control to the user that originally provided the pointer.
32206  * At this point, the caller will have their own full reference to the
32207  * result.  This can also be done by adding the result to a container,
32208  * or by passing it to another g_variant_new() call.
32209  *
32210  * Returns: a new, usually floating, #GVariant
32211  */
32212
32213
32214 /**
32215  * g_variant_new_signature:
32216  * @signature: a normal C nul-terminated string
32217  *
32218  * Creates a D-Bus type signature #GVariant with the contents of
32219  * @string.  @string must be a valid D-Bus type signature.  Use
32220  * g_variant_is_signature() if you're not sure.
32221  *
32222  * Returns: (transfer none): a floating reference to a new signature #GVariant instance
32223  * Since: 2.24
32224  */
32225
32226
32227 /**
32228  * g_variant_new_string:
32229  * @string: a normal utf8 nul-terminated string
32230  *
32231  * Creates a string #GVariant with the contents of @string.
32232  *
32233  * @string must be valid utf8.
32234  *
32235  * Returns: (transfer none): a floating reference to a new string #GVariant instance
32236  * Since: 2.24
32237  */
32238
32239
32240 /**
32241  * g_variant_new_strv:
32242  * @strv: (array length=length) (element-type utf8): an array of strings
32243  * @length: the length of @strv, or -1
32244  *
32245  * Constructs an array of strings #GVariant from the given array of
32246  * strings.
32247  *
32248  * If @length is -1 then @strv is %NULL-terminated.
32249  *
32250  * Returns: (transfer none): a new floating #GVariant instance
32251  * Since: 2.24
32252  */
32253
32254
32255 /**
32256  * g_variant_new_tuple:
32257  * @children: (array length=n_children): the items to make the tuple out of
32258  * @n_children: the length of @children
32259  *
32260  * Creates a new tuple #GVariant out of the items in @children.  The
32261  * type is determined from the types of @children.  No entry in the
32262  * @children array may be %NULL.
32263  *
32264  * If @n_children is 0 then the unit tuple is constructed.
32265  *
32266  * If the @children are floating references (see g_variant_ref_sink()), the
32267  * new instance takes ownership of them as if via g_variant_ref_sink().
32268  *
32269  * Returns: (transfer none): a floating reference to a new #GVariant tuple
32270  * Since: 2.24
32271  */
32272
32273
32274 /**
32275  * g_variant_new_uint16:
32276  * @value: a #guint16 value
32277  *
32278  * Creates a new uint16 #GVariant instance.
32279  *
32280  * Returns: (transfer none): a floating reference to a new uint16 #GVariant instance
32281  * Since: 2.24
32282  */
32283
32284
32285 /**
32286  * g_variant_new_uint32:
32287  * @value: a #guint32 value
32288  *
32289  * Creates a new uint32 #GVariant instance.
32290  *
32291  * Returns: (transfer none): a floating reference to a new uint32 #GVariant instance
32292  * Since: 2.24
32293  */
32294
32295
32296 /**
32297  * g_variant_new_uint64:
32298  * @value: a #guint64 value
32299  *
32300  * Creates a new uint64 #GVariant instance.
32301  *
32302  * Returns: (transfer none): a floating reference to a new uint64 #GVariant instance
32303  * Since: 2.24
32304  */
32305
32306
32307 /**
32308  * g_variant_new_va: (skip)
32309  * @format_string: a string that is prefixed with a format string
32310  * @endptr: (allow-none) (default NULL): location to store the end pointer, or %NULL
32311  * @app: a pointer to a #va_list
32312  *
32313  * This function is intended to be used by libraries based on
32314  * #GVariant that want to provide g_variant_new()-like functionality
32315  * to their users.
32316  *
32317  * The API is more general than g_variant_new() to allow a wider range
32318  * of possible uses.
32319  *
32320  * @format_string must still point to a valid format string, but it only
32321  * needs to be nul-terminated if @endptr is %NULL.  If @endptr is
32322  * non-%NULL then it is updated to point to the first character past the
32323  * end of the format string.
32324  *
32325  * @app is a pointer to a #va_list.  The arguments, according to
32326  * @format_string, are collected from this #va_list and the list is left
32327  * pointing to the argument following the last.
32328  *
32329  * These two generalisations allow mixing of multiple calls to
32330  * g_variant_new_va() and g_variant_get_va() within a single actual
32331  * varargs call by the user.
32332  *
32333  * The return value will be floating if it was a newly created GVariant
32334  * instance (for example, if the format string was "(ii)").  In the case
32335  * that the format_string was '*', '?', 'r', or a format starting with
32336  * '@' then the collected #GVariant pointer will be returned unmodified,
32337  * without adding any additional references.
32338  *
32339  * In order to behave correctly in all cases it is necessary for the
32340  * calling function to g_variant_ref_sink() the return result before
32341  * returning control to the user that originally provided the pointer.
32342  * At this point, the caller will have their own full reference to the
32343  * result.  This can also be done by adding the result to a container,
32344  * or by passing it to another g_variant_new() call.
32345  *
32346  * Returns: a new, usually floating, #GVariant
32347  * Since: 2.24
32348  */
32349
32350
32351 /**
32352  * g_variant_new_variant: (constructor)
32353  * @value: a #GVariant instance
32354  *
32355  * Boxes @value.  The result is a #GVariant instance representing a
32356  * variant containing the original value.
32357  *
32358  * If @child is a floating reference (see g_variant_ref_sink()), the new
32359  * instance takes ownership of @child.
32360  *
32361  * Returns: (transfer none): a floating reference to a new variant #GVariant instance
32362  * Since: 2.24
32363  */
32364
32365
32366 /**
32367  * g_variant_parse:
32368  * @type: (allow-none): a #GVariantType, or %NULL
32369  * @text: a string containing a GVariant in text form
32370  * @limit: (allow-none): a pointer to the end of @text, or %NULL
32371  * @endptr: (allow-none): a location to store the end pointer, or %NULL
32372  * @error: (allow-none): a pointer to a %NULL #GError pointer, or %NULL
32373  *
32374  * Parses a #GVariant from a text representation.
32375  *
32376  * A single #GVariant is parsed from the content of @text.
32377  *
32378  * The format is described <link linkend='gvariant-text'>here</link>.
32379  *
32380  * The memory at @limit will never be accessed and the parser behaves as
32381  * if the character at @limit is the nul terminator.  This has the
32382  * effect of bounding @text.
32383  *
32384  * If @endptr is non-%NULL then @text is permitted to contain data
32385  * following the value that this function parses and @endptr will be
32386  * updated to point to the first character past the end of the text
32387  * parsed by this function.  If @endptr is %NULL and there is extra data
32388  * then an error is returned.
32389  *
32390  * If @type is non-%NULL then the value will be parsed to have that
32391  * type.  This may result in additional parse errors (in the case that
32392  * the parsed value doesn't fit the type) but may also result in fewer
32393  * errors (in the case that the type would have been ambiguous, such as
32394  * with empty arrays).
32395  *
32396  * In the event that the parsing is successful, the resulting #GVariant
32397  * is returned.
32398  *
32399  * In case of any error, %NULL will be returned.  If @error is non-%NULL
32400  * then it will be set to reflect the error that occurred.
32401  *
32402  * Officially, the language understood by the parser is "any string
32403  * produced by g_variant_print()".
32404  *
32405  * Returns: a reference to a #GVariant, or %NULL
32406  */
32407
32408
32409 /**
32410  * g_variant_print:
32411  * @value: a #GVariant
32412  * @type_annotate: %TRUE if type information should be included in the output
32413  *
32414  * Pretty-prints @value in the format understood by g_variant_parse().
32415  *
32416  * The format is described <link linkend='gvariant-text'>here</link>.
32417  *
32418  * If @type_annotate is %TRUE, then type information is included in
32419  * the output.
32420  *
32421  * Returns: (transfer full): a newly-allocated string holding the result.
32422  * Since: 2.24
32423  */
32424
32425
32426 /**
32427  * g_variant_print_string: (skip)
32428  * @value: a #GVariant
32429  * @string: (allow-none) (default NULL): a #GString, or %NULL
32430  * @type_annotate: %TRUE if type information should be included in the output
32431  *
32432  * Behaves as g_variant_print(), but operates on a #GString.
32433  *
32434  * If @string is non-%NULL then it is appended to and returned.  Else,
32435  * a new empty #GString is allocated and it is returned.
32436  *
32437  * Returns: a #GString containing the string
32438  * Since: 2.24
32439  */
32440
32441
32442 /**
32443  * g_variant_ref:
32444  * @value: a #GVariant
32445  *
32446  * Increases the reference count of @value.
32447  *
32448  * Returns: the same @value
32449  * Since: 2.24
32450  */
32451
32452
32453 /**
32454  * g_variant_ref_sink:
32455  * @value: a #GVariant
32456  *
32457  * #GVariant uses a floating reference count system.  All functions with
32458  * names starting with <literal>g_variant_new_</literal> return floating
32459  * references.
32460  *
32461  * Calling g_variant_ref_sink() on a #GVariant with a floating reference
32462  * will convert the floating reference into a full reference.  Calling
32463  * g_variant_ref_sink() on a non-floating #GVariant results in an
32464  * additional normal reference being added.
32465  *
32466  * In other words, if the @value is floating, then this call "assumes
32467  * ownership" of the floating reference, converting it to a normal
32468  * reference.  If the @value is not floating, then this call adds a
32469  * new normal reference increasing the reference count by one.
32470  *
32471  * All calls that result in a #GVariant instance being inserted into a
32472  * container will call g_variant_ref_sink() on the instance.  This means
32473  * that if the value was just created (and has only its floating
32474  * reference) then the container will assume sole ownership of the value
32475  * at that point and the caller will not need to unreference it.  This
32476  * makes certain common styles of programming much easier while still
32477  * maintaining normal refcounting semantics in situations where values
32478  * are not floating.
32479  *
32480  * Returns: the same @value
32481  * Since: 2.24
32482  */
32483
32484
32485 /**
32486  * g_variant_store:
32487  * @value: the #GVariant to store
32488  * @data: the location to store the serialised data at
32489  *
32490  * Stores the serialised form of @value at @data.  @data should be
32491  * large enough.  See g_variant_get_size().
32492  *
32493  * The stored data is in machine native byte order but may not be in
32494  * fully-normalised form if read from an untrusted source.  See
32495  * g_variant_get_normal_form() for a solution.
32496  *
32497  * As with g_variant_get_data(), to be able to deserialise the
32498  * serialised variant successfully, its type and (if the destination
32499  * machine might be different) its endianness must also be available.
32500  *
32501  * This function is approximately O(n) in the size of @data.
32502  *
32503  * Since: 2.24
32504  */
32505
32506
32507 /**
32508  * g_variant_take_ref:
32509  * @value: a #GVariant
32510  *
32511  * If @value is floating, sink it.  Otherwise, do nothing.
32512  *
32513  * Typically you want to use g_variant_ref_sink() in order to
32514  * automatically do the correct thing with respect to floating or
32515  * non-floating references, but there is one specific scenario where
32516  * this function is helpful.
32517  *
32518  * The situation where this function is helpful is when creating an API
32519  * that allows the user to provide a callback function that returns a
32520  * #GVariant.  We certainly want to allow the user the flexibility to
32521  * return a non-floating reference from this callback (for the case
32522  * where the value that is being returned already exists).
32523  *
32524  * At the same time, the style of the #GVariant API makes it likely that
32525  * for newly-created #GVariant instances, the user can be saved some
32526  * typing if they are allowed to return a #GVariant with a floating
32527  * reference.
32528  *
32529  * Using this function on the return value of the user's callback allows
32530  * the user to do whichever is more convenient for them.  The caller
32531  * will alway receives exactly one full reference to the value: either
32532  * the one that was returned in the first place, or a floating reference
32533  * that has been converted to a full reference.
32534  *
32535  * This function has an odd interaction when combined with
32536  * g_variant_ref_sink() running at the same time in another thread on
32537  * the same #GVariant instance.  If g_variant_ref_sink() runs first then
32538  * the result will be that the floating reference is converted to a hard
32539  * reference.  If g_variant_take_ref() runs first then the result will
32540  * be that the floating reference is converted to a hard reference and
32541  * an additional reference on top of that one is added.  It is best to
32542  * avoid this situation.
32543  *
32544  * Returns: the same @value
32545  */
32546
32547
32548 /**
32549  * g_variant_type_copy:
32550  * @type: a #GVariantType
32551  *
32552  * Makes a copy of a #GVariantType.  It is appropriate to call
32553  * g_variant_type_free() on the return value.  @type may not be %NULL.
32554  *
32555  * Returns: (transfer full): a new #GVariantType  Since 2.24
32556  */
32557
32558
32559 /**
32560  * g_variant_type_dup_string:
32561  * @type: a #GVariantType
32562  *
32563  * Returns a newly-allocated copy of the type string corresponding to
32564  * @type.  The returned string is nul-terminated.  It is appropriate to
32565  * call g_free() on the return value.
32566  *
32567  * Returns: (transfer full): the corresponding type string  Since 2.24
32568  */
32569
32570
32571 /**
32572  * g_variant_type_element:
32573  * @type: an array or maybe #GVariantType
32574  *
32575  * Determines the element type of an array or maybe type.
32576  *
32577  * This function may only be used with array or maybe types.
32578  *
32579  * Returns: (transfer none): the element type of @type  Since 2.24
32580  */
32581
32582
32583 /**
32584  * g_variant_type_equal:
32585  * @type1: (type GVariantType): a #GVariantType
32586  * @type2: (type GVariantType): a #GVariantType
32587  *
32588  * Compares @type1 and @type2 for equality.
32589  *
32590  * Only returns %TRUE if the types are exactly equal.  Even if one type
32591  * is an indefinite type and the other is a subtype of it, %FALSE will
32592  * be returned if they are not exactly equal.  If you want to check for
32593  * subtypes, use g_variant_type_is_subtype_of().
32594  *
32595  * The argument types of @type1 and @type2 are only #gconstpointer to
32596  * allow use with #GHashTable without function pointer casting.  For
32597  * both arguments, a valid #GVariantType must be provided.
32598  *
32599  * Returns: %TRUE if @type1 and @type2 are exactly equal  Since 2.24
32600  */
32601
32602
32603 /**
32604  * g_variant_type_first:
32605  * @type: a tuple or dictionary entry #GVariantType
32606  *
32607  * Determines the first item type of a tuple or dictionary entry
32608  * type.
32609  *
32610  * This function may only be used with tuple or dictionary entry types,
32611  * but must not be used with the generic tuple type
32612  * %G_VARIANT_TYPE_TUPLE.
32613  *
32614  * In the case of a dictionary entry type, this returns the type of
32615  * the key.
32616  *
32617  * %NULL is returned in case of @type being %G_VARIANT_TYPE_UNIT.
32618  *
32619  * This call, together with g_variant_type_next() provides an iterator
32620  * interface over tuple and dictionary entry types.
32621  *
32622  * Returns: (transfer none): the first item type of @type, or %NULL  Since 2.24
32623  */
32624
32625
32626 /**
32627  * g_variant_type_free:
32628  * @type: (allow-none): a #GVariantType, or %NULL
32629  *
32630  * Frees a #GVariantType that was allocated with
32631  * g_variant_type_copy(), g_variant_type_new() or one of the container
32632  * type constructor functions.
32633  *
32634  * In the case that @type is %NULL, this function does nothing.
32635  *
32636  * Since 2.24
32637  */
32638
32639
32640 /**
32641  * g_variant_type_get_string_length:
32642  * @type: a #GVariantType
32643  *
32644  * Returns the length of the type string corresponding to the given
32645  * @type.  This function must be used to determine the valid extent of
32646  * the memory region returned by g_variant_type_peek_string().
32647  *
32648  * Returns: the length of the corresponding type string  Since 2.24
32649  */
32650
32651
32652 /**
32653  * g_variant_type_hash:
32654  * @type: (type GVariantType): a #GVariantType
32655  *
32656  * Hashes @type.
32657  *
32658  * The argument type of @type is only #gconstpointer to allow use with
32659  * #GHashTable without function pointer casting.  A valid
32660  * #GVariantType must be provided.
32661  *
32662  * Returns: the hash value  Since 2.24
32663  */
32664
32665
32666 /**
32667  * g_variant_type_is_array:
32668  * @type: a #GVariantType
32669  *
32670  * Determines if the given @type is an array type.  This is true if the
32671  * type string for @type starts with an 'a'.
32672  *
32673  * This function returns %TRUE for any indefinite type for which every
32674  * definite subtype is an array type -- %G_VARIANT_TYPE_ARRAY, for
32675  * example.
32676  *
32677  * Returns: %TRUE if @type is an array type  Since 2.24
32678  */
32679
32680
32681 /**
32682  * g_variant_type_is_basic:
32683  * @type: a #GVariantType
32684  *
32685  * Determines if the given @type is a basic type.
32686  *
32687  * Basic types are booleans, bytes, integers, doubles, strings, object
32688  * paths and signatures.
32689  *
32690  * Only a basic type may be used as the key of a dictionary entry.
32691  *
32692  * This function returns %FALSE for all indefinite types except
32693  * %G_VARIANT_TYPE_BASIC.
32694  *
32695  * Returns: %TRUE if @type is a basic type  Since 2.24
32696  */
32697
32698
32699 /**
32700  * g_variant_type_is_container:
32701  * @type: a #GVariantType
32702  *
32703  * Determines if the given @type is a container type.
32704  *
32705  * Container types are any array, maybe, tuple, or dictionary
32706  * entry types plus the variant type.
32707  *
32708  * This function returns %TRUE for any indefinite type for which every
32709  * definite subtype is a container -- %G_VARIANT_TYPE_ARRAY, for
32710  * example.
32711  *
32712  * Returns: %TRUE if @type is a container type  Since 2.24
32713  */
32714
32715
32716 /**
32717  * g_variant_type_is_definite:
32718  * @type: a #GVariantType
32719  *
32720  * Determines if the given @type is definite (ie: not indefinite).
32721  *
32722  * A type is definite if its type string does not contain any indefinite
32723  * type characters ('*', '?', or 'r').
32724  *
32725  * A #GVariant instance may not have an indefinite type, so calling
32726  * this function on the result of g_variant_get_type() will always
32727  * result in %TRUE being returned.  Calling this function on an
32728  * indefinite type like %G_VARIANT_TYPE_ARRAY, however, will result in
32729  * %FALSE being returned.
32730  *
32731  * Returns: %TRUE if @type is definite  Since 2.24
32732  */
32733
32734
32735 /**
32736  * g_variant_type_is_dict_entry:
32737  * @type: a #GVariantType
32738  *
32739  * Determines if the given @type is a dictionary entry type.  This is
32740  * true if the type string for @type starts with a '{'.
32741  *
32742  * This function returns %TRUE for any indefinite type for which every
32743  * definite subtype is a dictionary entry type --
32744  * %G_VARIANT_TYPE_DICT_ENTRY, for example.
32745  *
32746  * Returns: %TRUE if @type is a dictionary entry type  Since 2.24
32747  */
32748
32749
32750 /**
32751  * g_variant_type_is_maybe:
32752  * @type: a #GVariantType
32753  *
32754  * Determines if the given @type is a maybe type.  This is true if the
32755  * type string for @type starts with an 'm'.
32756  *
32757  * This function returns %TRUE for any indefinite type for which every
32758  * definite subtype is a maybe type -- %G_VARIANT_TYPE_MAYBE, for
32759  * example.
32760  *
32761  * Returns: %TRUE if @type is a maybe type  Since 2.24
32762  */
32763
32764
32765 /**
32766  * g_variant_type_is_subtype_of:
32767  * @type: a #GVariantType
32768  * @supertype: a #GVariantType
32769  *
32770  * Checks if @type is a subtype of @supertype.
32771  *
32772  * This function returns %TRUE if @type is a subtype of @supertype.  All
32773  * types are considered to be subtypes of themselves.  Aside from that,
32774  * only indefinite types can have subtypes.
32775  *
32776  * Returns: %TRUE if @type is a subtype of @supertype  Since 2.24
32777  */
32778
32779
32780 /**
32781  * g_variant_type_is_tuple:
32782  * @type: a #GVariantType
32783  *
32784  * Determines if the given @type is a tuple type.  This is true if the
32785  * type string for @type starts with a '(' or if @type is
32786  * %G_VARIANT_TYPE_TUPLE.
32787  *
32788  * This function returns %TRUE for any indefinite type for which every
32789  * definite subtype is a tuple type -- %G_VARIANT_TYPE_TUPLE, for
32790  * example.
32791  *
32792  * Returns: %TRUE if @type is a tuple type  Since 2.24
32793  */
32794
32795
32796 /**
32797  * g_variant_type_is_variant:
32798  * @type: a #GVariantType
32799  *
32800  * Determines if the given @type is the variant type.
32801  *
32802  * Returns: %TRUE if @type is the variant type  Since 2.24
32803  */
32804
32805
32806 /**
32807  * g_variant_type_key:
32808  * @type: a dictionary entry #GVariantType
32809  *
32810  * Determines the key type of a dictionary entry type.
32811  *
32812  * This function may only be used with a dictionary entry type.  Other
32813  * than the additional restriction, this call is equivalent to
32814  * g_variant_type_first().
32815  *
32816  * Returns: (transfer none): the key type of the dictionary entry  Since 2.24
32817  */
32818
32819
32820 /**
32821  * g_variant_type_n_items:
32822  * @type: a tuple or dictionary entry #GVariantType
32823  *
32824  * Determines the number of items contained in a tuple or
32825  * dictionary entry type.
32826  *
32827  * This function may only be used with tuple or dictionary entry types,
32828  * but must not be used with the generic tuple type
32829  * %G_VARIANT_TYPE_TUPLE.
32830  *
32831  * In the case of a dictionary entry type, this function will always
32832  * return 2.
32833  *
32834  * Returns: the number of items in @type  Since 2.24
32835  */
32836
32837
32838 /**
32839  * g_variant_type_new:
32840  * @type_string: a valid GVariant type string
32841  *
32842  * Creates a new #GVariantType corresponding to the type string given
32843  * by @type_string.  It is appropriate to call g_variant_type_free() on
32844  * the return value.
32845  *
32846  * It is a programmer error to call this function with an invalid type
32847  * string.  Use g_variant_type_string_is_valid() if you are unsure.
32848  *
32849  * Returns: (transfer full): a new #GVariantType
32850  * Since: 2.24
32851  */
32852
32853
32854 /**
32855  * g_variant_type_new_array: (constructor)
32856  * @element: a #GVariantType
32857  *
32858  * Constructs the type corresponding to an array of elements of the
32859  * type @type.
32860  *
32861  * It is appropriate to call g_variant_type_free() on the return value.
32862  *
32863  * Returns: (transfer full): a new array #GVariantType  Since 2.24
32864  */
32865
32866
32867 /**
32868  * g_variant_type_new_dict_entry: (constructor)
32869  * @key: a basic #GVariantType
32870  * @value: a #GVariantType
32871  *
32872  * Constructs the type corresponding to a dictionary entry with a key
32873  * of type @key and a value of type @value.
32874  *
32875  * It is appropriate to call g_variant_type_free() on the return value.
32876  *
32877  * Returns: (transfer full): a new dictionary entry #GVariantType  Since 2.24
32878  */
32879
32880
32881 /**
32882  * g_variant_type_new_maybe: (constructor)
32883  * @element: a #GVariantType
32884  *
32885  * Constructs the type corresponding to a maybe instance containing
32886  * type @type or Nothing.
32887  *
32888  * It is appropriate to call g_variant_type_free() on the return value.
32889  *
32890  * Returns: (transfer full): a new maybe #GVariantType  Since 2.24
32891  */
32892
32893
32894 /**
32895  * g_variant_type_new_tuple:
32896  * @items: (array length=length): an array of #GVariantTypes, one for each item
32897  * @length: the length of @items, or -1
32898  *
32899  * Constructs a new tuple type, from @items.
32900  *
32901  * @length is the number of items in @items, or -1 to indicate that
32902  * @items is %NULL-terminated.
32903  *
32904  * It is appropriate to call g_variant_type_free() on the return value.
32905  *
32906  * Returns: (transfer full): a new tuple #GVariantType  Since 2.24
32907  */
32908
32909
32910 /**
32911  * g_variant_type_next:
32912  * @type: a #GVariantType from a previous call
32913  *
32914  * Determines the next item type of a tuple or dictionary entry
32915  * type.
32916  *
32917  * @type must be the result of a previous call to
32918  * g_variant_type_first() or g_variant_type_next().
32919  *
32920  * If called on the key type of a dictionary entry then this call
32921  * returns the value type.  If called on the value type of a dictionary
32922  * entry then this call returns %NULL.
32923  *
32924  * For tuples, %NULL is returned when @type is the last item in a tuple.
32925  *
32926  * Returns: (transfer none): the next #GVariantType after @type, or %NULL  Since 2.24
32927  */
32928
32929
32930 /**
32931  * g_variant_type_peek_string: (skip)
32932  * @type: a #GVariantType
32933  *
32934  * Returns the type string corresponding to the given @type.  The
32935  * result is not nul-terminated; in order to determine its length you
32936  * must call g_variant_type_get_string_length().
32937  *
32938  * To get a nul-terminated string, see g_variant_type_dup_string().
32939  *
32940  * Returns: the corresponding type string (not nul-terminated)  Since 2.24
32941  */
32942
32943
32944 /**
32945  * g_variant_type_string_is_valid:
32946  * @type_string: a pointer to any string
32947  *
32948  * Checks if @type_string is a valid GVariant type string.  This call is
32949  * equivalent to calling g_variant_type_string_scan() and confirming
32950  * that the following character is a nul terminator.
32951  *
32952  * Returns: %TRUE if @type_string is exactly one valid type string  Since 2.24
32953  */
32954
32955
32956 /**
32957  * g_variant_type_string_scan:
32958  * @string: a pointer to any string
32959  * @limit: (allow-none): the end of @string, or %NULL
32960  * @endptr: (out) (allow-none): location to store the end pointer, or %NULL
32961  *
32962  * Scan for a single complete and valid GVariant type string in @string.
32963  * The memory pointed to by @limit (or bytes beyond it) is never
32964  * accessed.
32965  *
32966  * If a valid type string is found, @endptr is updated to point to the
32967  * first character past the end of the string that was found and %TRUE
32968  * is returned.
32969  *
32970  * If there is no valid type string starting at @string, or if the type
32971  * string does not end before @limit then %FALSE is returned.
32972  *
32973  * For the simple case of checking if a string is a valid type string,
32974  * see g_variant_type_string_is_valid().
32975  *
32976  * Returns: %TRUE if a valid type string was found
32977  * Since: 2.24
32978  */
32979
32980
32981 /**
32982  * g_variant_type_value:
32983  * @type: a dictionary entry #GVariantType
32984  *
32985  * Determines the value type of a dictionary entry type.
32986  *
32987  * This function may only be used with a dictionary entry type.
32988  *
32989  * Returns: (transfer none): the value type of the dictionary entry  Since 2.24
32990  */
32991
32992
32993 /**
32994  * g_variant_unref:
32995  * @value: a #GVariant
32996  *
32997  * Decreases the reference count of @value.  When its reference count
32998  * drops to 0, the memory used by the variant is freed.
32999  *
33000  * Since: 2.24
33001  */
33002
33003
33004 /**
33005  * g_vasprintf:
33006  * @string: the return location for the newly-allocated string.
33007  * @format: a standard printf() format string, but notice <link linkend="string-precision">string precision pitfalls</link>.
33008  * @args: the list of arguments to insert in the output.
33009  *
33010  * An implementation of the GNU vasprintf() function which supports
33011  * positional parameters, as specified in the Single Unix Specification.
33012  * This function is similar to g_vsprintf(), except that it allocates a
33013  * string to hold the output, instead of putting the output in a buffer
33014  * you allocate in advance.
33015  *
33016  * Returns: the number of bytes printed.
33017  * Since: 2.4
33018  */
33019
33020
33021 /**
33022  * g_vfprintf:
33023  * @file: the stream to write to.
33024  * @format: a standard printf() format string, but notice <link linkend="string-precision">string precision pitfalls</link>.
33025  * @args: the list of arguments to insert in the output.
33026  *
33027  * An implementation of the standard fprintf() function which supports
33028  * positional parameters, as specified in the Single Unix Specification.
33029  *
33030  * Returns: the number of bytes printed.
33031  * Since: 2.2
33032  */
33033
33034
33035 /**
33036  * g_vprintf:
33037  * @format: a standard printf() format string, but notice <link linkend="string-precision">string precision pitfalls</link>.
33038  * @args: the list of arguments to insert in the output.
33039  *
33040  * An implementation of the standard vprintf() function which supports
33041  * positional parameters, as specified in the Single Unix Specification.
33042  *
33043  * Returns: the number of bytes printed.
33044  * Since: 2.2
33045  */
33046
33047
33048 /**
33049  * g_vsnprintf:
33050  * @string: the buffer to hold the output.
33051  * @n: the maximum number of bytes to produce (including the terminating nul character).
33052  * @format: a standard printf() format string, but notice <link linkend="string-precision">string precision pitfalls</link>.
33053  * @args: the list of arguments to insert in the output.
33054  *
33055  * A safer form of the standard vsprintf() function. The output is guaranteed
33056  * to not exceed @n characters (including the terminating nul character), so
33057  * it is easy to ensure that a buffer overflow cannot occur.
33058  *
33059  * See also g_strdup_vprintf().
33060  *
33061  * In versions of GLib prior to 1.2.3, this function may return -1 if the
33062  * output was truncated, and the truncated string may not be nul-terminated.
33063  * In versions prior to 1.3.12, this function returns the length of the output
33064  * string.
33065  *
33066  * The return value of g_vsnprintf() conforms to the vsnprintf() function
33067  * as standardized in ISO C99. Note that this is different from traditional
33068  * vsnprintf(), which returns the length of the output string.
33069  *
33070  * The format string may contain positional parameters, as specified in
33071  * the Single Unix Specification.
33072  *
33073  * Returns: the number of bytes which would be produced if the buffer was large enough.
33074  */
33075
33076
33077 /**
33078  * g_vsprintf:
33079  * @string: the buffer to hold the output.
33080  * @format: a standard printf() format string, but notice <link linkend="string-precision">string precision pitfalls</link>.
33081  * @args: the list of arguments to insert in the output.
33082  *
33083  * An implementation of the standard vsprintf() function which supports
33084  * positional parameters, as specified in the Single Unix Specification.
33085  *
33086  * Returns: the number of bytes printed.
33087  * Since: 2.2
33088  */
33089
33090
33091 /**
33092  * g_wakeup_acknowledge:
33093  * @wakeup: a #GWakeup
33094  *
33095  * Acknowledges receipt of a wakeup signal on @wakeup.
33096  *
33097  * You must call this after @wakeup polls as ready.  If not, it will
33098  * continue to poll as ready until you do so.
33099  *
33100  * If you call this function and @wakeup is not signaled, nothing
33101  * happens.
33102  *
33103  * Since: 2.30
33104  */
33105
33106
33107 /**
33108  * g_wakeup_free:
33109  * @wakeup: a #GWakeup
33110  *
33111  * Frees @wakeup.
33112  *
33113  * You must not currently be polling on the #GPollFD returned by
33114  * g_wakeup_get_pollfd(), or the result is undefined.
33115  */
33116
33117
33118 /**
33119  * g_wakeup_get_pollfd:
33120  * @wakeup: a #GWakeup
33121  * @poll_fd: a #GPollFD
33122  *
33123  * Prepares a @poll_fd such that polling on it will succeed when
33124  * g_wakeup_signal() has been called on @wakeup.
33125  *
33126  * @poll_fd is valid until @wakeup is freed.
33127  *
33128  * Since: 2.30
33129  */
33130
33131
33132 /**
33133  * g_wakeup_new:
33134  *
33135  * Creates a new #GWakeup.
33136  *
33137  * You should use g_wakeup_free() to free it when you are done.
33138  *
33139  * Returns: a new #GWakeup
33140  * Since: 2.30
33141  */
33142
33143
33144 /**
33145  * g_wakeup_signal:
33146  * @wakeup: a #GWakeup
33147  *
33148  * Signals @wakeup.
33149  *
33150  * Any future (or present) polling on the #GPollFD returned by
33151  * g_wakeup_get_pollfd() will immediately succeed until such a time as
33152  * g_wakeup_acknowledge() is called.
33153  *
33154  * This function is safe to call from a UNIX signal handler.
33155  *
33156  * Since: 2.30
33157  */
33158
33159
33160 /**
33161  * g_warning:
33162  * @...: format string, followed by parameters to insert into the format string (as with printf())
33163  *
33164  * A convenience function/macro to log a warning message.
33165  *
33166  * You can make warnings fatal at runtime by setting the
33167  * <envar>G_DEBUG</envar> environment variable (see
33168  * <ulink url="glib-running.html">Running GLib Applications</ulink>).
33169  */
33170
33171
33172 /**
33173  * g_win32_error_message:
33174  * @error: error code.
33175  *
33176  * Translate a Win32 error code (as returned by GetLastError()) into
33177  * the corresponding message. The message is either language neutral,
33178  * or in the thread's language, or the user's language, the system's
33179  * language, or US English (see docs for FormatMessage()). The
33180  * returned string is in UTF-8. It should be deallocated with
33181  * g_free().
33182  *
33183  * Returns: newly-allocated error message
33184  */
33185
33186
33187 /**
33188  * g_win32_get_package_installation_directory:
33189  * @package: (allow-none): You should pass %NULL for this.
33190  * @dll_name: (allow-none): The name of a DLL that a package provides in UTF-8, or %NULL.
33191  *
33192  * Try to determine the installation directory for a software package.
33193  *
33194  * This function is deprecated. Use
33195  * g_win32_get_package_installation_directory_of_module() instead.
33196  *
33197  * The use of @package is deprecated. You should always pass %NULL. A
33198  * warning is printed if non-NULL is passed as @package.
33199  *
33200  * The original intended use of @package was for a short identifier of
33201  * the package, typically the same identifier as used for
33202  * <literal>GETTEXT_PACKAGE</literal> in software configured using GNU
33203  * autotools. The function first looks in the Windows Registry for the
33204  * value <literal>&num;InstallationDirectory</literal> in the key
33205  * <literal>&num;HKLM\Software\@package</literal>, and if that value
33206  * exists and is a string, returns that.
33207  *
33208  * It is strongly recommended that packagers of GLib-using libraries
33209  * for Windows do not store installation paths in the Registry to be
33210  * used by this function as that interfers with having several
33211  * parallel installations of the library. Enabling multiple
33212  * installations of different versions of some GLib-using library, or
33213  * GLib itself, is desirable for various reasons.
33214  *
33215  * For this reason it is recommeded to always pass %NULL as
33216  * @package to this function, to avoid the temptation to use the
33217  * Registry. In version 2.20 of GLib the @package parameter
33218  * will be ignored and this function won't look in the Registry at all.
33219  *
33220  * If @package is %NULL, or the above value isn't found in the
33221  * Registry, but @dll_name is non-%NULL, it should name a DLL loaded
33222  * into the current process. Typically that would be the name of the
33223  * DLL calling this function, looking for its installation
33224  * directory. The function then asks Windows what directory that DLL
33225  * was loaded from. If that directory's last component is "bin" or
33226  * "lib", the parent directory is returned, otherwise the directory
33227  * itself. If that DLL isn't loaded, the function proceeds as if
33228  * @dll_name was %NULL.
33229  *
33230  * If both @package and @dll_name are %NULL, the directory from where
33231  * the main executable of the process was loaded is used instead in
33232  * the same way as above.
33233  *
33234  * 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.
33235  * Deprecated: 2.18: Pass the HMODULE of a DLL or EXE to g_win32_get_package_installation_directory_of_module() instead.
33236  */
33237
33238
33239 /**
33240  * g_win32_get_package_installation_directory_of_module:
33241  * @hmodule: (allow-none): The Win32 handle for a DLL loaded into the current process, or %NULL
33242  *
33243  * This function tries to determine the installation directory of a
33244  * software package based on the location of a DLL of the software
33245  * package.
33246  *
33247  * @hmodule should be the handle of a loaded DLL or %NULL. The
33248  * function looks up the directory that DLL was loaded from. If
33249  * @hmodule is NULL, the directory the main executable of the current
33250  * process is looked up. If that directory's last component is "bin"
33251  * or "lib", its parent directory is returned, otherwise the directory
33252  * itself.
33253  *
33254  * It thus makes sense to pass only the handle to a "public" DLL of a
33255  * software package to this function, as such DLLs typically are known
33256  * to be installed in a "bin" or occasionally "lib" subfolder of the
33257  * installation folder. DLLs that are of the dynamically loaded module
33258  * or plugin variety are often located in more private locations
33259  * deeper down in the tree, from which it is impossible for GLib to
33260  * deduce the root of the package installation.
33261  *
33262  * The typical use case for this function is to have a DllMain() that
33263  * saves the handle for the DLL. Then when code in the DLL needs to
33264  * construct names of files in the installation tree it calls this
33265  * function passing the DLL handle.
33266  *
33267  * 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.
33268  * Since: 2.16
33269  */
33270
33271
33272 /**
33273  * g_win32_get_package_installation_subdirectory:
33274  * @package: (allow-none): You should pass %NULL for this.
33275  * @dll_name: (allow-none): The name of a DLL that a package provides, in UTF-8, or %NULL.
33276  * @subdir: A subdirectory of the package installation directory, also in UTF-8
33277  *
33278  * This function is deprecated. Use
33279  * g_win32_get_package_installation_directory_of_module() and
33280  * g_build_filename() instead.
33281  *
33282  * Returns a newly-allocated string containing the path of the
33283  * subdirectory @subdir in the return value from calling
33284  * g_win32_get_package_installation_directory() with the @package and
33285  * @dll_name parameters. See the documentation for
33286  * g_win32_get_package_installation_directory() for more details. In
33287  * particular, note that it is deprecated to pass anything except NULL
33288  * as @package.
33289  *
33290  * 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.
33291  * 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().
33292  */
33293
33294
33295 /**
33296  * g_win32_get_windows_version:
33297  *
33298  * Returns version information for the Windows operating system the
33299  * code is running on. See MSDN documentation for the GetVersion()
33300  * function. To summarize, the most significant bit is one on Win9x,
33301  * and zero on NT-based systems. Since version 2.14, GLib works only
33302  * on NT-based systems, so checking whether your are running on Win9x
33303  * in your own software is moot. The least significant byte is 4 on
33304  * Windows NT 4, and 5 on Windows XP. Software that needs really
33305  * detailed version and feature information should use Win32 API like
33306  * GetVersionEx() and VerifyVersionInfo().
33307  *
33308  * Returns: The version information.
33309  * Since: 2.6
33310  */
33311
33312
33313 /**
33314  * g_win32_getlocale:
33315  *
33316  * The setlocale() function in the Microsoft C library uses locale
33317  * names of the form "English_United States.1252" etc. We want the
33318  * UNIXish standard form "en_US", "zh_TW" etc. This function gets the
33319  * current thread locale from Windows - without any encoding info -
33320  * and returns it as a string of the above form for use in forming
33321  * file names etc. The returned string should be deallocated with
33322  * g_free().
33323  *
33324  * Returns: newly-allocated locale name.
33325  */
33326
33327
33328 /**
33329  * g_win32_locale_filename_from_utf8:
33330  * @utf8filename: a UTF-8 encoded filename.
33331  *
33332  * Converts a filename from UTF-8 to the system codepage.
33333  *
33334  * On NT-based Windows, on NTFS file systems, file names are in
33335  * Unicode. It is quite possible that Unicode file names contain
33336  * characters not representable in the system codepage. (For instance,
33337  * Greek or Cyrillic characters on Western European or US Windows
33338  * installations, or various less common CJK characters on CJK Windows
33339  * installations.)
33340  *
33341  * In such a case, and if the filename refers to an existing file, and
33342  * the file system stores alternate short (8.3) names for directory
33343  * entries, the short form of the filename is returned. Note that the
33344  * "short" name might in fact be longer than the Unicode name if the
33345  * Unicode name has very short pathname components containing
33346  * non-ASCII characters. If no system codepage name for the file is
33347  * possible, %NULL is returned.
33348  *
33349  * The return value is dynamically allocated and should be freed with
33350  * g_free() when no longer needed.
33351  *
33352  * Returns: The converted filename, or %NULL on conversion failure and lack of short names.
33353  * Since: 2.8
33354  */
33355
33356
33357 /**
33358  * gboolean:
33359  *
33360  * A standard boolean type.
33361  * Variables of this type should only contain the value
33362  * %TRUE or %FALSE.
33363  */
33364
33365
33366 /**
33367  * gchar:
33368  *
33369  * Corresponds to the standard C <type>char</type> type.
33370  */
33371
33372
33373 /**
33374  * gconstpointer:
33375  *
33376  * An untyped pointer to constant data.
33377  * The data pointed to should not be changed.
33378  *
33379  * This is typically used in function prototypes to indicate
33380  * that the data pointed to will not be altered by the function.
33381  */
33382
33383
33384 /**
33385  * gdouble:
33386  *
33387  * Corresponds to the standard C <type>double</type> type.
33388  * Values of this type can range from -#G_MAXDOUBLE to #G_MAXDOUBLE.
33389  */
33390
33391
33392 /**
33393  * gfloat:
33394  *
33395  * Corresponds to the standard C <type>float</type> type.
33396  * Values of this type can range from -#G_MAXFLOAT to #G_MAXFLOAT.
33397  */
33398
33399
33400 /**
33401  * gint:
33402  *
33403  * Corresponds to the standard C <type>int</type> type.
33404  * Values of this type can range from #G_MININT to #G_MAXINT.
33405  */
33406
33407
33408 /**
33409  * gint16:
33410  *
33411  * A signed integer guaranteed to be 16 bits on all platforms.
33412  * Values of this type can range from #G_MININT16 (= -32,768) to
33413  * #G_MAXINT16 (= 32,767).
33414  *
33415  * To print or scan values of this type, use
33416  * %G_GINT16_MODIFIER and/or %G_GINT16_FORMAT.
33417  */
33418
33419
33420 /**
33421  * gint32:
33422  *
33423  * A signed integer guaranteed to be 32 bits on all platforms.
33424  * Values of this type can range from #G_MININT32 (= -2,147,483,648)
33425  * to #G_MAXINT32 (= 2,147,483,647).
33426  *
33427  * To print or scan values of this type, use
33428  * %G_GINT32_MODIFIER and/or %G_GINT32_FORMAT.
33429  */
33430
33431
33432 /**
33433  * gint64:
33434  *
33435  * A signed integer guaranteed to be 64 bits on all platforms.
33436  * Values of this type can range from #G_MININT64
33437  * (= -9,223,372,036,854,775,808) to #G_MAXINT64
33438  * (= 9,223,372,036,854,775,807).
33439  *
33440  * To print or scan values of this type, use
33441  * %G_GINT64_MODIFIER and/or %G_GINT64_FORMAT.
33442  */
33443
33444
33445 /**
33446  * gint8:
33447  *
33448  * A signed integer guaranteed to be 8 bits on all platforms.
33449  * Values of this type can range from #G_MININT8 (= -128) to
33450  * #G_MAXINT8 (= 127).
33451  */
33452
33453
33454 /**
33455  * gintptr:
33456  *
33457  * Corresponds to the C99 type <type>intptr_t</type>,
33458  * a signed integer type that can hold any pointer.
33459  *
33460  * To print or scan values of this type, use
33461  * %G_GINTPTR_MODIFIER and/or %G_GINTPTR_FORMAT.
33462  *
33463  * Since: 2.18
33464  */
33465
33466
33467 /**
33468  * glib__private__:
33469  * @arg: Do not use this argument
33470  *
33471  * Do not call this function; it is used to share private
33472  * API between glib, gobject, and gio.
33473  */
33474
33475
33476 /**
33477  * glib_check_version:
33478  * @required_major: the required major version.
33479  * @required_minor: the required minor version.
33480  * @required_micro: the required micro version.
33481  *
33482  * Checks that the GLib library in use is compatible with the
33483  * given version. Generally you would pass in the constants
33484  * #GLIB_MAJOR_VERSION, #GLIB_MINOR_VERSION, #GLIB_MICRO_VERSION
33485  * as the three arguments to this function; that produces
33486  * a check that the library in use is compatible with
33487  * the version of GLib the application or module was compiled
33488  * against.
33489  *
33490  * Compatibility is defined by two things: first the version
33491  * of the running library is newer than the version
33492  * @required_major.required_minor.@required_micro. Second
33493  * the running library must be binary compatible with the
33494  * version @required_major.required_minor.@required_micro
33495  * (same major version.)
33496  *
33497  * 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.
33498  * Since: 2.6
33499  */
33500
33501
33502 /**
33503  * glib_gettext:
33504  * @str: The string to be translated
33505  *
33506  * Returns the translated string from the glib translations.
33507  * This is an internal function and should only be used by
33508  * the internals of glib (such as libgio).
33509  *
33510  * Returns: the transation of @str to the current locale
33511  */
33512
33513
33514 /**
33515  * glib_mem_profiler_table:
33516  *
33517  * A #GMemVTable containing profiling variants of the memory
33518  * allocation functions. Use them together with g_mem_profile()
33519  * in order to get information about the memory allocation pattern
33520  * of your program.
33521  */
33522
33523
33524 /**
33525  * glib_pgettext:
33526  * @msgctxtid: a combined message context and message id, separated by a \004 character
33527  * @msgidoffset: the offset of the message id in @msgctxid
33528  *
33529  * This function is a variant of glib_gettext() which supports
33530  * a disambiguating message context. See g_dpgettext() for full
33531  * details.
33532  *
33533  * This is an internal function and should only be used by
33534  * the internals of glib (such as libgio).
33535  *
33536  * Returns: the translation of @str to the current locale
33537  */
33538
33539
33540 /**
33541  * glong:
33542  *
33543  * Corresponds to the standard C <type>long</type> type.
33544  * Values of this type can range from #G_MINLONG to #G_MAXLONG.
33545  */
33546
33547
33548 /**
33549  * goffset:
33550  *
33551  * A signed integer type that is used for file offsets,
33552  * corresponding to the C99 type <type>off64_t</type>.
33553  * Values of this type can range from #G_MINOFFSET to
33554  * #G_MAXOFFSET.
33555  *
33556  * To print or scan values of this type, use
33557  * %G_GOFFSET_MODIFIER and/or %G_GOFFSET_FORMAT.
33558  *
33559  * Since: 2.14
33560  */
33561
33562
33563 /**
33564  * gpointer:
33565  *
33566  * An untyped pointer.
33567  * #gpointer looks better and is easier to use
33568  * than <type>void*</type>.
33569  */
33570
33571
33572 /**
33573  * gshort:
33574  *
33575  * Corresponds to the standard C <type>short</type> type.
33576  * Values of this type can range from #G_MINSHORT to #G_MAXSHORT.
33577  */
33578
33579
33580 /**
33581  * gsize:
33582  *
33583  * An unsigned integer type of the result of the sizeof operator,
33584  * corresponding to the <type>size_t</type> type defined in C99.
33585  * This type is wide enough to hold the numeric value of a pointer,
33586  * so it is usually 32bit wide on a 32bit platform and 64bit wide
33587  * on a 64bit platform. Values of this type can range from 0 to
33588  * #G_MAXSIZE.
33589  *
33590  * To print or scan values of this type, use
33591  * %G_GSIZE_MODIFIER and/or %G_GSIZE_FORMAT.
33592  */
33593
33594
33595 /**
33596  * gssize:
33597  *
33598  * A signed variant of #gsize, corresponding to the
33599  * <type>ssize_t</type> defined on most platforms.
33600  * Values of this type can range from #G_MINSSIZE
33601  * to #G_MAXSSIZE.
33602  *
33603  * To print or scan values of this type, use
33604  * %G_GSIZE_MODIFIER and/or %G_GSSIZE_FORMAT.
33605  */
33606
33607
33608 /**
33609  * guchar:
33610  *
33611  * Corresponds to the standard C <type>unsigned char</type> type.
33612  */
33613
33614
33615 /**
33616  * guint:
33617  *
33618  * Corresponds to the standard C <type>unsigned int</type> type.
33619  * Values of this type can range from 0 to #G_MAXUINT.
33620  */
33621
33622
33623 /**
33624  * guint16:
33625  *
33626  * An unsigned integer guaranteed to be 16 bits on all platforms.
33627  * Values of this type can range from 0 to #G_MAXUINT16 (= 65,535).
33628  *
33629  * To print or scan values of this type, use
33630  * %G_GINT16_MODIFIER and/or %G_GUINT16_FORMAT.
33631  */
33632
33633
33634 /**
33635  * guint32:
33636  *
33637  * An unsigned integer guaranteed to be 32 bits on all platforms.
33638  * Values of this type can range from 0 to #G_MAXUINT32 (= 4,294,967,295).
33639  *
33640  * To print or scan values of this type, use
33641  * %G_GINT32_MODIFIER and/or %G_GUINT32_FORMAT.
33642  */
33643
33644
33645 /**
33646  * guint64:
33647  *
33648  * An unsigned integer guaranteed to be 64 bits on all platforms.
33649  * Values of this type can range from 0 to #G_MAXUINT64
33650  * (= 18,446,744,073,709,551,615).
33651  *
33652  * To print or scan values of this type, use
33653  * %G_GINT64_MODIFIER and/or %G_GUINT64_FORMAT.
33654  */
33655
33656
33657 /**
33658  * guint8:
33659  *
33660  * An unsigned integer guaranteed to be 8 bits on all platforms.
33661  * Values of this type can range from 0 to #G_MAXUINT8 (= 255).
33662  */
33663
33664
33665 /**
33666  * guintptr:
33667  *
33668  * Corresponds to the C99 type <type>uintptr_t</type>,
33669  * an unsigned integer type that can hold any pointer.
33670  *
33671  * To print or scan values of this type, use
33672  * %G_GINTPTR_MODIFIER and/or %G_GUINTPTR_FORMAT.
33673  *
33674  * Since: 2.18
33675  */
33676
33677
33678 /**
33679  * gulong:
33680  *
33681  * Corresponds to the standard C <type>unsigned long</type> type.
33682  * Values of this type can range from 0 to #G_MAXULONG.
33683  */
33684
33685
33686 /**
33687  * gushort:
33688  *
33689  * Corresponds to the standard C <type>unsigned short</type> type.
33690  * Values of this type can range from 0 to #G_MAXUSHORT.
33691  */
33692
33693
33694
33695 /************************************************************/
33696 /* THIS FILE IS GENERATED DO NOT EDIT */
33697 /************************************************************/