koffi 2.10.0 → 2.11.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/CHANGELOG.md +309 -98
- package/build/koffi/darwin_arm64/koffi.node +0 -0
- package/build/koffi/darwin_x64/koffi.node +0 -0
- package/build/koffi/freebsd_arm64/koffi.node +0 -0
- package/build/koffi/freebsd_ia32/koffi.node +0 -0
- package/build/koffi/freebsd_x64/koffi.node +0 -0
- package/build/koffi/linux_arm64/koffi.node +0 -0
- package/build/koffi/linux_armhf/koffi.node +0 -0
- package/build/koffi/linux_ia32/koffi.node +0 -0
- package/build/koffi/linux_riscv64/koffi.node +0 -0
- package/build/koffi/linux_x64/koffi.node +0 -0
- package/build/koffi/musl_x64/koffi.node +0 -0
- package/build/koffi/openbsd_ia32/koffi.node +0 -0
- package/build/koffi/openbsd_x64/koffi.node +0 -0
- package/build/koffi/win32_arm64/koffi.node +0 -0
- package/build/koffi/win32_ia32/koffi.node +0 -0
- package/build/koffi/win32_x64/koffi.node +0 -0
- package/doc/assets.ini +5 -1
- package/doc/{flaat/flaat.css → flat/flat.css} +2 -0
- package/doc/{flaat → flat}/normal.css +124 -31
- package/doc/{flaat → flat}/print.css +1 -2
- package/doc/flat/reset.css +41 -0
- package/doc/{flaat → flat}/small.css +5 -2
- package/doc/{flaat/flaat.js → flat/static.js} +21 -10
- package/doc/pages/contribute.md +3 -3
- package/doc/pages/output.md +32 -1
- package/doc/pages/packaging.md +5 -5
- package/doc/pages/pointers.md +9 -0
- package/doc/pages.ini +13 -13
- package/doc/static/{koffi.js → highlight.js} +0 -1
- package/doc/static/koffi.css +3 -2
- package/doc/static/logo.webp +0 -0
- package/doc/templates/code.html +49 -0
- package/doc/templates/page.html +1 -1
- package/index.js +2 -2
- package/indirect.js +2 -2
- package/package.json +2 -2
- package/src/koffi/CMakeLists.txt +1 -1
- package/src/koffi/src/ffi.cc +39 -0
- package/build/koffi/linux_arm32/koffi.node +0 -0
package/doc/pages.ini
CHANGED
|
@@ -15,71 +15,71 @@ Template = templates/page.html
|
|
|
15
15
|
Title = Get started | Koffi
|
|
16
16
|
Menu = Documentation / Get started
|
|
17
17
|
Description = Install and start using Koffi in your Node.js project
|
|
18
|
-
Template = templates/
|
|
18
|
+
Template = templates/code.html
|
|
19
19
|
|
|
20
20
|
[pages/functions.md]
|
|
21
21
|
Title = Function calls | Koffi
|
|
22
22
|
Menu = Documentation / Function calls
|
|
23
23
|
Description = Call native functions
|
|
24
|
-
Template = templates/
|
|
24
|
+
Template = templates/code.html
|
|
25
25
|
|
|
26
26
|
[pages/input.md]
|
|
27
27
|
Title = Input parameters | Koffi
|
|
28
28
|
Menu = Documentation / Input parameters
|
|
29
|
-
Template = templates/
|
|
29
|
+
Template = templates/code.html
|
|
30
30
|
|
|
31
31
|
[pages/pointers.md]
|
|
32
32
|
Title = Data pointers | Koffi
|
|
33
33
|
Menu = Documentation / Data pointers
|
|
34
|
-
Template = templates/
|
|
34
|
+
Template = templates/code.html
|
|
35
35
|
|
|
36
36
|
[pages/output.md]
|
|
37
37
|
Title = Output parameters | Koffi
|
|
38
38
|
Menu = Documentation / Output parameters
|
|
39
|
-
Template = templates/
|
|
39
|
+
Template = templates/code.html
|
|
40
40
|
|
|
41
41
|
[pages/unions.md]
|
|
42
42
|
Title = Union values | Koffi
|
|
43
43
|
Menu = Documentation / Union values
|
|
44
|
-
Template = templates/
|
|
44
|
+
Template = templates/code.html
|
|
45
45
|
|
|
46
46
|
[pages/variables.md]
|
|
47
47
|
Title = Exported variables | Koffi
|
|
48
48
|
Menu = Documentation / Exported variables
|
|
49
|
-
Template = templates/
|
|
49
|
+
Template = templates/code.html
|
|
50
50
|
|
|
51
51
|
[pages/callbacks.md]
|
|
52
52
|
Title = Callbacks | Koffi
|
|
53
53
|
Menu = Documentation / Javascript callbacks
|
|
54
|
-
Template = templates/
|
|
54
|
+
Template = templates/code.html
|
|
55
55
|
|
|
56
56
|
[pages/misc.md]
|
|
57
57
|
Title = Miscellaneous | Koffi
|
|
58
58
|
Menu = Documentation / Miscellaneous
|
|
59
|
-
Template = templates/
|
|
59
|
+
Template = templates/code.html
|
|
60
60
|
|
|
61
61
|
[pages/packaging.md]
|
|
62
62
|
Title = Packaging | Koffi
|
|
63
63
|
Menu = Documentation / Bundlers and Koffi
|
|
64
|
-
Template = templates/
|
|
64
|
+
Template = templates/code.html
|
|
65
65
|
|
|
66
66
|
[pages/migration.md]
|
|
67
67
|
Title = Migration | Koffi
|
|
68
68
|
Menu = Documentation / Migration guide
|
|
69
69
|
Description = Migration between major Koffi versions
|
|
70
|
-
Template = templates/
|
|
70
|
+
Template = templates/code.html
|
|
71
71
|
|
|
72
72
|
[pages/benchmarks.md]
|
|
73
73
|
Title = Benchmarks | Koffi
|
|
74
74
|
Menu = Benchmarks
|
|
75
75
|
Description = Performance of Koffi compared to NAPI and node-ffi
|
|
76
|
-
Template = templates/
|
|
76
|
+
Template = templates/code.html
|
|
77
77
|
|
|
78
78
|
[pages/contribute.md]
|
|
79
79
|
Title = Contribute | Koffi
|
|
80
80
|
Menu = Contribute
|
|
81
81
|
Description = How to get, build and test Koffi code
|
|
82
|
-
Template = templates/
|
|
82
|
+
Template = templates/code.html
|
|
83
83
|
|
|
84
84
|
[changelog]
|
|
85
85
|
SourceFile = ../../src/koffi/CHANGELOG.md
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
// You should have received a copy of the GNU General Public License
|
|
14
14
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
15
15
|
|
|
16
|
-
import '../flaat/flaat.js';
|
|
17
16
|
import * as hljs from '../../../vendor/highlight.js/highlight.js';
|
|
18
17
|
|
|
19
18
|
window.addEventListener('load', e => {
|
package/doc/static/koffi.css
CHANGED
|
@@ -13,9 +13,10 @@
|
|
|
13
13
|
You should have received a copy of the GNU General Public License
|
|
14
14
|
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
|
15
15
|
|
|
16
|
-
@import url('../
|
|
16
|
+
@import url('../flat/flat.css');
|
|
17
17
|
@import url('../../../vendor/highlight.js/styles/base16/tomorrow.css');
|
|
18
18
|
|
|
19
19
|
html {
|
|
20
|
-
--
|
|
20
|
+
--top_color: #ec7400;
|
|
21
|
+
--anchor_color: #ec7400;
|
|
21
22
|
}
|
package/doc/static/logo.webp
CHANGED
|
Binary file
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en" class="nojs">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
|
|
7
|
+
<title>{{ TITLE }}</title>
|
|
8
|
+
<meta name="author" content="Niels Martignène">
|
|
9
|
+
<meta name="description" content="{{ DESCRIPTION }}">
|
|
10
|
+
<link rel="icon" href="{{ ASSET favicon.png }}">
|
|
11
|
+
|
|
12
|
+
<meta name="theme-color" content="#6aa051">
|
|
13
|
+
<link rel="stylesheet" href="{{ ASSET static/site.min.css }}">
|
|
14
|
+
|
|
15
|
+
<script type="text/javascript" src="{{ ASSET static/site.min.js }}" async></script>
|
|
16
|
+
<script type="text/javascript" src="{{ ASSET static/highlight.min.js }}" async></script>
|
|
17
|
+
</head>
|
|
18
|
+
|
|
19
|
+
<body>
|
|
20
|
+
<div id="deploy"></div>
|
|
21
|
+
|
|
22
|
+
<nav id="top">
|
|
23
|
+
<menu>
|
|
24
|
+
<a id="logo" href="/"><img src="{{ ASSET static/logo.webp }}" alt="Logo Koffi" /></a>
|
|
25
|
+
|
|
26
|
+
{{ LINKS }}
|
|
27
|
+
|
|
28
|
+
<div style="flex: 1;"></div>
|
|
29
|
+
|
|
30
|
+
<li><a href="https://www.npmjs.com/package/koffi" style="border-bottom-color: transparent; margin-top: 8px;"><img src="https://img.shields.io/npm/v/koffi?color=brightgreen&cacheSeconds=7200" alt="NPM"/></a></li>
|
|
31
|
+
<li><a href="https://github.com/Koromix/koffi" style="border-bottom-color: transparent; margin-top: 8px;"><img src="https://img.shields.io/badge/GitHub-Koffi-ff6600" alt="GitHub"/></a></li>
|
|
32
|
+
</menu>
|
|
33
|
+
</nav>
|
|
34
|
+
|
|
35
|
+
{{ TOC }}
|
|
36
|
+
|
|
37
|
+
<main>
|
|
38
|
+
{{ CONTENT }}
|
|
39
|
+
</main>
|
|
40
|
+
|
|
41
|
+
<footer>
|
|
42
|
+
<div>Koffi © 2024</div>
|
|
43
|
+
<div style="font-size: 0.8em;">
|
|
44
|
+
Niels Martignène (<a href="https://github.com/Koromix/" target="_blank">Koromix</a>)<br>
|
|
45
|
+
<a href="mailto:niels.martignene@protonmail.com" style="font-weight: bold; color: inherit;">niels.martignene@protonmail.com</a>
|
|
46
|
+
</div>
|
|
47
|
+
</footer>
|
|
48
|
+
</body>
|
|
49
|
+
</html>
|
package/doc/templates/page.html
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
|
|
27
27
|
<div style="flex: 1;"></div>
|
|
28
28
|
|
|
29
|
-
<li><a href="https://www.npmjs.com/package/koffi" style="border-bottom-color: transparent; margin-top: 8px;"><img src="https://img.shields.io/
|
|
29
|
+
<li><a href="https://www.npmjs.com/package/koffi" style="border-bottom-color: transparent; margin-top: 8px;"><img src="https://img.shields.io/npm/v/koffi?color=brightgreen&cacheSeconds=7200" alt="NPM"/></a></li>
|
|
30
30
|
<li><a href="https://github.com/Koromix/koffi" style="border-bottom-color: transparent; margin-top: 8px;"><img src="https://img.shields.io/badge/GitHub-Koffi-ff6600" alt="GitHub"/></a></li>
|
|
31
31
|
</menu>
|
|
32
32
|
</nav>
|
package/index.js
CHANGED
|
@@ -363,8 +363,8 @@ var require_package = __commonJS({
|
|
|
363
363
|
"../../bin/Koffi/package/src/koffi/package.json"(exports2, module2) {
|
|
364
364
|
module2.exports = {
|
|
365
365
|
name: "koffi",
|
|
366
|
-
version: "2.
|
|
367
|
-
stable: "2.
|
|
366
|
+
version: "2.11.0",
|
|
367
|
+
stable: "2.11.0",
|
|
368
368
|
description: "Fast and simple C FFI (foreign function interface) for Node.js",
|
|
369
369
|
keywords: [
|
|
370
370
|
"foreign",
|
package/indirect.js
CHANGED
|
@@ -363,8 +363,8 @@ var require_package = __commonJS({
|
|
|
363
363
|
"../../bin/Koffi/package/src/koffi/package.json"(exports2, module2) {
|
|
364
364
|
module2.exports = {
|
|
365
365
|
name: "koffi",
|
|
366
|
-
version: "2.
|
|
367
|
-
stable: "2.
|
|
366
|
+
version: "2.11.0",
|
|
367
|
+
stable: "2.11.0",
|
|
368
368
|
description: "Fast and simple C FFI (foreign function interface) for Node.js",
|
|
369
369
|
keywords: [
|
|
370
370
|
"foreign",
|
package/package.json
CHANGED
package/src/koffi/CMakeLists.txt
CHANGED
|
@@ -118,7 +118,7 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
|
118
118
|
endif()
|
|
119
119
|
endif()
|
|
120
120
|
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
|
121
|
-
if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
|
|
121
|
+
if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch|arm")
|
|
122
122
|
list(APPEND KOFFI_SRC src/abi_arm32.cc src/abi_arm32_asm.S)
|
|
123
123
|
else()
|
|
124
124
|
if(WIN32)
|
package/src/koffi/src/ffi.cc
CHANGED
|
@@ -2107,6 +2107,44 @@ static Napi::Value EncodeValue(const Napi::CallbackInfo &info)
|
|
|
2107
2107
|
return env.Undefined();
|
|
2108
2108
|
}
|
|
2109
2109
|
|
|
2110
|
+
static Napi::Value CreateView(const Napi::CallbackInfo &info)
|
|
2111
|
+
{
|
|
2112
|
+
Napi::Env env = info.Env();
|
|
2113
|
+
InstanceData *instance = env.GetInstanceData<InstanceData>();
|
|
2114
|
+
|
|
2115
|
+
if (info.Length() < 1) {
|
|
2116
|
+
ThrowError<Napi::TypeError>(env, "Expected 2 arguments, got %1", info.Length());
|
|
2117
|
+
return env.Null();
|
|
2118
|
+
}
|
|
2119
|
+
if (!info[1].IsNumber()) {
|
|
2120
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for length, expected integer", GetValueType(instance, info[1]));
|
|
2121
|
+
return env.Null();
|
|
2122
|
+
}
|
|
2123
|
+
|
|
2124
|
+
void *ptr = nullptr;
|
|
2125
|
+
if (!GetExternalPointer(env, info[0], &ptr))
|
|
2126
|
+
return env.Null();
|
|
2127
|
+
Size len = (Size)info[1].As<Napi::Number>().Int64Value();
|
|
2128
|
+
|
|
2129
|
+
if (len < 0) {
|
|
2130
|
+
ThrowError<Napi::TypeError>(env, "Array length must be positive and non-zero");
|
|
2131
|
+
return env.Null();
|
|
2132
|
+
}
|
|
2133
|
+
|
|
2134
|
+
if (len) {
|
|
2135
|
+
Napi::ArrayBuffer view = Napi::ArrayBuffer::New(env, ptr, (size_t)len);
|
|
2136
|
+
|
|
2137
|
+
if (!view.ByteLength()) {
|
|
2138
|
+
ThrowError<Napi::Error>(env, "This runtime does not support external buffers");
|
|
2139
|
+
return env.Null();
|
|
2140
|
+
}
|
|
2141
|
+
|
|
2142
|
+
return view;
|
|
2143
|
+
} else {
|
|
2144
|
+
return Napi::ArrayBuffer::New(env, 0);
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2147
|
+
|
|
2110
2148
|
static Napi::Value ResetKoffi(const Napi::CallbackInfo &info)
|
|
2111
2149
|
{
|
|
2112
2150
|
Napi::Env env = info.Env();
|
|
@@ -2364,6 +2402,7 @@ static Napi::Object InitModule(Napi::Env env, Napi::Object exports)
|
|
|
2364
2402
|
exports.Set("address", Napi::Function::New(env, GetPointerAddress, "address"));
|
|
2365
2403
|
exports.Set("call", Napi::Function::New(env, CallPointerSync, "call"));
|
|
2366
2404
|
exports.Set("encode", Napi::Function::New(env, EncodeValue, "encode"));
|
|
2405
|
+
exports.Set("view", Napi::Function::New(env, CreateView, "view"));
|
|
2367
2406
|
|
|
2368
2407
|
exports.Set("reset", Napi::Function::New(env, ResetKoffi, "reset"));
|
|
2369
2408
|
|
|
Binary file
|