@stdlib/math-base-napi-unary 0.2.3 → 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 +710 -144
- package/include/stdlib/math/base/napi/unary/b_b.h +84 -0
- package/include/stdlib/math/base/napi/unary/c_c.h +93 -0
- package/include/stdlib/math/base/napi/unary/c_f.h +84 -0
- package/include/stdlib/math/base/napi/unary/d_d.h +81 -0
- package/include/stdlib/math/base/napi/unary/d_f.h +81 -0
- package/include/stdlib/math/base/napi/unary/f_f.h +81 -0
- package/include/stdlib/math/base/napi/unary/f_i.h +84 -0
- package/include/stdlib/math/base/napi/unary/h_h.h +84 -0
- package/include/stdlib/math/base/napi/unary/i_d.h +84 -0
- package/include/stdlib/math/base/napi/unary/i_f.h +84 -0
- package/include/stdlib/math/base/napi/unary/i_i.h +84 -0
- package/include/stdlib/math/base/napi/unary/k_k.h +84 -0
- package/include/stdlib/math/base/napi/unary/s_s.h +84 -0
- package/include/stdlib/math/base/napi/unary/t_t.h +84 -0
- package/include/stdlib/math/base/napi/unary/u_u.h +84 -0
- package/include/stdlib/math/base/napi/unary/z_d.h +84 -0
- package/include/stdlib/math/base/napi/unary/z_z.h +93 -0
- package/include/stdlib/math/base/napi/unary.h +18 -406
- package/manifest.json +56 -37
- package/package.json +6 -3
- package/src/b_b.c +71 -0
- package/src/c_c.c +129 -0
- package/src/c_f.c +109 -0
- package/src/d_d.c +69 -0
- package/src/d_f.c +69 -0
- package/src/f_f.c +69 -0
- package/src/f_i.c +70 -0
- package/src/h_h.c +74 -0
- package/src/i_d.c +70 -0
- package/src/i_f.c +70 -0
- package/src/i_i.c +70 -0
- package/src/k_k.c +70 -0
- package/src/s_s.c +71 -0
- package/src/t_t.c +70 -0
- package/src/u_u.c +70 -0
- package/src/z_d.c +109 -0
- package/src/z_z.c +129 -0
- package/src/main.c +0 -601
|
@@ -0,0 +1,93 @@
|
|
|
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_UNARY_Z_Z_H
|
|
20
|
+
#define STDLIB_MATH_BASE_NAPI_UNARY_Z_Z_H
|
|
21
|
+
|
|
22
|
+
#include "stdlib/complex/float64/ctor.h"
|
|
23
|
+
#include <node_api.h>
|
|
24
|
+
#include <assert.h>
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Macro for registering a Node-API module exporting an interface invoking a unary function accepting and returning double-precision complex floating-point numbers.
|
|
28
|
+
*
|
|
29
|
+
* @param fcn unary function
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* #include "stdlib/complex/float64/ctor.h"
|
|
33
|
+
* #include "stdlib/complex/float64/reim.h"
|
|
34
|
+
*
|
|
35
|
+
* static stdlib_complex128_t scale( const stdlib_complex128_t x ) {
|
|
36
|
+
* double re;
|
|
37
|
+
* double im;
|
|
38
|
+
*
|
|
39
|
+
* stdlib_complex128_reim( x, &re, &im );
|
|
40
|
+
*
|
|
41
|
+
* re *= 10.0;
|
|
42
|
+
* im *= 10.0;
|
|
43
|
+
*
|
|
44
|
+
* return stdlib_complex128( re, im );
|
|
45
|
+
* }
|
|
46
|
+
*
|
|
47
|
+
* // ...
|
|
48
|
+
*
|
|
49
|
+
* // Register a Node-API module:
|
|
50
|
+
* STDLIB_MATH_BASE_NAPI_MODULE_Z_Z( scale );
|
|
51
|
+
*/
|
|
52
|
+
#define STDLIB_MATH_BASE_NAPI_MODULE_Z_Z( fcn ) \
|
|
53
|
+
static napi_value stdlib_math_base_napi_z_z_wrapper( \
|
|
54
|
+
napi_env env, \
|
|
55
|
+
napi_callback_info info \
|
|
56
|
+
) { \
|
|
57
|
+
return stdlib_math_base_napi_z_z( env, info, fcn ); \
|
|
58
|
+
}; \
|
|
59
|
+
static napi_value stdlib_math_base_napi_z_z_init( \
|
|
60
|
+
napi_env env, \
|
|
61
|
+
napi_value exports \
|
|
62
|
+
) { \
|
|
63
|
+
napi_value f; \
|
|
64
|
+
napi_status status = napi_create_function( \
|
|
65
|
+
env, \
|
|
66
|
+
"exports", \
|
|
67
|
+
NAPI_AUTO_LENGTH, \
|
|
68
|
+
stdlib_math_base_napi_z_z_wrapper, \
|
|
69
|
+
NULL, \
|
|
70
|
+
&f \
|
|
71
|
+
); \
|
|
72
|
+
assert( status == napi_ok ); \
|
|
73
|
+
return f; \
|
|
74
|
+
}; \
|
|
75
|
+
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_z_z_init )
|
|
76
|
+
|
|
77
|
+
/*
|
|
78
|
+
* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
|
|
79
|
+
*/
|
|
80
|
+
#ifdef __cplusplus
|
|
81
|
+
extern "C" {
|
|
82
|
+
#endif
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Invokes a unary function accepting and returning double-precision complex floating-point numbers.
|
|
86
|
+
*/
|
|
87
|
+
napi_value stdlib_math_base_napi_z_z( napi_env env, napi_callback_info info, stdlib_complex128_t (*fcn)( stdlib_complex128_t ) );
|
|
88
|
+
|
|
89
|
+
#ifdef __cplusplus
|
|
90
|
+
}
|
|
91
|
+
#endif
|
|
92
|
+
|
|
93
|
+
#endif // !STDLIB_MATH_BASE_NAPI_UNARY_Z_Z_H
|
|
@@ -19,411 +19,23 @@
|
|
|
19
19
|
#ifndef STDLIB_MATH_BASE_NAPI_UNARY_H
|
|
20
20
|
#define STDLIB_MATH_BASE_NAPI_UNARY_H
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
#include "stdlib/
|
|
24
|
-
#include
|
|
25
|
-
#include
|
|
26
|
-
#include
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
* // Register a Node-API module:
|
|
41
|
-
* STDLIB_MATH_BASE_NAPI_MODULE_D_D( scale );
|
|
42
|
-
*/
|
|
43
|
-
#define STDLIB_MATH_BASE_NAPI_MODULE_D_D( fcn ) \
|
|
44
|
-
static napi_value stdlib_math_base_napi_d_d_wrapper( \
|
|
45
|
-
napi_env env, \
|
|
46
|
-
napi_callback_info info \
|
|
47
|
-
) { \
|
|
48
|
-
return stdlib_math_base_napi_d_d( env, info, fcn ); \
|
|
49
|
-
}; \
|
|
50
|
-
static napi_value stdlib_math_base_napi_d_d_init( \
|
|
51
|
-
napi_env env, \
|
|
52
|
-
napi_value exports \
|
|
53
|
-
) { \
|
|
54
|
-
napi_value fcn; \
|
|
55
|
-
napi_status status = napi_create_function( \
|
|
56
|
-
env, \
|
|
57
|
-
"exports", \
|
|
58
|
-
NAPI_AUTO_LENGTH, \
|
|
59
|
-
stdlib_math_base_napi_d_d_wrapper, \
|
|
60
|
-
NULL, \
|
|
61
|
-
&fcn \
|
|
62
|
-
); \
|
|
63
|
-
assert( status == napi_ok ); \
|
|
64
|
-
return fcn; \
|
|
65
|
-
}; \
|
|
66
|
-
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_d_d_init )
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Macro for registering a Node-API module exporting an interface invoking a unary function accepting and returning single-precision floating-point numbers.
|
|
70
|
-
*
|
|
71
|
-
* @param fcn unary function
|
|
72
|
-
*
|
|
73
|
-
* @example
|
|
74
|
-
* static float scale( const float x ) {
|
|
75
|
-
* return x * 10.0f;
|
|
76
|
-
* }
|
|
77
|
-
*
|
|
78
|
-
* // ...
|
|
79
|
-
*
|
|
80
|
-
* // Register a Node-API module:
|
|
81
|
-
* STDLIB_MATH_BASE_NAPI_MODULE_F_F( scale );
|
|
82
|
-
*/
|
|
83
|
-
#define STDLIB_MATH_BASE_NAPI_MODULE_F_F( fcn ) \
|
|
84
|
-
static napi_value stdlib_math_base_napi_f_f_wrapper( \
|
|
85
|
-
napi_env env, \
|
|
86
|
-
napi_callback_info info \
|
|
87
|
-
) { \
|
|
88
|
-
return stdlib_math_base_napi_f_f( env, info, fcn ); \
|
|
89
|
-
}; \
|
|
90
|
-
static napi_value stdlib_math_base_napi_f_f_init( \
|
|
91
|
-
napi_env env, \
|
|
92
|
-
napi_value exports \
|
|
93
|
-
) { \
|
|
94
|
-
napi_value fcn; \
|
|
95
|
-
napi_status status = napi_create_function( \
|
|
96
|
-
env, \
|
|
97
|
-
"exports", \
|
|
98
|
-
NAPI_AUTO_LENGTH, \
|
|
99
|
-
stdlib_math_base_napi_f_f_wrapper, \
|
|
100
|
-
NULL, \
|
|
101
|
-
&fcn \
|
|
102
|
-
); \
|
|
103
|
-
assert( status == napi_ok ); \
|
|
104
|
-
return fcn; \
|
|
105
|
-
}; \
|
|
106
|
-
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_f_f_init )
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Macro for registering a Node-API module exporting an interface invoking a unary function accepting and returning double-precision complex floating-point numbers.
|
|
110
|
-
*
|
|
111
|
-
* @param fcn unary function
|
|
112
|
-
*
|
|
113
|
-
* @example
|
|
114
|
-
* #include "stdlib/complex/float64/ctor.h"
|
|
115
|
-
* #include "stdlib/complex/float64/reim.h"
|
|
116
|
-
*
|
|
117
|
-
* static stdlib_complex128_t scale( const stdlib_complex128_t x ) {
|
|
118
|
-
* double re;
|
|
119
|
-
* double im;
|
|
120
|
-
*
|
|
121
|
-
* stdlib_complex128_reim( x, &re, &im );
|
|
122
|
-
*
|
|
123
|
-
* re *= 10.0;
|
|
124
|
-
* im *= 10.0;
|
|
125
|
-
*
|
|
126
|
-
* return stdlib_complex128( re, im );
|
|
127
|
-
* }
|
|
128
|
-
*
|
|
129
|
-
* // ...
|
|
130
|
-
*
|
|
131
|
-
* // Register a Node-API module:
|
|
132
|
-
* STDLIB_MATH_BASE_NAPI_MODULE_Z_Z( scale );
|
|
133
|
-
*/
|
|
134
|
-
#define STDLIB_MATH_BASE_NAPI_MODULE_Z_Z( fcn ) \
|
|
135
|
-
static napi_value stdlib_math_base_napi_z_z_wrapper( \
|
|
136
|
-
napi_env env, \
|
|
137
|
-
napi_callback_info info \
|
|
138
|
-
) { \
|
|
139
|
-
return stdlib_math_base_napi_z_z( env, info, fcn ); \
|
|
140
|
-
}; \
|
|
141
|
-
static napi_value stdlib_math_base_napi_z_z_init( \
|
|
142
|
-
napi_env env, \
|
|
143
|
-
napi_value exports \
|
|
144
|
-
) { \
|
|
145
|
-
napi_value fcn; \
|
|
146
|
-
napi_status status = napi_create_function( \
|
|
147
|
-
env, \
|
|
148
|
-
"exports", \
|
|
149
|
-
NAPI_AUTO_LENGTH, \
|
|
150
|
-
stdlib_math_base_napi_z_z_wrapper, \
|
|
151
|
-
NULL, \
|
|
152
|
-
&fcn \
|
|
153
|
-
); \
|
|
154
|
-
assert( status == napi_ok ); \
|
|
155
|
-
return fcn; \
|
|
156
|
-
}; \
|
|
157
|
-
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_z_z_init )
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Macro for registering a Node-API module exporting an interface invoking a unary function accepting a double-precision complex floating-point number and returning a double-precision floating-point number.
|
|
161
|
-
*
|
|
162
|
-
* @param fcn unary function
|
|
163
|
-
*
|
|
164
|
-
* @example
|
|
165
|
-
* #include "stdlib/complex/float64/ctor.h"
|
|
166
|
-
*
|
|
167
|
-
* static double fcn( const stdlib_complex128_t x ) {
|
|
168
|
-
* // ...
|
|
169
|
-
* }
|
|
170
|
-
*
|
|
171
|
-
* // ...
|
|
172
|
-
*
|
|
173
|
-
* // Register a Node-API module:
|
|
174
|
-
* STDLIB_MATH_BASE_NAPI_MODULE_Z_D( fcn );
|
|
175
|
-
*/
|
|
176
|
-
#define STDLIB_MATH_BASE_NAPI_MODULE_Z_D( fcn ) \
|
|
177
|
-
static napi_value stdlib_math_base_napi_z_d_wrapper( \
|
|
178
|
-
napi_env env, \
|
|
179
|
-
napi_callback_info info \
|
|
180
|
-
) { \
|
|
181
|
-
return stdlib_math_base_napi_z_d( env, info, fcn ); \
|
|
182
|
-
}; \
|
|
183
|
-
static napi_value stdlib_math_base_napi_z_d_init( \
|
|
184
|
-
napi_env env, \
|
|
185
|
-
napi_value exports \
|
|
186
|
-
) { \
|
|
187
|
-
napi_value fcn; \
|
|
188
|
-
napi_status status = napi_create_function( \
|
|
189
|
-
env, \
|
|
190
|
-
"exports", \
|
|
191
|
-
NAPI_AUTO_LENGTH, \
|
|
192
|
-
stdlib_math_base_napi_z_d_wrapper, \
|
|
193
|
-
NULL, \
|
|
194
|
-
&fcn \
|
|
195
|
-
); \
|
|
196
|
-
assert( status == napi_ok ); \
|
|
197
|
-
return fcn; \
|
|
198
|
-
}; \
|
|
199
|
-
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_z_d_init )
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Macro for registering a Node-API module exporting an interface invoking a unary function accepting and returning single-precision complex floating-point numbers.
|
|
203
|
-
*
|
|
204
|
-
* @param fcn unary function
|
|
205
|
-
*
|
|
206
|
-
* @example
|
|
207
|
-
* #include "stdlib/complex/float32/ctor.h"
|
|
208
|
-
* #include "stdlib/complex/float32/reim.h"
|
|
209
|
-
*
|
|
210
|
-
* static stdlib_complex64_t scale( const stdlib_complex64_t x ) {
|
|
211
|
-
* float re;
|
|
212
|
-
* float im;
|
|
213
|
-
*
|
|
214
|
-
* stdlib_complex64_reim( x, &re, &im );
|
|
215
|
-
*
|
|
216
|
-
* re *= 10.0f;
|
|
217
|
-
* im *= 10.0f;
|
|
218
|
-
*
|
|
219
|
-
* return stdlib_complex64( re, im );
|
|
220
|
-
* }
|
|
221
|
-
*
|
|
222
|
-
* // ...
|
|
223
|
-
*
|
|
224
|
-
* // Register a Node-API module:
|
|
225
|
-
* STDLIB_MATH_BASE_NAPI_MODULE_C_C( scale );
|
|
226
|
-
*/
|
|
227
|
-
#define STDLIB_MATH_BASE_NAPI_MODULE_C_C( fcn ) \
|
|
228
|
-
static napi_value stdlib_math_base_napi_c_c_wrapper( \
|
|
229
|
-
napi_env env, \
|
|
230
|
-
napi_callback_info info \
|
|
231
|
-
) { \
|
|
232
|
-
return stdlib_math_base_napi_c_c( env, info, fcn ); \
|
|
233
|
-
}; \
|
|
234
|
-
static napi_value stdlib_math_base_napi_c_c_init( \
|
|
235
|
-
napi_env env, \
|
|
236
|
-
napi_value exports \
|
|
237
|
-
) { \
|
|
238
|
-
napi_value fcn; \
|
|
239
|
-
napi_status status = napi_create_function( \
|
|
240
|
-
env, \
|
|
241
|
-
"exports", \
|
|
242
|
-
NAPI_AUTO_LENGTH, \
|
|
243
|
-
stdlib_math_base_napi_c_c_wrapper, \
|
|
244
|
-
NULL, \
|
|
245
|
-
&fcn \
|
|
246
|
-
); \
|
|
247
|
-
assert( status == napi_ok ); \
|
|
248
|
-
return fcn; \
|
|
249
|
-
}; \
|
|
250
|
-
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_c_c_init )
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* Macro for registering a Node-API module exporting an interface invoking a unary function accepting a single-precision complex floating-point number and returning a single-precision floating-point number.
|
|
254
|
-
*
|
|
255
|
-
* @param fcn unary function
|
|
256
|
-
*
|
|
257
|
-
* @example
|
|
258
|
-
* #include "stdlib/complex/float32/ctor.h"
|
|
259
|
-
*
|
|
260
|
-
* static float fcn( const stdlib_complex64_t x ) {
|
|
261
|
-
* // ...
|
|
262
|
-
* }
|
|
263
|
-
*
|
|
264
|
-
* // ...
|
|
265
|
-
*
|
|
266
|
-
* // Register a Node-API module:
|
|
267
|
-
* STDLIB_MATH_BASE_NAPI_MODULE_C_F( fcn );
|
|
268
|
-
*/
|
|
269
|
-
#define STDLIB_MATH_BASE_NAPI_MODULE_C_F( fcn ) \
|
|
270
|
-
static napi_value stdlib_math_base_napi_c_f_wrapper( \
|
|
271
|
-
napi_env env, \
|
|
272
|
-
napi_callback_info info \
|
|
273
|
-
) { \
|
|
274
|
-
return stdlib_math_base_napi_c_f( env, info, fcn ); \
|
|
275
|
-
}; \
|
|
276
|
-
static napi_value stdlib_math_base_napi_c_f_init( \
|
|
277
|
-
napi_env env, \
|
|
278
|
-
napi_value exports \
|
|
279
|
-
) { \
|
|
280
|
-
napi_value fcn; \
|
|
281
|
-
napi_status status = napi_create_function( \
|
|
282
|
-
env, \
|
|
283
|
-
"exports", \
|
|
284
|
-
NAPI_AUTO_LENGTH, \
|
|
285
|
-
stdlib_math_base_napi_c_f_wrapper, \
|
|
286
|
-
NULL, \
|
|
287
|
-
&fcn \
|
|
288
|
-
); \
|
|
289
|
-
assert( status == napi_ok ); \
|
|
290
|
-
return fcn; \
|
|
291
|
-
}; \
|
|
292
|
-
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_c_f_init )
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* Macro for registering a Node-API module exporting an interface invoking a unary function accepting and returning 32-bit signed integers.
|
|
296
|
-
*
|
|
297
|
-
* @param fcn unary function
|
|
298
|
-
*
|
|
299
|
-
* @example
|
|
300
|
-
* #include <stdint.h>
|
|
301
|
-
*
|
|
302
|
-
* static int32_t scale( const int32_t x ) {
|
|
303
|
-
* return x * 10;
|
|
304
|
-
* }
|
|
305
|
-
*
|
|
306
|
-
* // ...
|
|
307
|
-
*
|
|
308
|
-
* // Register a Node-API module:
|
|
309
|
-
* STDLIB_MATH_BASE_NAPI_MODULE_I_I( scale );
|
|
310
|
-
*/
|
|
311
|
-
#define STDLIB_MATH_BASE_NAPI_MODULE_I_I( fcn ) \
|
|
312
|
-
static napi_value stdlib_math_base_napi_i_i_wrapper( \
|
|
313
|
-
napi_env env, \
|
|
314
|
-
napi_callback_info info \
|
|
315
|
-
) { \
|
|
316
|
-
return stdlib_math_base_napi_i_i( env, info, fcn ); \
|
|
317
|
-
}; \
|
|
318
|
-
static napi_value stdlib_math_base_napi_i_i_init( \
|
|
319
|
-
napi_env env, \
|
|
320
|
-
napi_value exports \
|
|
321
|
-
) { \
|
|
322
|
-
napi_value fcn; \
|
|
323
|
-
napi_status status = napi_create_function( \
|
|
324
|
-
env, \
|
|
325
|
-
"exports", \
|
|
326
|
-
NAPI_AUTO_LENGTH, \
|
|
327
|
-
stdlib_math_base_napi_i_i_wrapper, \
|
|
328
|
-
NULL, \
|
|
329
|
-
&fcn \
|
|
330
|
-
); \
|
|
331
|
-
assert( status == napi_ok ); \
|
|
332
|
-
return fcn; \
|
|
333
|
-
}; \
|
|
334
|
-
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_i_i_init )
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* Macro for registering a Node-API module exporting an interface invoking a unary function accepting a signed 32-bit integer and returning a double-precision floating-point number.
|
|
338
|
-
*
|
|
339
|
-
* @param fcn unary function
|
|
340
|
-
*
|
|
341
|
-
* @example
|
|
342
|
-
* #include <stdint.h>
|
|
343
|
-
*
|
|
344
|
-
* static double scale( const int32_t x ) {
|
|
345
|
-
* return x * 10.0;
|
|
346
|
-
* }
|
|
347
|
-
*
|
|
348
|
-
* // ...
|
|
349
|
-
*
|
|
350
|
-
* // Register a Node-API module:
|
|
351
|
-
* STDLIB_MATH_BASE_NAPI_MODULE_I_D( scale );
|
|
352
|
-
*/
|
|
353
|
-
#define STDLIB_MATH_BASE_NAPI_MODULE_I_D( fcn ) \
|
|
354
|
-
static napi_value stdlib_math_base_napi_i_d_wrapper( \
|
|
355
|
-
napi_env env, \
|
|
356
|
-
napi_callback_info info \
|
|
357
|
-
) { \
|
|
358
|
-
return stdlib_math_base_napi_i_d( env, info, fcn ); \
|
|
359
|
-
}; \
|
|
360
|
-
static napi_value stdlib_math_base_napi_i_d_init( \
|
|
361
|
-
napi_env env, \
|
|
362
|
-
napi_value exports \
|
|
363
|
-
) { \
|
|
364
|
-
napi_value fcn; \
|
|
365
|
-
napi_status status = napi_create_function( \
|
|
366
|
-
env, \
|
|
367
|
-
"exports", \
|
|
368
|
-
NAPI_AUTO_LENGTH, \
|
|
369
|
-
stdlib_math_base_napi_i_d_wrapper, \
|
|
370
|
-
NULL, \
|
|
371
|
-
&fcn \
|
|
372
|
-
); \
|
|
373
|
-
assert( status == napi_ok ); \
|
|
374
|
-
return fcn; \
|
|
375
|
-
}; \
|
|
376
|
-
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_i_d_init )
|
|
377
|
-
|
|
378
|
-
/*
|
|
379
|
-
* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
|
|
380
|
-
*/
|
|
381
|
-
#ifdef __cplusplus
|
|
382
|
-
extern "C" {
|
|
383
|
-
#endif
|
|
384
|
-
|
|
385
|
-
/**
|
|
386
|
-
* Invokes a unary function accepting and returning double-precision floating-point numbers.
|
|
387
|
-
*/
|
|
388
|
-
napi_value stdlib_math_base_napi_d_d( napi_env env, napi_callback_info info, double (*fcn)( double ) );
|
|
389
|
-
|
|
390
|
-
/**
|
|
391
|
-
* Invokes a unary function accepting and returning single-precision floating-point numbers.
|
|
392
|
-
*/
|
|
393
|
-
napi_value stdlib_math_base_napi_f_f( napi_env env, napi_callback_info info, float (*fcn)( float ) );
|
|
394
|
-
|
|
395
|
-
/**
|
|
396
|
-
* Invokes a unary function accepting and returning double-precision complex floating-point numbers.
|
|
397
|
-
*/
|
|
398
|
-
napi_value stdlib_math_base_napi_z_z( napi_env env, napi_callback_info info, stdlib_complex128_t (*fcn)( stdlib_complex128_t ) );
|
|
399
|
-
|
|
400
|
-
/**
|
|
401
|
-
* Invokes a unary function accepting a double-precision complex floating-point number and returning a double-precision floating-point number.
|
|
402
|
-
*/
|
|
403
|
-
napi_value stdlib_math_base_napi_z_d( napi_env env, napi_callback_info info, double (*fcn)( stdlib_complex128_t ) );
|
|
404
|
-
|
|
405
|
-
/**
|
|
406
|
-
* Invokes a unary function accepting and returning single-precision complex floating-point numbers.
|
|
407
|
-
*/
|
|
408
|
-
napi_value stdlib_math_base_napi_c_c( napi_env env, napi_callback_info info, stdlib_complex64_t (*fcn)( stdlib_complex64_t ) );
|
|
409
|
-
|
|
410
|
-
/**
|
|
411
|
-
* Invokes a unary function accepting a single-precision complex floating-point number and returning a single-precision floating-point number.
|
|
412
|
-
*/
|
|
413
|
-
napi_value stdlib_math_base_napi_c_f( napi_env env, napi_callback_info info, float (*fcn)( stdlib_complex64_t ) );
|
|
414
|
-
|
|
415
|
-
/**
|
|
416
|
-
* Invokes a unary function accepting and returning signed 32-bit integers.
|
|
417
|
-
*/
|
|
418
|
-
napi_value stdlib_math_base_napi_i_i( napi_env env, napi_callback_info info, int32_t (*fcn)( int32_t ) );
|
|
419
|
-
|
|
420
|
-
/**
|
|
421
|
-
* Invokes a unary function accepting a signed 32-bit integer and returning a single-precision floating-point number.
|
|
422
|
-
*/
|
|
423
|
-
napi_value stdlib_math_base_napi_i_d( napi_env env, napi_callback_info info, double (*fcn)( int32_t ) );
|
|
424
|
-
|
|
425
|
-
#ifdef __cplusplus
|
|
426
|
-
}
|
|
427
|
-
#endif
|
|
22
|
+
// NOTE: keep in alphabetical order...
|
|
23
|
+
#include "stdlib/math/base/napi/unary/b_b.h"
|
|
24
|
+
#include "stdlib/math/base/napi/unary/c_c.h"
|
|
25
|
+
#include "stdlib/math/base/napi/unary/c_f.h"
|
|
26
|
+
#include "stdlib/math/base/napi/unary/d_d.h"
|
|
27
|
+
#include "stdlib/math/base/napi/unary/d_f.h"
|
|
28
|
+
#include "stdlib/math/base/napi/unary/f_f.h"
|
|
29
|
+
#include "stdlib/math/base/napi/unary/f_i.h"
|
|
30
|
+
#include "stdlib/math/base/napi/unary/h_h.h"
|
|
31
|
+
#include "stdlib/math/base/napi/unary/i_d.h"
|
|
32
|
+
#include "stdlib/math/base/napi/unary/i_f.h"
|
|
33
|
+
#include "stdlib/math/base/napi/unary/i_i.h"
|
|
34
|
+
#include "stdlib/math/base/napi/unary/k_k.h"
|
|
35
|
+
#include "stdlib/math/base/napi/unary/s_s.h"
|
|
36
|
+
#include "stdlib/math/base/napi/unary/t_t.h"
|
|
37
|
+
#include "stdlib/math/base/napi/unary/u_u.h"
|
|
38
|
+
#include "stdlib/math/base/napi/unary/z_d.h"
|
|
39
|
+
#include "stdlib/math/base/napi/unary/z_z.h"
|
|
428
40
|
|
|
429
41
|
#endif // !STDLIB_MATH_BASE_NAPI_UNARY_H
|
package/manifest.json
CHANGED
|
@@ -1,43 +1,62 @@
|
|
|
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
|
-
|
|
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/b_b.c",
|
|
29
|
+
"./src/c_c.c",
|
|
30
|
+
"./src/c_f.c",
|
|
31
|
+
"./src/d_d.c",
|
|
32
|
+
"./src/d_f.c",
|
|
33
|
+
"./src/f_f.c",
|
|
34
|
+
"./src/f_i.c",
|
|
35
|
+
"./src/h_h.c",
|
|
36
|
+
"./src/i_d.c",
|
|
37
|
+
"./src/i_f.c",
|
|
38
|
+
"./src/i_i.c",
|
|
39
|
+
"./src/k_k.c",
|
|
40
|
+
"./src/s_s.c",
|
|
41
|
+
"./src/t_t.c",
|
|
42
|
+
"./src/u_u.c",
|
|
43
|
+
"./src/z_d.c",
|
|
44
|
+
"./src/z_z.c"
|
|
45
|
+
],
|
|
46
|
+
"include": [
|
|
47
|
+
"./include"
|
|
48
|
+
],
|
|
49
|
+
"libraries": [],
|
|
50
|
+
"libpath": [],
|
|
51
|
+
"dependencies": [
|
|
36
52
|
"@stdlib/complex-float32-ctor",
|
|
37
53
|
"@stdlib/complex-float64-ctor",
|
|
38
54
|
"@stdlib/complex-float64-reim",
|
|
39
|
-
"@stdlib/complex-float32-reim"
|
|
55
|
+
"@stdlib/complex-float32-reim",
|
|
56
|
+
"@stdlib/number-float16-ctor",
|
|
57
|
+
"@stdlib/number-float64-base-to-float16",
|
|
58
|
+
"@stdlib/number-float16-base-to-float64"
|
|
40
59
|
]
|
|
41
|
-
|
|
42
|
-
|
|
60
|
+
}
|
|
61
|
+
]
|
|
43
62
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/math-base-napi-unary",
|
|
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 unary numerical function.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -35,9 +35,12 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@stdlib/complex-float32-ctor": "^0.0.2",
|
|
38
|
-
"@stdlib/complex-float32-reim": "^0.1.
|
|
38
|
+
"@stdlib/complex-float32-reim": "^0.1.2",
|
|
39
39
|
"@stdlib/complex-float64-ctor": "^0.0.3",
|
|
40
|
-
"@stdlib/complex-float64-reim": "^0.1.
|
|
40
|
+
"@stdlib/complex-float64-reim": "^0.1.2",
|
|
41
|
+
"@stdlib/number-float16-base-to-float64": "github:stdlib-js/number-float16-base-to-float64#main",
|
|
42
|
+
"@stdlib/number-float16-ctor": "github:stdlib-js/number-float16-ctor#main",
|
|
43
|
+
"@stdlib/number-float64-base-to-float16": "github:stdlib-js/number-float64-base-to-float16#main",
|
|
41
44
|
"@stdlib/utils-library-manifest": "^0.2.2"
|
|
42
45
|
},
|
|
43
46
|
"devDependencies": {},
|