diff options
author | Pixel <pixel@nobis-crew.org> | 2009-11-04 11:56:41 -0800 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2009-11-04 11:59:33 -0800 |
commit | d577d991b97ae2b5ee1af23641bcffc3f83af5b2 (patch) | |
tree | 590639d50205d1bcfaff2a7d2dc6ebf3f373c7ed /iup/src/iup_assert.h |
Initial import. Contains the im, cd and iup librairies, and a "working" Makefile for them under linux.
Diffstat (limited to 'iup/src/iup_assert.h')
-rwxr-xr-x | iup/src/iup_assert.h | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/iup/src/iup_assert.h b/iup/src/iup_assert.h new file mode 100755 index 0000000..03cec99 --- /dev/null +++ b/iup/src/iup_assert.h @@ -0,0 +1,68 @@ +/** \file + * \brief Assert Utilities + * + * See Copyright Notice in "iup.h" + */ + + +#ifndef __IUP_ASSERT_H +#define __IUP_ASSERT_H + +#ifdef __cplusplus +extern "C" { +#endif + + +/** \defgroup assert Assert Utilities + * \par + * All functions of the main API (Iup***) calls iupASSERT to check the parameters. + * \par + * The IUP main library must be recompiled with the IUP_ASSERT define to enable these checks. + * iupASSERT is not called inside driver dependent functions nor in each control implementation, + * it is used only in the functions of the main API and in some utilities. + * \par + * See \ref iup_assert.h + * \ingroup util */ + +/* internal functions */ +void iupAssert(const char* expr, const char* file, int line, const char* func); +void iupError(const char* format, ...); + +/** \def iupASSERT + * \brief If the expression if false, + * displays a message with information of the source code where the assert happen. + * + * \param _expr The evaluated expression. + * \par + * It is a macro that calls a function only if IUP_ASSERT is defined. + * \ingroup assert */ + +/** \def iupERROR + * \brief Displays an error message. Also used by the iupASSERT. + * \par + * It is a macro that calls a function only if IUP_ASSERT is defined. + * \ingroup assert */ + +#ifndef IUP_ASSERT +#define iupASSERT(_expr) ((void)0) +#define iupERROR(_msg) ((void)0) +#define iupERROR1(_msg, _p1) ((void)0) +#define iupERROR2(_msg, _p1, _p2) ((void)0) +#else +#ifdef __FUNCTION__ +#define iupASSERT(_expr) ((_expr)? (void)0: iupAssert(#_expr, __FILE__, __LINE__, __FUNCTION__)) +#else +#define iupASSERT(_expr) ((_expr)? (void)0: iupAssert(#_expr, __FILE__, __LINE__, NULL)) +#endif /* __FUNCTION__ */ + +#define iupERROR(_msg) iupError(_msg) +#define iupERROR1(_msg, _p1) iupError(_msg, _p1) +#define iupERROR2(_msg, _p1, _p2) iupError(_msg, _p1, _p2) + +#endif /* IUP_ASSERT */ + +#ifdef __cplusplus +} +#endif + +#endif |