Lhogho  0.0.028
 All Data Structures Files Functions Variables Typedefs Macros Pages
globals.h
Go to the documentation of this file.
1 //
2 // Project: Lhogho
3 // File: globals.h
4 //
5 // Copyright (C) 2007 P.Boytchev
6 //
7 // Revision history:
8 // 2006-09-28 - file created
9 // 2006-10-10 - added DEBUG_* macros
10 // 2006-10-11 - removed ADVANCED macro
11 // - added UNICODE macro
12 // 2006-10-13 - added DEBUG_TOKENS macro
13 // 2007-03-01 - added DEVELOPMENT macro
14 // 2007-03-19 - DEBUG_LIST_FLAGS macro
15 // 2007-03-25 - DEBUG_PARENTHESES macro
16 // 2007-05-17 - added license info
17 // 2007-05-22 - added doxygen-friendly documentation
18 // 2007-06-02 - STATISTICS & DEVELOPMENT merged into ADVANCED
19 // 2007-06-05 - definitions spread to where they belong
20 // 2007-07-03 - DEBUG_COMPILE macro
21 // 2007-07-31 - DEBUG_FIND_VAR macro
22 // 2007-12-02 - DEBUG_LIST_TOKEN_FLAGS macro
23 // 2010-06-25 - support for inner_eof
24 // 2011-02-27 - check for GCC version
25 // 2012-09-23 - DEBUG_ATOM_LIST macro
26 //
27 //
28 // This program is free software; you can redistribute it and/or modify
29 // it under the terms of the GNU General Public License as published by
30 // the Free Software Foundation; either version 2 of the License, or
31 // (at your option) any later version.
32 //
33 // This program is distributed in the hope that it will be useful,
34 // but WITHOUT ANY WARRANTY; without even the implied warranty of
35 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36 // GNU General Public License for more details.
37 //
38 // You should have received a copy of the GNU General Public License
39 // along with this program; if not, write to the Free Software
40 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
41 //
42 
43 
44 #ifndef LHOGHO_GLOBALS_H
45 #define LHOGHO_GLOBALS_H
46 
47 
48 #include "stdint.h"
49 #include "stddef.h"
50 
51 
52 
53 
54 //===================================================
56 //===================================================
57 #define SAFEMODE
58 #define UNICODE_CHARS
59 #define ADVANCED
60 
61 
62 
63 
64 //===================================================
70 //===================================================
71 #define noDEBUG_POOL
72 #define noDEBUG_HEAP
73 #define noDEBUG_ATOM
74 #define noDEBUG_ATOM_LIST
75 #define noDEBUG_VAR
76 #define noDEBUG_TOKENS
77 #define noDEBUG_LIST_FLAGS
78 #define noDEBUG_LIST_TOKEN_FLAGS
79 #define noDEBUG_REF_COUNT
80 #define noDEBUG_TOKENIZATION
81 #define noDEBUG_PARENTHESES
82 #define noDEBUG_PARSE
83 #define noDEBUG_TO_END
84 #define noDEBUG_COMPILE
85 #define noDEBUG_FIND_VAR
86 #define noDEBUG_FIND_RUNTIME_VAR
87 #define noDEBUG_RUNTIME_ATOMS
88 #define noDEBUG_COMPILETIME_ATOMS
89 #define DEBUG_CLEAR_FREED_MEM
90 #define noDEBUG_MEMORY_LEAKS
91 
92 #ifdef DEBUG_MEMORY_LEAKS
93  #define DEBUG_CLEAR_FREED_MEM
94 #endif
95 
96 
97 //===================================================
101 //===================================================
102 #ifdef PROCESSOR_x86
103  #define PROCESSOR_NAME "i386"
104  //#define ASM_STORE_RESULT "push %%ebx; push %%eax; push %%esi;"
105  //#define ASM_RESTORE_RESULT "pop %%esi; pop %%eax; pop %%ebx"
106  #define ASM_STORE_RESULT "pusha"
107  #define ASM_RESTORE_RESULT "popa"
108  #define ASM_CLOBBER_REGISTERS "%eax","%ebx","%ecx","%edx","%esi","%edi","memory","cc"
109 //#define ASM_STATUS "movl %0,%%ebx"::"m"(status):"%ebx" ///< set OUTPUT flag
110 //#define ASM_SET_STATUS "stc" ///< set OUTPUT flag
111 //#define ASM_CLEAR_STATUS "clc" ///< clear OUTPUT flag
112 #endif
113 
114 #ifdef WINDOWS
115  #define OS_NAME "windows"
116 #endif
117 
118 #ifdef __GNUC__
119 #define GCC_VERSION (__GNUC__ * 10000 \
120  + __GNUC_MINOR__ * 100 \
121  + __GNUC_PATCHLEVEL__)
122 
123  // GCC versions 4.4 and 4.5 generate crashing Lhogho
124  // GCC versions 3.4 and 4.1 generate working Lhogho
125  // Thus, set UNSUPPORTED_COMPILER flag for GCC > 4.1.99
126  #if GCC_VERSION > 40199 // GCC
127  #define UNSUPPORTED_COMPILER
128  #endif
129 #else
130  #define UNSUPPORTED_COMPILER
131 #endif
132 
133 
134 #ifdef LINUX
135  #define OS_NAME "linux"
136 #endif
137 
138 #ifdef APPLE
139  #define OS_NAME "darwin"
140 #endif
141 
142 #ifndef OS_NAME
143  #error "Undefined operating system"
144 #endif
145 
146 #ifndef PROCESSOR_NAME
147  #error "Undefined processor"
148 #endif
149 
150 
151 //===================================================
153 //===================================================
154 // @{
155 typedef double float64_t; // 64-bit fp
156 typedef float float32_t; // 32-bit fp
157 //typedef long long int64_t; // 64-bit int
158 typedef unsigned char byte_t; // 8-bit byte
159 typedef unsigned short ushort_t; // unsigned short
160 typedef int int_t; // integer
161 typedef unsigned int uint_t; // unsigned integer
162 typedef void* ptr_t; // pointer
163 typedef byte_t* bytes_t; // array of bytes
164 typedef void(*fn)(); // general function
165 
166 #ifdef UNICODE_CHARS
167  typedef wchar_t char_t; // character
168  typedef wchar_t* chars_t; // string
169 #else
170  typedef char char_t; // character
171  typedef char* chars_t; // string
172 #endif //UNICODE_CHARS
173 
175 #define Z printf("--- %s() in %s:%d---\n",__FUNCTION__,__FILE__,__LINE__)
176 
177 //===================================================
183 //===================================================
184 typedef void(*outter_t)(chars_t,int);
185 
186 
187 
188 //===================================================
194 //===================================================
195 typedef char_t(*inner_t)(void);
196 
197 
198 
199 //===================================================
205 //===================================================
206 typedef int(*inner_eof_t)(void);
207 
208 
209 
210 
211 #ifndef NULL
212 #define NULL 0
213 #endif
214 
215 
216 #ifndef __USE_ISOC99
217 #define __USE_ISOC99
218 #endif
219 
220 #endif //LHOGHO_GLOBALS_H

[ HOME | INDEX | ATOMS | VARS | REFERENCE ]
Lhogho Developer's Documentation
Wed Jul 10 2013