summaryrefslogtreecommitdiff
path: root/src/javascript/jsc/bindings/headers-handwritten.h
blob: a8d53f6e30ad7614a56ab8fec977804acdc4e8f0 (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#pragma once

typedef uint16_t ZigErrorCode;

typedef struct ZigString {
  const unsigned char *ptr;
  size_t len;
} ZigString;
typedef struct ZigErrorType {
  ZigErrorCode code;
  void *ptr;
} ZigErrorType;
typedef union ErrorableZigStringResult {
  ZigString value;
  ZigErrorType err;
} ErrorableZigStringResult;
typedef struct ErrorableZigString {
  ErrorableZigStringResult result;
  bool success;
} ErrorableZigString;
typedef struct ResolvedSource {
  ZigString specifier;
  ZigString source_code;
  ZigString source_url;
  uint32_t hash;
  void *allocator;
  uint64_t bytecodecache_fd;
} ResolvedSource;
typedef union ErrorableResolvedSourceResult {
  ResolvedSource value;
  ZigErrorType err;
} ErrorableResolvedSourceResult;
typedef struct ErrorableResolvedSource {
  ErrorableResolvedSourceResult result;
  bool success;
} ErrorableResolvedSource;

typedef uint8_t ZigStackFrameCode;
const ZigStackFrameCode ZigStackFrameCodeNone = 0;
const ZigStackFrameCode ZigStackFrameCodeEval = 1;
const ZigStackFrameCode ZigStackFrameCodeModule = 2;
const ZigStackFrameCode ZigStackFrameCodeFunction = 3;
const ZigStackFrameCode ZigStackFrameCodeGlobal = 4;
const ZigStackFrameCode ZigStackFrameCodeWasm = 5;
const ZigStackFrameCode ZigStackFrameCodeConstructor = 6;

typedef struct ZigStackFramePosition {
  int32_t source_offset;
  int32_t line;
  int32_t line_start;
  int32_t line_stop;
  int32_t column_start;
  int32_t column_stop;
  int32_t expression_start;
  int32_t expression_stop;
} ZigStackFramePosition;

typedef struct ZigStackFrame {
  ZigString function_name;
  ZigString source_url;
  ZigStackFramePosition position;
  ZigStackFrameCode code_type;
} ZigStackFrame;

typedef struct ZigStackTrace {
  ZigString *source_lines_ptr;
  int32_t *source_lines_numbers;
  uint8_t source_lines_len;
  uint8_t source_lines_to_collect;
  ZigStackFrame *frames_ptr;
  uint8_t frames_len;
} ZigStackTrace;

typedef struct ZigException {
  unsigned char code;
  uint16_t runtime_type;
  ZigString name;
  ZigString message;
  ZigStackTrace stack;
  void *exception;
} ZigException;

typedef uint8_t JSErrorCode;
const JSErrorCode JSErrorCodeError = 0;
const JSErrorCode JSErrorCodeEvalError = 1;
const JSErrorCode JSErrorCodeRangeError = 2;
const JSErrorCode JSErrorCodeReferenceError = 3;
const JSErrorCode JSErrorCodeSyntaxError = 4;
const JSErrorCode JSErrorCodeTypeError = 5;
const JSErrorCode JSErrorCodeURIError = 6;
const JSErrorCode JSErrorCodeAggregateError = 7;
const JSErrorCode JSErrorCodeOutOfMemoryError = 8;
const JSErrorCode JSErrorCodeStackOverflow = 253;
const JSErrorCode JSErrorCodeUserErrorCode = 254;

#ifdef __cplusplus
extern "C" ZigErrorCode Zig_ErrorCodeParserError;

extern "C" void ZigString__free(const unsigned char *ptr, size_t len, void *allocator);
#endif