Split glib.h into many header files mostly according to the resp.
2000-10-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* glib.h, galloca.h, garray.h, gasyncqueue.h, gbacktrace.h,
gcache.h, gcompletion.h, gconvert.h, gdataset.h, gdate.h, ghash.h,
ghook.h, giochannel.h, glist.h , gmacros.h, gmain.h, gmem.h,
gmessages.h, gnode.h, gprimes.h, gquark.h, gqueue.h, grand.h,
grel.h, gscanner.h, gslist.h, gstrfuncs.h, gstring.h, gthread.h,
gthreadpool.h, gtimer.h, gtree.h, gtypes.h, gutils.h: Split glib.h
into many header files mostly according to the resp. *.c-files.
* gmacros.h: Added G_BEGIN_DECLS and G_END_DECLS to mean: 'in case
of C++: extern "C" { ... }' analogous to glibc __BEGIN_DECLS and
__END_DECLS.
* configure.in, gerror.h, gfileutils.h, gshell.h, gspawn.h,
gunicode.h, : Changed guard-macro names to something more
consistent.
* configure.in, *.h: Use G_BEGIN_DECLS and G_END_DECLS.
2000-10-12 13:52:07 +02:00
|
|
|
/* GLIB - Library of useful routines for C programming
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2017-01-05 12:47:07 +01:00
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
Split glib.h into many header files mostly according to the resp.
2000-10-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* glib.h, galloca.h, garray.h, gasyncqueue.h, gbacktrace.h,
gcache.h, gcompletion.h, gconvert.h, gdataset.h, gdate.h, ghash.h,
ghook.h, giochannel.h, glist.h , gmacros.h, gmain.h, gmem.h,
gmessages.h, gnode.h, gprimes.h, gquark.h, gqueue.h, grand.h,
grel.h, gscanner.h, gslist.h, gstrfuncs.h, gstring.h, gthread.h,
gthreadpool.h, gtimer.h, gtree.h, gtypes.h, gutils.h: Split glib.h
into many header files mostly according to the resp. *.c-files.
* gmacros.h: Added G_BEGIN_DECLS and G_END_DECLS to mean: 'in case
of C++: extern "C" { ... }' analogous to glibc __BEGIN_DECLS and
__END_DECLS.
* configure.in, gerror.h, gfileutils.h, gshell.h, gspawn.h,
gunicode.h, : Changed guard-macro names to something more
consistent.
* configure.in, *.h: Use G_BEGIN_DECLS and G_END_DECLS.
2000-10-12 13:52:07 +02:00
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2014-01-23 12:58:29 +01:00
|
|
|
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
Split glib.h into many header files mostly according to the resp.
2000-10-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* glib.h, galloca.h, garray.h, gasyncqueue.h, gbacktrace.h,
gcache.h, gcompletion.h, gconvert.h, gdataset.h, gdate.h, ghash.h,
ghook.h, giochannel.h, glist.h , gmacros.h, gmain.h, gmem.h,
gmessages.h, gnode.h, gprimes.h, gquark.h, gqueue.h, grand.h,
grel.h, gscanner.h, gslist.h, gstrfuncs.h, gstring.h, gthread.h,
gthreadpool.h, gtimer.h, gtree.h, gtypes.h, gutils.h: Split glib.h
into many header files mostly according to the resp. *.c-files.
* gmacros.h: Added G_BEGIN_DECLS and G_END_DECLS to mean: 'in case
of C++: extern "C" { ... }' analogous to glibc __BEGIN_DECLS and
__END_DECLS.
* configure.in, gerror.h, gfileutils.h, gshell.h, gspawn.h,
gunicode.h, : Changed guard-macro names to something more
consistent.
* configure.in, *.h: Use G_BEGIN_DECLS and G_END_DECLS.
2000-10-12 13:52:07 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Modified by the GLib Team and others 1997-2000. See the AUTHORS
|
|
|
|
* file for a list of people on the GLib Team. See the ChangeLog
|
|
|
|
* files for a list of changes. These files are distributed with
|
2008-03-14 20:30:38 +01:00
|
|
|
* GLib at ftp://ftp.gtk.org/pub/gtk/.
|
Split glib.h into many header files mostly according to the resp.
2000-10-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* glib.h, galloca.h, garray.h, gasyncqueue.h, gbacktrace.h,
gcache.h, gcompletion.h, gconvert.h, gdataset.h, gdate.h, ghash.h,
ghook.h, giochannel.h, glist.h , gmacros.h, gmain.h, gmem.h,
gmessages.h, gnode.h, gprimes.h, gquark.h, gqueue.h, grand.h,
grel.h, gscanner.h, gslist.h, gstrfuncs.h, gstring.h, gthread.h,
gthreadpool.h, gtimer.h, gtree.h, gtypes.h, gutils.h: Split glib.h
into many header files mostly according to the resp. *.c-files.
* gmacros.h: Added G_BEGIN_DECLS and G_END_DECLS to mean: 'in case
of C++: extern "C" { ... }' analogous to glibc __BEGIN_DECLS and
__END_DECLS.
* configure.in, gerror.h, gfileutils.h, gshell.h, gspawn.h,
gunicode.h, : Changed guard-macro names to something more
consistent.
* configure.in, *.h: Use G_BEGIN_DECLS and G_END_DECLS.
2000-10-12 13:52:07 +02:00
|
|
|
*/
|
|
|
|
|
2012-12-28 05:43:14 +01:00
|
|
|
#ifndef __G_UTILS_H__
|
|
|
|
#define __G_UTILS_H__
|
|
|
|
|
2011-10-12 06:24:46 +02:00
|
|
|
#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
|
2008-03-14 20:30:38 +01:00
|
|
|
#error "Only <glib.h> can be included directly."
|
|
|
|
#endif
|
|
|
|
|
2001-06-26 18:01:21 +02:00
|
|
|
#include <glib/gtypes.h>
|
Split glib.h into many header files mostly according to the resp.
2000-10-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* glib.h, galloca.h, garray.h, gasyncqueue.h, gbacktrace.h,
gcache.h, gcompletion.h, gconvert.h, gdataset.h, gdate.h, ghash.h,
ghook.h, giochannel.h, glist.h , gmacros.h, gmain.h, gmem.h,
gmessages.h, gnode.h, gprimes.h, gquark.h, gqueue.h, grand.h,
grel.h, gscanner.h, gslist.h, gstrfuncs.h, gstring.h, gthread.h,
gthreadpool.h, gtimer.h, gtree.h, gtypes.h, gutils.h: Split glib.h
into many header files mostly according to the resp. *.c-files.
* gmacros.h: Added G_BEGIN_DECLS and G_END_DECLS to mean: 'in case
of C++: extern "C" { ... }' analogous to glibc __BEGIN_DECLS and
__END_DECLS.
* configure.in, gerror.h, gfileutils.h, gshell.h, gspawn.h,
gunicode.h, : Changed guard-macro names to something more
consistent.
* configure.in, *.h: Use G_BEGIN_DECLS and G_END_DECLS.
2000-10-12 13:52:07 +02:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
/* Define G_VA_COPY() to do the right thing for copying va_list variables.
|
|
|
|
* glibconfig.h may have already defined G_VA_COPY as va_copy or __va_copy.
|
|
|
|
*/
|
|
|
|
#if !defined (G_VA_COPY)
|
|
|
|
# if defined (__GNUC__) && defined (__PPC__) && (defined (_CALL_SYSV) || defined (_WIN32))
|
|
|
|
# define G_VA_COPY(ap1, ap2) (*(ap1) = *(ap2))
|
|
|
|
# elif defined (G_VA_COPY_AS_ARRAY)
|
Require C90 compliance
Assume all supported platforms implement C90, and therefore they
(correctly) implement atexit(), memmove(), setlocale(), strerror(),
and vprintf(), and have <float.h> and <limits.h>.
(Also remove the configure check testing that "do ... while (0)" works
correctly; the non-do/while-based version of G_STMT_START and
G_STMT_END was removed years ago, but the check remained. Also, remove
some checks that configure.ac claimed were needed for libcharset, but
aren't actually used.)
Note that removing the g_memmove() function is not an ABI break even
on systems where g_memmove() was previously not a macro, because it
was never marked GLIB_AVAILABLE_IN_ALL or listed in glib.symbols, so
it would have been glib-internal since 2004.
https://bugzilla.gnome.org/show_bug.cgi?id=710519
2013-10-19 19:03:58 +02:00
|
|
|
# define G_VA_COPY(ap1, ap2) memmove ((ap1), (ap2), sizeof (va_list))
|
Split glib.h into many header files mostly according to the resp.
2000-10-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* glib.h, galloca.h, garray.h, gasyncqueue.h, gbacktrace.h,
gcache.h, gcompletion.h, gconvert.h, gdataset.h, gdate.h, ghash.h,
ghook.h, giochannel.h, glist.h , gmacros.h, gmain.h, gmem.h,
gmessages.h, gnode.h, gprimes.h, gquark.h, gqueue.h, grand.h,
grel.h, gscanner.h, gslist.h, gstrfuncs.h, gstring.h, gthread.h,
gthreadpool.h, gtimer.h, gtree.h, gtypes.h, gutils.h: Split glib.h
into many header files mostly according to the resp. *.c-files.
* gmacros.h: Added G_BEGIN_DECLS and G_END_DECLS to mean: 'in case
of C++: extern "C" { ... }' analogous to glibc __BEGIN_DECLS and
__END_DECLS.
* configure.in, gerror.h, gfileutils.h, gshell.h, gspawn.h,
gunicode.h, : Changed guard-macro names to something more
consistent.
* configure.in, *.h: Use G_BEGIN_DECLS and G_END_DECLS.
2000-10-12 13:52:07 +02:00
|
|
|
# else /* va_list is a pointer */
|
|
|
|
# define G_VA_COPY(ap1, ap2) ((ap1) = (ap2))
|
|
|
|
# endif /* va_list is a pointer */
|
|
|
|
#endif /* !G_VA_COPY */
|
|
|
|
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2011-03-13 03:50:45 +01:00
|
|
|
const gchar * g_get_user_name (void);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2011-03-13 03:50:45 +01:00
|
|
|
const gchar * g_get_real_name (void);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2011-03-13 03:50:45 +01:00
|
|
|
const gchar * g_get_home_dir (void);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2011-03-13 03:50:45 +01:00
|
|
|
const gchar * g_get_tmp_dir (void);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2011-03-13 03:50:45 +01:00
|
|
|
const gchar * g_get_host_name (void);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2013-01-13 18:14:11 +01:00
|
|
|
const gchar * g_get_prgname (void);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2002-11-08 01:51:25 +01:00
|
|
|
void g_set_prgname (const gchar *prgname);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2011-03-13 03:50:45 +01:00
|
|
|
const gchar * g_get_application_name (void);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2002-11-08 01:51:25 +01:00
|
|
|
void g_set_application_name (const gchar *application_name);
|
Split glib.h into many header files mostly according to the resp.
2000-10-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* glib.h, galloca.h, garray.h, gasyncqueue.h, gbacktrace.h,
gcache.h, gcompletion.h, gconvert.h, gdataset.h, gdate.h, ghash.h,
ghook.h, giochannel.h, glist.h , gmacros.h, gmain.h, gmem.h,
gmessages.h, gnode.h, gprimes.h, gquark.h, gqueue.h, grand.h,
grel.h, gscanner.h, gslist.h, gstrfuncs.h, gstring.h, gthread.h,
gthreadpool.h, gtimer.h, gtree.h, gtypes.h, gutils.h: Split glib.h
into many header files mostly according to the resp. *.c-files.
* gmacros.h: Added G_BEGIN_DECLS and G_END_DECLS to mean: 'in case
of C++: extern "C" { ... }' analogous to glibc __BEGIN_DECLS and
__END_DECLS.
* configure.in, gerror.h, gfileutils.h, gshell.h, gspawn.h,
gunicode.h, : Changed guard-macro names to something more
consistent.
* configure.in, *.h: Use G_BEGIN_DECLS and G_END_DECLS.
2000-10-12 13:52:07 +02:00
|
|
|
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2011-03-13 03:50:45 +01:00
|
|
|
void g_reload_user_special_dirs_cache (void);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2011-03-13 03:50:45 +01:00
|
|
|
const gchar * g_get_user_data_dir (void);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2011-03-13 03:50:45 +01:00
|
|
|
const gchar * g_get_user_config_dir (void);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2011-03-13 03:50:45 +01:00
|
|
|
const gchar * g_get_user_cache_dir (void);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2011-03-13 03:50:45 +01:00
|
|
|
const gchar * const * g_get_system_data_dirs (void);
|
2005-04-08 14:03:16 +02:00
|
|
|
|
|
|
|
#ifdef G_OS_WIN32
|
2009-02-23 10:52:48 +01:00
|
|
|
/* This functions is not part of the public GLib API */
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2011-03-13 03:50:45 +01:00
|
|
|
const gchar * const * g_win32_get_system_data_dirs_for_module (void (*address_of_function)(void));
|
2005-07-20 10:37:13 +02:00
|
|
|
#endif
|
|
|
|
|
2017-01-19 19:53:34 +01:00
|
|
|
#if defined (G_OS_WIN32) && defined (G_CAN_INLINE)
|
2009-02-23 10:52:48 +01:00
|
|
|
/* This function is not part of the public GLib API either. Just call
|
|
|
|
* g_get_system_data_dirs() in your code, never mind that that is
|
|
|
|
* actually a macro and you will in fact call this inline function.
|
|
|
|
*/
|
2011-03-13 03:50:45 +01:00
|
|
|
static inline const gchar * const *
|
2009-02-23 10:52:48 +01:00
|
|
|
_g_win32_get_system_data_dirs (void)
|
2005-04-08 14:03:16 +02:00
|
|
|
{
|
2009-08-14 21:59:47 +02:00
|
|
|
return g_win32_get_system_data_dirs_for_module ((void (*)(void)) &_g_win32_get_system_data_dirs);
|
2005-04-08 14:03:16 +02:00
|
|
|
}
|
2009-02-23 10:52:48 +01:00
|
|
|
#define g_get_system_data_dirs _g_win32_get_system_data_dirs
|
2005-04-08 14:03:16 +02:00
|
|
|
#endif
|
|
|
|
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2011-03-13 03:50:45 +01:00
|
|
|
const gchar * const * g_get_system_config_dirs (void);
|
Split glib.h into many header files mostly according to the resp.
2000-10-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* glib.h, galloca.h, garray.h, gasyncqueue.h, gbacktrace.h,
gcache.h, gcompletion.h, gconvert.h, gdataset.h, gdate.h, ghash.h,
ghook.h, giochannel.h, glist.h , gmacros.h, gmain.h, gmem.h,
gmessages.h, gnode.h, gprimes.h, gquark.h, gqueue.h, grand.h,
grel.h, gscanner.h, gslist.h, gstrfuncs.h, gstring.h, gthread.h,
gthreadpool.h, gtimer.h, gtree.h, gtypes.h, gutils.h: Split glib.h
into many header files mostly according to the resp. *.c-files.
* gmacros.h: Added G_BEGIN_DECLS and G_END_DECLS to mean: 'in case
of C++: extern "C" { ... }' analogous to glibc __BEGIN_DECLS and
__END_DECLS.
* configure.in, gerror.h, gfileutils.h, gshell.h, gspawn.h,
gunicode.h, : Changed guard-macro names to something more
consistent.
* configure.in, *.h: Use G_BEGIN_DECLS and G_END_DECLS.
2000-10-12 13:52:07 +02:00
|
|
|
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2010-11-06 22:34:40 +01:00
|
|
|
const gchar * g_get_user_runtime_dir (void);
|
|
|
|
|
2007-06-04 16:54:49 +02:00
|
|
|
/**
|
|
|
|
* GUserDirectory:
|
|
|
|
* @G_USER_DIRECTORY_DESKTOP: the user's Desktop directory
|
|
|
|
* @G_USER_DIRECTORY_DOCUMENTS: the user's Documents directory
|
|
|
|
* @G_USER_DIRECTORY_DOWNLOAD: the user's Downloads directory
|
|
|
|
* @G_USER_DIRECTORY_MUSIC: the user's Music directory
|
|
|
|
* @G_USER_DIRECTORY_PICTURES: the user's Pictures directory
|
|
|
|
* @G_USER_DIRECTORY_PUBLIC_SHARE: the user's shared directory
|
|
|
|
* @G_USER_DIRECTORY_TEMPLATES: the user's Templates directory
|
|
|
|
* @G_USER_DIRECTORY_VIDEOS: the user's Movies directory
|
2007-09-16 20:32:51 +02:00
|
|
|
* @G_USER_N_DIRECTORIES: the number of enum values
|
|
|
|
*
|
|
|
|
* These are logical ids for special directories which are defined
|
|
|
|
* depending on the platform used. You should use g_get_user_special_dir()
|
|
|
|
* to retrieve the full path associated to the logical id.
|
|
|
|
*
|
|
|
|
* The #GUserDirectory enumeration can be extended at later date. Not
|
|
|
|
* every platform has a directory for every logical id in this
|
|
|
|
* enumeration.
|
2007-06-04 16:54:49 +02:00
|
|
|
*
|
|
|
|
* Since: 2.14
|
|
|
|
*/
|
|
|
|
typedef enum {
|
|
|
|
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
|
|
|
|
} GUserDirectory;
|
|
|
|
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2011-03-13 03:50:45 +01:00
|
|
|
const gchar * g_get_user_special_dir (GUserDirectory directory);
|
2007-06-04 16:54:49 +02:00
|
|
|
|
2011-06-09 05:44:39 +02:00
|
|
|
/**
|
|
|
|
* GDebugKey:
|
|
|
|
* @key: the string
|
|
|
|
* @value: the flag
|
|
|
|
*
|
|
|
|
* Associates a string with a bit flag.
|
|
|
|
* Used in g_parse_debug_string().
|
|
|
|
*/
|
|
|
|
typedef struct _GDebugKey GDebugKey;
|
Split glib.h into many header files mostly according to the resp.
2000-10-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* glib.h, galloca.h, garray.h, gasyncqueue.h, gbacktrace.h,
gcache.h, gcompletion.h, gconvert.h, gdataset.h, gdate.h, ghash.h,
ghook.h, giochannel.h, glist.h , gmacros.h, gmain.h, gmem.h,
gmessages.h, gnode.h, gprimes.h, gquark.h, gqueue.h, grand.h,
grel.h, gscanner.h, gslist.h, gstrfuncs.h, gstring.h, gthread.h,
gthreadpool.h, gtimer.h, gtree.h, gtypes.h, gutils.h: Split glib.h
into many header files mostly according to the resp. *.c-files.
* gmacros.h: Added G_BEGIN_DECLS and G_END_DECLS to mean: 'in case
of C++: extern "C" { ... }' analogous to glibc __BEGIN_DECLS and
__END_DECLS.
* configure.in, gerror.h, gfileutils.h, gshell.h, gspawn.h,
gunicode.h, : Changed guard-macro names to something more
consistent.
* configure.in, *.h: Use G_BEGIN_DECLS and G_END_DECLS.
2000-10-12 13:52:07 +02:00
|
|
|
struct _GDebugKey
|
|
|
|
{
|
2008-11-29 02:21:11 +01:00
|
|
|
const gchar *key;
|
|
|
|
guint value;
|
Split glib.h into many header files mostly according to the resp.
2000-10-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* glib.h, galloca.h, garray.h, gasyncqueue.h, gbacktrace.h,
gcache.h, gcompletion.h, gconvert.h, gdataset.h, gdate.h, ghash.h,
ghook.h, giochannel.h, glist.h , gmacros.h, gmain.h, gmem.h,
gmessages.h, gnode.h, gprimes.h, gquark.h, gqueue.h, grand.h,
grel.h, gscanner.h, gslist.h, gstrfuncs.h, gstring.h, gthread.h,
gthreadpool.h, gtimer.h, gtree.h, gtypes.h, gutils.h: Split glib.h
into many header files mostly according to the resp. *.c-files.
* gmacros.h: Added G_BEGIN_DECLS and G_END_DECLS to mean: 'in case
of C++: extern "C" { ... }' analogous to glibc __BEGIN_DECLS and
__END_DECLS.
* configure.in, gerror.h, gfileutils.h, gshell.h, gspawn.h,
gunicode.h, : Changed guard-macro names to something more
consistent.
* configure.in, *.h: Use G_BEGIN_DECLS and G_END_DECLS.
2000-10-12 13:52:07 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Miscellaneous utility functions
|
|
|
|
*/
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2001-04-16 17:04:17 +02:00
|
|
|
guint g_parse_debug_string (const gchar *string,
|
|
|
|
const GDebugKey *keys,
|
|
|
|
guint nkeys);
|
|
|
|
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2001-02-18 00:30:48 +01:00
|
|
|
gint g_snprintf (gchar *string,
|
|
|
|
gulong n,
|
|
|
|
gchar const *format,
|
|
|
|
...) G_GNUC_PRINTF (3, 4);
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2001-02-18 00:30:48 +01:00
|
|
|
gint g_vsnprintf (gchar *string,
|
|
|
|
gulong n,
|
|
|
|
gchar const *format,
|
2013-01-13 17:05:14 +01:00
|
|
|
va_list args)
|
|
|
|
G_GNUC_PRINTF(3, 0);
|
2001-02-18 00:30:48 +01:00
|
|
|
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2011-10-17 07:30:31 +02:00
|
|
|
void g_nullify_pointer (gpointer *nullify_location);
|
2001-04-19 15:33:31 +02:00
|
|
|
|
2011-10-17 07:30:31 +02:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
G_FORMAT_SIZE_DEFAULT = 0,
|
|
|
|
G_FORMAT_SIZE_LONG_FORMAT = 1 << 0,
|
2017-10-20 17:43:36 +02:00
|
|
|
G_FORMAT_SIZE_IEC_UNITS = 1 << 1,
|
|
|
|
G_FORMAT_SIZE_BITS = 1 << 2
|
2011-10-17 07:30:31 +02:00
|
|
|
} GFormatSizeFlags;
|
2001-04-19 15:33:31 +02:00
|
|
|
|
2012-05-25 14:42:50 +02:00
|
|
|
GLIB_AVAILABLE_IN_2_30
|
2011-10-17 07:30:31 +02:00
|
|
|
gchar *g_format_size_full (guint64 size,
|
|
|
|
GFormatSizeFlags flags);
|
2012-05-25 14:42:50 +02:00
|
|
|
GLIB_AVAILABLE_IN_2_30
|
2011-10-17 07:30:31 +02:00
|
|
|
gchar *g_format_size (guint64 size);
|
Split glib.h into many header files mostly according to the resp.
2000-10-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* glib.h, galloca.h, garray.h, gasyncqueue.h, gbacktrace.h,
gcache.h, gcompletion.h, gconvert.h, gdataset.h, gdate.h, ghash.h,
ghook.h, giochannel.h, glist.h , gmacros.h, gmain.h, gmem.h,
gmessages.h, gnode.h, gprimes.h, gquark.h, gqueue.h, grand.h,
grel.h, gscanner.h, gslist.h, gstrfuncs.h, gstring.h, gthread.h,
gthreadpool.h, gtimer.h, gtree.h, gtypes.h, gutils.h: Split glib.h
into many header files mostly according to the resp. *.c-files.
* gmacros.h: Added G_BEGIN_DECLS and G_END_DECLS to mean: 'in case
of C++: extern "C" { ... }' analogous to glibc __BEGIN_DECLS and
__END_DECLS.
* configure.in, gerror.h, gfileutils.h, gshell.h, gspawn.h,
gunicode.h, : Changed guard-macro names to something more
consistent.
* configure.in, *.h: Use G_BEGIN_DECLS and G_END_DECLS.
2000-10-12 13:52:07 +02:00
|
|
|
|
2018-05-09 03:24:00 +02:00
|
|
|
GLIB_DEPRECATED_IN_2_30_FOR(g_format_size)
|
2011-10-17 07:30:31 +02:00
|
|
|
gchar *g_format_size_for_display (goffset size);
|
2004-10-27 18:46:29 +02:00
|
|
|
|
2011-11-03 05:04:15 +01:00
|
|
|
#ifndef G_DISABLE_DEPRECATED
|
2011-06-09 05:44:39 +02:00
|
|
|
/**
|
|
|
|
* GVoidFunc:
|
|
|
|
*
|
|
|
|
* 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().
|
Split glib.h into many header files mostly according to the resp.
2000-10-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* glib.h, galloca.h, garray.h, gasyncqueue.h, gbacktrace.h,
gcache.h, gcompletion.h, gconvert.h, gdataset.h, gdate.h, ghash.h,
ghook.h, giochannel.h, glist.h , gmacros.h, gmain.h, gmem.h,
gmessages.h, gnode.h, gprimes.h, gquark.h, gqueue.h, grand.h,
grel.h, gscanner.h, gslist.h, gstrfuncs.h, gstring.h, gthread.h,
gthreadpool.h, gtimer.h, gtree.h, gtypes.h, gutils.h: Split glib.h
into many header files mostly according to the resp. *.c-files.
* gmacros.h: Added G_BEGIN_DECLS and G_END_DECLS to mean: 'in case
of C++: extern "C" { ... }' analogous to glibc __BEGIN_DECLS and
__END_DECLS.
* configure.in, gerror.h, gfileutils.h, gshell.h, gspawn.h,
gunicode.h, : Changed guard-macro names to something more
consistent.
* configure.in, *.h: Use G_BEGIN_DECLS and G_END_DECLS.
2000-10-12 13:52:07 +02:00
|
|
|
*/
|
2011-06-09 05:44:39 +02:00
|
|
|
typedef void (*GVoidFunc) (void);
|
Require C90 compliance
Assume all supported platforms implement C90, and therefore they
(correctly) implement atexit(), memmove(), setlocale(), strerror(),
and vprintf(), and have <float.h> and <limits.h>.
(Also remove the configure check testing that "do ... while (0)" works
correctly; the non-do/while-based version of G_STMT_START and
G_STMT_END was removed years ago, but the check remained. Also, remove
some checks that configure.ac claimed were needed for libcharset, but
aren't actually used.)
Note that removing the g_memmove() function is not an ABI break even
on systems where g_memmove() was previously not a macro, because it
was never marked GLIB_AVAILABLE_IN_ALL or listed in glib.symbols, so
it would have been glib-internal since 2004.
https://bugzilla.gnome.org/show_bug.cgi?id=710519
2013-10-19 19:03:58 +02:00
|
|
|
#define ATEXIT(proc) g_ATEXIT(proc)
|
2011-10-20 03:03:43 +02:00
|
|
|
GLIB_DEPRECATED
|
Split glib.h into many header files mostly according to the resp.
2000-10-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* glib.h, galloca.h, garray.h, gasyncqueue.h, gbacktrace.h,
gcache.h, gcompletion.h, gconvert.h, gdataset.h, gdate.h, ghash.h,
ghook.h, giochannel.h, glist.h , gmacros.h, gmain.h, gmem.h,
gmessages.h, gnode.h, gprimes.h, gquark.h, gqueue.h, grand.h,
grel.h, gscanner.h, gslist.h, gstrfuncs.h, gstring.h, gthread.h,
gthreadpool.h, gtimer.h, gtree.h, gtypes.h, gutils.h: Split glib.h
into many header files mostly according to the resp. *.c-files.
* gmacros.h: Added G_BEGIN_DECLS and G_END_DECLS to mean: 'in case
of C++: extern "C" { ... }' analogous to glibc __BEGIN_DECLS and
__END_DECLS.
* configure.in, gerror.h, gfileutils.h, gshell.h, gspawn.h,
gunicode.h, : Changed guard-macro names to something more
consistent.
* configure.in, *.h: Use G_BEGIN_DECLS and G_END_DECLS.
2000-10-12 13:52:07 +02:00
|
|
|
void g_atexit (GVoidFunc func);
|
|
|
|
|
2005-08-31 23:02:47 +02:00
|
|
|
#ifdef G_OS_WIN32
|
|
|
|
/* It's a bad idea to wrap atexit() on Windows. If the GLib DLL calls
|
|
|
|
* atexit(), the function will be called when the GLib DLL is detached
|
|
|
|
* from the program, which is not what the caller wants. The caller
|
|
|
|
* wants the function to be called when it *itself* exits (or is
|
|
|
|
* detached, in case the caller, too, is a DLL).
|
|
|
|
*/
|
2010-01-05 10:28:43 +01:00
|
|
|
#if (defined(__MINGW_H) && !defined(_STDLIB_H_)) || (defined(_MSC_VER) && !defined(_INC_STDLIB))
|
2005-08-31 23:02:47 +02:00
|
|
|
int atexit (void (*)(void));
|
2009-11-10 00:37:13 +01:00
|
|
|
#endif
|
2005-08-31 23:02:47 +02:00
|
|
|
#define g_atexit(func) atexit(func)
|
|
|
|
#endif
|
|
|
|
|
2015-08-21 02:16:23 +02:00
|
|
|
#endif
|
2011-10-20 03:03:43 +02:00
|
|
|
|
2011-10-15 22:13:08 +02:00
|
|
|
|
2000-10-13 10:16:54 +02:00
|
|
|
/* Look for an executable in PATH, following execvp() rules */
|
2012-12-06 20:04:59 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2000-10-13 10:16:54 +02:00
|
|
|
gchar* g_find_program_in_path (const gchar *program);
|
Split glib.h into many header files mostly according to the resp.
2000-10-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* glib.h, galloca.h, garray.h, gasyncqueue.h, gbacktrace.h,
gcache.h, gcompletion.h, gconvert.h, gdataset.h, gdate.h, ghash.h,
ghook.h, giochannel.h, glist.h , gmacros.h, gmain.h, gmem.h,
gmessages.h, gnode.h, gprimes.h, gquark.h, gqueue.h, grand.h,
grel.h, gscanner.h, gslist.h, gstrfuncs.h, gstring.h, gthread.h,
gthreadpool.h, gtimer.h, gtree.h, gtypes.h, gutils.h: Split glib.h
into many header files mostly according to the resp. *.c-files.
* gmacros.h: Added G_BEGIN_DECLS and G_END_DECLS to mean: 'in case
of C++: extern "C" { ... }' analogous to glibc __BEGIN_DECLS and
__END_DECLS.
* configure.in, gerror.h, gfileutils.h, gshell.h, gspawn.h,
gunicode.h, : Changed guard-macro names to something more
consistent.
* configure.in, *.h: Use G_BEGIN_DECLS and G_END_DECLS.
2000-10-12 13:52:07 +02:00
|
|
|
|
|
|
|
/* Bit tests
|
2015-11-09 17:12:18 +01:00
|
|
|
*
|
|
|
|
* These are defined in a convoluted way because we want the compiler to
|
|
|
|
* be able to inline the code for performance reasons, but for
|
|
|
|
* historical reasons, we must continue to provide non-inline versions
|
|
|
|
* on our ABI.
|
|
|
|
*
|
|
|
|
* We define these as functions in gutils.c which are just implemented
|
|
|
|
* as calls to the _impl() versions in order to preserve the ABI.
|
Split glib.h into many header files mostly according to the resp.
2000-10-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* glib.h, galloca.h, garray.h, gasyncqueue.h, gbacktrace.h,
gcache.h, gcompletion.h, gconvert.h, gdataset.h, gdate.h, ghash.h,
ghook.h, giochannel.h, glist.h , gmacros.h, gmain.h, gmem.h,
gmessages.h, gnode.h, gprimes.h, gquark.h, gqueue.h, grand.h,
grel.h, gscanner.h, gslist.h, gstrfuncs.h, gstring.h, gthread.h,
gthreadpool.h, gtimer.h, gtree.h, gtypes.h, gutils.h: Split glib.h
into many header files mostly according to the resp. *.c-files.
* gmacros.h: Added G_BEGIN_DECLS and G_END_DECLS to mean: 'in case
of C++: extern "C" { ... }' analogous to glibc __BEGIN_DECLS and
__END_DECLS.
* configure.in, gerror.h, gfileutils.h, gshell.h, gspawn.h,
gunicode.h, : Changed guard-macro names to something more
consistent.
* configure.in, *.h: Use G_BEGIN_DECLS and G_END_DECLS.
2000-10-12 13:52:07 +02:00
|
|
|
*/
|
|
|
|
|
2015-11-09 17:12:18 +01:00
|
|
|
#define g_bit_nth_lsf(mask, nth_bit) g_bit_nth_lsf_impl(mask, nth_bit)
|
|
|
|
#define g_bit_nth_msf(mask, nth_bit) g_bit_nth_msf_impl(mask, nth_bit)
|
|
|
|
#define g_bit_storage(number) g_bit_storage_impl(number)
|
|
|
|
|
2015-11-25 14:48:06 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2015-11-09 17:12:18 +01:00
|
|
|
gint (g_bit_nth_lsf) (gulong mask,
|
|
|
|
gint nth_bit);
|
2015-11-25 14:48:06 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2015-11-09 17:12:18 +01:00
|
|
|
gint (g_bit_nth_msf) (gulong mask,
|
|
|
|
gint nth_bit);
|
2015-11-25 14:48:06 +01:00
|
|
|
GLIB_AVAILABLE_IN_ALL
|
2015-11-09 17:12:18 +01:00
|
|
|
guint (g_bit_storage) (gulong number);
|
|
|
|
|
|
|
|
static inline gint
|
|
|
|
g_bit_nth_lsf_impl (gulong mask,
|
|
|
|
gint nth_bit)
|
Split glib.h into many header files mostly according to the resp.
2000-10-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* glib.h, galloca.h, garray.h, gasyncqueue.h, gbacktrace.h,
gcache.h, gcompletion.h, gconvert.h, gdataset.h, gdate.h, ghash.h,
ghook.h, giochannel.h, glist.h , gmacros.h, gmain.h, gmem.h,
gmessages.h, gnode.h, gprimes.h, gquark.h, gqueue.h, grand.h,
grel.h, gscanner.h, gslist.h, gstrfuncs.h, gstring.h, gthread.h,
gthreadpool.h, gtimer.h, gtree.h, gtypes.h, gutils.h: Split glib.h
into many header files mostly according to the resp. *.c-files.
* gmacros.h: Added G_BEGIN_DECLS and G_END_DECLS to mean: 'in case
of C++: extern "C" { ... }' analogous to glibc __BEGIN_DECLS and
__END_DECLS.
* configure.in, gerror.h, gfileutils.h, gshell.h, gspawn.h,
gunicode.h, : Changed guard-macro names to something more
consistent.
* configure.in, *.h: Use G_BEGIN_DECLS and G_END_DECLS.
2000-10-12 13:52:07 +02:00
|
|
|
{
|
2007-01-03 21:08:53 +01:00
|
|
|
if (G_UNLIKELY (nth_bit < -1))
|
|
|
|
nth_bit = -1;
|
|
|
|
while (nth_bit < ((GLIB_SIZEOF_LONG * 8) - 1))
|
Split glib.h into many header files mostly according to the resp.
2000-10-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* glib.h, galloca.h, garray.h, gasyncqueue.h, gbacktrace.h,
gcache.h, gcompletion.h, gconvert.h, gdataset.h, gdate.h, ghash.h,
ghook.h, giochannel.h, glist.h , gmacros.h, gmain.h, gmem.h,
gmessages.h, gnode.h, gprimes.h, gquark.h, gqueue.h, grand.h,
grel.h, gscanner.h, gslist.h, gstrfuncs.h, gstring.h, gthread.h,
gthreadpool.h, gtimer.h, gtree.h, gtypes.h, gutils.h: Split glib.h
into many header files mostly according to the resp. *.c-files.
* gmacros.h: Added G_BEGIN_DECLS and G_END_DECLS to mean: 'in case
of C++: extern "C" { ... }' analogous to glibc __BEGIN_DECLS and
__END_DECLS.
* configure.in, gerror.h, gfileutils.h, gshell.h, gspawn.h,
gunicode.h, : Changed guard-macro names to something more
consistent.
* configure.in, *.h: Use G_BEGIN_DECLS and G_END_DECLS.
2000-10-12 13:52:07 +02:00
|
|
|
{
|
|
|
|
nth_bit++;
|
2004-01-10 09:15:24 +01:00
|
|
|
if (mask & (1UL << nth_bit))
|
2015-11-09 17:12:18 +01:00
|
|
|
return nth_bit;
|
Split glib.h into many header files mostly according to the resp.
2000-10-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* glib.h, galloca.h, garray.h, gasyncqueue.h, gbacktrace.h,
gcache.h, gcompletion.h, gconvert.h, gdataset.h, gdate.h, ghash.h,
ghook.h, giochannel.h, glist.h , gmacros.h, gmain.h, gmem.h,
gmessages.h, gnode.h, gprimes.h, gquark.h, gqueue.h, grand.h,
grel.h, gscanner.h, gslist.h, gstrfuncs.h, gstring.h, gthread.h,
gthreadpool.h, gtimer.h, gtree.h, gtypes.h, gutils.h: Split glib.h
into many header files mostly according to the resp. *.c-files.
* gmacros.h: Added G_BEGIN_DECLS and G_END_DECLS to mean: 'in case
of C++: extern "C" { ... }' analogous to glibc __BEGIN_DECLS and
__END_DECLS.
* configure.in, gerror.h, gfileutils.h, gshell.h, gspawn.h,
gunicode.h, : Changed guard-macro names to something more
consistent.
* configure.in, *.h: Use G_BEGIN_DECLS and G_END_DECLS.
2000-10-12 13:52:07 +02:00
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
2015-11-09 17:12:18 +01:00
|
|
|
|
|
|
|
static inline gint
|
|
|
|
g_bit_nth_msf_impl (gulong mask,
|
|
|
|
gint nth_bit)
|
Split glib.h into many header files mostly according to the resp.
2000-10-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* glib.h, galloca.h, garray.h, gasyncqueue.h, gbacktrace.h,
gcache.h, gcompletion.h, gconvert.h, gdataset.h, gdate.h, ghash.h,
ghook.h, giochannel.h, glist.h , gmacros.h, gmain.h, gmem.h,
gmessages.h, gnode.h, gprimes.h, gquark.h, gqueue.h, grand.h,
grel.h, gscanner.h, gslist.h, gstrfuncs.h, gstring.h, gthread.h,
gthreadpool.h, gtimer.h, gtree.h, gtypes.h, gutils.h: Split glib.h
into many header files mostly according to the resp. *.c-files.
* gmacros.h: Added G_BEGIN_DECLS and G_END_DECLS to mean: 'in case
of C++: extern "C" { ... }' analogous to glibc __BEGIN_DECLS and
__END_DECLS.
* configure.in, gerror.h, gfileutils.h, gshell.h, gspawn.h,
gunicode.h, : Changed guard-macro names to something more
consistent.
* configure.in, *.h: Use G_BEGIN_DECLS and G_END_DECLS.
2000-10-12 13:52:07 +02:00
|
|
|
{
|
2007-01-03 21:08:53 +01:00
|
|
|
if (nth_bit < 0 || G_UNLIKELY (nth_bit > GLIB_SIZEOF_LONG * 8))
|
2001-07-11 00:37:08 +02:00
|
|
|
nth_bit = GLIB_SIZEOF_LONG * 8;
|
2007-01-03 21:08:53 +01:00
|
|
|
while (nth_bit > 0)
|
Split glib.h into many header files mostly according to the resp.
2000-10-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* glib.h, galloca.h, garray.h, gasyncqueue.h, gbacktrace.h,
gcache.h, gcompletion.h, gconvert.h, gdataset.h, gdate.h, ghash.h,
ghook.h, giochannel.h, glist.h , gmacros.h, gmain.h, gmem.h,
gmessages.h, gnode.h, gprimes.h, gquark.h, gqueue.h, grand.h,
grel.h, gscanner.h, gslist.h, gstrfuncs.h, gstring.h, gthread.h,
gthreadpool.h, gtimer.h, gtree.h, gtypes.h, gutils.h: Split glib.h
into many header files mostly according to the resp. *.c-files.
* gmacros.h: Added G_BEGIN_DECLS and G_END_DECLS to mean: 'in case
of C++: extern "C" { ... }' analogous to glibc __BEGIN_DECLS and
__END_DECLS.
* configure.in, gerror.h, gfileutils.h, gshell.h, gspawn.h,
gunicode.h, : Changed guard-macro names to something more
consistent.
* configure.in, *.h: Use G_BEGIN_DECLS and G_END_DECLS.
2000-10-12 13:52:07 +02:00
|
|
|
{
|
|
|
|
nth_bit--;
|
2004-01-10 09:15:24 +01:00
|
|
|
if (mask & (1UL << nth_bit))
|
2015-11-09 17:12:18 +01:00
|
|
|
return nth_bit;
|
Split glib.h into many header files mostly according to the resp.
2000-10-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* glib.h, galloca.h, garray.h, gasyncqueue.h, gbacktrace.h,
gcache.h, gcompletion.h, gconvert.h, gdataset.h, gdate.h, ghash.h,
ghook.h, giochannel.h, glist.h , gmacros.h, gmain.h, gmem.h,
gmessages.h, gnode.h, gprimes.h, gquark.h, gqueue.h, grand.h,
grel.h, gscanner.h, gslist.h, gstrfuncs.h, gstring.h, gthread.h,
gthreadpool.h, gtimer.h, gtree.h, gtypes.h, gutils.h: Split glib.h
into many header files mostly according to the resp. *.c-files.
* gmacros.h: Added G_BEGIN_DECLS and G_END_DECLS to mean: 'in case
of C++: extern "C" { ... }' analogous to glibc __BEGIN_DECLS and
__END_DECLS.
* configure.in, gerror.h, gfileutils.h, gshell.h, gspawn.h,
gunicode.h, : Changed guard-macro names to something more
consistent.
* configure.in, *.h: Use G_BEGIN_DECLS and G_END_DECLS.
2000-10-12 13:52:07 +02:00
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
2015-11-09 17:12:18 +01:00
|
|
|
|
|
|
|
static inline guint
|
|
|
|
g_bit_storage_impl (gulong number)
|
Split glib.h into many header files mostly according to the resp.
2000-10-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* glib.h, galloca.h, garray.h, gasyncqueue.h, gbacktrace.h,
gcache.h, gcompletion.h, gconvert.h, gdataset.h, gdate.h, ghash.h,
ghook.h, giochannel.h, glist.h , gmacros.h, gmain.h, gmem.h,
gmessages.h, gnode.h, gprimes.h, gquark.h, gqueue.h, grand.h,
grel.h, gscanner.h, gslist.h, gstrfuncs.h, gstring.h, gthread.h,
gthreadpool.h, gtimer.h, gtree.h, gtypes.h, gutils.h: Split glib.h
into many header files mostly according to the resp. *.c-files.
* gmacros.h: Added G_BEGIN_DECLS and G_END_DECLS to mean: 'in case
of C++: extern "C" { ... }' analogous to glibc __BEGIN_DECLS and
__END_DECLS.
* configure.in, gerror.h, gfileutils.h, gshell.h, gspawn.h,
gunicode.h, : Changed guard-macro names to something more
consistent.
* configure.in, *.h: Use G_BEGIN_DECLS and G_END_DECLS.
2000-10-12 13:52:07 +02:00
|
|
|
{
|
2007-01-03 21:08:53 +01:00
|
|
|
#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(__OPTIMIZE__)
|
2007-01-09 20:05:36 +01:00
|
|
|
return G_LIKELY (number) ?
|
2015-11-09 17:12:18 +01:00
|
|
|
((GLIB_SIZEOF_LONG * 8U - 1) ^ (guint) __builtin_clzl(number)) + 1 : 1;
|
2007-01-03 21:08:53 +01:00
|
|
|
#else
|
2014-05-25 12:18:14 +02:00
|
|
|
guint n_bits = 0;
|
2015-11-09 17:12:18 +01:00
|
|
|
|
Split glib.h into many header files mostly according to the resp.
2000-10-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* glib.h, galloca.h, garray.h, gasyncqueue.h, gbacktrace.h,
gcache.h, gcompletion.h, gconvert.h, gdataset.h, gdate.h, ghash.h,
ghook.h, giochannel.h, glist.h , gmacros.h, gmain.h, gmem.h,
gmessages.h, gnode.h, gprimes.h, gquark.h, gqueue.h, grand.h,
grel.h, gscanner.h, gslist.h, gstrfuncs.h, gstring.h, gthread.h,
gthreadpool.h, gtimer.h, gtree.h, gtypes.h, gutils.h: Split glib.h
into many header files mostly according to the resp. *.c-files.
* gmacros.h: Added G_BEGIN_DECLS and G_END_DECLS to mean: 'in case
of C++: extern "C" { ... }' analogous to glibc __BEGIN_DECLS and
__END_DECLS.
* configure.in, gerror.h, gfileutils.h, gshell.h, gspawn.h,
gunicode.h, : Changed guard-macro names to something more
consistent.
* configure.in, *.h: Use G_BEGIN_DECLS and G_END_DECLS.
2000-10-12 13:52:07 +02:00
|
|
|
do
|
|
|
|
{
|
|
|
|
n_bits++;
|
|
|
|
number >>= 1;
|
|
|
|
}
|
|
|
|
while (number);
|
|
|
|
return n_bits;
|
2007-01-03 21:08:53 +01:00
|
|
|
#endif
|
Split glib.h into many header files mostly according to the resp.
2000-10-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* glib.h, galloca.h, garray.h, gasyncqueue.h, gbacktrace.h,
gcache.h, gcompletion.h, gconvert.h, gdataset.h, gdate.h, ghash.h,
ghook.h, giochannel.h, glist.h , gmacros.h, gmain.h, gmem.h,
gmessages.h, gnode.h, gprimes.h, gquark.h, gqueue.h, grand.h,
grel.h, gscanner.h, gslist.h, gstrfuncs.h, gstring.h, gthread.h,
gthreadpool.h, gtimer.h, gtree.h, gtypes.h, gutils.h: Split glib.h
into many header files mostly according to the resp. *.c-files.
* gmacros.h: Added G_BEGIN_DECLS and G_END_DECLS to mean: 'in case
of C++: extern "C" { ... }' analogous to glibc __BEGIN_DECLS and
__END_DECLS.
* configure.in, gerror.h, gfileutils.h, gshell.h, gspawn.h,
gunicode.h, : Changed guard-macro names to something more
consistent.
* configure.in, *.h: Use G_BEGIN_DECLS and G_END_DECLS.
2000-10-12 13:52:07 +02:00
|
|
|
}
|
|
|
|
|
2016-03-30 15:56:43 +02:00
|
|
|
/* Crashes the program. */
|
|
|
|
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_50
|
|
|
|
#ifndef G_OS_WIN32
|
2018-02-18 03:28:17 +01:00
|
|
|
# include <stdlib.h>
|
2016-03-30 15:56:43 +02:00
|
|
|
# define g_abort() abort ()
|
|
|
|
#else
|
|
|
|
GLIB_AVAILABLE_IN_2_50
|
|
|
|
void g_abort (void) G_GNUC_NORETURN G_ANALYZER_NORETURN;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2008-09-13 22:23:17 +02:00
|
|
|
#ifndef G_DISABLE_DEPRECATED
|
|
|
|
|
2001-10-23 01:19:19 +02:00
|
|
|
/*
|
2008-09-13 22:23:17 +02:00
|
|
|
* This macro is deprecated. This DllMain() is too complex. It is
|
|
|
|
* recommended to write an explicit minimal DLlMain() that just saves
|
|
|
|
* the handle to the DLL and then use that handle instead, for
|
|
|
|
* instance passing it to
|
2008-02-24 02:07:41 +01:00
|
|
|
* g_win32_get_package_installation_directory_of_module().
|
|
|
|
*
|
2001-10-23 01:19:19 +02:00
|
|
|
* On Windows, this macro defines a DllMain function that stores the
|
|
|
|
* actual DLL name that the code being compiled will be included in.
|
|
|
|
* STATIC should be empty or 'static'. DLL_NAME is the name of the
|
|
|
|
* (pointer to the) char array where the DLL name will be stored. If
|
|
|
|
* this is used, you must also include <windows.h>. If you need a more complex
|
|
|
|
* DLL entry point function, you cannot use this.
|
|
|
|
*
|
|
|
|
* On non-Windows platforms, expands to nothing.
|
|
|
|
*/
|
Split glib.h into many header files mostly according to the resp.
2000-10-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* glib.h, galloca.h, garray.h, gasyncqueue.h, gbacktrace.h,
gcache.h, gcompletion.h, gconvert.h, gdataset.h, gdate.h, ghash.h,
ghook.h, giochannel.h, glist.h , gmacros.h, gmain.h, gmem.h,
gmessages.h, gnode.h, gprimes.h, gquark.h, gqueue.h, grand.h,
grel.h, gscanner.h, gslist.h, gstrfuncs.h, gstring.h, gthread.h,
gthreadpool.h, gtimer.h, gtree.h, gtypes.h, gutils.h: Split glib.h
into many header files mostly according to the resp. *.c-files.
* gmacros.h: Added G_BEGIN_DECLS and G_END_DECLS to mean: 'in case
of C++: extern "C" { ... }' analogous to glibc __BEGIN_DECLS and
__END_DECLS.
* configure.in, gerror.h, gfileutils.h, gshell.h, gspawn.h,
gunicode.h, : Changed guard-macro names to something more
consistent.
* configure.in, *.h: Use G_BEGIN_DECLS and G_END_DECLS.
2000-10-12 13:52:07 +02:00
|
|
|
|
2001-10-23 01:19:19 +02:00
|
|
|
#ifndef G_PLATFORM_WIN32
|
|
|
|
# define G_WIN32_DLLMAIN_FOR_DLL_NAME(static, dll_name)
|
|
|
|
#else
|
2005-04-08 01:46:38 +02:00
|
|
|
# define G_WIN32_DLLMAIN_FOR_DLL_NAME(static, dll_name) \
|
|
|
|
static char *dll_name; \
|
|
|
|
\
|
|
|
|
BOOL WINAPI \
|
|
|
|
DllMain (HINSTANCE hinstDLL, \
|
|
|
|
DWORD fdwReason, \
|
|
|
|
LPVOID lpvReserved) \
|
|
|
|
{ \
|
|
|
|
wchar_t wcbfr[1000]; \
|
|
|
|
char *tem; \
|
|
|
|
switch (fdwReason) \
|
|
|
|
{ \
|
|
|
|
case DLL_PROCESS_ATTACH: \
|
2006-12-28 16:41:28 +01:00
|
|
|
GetModuleFileNameW ((HMODULE) hinstDLL, wcbfr, G_N_ELEMENTS (wcbfr)); \
|
|
|
|
tem = g_utf16_to_utf8 (wcbfr, -1, NULL, NULL, NULL); \
|
|
|
|
dll_name = g_path_get_basename (tem); \
|
|
|
|
g_free (tem); \
|
2005-04-08 01:46:38 +02:00
|
|
|
break; \
|
|
|
|
} \
|
|
|
|
\
|
|
|
|
return TRUE; \
|
2001-10-23 01:19:19 +02:00
|
|
|
}
|
2008-09-13 22:23:17 +02:00
|
|
|
|
|
|
|
#endif /* !G_DISABLE_DEPRECATED */
|
|
|
|
|
2001-10-23 01:19:19 +02:00
|
|
|
#endif /* G_PLATFORM_WIN32 */
|
Split glib.h into many header files mostly according to the resp.
2000-10-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* glib.h, galloca.h, garray.h, gasyncqueue.h, gbacktrace.h,
gcache.h, gcompletion.h, gconvert.h, gdataset.h, gdate.h, ghash.h,
ghook.h, giochannel.h, glist.h , gmacros.h, gmain.h, gmem.h,
gmessages.h, gnode.h, gprimes.h, gquark.h, gqueue.h, grand.h,
grel.h, gscanner.h, gslist.h, gstrfuncs.h, gstring.h, gthread.h,
gthreadpool.h, gtimer.h, gtree.h, gtypes.h, gutils.h: Split glib.h
into many header files mostly according to the resp. *.c-files.
* gmacros.h: Added G_BEGIN_DECLS and G_END_DECLS to mean: 'in case
of C++: extern "C" { ... }' analogous to glibc __BEGIN_DECLS and
__END_DECLS.
* configure.in, gerror.h, gfileutils.h, gshell.h, gspawn.h,
gunicode.h, : Changed guard-macro names to something more
consistent.
* configure.in, *.h: Use G_BEGIN_DECLS and G_END_DECLS.
2000-10-12 13:52:07 +02:00
|
|
|
|
2012-12-30 05:57:23 +01:00
|
|
|
G_END_DECLS
|
|
|
|
|
2001-10-23 01:19:19 +02:00
|
|
|
#endif /* __G_UTILS_H__ */
|