annotate src/generic.h @ 65:800c6fde1cf6

build requires ImageMagick to see convert needed by pst2dii
author Carl Byington <carl@five-ten-sg.com>
date Tue, 26 Feb 2008 17:26:36 -0800
parents f6db1f060a95
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
43
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
1 /* {{{ Generic.h - thigns every program does:
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
2 *
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
3 * - user output (log, debug, etc)
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
4 * - crash and burn
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
5 * - allocate memory (or explode)
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
6 * }}} */
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
7 #ifndef GENERIC_H
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
8 #define GENERIC_H
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
9 #include <stdlib.h>
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
10 #include <stdio.h>
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
11 #include <stdarg.h>
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
12 /***************************************************/
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
13
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
14 #define LOAD_DEBUG 1
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
15
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
16 #define DIE(...) { fprintf(stderr, "Fatal Error at %s,%d: ", __FILE__, __LINE__); pDIE(__VA_ARGS__); }
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
17
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
18 //#define WARN(...) { fprintf(stderr, "WARN: %s,%d: ", __FILE__, __LINE__); pWARN(__VA_ARGS__); }
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
19 void pDIE( char *fmt, ... );
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
20 //void pWARN( char *fmt, ... );
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
21
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
22 #define WARN(...) DB( DB_WARN, __VA_ARGS__ )
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
23 #define ASSERT(x,...) { if( !(x) ) DIE( __VA_ARGS__ ); }
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
24
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
25 void *F_MALLOC( size_t size );
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
26 void *F_REALLOC( void *p, size_t size );
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
27
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
28 #define DO_DEBUG 0
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
29 #define DEBUG(x) if( DO_DEBUG ) { x; }
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
30 #define STUPID_CR "\r\n"
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
31
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
32 #define DB_CRASH 0 // crashing
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
33 #define DB_ERR 1 // error
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
34 #define DB_WARN 2 // warning
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
35 #define DB_INFO 3 // normal, but significant, condition
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
36 #define DB_VERB 4 // verbose information
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
37 #define DB_0 5 // debug-level message
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
38 #define DB_1 6 // debug-level message
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
39 #define DB_2 7 // debug-level message
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
40
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
41 extern int DEBUG_LEVEL;
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
42 extern void (*dbfunc)(char *file, int line, int level, char *fmt, ...);
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
43
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
44 #define DB(...) { dbfunc( __FILE__, __LINE__, __VA_ARGS__ ); }
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
45
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
46 int set_db_function( void (*func)( char *file, int line, int level, char *fmt, ...) );
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
47
f6db1f060a95 start on outlook 2003 64 bit format
carl
parents:
diff changeset
48 #endif