-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspecial.h
54 lines (44 loc) · 967 Bytes
/
special.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
#ifndef __SPECIAL_H__
#define __SPECIAL_H__
#include <string>
#include "value.h"
extern const
value_t BOOLEAN_TRUE,
BOOLEAN_FALSE,
EMPTY_LIST,
UNDEFINED,
UNSPECIFIED,
END_OF_FILE,
OP_HALT,
OP_CONSTANT,
OP_LOOKUP,
OP_CLOSURE,
OP_TEST,
OP_ASSIGN,
OP_SAVE,
OP_REIFY,
OP_FRAME,
OP_APPLY,
OP_ARGUMENT,
OP_RETURN,
OP_BIND,
OP_BIND_MACRO;
static inline
bool is_special(value_t value) {
return ((value & 0x0000000000000006) == 0x06);
}
static inline
bool is_boolean(value_t value) {
return ((value & 0xFFFFFFFFFFFFFFF7) == 0x16);
}
static inline
bool unwrap_boolean(value_t value) {
return value == BOOLEAN_TRUE;
}
static inline
value_t wrap_boolean(bool boolean) {
return (boolean ? BOOLEAN_TRUE : BOOLEAN_FALSE);
}
value_t boolean_make_from_string(const std::string& str);
std::string boolean_format(value_t value);
#endif