Miscellaneous Macros

Miscellaneous Macros — macros used in liblangtag

Synopsis

#define             LT_ALIGNED_TO                       (_x_,
                                                         _y_)
#define             LT_ALIGNED_TO_POINTER               (_x_)
#define             LT_BEGIN_DECLS
#define             LT_BREAKPOINT
#define             LT_DIR_SEPARATOR
#define             LT_DIR_SEPARATOR_S
#define             LT_END_DECLS
#define             LT_GNUC_NULL_TERMINATED
#define             LT_GNUC_PRINTF                      (format_idx,
                                                         arg_idx)
#define             LT_INLINE_FUNC
#define             LT_LIKELY                           (_e_)
#define             LT_MAX
#define             LT_MIN
#define             LT_N_ELEMENTS                       (_x_)
#define             LT_PATH_MAX
#define             LT_SEARCHPATH_SEPARATOR
#define             LT_SEARCHPATH_SEPARATOR_S
#define             LT_STMT_END
#define             LT_STMT_START
#define             LT_UNLIKELY                         (_e_)
#define             inline
typedef             lt_bool_t;
int                 (*lt_compare_func_t)                (const lt_pointer_t v1,
                                                         const lt_pointer_t v2);
lt_pointer_t        (*lt_copy_func_t)                   (lt_pointer_t data);
void                (*lt_destroy_func_t)                (lt_pointer_t data);
typedef             lt_pointer_t;

Description

These macros provide more specialized features which are not needed so often by application programmers.

Details

LT_ALIGNED_TO()

#define LT_ALIGNED_TO(_x_,_y_)		(((_x_) + (_y_) - 1) & ~((_y_) - 1))


LT_ALIGNED_TO_POINTER()

#define LT_ALIGNED_TO_POINTER(_x_) LT_ALIGNED_TO ((_x_), ALIGNOF_VOID_P)


LT_BEGIN_DECLS

#  define LT_BEGIN_DECLS extern "C" {

Used (along with LT_END_DECLS) to bracket header files. If the compiler in use is a C++ compiler, adds extern "C" around the header.


LT_BREAKPOINT

#define             LT_BREAKPOINT()


LT_DIR_SEPARATOR

#  define LT_DIR_SEPARATOR		'\\'


LT_DIR_SEPARATOR_S

#  define LT_DIR_SEPARATOR_S		"\\"


LT_END_DECLS

#  define LT_END_DECLS		}

Used (along with LT_BEGIN_DECLS) to bracket header files. If the compiler in use is a C++ compiler, adds extern "C" around the header.


LT_GNUC_NULL_TERMINATED

#define             LT_GNUC_NULL_TERMINATED


LT_GNUC_PRINTF()

#define             LT_GNUC_PRINTF(format_idx, arg_idx)


LT_INLINE_FUNC

#  define LT_INLINE_FUNC static __inline __attribute__ ((unused))

This macro is used to export function prototypes so they can be linked with an external version when no inlining is performed.


LT_LIKELY()

#  define LT_LIKELY(_e_) (__builtin_expect (_LT_BOOLEAN_EXPR (_e_), 1))


LT_MAX

#  define LT_MAX		MAX


LT_MIN

#  define LT_MIN		MIN


LT_N_ELEMENTS()

#define LT_N_ELEMENTS(_x_)		(sizeof (_x_) / sizeof ((_x_)[0]))


LT_PATH_MAX

#define LT_PATH_MAX 512


LT_SEARCHPATH_SEPARATOR

#  define LT_SEARCHPATH_SEPARATOR ';'


LT_SEARCHPATH_SEPARATOR_S

#  define LT_SEARCHPATH_SEPARATOR_S ";"


LT_STMT_END

#  define LT_STMT_END		while (0)

Used within multi-statement macros so that they can be used in places where only on statement is expected by the compiler.


LT_STMT_START

#  define LT_STMT_START		do

Used within multi-statement macros so that they can be used in places where only on statement is expected by the compiler.


LT_UNLIKELY()

#  define LT_UNLIKELY(_e_) (__builtin_expect (_LT_BOOLEAN_EXPR (_e_), 0))


inline

#  define inline __inline__


lt_bool_t

typedef int		lt_bool_t;


lt_compare_func_t ()

int                 (*lt_compare_func_t)                (const lt_pointer_t v1,
                                                         const lt_pointer_t v2);


lt_copy_func_t ()

lt_pointer_t        (*lt_copy_func_t)                   (lt_pointer_t data);


lt_destroy_func_t ()

void                (*lt_destroy_func_t)                (lt_pointer_t data);


lt_pointer_t

typedef void *		lt_pointer_t;