2
* Copyright (C) 2002, 2003 by the Widelands Development Team
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License
6
* as published by the Free Software Foundation; either version 2
7
* of the License, or (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26
#define PRINTF_FORMAT(b,c) __attribute__ (( __format__ (__printf__,b,c) ))
28
#define PRINTF_FORMAT(b,c)
32
==============================================================================
34
ERROR HANDLING FUNCTIONS
36
==============================================================================
41
#define ERR_NOT_IMPLEMENTED -1
42
#define ERR_INVAL_ARG -2
43
#define ERR_FAILED -255
46
// Critical errors, displayed to the user.
47
// Does not return (unless the user is really daring)
48
void critical_error(const char *, ...) PRINTF_FORMAT(1,2);
50
// Informational messages that can aid in debugging
51
#define ALIVE() log("Alive in %s line %i\n", __FILE__, __LINE__)
52
void log(const char *, ...) PRINTF_FORMAT(1,2);
55
#ifndef KEEP_STANDART_ASSERT
56
#include "wexception.h"
62
/* reintroduce when we figure out a way to actually manage the beast that is autotools
63
(problem is: tools include this as well)
64
extern int graph_is_init;
66
inline void myassert(int line, const char* file, int cond, const char* condt) {
69
sprintf(buf, "%s (%i): assertion \"%s\" failed!\n", file, line, condt);
73
// User chooses, if it goes on
81
void myassert(int line, const char* file, const char* condt) throw(wexception);
83
#define assert(condition) \
84
do { if (!(condition)) myassert(__LINE__, __FILE__, #condition); } while(0)