/src/wrappers/glib/library/utilities/glib_miscellaneous_utility_functions.e

http://github.com/tybor/Liberty · Specman e · 789 lines · 2 code · 272 blank · 515 comment · 0 complexity · 350ba1e5a2548d736116366d3921692c MD5 · raw file

  1. deferred class GLIB_MISCELLANEOUS_UTILITY_FUNCTIONS
  2. -- Miscellaneous Utility Functions
  3. -- Miscellaneous Utility Functions -- a selection of portable utility functions.
  4. -- Synopsis
  5. -- #include <glib.h>
  6. -- const gchar* g_get_application_name (void);
  7. -- void g_set_application_name (const gchar *application_name);
  8. -- gchar* g_get_prgname (void);
  9. -- void g_set_prgname (const gchar *prgname);
  10. -- const gchar* g_getenv (const gchar *variable);
  11. -- gboolean g_setenv (const gchar *variable,
  12. -- const gchar *value,
  13. -- gboolean overwrite);
  14. -- void g_unsetenv (const gchar *variable);
  15. -- gchar** g_listenv (void);
  16. -- const gchar* g_get_user_name (void);
  17. -- const gchar* g_get_real_name (void);
  18. -- const gchar* g_get_user_cache_dir (void);
  19. -- const gchar* g_get_user_data_dir (void);
  20. -- const gchar* g_get_user_config_dir (void);
  21. -- const gchar* const * g_get_system_data_dirs (void);
  22. -- const gchar* const * g_get_system_config_dirs
  23. -- (void);
  24. -- const gchar* g_get_host_name (void);
  25. -- const gchar* g_get_home_dir (void);
  26. -- const gchar* g_get_tmp_dir (void);
  27. -- gchar* g_get_current_dir (void);
  28. -- const gchar* g_basename (const gchar *file_name);
  29. -- #define g_dirname
  30. -- gboolean g_path_is_absolute (const gchar *file_name);
  31. -- const gchar* g_path_skip_root (const gchar *file_name);
  32. -- gchar* g_path_get_basename (const gchar *file_name);
  33. -- gchar* g_path_get_dirname (const gchar *file_name);
  34. -- gchar* g_build_filename (const gchar *first_element,
  35. -- ...);
  36. -- gchar* g_build_filenamev (gchar **args);
  37. -- gchar* g_build_path (const gchar *separator,
  38. -- const gchar *first_element,
  39. -- ...);
  40. -- gchar* g_build_pathv (const gchar *separator,
  41. -- gchar **args);
  42. -- gchar* g_find_program_in_path (const gchar *program);
  43. -- gint g_bit_nth_lsf (gulong mask,
  44. -- gint nth_bit);
  45. -- gint g_bit_nth_msf (gulong mask,
  46. -- gint nth_bit);
  47. -- guint g_bit_storage (gulong number);
  48. -- guint g_spaced_primes_closest (guint num);
  49. -- void g_atexit (GVoidFunc func);
  50. -- guint g_parse_debug_string (const gchar *string,
  51. -- const GDebugKey *keys,
  52. -- guint nkeys);
  53. -- GDebugKey;
  54. -- void (*GVoidFunc) (void);
  55. -- void (*GFreeFunc) (gpointer data);
  56. -- void g_qsort_with_data (gconstpointer pbase,
  57. -- gint total_elems,
  58. -- gsize size,
  59. -- GCompareDataFunc compare_func,
  60. -- gpointer user_data);
  61. -- void g_nullify_pointer (gpointer *nullify_location);
  62. -- Description
  63. -- These are portable utility functions.
  64. -- Details
  65. -- g_get_application_name ()
  66. -- const gchar* g_get_application_name (void);
  67. -- Gets a human-readable name for the application, as set by
  68. -- g_set_application_name(). This name should be localized if possible, and is
  69. -- intended for display to the user. Contrast with g_get_prgname(), which gets a
  70. -- non-localized name. If g_set_application_name() has not been called, returns the
  71. -- result of g_get_prgname() (which may be NULL if g_set_prgname() has also not been
  72. -- called).
  73. -- Returns : human-readable application name. may return NULL
  74. -- Since 2.2
  75. -- ---------------------------------------------------------------------------------
  76. -- g_set_application_name ()
  77. -- void g_set_application_name (const gchar *application_name);
  78. -- Sets a human-readable name for the application. This name should be localized if
  79. -- possible, and is intended for display to the user. Contrast with g_set_prgname(),
  80. -- which sets a non-localized name. g_set_prgname() will be called automatically by
  81. -- gtk_init(), but g_set_application_name() will not.
  82. -- Note that for thread safety reasons, this function can only be called once.
  83. -- The application name will be used in contexts such as error messages, or when
  84. -- displaying an application's name in the task list.
  85. -- application_name : localized name of the application
  86. -- ---------------------------------------------------------------------------------
  87. -- g_get_prgname ()
  88. -- gchar* g_get_prgname (void);
  89. -- Gets the name of the program. This name should not be localized, contrast with
  90. -- g_get_application_name(). (If you are using GDK or GTK+ the program name is set
  91. -- in gdk_init(), which is called by gtk_init(). The program name is found by taking
  92. -- the last component of argv[0].)
  93. -- Returns : the name of the program. The returned string belongs to GLib and must
  94. -- not be modified or freed.
  95. -- ---------------------------------------------------------------------------------
  96. -- g_set_prgname ()
  97. -- void g_set_prgname (const gchar *prgname);
  98. -- Sets the name of the program. This name should not be localized, contrast with
  99. -- g_set_application_name(). Note that for thread-safety reasons this function can
  100. -- only be called once.
  101. -- prgname : the name of the program.
  102. -- ---------------------------------------------------------------------------------
  103. -- g_getenv ()
  104. -- const gchar* g_getenv (const gchar *variable);
  105. -- Returns the value of an environment variable. The name and value are in the GLib
  106. -- file name encoding. On UNIX, this means the actual bytes which might or might not
  107. -- be in some consistent character set and encoding. On Windows, it is in UTF-8. On
  108. -- Windows, in case the environment variable's value contains references to other
  109. -- environment variables, they are expanded.
  110. -- variable : the environment variable to get, in the GLib file name encoding.
  111. -- Returns : the value of the environment variable, or NULL if the environment
  112. -- variable is not found. The returned string may be overwritten by the
  113. -- next call to g_getenv(), g_setenv() or g_unsetenv().
  114. -- ---------------------------------------------------------------------------------
  115. -- g_setenv ()
  116. -- gboolean g_setenv (const gchar *variable,
  117. -- const gchar *value,
  118. -- gboolean overwrite);
  119. -- Sets an environment variable. Both the variable's name and value should be in the
  120. -- GLib file name encoding. On UNIX, this means that they can be any sequence of
  121. -- bytes. On Windows, they should be in UTF-8.
  122. -- Note that on some systems, when variables are overwritten, the memory used for
  123. -- the previous variables and its value isn't reclaimed.
  124. -- variable : the environment variable to set, must not contain '='.
  125. -- value : the value for to set the variable to.
  126. -- overwrite : whether to change the variable if it already exists.
  127. -- Returns : FALSE if the environment variable couldn't be set.
  128. -- Since 2.4
  129. -- ---------------------------------------------------------------------------------
  130. -- g_unsetenv ()
  131. -- void g_unsetenv (const gchar *variable);
  132. -- Removes an environment variable from the environment.
  133. -- Note that on some systems, when variables are overwritten, the memory used for
  134. -- the previous variables and its value isn't reclaimed. Furthermore, this function
  135. -- can't be guaranteed to operate in a threadsafe way.
  136. -- variable : the environment variable to remove, must not contain '='.
  137. -- Since 2.4
  138. -- ---------------------------------------------------------------------------------
  139. -- g_listenv ()
  140. -- gchar** g_listenv (void);
  141. -- Gets the names of all variables set in the environment.
  142. -- Returns : a NULL-terminated list of strings which must be freed with
  143. -- g_strfreev(). Programs that want to be portable to Windows should
  144. -- typically use this function and g_getenv() instead of using the environ
  145. -- array from the C library directly. On Windows, the strings in the
  146. -- environ array are in system codepage encoding, while in most of the
  147. -- typical use cases for environment variables in GLib-using programs you
  148. -- want the UTF-8 encoding that this function and g_getenv() provide.
  149. -- Since 2.8
  150. -- ---------------------------------------------------------------------------------
  151. -- g_get_user_name ()
  152. -- const gchar* g_get_user_name (void);
  153. -- Gets the user name of the current user. The encoding of the returned string is
  154. -- system-defined. On UNIX, it might be the preferred file name encoding, or
  155. -- something else, and there is no guarantee that it is even consistent on a
  156. -- machine. On Windows, it is always UTF-8.
  157. -- Returns : the user name of the current user.
  158. -- ---------------------------------------------------------------------------------
  159. -- g_get_real_name ()
  160. -- const gchar* g_get_real_name (void);
  161. -- Gets the real name of the user. This usually comes from the user's entry in the
  162. -- passwd file. The encoding of the returned string is system-defined. (On Windows,
  163. -- it is, however, always UTF-8.) If the real user name cannot be determined, the
  164. -- string "Unknown" is returned.
  165. -- Returns : the user's real name.
  166. -- ---------------------------------------------------------------------------------
  167. -- g_get_user_cache_dir ()
  168. -- const gchar* g_get_user_cache_dir (void);
  169. -- Returns a base directory in which to store non-essential, cached data specific to
  170. -- particular user.
  171. -- On UNIX platforms this is determined using the mechanisms described in the XDG
  172. -- Base Directory Specification
  173. -- Returns : a string owned by GLib that must not be modified or freed.
  174. -- Since 2.6
  175. -- ---------------------------------------------------------------------------------
  176. -- g_get_user_data_dir ()
  177. -- const gchar* g_get_user_data_dir (void);
  178. -- Returns a base directory in which to access application data such as icons that
  179. -- is customized for a particular user.
  180. -- On UNIX platforms this is determined using the mechanisms described in the XDG
  181. -- Base Directory Specification
  182. -- Returns : a string owned by GLib that must not be modified or freed.
  183. -- Since 2.6
  184. -- ---------------------------------------------------------------------------------
  185. -- g_get_user_config_dir ()
  186. -- const gchar* g_get_user_config_dir (void);
  187. -- Returns a base directory in which to store user-specific application
  188. -- configuration information such as user preferences and settings.
  189. -- On UNIX platforms this is determined using the mechanisms described in the XDG
  190. -- Base Directory Specification
  191. -- Returns : a string owned by GLib that must not be modified or freed.
  192. -- Since 2.6
  193. -- ---------------------------------------------------------------------------------
  194. -- g_get_system_data_dirs ()
  195. -- const gchar* const * g_get_system_data_dirs (void);
  196. -- Returns an ordered list of base directories in which to access system-wide
  197. -- application data.
  198. -- On UNIX platforms this is determined using the mechanisms described in the XDG
  199. -- Base Directory Specification
  200. -- On Windows the first elements in the list are the Application Data and Documents
  201. -- folders for All Users. (These can be determined only on Windows 2000 or later and
  202. -- are not present in the list on other Windows versions.) See documentation for
  203. -- CSIDL_COMMON_APPDATA and CSIDL_COMMON_DOCUMENTS.
  204. -- Then follows the "share" subfolder in the installation folder for the package
  205. -- containing the DLL that calls this function, if it can be determined.
  206. -- Finally the list contains the "share" subfolder in the installation folder for
  207. -- GLib, and in the installation folder for the package the application's .exe file
  208. -- belongs to.
  209. -- The installation folders above are determined by looking up the folder where the
  210. -- module (DLL or EXE) in question is located. If the folder's name is "bin", its
  211. -- parent is used, otherwise the folder itself.
  212. -- Note that on Windows the returned list can vary depending on where this function
  213. -- is called.
  214. -- Returns : a NULL-terminated array of strings owned by GLib that must not be
  215. -- modified or freed.
  216. -- Since 2.6
  217. -- ---------------------------------------------------------------------------------
  218. -- g_get_system_config_dirs ()
  219. -- const gchar* const * g_get_system_config_dirs
  220. -- (void);
  221. -- Returns an ordered list of base directories in which to access system-wide
  222. -- configuration information.
  223. -- On UNIX platforms this is determined using the mechanisms described in the XDG
  224. -- Base Directory Specification
  225. -- Returns : a NULL-terminated array of strings owned by GLib that must not be
  226. -- modified or freed.
  227. -- Since 2.6
  228. -- ---------------------------------------------------------------------------------
  229. -- g_get_host_name ()
  230. -- const gchar* g_get_host_name (void);
  231. -- Return a name for the machine.
  232. -- The returned name is not necessarily a fully-qualified domain name, or even
  233. -- present in DNS or some other name service at all. It need not even be unique on
  234. -- your local network or site, but usually it is. Callers should not rely on the
  235. -- return value having any specific properties like uniqueness for security
  236. -- purposes. Even if the name of the machine is changed while an application is
  237. -- running, the return value from this function does not change. The returned string
  238. -- is owned by GLib and should not be modified or freed. If no name can be
  239. -- determined, a default fixed string "localhost" is returned.
  240. -- Returns : the host name of the machine.
  241. -- Since 2.8
  242. -- ---------------------------------------------------------------------------------
  243. -- g_get_home_dir ()
  244. -- const gchar* g_get_home_dir (void);
  245. -- Gets the current user's home directory.
  246. -- Note that in contrast to traditional UNIX tools, this function prefers passwd
  247. -- entries over the HOME environment variable.
  248. -- Returns : the current user's home directory.
  249. -- ---------------------------------------------------------------------------------
  250. -- g_get_tmp_dir ()
  251. -- const gchar* g_get_tmp_dir (void);
  252. -- Gets the directory to use for temporary files. This is found from inspecting the
  253. -- environment variables TMPDIR, TMP, and TEMP in that order. If none of those are
  254. -- defined "/tmp" is returned on UNIX and "C:\" on Windows. The encoding of the
  255. -- returned string is system-defined. On Windows, it is always UTF-8. The return
  256. -- value is never NULL.
  257. -- Returns : the directory to use for temporary files.
  258. -- ---------------------------------------------------------------------------------
  259. -- g_get_current_dir ()
  260. -- gchar* g_get_current_dir (void);
  261. -- Gets the current directory. The returned string should be freed when no longer
  262. -- needed. The encoding of the returned string is system defined. On Windows, it is
  263. -- always UTF-8.
  264. -- Returns : the current directory.
  265. -- ---------------------------------------------------------------------------------
  266. -- g_basename ()
  267. -- const gchar* g_basename (const gchar *file_name);
  268. -- Warning
  269. -- g_basename has been deprecated since version 2.2 and should not be used in
  270. -- newly-written code. Use g_path_get_basename() instead, but notice that
  271. -- g_path_get_basename() allocates new memory for the returned string, unlike this
  272. -- function which returns a pointer into the argument.
  273. -- Gets the name of the file without any leading directory components. It returns a
  274. -- pointer into the given file name string.
  275. -- file_name : the name of the file.
  276. -- Returns : the name of the file without any leading directory components.
  277. -- ---------------------------------------------------------------------------------
  278. -- g_dirname
  279. -- #define g_dirname
  280. -- Warning
  281. -- g_dirname is deprecated and should not be used in newly-written code.
  282. -- This function is deprecated and will be removed in the next major release of
  283. -- GLib. Use g_path_get_dirname() instead.
  284. -- Gets the directory components of a file name. If the file name has no directory
  285. -- components "." is returned. The returned string should be freed when no longer
  286. -- needed.
  287. -- Returns : the directory components of the file.
  288. -- ---------------------------------------------------------------------------------
  289. -- g_path_is_absolute ()
  290. -- gboolean g_path_is_absolute (const gchar *file_name);
  291. -- Returns TRUE if the given file_name is an absolute file name, i.e. it contains a
  292. -- full path from the root directory such as "/usr/local" on UNIX or "C:\windows" on
  293. -- Windows systems.
  294. -- file_name : a file name.
  295. -- Returns : TRUE if file_name is an absolute path.
  296. -- ---------------------------------------------------------------------------------
  297. -- g_path_skip_root ()
  298. -- const gchar* g_path_skip_root (const gchar *file_name);
  299. -- Returns a pointer into file_name after the root component, i.e. after the "/" in
  300. -- UNIX or "C:\" under Windows. If file_name is not an absolute path it returns
  301. -- NULL.
  302. -- file_name : a file name.
  303. -- Returns : a pointer into file_name after the root component.
  304. -- ---------------------------------------------------------------------------------
  305. -- g_path_get_basename ()
  306. -- gchar* g_path_get_basename (const gchar *file_name);
  307. -- Gets the last component of the filename. If file_name ends with a directory
  308. -- separator it gets the component before the last slash. If file_name consists only
  309. -- of directory separators (and on Windows, possibly a drive letter), a single
  310. -- separator is returned. If file_name is empty, it gets ".".
  311. -- file_name : the name of the file.
  312. -- Returns : a newly allocated string containing the last component of the
  313. -- filename.
  314. -- ---------------------------------------------------------------------------------
  315. -- g_path_get_dirname ()
  316. -- gchar* g_path_get_dirname (const gchar *file_name);
  317. -- Gets the directory components of a file name. If the file name has no directory
  318. -- components "." is returned. The returned string should be freed when no longer
  319. -- needed.
  320. -- file_name : the name of the file.
  321. -- Returns : the directory components of the file.
  322. -- ---------------------------------------------------------------------------------
  323. -- g_build_filename ()
  324. -- gchar* g_build_filename (const gchar *first_element,
  325. -- ...);
  326. -- Creates a filename from a series of elements using the correct separator for
  327. -- filenames.
  328. -- On Unix, this function behaves identically to g_build_path (G_DIR_SEPARATOR_S,
  329. -- first_element, ....).
  330. -- On Windows, it takes into account that either the backslash (\ or slash (/) can
  331. -- be used as separator in filenames, but otherwise behaves as on Unix. When file
  332. -- pathname separators need to be inserted, the one that last previously occurred in
  333. -- the parameters (reading from left to right) is used.
  334. -- No attempt is made to force the resulting filename to be an absolute path. If the
  335. -- first element is a relative path, the result will be a relative path.
  336. -- first_element : the first element in the path
  337. -- ... : remaining elements in path, terminated by NULL
  338. -- Returns : a newly-allocated string that must be freed with g_free().
  339. -- ---------------------------------------------------------------------------------
  340. -- g_build_filenamev ()
  341. -- gchar* g_build_filenamev (gchar **args);
  342. -- Behaves exactly like g_build_filename(), but takes the path elements as a string
  343. -- array, instead of varargs. This function is mainly meant for language bindings.
  344. -- args : NULL-terminated array of strings containing the path elements.
  345. -- Returns : a newly-allocated string that must be freed with g_free().
  346. -- Since 2.8
  347. -- ---------------------------------------------------------------------------------
  348. -- g_build_path ()
  349. -- gchar* g_build_path (const gchar *separator,
  350. -- const gchar *first_element,
  351. -- ...);
  352. -- Creates a path from a series of elements using separator as the separator between
  353. -- elements. At the boundary between two elements, any trailing occurrences of
  354. -- separator in the first element, or leading occurrences of separator in the second
  355. -- element are removed and exactly one copy of the separator is inserted.
  356. -- Empty elements are ignored.
  357. -- The number of leading copies of the separator on the result is the same as the
  358. -- number of leading copies of the separator on the first non-empty element.
  359. -- The number of trailing copies of the separator on the result is the same as the
  360. -- number of trailing copies of the separator on the last non-empty element.
  361. -- (Determination of the number of trailing copies is done without stripping leading
  362. -- copies, so if the separator is ABA, ABABA has 1 trailing copy.)
  363. -- However, if there is only a single non-empty element, and there are no characters
  364. -- in that element not part of the leading or trailing separators, then the result
  365. -- is exactly the original value of that element.
  366. -- Other than for determination of the number of leading and trailing copies of the
  367. -- separator, elements consisting only of copies of the separator are ignored.
  368. -- separator : a string used to separator the elements of the path.
  369. -- first_element : the first element in the path
  370. -- ... : remaining elements in path, terminated by NULL
  371. -- Returns : a newly-allocated string that must be freed with g_free().
  372. -- ---------------------------------------------------------------------------------
  373. -- g_build_pathv ()
  374. -- gchar* g_build_pathv (const gchar *separator,
  375. -- gchar **args);
  376. -- Behaves exactly like g_build_path(), but takes the path elements as a string
  377. -- array, instead of varargs. This function is mainly meant for language bindings.
  378. -- separator : a string used to separator the elements of the path.
  379. -- args : NULL-terminated array of strings containing the path elements.
  380. -- Returns : a newly-allocated string that must be freed with g_free().
  381. -- Since 2.8
  382. -- ---------------------------------------------------------------------------------
  383. -- g_find_program_in_path ()
  384. -- gchar* g_find_program_in_path (const gchar *program);
  385. -- Locates the first executable named program in the user's path, in the same way
  386. -- that execvp() would locate it. Returns an allocated string with the absolute path
  387. -- name, or NULL if the program is not found in the path. If program is already an
  388. -- absolute path, returns a copy of program if program exists and is executable, and
  389. -- NULL otherwise. On Windows, if program does not have a file type suffix, tries
  390. -- with the suffixes .exe, .cmd, .bat and .com, and the suffixes in the PATHEXT
  391. -- environment variable.
  392. -- On Windows, it looks for the file in the same way as CreateProcess() would. This
  393. -- means first in the directory where the executing program was loaded from, then in
  394. -- the current directory, then in the Windows 32-bit system directory, then in the
  395. -- Windows directory, and finally in the directories in the PATH environment
  396. -- variable. If the program is found, the return value contains the full name
  397. -- including the type suffix.
  398. -- program : a program name in the GLib file name encoding
  399. -- Returns : absolute path, or NULL
  400. -- ---------------------------------------------------------------------------------
  401. -- g_bit_nth_lsf ()
  402. -- gint g_bit_nth_lsf (gulong mask,
  403. -- gint nth_bit);
  404. -- Find the position of the first bit set in mask, searching from (but not
  405. -- including) nth_bit upwards. Bits are numbered from 0 (least significant) to
  406. -- sizeof(gulong) * 8 - 1 (31 or 63, usually). To start searching from the 0th bit,
  407. -- set nth_bit to -1.
  408. -- mask : a gulong containing flags.
  409. -- nth_bit : the index of the bit to start the search from.
  410. -- Returns : the index of the first bit set which is higher than nth_bit.
  411. -- ---------------------------------------------------------------------------------
  412. -- g_bit_nth_msf ()
  413. -- gint g_bit_nth_msf (gulong mask,
  414. -- gint nth_bit);
  415. -- Find the position of the first bit set in mask, searching from (but not
  416. -- including) nth_bit downwards. Bits are numbered from 0 (least significant) to
  417. -- sizeof(gulong) * 8 - 1 (31 or 63, usually). To start searching from the last bit,
  418. -- set nth_bit to -1 or GLIB_SIZEOF_LONG * 8.
  419. -- mask : a gulong containing flags.
  420. -- nth_bit : the index of the bit to start the search from.
  421. -- Returns : the index of the first bit set which is lower than nth_bit.
  422. -- ---------------------------------------------------------------------------------
  423. -- g_bit_storage ()
  424. -- guint g_bit_storage (gulong number);
  425. -- Gets the number of bits used to hold number, e.g. if number is 4, 3 bits are
  426. -- needed.
  427. -- number : a guint.
  428. -- Returns : the number of bits used to hold number.
  429. -- ---------------------------------------------------------------------------------
  430. -- g_spaced_primes_closest ()
  431. -- guint g_spaced_primes_closest (guint num);
  432. -- Gets the smallest prime number from a built-in array of primes which is larger
  433. -- than num. This is used within GLib to calculate the optimum size of a GHashTable.
  434. -- The built-in array of primes ranges from 11 to 13845163 such that each prime is
  435. -- approximately 1.5-2 times the previous prime.
  436. -- num : a guint.
  437. -- Returns : the smallest prime number from a built-in array of primes which is
  438. -- larger than num.
  439. -- ---------------------------------------------------------------------------------
  440. -- g_atexit ()
  441. -- void g_atexit (GVoidFunc func);
  442. -- Specifies a function to be called at normal program termination.
  443. -- Since GLib 2.8.2, on Windows g_atexit() actually is a preprocessor macro that
  444. -- maps to a call to the atexit() function in the C library. This means that in case
  445. -- the code that calls g_atexit(), i.e. atexit(), is in a DLL, the function will be
  446. -- called when the DLL is detached from the program. This typically makes more sense
  447. -- than that the function is called when the GLib DLL is detached, which happened
  448. -- earlier when g_atexit() was a function in the GLib DLL.
  449. -- The behaviour of atexit() in the context of dynamically loaded modules is not
  450. -- formally specified and varies wildly.
  451. -- On POSIX systems, calling g_atexit() (or atexit()) in a dynamically loaded module
  452. -- which is unloaded before the program terminates might well cause a crash at
  453. -- program exit.
  454. -- Some POSIX systems implement atexit() like Windows, and have each dynamically
  455. -- loaded module maintain an own atexit chain that is called when the module is
  456. -- unloaded.
  457. -- On other POSIX systems, before a dynamically loaded module is unloaded, the
  458. -- registered atexit functions (if any) residing in that module are called,
  459. -- regardless where the code that registered them resided. This is presumably the
  460. -- most robust approach.
  461. -- As can be seen from the above, for portability it's best to avoid calling
  462. -- g_atexit() (or atexit()) except in the main executable of a program.
  463. -- func : the function to call on normal program termination.
  464. -- ---------------------------------------------------------------------------------
  465. -- g_parse_debug_string ()
  466. -- guint g_parse_debug_string (const gchar *string,
  467. -- const GDebugKey *keys,
  468. -- guint nkeys);
  469. -- Parses a string containing debugging options into a guint containing bit flags.
  470. -- This is used within GDK and GTK+ to parse the debug options passed on the command
  471. -- line or through environment variables.
  472. -- string : a list of debug options separated by colons, spaces, or commas; or the
  473. -- string "all" to set all flags.
  474. -- keys : pointer to an array of GDebugKey which associate strings with bit
  475. -- flags.
  476. -- nkeys : the number of GDebugKeys in the array.
  477. -- Returns : the combined set of bit flags.
  478. -- ---------------------------------------------------------------------------------
  479. -- GDebugKey
  480. -- typedef struct {
  481. -- gchar *key;
  482. -- guint value;
  483. -- } GDebugKey;
  484. -- Associates a string with a bit flag. Used in g_parse_debug_string().
  485. -- gchar *key; the string
  486. -- guint value; the flag
  487. -- ---------------------------------------------------------------------------------
  488. -- GVoidFunc ()
  489. -- void (*GVoidFunc) (void);
  490. -- Declares a type of function which takes no arguments and has no return value. It
  491. -- is used to specify the type function passed to g_atexit().
  492. -- ---------------------------------------------------------------------------------
  493. -- GFreeFunc ()
  494. -- void (*GFreeFunc) (gpointer data);
  495. -- Declares a type of function which takes an arbitrary data pointer argument and
  496. -- has no return value. It is not currently used in GLib or GTK+.
  497. -- data : a data pointer.
  498. -- ---------------------------------------------------------------------------------
  499. -- g_qsort_with_data ()
  500. -- void g_qsort_with_data (gconstpointer pbase,
  501. -- gint total_elems,
  502. -- gsize size,
  503. -- GCompareDataFunc compare_func,
  504. -- gpointer user_data);
  505. -- This is just like the standard C qsort() function, but the comparison routine
  506. -- accepts a user data argument.
  507. -- pbase : start of array to sort
  508. -- total_elems : elements in the array
  509. -- size : size of each element
  510. -- compare_func : function to compare elements
  511. -- user_data : data to pass to compare_func
  512. -- ---------------------------------------------------------------------------------
  513. -- g_nullify_pointer ()
  514. -- void g_nullify_pointer (gpointer *nullify_location);
  515. -- Set the pointer at the specified location to NULL.
  516. -- nullify_location : the memory address of the pointer.
  517. end -- class GLIB_MISCELLANEOUS_UTILITY_FUNCTIONS