vsql-node 0.0.0-stage → 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +203 -2
- package/binding.gyp +44 -0
- package/index.d.ts +133 -0
- package/internal/amalgamation/LICENSE +21 -0
- package/internal/amalgamation/LICENSE-V +21 -0
- package/internal/amalgamation/afunix.h +26 -0
- package/internal/amalgamation/atomic.h +571 -0
- package/internal/amalgamation/core_windows.c +25 -0
- package/internal/amalgamation/core_windows.h +9 -0
- package/internal/amalgamation/execute_capture_nix.c +7 -0
- package/internal/amalgamation/execute_capture_nix.h +266 -0
- package/internal/amalgamation/gc/cord.h +426 -0
- package/internal/amalgamation/gc/cord_pos.h +151 -0
- package/internal/amalgamation/gc/ec.h +91 -0
- package/internal/amalgamation/gc/gc.h +2826 -0
- package/internal/amalgamation/gc/gc_allocator.h +480 -0
- package/internal/amalgamation/gc/gc_backptr.h +109 -0
- package/internal/amalgamation/gc/gc_config_macros.h +548 -0
- package/internal/amalgamation/gc/gc_disclaim.h +85 -0
- package/internal/amalgamation/gc/gc_gcj.h +123 -0
- package/internal/amalgamation/gc/gc_inline.h +261 -0
- package/internal/amalgamation/gc/gc_mark.h +516 -0
- package/internal/amalgamation/gc/gc_pthread_redirects.h +140 -0
- package/internal/amalgamation/gc/gc_tiny_fl.h +107 -0
- package/internal/amalgamation/gc/gc_typed.h +196 -0
- package/internal/amalgamation/gc/gc_version.h +55 -0
- package/internal/amalgamation/gc/javaxfc.h +76 -0
- package/internal/amalgamation/gc/leak_detector.h +120 -0
- package/internal/amalgamation/gc.c +45932 -0
- package/internal/amalgamation/gc.h +4 -0
- package/internal/amalgamation/gc_boehm_helpers.c +64 -0
- package/internal/amalgamation/gc_debugger_linux.h +61 -0
- package/internal/amalgamation/getrandom_linux.h +33 -0
- package/internal/amalgamation/ipv6_v6only.h +5 -0
- package/internal/amalgamation/libvsql.c +27 -0
- package/internal/amalgamation/libvsql.h +1772 -0
- package/internal/amalgamation/libvsql_linux_amd64.c +106591 -0
- package/internal/amalgamation/libvsql_linux_arm64.c +106571 -0
- package/internal/amalgamation/libvsql_macos_amd64.c +106728 -0
- package/internal/amalgamation/libvsql_macos_arm64.c +106708 -0
- package/internal/amalgamation/libvsql_windows_amd64.c +108235 -0
- package/internal/amalgamation/segfault_handler_nix.c +56 -0
- package/internal/amalgamation/segfault_handler_nix.h +449 -0
- package/internal/amalgamation/segfault_handler_windows.h +52 -0
- package/internal/amalgamation/thread_helper.c +12 -0
- package/internal/amalgamation/thread_helper.h +96 -0
- package/internal/amalgamation/ticks_windows.c +3 -0
- package/internal/amalgamation/ticks_windows.h +31 -0
- package/internal/amalgamation/ticks_windows_api.h +6 -0
- package/internal/amalgamation/vsql_runtime.c +14 -0
- package/internal/amalgamation/vsql_runtime_linux.c +6 -0
- package/internal/amalgamation/vsql_runtime_macos.c +6 -0
- package/internal/amalgamation/vsql_runtime_windows.c +6 -0
- package/lib/binding.js +13 -0
- package/lib/connection.js +492 -0
- package/lib/convert.js +213 -0
- package/lib/errors.js +17 -0
- package/lib/index.js +41 -0
- package/libvsql_flags.gypi +30 -0
- package/package.json +45 -4
- package/src/binding.c +773 -0
- package/src/runtime.c +20 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 1993-1994 by Xerox Corporation. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
|
|
5
|
+
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
|
|
6
|
+
*
|
|
7
|
+
* Permission is hereby granted to use or copy this program
|
|
8
|
+
* for any purpose, provided the above notices are retained on all copies.
|
|
9
|
+
* Permission to modify the code and to distribute modified code is granted,
|
|
10
|
+
* provided the above notices are retained, and a notice that the code was
|
|
11
|
+
* modified is included with the above copyright notice.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/* This should never be included directly; included only from `cord.h` file. */
|
|
15
|
+
#if !defined(CORD_POSITION_H) && defined(CORD_H)
|
|
16
|
+
# define CORD_POSITION_H
|
|
17
|
+
|
|
18
|
+
# ifdef __cplusplus
|
|
19
|
+
extern "C" {
|
|
20
|
+
# endif
|
|
21
|
+
|
|
22
|
+
/*
|
|
23
|
+
* The representation of `CORD_position`. This is private to the
|
|
24
|
+
* implementation, but the size is known to clients. Also the implementation
|
|
25
|
+
* of some exported macros relies on it. Do not use anything defined here
|
|
26
|
+
* and not in `cord.h` file.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The maximum depth of a balanced cord plus one. We do not let cords get
|
|
31
|
+
* deeper than this maximum.
|
|
32
|
+
*/
|
|
33
|
+
# define CORD_MAX_DEPTH 48
|
|
34
|
+
|
|
35
|
+
struct CORD_pe {
|
|
36
|
+
CORD pe_cord;
|
|
37
|
+
size_t pe_start_pos;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* A structure describing an entry on the path from the root to current
|
|
42
|
+
* position.
|
|
43
|
+
*/
|
|
44
|
+
typedef struct CORD_Pos {
|
|
45
|
+
size_t cur_pos;
|
|
46
|
+
|
|
47
|
+
int path_len;
|
|
48
|
+
|
|
49
|
+
/* `path_len` is `CORD_POS_INVALID` if and only if position is invalid. */
|
|
50
|
+
# define CORD_POS_INVALID 0x55555555
|
|
51
|
+
|
|
52
|
+
/*
|
|
53
|
+
* Current leaf, if it is a string. If the current leaf is a function,
|
|
54
|
+
* then this may point to `function_buf` containing the next few characters.
|
|
55
|
+
* Always points to a valid string containing the current character
|
|
56
|
+
* unless `cur_end` is zero.
|
|
57
|
+
*/
|
|
58
|
+
const char *cur_leaf;
|
|
59
|
+
|
|
60
|
+
/* Start position of `cur_leaf`. */
|
|
61
|
+
size_t cur_start;
|
|
62
|
+
|
|
63
|
+
/* Ending position of `cur_leaf`; zero if `cur_leaf` is invalid. */
|
|
64
|
+
size_t cur_end;
|
|
65
|
+
|
|
66
|
+
/*
|
|
67
|
+
* `path[path_len]` is the leaf corresponding to `cur_pos`;
|
|
68
|
+
* `path[0].pe_cord` is the cord we point to.
|
|
69
|
+
*/
|
|
70
|
+
struct CORD_pe path[CORD_MAX_DEPTH + 1];
|
|
71
|
+
|
|
72
|
+
# define CORD_FUNCTION_BUF_SZ 8
|
|
73
|
+
|
|
74
|
+
/* Space for next few chars from function node. */
|
|
75
|
+
char function_buf[CORD_FUNCTION_BUF_SZ];
|
|
76
|
+
} CORD_pos[1];
|
|
77
|
+
|
|
78
|
+
/** Extract the cord from a position. */
|
|
79
|
+
CORD_API CORD CORD_pos_to_cord(CORD_pos);
|
|
80
|
+
|
|
81
|
+
/** Extract the current index from a position. */
|
|
82
|
+
CORD_API size_t CORD_pos_to_index(CORD_pos);
|
|
83
|
+
|
|
84
|
+
/** Fetch the character located at the given position. */
|
|
85
|
+
CORD_API char CORD_pos_fetch(CORD_pos);
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Initialize the position to refer to the given cord and `index`.
|
|
89
|
+
* Note that this is the most expensive function on positions.
|
|
90
|
+
*/
|
|
91
|
+
CORD_API void CORD_set_pos(CORD_pos, CORD, size_t /* `index` */);
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Advance the position to the next character. `p` must be initialized
|
|
95
|
+
* and valid. Invalidates `p` if past end.
|
|
96
|
+
*/
|
|
97
|
+
CORD_API void CORD_next(CORD_pos /* `p` */);
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Move the position to the preceding character. `p` must be initialized
|
|
101
|
+
* and valid. Invalidates `p` if past beginning.
|
|
102
|
+
*/
|
|
103
|
+
CORD_API void CORD_prev(CORD_pos /* `p` */);
|
|
104
|
+
|
|
105
|
+
/** Is the position valid, i.e. inside the cord? */
|
|
106
|
+
CORD_API int CORD_pos_valid(CORD_pos);
|
|
107
|
+
|
|
108
|
+
CORD_API char CORD__pos_fetch(CORD_pos);
|
|
109
|
+
CORD_API void CORD__next(CORD_pos);
|
|
110
|
+
CORD_API void CORD__prev(CORD_pos);
|
|
111
|
+
|
|
112
|
+
# define CORD_pos_fetch(p) \
|
|
113
|
+
((p)[0].cur_end != 0 ? (p)[0].cur_leaf[(p)[0].cur_pos - (p)[0].cur_start] \
|
|
114
|
+
: CORD__pos_fetch(p))
|
|
115
|
+
|
|
116
|
+
# define CORD_next(p) \
|
|
117
|
+
((p)[0].cur_pos + 1 < (p)[0].cur_end ? (p)[0].cur_pos++ \
|
|
118
|
+
: (CORD__next(p), 0U))
|
|
119
|
+
|
|
120
|
+
# define CORD_prev(p) \
|
|
121
|
+
((p)[0].cur_end != 0 && (p)[0].cur_pos > (p)[0].cur_start \
|
|
122
|
+
? (p)[0].cur_pos-- \
|
|
123
|
+
: (CORD__prev(p), 0U))
|
|
124
|
+
|
|
125
|
+
# define CORD_pos_to_index(p) ((p)[0].cur_pos)
|
|
126
|
+
|
|
127
|
+
# define CORD_pos_to_cord(p) ((p)[0].path[0].pe_cord)
|
|
128
|
+
|
|
129
|
+
# define CORD_pos_valid(p) ((p)[0].path_len != CORD_POS_INVALID)
|
|
130
|
+
|
|
131
|
+
/* Some grubby stuff for performance-critical friends. */
|
|
132
|
+
|
|
133
|
+
/** Number of characters in cache. A non-positive value means none. */
|
|
134
|
+
# define CORD_pos_chars_left(p) ((long)(p)[0].cur_end - (long)(p)[0].cur_pos)
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Advance position by `n` characters; `n` should be positive and less
|
|
138
|
+
* than `CORD_pos_chars_left(p)`.
|
|
139
|
+
*/
|
|
140
|
+
# define CORD_pos_advance(p, n) \
|
|
141
|
+
((p)[0].cur_pos += (n) - (size_t)1, CORD_next(p))
|
|
142
|
+
|
|
143
|
+
/** Address of the current character in cache. */
|
|
144
|
+
# define CORD_pos_cur_char_addr(p) \
|
|
145
|
+
((p)[0].cur_leaf + ((p)[0].cur_pos - (p)[0].cur_start))
|
|
146
|
+
|
|
147
|
+
# ifdef __cplusplus
|
|
148
|
+
} /* extern "C" */
|
|
149
|
+
# endif
|
|
150
|
+
|
|
151
|
+
#endif
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 1993-1994 by Xerox Corporation. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
|
|
5
|
+
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
|
|
6
|
+
*
|
|
7
|
+
* Permission is hereby granted to use or copy this program
|
|
8
|
+
* for any purpose, provided the above notices are retained on all copies.
|
|
9
|
+
* Permission to modify the code and to distribute modified code is granted,
|
|
10
|
+
* provided the above notices are retained, and a notice that the code was
|
|
11
|
+
* modified is included with the above copyright notice.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
#ifndef EC_H
|
|
15
|
+
#define EC_H
|
|
16
|
+
|
|
17
|
+
#ifndef CORD_H
|
|
18
|
+
# include "cord.h"
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
#ifdef __cplusplus
|
|
22
|
+
extern "C" {
|
|
23
|
+
#endif
|
|
24
|
+
|
|
25
|
+
/*
|
|
26
|
+
* Extensible cords are strings that may be destructively appended to.
|
|
27
|
+
* They allow fast construction of cords from characters that are being
|
|
28
|
+
* read from a stream.
|
|
29
|
+
*
|
|
30
|
+
* A client might look like:
|
|
31
|
+
* ```
|
|
32
|
+
* CORD_ec x;
|
|
33
|
+
* CORD result;
|
|
34
|
+
* char c;
|
|
35
|
+
* FILE *f;
|
|
36
|
+
*
|
|
37
|
+
* CORD_ec_init(x);
|
|
38
|
+
* while (...) {
|
|
39
|
+
* c = getc(f);
|
|
40
|
+
* ...
|
|
41
|
+
* CORD_ec_append(x, c);
|
|
42
|
+
* }
|
|
43
|
+
* result = CORD_balance(CORD_ec_to_cord(x));
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* If a C string is desired as the final result, the call to `CORD_balance`
|
|
47
|
+
* may be replaced by a call to `CORD_to_char_star`.
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
#ifndef CORD_BUFSZ
|
|
51
|
+
# define CORD_BUFSZ 128
|
|
52
|
+
#endif
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* This structure represents the concatenation of `ec_cord` with
|
|
56
|
+
* `ec_buf[0 .. ec_bufptr - ec_buf - 1]`.
|
|
57
|
+
*/
|
|
58
|
+
typedef struct CORD_ec_struct {
|
|
59
|
+
CORD ec_cord;
|
|
60
|
+
char *ec_bufptr;
|
|
61
|
+
char ec_buf[CORD_BUFSZ + 1];
|
|
62
|
+
} CORD_ec[1];
|
|
63
|
+
|
|
64
|
+
/** Flush the buffer part of the extended cord into extensible cord. */
|
|
65
|
+
CORD_API void CORD_ec_flush_buf(CORD_ec);
|
|
66
|
+
|
|
67
|
+
/** Convert an extensible cord to a cord. */
|
|
68
|
+
#define CORD_ec_to_cord(x) (CORD_ec_flush_buf(x), (x)[0].ec_cord)
|
|
69
|
+
|
|
70
|
+
/** Initialize an extensible cord. */
|
|
71
|
+
#define CORD_ec_init(x) \
|
|
72
|
+
((x)[0].ec_cord = 0, (void)((x)[0].ec_bufptr = (x)[0].ec_buf))
|
|
73
|
+
|
|
74
|
+
/** Append a character to an extensible cord. */
|
|
75
|
+
#define CORD_ec_append(x, c) \
|
|
76
|
+
((void)((x)[0].ec_bufptr == (x)[0].ec_buf + CORD_BUFSZ \
|
|
77
|
+
? (CORD_ec_flush_buf(x), 0) \
|
|
78
|
+
: 0), \
|
|
79
|
+
(void)(*(x)[0].ec_bufptr++ = (c)))
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Append a cord to an extensible cord. Structure remains shared with
|
|
83
|
+
* the original.
|
|
84
|
+
*/
|
|
85
|
+
CORD_API void CORD_ec_append_cord(CORD_ec, CORD);
|
|
86
|
+
|
|
87
|
+
#ifdef __cplusplus
|
|
88
|
+
} /* extern "C" */
|
|
89
|
+
#endif
|
|
90
|
+
|
|
91
|
+
#endif /* EC_H */
|