-
Notifications
You must be signed in to change notification settings - Fork 3
/
std.h
56 lines (49 loc) · 1.82 KB
/
std.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
#ifndef VAIVEN_VISITOR_HEADER_STD
#define VAIVEN_VISITOR_HEADER_STD
#include "functions.h"
#include "heap.h"
namespace vaiven {
void init_std(Functions& funcs);
// exposed to vaiven code
Value print(Value value);
Value append(Value lhs, Value rhs);
Value len(Value subject);
Value assert(Value expectation);
Value object();
Value keys(Value object);
Value toString(Value subject);
Value sqrt(Value value);
Value round(Value value);
Value floor(Value value);
Value ceil(Value value);
// used by interpreter/called by assembly
Value newList();
Value newListWithSize(int size);
Value* getListContainerUnchecked(GcableList* list);
Value add(Value lhs, Value rhs);
Value sub(Value lhs, Value rhs);
Value mul(Value lhs, Value rhs);
Value div(Value lhs, Value rhs);
Value gt(Value lhs, Value rhs);
Value gte(Value lhs, Value rhs);
Value lt(Value lhs, Value rhs);
Value lte(Value lhs, Value rhs);
Value addStrUnchecked(GcableString* lhs, GcableString* rhs);
Value set(Value objectOrArr, Value propOrIndex, Value value);
Value get(Value objectOrArr, Value propOrIndex);
Value listAccessUnchecked(GcableList* list, int index);
void listStoreUnchecked(GcableList* list, int index, Value value);
Value objectAccessChecked(Value subject, string& property);
void objectStoreChecked(Value subject, string& property, Value value);
Value objectAccessUnchecked(GcableObject* object, string& property);
void objectStoreUnchecked(GcableObject* object, string& property, Value value);
Value cmp(Value a, Value b);
Value inverseCmp(Value a, Value b);
// seems like using bool often results in garbage in the upper bits
uint64_t cmpUnboxed(Value a, Value b);
uint64_t cmpStrUnchecked(GcableString* a, GcableString* b);
uint64_t inverseCmpUnboxed(Value a, Value b);
uint64_t inverseCmpStrUnchecked(GcableString* a, GcableString* b);
string toStringCpp(Value subject);
}
#endif