/usr/include/gwyddion/libgwyddion/gwymacros.h is in libgwyddion20-dev 2.50-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | /*
* $Id: gwymacros.h 20678 2017-12-18 18:26:55Z yeti-dn $
* Copyright (C) 2003-2016 David Necas (Yeti), Petr Klapetek.
* E-mail: yeti@gwyddion.net, klapetek@gwyddion.net.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __GWY_MACROS_H__
#define __GWY_MACROS_H__
#include <stdarg.h>
#include <glib.h>
#include <gwyconfig.h>
/* FIXME: move to gwyconfig.h? or just config.h? */
/* XXX: Most of this is available in gi18n.h */
#ifdef ENABLE_NLS
#include <libintl.h>
#else
#define gettext(x) (x)
#define ngettext(sing, plur, n) ((n) == 1 ? (sing) : (plur))
#endif
#define _(x) gettext(x)
#ifdef gettext_noop
#define N_(x) gettext_noop(x)
#else
#define N_(x) (x)
#endif
#define GWY_SWAP(t, x, y) \
do { \
t __unsafe_swap; \
__unsafe_swap = x; \
x = y; \
y = __unsafe_swap; \
} while (0)
#define gwy_strequal(a, b) \
(!strcmp((a), (b)))
#define GWY_CLAMP(x, low, hi) \
(G_UNLIKELY((x) > (hi)) ? (hi) : (G_UNLIKELY((x) < (low)) ? (low) : (x)))
#define gwy_clear(array, n) \
memset((array), 0, (n)*sizeof((array)[0]))
#define gwy_assign(dest, source, n) \
memcpy((dest), (source), (n)*sizeof((dest)[0]))
#define GWY_OBJECT_UNREF(obj) \
do { \
if (obj) { \
g_object_unref(obj); \
(obj) = NULL; \
} \
} while (0)
#define gwy_object_unref GWY_OBJECT_UNREF
#define GWY_SIGNAL_HANDLER_DISCONNECT(obj, hid) \
do { \
if (hid && obj) \
g_signal_handler_disconnect(obj, hid); \
(hid) = 0; \
} while (0)
#define gwy_signal_handler_disconnect GWY_SIGNAL_HANDLER_DISCONNECT
#define GWY_FIND_PSPEC(type, id, spectype) \
G_PARAM_SPEC_##spectype(g_object_class_find_property \
(G_OBJECT_CLASS(g_type_class_peek(type)), id))
#define GWY_SI_VALUE_FORMAT_FREE(vf) \
do { \
if (vf) { \
gwy_si_unit_value_format_free(vf); \
(vf) = NULL; \
} \
} while (0)
#define GWY_FREE(ptr) \
do { \
if (ptr) { \
g_free(ptr); \
(ptr) = NULL; \
} \
} while (0)
G_BEGIN_DECLS
#ifdef G_HAVE_GNUC_VARARGS
# ifdef DEBUG
# define gwy_debug(format...) \
gwy_debug_gnu(G_LOG_DOMAIN,\
__FILE__ ":" G_STRINGIFY (__LINE__), \
G_STRFUNC, \
format)
# else
# define gwy_debug(format...) /* */
# endif
# define gwy_info(format...) \
g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format)
#elif defined(G_HAVE_ISO_VARARGS)
# ifdef DEBUG
# define gwy_debug(...) \
gwy_debug_gnu(G_LOG_DOMAIN, \
__FILE__ ":" G_STRINGIFY(__LINE__), \
G_STRFUNC, \
__VA_ARGS__)
# else
# define gwy_debug(...) /* */
# endif
# define gwy_info(...) \
g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, __VA_ARGS__)
#else
/* no varargs macros */
# ifdef DEBUG
static inline void
gwy_debug(const gchar *format, ...)
{
va_list args;
va_start(args, format);
g_logv(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format, args);
va_end(args);
}
gwy_info(const gchar *format, ...)
{
va_list args;
va_start(args, format);
g_logv(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format, args);
va_end(args);
}
# else
static inline void
gwy_debug(const gchar *format, ...)
{
}
# endif
#endif /* varargs macros */
void gwy_debug_gnu(const gchar *domain,
const gchar *fileline,
const gchar *funcname,
const gchar *format,
...) G_GNUC_PRINTF(4, 5);
G_END_DECLS
#endif /* __GWY_MACROS_H__ */
/* vim: set cin et ts=4 sw=4 cino=>1s,e0,n0,f0,{0,}0,^0,\:1s,=0,g1s,h0,t0,+1s,c3,(0,u0 : */
|