1
/* Grafx2 - The Ultimate 256-color bitmap paint program
3
Copyright 2008 Adrien Destugues
5
Grafx2 is free software; you can redistribute it and/or
6
modify it under the terms of the GNU General Public License
7
as published by the Free Software Foundation; version 2
10
Grafx2 is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
15
You should have received a copy of the GNU General Public License
16
along with Grafx2; if not, see <http://www.gnu.org/licenses/>
19
//////////////////////////////////////////////////////////////////////////////
21
/// Functions and macros for tracing and error reporting.
22
//////////////////////////////////////////////////////////////////////////////
24
/// Prints the source filename, line number, function name, a string and an integer.
25
#define DEBUG(y,z) printf("%s %d %s | %s : %d###\n",__FILE__,__LINE__,__func__,y,(unsigned int)z)
27
/// Same as ::DEBUG but in hexadecimal
28
#define DEBUGX(y,z) printf("%s %d %s | %s : %X###\n",__FILE__,__LINE__,__func__,y,(unsigned int)z)
30
/// Helper function used by the macro ::Error
31
void Error_function(int error_code, const char *filename, int line_number, const char *function_name);
34
/// Report a run-time error: It will print to standard output some information
35
/// about the calling function, and then:
36
/// - If the error code is 0, just do a red screen flash and resume.
37
/// - If the error code is non-zero, abort the program.
38
#define Error(n) Error_function(n, __FILE__,__LINE__,__func__)