1 /*
2 
3 Copyright (C) 2015-2018 Night Dive Studios, LLC.
4 
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9 
10 This program 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.
14 
15 You should have received a copy of the GNU General Public License
16 along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 
18 */
19 //		LG.H		Looking Glass Over-Arching Master Control Header File
20 //
21 /*
22 * $Header: n:/project/lib/src/lg/rcs/lg.h 1.3 1993/08/06 11:00:11 rex Exp $
23 * $Log: lg.h $
24  * Revision 1.3  1993/08/06  11:00:11  rex
25  * Removed libdbg.h
26  *
27  * Revision 1.2  1993/03/19  18:20:22  rex
28  * Added RCS header
29  *
30 */
31 
32 #ifndef __TYPES_H
33 #include "lg_types.h"
34 #endif
35 
36 #include <string.h>
37 #include "log.h"
38 
39 // Relative path workaround
40 #define THIS_FILE ((strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') : __FILE__ - 1) + 1)
41 
42 /**
43  * Main function for logging, and helper functions
44  * @param level log level (LOG_TRACE, LOG_DEBUG, LOG_INFO, LOG_WARN, LOG_ERROR, LOG_FATAL)
45  * @param string printf-like string with format
46  * @example LOGGER(LOG_TRACE, "My name is %s", name);
47 **/
48 #define LOGGER(level, ...) log_log(level, THIS_FILE, __LINE__, __VA_ARGS__)
49 #define TRACE(...) log_log(LOG_TRACE, THIS_FILE, __LINE__, __VA_ARGS__)
50 #define DEBUG(...) log_log(LOG_DEBUG, THIS_FILE, __LINE__, __VA_ARGS__)
51 #define INFO(...) log_log(LOG_INFO, THIS_FILE, __LINE__, __VA_ARGS__)
52 #define WARN(...) log_log(LOG_WARN, THIS_FILE, __LINE__, __VA_ARGS__)
53 #define ERROR(...) log_log(LOG_ERROR, THIS_FILE, __LINE__, __VA_ARGS__)
54 
55 // DG: helpful for seeing which stubbed out things are even used
56 // prints a stub message (incl. containing function)
57 #define STUB(msg) \
58 	printf("STUB: %s() %s\n", __FUNCTION__, msg);
59 
60 // prints a stub message (incl. containing function) only the first time it's called
61 #define STUB_ONCE(msg) do { \
62 	static int show=1; \
63 	if(show) { \
64 		show = 0; \
65 		printf("STUB: %s() %s\n", __FUNCTION__, msg); \
66 	} \
67 } while(0);
68 
69 // For mac version.
70 #define	lg_max(a,b) (((a) > (b)) ? (a) : (b))
71 #define	lg_min(a,b) (((a) < (b)) ? (a) : (b))
72 
73 #define LG_memset memset
74 #define LG_memcpy memcpy
75 #define LG_memmove memmove
76 //#define BlockMove(src, dest, num) LG_memmove(src, dest, num);
77 
78 #define GAMEONLY			1
79 #define SVGA_SUPPORT		1
80 #define USE_STEALTH			1
81 #define USE_PFIELD			1
82 #define DISTANCE_AI_KILL	1
83 #define TEXTURE_SELECTION	1
84 #define NO_HELP_STRINGS		1
85 #define NO_CORRUPT_SAVES	1
86 #define MAP_RESHIFTING		1
87 #define DIRAC_EDMS			1
88 #define NO_ANTIGRAV_CRATES	1
89 #define DOOM_EMULATION_MODE	1
90 #define EDMS_SAFETY_NET		1
91 #define AUDIOLOGS			1
92 #define SVGA_CUTSCENES		1
93 #define LOST_TREASURES_OF_MFD_GAMES		1
94