5 * Copyright (C) 2008-2009 Pawel Dziepak
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 #include "libs/pointer.h"
27 #include "libs/string.h"
28 #include "libs/colors.h"
29 #include "libs/stream.h"
34 static p
<resources::stream
> msg_output
;
37 const string er_message
;
39 void er_print(const string
&, color::color
);
42 explicit error(p
<error
>);
43 error(p
<error
>, const string
&);
47 void critical() __attribute__((noreturn
));
51 #define on_stack(x) ((unsigned int)(x) < 0x2fffff && (unsigned int)(x) > 0x200000)
53 static inline void critical(const string
&) __attribute__((noreturn
));
55 static inline void critical(const string
&info
) {
56 p
<manes::error
> er
= new manes::error(info
);
61 static inline void debug(const string
&info
) {
62 p
<manes::error
> er
= new manes::error(info
);
67 #define QUOTE(x) _QUOTE(x)
69 #if DEBUG_MODE == CONF_YES
70 #define assert(msg, cond) \
72 p<manes::error> er = new manes::error((string)msg + " @" + __FILE__ + ":" + QUOTE(__LINE__) ); \
76 #define assert(msg, cond)