1999-08-16 17:58:30 +00:00
|
|
|
<!-- ##### SECTION Title ##### -->
|
|
|
|
Miscellaneous Utility Functions
|
|
|
|
|
|
|
|
<!-- ##### SECTION Short_Description ##### -->
|
2007-07-22 04:14:54 +00:00
|
|
|
a selection of portable utility functions
|
1999-08-16 17:58:30 +00:00
|
|
|
|
|
|
|
<!-- ##### SECTION Long_Description ##### -->
|
|
|
|
<para>
|
2000-09-07 16:36:56 +00:00
|
|
|
These are portable utility functions.
|
1999-08-17 12:39:52 +00:00
|
|
|
</para>
|
1999-08-16 17:58:30 +00:00
|
|
|
|
|
|
|
<!-- ##### SECTION See_Also ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
2005-05-05 14:57:29 +00:00
|
|
|
<!-- ##### SECTION Stability_Level ##### -->
|
|
|
|
|
|
|
|
|
2002-11-28 23:11:58 +00:00
|
|
|
<!-- ##### FUNCTION g_get_application_name ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|
2003-06-18 23:12:56 +00:00
|
|
|
<!-- ##### FUNCTION g_set_application_name ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@application_name:
|
|
|
|
|
|
|
|
|
1999-08-16 17:58:30 +00:00
|
|
|
<!-- ##### FUNCTION g_get_prgname ##### -->
|
|
|
|
<para>
|
2005-02-02 06:07:14 +00:00
|
|
|
|
1999-08-16 17:58:30 +00:00
|
|
|
</para>
|
|
|
|
|
2005-02-02 06:07:14 +00:00
|
|
|
@Returns:
|
1999-08-16 17:58:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION g_set_prgname ##### -->
|
|
|
|
<para>
|
2005-02-02 06:07:14 +00:00
|
|
|
|
1999-08-16 17:58:30 +00:00
|
|
|
</para>
|
|
|
|
|
2005-02-02 06:07:14 +00:00
|
|
|
@prgname:
|
1999-08-16 17:58:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION g_getenv ##### -->
|
|
|
|
<para>
|
2003-07-30 19:00:36 +00:00
|
|
|
|
|
|
|
</para>
|
|
|
|
|
2003-09-12 00:17:02 +00:00
|
|
|
@variable:
|
2003-07-30 19:00:36 +00:00
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION g_setenv ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@variable:
|
|
|
|
@value:
|
|
|
|
@overwrite:
|
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION g_unsetenv ##### -->
|
|
|
|
<para>
|
|
|
|
|
1999-08-16 17:58:30 +00:00
|
|
|
</para>
|
|
|
|
|
2003-07-30 19:00:36 +00:00
|
|
|
@variable:
|
1999-08-16 17:58:30 +00:00
|
|
|
|
|
|
|
|
2005-05-05 14:57:29 +00:00
|
|
|
<!-- ##### FUNCTION g_listenv ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|
1999-08-16 17:58:30 +00:00
|
|
|
<!-- ##### FUNCTION g_get_user_name ##### -->
|
|
|
|
<para>
|
2005-02-02 06:07:14 +00:00
|
|
|
|
1999-08-16 17:58:30 +00:00
|
|
|
</para>
|
|
|
|
|
2005-05-05 14:57:29 +00:00
|
|
|
@Returns:
|
1999-08-16 17:58:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION g_get_real_name ##### -->
|
|
|
|
<para>
|
2005-02-02 06:07:14 +00:00
|
|
|
|
1999-08-16 17:58:30 +00:00
|
|
|
</para>
|
|
|
|
|
2005-05-05 14:57:29 +00:00
|
|
|
@Returns:
|
1999-08-16 17:58:30 +00:00
|
|
|
|
|
|
|
|
2004-08-25 05:02:57 +00:00
|
|
|
<!-- ##### FUNCTION g_get_user_cache_dir ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION g_get_user_data_dir ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION g_get_user_config_dir ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|
2007-06-04 14:54:49 +00:00
|
|
|
<!-- ##### ENUM GUserDirectory ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@G_USER_DIRECTORY_DESKTOP:
|
|
|
|
@G_USER_DIRECTORY_DOCUMENTS:
|
|
|
|
@G_USER_DIRECTORY_DOWNLOAD:
|
|
|
|
@G_USER_DIRECTORY_MUSIC:
|
|
|
|
@G_USER_DIRECTORY_PICTURES:
|
|
|
|
@G_USER_DIRECTORY_PUBLIC_SHARE:
|
|
|
|
@G_USER_DIRECTORY_TEMPLATES:
|
|
|
|
@G_USER_DIRECTORY_VIDEOS:
|
|
|
|
@G_USER_N_DIRECTORIES:
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION g_get_user_special_dir ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@directory:
|
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|
2004-10-26 16:10:52 +00:00
|
|
|
<!-- ##### FUNCTION g_get_system_data_dirs ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION g_get_system_config_dirs ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|
2005-06-30 21:01:58 +00:00
|
|
|
<!-- ##### FUNCTION g_get_host_name ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|
1999-08-16 17:58:30 +00:00
|
|
|
<!-- ##### FUNCTION g_get_home_dir ##### -->
|
|
|
|
<para>
|
2005-02-02 06:07:14 +00:00
|
|
|
|
1999-08-16 17:58:30 +00:00
|
|
|
</para>
|
|
|
|
|
2005-02-02 06:07:14 +00:00
|
|
|
@Returns:
|
1999-08-16 17:58:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION g_get_tmp_dir ##### -->
|
|
|
|
<para>
|
2005-02-02 06:07:14 +00:00
|
|
|
|
1999-08-16 17:58:30 +00:00
|
|
|
</para>
|
|
|
|
|
2005-02-02 06:07:14 +00:00
|
|
|
@Returns:
|
1999-08-16 17:58:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION g_get_current_dir ##### -->
|
|
|
|
<para>
|
2005-02-02 06:07:14 +00:00
|
|
|
|
1999-08-16 17:58:30 +00:00
|
|
|
</para>
|
|
|
|
|
2005-05-05 14:57:29 +00:00
|
|
|
@Returns:
|
1999-08-16 17:58:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION g_basename ##### -->
|
2000-10-27 12:34:49 +00:00
|
|
|
|
1999-08-16 17:58:30 +00:00
|
|
|
|
2002-11-28 20:46:29 +00:00
|
|
|
@file_name:
|
|
|
|
@Returns:
|
1999-08-16 17:58:30 +00:00
|
|
|
|
|
|
|
|
2001-04-19 14:50:44 +00:00
|
|
|
<!-- ##### MACRO g_dirname ##### -->
|
2000-10-27 12:34:49 +00:00
|
|
|
<para>
|
|
|
|
This function is deprecated and will be removed in the next major
|
|
|
|
release of GLib. Use g_path_get_dirname() instead.
|
|
|
|
</para>
|
|
|
|
|
1999-08-16 17:58:30 +00:00
|
|
|
<para>
|
2000-09-07 16:36:56 +00:00
|
|
|
Gets the directory components of a file name.
|
|
|
|
If the file name has no directory components "." is returned.
|
|
|
|
The returned string should be freed when no longer needed.
|
1999-08-16 17:58:30 +00:00
|
|
|
</para>
|
|
|
|
|
2000-09-07 16:36:56 +00:00
|
|
|
@Returns: the directory components of the file.
|
1999-08-16 17:58:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION g_path_is_absolute ##### -->
|
|
|
|
<para>
|
2005-02-02 06:07:14 +00:00
|
|
|
|
1999-08-16 17:58:30 +00:00
|
|
|
</para>
|
|
|
|
|
2005-05-05 14:57:29 +00:00
|
|
|
@file_name:
|
|
|
|
@Returns:
|
1999-08-16 17:58:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION g_path_skip_root ##### -->
|
|
|
|
<para>
|
2005-02-02 06:07:14 +00:00
|
|
|
|
1999-08-16 17:58:30 +00:00
|
|
|
</para>
|
|
|
|
|
2005-02-02 06:07:14 +00:00
|
|
|
@file_name:
|
|
|
|
@Returns:
|
2000-09-06 00:04:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION g_path_get_basename ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
2003-07-28 20:20:00 +00:00
|
|
|
@file_name:
|
|
|
|
@Returns:
|
2000-09-06 00:04:49 +00:00
|
|
|
|
|
|
|
|
2000-10-27 16:48:11 +00:00
|
|
|
<!-- ##### FUNCTION g_path_get_dirname ##### -->
|
|
|
|
<para>
|
2005-02-02 06:07:14 +00:00
|
|
|
|
2000-10-27 16:48:11 +00:00
|
|
|
</para>
|
|
|
|
|
2005-02-02 06:07:14 +00:00
|
|
|
@file_name:
|
|
|
|
@Returns:
|
2000-10-27 16:48:11 +00:00
|
|
|
|
|
|
|
|
2001-09-10 15:50:02 +00:00
|
|
|
<!-- ##### FUNCTION g_build_filename ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@first_element:
|
|
|
|
@Varargs:
|
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|
2005-06-30 03:13:35 +00:00
|
|
|
<!-- ##### FUNCTION g_build_filenamev ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@args:
|
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|
2001-09-10 15:50:02 +00:00
|
|
|
<!-- ##### FUNCTION g_build_path ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@separator:
|
|
|
|
@first_element:
|
|
|
|
@Varargs:
|
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|
2005-06-30 03:13:35 +00:00
|
|
|
<!-- ##### FUNCTION g_build_pathv ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@separator:
|
|
|
|
@args:
|
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|
2000-11-05 16:38:16 +00:00
|
|
|
<!-- ##### FUNCTION g_find_program_in_path ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@program:
|
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|
1999-08-16 17:58:30 +00:00
|
|
|
<!-- ##### FUNCTION g_bit_nth_lsf ##### -->
|
|
|
|
<para>
|
2000-09-07 16:36:56 +00:00
|
|
|
Find the position of the first bit set in @mask, searching from (but not
|
|
|
|
including) @nth_bit upwards. Bits are numbered from 0 (least significant)
|
2004-01-10 08:15:24 +00:00
|
|
|
to sizeof(#gulong) * 8 - 1 (31 or 63, usually). To start searching from the
|
|
|
|
0th bit, set @nth_bit to -1.
|
1999-08-16 17:58:30 +00:00
|
|
|
</para>
|
|
|
|
|
2004-01-10 08:15:24 +00:00
|
|
|
@mask: a #gulong containing flags.
|
2000-09-07 16:36:56 +00:00
|
|
|
@nth_bit: the index of the bit to start the search from.
|
|
|
|
@Returns: the index of the first bit set which is higher than @nth_bit.
|
1999-08-16 17:58:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION g_bit_nth_msf ##### -->
|
|
|
|
<para>
|
2000-09-07 16:36:56 +00:00
|
|
|
Find the position of the first bit set in @mask, searching from (but not
|
|
|
|
including) @nth_bit downwards. Bits are numbered from 0 (least significant)
|
2004-01-10 08:15:24 +00:00
|
|
|
to sizeof(#gulong) * 8 - 1 (31 or 63, usually). To start searching from the
|
|
|
|
last bit, set @nth_bit to -1 or GLIB_SIZEOF_LONG * 8.
|
1999-08-16 17:58:30 +00:00
|
|
|
</para>
|
|
|
|
|
2004-01-10 08:15:24 +00:00
|
|
|
@mask: a #gulong containing flags.
|
2000-09-07 16:36:56 +00:00
|
|
|
@nth_bit: the index of the bit to start the search from.
|
|
|
|
@Returns: the index of the first bit set which is lower than @nth_bit.
|
1999-08-16 17:58:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION g_bit_storage ##### -->
|
|
|
|
<para>
|
2000-09-07 16:36:56 +00:00
|
|
|
Gets the number of bits used to hold @number,
|
|
|
|
e.g. if @number is 4, 3 bits are needed.
|
1999-08-16 17:58:30 +00:00
|
|
|
</para>
|
|
|
|
|
2000-09-07 16:36:56 +00:00
|
|
|
@number: a guint.
|
|
|
|
@Returns: the number of bits used to hold @number.
|
1999-08-16 17:58:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION g_spaced_primes_closest ##### -->
|
|
|
|
<para>
|
2000-09-07 16:36:56 +00:00
|
|
|
Gets the smallest prime number from a built-in array of primes which
|
|
|
|
is larger than @num. This is used within GLib to calculate the optimum
|
|
|
|
size of a #GHashTable.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
The built-in array of primes ranges from 11 to 13845163 such that
|
|
|
|
each prime is approximately 1.5-2 times the previous prime.
|
1999-08-16 17:58:30 +00:00
|
|
|
</para>
|
|
|
|
|
Documentation fixes.
* glib/gconvert.c, glib/grand.c, glib/ghash.c,
glib/gthreadpool.c, glib/gtree.c: Documentation fixes.
* glib/tmpl/allocators.sgml, glib/tmpl/arrays.sgml,
glib/tmpl/arrays_byte.sgml, glib/tmpl/arrays_pointer.sgml,
glib/tmpl/caches.sgml, glib/tmpl/completion.sgml,
glib/tmpl/conversions.sgml,
glib/tmpl/datalist.sgml, glib/tmpl/date.sgml,
glib/tmpl/error_reporting.sgml, glib/tmpl/fileutils.sgml,
glib/tmpl/hash_tables.sgml,
glib/tmpl/hooks.sgml, glib/tmpl/macros.sgml,
glib/tmpl/macros_misc.sgml, glib/tmpl/main.sgml, glib/tmpl/markup.sgml,
glib/tmpl/memory.sgml, glib/tmpl/memory_chunks.sgml,
glib/tmpl/messages.sgml, glib/tmpl/misc_utils.sgml,
glib/tmpl/modules.sgml, glib/tmpl/numerical.sgml,
glib/tmpl/patterns.sgml, glib/tmpl/queue.sgml,
glib/tmpl/shell.sgml, glib/tmpl/spawn.sgml,
glib/tmpl/string_utils.sgml, glib/tmpl/thread_pools.sgml,
glib/tmpl/threads.sgml, glib/tmpl/timers.sgml,
glib/tmpl/trees-binary.sgml, glib/tmpl/trees-nary.sgml,
glib/tmpl/type_conversion.sgml, glib/tmpl/unicode.sgml,
glib/tmpl/warnings.sgml, glib/tmpl/windows.sgml:
Improve markup of examples, general consistency improvements.
2001-12-12 20:32:07 +00:00
|
|
|
@num: a #guint.
|
2000-09-07 16:36:56 +00:00
|
|
|
@Returns: the smallest prime number from a built-in array of primes which is
|
|
|
|
larger than @num.
|
1999-08-16 17:58:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION g_atexit ##### -->
|
|
|
|
<para>
|
2005-02-02 06:07:14 +00:00
|
|
|
|
1999-08-16 17:58:30 +00:00
|
|
|
</para>
|
|
|
|
|
2005-02-02 06:07:14 +00:00
|
|
|
@func:
|
1999-08-16 17:58:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION g_parse_debug_string ##### -->
|
|
|
|
<para>
|
2005-02-02 06:07:14 +00:00
|
|
|
|
1999-08-16 17:58:30 +00:00
|
|
|
</para>
|
|
|
|
|
2005-02-02 06:07:14 +00:00
|
|
|
@string:
|
|
|
|
@keys:
|
2005-05-05 14:57:29 +00:00
|
|
|
@nkeys:
|
|
|
|
@Returns:
|
1999-08-16 17:58:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### STRUCT GDebugKey ##### -->
|
|
|
|
<para>
|
2000-09-07 16:36:56 +00:00
|
|
|
Associates a string with a bit flag.
|
|
|
|
Used in g_parse_debug_string().
|
1999-08-16 17:58:30 +00:00
|
|
|
</para>
|
|
|
|
|
2005-06-30 03:13:35 +00:00
|
|
|
@key: the string
|
|
|
|
@value: the flag
|
1999-08-16 17:58:30 +00:00
|
|
|
|
|
|
|
<!-- ##### USER_FUNCTION GVoidFunc ##### -->
|
|
|
|
<para>
|
2000-09-07 16:36:56 +00:00
|
|
|
Declares a type of function which takes no arguments and has no return value.
|
|
|
|
It is used to specify the type function passed to g_atexit().
|
1999-08-16 17:58:30 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-10-12 15:41:37 +00:00
|
|
|
<!-- ##### USER_FUNCTION GFreeFunc ##### -->
|
|
|
|
<para>
|
|
|
|
Declares a type of function which takes an arbitrary data pointer argument
|
|
|
|
and has no return value. It is not currently used in GLib or GTK+.
|
|
|
|
</para>
|
|
|
|
|
consistently refer to GTK+.
* glib/tmpl/caches.sgml, glib/tmpl/datalist.sgml,
glib/tmpl/hash_tables.sgml, glib/tmpl/messages.sgml,
glib/tmpl/misc_utils.sgml: consistently refer to GTK+.
* glib/tmpl/error_reporting.sgml, glib/tmpl/fileutils.sgml,
glib/tmpl/windows.sgml, glib/tmpl/modules.sgml,
glib/tmpl/linked_lists_single.sgml, glib/tmpl/trees-nary.sgml,
glib/tmpl/trees-binary.sgml, glib/tmpl/timers.sgml: Markup fixes.
2001-10-01 18:11:58 +00:00
|
|
|
@data: a data pointer.
|
2000-10-12 15:41:37 +00:00
|
|
|
|
|
|
|
|
2001-01-05 20:48:43 +00:00
|
|
|
<!-- ##### FUNCTION g_qsort_with_data ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@pbase:
|
|
|
|
@total_elems:
|
|
|
|
@size:
|
|
|
|
@compare_func:
|
|
|
|
@user_data:
|
|
|
|
|
|
|
|
|
2001-09-10 15:50:02 +00:00
|
|
|
<!-- ##### FUNCTION g_nullify_pointer ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@nullify_location:
|
|
|
|
|
|
|
|
|