gwymacros

gwymacros — Utility macros.

Synopsis




#define     gettext                         (x)
#define     ngettext                        (sing, plur, n)
#define     _                               (x)
#define     N_                              (x)
#define     gwy_object_unref                (obj)
#define     GWY_SWAP                        (t, x, y)
#define     GWY_FIND_PSPEC                  (type, id, spectype)
#define     gwy_strequal                    (a, b)
#define     gwy_debug                       (format...)
void        gwy_debug_gnu                   (const gchar *domain,
                                             const gchar *fileline,
                                             const gchar *funcname,
                                             const gchar *format,
                                             ...);

Description

Details

gettext()

#define gettext(x) (x)

x :

ngettext()

#define ngettext(sing, plur, n) ((n) == 1 ? (sing) : (plur))

sing :
plur :
n :

_()

#define _(x) gettext(x)

x :

N_()

#define     N_(x)

x :

gwy_object_unref()

#define     gwy_object_unref(obj)

If obj is not NULL, unreferences obj. In all cases sets obj to NULL.

If the object reference count is greater than one, assure it should be referenced elsewhere, otherwise it leaks memory.

obj : A pointer to GObject or NULL (must be an l-value).

GWY_SWAP()

#define     GWY_SWAP(t, x, y)

Swaps two variables (more precisely lhs and rhs expressions) of type t in a single statement.

t : A C type.
x : A variable of type t to swap with x.
y : A variable of type t to swap with y.

GWY_FIND_PSPEC()

#define     GWY_FIND_PSPEC(type, id, spectype)

A convenience g_object_class_find_property() wrapper.

It expands to property spec cast to correct type (spec).

type : Object type (e.g. GWY_TYPE_CONTAINER).
id : Property id.
spectype : Param spec type (e.g. DOUBLE).

gwy_strequal()

#define gwy_strequal(a, b) (!strcmp((a), (b)))

Expands to TRUE if strings are equal, to FALSE otherwise.

a : A string.
b : Another string.

gwy_debug()

#define     gwy_debug(format...)

Prints a debugging message.

Does nothing if compiled without DEBUG defined.

format... : A format string followed by stuff to print.

gwy_debug_gnu ()

void        gwy_debug_gnu                   (const gchar *domain,
                                             const gchar *fileline,
                                             const gchar *funcname,
                                             const gchar *format,
                                             ...);

Print a debugging message.

To be used via gwy_debug(), should not be used directly.

domain : Log domain.
fileline : File and line info.
funcname : Function name.
format : Message format.
... : Message parameters.