@stdlib/math-base-napi-quinary 0.2.2 → 0.2.4
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/NOTICE +1 -1
- package/README.md +49 -47
- package/include/stdlib/math/base/napi/quinary/ddddd_d.h +81 -0
- package/include/stdlib/math/base/napi/quinary/fffff_f.h +81 -0
- package/include/stdlib/math/base/napi/quinary.h +3 -100
- package/manifest.json +37 -36
- package/package.json +2 -7
- package/src/addon.c +0 -1
- package/src/ddddd_d.c +125 -0
- package/src/{main.c → fffff_f.c} +2 -107
package/NOTICE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Copyright (c) 2016-
|
|
1
|
+
Copyright (c) 2016-2026 The Stdlib Authors.
|
package/README.md
CHANGED
|
@@ -127,6 +127,29 @@ console.log( headerDir );
|
|
|
127
127
|
#include "stdlib/math/base/napi/quinary.h"
|
|
128
128
|
```
|
|
129
129
|
|
|
130
|
+
<!-- NOTE: keep in alphabetical order according to the suffix XXXXX_X -->
|
|
131
|
+
|
|
132
|
+
#### STDLIB_MATH_BASE_NAPI_MODULE_DDDDD_D( fcn )
|
|
133
|
+
|
|
134
|
+
Macro for registering a Node-API module exporting an interface for invoking a quinary function accepting and returning double-precision floating-point numbers.
|
|
135
|
+
|
|
136
|
+
```c
|
|
137
|
+
static double add( const double x, const double y, const double z, const double w, const double u ) {
|
|
138
|
+
return x + y + z + w + u;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// ...
|
|
142
|
+
|
|
143
|
+
// Register a Node-API module:
|
|
144
|
+
STDLIB_MATH_BASE_NAPI_MODULE_DDDDD_D( add );
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
The macro expects the following arguments:
|
|
148
|
+
|
|
149
|
+
- **fcn**: `double (*fcn)( double, double, double, double, double )` quinary function.
|
|
150
|
+
|
|
151
|
+
When used, this macro should be used **instead of** `NAPI_MODULE`. The macro includes `NAPI_MODULE`, thus ensuring Node-API module registration.
|
|
152
|
+
|
|
130
153
|
#### stdlib_math_base_napi_ddddd_d( env, info, fcn )
|
|
131
154
|
|
|
132
155
|
Invokes a quinary function accepting and returning double-precision floating-point numbers.
|
|
@@ -166,6 +189,27 @@ The function accepts the following arguments:
|
|
|
166
189
|
void stdlib_math_base_napi_ddddd_d( napi_env env, napi_callback_info info, double (*fcn)( double, double, double, double, double ) );
|
|
167
190
|
```
|
|
168
191
|
|
|
192
|
+
#### STDLIB_MATH_BASE_NAPI_MODULE_FFFFF_F( fcn )
|
|
193
|
+
|
|
194
|
+
Macro for registering a Node-API module exporting an interface for invoking a quinary function accepting and returning single-precision floating-point numbers.
|
|
195
|
+
|
|
196
|
+
```c
|
|
197
|
+
static float addf( const float x, const float y, const float z, const float w, const float u ) {
|
|
198
|
+
return x + y + z + w + u;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// ...
|
|
202
|
+
|
|
203
|
+
// Register a Node-API module:
|
|
204
|
+
STDLIB_MATH_BASE_NAPI_MODULE_FFFFF_F( addf );
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
The macro expects the following arguments:
|
|
208
|
+
|
|
209
|
+
- **fcn**: `float (*fcn)( float, float, float, float, float )` quinary function.
|
|
210
|
+
|
|
211
|
+
When used, this macro should be used **instead of** `NAPI_MODULE`. The macro includes `NAPI_MODULE`, thus ensuring Node-API module registration.
|
|
212
|
+
|
|
169
213
|
#### stdlib_math_base_napi_fffff_f( env, info, fcn )
|
|
170
214
|
|
|
171
215
|
Invokes a quinary function accepting and returning single-precision floating-point numbers.
|
|
@@ -205,48 +249,6 @@ The function accepts the following arguments:
|
|
|
205
249
|
void stdlib_math_base_napi_fffff_f( napi_env env, napi_callback_info info, float (*fcn)( float, float, float, float, float ) );
|
|
206
250
|
```
|
|
207
251
|
|
|
208
|
-
#### STDLIB_MATH_BASE_NAPI_MODULE_DDDDD_D( fcn )
|
|
209
|
-
|
|
210
|
-
Macro for registering a Node-API module exporting an interface for invoking a quinary function accepting and returning double-precision floating-point numbers.
|
|
211
|
-
|
|
212
|
-
```c
|
|
213
|
-
static double add( const double x, const double y, const double z, const double w, const double u ) {
|
|
214
|
-
return x + y + z + w + u;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// ...
|
|
218
|
-
|
|
219
|
-
// Register a Node-API module:
|
|
220
|
-
STDLIB_MATH_BASE_NAPI_MODULE_DDDDD_D( add );
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
The macro expects the following arguments:
|
|
224
|
-
|
|
225
|
-
- **fcn**: `double (*fcn)( double, double, double, double, double )` quinary function.
|
|
226
|
-
|
|
227
|
-
When used, this macro should be used **instead of** `NAPI_MODULE`. The macro includes `NAPI_MODULE`, thus ensuring Node-API module registration.
|
|
228
|
-
|
|
229
|
-
#### STDLIB_MATH_BASE_NAPI_MODULE_FFFFF_F( fcn )
|
|
230
|
-
|
|
231
|
-
Macro for registering a Node-API module exporting an interface for invoking a quinary function accepting and returning single-precision floating-point numbers.
|
|
232
|
-
|
|
233
|
-
```c
|
|
234
|
-
static float addf( const float x, const float y, const float z, const float w, const float u ) {
|
|
235
|
-
return x + y + z + w + u;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
// ...
|
|
239
|
-
|
|
240
|
-
// Register a Node-API module:
|
|
241
|
-
STDLIB_MATH_BASE_NAPI_MODULE_FFFFF_F( addf );
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
The macro expects the following arguments:
|
|
245
|
-
|
|
246
|
-
- **fcn**: `float (*fcn)( float, float, float, float, float )` quinary function.
|
|
247
|
-
|
|
248
|
-
When used, this macro should be used **instead of** `NAPI_MODULE`. The macro includes `NAPI_MODULE`, thus ensuring Node-API module registration.
|
|
249
|
-
|
|
250
252
|
</section>
|
|
251
253
|
|
|
252
254
|
<!-- /.usage -->
|
|
@@ -323,7 +325,7 @@ See [LICENSE][stdlib-license].
|
|
|
323
325
|
|
|
324
326
|
## Copyright
|
|
325
327
|
|
|
326
|
-
Copyright © 2016-
|
|
328
|
+
Copyright © 2016-2026. The Stdlib [Authors][stdlib-authors].
|
|
327
329
|
|
|
328
330
|
</section>
|
|
329
331
|
|
|
@@ -336,8 +338,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
336
338
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/math-base-napi-quinary.svg
|
|
337
339
|
[npm-url]: https://npmjs.org/package/@stdlib/math-base-napi-quinary
|
|
338
340
|
|
|
339
|
-
[test-image]: https://github.com/stdlib-js/math-base-napi-quinary/actions/workflows/test.yml/badge.svg?branch=v0.2.
|
|
340
|
-
[test-url]: https://github.com/stdlib-js/math-base-napi-quinary/actions/workflows/test.yml?query=branch:v0.2.
|
|
341
|
+
[test-image]: https://github.com/stdlib-js/math-base-napi-quinary/actions/workflows/test.yml/badge.svg?branch=v0.2.4
|
|
342
|
+
[test-url]: https://github.com/stdlib-js/math-base-napi-quinary/actions/workflows/test.yml?query=branch:v0.2.4
|
|
341
343
|
|
|
342
344
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/math-base-napi-quinary/main.svg
|
|
343
345
|
[coverage-url]: https://codecov.io/github/stdlib-js/math-base-napi-quinary?branch=main
|
|
@@ -349,8 +351,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
349
351
|
|
|
350
352
|
-->
|
|
351
353
|
|
|
352
|
-
[chat-image]: https://img.shields.io/
|
|
353
|
-
[chat-url]: https://
|
|
354
|
+
[chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
|
|
355
|
+
[chat-url]: https://stdlib.zulipchat.com
|
|
354
356
|
|
|
355
357
|
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
356
358
|
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2025 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
#ifndef STDLIB_MATH_BASE_NAPI_QUINARY_DDDDD_D_H
|
|
20
|
+
#define STDLIB_MATH_BASE_NAPI_QUINARY_DDDDD_D_H
|
|
21
|
+
|
|
22
|
+
#include <node_api.h>
|
|
23
|
+
#include <assert.h>
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Macro for registering a Node-API module exporting an interface invoking a quinary function accepting and returning double-precision floating-point numbers.
|
|
27
|
+
*
|
|
28
|
+
* @param fcn quinary function
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* static double add( const double x, const double y, const double z, const double w, const double u ) {
|
|
32
|
+
* return x + y + z + w + u;
|
|
33
|
+
* }
|
|
34
|
+
*
|
|
35
|
+
* // ...
|
|
36
|
+
*
|
|
37
|
+
* // Register a Node-API module:
|
|
38
|
+
* STDLIB_MATH_BASE_NAPI_MODULE_DDDDD_D( add );
|
|
39
|
+
*/
|
|
40
|
+
#define STDLIB_MATH_BASE_NAPI_MODULE_DDDDD_D( fcn ) \
|
|
41
|
+
static napi_value stdlib_math_base_napi_ddddd_d_wrapper( \
|
|
42
|
+
napi_env env, \
|
|
43
|
+
napi_callback_info info \
|
|
44
|
+
) { \
|
|
45
|
+
return stdlib_math_base_napi_ddddd_d( env, info, fcn ); \
|
|
46
|
+
}; \
|
|
47
|
+
static napi_value stdlib_math_base_napi_ddddd_d_init( \
|
|
48
|
+
napi_env env, \
|
|
49
|
+
napi_value exports \
|
|
50
|
+
) { \
|
|
51
|
+
napi_value f; \
|
|
52
|
+
napi_status status = napi_create_function( \
|
|
53
|
+
env, \
|
|
54
|
+
"exports", \
|
|
55
|
+
NAPI_AUTO_LENGTH, \
|
|
56
|
+
stdlib_math_base_napi_ddddd_d_wrapper, \
|
|
57
|
+
NULL, \
|
|
58
|
+
&f \
|
|
59
|
+
); \
|
|
60
|
+
assert( status == napi_ok ); \
|
|
61
|
+
return f; \
|
|
62
|
+
}; \
|
|
63
|
+
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_ddddd_d_init )
|
|
64
|
+
|
|
65
|
+
/*
|
|
66
|
+
* If C++, prevent name mangling so that the compiler emits a quinary file having undecorated names, thus mirroring the behavior of a C compiler.
|
|
67
|
+
*/
|
|
68
|
+
#ifdef __cplusplus
|
|
69
|
+
extern "C" {
|
|
70
|
+
#endif
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Invokes a quinary function accepting and returning double-precision floating-point numbers.
|
|
74
|
+
*/
|
|
75
|
+
napi_value stdlib_math_base_napi_ddddd_d( napi_env env, napi_callback_info info, double (*fcn)( double, double, double, double, double ) );
|
|
76
|
+
|
|
77
|
+
#ifdef __cplusplus
|
|
78
|
+
}
|
|
79
|
+
#endif
|
|
80
|
+
|
|
81
|
+
#endif // !STDLIB_MATH_BASE_NAPI_QUINARY_DDDDD_D_H
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2025 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
#ifndef STDLIB_MATH_BASE_NAPI_QUINARY_FFFFF_F_H
|
|
20
|
+
#define STDLIB_MATH_BASE_NAPI_QUINARY_FFFFF_F_H
|
|
21
|
+
|
|
22
|
+
#include <node_api.h>
|
|
23
|
+
#include <assert.h>
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Macro for registering a Node-API module exporting an interface invoking a quinary function accepting and returning single-precision floating-point numbers.
|
|
27
|
+
*
|
|
28
|
+
* @param fcn quinary function
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* static float addf( const float x, const float y, const float z, const float w, const float u ) {
|
|
32
|
+
* return x + y + z + w + u;
|
|
33
|
+
* }
|
|
34
|
+
*
|
|
35
|
+
* // ...
|
|
36
|
+
*
|
|
37
|
+
* // Register a Node-API module:
|
|
38
|
+
* STDLIB_MATH_BASE_NAPI_MODULE_FFFFF_F( addf );
|
|
39
|
+
*/
|
|
40
|
+
#define STDLIB_MATH_BASE_NAPI_MODULE_FFFFF_F( fcn ) \
|
|
41
|
+
static napi_value stdlib_math_base_napi_fffff_f_wrapper( \
|
|
42
|
+
napi_env env, \
|
|
43
|
+
napi_callback_info info \
|
|
44
|
+
) { \
|
|
45
|
+
return stdlib_math_base_napi_fffff_f( env, info, fcn ); \
|
|
46
|
+
}; \
|
|
47
|
+
static napi_value stdlib_math_base_napi_fffff_f_init( \
|
|
48
|
+
napi_env env, \
|
|
49
|
+
napi_value exports \
|
|
50
|
+
) { \
|
|
51
|
+
napi_value f; \
|
|
52
|
+
napi_status status = napi_create_function( \
|
|
53
|
+
env, \
|
|
54
|
+
"exports", \
|
|
55
|
+
NAPI_AUTO_LENGTH, \
|
|
56
|
+
stdlib_math_base_napi_fffff_f_wrapper, \
|
|
57
|
+
NULL, \
|
|
58
|
+
&f \
|
|
59
|
+
); \
|
|
60
|
+
assert( status == napi_ok ); \
|
|
61
|
+
return f; \
|
|
62
|
+
}; \
|
|
63
|
+
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_fffff_f_init )
|
|
64
|
+
|
|
65
|
+
/*
|
|
66
|
+
* If C++, prevent name mangling so that the compiler emits a quinary file having undecorated names, thus mirroring the behavior of a C compiler.
|
|
67
|
+
*/
|
|
68
|
+
#ifdef __cplusplus
|
|
69
|
+
extern "C" {
|
|
70
|
+
#endif
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Invokes a quinary function accepting and returning single-precision floating-point numbers.
|
|
74
|
+
*/
|
|
75
|
+
napi_value stdlib_math_base_napi_fffff_f( napi_env env, napi_callback_info info, float (*fcn)( float, float, float, float, float ) );
|
|
76
|
+
|
|
77
|
+
#ifdef __cplusplus
|
|
78
|
+
}
|
|
79
|
+
#endif
|
|
80
|
+
|
|
81
|
+
#endif // !STDLIB_MATH_BASE_NAPI_QUINARY_FFFFF_F_H
|
|
@@ -22,105 +22,8 @@
|
|
|
22
22
|
#include <node_api.h>
|
|
23
23
|
#include <assert.h>
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
* @param fcn quinary function
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* static double add( const double x, const double y, const double z, const double w, const double u ) {
|
|
32
|
-
* return x + y + z + w + u;
|
|
33
|
-
* }
|
|
34
|
-
*
|
|
35
|
-
* // ...
|
|
36
|
-
*
|
|
37
|
-
* // Register a Node-API module:
|
|
38
|
-
* STDLIB_MATH_BASE_NAPI_MODULE_DDDDD_D( add );
|
|
39
|
-
*/
|
|
40
|
-
#define STDLIB_MATH_BASE_NAPI_MODULE_DDDDD_D( fcn ) \
|
|
41
|
-
static napi_value stdlib_math_base_napi_ddddd_d_wrapper( \
|
|
42
|
-
napi_env env, \
|
|
43
|
-
napi_callback_info info \
|
|
44
|
-
) { \
|
|
45
|
-
return stdlib_math_base_napi_ddddd_d( env, info, fcn ); \
|
|
46
|
-
}; \
|
|
47
|
-
static napi_value stdlib_math_base_napi_ddddd_d_init( \
|
|
48
|
-
napi_env env, \
|
|
49
|
-
napi_value exports \
|
|
50
|
-
) { \
|
|
51
|
-
napi_value fcn; \
|
|
52
|
-
napi_status status = napi_create_function( \
|
|
53
|
-
env, \
|
|
54
|
-
"exports", \
|
|
55
|
-
NAPI_AUTO_LENGTH, \
|
|
56
|
-
stdlib_math_base_napi_ddddd_d_wrapper, \
|
|
57
|
-
NULL, \
|
|
58
|
-
&fcn \
|
|
59
|
-
); \
|
|
60
|
-
assert( status == napi_ok ); \
|
|
61
|
-
return fcn; \
|
|
62
|
-
}; \
|
|
63
|
-
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_ddddd_d_init )
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Macro for registering a Node-API module exporting an interface invoking a quinary function accepting and returning single-precision floating-point numbers.
|
|
67
|
-
*
|
|
68
|
-
* @param fcn quinary function
|
|
69
|
-
*
|
|
70
|
-
* @example
|
|
71
|
-
* static float addf( const float x, const float y, const float z, const float w, const float u ) {
|
|
72
|
-
* return x + y + z + w + u;
|
|
73
|
-
* }
|
|
74
|
-
*
|
|
75
|
-
* // ...
|
|
76
|
-
*
|
|
77
|
-
* // Register a Node-API module:
|
|
78
|
-
* STDLIB_MATH_BASE_NAPI_MODULE_FFFFF_F( addf );
|
|
79
|
-
*/
|
|
80
|
-
#define STDLIB_MATH_BASE_NAPI_MODULE_FFFFF_F( fcn ) \
|
|
81
|
-
static napi_value stdlib_math_base_napi_fffff_f_wrapper( \
|
|
82
|
-
napi_env env, \
|
|
83
|
-
napi_callback_info info \
|
|
84
|
-
) { \
|
|
85
|
-
return stdlib_math_base_napi_fffff_f( env, info, fcn ); \
|
|
86
|
-
}; \
|
|
87
|
-
static napi_value stdlib_math_base_napi_fffff_f_init( \
|
|
88
|
-
napi_env env, \
|
|
89
|
-
napi_value exports \
|
|
90
|
-
) { \
|
|
91
|
-
napi_value fcn; \
|
|
92
|
-
napi_status status = napi_create_function( \
|
|
93
|
-
env, \
|
|
94
|
-
"exports", \
|
|
95
|
-
NAPI_AUTO_LENGTH, \
|
|
96
|
-
stdlib_math_base_napi_fffff_f_wrapper, \
|
|
97
|
-
NULL, \
|
|
98
|
-
&fcn \
|
|
99
|
-
); \
|
|
100
|
-
assert( status == napi_ok ); \
|
|
101
|
-
return fcn; \
|
|
102
|
-
}; \
|
|
103
|
-
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_fffff_f_init )
|
|
104
|
-
|
|
105
|
-
/*
|
|
106
|
-
* If C++, prevent name mangling so that the compiler emits a quinary file having undecorated names, thus mirroring the behavior of a C compiler.
|
|
107
|
-
*/
|
|
108
|
-
#ifdef __cplusplus
|
|
109
|
-
extern "C" {
|
|
110
|
-
#endif
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Invokes a quinary function accepting and returning double-precision floating-point numbers.
|
|
114
|
-
*/
|
|
115
|
-
napi_value stdlib_math_base_napi_ddddd_d( napi_env env, napi_callback_info info, double (*fcn)( double, double, double, double, double ) );
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Invokes a quinary function accepting and returning single-precision floating-point numbers.
|
|
119
|
-
*/
|
|
120
|
-
napi_value stdlib_math_base_napi_fffff_f( napi_env env, napi_callback_info info, float (*fcn)( float, float, float, float, float ) );
|
|
121
|
-
|
|
122
|
-
#ifdef __cplusplus
|
|
123
|
-
}
|
|
124
|
-
#endif
|
|
25
|
+
// NOTE: keep in alphabetical order...
|
|
26
|
+
#include "stdlib/math/base/napi/quinary/ddddd_d.h"
|
|
27
|
+
#include "stdlib/math/base/napi/quinary/fffff_f.h"
|
|
125
28
|
|
|
126
29
|
#endif // !STDLIB_MATH_BASE_NAPI_QUINARY_H
|
package/manifest.json
CHANGED
|
@@ -1,38 +1,39 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
2
|
+
"options": {},
|
|
3
|
+
"fields": [
|
|
4
|
+
{
|
|
5
|
+
"field": "src",
|
|
6
|
+
"resolve": true,
|
|
7
|
+
"relative": true
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"field": "include",
|
|
11
|
+
"resolve": true,
|
|
12
|
+
"relative": true
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"field": "libraries",
|
|
16
|
+
"resolve": false,
|
|
17
|
+
"relative": false
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"field": "libpath",
|
|
21
|
+
"resolve": true,
|
|
22
|
+
"relative": false
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"confs": [
|
|
26
|
+
{
|
|
27
|
+
"src": [
|
|
28
|
+
"./src/ddddd_d.c",
|
|
29
|
+
"./src/fffff_f.c"
|
|
30
|
+
],
|
|
31
|
+
"include": [
|
|
32
|
+
"./include"
|
|
33
|
+
],
|
|
34
|
+
"libraries": [],
|
|
35
|
+
"libpath": [],
|
|
36
|
+
"dependencies": []
|
|
37
|
+
}
|
|
38
|
+
]
|
|
38
39
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/math-base-napi-quinary",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "C APIs for registering a Node-API module exporting an interface for invoking a quinary numerical function.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@stdlib/utils-library-manifest": "^0.2.
|
|
37
|
+
"@stdlib/utils-library-manifest": "^0.2.3"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {},
|
|
40
40
|
"engines": {
|
|
@@ -65,11 +65,6 @@
|
|
|
65
65
|
"map",
|
|
66
66
|
"transform"
|
|
67
67
|
],
|
|
68
|
-
"__stdlib__": {
|
|
69
|
-
"envs": {
|
|
70
|
-
"browser": false
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
68
|
"funding": {
|
|
74
69
|
"type": "opencollective",
|
|
75
70
|
"url": "https://opencollective.com/stdlib"
|
package/src/addon.c
CHANGED
package/src/ddddd_d.c
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2025 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
#include "stdlib/math/base/napi/quinary/ddddd_d.h"
|
|
20
|
+
#include <node_api.h>
|
|
21
|
+
#include <assert.h>
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Invokes a quinary function accepting and returning double-precision floating-point numbers.
|
|
25
|
+
*
|
|
26
|
+
* ## Notes
|
|
27
|
+
*
|
|
28
|
+
* - This function expects that the callback `info` argument provides access to the following JavaScript arguments:
|
|
29
|
+
*
|
|
30
|
+
* - `x`: input value.
|
|
31
|
+
* - `y`: input value.
|
|
32
|
+
* - `z`: input value.
|
|
33
|
+
* - `w`: input value.
|
|
34
|
+
* - `u`: input value.
|
|
35
|
+
*
|
|
36
|
+
* @param env environment under which the function is invoked
|
|
37
|
+
* @param info callback data
|
|
38
|
+
* @param fcn quinary function
|
|
39
|
+
* @return function return value as a Node-API double-precision floating-point number
|
|
40
|
+
*/
|
|
41
|
+
napi_value stdlib_math_base_napi_ddddd_d( napi_env env, napi_callback_info info, double (*fcn)( double, double, double, double, double ) ) {
|
|
42
|
+
napi_status status;
|
|
43
|
+
|
|
44
|
+
size_t argc = 5;
|
|
45
|
+
napi_value argv[ 5 ];
|
|
46
|
+
status = napi_get_cb_info( env, info, &argc, argv, NULL, NULL );
|
|
47
|
+
assert( status == napi_ok );
|
|
48
|
+
|
|
49
|
+
if ( argc < 5 ) {
|
|
50
|
+
status = napi_throw_error( env, NULL, "invalid invocation. Must provide five numbers." );
|
|
51
|
+
assert( status == napi_ok );
|
|
52
|
+
return NULL;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
napi_valuetype vtype0;
|
|
56
|
+
status = napi_typeof( env, argv[ 0 ], &vtype0 );
|
|
57
|
+
assert( status == napi_ok );
|
|
58
|
+
if ( vtype0 != napi_number ) {
|
|
59
|
+
status = napi_throw_type_error( env, NULL, "invalid argument. First argument must be a number." );
|
|
60
|
+
assert( status == napi_ok );
|
|
61
|
+
return NULL;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
napi_valuetype vtype1;
|
|
65
|
+
status = napi_typeof( env, argv[ 1 ], &vtype1 );
|
|
66
|
+
assert( status == napi_ok );
|
|
67
|
+
if ( vtype1 != napi_number ) {
|
|
68
|
+
status = napi_throw_type_error( env, NULL, "invalid argument. Second argument must be a number." );
|
|
69
|
+
assert( status == napi_ok );
|
|
70
|
+
return NULL;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
napi_valuetype vtype2;
|
|
74
|
+
status = napi_typeof( env, argv[ 2 ], &vtype2 );
|
|
75
|
+
assert( status == napi_ok );
|
|
76
|
+
if ( vtype2 != napi_number ) {
|
|
77
|
+
status = napi_throw_type_error( env, NULL, "invalid argument. Third argument must be a number." );
|
|
78
|
+
assert( status == napi_ok );
|
|
79
|
+
return NULL;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
napi_valuetype vtype3;
|
|
83
|
+
status = napi_typeof( env, argv[ 3 ], &vtype3 );
|
|
84
|
+
assert( status == napi_ok );
|
|
85
|
+
if ( vtype3 != napi_number ) {
|
|
86
|
+
status = napi_throw_type_error( env, NULL, "invalid argument. Fourth argument must be a number." );
|
|
87
|
+
assert( status == napi_ok );
|
|
88
|
+
return NULL;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
napi_valuetype vtype4;
|
|
92
|
+
status = napi_typeof( env, argv[ 4 ], &vtype4 );
|
|
93
|
+
assert( status == napi_ok );
|
|
94
|
+
if ( vtype4 != napi_number ) {
|
|
95
|
+
status = napi_throw_type_error( env, NULL, "invalid argument. Fifth argument must be a number." );
|
|
96
|
+
assert( status == napi_ok );
|
|
97
|
+
return NULL;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
double x;
|
|
101
|
+
status = napi_get_value_double( env, argv[ 0 ], &x );
|
|
102
|
+
assert( status == napi_ok );
|
|
103
|
+
|
|
104
|
+
double y;
|
|
105
|
+
status = napi_get_value_double( env, argv[ 1 ], &y );
|
|
106
|
+
assert( status == napi_ok );
|
|
107
|
+
|
|
108
|
+
double z;
|
|
109
|
+
status = napi_get_value_double( env, argv[ 2 ], &z );
|
|
110
|
+
assert( status == napi_ok );
|
|
111
|
+
|
|
112
|
+
double w;
|
|
113
|
+
status = napi_get_value_double( env, argv[ 3 ], &w );
|
|
114
|
+
assert( status == napi_ok );
|
|
115
|
+
|
|
116
|
+
double u;
|
|
117
|
+
status = napi_get_value_double( env, argv[ 4 ], &u );
|
|
118
|
+
assert( status == napi_ok );
|
|
119
|
+
|
|
120
|
+
napi_value v;
|
|
121
|
+
status = napi_create_double( env, fcn( x, y, z, w, u ), &v );
|
|
122
|
+
assert( status == napi_ok );
|
|
123
|
+
|
|
124
|
+
return v;
|
|
125
|
+
}
|
package/src/{main.c → fffff_f.c}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license Apache-2.0
|
|
3
3
|
*
|
|
4
|
-
* Copyright (c)
|
|
4
|
+
* Copyright (c) 2025 The Stdlib Authors.
|
|
5
5
|
*
|
|
6
6
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
* you may not use this file except in compliance with the License.
|
|
@@ -16,115 +16,10 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
#include "stdlib/math/base/napi/quinary.h"
|
|
19
|
+
#include "stdlib/math/base/napi/quinary/fffff_f.h"
|
|
20
20
|
#include <node_api.h>
|
|
21
|
-
#include <stdint.h>
|
|
22
21
|
#include <assert.h>
|
|
23
22
|
|
|
24
|
-
/**
|
|
25
|
-
* Invokes a quinary function accepting and returning double-precision floating-point numbers.
|
|
26
|
-
*
|
|
27
|
-
* ## Notes
|
|
28
|
-
*
|
|
29
|
-
* - This function expects that the callback `info` argument provides access to the following JavaScript arguments:
|
|
30
|
-
*
|
|
31
|
-
* - `x`: input value.
|
|
32
|
-
* - `y`: input value.
|
|
33
|
-
* - `z`: input value.
|
|
34
|
-
* - `w`: input value.
|
|
35
|
-
* - `u`: input value.
|
|
36
|
-
*
|
|
37
|
-
* @param env environment under which the function is invoked
|
|
38
|
-
* @param info callback data
|
|
39
|
-
* @param fcn quinary function
|
|
40
|
-
* @return function return value as a Node-API double-precision floating-point number
|
|
41
|
-
*/
|
|
42
|
-
napi_value stdlib_math_base_napi_ddddd_d( napi_env env, napi_callback_info info, double (*fcn)( double, double, double, double, double ) ) {
|
|
43
|
-
napi_status status;
|
|
44
|
-
|
|
45
|
-
size_t argc = 5;
|
|
46
|
-
napi_value argv[ 5 ];
|
|
47
|
-
status = napi_get_cb_info( env, info, &argc, argv, NULL, NULL );
|
|
48
|
-
assert( status == napi_ok );
|
|
49
|
-
|
|
50
|
-
if ( argc < 5 ) {
|
|
51
|
-
status = napi_throw_error( env, NULL, "invalid invocation. Must provide five numbers." );
|
|
52
|
-
assert( status == napi_ok );
|
|
53
|
-
return NULL;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
napi_valuetype vtype0;
|
|
57
|
-
status = napi_typeof( env, argv[ 0 ], &vtype0 );
|
|
58
|
-
assert( status == napi_ok );
|
|
59
|
-
if ( vtype0 != napi_number ) {
|
|
60
|
-
status = napi_throw_type_error( env, NULL, "invalid argument. First argument must be a number." );
|
|
61
|
-
assert( status == napi_ok );
|
|
62
|
-
return NULL;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
napi_valuetype vtype1;
|
|
66
|
-
status = napi_typeof( env, argv[ 1 ], &vtype1 );
|
|
67
|
-
assert( status == napi_ok );
|
|
68
|
-
if ( vtype1 != napi_number ) {
|
|
69
|
-
status = napi_throw_type_error( env, NULL, "invalid argument. Second argument must be a number." );
|
|
70
|
-
assert( status == napi_ok );
|
|
71
|
-
return NULL;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
napi_valuetype vtype2;
|
|
75
|
-
status = napi_typeof( env, argv[ 2 ], &vtype2 );
|
|
76
|
-
assert( status == napi_ok );
|
|
77
|
-
if ( vtype2 != napi_number ) {
|
|
78
|
-
status = napi_throw_type_error( env, NULL, "invalid argument. Third argument must be a number." );
|
|
79
|
-
assert( status == napi_ok );
|
|
80
|
-
return NULL;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
napi_valuetype vtype3;
|
|
84
|
-
status = napi_typeof( env, argv[ 3 ], &vtype3 );
|
|
85
|
-
assert( status == napi_ok );
|
|
86
|
-
if ( vtype3 != napi_number ) {
|
|
87
|
-
status = napi_throw_type_error( env, NULL, "invalid argument. Fourth argument must be a number." );
|
|
88
|
-
assert( status == napi_ok );
|
|
89
|
-
return NULL;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
napi_valuetype vtype4;
|
|
93
|
-
status = napi_typeof( env, argv[ 4 ], &vtype4 );
|
|
94
|
-
assert( status == napi_ok );
|
|
95
|
-
if ( vtype4 != napi_number ) {
|
|
96
|
-
status = napi_throw_type_error( env, NULL, "invalid argument. Fifth argument must be a number." );
|
|
97
|
-
assert( status == napi_ok );
|
|
98
|
-
return NULL;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
double x;
|
|
102
|
-
status = napi_get_value_double( env, argv[ 0 ], &x );
|
|
103
|
-
assert( status == napi_ok );
|
|
104
|
-
|
|
105
|
-
double y;
|
|
106
|
-
status = napi_get_value_double( env, argv[ 1 ], &y );
|
|
107
|
-
assert( status == napi_ok );
|
|
108
|
-
|
|
109
|
-
double z;
|
|
110
|
-
status = napi_get_value_double( env, argv[ 2 ], &z );
|
|
111
|
-
assert( status == napi_ok );
|
|
112
|
-
|
|
113
|
-
double w;
|
|
114
|
-
status = napi_get_value_double( env, argv[ 3 ], &w );
|
|
115
|
-
assert( status == napi_ok );
|
|
116
|
-
|
|
117
|
-
double u;
|
|
118
|
-
status = napi_get_value_double( env, argv[ 4 ], &u );
|
|
119
|
-
assert( status == napi_ok );
|
|
120
|
-
|
|
121
|
-
napi_value v;
|
|
122
|
-
status = napi_create_double( env, fcn( x, y, z, w, u ), &v );
|
|
123
|
-
assert( status == napi_ok );
|
|
124
|
-
|
|
125
|
-
return v;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
23
|
/**
|
|
129
24
|
* Invokes a quinary function accepting and returning single-precision floating-point numbers.
|
|
130
25
|
*
|