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
|
/** \file
* \brief String Utilities
*
* See Copyright Notice in "iup.h"
*/
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include <stdarg.h>
#include "iup.h"
#include "iup_assert.h"
#include "iup_attrib.h"
#include "iup_str.h"
#include "iup_strmessage.h"
/* from iup_open, but it is not exported, used only here */
int iupIsOpened(void);
void iupError(const char* format, ...)
{
static char msg[SHRT_MAX];
va_list arglist;
va_start(arglist, format);
vsprintf(msg, format, arglist);
va_end(arglist);
#if IUP_ASSERT_CONSOLE
fprintf(stderr, msg);
#else
if (iupIsOpened())
iupStrMessageShowError(NULL, msg);
else
fprintf(stderr, msg);
#endif
}
void iupAssert(const char* expr, const char* file, int line, const char* func)
{
if (func)
iupError("File: %s\n"
"Line: %d\n"
"Function: %s\n"
"Assertive: (%s)",
file, line, func, expr);
else
iupError("File: %s\n"
"Line: %d\n"
"Assertive: (%s)",
file, line, expr);
}
|