koffi 2.9.1 → 2.10.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 +61 -48
- 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_arm32/koffi.node +0 -0
- package/build/koffi/linux_arm64/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/README.md +27 -0
- package/doc/assets.ini +19 -0
- package/doc/develop.sh +14 -0
- package/doc/flaat/flaat.css +25 -0
- package/doc/flaat/flaat.js +150 -0
- package/doc/flaat/normal.css +335 -0
- package/doc/flaat/print.css +30 -0
- package/doc/flaat/small.css +101 -0
- package/doc/{benchmarks.md → pages/benchmarks.md} +14 -18
- package/doc/{callbacks.md → pages/callbacks.md} +27 -36
- package/doc/{contribute.md → pages/contribute.md} +10 -12
- package/doc/{functions.md → pages/functions.md} +29 -34
- package/doc/pages/index.md +20 -0
- package/doc/{input.md → pages/input.md} +28 -33
- package/doc/{migration.md → pages/migration.md} +7 -10
- package/doc/{misc.md → pages/misc.md} +54 -23
- package/doc/{output.md → pages/output.md} +17 -20
- package/doc/{packaging.md → pages/packaging.md} +19 -12
- package/doc/{platforms.md → pages/platforms.md} +25 -11
- package/doc/{pointers.md → pages/pointers.md} +13 -16
- package/doc/{start.md → pages/start.md} +12 -14
- package/doc/{unions.md → pages/unions.md} +5 -7
- package/doc/{variables.md → pages/variables.md} +7 -11
- package/doc/pages.ini +89 -0
- package/doc/static/koffi.css +21 -0
- package/doc/static/koffi.js +21 -0
- package/doc/static/koffi.png +0 -0
- package/doc/static/logo.webp +0 -0
- package/doc/static/print.css +22 -0
- package/doc/templates/page.html +48 -0
- package/index.js +2 -2
- package/indirect.js +2 -2
- package/package.json +2 -2
- package/src/koffi/CMakeLists.txt +6 -0
- package/src/koffi/examples/yao-pkg/README.md +17 -0
- package/src/koffi/examples/yao-pkg/index.js +2 -0
- package/src/koffi/examples/yao-pkg/package.json +22 -0
- package/src/koffi/src/call.cc +2 -0
- package/src/koffi/src/ffi.cc +40 -4
- package/src/koffi/src/util.cc +1 -1
- package/doc/Makefile +0 -20
- package/doc/benchmarks.xlsx +0 -0
- package/doc/changelog.md +0 -5
- package/doc/conf.py +0 -118
- package/doc/index.rst +0 -47
- package/doc/make.bat +0 -35
- package/doc/poetry.lock +0 -521
- package/doc/pyproject.toml +0 -19
- package/doc/static/bench_linux.png +0 -0
- package/doc/static/bench_windows.png +0 -0
- package/doc/static/custom.css +0 -70
- package/doc/static/node_c.webp +0 -0
- package/doc/static/opensans/LICENSE.txt +0 -202
- package/doc/static/opensans/OpenSans.css +0 -39
- package/doc/static/opensans/OpenSans_v17_Latin_Bold.woff +0 -0
- package/doc/static/opensans/OpenSans_v17_Latin_Bold.woff2 +0 -0
- package/doc/static/opensans/OpenSans_v17_Latin_BoldItalic.woff +0 -0
- package/doc/static/opensans/OpenSans_v17_Latin_BoldItalic.woff2 +0 -0
- package/doc/static/opensans/OpenSans_v17_Latin_Italic.woff +0 -0
- package/doc/static/opensans/OpenSans_v17_Latin_Italic.woff2 +0 -0
- package/doc/static/opensans/OpenSans_v17_Latin_Regular.woff +0 -0
- package/doc/static/opensans/OpenSans_v17_Latin_Regular.woff2 +0 -0
- package/doc/static/perf_linux_20220623.png +0 -0
- package/doc/static/perf_linux_20220623_2.png +0 -0
- package/doc/static/perf_linux_20220627.png +0 -0
- package/doc/static/perf_linux_20220628.png +0 -0
- package/doc/static/perf_linux_20220812.png +0 -0
- package/doc/static/perf_windows_20220623.png +0 -0
- package/doc/static/perf_windows_20220623_2.png +0 -0
- package/doc/static/perf_windows_20220627.png +0 -0
- package/doc/static/perf_windows_20220628.png +0 -0
- package/doc/static/perf_windows_20220812.png +0 -0
- package/doc/templates/badges.html +0 -7
- package/doc/templates/logo.html +0 -3
- /package/doc/static/{perf_linux_20231028.png → perf_linux.png} +0 -0
- /package/doc/static/{perf_windows_20231028.png → perf_windows.png} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,24 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Version history
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> [!NOTE]
|
|
4
|
+
> Consult the [migration guide](migration) to migrate between major Koffi versions.
|
|
5
|
+
|
|
6
|
+
## Koffi 2
|
|
7
|
+
|
|
8
|
+
### Koffi 2.10
|
|
9
|
+
|
|
10
|
+
#### Koffi 2.10.0 (2024-12-22)
|
|
11
|
+
|
|
12
|
+
- Allow [redefinition of opaque types](misc#circular-references) to concrete struct or union
|
|
13
|
+
- Update documentation style
|
|
4
14
|
|
|
5
15
|
### Koffi 2.9
|
|
6
16
|
|
|
17
|
+
#### Koffi 2.9.2 (2024-11-08)
|
|
18
|
+
|
|
19
|
+
- Fix non-aligned pointers when pushing UTF-16 and UTF-32 string parameters
|
|
20
|
+
- Various documentation fixes and improvements
|
|
21
|
+
|
|
7
22
|
#### Koffi 2.9.1 (2024-09-23)
|
|
8
23
|
|
|
9
24
|
- Fix x86 32-bit support regression in 2.9.0
|
|
@@ -21,9 +36,8 @@
|
|
|
21
36
|
|
|
22
37
|
- Work around MSVC compiler bug introduced in Visual Studio 17.10
|
|
23
38
|
|
|
24
|
-
|
|
25
|
-
Use on platforms without pre-built binaries is broken in Koffi 2.8.10, skip this version.
|
|
26
|
-
```
|
|
39
|
+
> [!WARNING]
|
|
40
|
+
> Use on platforms without pre-built binaries is broken in Koffi 2.8.10, skip this version.
|
|
27
41
|
|
|
28
42
|
#### Koffi 2.8.9 (2024-05-17)
|
|
29
43
|
|
|
@@ -39,7 +53,7 @@ Use on platforms without pre-built binaries is broken in Koffi 2.8.10, skip this
|
|
|
39
53
|
|
|
40
54
|
#### Koffi 2.8.6 (2024-04-12)
|
|
41
55
|
|
|
42
|
-
- Support [loading library](functions
|
|
56
|
+
- Support [loading library](functions#loading-options) with RTLD_DEEPBIND where supported
|
|
43
57
|
|
|
44
58
|
#### Koffi 2.8.5 (2024-04-11)
|
|
45
59
|
|
|
@@ -51,13 +65,12 @@ Use on platforms without pre-built binaries is broken in Koffi 2.8.10, skip this
|
|
|
51
65
|
|
|
52
66
|
- Use simpler workaround for Node 20.12+ and 21.6+ to avoid excessive memory use
|
|
53
67
|
|
|
54
|
-
|
|
55
|
-
Some pre-built binaries are missing in Koffi 2.8.3, skip this version.
|
|
56
|
-
```
|
|
68
|
+
> [!WARNING]
|
|
69
|
+
> Some pre-built binaries are missing in Koffi 2.8.3, skip this version.
|
|
57
70
|
|
|
58
71
|
#### Koffi 2.8.2 (2024-04-07)
|
|
59
72
|
|
|
60
|
-
- Support [loading library](functions
|
|
73
|
+
- Support [loading library](functions#loading-options) with RTLD_GLOBAL on POSIX platforms
|
|
61
74
|
|
|
62
75
|
#### Koffi 2.8.1 (2024-04-04)
|
|
63
76
|
|
|
@@ -66,7 +79,7 @@ Some pre-built binaries are missing in Koffi 2.8.3, skip this version.
|
|
|
66
79
|
#### Koffi 2.8.0 (2024-02-12)
|
|
67
80
|
|
|
68
81
|
- Support pushing pointers for string arguments
|
|
69
|
-
- Add `koffi.alloc()` for [stable pointers](output
|
|
82
|
+
- Add `koffi.alloc()` for [stable pointers](output#stable-pointers)
|
|
70
83
|
|
|
71
84
|
### Koffi 2.7
|
|
72
85
|
|
|
@@ -89,13 +102,13 @@ Some pre-built binaries are missing in Koffi 2.8.3, skip this version.
|
|
|
89
102
|
|
|
90
103
|
#### Koffi 2.7.1 (2024-01-02)
|
|
91
104
|
|
|
92
|
-
- Support C-like `int[3]` syntax for [fixed array types](input
|
|
105
|
+
- Support C-like `int[3]` syntax for [fixed array types](input#fixed-size-c-arrays)
|
|
93
106
|
- Refuse type specifiers with invalid tokens at the end (previously ignored)
|
|
94
107
|
|
|
95
108
|
#### Koffi 2.7.0 (2023-12-21)
|
|
96
109
|
|
|
97
|
-
- Support alternative [callback calling convention](callbacks
|
|
98
|
-
- Change syntax for [calling conventions](functions
|
|
110
|
+
- Support alternative [callback calling convention](callbacks#callback-types) in classic syntax
|
|
111
|
+
- Change syntax for [calling conventions](functions#calling-conventions) with classic syntax
|
|
99
112
|
- Drop unused "internal" property from Koffi
|
|
100
113
|
|
|
101
114
|
### Koffi 2.6
|
|
@@ -107,7 +120,7 @@ Some pre-built binaries are missing in Koffi 2.8.3, skip this version.
|
|
|
107
120
|
#### Koffi 2.6.11 (2023-12-05)
|
|
108
121
|
|
|
109
122
|
- Speed up resolving simple and often used type names
|
|
110
|
-
- Fix use of optional length argument with [koffi.encode()](variables
|
|
123
|
+
- Fix use of optional length argument with [koffi.encode()](variables#encode-to-c-memory)
|
|
111
124
|
|
|
112
125
|
#### Koffi 2.6.10 (2023-11-29)
|
|
113
126
|
|
|
@@ -120,9 +133,8 @@ Some pre-built binaries are missing in Koffi 2.8.3, skip this version.
|
|
|
120
133
|
- Show detected version of Node when not adequate
|
|
121
134
|
- Minor documentation fixes
|
|
122
135
|
|
|
123
|
-
|
|
124
|
-
Loading Win32 system libraries can fail in Koffi 2.6.8, skip this version.
|
|
125
|
-
```
|
|
136
|
+
> [!WARNING]
|
|
137
|
+
> Loading Win32 system libraries can fail in Koffi 2.6.8, skip this version.
|
|
126
138
|
|
|
127
139
|
#### Koffi 2.6.6 (2023-10-28)
|
|
128
140
|
|
|
@@ -141,9 +153,8 @@ Loading Win32 system libraries can fail in Koffi 2.6.8, skip this version.
|
|
|
141
153
|
|
|
142
154
|
- Add indirect loading script to help some bundlers
|
|
143
155
|
|
|
144
|
-
|
|
145
|
-
Pre-built binaries don't work correctly in Koffi 2.6.2, skip this version.
|
|
146
|
-
```
|
|
156
|
+
> [!WARNING]
|
|
157
|
+
> Pre-built binaries don't work correctly in Koffi 2.6.2, skip this version.
|
|
147
158
|
|
|
148
159
|
#### Koffi 2.6.1 (2023-09-18)
|
|
149
160
|
|
|
@@ -154,9 +165,9 @@ Pre-built binaries don't work correctly in Koffi 2.6.2, skip this version.
|
|
|
154
165
|
|
|
155
166
|
**New features:**
|
|
156
167
|
|
|
157
|
-
- Use [koffi.symbol()](variables
|
|
158
|
-
- Use [koffi.encode()](variables
|
|
159
|
-
- Use shared library [lazy-loading](functions
|
|
168
|
+
- Use [koffi.symbol()](variables#variable-definitions) to make pointers to exported variables (or other symbols)
|
|
169
|
+
- Use [koffi.encode()](variables#encode-to-c-memory) to explictly encode data from JS to C memory
|
|
170
|
+
- Use shared library [lazy-loading](functions#loading-options) (RTLD_LAZY) on POSIX platforms
|
|
160
171
|
|
|
161
172
|
**Other changes:**
|
|
162
173
|
|
|
@@ -173,7 +184,7 @@ Pre-built binaries don't work correctly in Koffi 2.6.2, skip this version.
|
|
|
173
184
|
#### Koffi 2.5.19 (2023-08-29)
|
|
174
185
|
|
|
175
186
|
- Create thread-safe function broker lazily
|
|
176
|
-
- Add [koffi.reset()](misc
|
|
187
|
+
- Add [koffi.reset()](misc#reset-internal-state) for type names and async broker
|
|
177
188
|
|
|
178
189
|
#### Koffi 2.5.18 (2023-08-27)
|
|
179
190
|
|
|
@@ -185,9 +196,8 @@ Pre-built binaries don't work correctly in Koffi 2.6.2, skip this version.
|
|
|
185
196
|
- Fix DLL error when using Koffi from NW.js on Windows
|
|
186
197
|
- Simplify NW.js Koffi example
|
|
187
198
|
|
|
188
|
-
|
|
189
|
-
Pre-built binaries don't work correctly in Koffi 2.5.13 to 2.5.15, skip those versions.
|
|
190
|
-
```
|
|
199
|
+
> [!WARNING]
|
|
200
|
+
> Pre-built binaries don't work correctly in Koffi 2.5.13 to 2.5.15, skip those versions.
|
|
191
201
|
|
|
192
202
|
#### Koffi 2.5.12 (2023-08-21)
|
|
193
203
|
|
|
@@ -196,7 +206,7 @@ Pre-built binaries don't work correctly in Koffi 2.5.13 to 2.5.15, skip those ve
|
|
|
196
206
|
|
|
197
207
|
#### Koffi 2.5.11 (2023-08-03)
|
|
198
208
|
|
|
199
|
-
- Support casting function pointers with [koffi.as()](pointers
|
|
209
|
+
- Support casting function pointers with [koffi.as()](pointers#handling-void-pointers)
|
|
200
210
|
- Build in C++20 mode
|
|
201
211
|
|
|
202
212
|
#### Koffi 2.5.10 (2023-08-01)
|
|
@@ -218,7 +228,7 @@ Pre-built binaries don't work correctly in Koffi 2.5.13 to 2.5.15, skip those ve
|
|
|
218
228
|
#### Koffi 2.5.8 (2023-07-26)
|
|
219
229
|
|
|
220
230
|
- Add more search paths for native Koffi modules
|
|
221
|
-
- Add section [about bundling](start
|
|
231
|
+
- Add section [about bundling](start#bundling-koffi) to documentation
|
|
222
232
|
|
|
223
233
|
#### Koffi 2.5.7 (2023-07-19)
|
|
224
234
|
|
|
@@ -255,7 +265,7 @@ Pre-built binaries don't work correctly in Koffi 2.5.13 to 2.5.15, skip those ve
|
|
|
255
265
|
|
|
256
266
|
**New features:**
|
|
257
267
|
|
|
258
|
-
- Support [union types](unions
|
|
268
|
+
- Support [union types](unions)
|
|
259
269
|
|
|
260
270
|
**Other fixes:**
|
|
261
271
|
|
|
@@ -273,8 +283,8 @@ Pre-built binaries don't work correctly in Koffi 2.5.13 to 2.5.15, skip those ve
|
|
|
273
283
|
|
|
274
284
|
**Main changes:**
|
|
275
285
|
|
|
276
|
-
- Support [decoding function pointers](functions
|
|
277
|
-
- Support calling function pointers with [koffi.call()](functions
|
|
286
|
+
- Support [decoding function pointers](functions#decode-pointer-to-function) to callable functions
|
|
287
|
+
- Support calling function pointers with [koffi.call()](functions#call-pointer-directly)
|
|
278
288
|
- Deprecate `koffi.callback` in favor of `koffi.proto`
|
|
279
289
|
|
|
280
290
|
**Other changes:**
|
|
@@ -384,9 +394,9 @@ Pre-built binaries don't work correctly in Koffi 2.5.13 to 2.5.15, skip those ve
|
|
|
384
394
|
|
|
385
395
|
**Main changes:**
|
|
386
396
|
|
|
387
|
-
- Fix type parser issues (such as ignoring some [disposable qualifiers](pointers
|
|
397
|
+
- Fix type parser issues (such as ignoring some [disposable qualifiers](pointers#disposable-types))
|
|
388
398
|
- Fix crash when using disposable types in output parameters
|
|
389
|
-
- Add basic [koffi.stats()](misc
|
|
399
|
+
- Add basic [koffi.stats()](misc#usage-statistics) interface
|
|
390
400
|
|
|
391
401
|
**Other changes:**
|
|
392
402
|
|
|
@@ -404,8 +414,8 @@ Pre-built binaries don't work correctly in Koffi 2.5.13 to 2.5.15, skip those ve
|
|
|
404
414
|
**Main changes:**
|
|
405
415
|
|
|
406
416
|
- Allow buffers (TypedArray or ArrayBuffer) values for input and/or output pointer arguments (for polymorphic arguments)
|
|
407
|
-
- Support opaque buffers (TypedArray or ArrayBuffer) values in `koffi.decode()` to [decode output buffers](output
|
|
408
|
-
- Decode non-string types as arrays when an [explicit length is passed to koffi.decode()](callbacks
|
|
417
|
+
- Support opaque buffers (TypedArray or ArrayBuffer) values in `koffi.decode()` to [decode output buffers](output#output-buffers)
|
|
418
|
+
- Decode non-string types as arrays when an [explicit length is passed to koffi.decode()](callbacks#decoding-pointer-arguments)
|
|
409
419
|
|
|
410
420
|
**Other changes:**
|
|
411
421
|
|
|
@@ -436,7 +446,7 @@ Pre-built binaries don't work correctly in Koffi 2.5.13 to 2.5.15, skip those ve
|
|
|
436
446
|
|
|
437
447
|
**Main fixes:**
|
|
438
448
|
|
|
439
|
-
- Support transparent [asynchronous callbacks](callbacks
|
|
449
|
+
- Support transparent [asynchronous callbacks](callbacks#asynchronous-callbacks)
|
|
440
450
|
- Expand from a maximum of 16+16 to 1024 callbacks running in parallel
|
|
441
451
|
|
|
442
452
|
**Other fixes:**
|
|
@@ -454,8 +464,8 @@ Pre-built binaries don't work correctly in Koffi 2.5.13 to 2.5.15, skip those ve
|
|
|
454
464
|
|
|
455
465
|
**New features:**
|
|
456
466
|
|
|
457
|
-
- Add [koffi.decode()](callbacks
|
|
458
|
-
- Support transparent [output string parameters](output
|
|
467
|
+
- Add [koffi.decode()](callbacks#decoding-pointer-arguments) for callback pointer arguments
|
|
468
|
+
- Support transparent [output string parameters](output#string-buffer-example)
|
|
459
469
|
- Add `koffi.offsetof()` utility function
|
|
460
470
|
- Support optional *this* binding in `koffi.register()`
|
|
461
471
|
|
|
@@ -468,7 +478,7 @@ Pre-built binaries don't work correctly in Koffi 2.5.13 to 2.5.15, skip those ve
|
|
|
468
478
|
|
|
469
479
|
#### Koffi 2.1.5 (2022-11-27)
|
|
470
480
|
|
|
471
|
-
- Add missing README
|
|
481
|
+
- Add missing README file to NPM package
|
|
472
482
|
|
|
473
483
|
#### Koffi 2.1.4 (2022-11-25)
|
|
474
484
|
|
|
@@ -497,8 +507,8 @@ Pre-built binaries don't work correctly in Koffi 2.5.13 to 2.5.15, skip those ve
|
|
|
497
507
|
|
|
498
508
|
**Main changes:**
|
|
499
509
|
|
|
500
|
-
- Add [koffi.as()](pointers
|
|
501
|
-
- Add [endian-sensitive integer types](input
|
|
510
|
+
- Add [koffi.as()](pointers#handling-void-pointers) to support polymorphic APIs based on `void *` parameters
|
|
511
|
+
- Add [endian-sensitive integer types](input#endian-sensitive-integers): `intX_le_t`, `intX_be_t`, `uintX_le_t`, `uintX_be_t`
|
|
502
512
|
- Accept typed arrays for `void *` parameters
|
|
503
513
|
- Introduce `koffi.opaque()` to replace `koffi.handle()` (which remains supported until Koffi 3.0)
|
|
504
514
|
- Support JS Array and TypedArray to fill struct and array pointer members
|
|
@@ -521,8 +531,8 @@ Pre-built binaries don't work correctly in Koffi 2.5.13 to 2.5.15, skip those ve
|
|
|
521
531
|
|
|
522
532
|
**Major new features:**
|
|
523
533
|
|
|
524
|
-
- Add [disposable types](pointers
|
|
525
|
-
- Add support for [registered callbacks](callbacks
|
|
534
|
+
- Add [disposable types](pointers#disposable-types) for automatic disposal of C values (such as heap-allocated strings)
|
|
535
|
+
- Add support for [registered callbacks](callbacks#registered-callbacks), that can be called after the initial FFI call
|
|
526
536
|
- Support named pointer types
|
|
527
537
|
- Support complex type specifications outside of prototype parser
|
|
528
538
|
|
|
@@ -539,7 +549,9 @@ Pre-built binaries don't work correctly in Koffi 2.5.13 to 2.5.15, skip those ve
|
|
|
539
549
|
- Change handling of opaque handles, which must be used through pointers
|
|
540
550
|
- Support all types in `koffi.introspect(type)`
|
|
541
551
|
|
|
542
|
-
Consult the [migration guide](migration
|
|
552
|
+
Consult the [migration guide](migration) for more information.
|
|
553
|
+
|
|
554
|
+
## Koffi 1
|
|
543
555
|
|
|
544
556
|
### Koffi 1.3
|
|
545
557
|
|
|
@@ -691,13 +703,14 @@ This entry documents changes since version 1.1.0.
|
|
|
691
703
|
- Make sure we have a redzone below the stack for all architectures
|
|
692
704
|
- Use slower allocation for big objects instead of failing
|
|
693
705
|
|
|
694
|
-
|
|
706
|
+
# Todo list
|
|
695
707
|
|
|
696
708
|
The following features and improvements are planned, not necessarily in that order:
|
|
697
709
|
|
|
710
|
+
- Port Koffi to Loong64 ISA and ABI
|
|
711
|
+
- Port Koffi to PowerPC (POWER9+) ISA and ABI
|
|
698
712
|
- Optimize passing of structs and arrays (with auto-generated JS)
|
|
699
713
|
- Automate Windows/AArch64 (qemu) and macOS/AArch64 (how? ... thanks Apple) tests
|
|
700
714
|
- Create a real-world example, using several libraries (Raylib, SQLite, libsodium) to illustrate various C API styles
|
|
701
715
|
- Add simple struct type parser
|
|
702
|
-
- Port Koffi to PowerPC (POWER9+) ABI
|
|
703
716
|
- Fix assembly unwind and CFI directives for better debugging experience
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/doc/README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Install required dependencies
|
|
2
|
+
|
|
3
|
+
On Debian and Ubuntu use the following commands:
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
sudo apt update
|
|
7
|
+
sudo apt install build-essential
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
On RPM-based distributions such as Fedora or Rocky Linux, use:
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
sudo dnf groupinstall "Development Tools"
|
|
14
|
+
sudo dnf install clang
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
# Run the develop script
|
|
18
|
+
|
|
19
|
+
Run the development script from the website directory:
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
./develop.sh
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Open the proposed link at `http://localhost:8000/`.
|
|
26
|
+
|
|
27
|
+
Change page content at will and builds will happen automatically. You just need to refresh the page.
|
package/doc/assets.ini
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
EsbuildPath = ../../vendor/esbuild/bin
|
|
2
|
+
|
|
3
|
+
[favicon.png]
|
|
4
|
+
Type = Copy
|
|
5
|
+
From = static/koffi.png
|
|
6
|
+
|
|
7
|
+
[static]
|
|
8
|
+
Type = Copy
|
|
9
|
+
From = static
|
|
10
|
+
Ignore = favicon.png *.js *.css
|
|
11
|
+
|
|
12
|
+
[static/site.min.js]
|
|
13
|
+
Type = Bundle
|
|
14
|
+
Source = static/koffi.js
|
|
15
|
+
|
|
16
|
+
[static/site.min.css]
|
|
17
|
+
Type = Bundle
|
|
18
|
+
Source = static/koffi.css
|
|
19
|
+
Options = --loader:.woff=file --loader:.woff2=file --loader:.png=file --loader:.webp=file
|
package/doc/develop.sh
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/bin/bash -e
|
|
2
|
+
|
|
3
|
+
cd "$(dirname $0)"
|
|
4
|
+
|
|
5
|
+
../../bootstrap.sh
|
|
6
|
+
../../felix -pFast serf hodler
|
|
7
|
+
|
|
8
|
+
trap 'kill $(jobs -p) 2>/dev/null' EXIT
|
|
9
|
+
trap 'kill $(jobs -p) 2>/dev/null' SIGINT
|
|
10
|
+
|
|
11
|
+
../../bin/Fast/serf dist/ &
|
|
12
|
+
../../bin/Fast/hodler . -O dist --loop &
|
|
13
|
+
|
|
14
|
+
wait $(jobs -p)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* Copyright (C) 2024 Niels Martignène <niels.martignene@protonmail.com>
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
+
this software and associated documentation files (the “Software”), to deal in
|
|
5
|
+
the Software without restriction, including without limitation the rights to use,
|
|
6
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
7
|
+
Software, and to permit persons to whom the Software is furnished to do so,
|
|
8
|
+
subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
|
|
14
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
15
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
16
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
17
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
18
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
19
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
20
|
+
OTHER DEALINGS IN THE SOFTWARE. */
|
|
21
|
+
|
|
22
|
+
@import url('../../../vendor/opensans/OpenSans.css');
|
|
23
|
+
@import url('./normal.css');
|
|
24
|
+
@import url('./small.css');
|
|
25
|
+
@import url('./print.css');
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
// Copyright (C) 2024 Niels Martignène <niels.martignene@protonmail.com>
|
|
2
|
+
//
|
|
3
|
+
// This program is free software: you can redistribute it and/or modify
|
|
4
|
+
// it under the terms of the GNU General Public License as published by
|
|
5
|
+
// the Free Software Foundation, either version 3 of the License, or
|
|
6
|
+
// (at your option) any later version.
|
|
7
|
+
//
|
|
8
|
+
// This program is distributed in the hope that it will be useful,
|
|
9
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11
|
+
// GNU General Public License for more details.
|
|
12
|
+
//
|
|
13
|
+
// You should have received a copy of the GNU General Public License
|
|
14
|
+
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
15
|
+
|
|
16
|
+
window.addEventListener('load', e => {
|
|
17
|
+
initDeploy();
|
|
18
|
+
initMenu();
|
|
19
|
+
initSide();
|
|
20
|
+
initScroll();
|
|
21
|
+
|
|
22
|
+
document.documentElement.classList.remove('nojs');
|
|
23
|
+
document.documentElement.classList.add('js');
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
function initDeploy() {
|
|
27
|
+
let deploy = document.querySelector('#deploy');
|
|
28
|
+
|
|
29
|
+
deploy.addEventListener('click', e => {
|
|
30
|
+
let top = document.querySelector('nav#top');
|
|
31
|
+
top.classList.toggle('active');
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function initMenu() {
|
|
36
|
+
let items = document.querySelectorAll('nav#top li');
|
|
37
|
+
|
|
38
|
+
document.body.addEventListener('click', e => {
|
|
39
|
+
if (e.target.tagName == 'DIV' && findParent(e.target, el => el.id == 'top'))
|
|
40
|
+
return;
|
|
41
|
+
|
|
42
|
+
// Expand top menu categories
|
|
43
|
+
{
|
|
44
|
+
let target = findParent(e.target, el => el.tagName == 'LI');
|
|
45
|
+
|
|
46
|
+
if (target?.querySelector('div') != null) {
|
|
47
|
+
for (let item of items) {
|
|
48
|
+
if (item == target) {
|
|
49
|
+
item.classList.toggle('active');
|
|
50
|
+
} else {
|
|
51
|
+
item.classList.remove('active');
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (e.target.tagName == 'A' && e.target.getAttribute('href') == '#')
|
|
58
|
+
e.preventDefault();
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function initSide() {
|
|
63
|
+
// Find all side menu items, and the pointed to elements
|
|
64
|
+
let links = [].slice.call(document.querySelectorAll('nav#side a'));
|
|
65
|
+
let items = [].slice.call(links).map(link => {
|
|
66
|
+
let anchor = document.querySelector(link.getAttribute('href'));
|
|
67
|
+
return [link, anchor];
|
|
68
|
+
});
|
|
69
|
+
if (!items.length)
|
|
70
|
+
return;
|
|
71
|
+
|
|
72
|
+
let pending_request = false;
|
|
73
|
+
let active_idx = null;
|
|
74
|
+
function highlight(idx) {
|
|
75
|
+
if (pending_request)
|
|
76
|
+
return;
|
|
77
|
+
|
|
78
|
+
window.requestAnimationFrame(() => {
|
|
79
|
+
pending_request = false;
|
|
80
|
+
|
|
81
|
+
if (idx !== active_idx) {
|
|
82
|
+
if (active_idx !== null)
|
|
83
|
+
items[active_idx][0].classList.remove('active');
|
|
84
|
+
items[idx][0].classList.add('active');
|
|
85
|
+
active_idx = idx;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
pending_request = true;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Event handlers, for clicks
|
|
92
|
+
let ignore_scroll = false;
|
|
93
|
+
function highlightOnClick(idx) {
|
|
94
|
+
highlight(idx);
|
|
95
|
+
setTimeout(() => { ignore_scroll = false; }, 50);
|
|
96
|
+
ignore_scroll = true;
|
|
97
|
+
}
|
|
98
|
+
function highlightOnScroll() {
|
|
99
|
+
if (ignore_scroll)
|
|
100
|
+
return;
|
|
101
|
+
|
|
102
|
+
let idx;
|
|
103
|
+
for (idx = 0; idx < items.length; idx++) {
|
|
104
|
+
let rect = items[idx][1].getBoundingClientRect();
|
|
105
|
+
if (rect.top >= 50)
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
if (idx)
|
|
109
|
+
idx--;
|
|
110
|
+
|
|
111
|
+
highlight(idx);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// The scroll handler is not enough because it does not work for
|
|
115
|
+
// small sections at the end of the page.
|
|
116
|
+
for (let i = 0; i < items.length; i++) {
|
|
117
|
+
items[i][0].addEventListener('click', highlightOnClick.bind(this, i));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Enable only on big screens, when the side menu is fixed
|
|
121
|
+
let mql = window.matchMedia('(min-width: 801px)');
|
|
122
|
+
if (mql.matches) {
|
|
123
|
+
window.addEventListener('scroll', highlightOnScroll);
|
|
124
|
+
highlightOnScroll();
|
|
125
|
+
}
|
|
126
|
+
mql.addListener(mql => {
|
|
127
|
+
if (mql.matches) {
|
|
128
|
+
window.addEventListener('scroll', highlightOnScroll);
|
|
129
|
+
highlightOnScroll();
|
|
130
|
+
} else {
|
|
131
|
+
window.removeEventListener('scroll', highlightOnScroll);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function initScroll() {
|
|
137
|
+
window.addEventListener('scroll', adjust_top);
|
|
138
|
+
adjust_top();
|
|
139
|
+
|
|
140
|
+
function adjust_top() {
|
|
141
|
+
let top = document.querySelector('nav#top');
|
|
142
|
+
top.classList.toggle('border', window.pageYOffset >= 20);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function findParent(el, func) {
|
|
147
|
+
while (el && !func(el))
|
|
148
|
+
el = el.parentElement;
|
|
149
|
+
return el;
|
|
150
|
+
}
|