koffi 1.3.2 → 1.3.5
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/CMakeLists.txt +27 -3
- package/ChangeLog.md +46 -14
- package/build/qemu/1.3.5/koffi_darwin_arm64.tar.gz +0 -0
- package/build/qemu/1.3.5/koffi_darwin_x64.tar.gz +0 -0
- package/build/qemu/1.3.5/koffi_freebsd_arm64.tar.gz +0 -0
- package/build/qemu/1.3.5/koffi_freebsd_ia32.tar.gz +0 -0
- package/build/qemu/1.3.5/koffi_freebsd_x64.tar.gz +0 -0
- package/build/qemu/1.3.5/koffi_linux_arm32hf.tar.gz +0 -0
- package/build/qemu/1.3.5/koffi_linux_arm64.tar.gz +0 -0
- package/build/qemu/1.3.5/koffi_linux_ia32.tar.gz +0 -0
- package/build/qemu/1.3.5/koffi_linux_riscv64hf64.tar.gz +0 -0
- package/build/qemu/1.3.5/koffi_linux_x64.tar.gz +0 -0
- package/build/qemu/1.3.5/koffi_openbsd_ia32.tar.gz +0 -0
- package/build/qemu/1.3.5/koffi_openbsd_x64.tar.gz +0 -0
- package/build/qemu/1.3.5/koffi_win32_arm64.tar.gz +0 -0
- package/build/qemu/1.3.5/koffi_win32_ia32.tar.gz +0 -0
- package/build/qemu/1.3.5/koffi_win32_x64.tar.gz +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_windows_20220623.png +0 -0
- package/doc/_static/perf_windows_20220623_2.png +0 -0
- package/doc/benchmarks.md +40 -36
- package/doc/benchmarks.xlsx +0 -0
- package/doc/changes.md +2 -0
- package/doc/conf.py +10 -3
- package/doc/contribute.md +16 -0
- package/doc/dist/doctrees/benchmarks.doctree +0 -0
- package/doc/dist/doctrees/changes.doctree +0 -0
- package/doc/dist/doctrees/contribute.doctree +0 -0
- package/doc/dist/doctrees/environment.pickle +0 -0
- package/doc/dist/doctrees/functions.doctree +0 -0
- package/doc/dist/doctrees/index.doctree +0 -0
- package/doc/dist/doctrees/memory.doctree +0 -0
- package/doc/dist/doctrees/platforms.doctree +0 -0
- package/doc/dist/doctrees/start.doctree +0 -0
- package/doc/dist/doctrees/types.doctree +0 -0
- package/doc/dist/html/_sources/benchmarks.md.txt +40 -36
- package/doc/dist/html/_sources/changes.md.txt +2 -0
- package/doc/dist/html/_sources/contribute.md.txt +16 -0
- package/doc/dist/html/_sources/functions.md.txt +18 -14
- package/doc/dist/html/_sources/index.rst.txt +2 -1
- package/doc/dist/html/_sources/memory.md.txt +6 -3
- package/doc/dist/html/_sources/platforms.md.txt +2 -0
- package/doc/dist/html/_sources/start.md.txt +3 -3
- package/doc/dist/html/_sources/types.md.txt +10 -8
- package/doc/dist/html/_static/perf_linux_20220623.png +0 -0
- package/doc/dist/html/_static/perf_linux_20220623_2.png +0 -0
- package/doc/dist/html/_static/perf_windows_20220623.png +0 -0
- package/doc/dist/html/_static/perf_windows_20220623_2.png +0 -0
- package/doc/dist/html/_static/pygments.css +54 -54
- package/doc/dist/html/benchmarks.html +52 -20
- package/doc/dist/html/changes.html +391 -0
- package/doc/dist/html/contribute.html +24 -2
- package/doc/dist/html/functions.html +83 -84
- package/doc/dist/html/genindex.html +1 -0
- package/doc/dist/html/index.html +18 -3
- package/doc/dist/html/memory.html +11 -5
- package/doc/dist/html/objects.inv +0 -0
- package/doc/dist/html/platforms.html +3 -1
- package/doc/dist/html/search.html +1 -0
- package/doc/dist/html/searchindex.js +1 -1
- package/doc/dist/html/start.html +48 -47
- package/doc/dist/html/types.html +161 -159
- package/doc/functions.md +18 -14
- package/doc/index.rst +2 -1
- package/doc/memory.md +6 -3
- package/doc/platforms.md +2 -0
- package/doc/start.md +3 -3
- package/doc/types.md +10 -8
- package/package.json +2 -2
- package/qemu/qemu.js +1 -0
- package/qemu/registry/machines.json +6 -11
- package/src/abi_arm32.cc +9 -9
- package/src/abi_arm64.cc +9 -9
- package/src/abi_riscv64.cc +9 -9
- package/src/abi_x64_sysv.cc +9 -9
- package/src/abi_x64_win.cc +9 -9
- package/src/abi_x86.cc +9 -9
- package/src/call.cc +8 -7
- package/src/call.hh +6 -0
- package/src/ffi.cc +73 -22
- package/src/ffi.hh +11 -4
- package/src/parser.cc +1 -1
- package/src/util.hh +21 -1
- package/test/async.js +1 -1
- package/test/misc.c +20 -0
- package/test/sync.js +13 -3
- package/vendor/libcc/libcc.hh +1 -1
- package/build/qemu/1.3.2/koffi_darwin_arm64.tar.gz +0 -0
- package/build/qemu/1.3.2/koffi_darwin_x64.tar.gz +0 -0
- package/build/qemu/1.3.2/koffi_freebsd_arm64.tar.gz +0 -0
- package/build/qemu/1.3.2/koffi_freebsd_ia32.tar.gz +0 -0
- package/build/qemu/1.3.2/koffi_freebsd_x64.tar.gz +0 -0
- package/build/qemu/1.3.2/koffi_linux_arm32hf.tar.gz +0 -0
- package/build/qemu/1.3.2/koffi_linux_arm64.tar.gz +0 -0
- package/build/qemu/1.3.2/koffi_linux_ia32.tar.gz +0 -0
- package/build/qemu/1.3.2/koffi_linux_riscv64hf64.tar.gz +0 -0
- package/build/qemu/1.3.2/koffi_linux_x64.tar.gz +0 -0
- package/build/qemu/1.3.2/koffi_openbsd_ia32.tar.gz +0 -0
- package/build/qemu/1.3.2/koffi_openbsd_x64.tar.gz +0 -0
- package/build/qemu/1.3.2/koffi_win32_arm64.tar.gz +0 -0
- package/build/qemu/1.3.2/koffi_win32_ia32.tar.gz +0 -0
- package/build/qemu/1.3.2/koffi_win32_x64.tar.gz +0 -0
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
## Function definitions
|
|
4
4
|
|
|
5
|
-
To declare functions, start by loading the shared library with `koffi.load()`.
|
|
5
|
+
To declare functions, start by loading the shared library with `koffi.load(filename)`.
|
|
6
6
|
|
|
7
7
|
```js
|
|
8
8
|
const koffi = require('koffi');
|
|
9
9
|
const lib = koffi.load('/path/to/shared/library'); // File extension depends on platforms: .so, .dll, .dylib, etc.
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
You can use the returned object to load C functions from the library.
|
|
12
|
+
You can use the returned object to load C functions from the library. To do so, you can use two syntaxes:
|
|
13
13
|
|
|
14
|
-
-
|
|
14
|
+
- The classic syntax, inspired by node-ffi
|
|
15
15
|
- C-like prototypes
|
|
16
16
|
|
|
17
17
|
### Classic syntax
|
|
@@ -27,18 +27,20 @@ Koffi automatically tries mangled names for non-standard x86 calling conventions
|
|
|
27
27
|
|
|
28
28
|
### C-like prototypes
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
If you prefer, you can declare functions using simple C-like prototype strings, as shown below:
|
|
31
31
|
|
|
32
32
|
```js
|
|
33
33
|
const printf = lib.func('int printf(const char *fmt, ...)');
|
|
34
34
|
const atoi = lib.func('int atoi(string)'); // The parameter name is not used by Koffi, and optional
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
+
You can use `()` or `(void)` for functions that take no argument.
|
|
38
|
+
|
|
37
39
|
## Synchronous calls
|
|
38
40
|
|
|
39
41
|
By default, calling a C function happens synchronously.
|
|
40
42
|
|
|
41
|
-
Most architectures only support one procedure call standard per process. The 32-bit x86 platform is an exception to this, and Koffi
|
|
43
|
+
Most architectures only support one procedure call standard per process. The 32-bit x86 platform is an exception to this, and Koffi supports several x86 conventions:
|
|
42
44
|
|
|
43
45
|
Convention | Classic form | Prototype form | Description
|
|
44
46
|
------------- | ----------------------------- | -------------- | -------------------------------------------------------------------
|
|
@@ -49,7 +51,7 @@ Most architectures only support one procedure call standard per process. The 32-
|
|
|
49
51
|
|
|
50
52
|
You can safely use these on non-x86 platforms, they are simply ignored.
|
|
51
53
|
|
|
52
|
-
Below you can find a small example showing how to use a non-default calling convention:
|
|
54
|
+
Below you can find a small example showing how to use a non-default calling convention, with the two syntaxes:
|
|
53
55
|
|
|
54
56
|
```js
|
|
55
57
|
const koffi = require('koffi');
|
|
@@ -75,9 +77,13 @@ atoi.async('1257', (err, res) => {
|
|
|
75
77
|
})
|
|
76
78
|
console.log('Hello World!');
|
|
77
79
|
|
|
78
|
-
// This program will print
|
|
80
|
+
// This program will print:
|
|
81
|
+
// Hello World!
|
|
82
|
+
// Result: 1257
|
|
79
83
|
```
|
|
80
84
|
|
|
85
|
+
These calls are executed by worker threads. It is **your responsibility to deal with data sharing issues** in the native code that may be caused by multi-threading.
|
|
86
|
+
|
|
81
87
|
You can easily convert this callback-style async function to a promise-based version with `util.promisify()` from the Node.js standard library.
|
|
82
88
|
|
|
83
89
|
Variadic functions cannot be called asynchronously.
|
|
@@ -101,7 +107,7 @@ On x86 platforms, only the Cdecl convention can be used for variadic functions.
|
|
|
101
107
|
|
|
102
108
|
By default, Koffi will only forward arguments from Javascript to C. However, many C functions use pointer arguments for output values, or input/output values.
|
|
103
109
|
|
|
104
|
-
For
|
|
110
|
+
For simplicity, and because Javascript only has value semantics for primitive types, Koffi can marshal out (or in/out) two types of parameters:
|
|
105
111
|
|
|
106
112
|
- [Structs](types.md#struct-types) (to/from JS objects)
|
|
107
113
|
- [Opaque handles](types.md#opaque-handles)
|
|
@@ -166,8 +172,6 @@ sqlite3_close_v2(db);
|
|
|
166
172
|
|
|
167
173
|
## Javascript callbacks
|
|
168
174
|
|
|
169
|
-
### Using callbacks
|
|
170
|
-
|
|
171
175
|
In order to pass a JS function to a C function expecting a callback, you must first create a callback type with the expected return type and parameters. The syntax is similar to the one used to load functions from a shared library.
|
|
172
176
|
|
|
173
177
|
```js
|
|
@@ -180,7 +184,7 @@ const ExampleCallback = koffi.callback('ExampleCallback', 'void', ['int']);
|
|
|
180
184
|
const AddDoubleFloat = koffi.callback('double AddDoubleFloat(double d, float f)');
|
|
181
185
|
```
|
|
182
186
|
|
|
183
|
-
Once your callback type is declared, you can use
|
|
187
|
+
Once your callback type is declared, you can use it in struct definitions, or as function parameter and/or return type.
|
|
184
188
|
|
|
185
189
|
Here is a small example with the C part and the JS part.
|
|
186
190
|
|
|
@@ -217,8 +221,8 @@ console.log(ret);
|
|
|
217
221
|
|
|
218
222
|
On x86 platforms, only Cdecl and Stdcall callbacks are supported.
|
|
219
223
|
|
|
220
|
-
|
|
224
|
+
## Thread safety
|
|
221
225
|
|
|
222
|
-
|
|
226
|
+
Asynchronous functions run on worker threads. You need to deal with thread safety issues if you share data between threads.
|
|
223
227
|
|
|
224
|
-
|
|
228
|
+
Callbacks must be called from the main thread, or more precisely from the same thread as the V8 intepreter. Calling a callback from another thread is undefined behavior, and will likely lead to a crash or a big mess. You've been warned!
|
|
@@ -6,7 +6,7 @@ Overview
|
|
|
6
6
|
|
|
7
7
|
Koffi is a **fast and easy-to-use C FFI module for Node.js**, featuring:
|
|
8
8
|
|
|
9
|
-
* Low-overhead and fast performance (see :ref:`Benchmarks
|
|
9
|
+
* Low-overhead and fast performance (see :ref:`benchmarks<Benchmarks>`)
|
|
10
10
|
* Support for primitive and aggregate data types (structs and fixed-size arrays), both by reference (pointer) and by value
|
|
11
11
|
* Javascript functions can be used as C callbacks (since 1.2.0)
|
|
12
12
|
* Well-tested code base for :ref:`popular OS/architecture combinations<Supported platforms>`
|
|
@@ -24,6 +24,7 @@ Table of contents
|
|
|
24
24
|
memory
|
|
25
25
|
benchmarks
|
|
26
26
|
contribute
|
|
27
|
+
changes
|
|
27
28
|
|
|
28
29
|
License
|
|
29
30
|
-------
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
For synchronous/normal calls, Koffi uses two preallocated memory blocks:
|
|
6
6
|
|
|
7
|
-
- One to construct
|
|
7
|
+
- One to construct the C stack and assign registers, subsequently used by the platform-specific assembly code (1 MiB by default)
|
|
8
8
|
- One to allocate strings and big objects/structs (2 MiB by default)
|
|
9
9
|
|
|
10
10
|
Unless very big strings or objects (at least more than one page of memory) are used, no extra allocation ever happens during calls or callbacks.
|
|
@@ -18,12 +18,15 @@ console.log(config);
|
|
|
18
18
|
|
|
19
19
|
The same is true for asynchronous calls. When an asynchronous call is made, Koffi will allocate new blocks unless there is an unused (resident) set of blocks still available. Once the asynchronous call is finished, these blocks are freed if there are more than `resident_async_pools` sets of blocks left around.
|
|
20
20
|
|
|
21
|
+
There cannot be more than `max_async_calls` running at the same time.
|
|
22
|
+
|
|
21
23
|
## Default settings
|
|
22
24
|
|
|
23
25
|
Setting | Default | Description
|
|
24
26
|
-------------------- | ------- | -----------------------------------------------
|
|
25
27
|
sync_stack_size | 1 MiB | Stack size for synchronous calls
|
|
26
28
|
sync_heap_size | 2 MiB | Heap size for synchronous calls
|
|
27
|
-
async_stack_size |
|
|
28
|
-
async_heap_size |
|
|
29
|
+
async_stack_size | 256 kiB | Stack size for asynchronous calls
|
|
30
|
+
async_heap_size | 512 kiB | Heap size for asynchronous calls
|
|
29
31
|
resident_async_pools | 2 | Number of resident pools for asynchronous calls
|
|
32
|
+
max_async_calls | 64 | Maximum number of ongoing asynchronous calls
|
|
@@ -12,6 +12,8 @@ RISC-V 64 [^3] | ⬜️ *N/A* | ✅ Yes | ⬜️ *N/A* | 🟨 Probab
|
|
|
12
12
|
|
|
13
13
|
For all fully supported platforms (green check marks), a prebuilt binary is included in the NPM package which means you can install Koffi without a C++ compiler.
|
|
14
14
|
|
|
15
|
+
Node 12 or later is required, earlier versions are not supported. Use [NVM](https://github.com/nvm-sh/nvm) to install recent Node versions on older Linux distributions.
|
|
16
|
+
|
|
15
17
|
[^1]: The following call conventions are supported for forward calls: cdecl, stdcall, MS fastcall, thiscall. Only cdecl and stdcall can be used for C to JS callbacks.
|
|
16
18
|
[^2]: The prebuilt binary uses the hard float ABI and expects a VFP coprocessor. Build from source to use Koffi with a different ABI (softfp, soft).
|
|
17
19
|
[^3]: The prebuilt binary uses the LP64D (double-precision float) ABI. The LP64 ABI is supported in theory if you build Koffi from source (untested), the LP64F ABI is not supported.
|
|
@@ -19,7 +19,7 @@ Below you can find three examples:
|
|
|
19
19
|
|
|
20
20
|
## Small Linux example
|
|
21
21
|
|
|
22
|
-
This is a small example for Linux systems, which uses `gettimeofday()` and `printf()` to print the current time
|
|
22
|
+
This is a small example for Linux systems, which uses `gettimeofday()`, `localtime_r()` and `printf()` to print the current time.
|
|
23
23
|
|
|
24
24
|
It illustrates the use of output parameters.
|
|
25
25
|
|
|
@@ -69,7 +69,7 @@ printf('Local time: %02d:%02d:%02d\n', 'int', now.tm_hour, 'int', now.tm_min, 'i
|
|
|
69
69
|
|
|
70
70
|
## Small Windows example
|
|
71
71
|
|
|
72
|
-
This is a small example targeting the Win32 API, using `MessageBox()` to show a Hello message to the user.
|
|
72
|
+
This is a small example targeting the Win32 API, using `MessageBox()` to show a *Hello World!* message to the user.
|
|
73
73
|
|
|
74
74
|
It illustrates the use of the x86 stdcall calling convention.
|
|
75
75
|
|
|
@@ -85,5 +85,5 @@ const MB_ICONINFORMATION = 0x40;
|
|
|
85
85
|
// Find functions
|
|
86
86
|
const MessageBoxA = lib.stdcall('MessageBoxA', 'int', ['void *', 'string', 'string', 'uint']);
|
|
87
87
|
|
|
88
|
-
MessageBoxA(null, 'Hello', '
|
|
88
|
+
MessageBoxA(null, 'Hello World!', 'Koffi', MB_ICONINFORMATION);
|
|
89
89
|
```
|
|
@@ -42,6 +42,8 @@ Number (float) | float64 | 8 | |
|
|
|
42
42
|
Number (float) | float | 4 | |
|
|
43
43
|
Number (float) | double | 8 | |
|
|
44
44
|
|
|
45
|
+
Koffi also accepts BigInt values when converting from JS to C integers. If the value exceeds the range of the C type, Koffi will convert the number to an undefined value. In the reverse direction, BigInt values are automatically used when needed for big 64-bit integers.
|
|
46
|
+
|
|
45
47
|
Koffi defines a few more types that can change size depending on the OS and the architecture:
|
|
46
48
|
|
|
47
49
|
JS type | C type | Signedness | Note
|
|
@@ -95,7 +97,7 @@ const A = koffi.struct('A', {
|
|
|
95
97
|
|
|
96
98
|
Koffi follows the C and ABI rules regarding struct alignment and padding.
|
|
97
99
|
|
|
98
|
-
Once a struct is declared, you can use it by name (with a string, like you can do for primitive types) or
|
|
100
|
+
Once a struct is declared, you can use it by name (with a string, like you can do for primitive types) or through the value returned by the call to `koffi.struct()`. Only the latter is possible when declaring an anonymous struct.
|
|
99
101
|
|
|
100
102
|
```js
|
|
101
103
|
// The following two function declarations are equivalent, and declare a function taking an A value and returning A
|
|
@@ -107,9 +109,9 @@ const Function2 = lib.func('Function', A, [A]);
|
|
|
107
109
|
|
|
108
110
|
In C, pointer arguments are used for differenty purposes. It is important to distinguish these use cases because Koffi provides different ways to deal with each of them:
|
|
109
111
|
|
|
110
|
-
- **Struct pointers**: Use of struct pointers by C libraries fall in two cases: avoid (potentially) expensive copies, and to let the function change struct contents (output or input/output
|
|
111
|
-
- **Opaque handles**: the library does not expose the contents of the structs, and only provides you with a pointer to it (e.g. `
|
|
112
|
-
- **Arrays**: in C, you dynamically-sized arrays are usually passed to functions with pointers, either NULL-terminated or with an additional length argument.
|
|
112
|
+
- **Struct pointers**: Use of struct pointers by C libraries fall in two cases: avoid (potentially) expensive copies, and to let the function change struct contents (output or input/output arguments).
|
|
113
|
+
- **Opaque handles**: the library does not expose the contents of the structs, and only provides you with a pointer to it (e.g. `FILE *`). Only the functions provided by the library can do something with this pointer, in Koffi we call this a handle. This is usually done for ABI-stability reason, and to prevent library users from messing directly with library internals.
|
|
114
|
+
- **Arrays**: in C, you dynamically-sized arrays are usually passed to functions with pointers, either NULL-terminated (or any other sentinel value) or with an additional length argument.
|
|
113
115
|
- **Pointers to primitive types**: This is more rare, and generally used for output or input/output arguments. The Win32 API has a lot of these.
|
|
114
116
|
|
|
115
117
|
### Struct pointers
|
|
@@ -351,7 +353,7 @@ const ComputeTotalLength = lib.func('int64_t ComputeTotalLength(const char **str
|
|
|
351
353
|
let strings = ['Get', 'Total', 'Length', null];
|
|
352
354
|
let total = ComputeTotalLength(strings);
|
|
353
355
|
|
|
354
|
-
console.log(total); // Prints
|
|
356
|
+
console.log(total); // Prints 14
|
|
355
357
|
```
|
|
356
358
|
|
|
357
359
|
By default, just like for objects, array arguments are copied from JS to C but not vice-versa. You can however change the direction as documented in the section on [output parameters](functions.md#output-parameters).
|
|
@@ -423,7 +425,7 @@ console.log(filenames);
|
|
|
423
425
|
|
|
424
426
|
In javascript, it is not possible to pass a primitive value by reference to another function. This means that you cannot call a function and expect it to modify the value of one of its number or string parameter.
|
|
425
427
|
|
|
426
|
-
However, arrays and objects (among others) are reference type values. Assigning an array or an object from one variable to another does not invole any copy. Instead, as the following example illustrates, the new variable references the same
|
|
428
|
+
However, arrays and objects (among others) are reference type values. Assigning an array or an object from one variable to another does not invole any copy. Instead, as the following example illustrates, the new variable references the same array as the first:
|
|
427
429
|
|
|
428
430
|
```js
|
|
429
431
|
let list1 = [1, 2];
|
|
@@ -436,7 +438,7 @@ console.log(list1); // Prints [1, 42]
|
|
|
436
438
|
|
|
437
439
|
All of this means that C functions that are expected to modify their primitive output values (such as an `int *` parameter) cannot be used directly. However, thanks to Koffi's transparent array support, you can use Javascript arrays to approximate reference semantics with single-element arrays.
|
|
438
440
|
|
|
439
|
-
Below, you can find an example of an addition function where the result is stored in an `int *` output parameter and how to use this function from Koffi.
|
|
441
|
+
Below, you can find an example of an addition function where the result is stored in an `int *` input/output parameter and how to use this function from Koffi.
|
|
440
442
|
|
|
441
443
|
```c
|
|
442
444
|
void AddInt(int *dest, int add)
|
|
@@ -445,7 +447,7 @@ void AddInt(int *dest, int add)
|
|
|
445
447
|
}
|
|
446
448
|
```
|
|
447
449
|
|
|
448
|
-
You can simply pass a single-element array as the
|
|
450
|
+
You can simply pass a single-element array as the first argument:
|
|
449
451
|
|
|
450
452
|
```js
|
|
451
453
|
const AddInt = lib.func('void AddInt(_Inout_ int *dest, int add)');
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -88,21 +88,21 @@ body[data-theme="dark"] .highlight td.linenos .special { color: #000000; backgro
|
|
|
88
88
|
body[data-theme="dark"] .highlight span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
|
|
89
89
|
body[data-theme="dark"] .highlight .hll { background-color: #404040 }
|
|
90
90
|
body[data-theme="dark"] .highlight { background: #202020; color: #d0d0d0 }
|
|
91
|
-
body[data-theme="dark"] .highlight .c { color: #
|
|
91
|
+
body[data-theme="dark"] .highlight .c { color: #ababab; font-style: italic } /* Comment */
|
|
92
92
|
body[data-theme="dark"] .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
|
|
93
93
|
body[data-theme="dark"] .highlight .esc { color: #d0d0d0 } /* Escape */
|
|
94
94
|
body[data-theme="dark"] .highlight .g { color: #d0d0d0 } /* Generic */
|
|
95
|
-
body[data-theme="dark"] .highlight .k { color: #
|
|
95
|
+
body[data-theme="dark"] .highlight .k { color: #6ebf26; font-weight: bold } /* Keyword */
|
|
96
96
|
body[data-theme="dark"] .highlight .l { color: #d0d0d0 } /* Literal */
|
|
97
97
|
body[data-theme="dark"] .highlight .n { color: #d0d0d0 } /* Name */
|
|
98
98
|
body[data-theme="dark"] .highlight .o { color: #d0d0d0 } /* Operator */
|
|
99
99
|
body[data-theme="dark"] .highlight .x { color: #d0d0d0 } /* Other */
|
|
100
100
|
body[data-theme="dark"] .highlight .p { color: #d0d0d0 } /* Punctuation */
|
|
101
|
-
body[data-theme="dark"] .highlight .ch { color: #
|
|
102
|
-
body[data-theme="dark"] .highlight .cm { color: #
|
|
101
|
+
body[data-theme="dark"] .highlight .ch { color: #ababab; font-style: italic } /* Comment.Hashbang */
|
|
102
|
+
body[data-theme="dark"] .highlight .cm { color: #ababab; font-style: italic } /* Comment.Multiline */
|
|
103
103
|
body[data-theme="dark"] .highlight .cp { color: #cd2828; font-weight: bold } /* Comment.Preproc */
|
|
104
|
-
body[data-theme="dark"] .highlight .cpf { color: #
|
|
105
|
-
body[data-theme="dark"] .highlight .c1 { color: #
|
|
104
|
+
body[data-theme="dark"] .highlight .cpf { color: #ababab; font-style: italic } /* Comment.PreprocFile */
|
|
105
|
+
body[data-theme="dark"] .highlight .c1 { color: #ababab; font-style: italic } /* Comment.Single */
|
|
106
106
|
body[data-theme="dark"] .highlight .cs { color: #e50808; font-weight: bold; background-color: #520000 } /* Comment.Special */
|
|
107
107
|
body[data-theme="dark"] .highlight .gd { color: #d22323 } /* Generic.Deleted */
|
|
108
108
|
body[data-theme="dark"] .highlight .ge { color: #d0d0d0; font-style: italic } /* Generic.Emph */
|
|
@@ -114,36 +114,36 @@ body[data-theme="dark"] .highlight .gp { color: #aaaaaa } /* Generic.Prompt */
|
|
|
114
114
|
body[data-theme="dark"] .highlight .gs { color: #d0d0d0; font-weight: bold } /* Generic.Strong */
|
|
115
115
|
body[data-theme="dark"] .highlight .gu { color: #ffffff; text-decoration: underline } /* Generic.Subheading */
|
|
116
116
|
body[data-theme="dark"] .highlight .gt { color: #d22323 } /* Generic.Traceback */
|
|
117
|
-
body[data-theme="dark"] .highlight .kc { color: #
|
|
118
|
-
body[data-theme="dark"] .highlight .kd { color: #
|
|
119
|
-
body[data-theme="dark"] .highlight .kn { color: #
|
|
120
|
-
body[data-theme="dark"] .highlight .kp { color: #
|
|
121
|
-
body[data-theme="dark"] .highlight .kr { color: #
|
|
122
|
-
body[data-theme="dark"] .highlight .kt { color: #
|
|
117
|
+
body[data-theme="dark"] .highlight .kc { color: #6ebf26; font-weight: bold } /* Keyword.Constant */
|
|
118
|
+
body[data-theme="dark"] .highlight .kd { color: #6ebf26; font-weight: bold } /* Keyword.Declaration */
|
|
119
|
+
body[data-theme="dark"] .highlight .kn { color: #6ebf26; font-weight: bold } /* Keyword.Namespace */
|
|
120
|
+
body[data-theme="dark"] .highlight .kp { color: #6ebf26 } /* Keyword.Pseudo */
|
|
121
|
+
body[data-theme="dark"] .highlight .kr { color: #6ebf26; font-weight: bold } /* Keyword.Reserved */
|
|
122
|
+
body[data-theme="dark"] .highlight .kt { color: #6ebf26; font-weight: bold } /* Keyword.Type */
|
|
123
123
|
body[data-theme="dark"] .highlight .ld { color: #d0d0d0 } /* Literal.Date */
|
|
124
|
-
body[data-theme="dark"] .highlight .m { color: #
|
|
124
|
+
body[data-theme="dark"] .highlight .m { color: #51b2fd } /* Literal.Number */
|
|
125
125
|
body[data-theme="dark"] .highlight .s { color: #ed9d13 } /* Literal.String */
|
|
126
126
|
body[data-theme="dark"] .highlight .na { color: #bbbbbb } /* Name.Attribute */
|
|
127
|
-
body[data-theme="dark"] .highlight .nb { color: #
|
|
128
|
-
body[data-theme="dark"] .highlight .nc { color: #
|
|
127
|
+
body[data-theme="dark"] .highlight .nb { color: #2fbccd } /* Name.Builtin */
|
|
128
|
+
body[data-theme="dark"] .highlight .nc { color: #71adff; text-decoration: underline } /* Name.Class */
|
|
129
129
|
body[data-theme="dark"] .highlight .no { color: #40ffff } /* Name.Constant */
|
|
130
130
|
body[data-theme="dark"] .highlight .nd { color: #ffa500 } /* Name.Decorator */
|
|
131
131
|
body[data-theme="dark"] .highlight .ni { color: #d0d0d0 } /* Name.Entity */
|
|
132
132
|
body[data-theme="dark"] .highlight .ne { color: #bbbbbb } /* Name.Exception */
|
|
133
|
-
body[data-theme="dark"] .highlight .nf { color: #
|
|
133
|
+
body[data-theme="dark"] .highlight .nf { color: #71adff } /* Name.Function */
|
|
134
134
|
body[data-theme="dark"] .highlight .nl { color: #d0d0d0 } /* Name.Label */
|
|
135
|
-
body[data-theme="dark"] .highlight .nn { color: #
|
|
135
|
+
body[data-theme="dark"] .highlight .nn { color: #71adff; text-decoration: underline } /* Name.Namespace */
|
|
136
136
|
body[data-theme="dark"] .highlight .nx { color: #d0d0d0 } /* Name.Other */
|
|
137
137
|
body[data-theme="dark"] .highlight .py { color: #d0d0d0 } /* Name.Property */
|
|
138
|
-
body[data-theme="dark"] .highlight .nt { color: #
|
|
138
|
+
body[data-theme="dark"] .highlight .nt { color: #6ebf26; font-weight: bold } /* Name.Tag */
|
|
139
139
|
body[data-theme="dark"] .highlight .nv { color: #40ffff } /* Name.Variable */
|
|
140
|
-
body[data-theme="dark"] .highlight .ow { color: #
|
|
140
|
+
body[data-theme="dark"] .highlight .ow { color: #6ebf26; font-weight: bold } /* Operator.Word */
|
|
141
141
|
body[data-theme="dark"] .highlight .w { color: #666666 } /* Text.Whitespace */
|
|
142
|
-
body[data-theme="dark"] .highlight .mb { color: #
|
|
143
|
-
body[data-theme="dark"] .highlight .mf { color: #
|
|
144
|
-
body[data-theme="dark"] .highlight .mh { color: #
|
|
145
|
-
body[data-theme="dark"] .highlight .mi { color: #
|
|
146
|
-
body[data-theme="dark"] .highlight .mo { color: #
|
|
142
|
+
body[data-theme="dark"] .highlight .mb { color: #51b2fd } /* Literal.Number.Bin */
|
|
143
|
+
body[data-theme="dark"] .highlight .mf { color: #51b2fd } /* Literal.Number.Float */
|
|
144
|
+
body[data-theme="dark"] .highlight .mh { color: #51b2fd } /* Literal.Number.Hex */
|
|
145
|
+
body[data-theme="dark"] .highlight .mi { color: #51b2fd } /* Literal.Number.Integer */
|
|
146
|
+
body[data-theme="dark"] .highlight .mo { color: #51b2fd } /* Literal.Number.Oct */
|
|
147
147
|
body[data-theme="dark"] .highlight .sa { color: #ed9d13 } /* Literal.String.Affix */
|
|
148
148
|
body[data-theme="dark"] .highlight .sb { color: #ed9d13 } /* Literal.String.Backtick */
|
|
149
149
|
body[data-theme="dark"] .highlight .sc { color: #ed9d13 } /* Literal.String.Char */
|
|
@@ -157,13 +157,13 @@ body[data-theme="dark"] .highlight .sx { color: #ffa500 } /* Literal.String.Othe
|
|
|
157
157
|
body[data-theme="dark"] .highlight .sr { color: #ed9d13 } /* Literal.String.Regex */
|
|
158
158
|
body[data-theme="dark"] .highlight .s1 { color: #ed9d13 } /* Literal.String.Single */
|
|
159
159
|
body[data-theme="dark"] .highlight .ss { color: #ed9d13 } /* Literal.String.Symbol */
|
|
160
|
-
body[data-theme="dark"] .highlight .bp { color: #
|
|
161
|
-
body[data-theme="dark"] .highlight .fm { color: #
|
|
160
|
+
body[data-theme="dark"] .highlight .bp { color: #2fbccd } /* Name.Builtin.Pseudo */
|
|
161
|
+
body[data-theme="dark"] .highlight .fm { color: #71adff } /* Name.Function.Magic */
|
|
162
162
|
body[data-theme="dark"] .highlight .vc { color: #40ffff } /* Name.Variable.Class */
|
|
163
163
|
body[data-theme="dark"] .highlight .vg { color: #40ffff } /* Name.Variable.Global */
|
|
164
164
|
body[data-theme="dark"] .highlight .vi { color: #40ffff } /* Name.Variable.Instance */
|
|
165
165
|
body[data-theme="dark"] .highlight .vm { color: #40ffff } /* Name.Variable.Magic */
|
|
166
|
-
body[data-theme="dark"] .highlight .il { color: #
|
|
166
|
+
body[data-theme="dark"] .highlight .il { color: #51b2fd } /* Literal.Number.Integer.Long */
|
|
167
167
|
@media (prefers-color-scheme: dark) {
|
|
168
168
|
body:not([data-theme="light"]) .highlight pre { line-height: 125%; }
|
|
169
169
|
body:not([data-theme="light"]) .highlight td.linenos .normal { color: #aaaaaa; background-color: transparent; padding-left: 5px; padding-right: 5px; }
|
|
@@ -172,21 +172,21 @@ body:not([data-theme="light"]) .highlight td.linenos .special { color: #000000;
|
|
|
172
172
|
body:not([data-theme="light"]) .highlight span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
|
|
173
173
|
body:not([data-theme="light"]) .highlight .hll { background-color: #404040 }
|
|
174
174
|
body:not([data-theme="light"]) .highlight { background: #202020; color: #d0d0d0 }
|
|
175
|
-
body:not([data-theme="light"]) .highlight .c { color: #
|
|
175
|
+
body:not([data-theme="light"]) .highlight .c { color: #ababab; font-style: italic } /* Comment */
|
|
176
176
|
body:not([data-theme="light"]) .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
|
|
177
177
|
body:not([data-theme="light"]) .highlight .esc { color: #d0d0d0 } /* Escape */
|
|
178
178
|
body:not([data-theme="light"]) .highlight .g { color: #d0d0d0 } /* Generic */
|
|
179
|
-
body:not([data-theme="light"]) .highlight .k { color: #
|
|
179
|
+
body:not([data-theme="light"]) .highlight .k { color: #6ebf26; font-weight: bold } /* Keyword */
|
|
180
180
|
body:not([data-theme="light"]) .highlight .l { color: #d0d0d0 } /* Literal */
|
|
181
181
|
body:not([data-theme="light"]) .highlight .n { color: #d0d0d0 } /* Name */
|
|
182
182
|
body:not([data-theme="light"]) .highlight .o { color: #d0d0d0 } /* Operator */
|
|
183
183
|
body:not([data-theme="light"]) .highlight .x { color: #d0d0d0 } /* Other */
|
|
184
184
|
body:not([data-theme="light"]) .highlight .p { color: #d0d0d0 } /* Punctuation */
|
|
185
|
-
body:not([data-theme="light"]) .highlight .ch { color: #
|
|
186
|
-
body:not([data-theme="light"]) .highlight .cm { color: #
|
|
185
|
+
body:not([data-theme="light"]) .highlight .ch { color: #ababab; font-style: italic } /* Comment.Hashbang */
|
|
186
|
+
body:not([data-theme="light"]) .highlight .cm { color: #ababab; font-style: italic } /* Comment.Multiline */
|
|
187
187
|
body:not([data-theme="light"]) .highlight .cp { color: #cd2828; font-weight: bold } /* Comment.Preproc */
|
|
188
|
-
body:not([data-theme="light"]) .highlight .cpf { color: #
|
|
189
|
-
body:not([data-theme="light"]) .highlight .c1 { color: #
|
|
188
|
+
body:not([data-theme="light"]) .highlight .cpf { color: #ababab; font-style: italic } /* Comment.PreprocFile */
|
|
189
|
+
body:not([data-theme="light"]) .highlight .c1 { color: #ababab; font-style: italic } /* Comment.Single */
|
|
190
190
|
body:not([data-theme="light"]) .highlight .cs { color: #e50808; font-weight: bold; background-color: #520000 } /* Comment.Special */
|
|
191
191
|
body:not([data-theme="light"]) .highlight .gd { color: #d22323 } /* Generic.Deleted */
|
|
192
192
|
body:not([data-theme="light"]) .highlight .ge { color: #d0d0d0; font-style: italic } /* Generic.Emph */
|
|
@@ -198,36 +198,36 @@ body:not([data-theme="light"]) .highlight .gp { color: #aaaaaa } /* Generic.Prom
|
|
|
198
198
|
body:not([data-theme="light"]) .highlight .gs { color: #d0d0d0; font-weight: bold } /* Generic.Strong */
|
|
199
199
|
body:not([data-theme="light"]) .highlight .gu { color: #ffffff; text-decoration: underline } /* Generic.Subheading */
|
|
200
200
|
body:not([data-theme="light"]) .highlight .gt { color: #d22323 } /* Generic.Traceback */
|
|
201
|
-
body:not([data-theme="light"]) .highlight .kc { color: #
|
|
202
|
-
body:not([data-theme="light"]) .highlight .kd { color: #
|
|
203
|
-
body:not([data-theme="light"]) .highlight .kn { color: #
|
|
204
|
-
body:not([data-theme="light"]) .highlight .kp { color: #
|
|
205
|
-
body:not([data-theme="light"]) .highlight .kr { color: #
|
|
206
|
-
body:not([data-theme="light"]) .highlight .kt { color: #
|
|
201
|
+
body:not([data-theme="light"]) .highlight .kc { color: #6ebf26; font-weight: bold } /* Keyword.Constant */
|
|
202
|
+
body:not([data-theme="light"]) .highlight .kd { color: #6ebf26; font-weight: bold } /* Keyword.Declaration */
|
|
203
|
+
body:not([data-theme="light"]) .highlight .kn { color: #6ebf26; font-weight: bold } /* Keyword.Namespace */
|
|
204
|
+
body:not([data-theme="light"]) .highlight .kp { color: #6ebf26 } /* Keyword.Pseudo */
|
|
205
|
+
body:not([data-theme="light"]) .highlight .kr { color: #6ebf26; font-weight: bold } /* Keyword.Reserved */
|
|
206
|
+
body:not([data-theme="light"]) .highlight .kt { color: #6ebf26; font-weight: bold } /* Keyword.Type */
|
|
207
207
|
body:not([data-theme="light"]) .highlight .ld { color: #d0d0d0 } /* Literal.Date */
|
|
208
|
-
body:not([data-theme="light"]) .highlight .m { color: #
|
|
208
|
+
body:not([data-theme="light"]) .highlight .m { color: #51b2fd } /* Literal.Number */
|
|
209
209
|
body:not([data-theme="light"]) .highlight .s { color: #ed9d13 } /* Literal.String */
|
|
210
210
|
body:not([data-theme="light"]) .highlight .na { color: #bbbbbb } /* Name.Attribute */
|
|
211
|
-
body:not([data-theme="light"]) .highlight .nb { color: #
|
|
212
|
-
body:not([data-theme="light"]) .highlight .nc { color: #
|
|
211
|
+
body:not([data-theme="light"]) .highlight .nb { color: #2fbccd } /* Name.Builtin */
|
|
212
|
+
body:not([data-theme="light"]) .highlight .nc { color: #71adff; text-decoration: underline } /* Name.Class */
|
|
213
213
|
body:not([data-theme="light"]) .highlight .no { color: #40ffff } /* Name.Constant */
|
|
214
214
|
body:not([data-theme="light"]) .highlight .nd { color: #ffa500 } /* Name.Decorator */
|
|
215
215
|
body:not([data-theme="light"]) .highlight .ni { color: #d0d0d0 } /* Name.Entity */
|
|
216
216
|
body:not([data-theme="light"]) .highlight .ne { color: #bbbbbb } /* Name.Exception */
|
|
217
|
-
body:not([data-theme="light"]) .highlight .nf { color: #
|
|
217
|
+
body:not([data-theme="light"]) .highlight .nf { color: #71adff } /* Name.Function */
|
|
218
218
|
body:not([data-theme="light"]) .highlight .nl { color: #d0d0d0 } /* Name.Label */
|
|
219
|
-
body:not([data-theme="light"]) .highlight .nn { color: #
|
|
219
|
+
body:not([data-theme="light"]) .highlight .nn { color: #71adff; text-decoration: underline } /* Name.Namespace */
|
|
220
220
|
body:not([data-theme="light"]) .highlight .nx { color: #d0d0d0 } /* Name.Other */
|
|
221
221
|
body:not([data-theme="light"]) .highlight .py { color: #d0d0d0 } /* Name.Property */
|
|
222
|
-
body:not([data-theme="light"]) .highlight .nt { color: #
|
|
222
|
+
body:not([data-theme="light"]) .highlight .nt { color: #6ebf26; font-weight: bold } /* Name.Tag */
|
|
223
223
|
body:not([data-theme="light"]) .highlight .nv { color: #40ffff } /* Name.Variable */
|
|
224
|
-
body:not([data-theme="light"]) .highlight .ow { color: #
|
|
224
|
+
body:not([data-theme="light"]) .highlight .ow { color: #6ebf26; font-weight: bold } /* Operator.Word */
|
|
225
225
|
body:not([data-theme="light"]) .highlight .w { color: #666666 } /* Text.Whitespace */
|
|
226
|
-
body:not([data-theme="light"]) .highlight .mb { color: #
|
|
227
|
-
body:not([data-theme="light"]) .highlight .mf { color: #
|
|
228
|
-
body:not([data-theme="light"]) .highlight .mh { color: #
|
|
229
|
-
body:not([data-theme="light"]) .highlight .mi { color: #
|
|
230
|
-
body:not([data-theme="light"]) .highlight .mo { color: #
|
|
226
|
+
body:not([data-theme="light"]) .highlight .mb { color: #51b2fd } /* Literal.Number.Bin */
|
|
227
|
+
body:not([data-theme="light"]) .highlight .mf { color: #51b2fd } /* Literal.Number.Float */
|
|
228
|
+
body:not([data-theme="light"]) .highlight .mh { color: #51b2fd } /* Literal.Number.Hex */
|
|
229
|
+
body:not([data-theme="light"]) .highlight .mi { color: #51b2fd } /* Literal.Number.Integer */
|
|
230
|
+
body:not([data-theme="light"]) .highlight .mo { color: #51b2fd } /* Literal.Number.Oct */
|
|
231
231
|
body:not([data-theme="light"]) .highlight .sa { color: #ed9d13 } /* Literal.String.Affix */
|
|
232
232
|
body:not([data-theme="light"]) .highlight .sb { color: #ed9d13 } /* Literal.String.Backtick */
|
|
233
233
|
body:not([data-theme="light"]) .highlight .sc { color: #ed9d13 } /* Literal.String.Char */
|
|
@@ -241,12 +241,12 @@ body:not([data-theme="light"]) .highlight .sx { color: #ffa500 } /* Literal.Stri
|
|
|
241
241
|
body:not([data-theme="light"]) .highlight .sr { color: #ed9d13 } /* Literal.String.Regex */
|
|
242
242
|
body:not([data-theme="light"]) .highlight .s1 { color: #ed9d13 } /* Literal.String.Single */
|
|
243
243
|
body:not([data-theme="light"]) .highlight .ss { color: #ed9d13 } /* Literal.String.Symbol */
|
|
244
|
-
body:not([data-theme="light"]) .highlight .bp { color: #
|
|
245
|
-
body:not([data-theme="light"]) .highlight .fm { color: #
|
|
244
|
+
body:not([data-theme="light"]) .highlight .bp { color: #2fbccd } /* Name.Builtin.Pseudo */
|
|
245
|
+
body:not([data-theme="light"]) .highlight .fm { color: #71adff } /* Name.Function.Magic */
|
|
246
246
|
body:not([data-theme="light"]) .highlight .vc { color: #40ffff } /* Name.Variable.Class */
|
|
247
247
|
body:not([data-theme="light"]) .highlight .vg { color: #40ffff } /* Name.Variable.Global */
|
|
248
248
|
body:not([data-theme="light"]) .highlight .vi { color: #40ffff } /* Name.Variable.Instance */
|
|
249
249
|
body:not([data-theme="light"]) .highlight .vm { color: #40ffff } /* Name.Variable.Magic */
|
|
250
|
-
body:not([data-theme="light"]) .highlight .il { color: #
|
|
250
|
+
body:not([data-theme="light"]) .highlight .il { color: #51b2fd } /* Literal.Number.Integer.Long */
|
|
251
251
|
}
|
|
252
252
|
}
|