aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/BunObject+exports.h
blob: b805b90d852b4502e21ef09052597203a35789b7 (plain) (blame)
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
// clang-format off

// --- Getters ---
#define FOR_EACH_GETTER(macro) \
    macro(CryptoHasher) \
    macro(FFI) \
    macro(FileSystemRouter) \
    macro(MD4) \
    macro(MD5) \
    macro(SHA1) \
    macro(SHA224) \
    macro(SHA256) \
    macro(SHA384) \
    macro(SHA512) \
    macro(SHA512_256) \
    macro(TOML) \
    macro(Transpiler) \
    macro(argv) \
    macro(assetPrefix) \
    macro(cwd) \
    macro(enableANSIColors) \
    macro(hash) \
    macro(inspect) \
    macro(main) \
    macro(origin) \
    macro(stderr) \
    macro(stdin) \
    macro(stdout) \
    macro(unsafe) \

// --- Callbacks ---
#define FOR_EACH_CALLBACK(macro) \
    macro(DO_NOT_USE_OR_YOU_WILL_BE_FIRED_mimalloc_dump) \
    macro(_Os) \
    macro(_Path) \
    macro(allocUnsafe) \
    macro(build) \
    macro(connect) \
    macro(deflateSync) \
    macro(file) \
    macro(fs) \
    macro(gc) \
    macro(generateHeapSnapshot) \
    macro(getImportedStyles) \
    macro(gunzipSync) \
    macro(gzipSync) \
    macro(indexOfLine) \
    macro(inflateSync) \
    macro(jest) \
    macro(listen) \
    macro(mmap) \
    macro(nanoseconds) \
    macro(openInEditor) \
    macro(registerMacro) \
    macro(resolve) \
    macro(resolveSync) \
    macro(serve) \
    macro(sha) \
    macro(shrink) \
    macro(sleepSync) \
    macro(spawn) \
    macro(spawnSync) \
    macro(which) \
    macro(write) \

#define DECLARE_ZIG_BUN_OBJECT_CALLBACK(name) extern "C" JSC::EncodedJSValue BunObject_callback_##name(JSC::JSGlobalObject*, JSC::CallFrame*);
FOR_EACH_CALLBACK(DECLARE_ZIG_BUN_OBJECT_CALLBACK);
#undef DECLARE_ZIG_BUN_OBJECT_CALLBACK

#define DECLARE_ZIG_BUN_OBJECT_GETTER(name) extern "C" JSC::EncodedJSValue BunObject_getter_##name(JSC::JSGlobalObject*, JSC::JSObject*);
FOR_EACH_GETTER(DECLARE_ZIG_BUN_OBJECT_GETTER);
#undef DECLARE_ZIG_BUN_OBJECT_GETTER

#define DEFINE_ZIG_BUN_OBJECT_GETTER_WRAPPER(name) JSC::JSValue BunObject_getter_wrap_##name(JSC::VM &vm, JSC::JSObject *object) { \
    return JSC::JSValue::decode(BunObject_getter_##name(object->globalObject(), object)); \
} \

FOR_EACH_GETTER(DEFINE_ZIG_BUN_OBJECT_GETTER_WRAPPER);
#undef DEFINE_ZIG_BUN_OBJECT_GETTER_WRAPPER

#undef FOR_EACH_GETTER
#undef FOR_EACH_CALLBACK