/
common.h
82 lines (55 loc) · 1.96 KB
/
common.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#ifndef bird_common_h
#define bird_common_h
// special definitions for Cygwin
#define _DEFAULT_SOURCE 1
#define _ln_
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "config.h"
// --> debug mode options starts here...
#if DEBUG_MODE == 1
#define DEBUG_TRACE_EXECUTION 0
#define DEBUG_PRINT_CODE 1
#define DEBUG_TABLE 0
#define DEBUG_LOG_GC 0
#endif
// --> debug mode options ends here...
#define UINT8_COUNT (UINT8_MAX + 1)
#define UINT16_COUNT (UINT16_MAX + 1)
#define STACK_MAX (FRAMES_MAX * UINT8_COUNT)
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#define IS_UNIX
#elif defined _WIN32
// #define NO_OLDNAMES
#endif
#define VERSION(x) #x
#define VERSION_STRING(name, major, minor, patch) \
name " " VERSION(major) "." VERSION(minor) "." VERSION(patch)
#ifdef __clang__
#define COMPILER \
VERSION_STRING("Clang", __clang_major__, __clang_minor__, \
__clang_patchlevel__)
#elif defined(_MSC_VER)
#define COMPILER VERSION_STRING("MSC", _MSC_VER)
#elif defined(__MINGW32_MAJOR_VERSION)
#define COMPILER \
VERSION_STRING("MinGW32", __MINGW32_MAJOR_VERSION, __MINGW32_MINOR_VERSION, 0)
#elif defined(__MINGW64_VERSION_MAJOR)
#define COMPILER \
VERSION_STRING("MinGW-64", __MINGW64_VERSION_MAJOR, __MINGW64_VERSION_MAJOR, \
0)
#elif defined(__GNUC__)
#define COMPILER \
VERSION_STRING("GCC", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
#else
#define COMPILER "Unknown Compiler"
#endif
#define DEFAULT_GC_START (1024 * 1024)
#define BIRD_EXTENSION ".b"
#define BIRD_VERSION_STRING "0.0.1"
#define BVM_VERSION "0.0.1"
#define EXIT_COMPILE 10
#define EXIT_RUNTIME 10
#define EXIT_TERMINAL 12
#endif