-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathoptions.h
More file actions
63 lines (51 loc) · 1.41 KB
/
options.h
File metadata and controls
63 lines (51 loc) · 1.41 KB
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
#ifndef clox_options_h
#define clox_options_h
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct sCloxOptions {
// debug options (default: false)
bool printAST;
bool traceParserCalls;
bool traceVMExecution;
bool stepVMExecution;
bool debugThreads;
bool debugTokens;
bool debugBytecode;
int debugVMLvl;
int debugRegexLvl;
int debugOptimizerLvl;
int traceGCLvl;
bool traceCompiler;
bool disableBcodeOptimizer;
bool disableGC;
bool stressGCYoung;
bool stressGCFull;
bool stressGCBoth;
bool compileOnly;
bool parseOnly;
bool profileGC;
char *initialLoadPath; // COLON-separated load path
char *initialScript;
bool _inited; // internal use, if singleton is inited
bool end; // if hit end of options (--)
int index; // index into ARGV
} CloxOptions; // [singleton]
extern int origArgc;
extern char **origArgv;
void initOptions(int argc, char **argv);
CloxOptions *getOptions(void);
bool findOption(const char *optName, const char *typeName);
int parseOption(char **argv, int idx);
#define GET_OPTION(opt) (getOptions()->opt)
#define CLOX_OPTION_T(opt) ((bool)(getOptions()->opt) == true)
#define OPTION_T(opt) CLOX_OPTION_T(opt)
#define SET_OPTION(name, val) do {\
(getOptions())->name = val;\
} while (0)
#define IS_OPTION(name, type) (findOption(name, #type) == true)
#ifdef __cplusplus
}
#endif
#endif