From d577d991b97ae2b5ee1af23641bcffc3f83af5b2 Mon Sep 17 00:00:00 2001 From: Pixel Date: Wed, 4 Nov 2009 11:56:41 -0800 Subject: Initial import. Contains the im, cd and iup librairies, and a "working" Makefile for them under linux. --- iup/src/iup_assert.h | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100755 iup/src/iup_assert.h (limited to 'iup/src/iup_assert.h') 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 -- cgit v1.2.3