@stdlib/math-base-napi-unary 0.2.3 → 0.2.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/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 +8 -10
- 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,84 @@
|
|
|
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_I_D_H
|
|
20
|
+
#define STDLIB_MATH_BASE_NAPI_UNARY_I_D_H
|
|
21
|
+
|
|
22
|
+
#include <node_api.h>
|
|
23
|
+
#include <assert.h>
|
|
24
|
+
#include <stdint.h>
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 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.
|
|
28
|
+
*
|
|
29
|
+
* @param fcn unary function
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* #include <stdint.h>
|
|
33
|
+
*
|
|
34
|
+
* static double scale( const int32_t x ) {
|
|
35
|
+
* return x * 10.0;
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* // ...
|
|
39
|
+
*
|
|
40
|
+
* // Register a Node-API module:
|
|
41
|
+
* STDLIB_MATH_BASE_NAPI_MODULE_I_D( scale );
|
|
42
|
+
*/
|
|
43
|
+
#define STDLIB_MATH_BASE_NAPI_MODULE_I_D( fcn ) \
|
|
44
|
+
static napi_value stdlib_math_base_napi_i_d_wrapper( \
|
|
45
|
+
napi_env env, \
|
|
46
|
+
napi_callback_info info \
|
|
47
|
+
) { \
|
|
48
|
+
return stdlib_math_base_napi_i_d( env, info, fcn ); \
|
|
49
|
+
}; \
|
|
50
|
+
static napi_value stdlib_math_base_napi_i_d_init( \
|
|
51
|
+
napi_env env, \
|
|
52
|
+
napi_value exports \
|
|
53
|
+
) { \
|
|
54
|
+
napi_value f; \
|
|
55
|
+
napi_status status = napi_create_function( \
|
|
56
|
+
env, \
|
|
57
|
+
"exports", \
|
|
58
|
+
NAPI_AUTO_LENGTH, \
|
|
59
|
+
stdlib_math_base_napi_i_d_wrapper, \
|
|
60
|
+
NULL, \
|
|
61
|
+
&f \
|
|
62
|
+
); \
|
|
63
|
+
assert( status == napi_ok ); \
|
|
64
|
+
return f; \
|
|
65
|
+
}; \
|
|
66
|
+
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_i_d_init )
|
|
67
|
+
|
|
68
|
+
/*
|
|
69
|
+
* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
|
|
70
|
+
*/
|
|
71
|
+
#ifdef __cplusplus
|
|
72
|
+
extern "C" {
|
|
73
|
+
#endif
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Invokes a unary function accepting a signed 32-bit integer and returning a single-precision floating-point number.
|
|
77
|
+
*/
|
|
78
|
+
napi_value stdlib_math_base_napi_i_d( napi_env env, napi_callback_info info, double (*fcn)( int32_t ) );
|
|
79
|
+
|
|
80
|
+
#ifdef __cplusplus
|
|
81
|
+
}
|
|
82
|
+
#endif
|
|
83
|
+
|
|
84
|
+
#endif // !STDLIB_MATH_BASE_NAPI_UNARY_I_D_H
|
|
@@ -0,0 +1,84 @@
|
|
|
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_I_F_H
|
|
20
|
+
#define STDLIB_MATH_BASE_NAPI_UNARY_I_F_H
|
|
21
|
+
|
|
22
|
+
#include <node_api.h>
|
|
23
|
+
#include <assert.h>
|
|
24
|
+
#include <stdint.h>
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Macro for registering a Node-API module exporting an interface invoking a unary function accepting a signed 32-bit integer and returning a single-precision floating-point number.
|
|
28
|
+
*
|
|
29
|
+
* @param fcn unary function
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* #include <stdint.h>
|
|
33
|
+
*
|
|
34
|
+
* static float fcn( const int32_t x ) {
|
|
35
|
+
* // ...
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* // ...
|
|
39
|
+
*
|
|
40
|
+
* // Register a Node-API module:
|
|
41
|
+
* STDLIB_MATH_BASE_NAPI_MODULE_I_F( fcn );
|
|
42
|
+
*/
|
|
43
|
+
#define STDLIB_MATH_BASE_NAPI_MODULE_I_F( fcn ) \
|
|
44
|
+
static napi_value stdlib_math_base_napi_i_f_wrapper( \
|
|
45
|
+
napi_env env, \
|
|
46
|
+
napi_callback_info info \
|
|
47
|
+
) { \
|
|
48
|
+
return stdlib_math_base_napi_i_f( env, info, fcn ); \
|
|
49
|
+
}; \
|
|
50
|
+
static napi_value stdlib_math_base_napi_i_f_init( \
|
|
51
|
+
napi_env env, \
|
|
52
|
+
napi_value exports \
|
|
53
|
+
) { \
|
|
54
|
+
napi_value f; \
|
|
55
|
+
napi_status status = napi_create_function( \
|
|
56
|
+
env, \
|
|
57
|
+
"exports", \
|
|
58
|
+
NAPI_AUTO_LENGTH, \
|
|
59
|
+
stdlib_math_base_napi_i_f_wrapper, \
|
|
60
|
+
NULL, \
|
|
61
|
+
&f \
|
|
62
|
+
); \
|
|
63
|
+
assert( status == napi_ok ); \
|
|
64
|
+
return f; \
|
|
65
|
+
}; \
|
|
66
|
+
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_i_f_init )
|
|
67
|
+
|
|
68
|
+
/*
|
|
69
|
+
* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
|
|
70
|
+
*/
|
|
71
|
+
#ifdef __cplusplus
|
|
72
|
+
extern "C" {
|
|
73
|
+
#endif
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Invokes a unary function accepting a signed 32-bit integer and returning a single-precision floating-point number.
|
|
77
|
+
*/
|
|
78
|
+
napi_value stdlib_math_base_napi_i_f( napi_env env, napi_callback_info info, float (*fcn)( int32_t ) );
|
|
79
|
+
|
|
80
|
+
#ifdef __cplusplus
|
|
81
|
+
}
|
|
82
|
+
#endif
|
|
83
|
+
|
|
84
|
+
#endif // !STDLIB_MATH_BASE_NAPI_UNARY_I_F_H
|
|
@@ -0,0 +1,84 @@
|
|
|
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_I_I_H
|
|
20
|
+
#define STDLIB_MATH_BASE_NAPI_UNARY_I_I_H
|
|
21
|
+
|
|
22
|
+
#include <node_api.h>
|
|
23
|
+
#include <assert.h>
|
|
24
|
+
#include <stdint.h>
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Macro for registering a Node-API module exporting an interface invoking a unary function accepting and returning 32-bit signed integers.
|
|
28
|
+
*
|
|
29
|
+
* @param fcn unary function
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* #include <stdint.h>
|
|
33
|
+
*
|
|
34
|
+
* static int32_t scale( const int32_t x ) {
|
|
35
|
+
* return x * 10;
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* // ...
|
|
39
|
+
*
|
|
40
|
+
* // Register a Node-API module:
|
|
41
|
+
* STDLIB_MATH_BASE_NAPI_MODULE_I_I( scale );
|
|
42
|
+
*/
|
|
43
|
+
#define STDLIB_MATH_BASE_NAPI_MODULE_I_I( fcn ) \
|
|
44
|
+
static napi_value stdlib_math_base_napi_i_i_wrapper( \
|
|
45
|
+
napi_env env, \
|
|
46
|
+
napi_callback_info info \
|
|
47
|
+
) { \
|
|
48
|
+
return stdlib_math_base_napi_i_i( env, info, fcn ); \
|
|
49
|
+
}; \
|
|
50
|
+
static napi_value stdlib_math_base_napi_i_i_init( \
|
|
51
|
+
napi_env env, \
|
|
52
|
+
napi_value exports \
|
|
53
|
+
) { \
|
|
54
|
+
napi_value f; \
|
|
55
|
+
napi_status status = napi_create_function( \
|
|
56
|
+
env, \
|
|
57
|
+
"exports", \
|
|
58
|
+
NAPI_AUTO_LENGTH, \
|
|
59
|
+
stdlib_math_base_napi_i_i_wrapper, \
|
|
60
|
+
NULL, \
|
|
61
|
+
&f \
|
|
62
|
+
); \
|
|
63
|
+
assert( status == napi_ok ); \
|
|
64
|
+
return f; \
|
|
65
|
+
}; \
|
|
66
|
+
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_i_i_init )
|
|
67
|
+
|
|
68
|
+
/*
|
|
69
|
+
* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
|
|
70
|
+
*/
|
|
71
|
+
#ifdef __cplusplus
|
|
72
|
+
extern "C" {
|
|
73
|
+
#endif
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Invokes a unary function accepting and returning signed 32-bit integers.
|
|
77
|
+
*/
|
|
78
|
+
napi_value stdlib_math_base_napi_i_i( napi_env env, napi_callback_info info, int32_t (*fcn)( int32_t ) );
|
|
79
|
+
|
|
80
|
+
#ifdef __cplusplus
|
|
81
|
+
}
|
|
82
|
+
#endif
|
|
83
|
+
|
|
84
|
+
#endif // !STDLIB_MATH_BASE_NAPI_UNARY_I_I_H
|
|
@@ -0,0 +1,84 @@
|
|
|
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_K_K_H
|
|
20
|
+
#define STDLIB_MATH_BASE_NAPI_UNARY_K_K_H
|
|
21
|
+
|
|
22
|
+
#include <node_api.h>
|
|
23
|
+
#include <assert.h>
|
|
24
|
+
#include <stdint.h>
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Macro for registering a Node-API module exporting an interface invoking a unary function accepting and returning 16-bit signed integers.
|
|
28
|
+
*
|
|
29
|
+
* @param fcn unary function
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* #include <stdint.h>
|
|
33
|
+
*
|
|
34
|
+
* static int16_t scale( const int16_t x ) {
|
|
35
|
+
* return x * 10;
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* // ...
|
|
39
|
+
*
|
|
40
|
+
* // Register a Node-API module:
|
|
41
|
+
* STDLIB_MATH_BASE_NAPI_MODULE_K_K( scale );
|
|
42
|
+
*/
|
|
43
|
+
#define STDLIB_MATH_BASE_NAPI_MODULE_K_K( fcn ) \
|
|
44
|
+
static napi_value stdlib_math_base_napi_k_k_wrapper( \
|
|
45
|
+
napi_env env, \
|
|
46
|
+
napi_callback_info info \
|
|
47
|
+
) { \
|
|
48
|
+
return stdlib_math_base_napi_k_k( env, info, fcn ); \
|
|
49
|
+
}; \
|
|
50
|
+
static napi_value stdlib_math_base_napi_k_k_init( \
|
|
51
|
+
napi_env env, \
|
|
52
|
+
napi_value exports \
|
|
53
|
+
) { \
|
|
54
|
+
napi_value f; \
|
|
55
|
+
napi_status status = napi_create_function( \
|
|
56
|
+
env, \
|
|
57
|
+
"exports", \
|
|
58
|
+
NAPI_AUTO_LENGTH, \
|
|
59
|
+
stdlib_math_base_napi_k_k_wrapper, \
|
|
60
|
+
NULL, \
|
|
61
|
+
&f \
|
|
62
|
+
); \
|
|
63
|
+
assert( status == napi_ok ); \
|
|
64
|
+
return f; \
|
|
65
|
+
}; \
|
|
66
|
+
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_k_k_init )
|
|
67
|
+
|
|
68
|
+
/*
|
|
69
|
+
* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
|
|
70
|
+
*/
|
|
71
|
+
#ifdef __cplusplus
|
|
72
|
+
extern "C" {
|
|
73
|
+
#endif
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Invokes a unary function accepting and returning signed 16-bit integers.
|
|
77
|
+
*/
|
|
78
|
+
napi_value stdlib_math_base_napi_k_k( napi_env env, napi_callback_info info, int16_t (*fcn)( int16_t ) );
|
|
79
|
+
|
|
80
|
+
#ifdef __cplusplus
|
|
81
|
+
}
|
|
82
|
+
#endif
|
|
83
|
+
|
|
84
|
+
#endif // !STDLIB_MATH_BASE_NAPI_UNARY_K_K_H
|
|
@@ -0,0 +1,84 @@
|
|
|
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_S_S_H
|
|
20
|
+
#define STDLIB_MATH_BASE_NAPI_UNARY_S_S_H
|
|
21
|
+
|
|
22
|
+
#include <node_api.h>
|
|
23
|
+
#include <assert.h>
|
|
24
|
+
#include <stdint.h>
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Macro for registering a Node-API module exporting an interface invoking a unary function accepting and returning 8-bit signed integers.
|
|
28
|
+
*
|
|
29
|
+
* @param fcn unary function
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* #include <stdint.h>
|
|
33
|
+
*
|
|
34
|
+
* static int8_t scale( const int8_t x ) {
|
|
35
|
+
* return x * 10;
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* // ...
|
|
39
|
+
*
|
|
40
|
+
* // Register a Node-API module:
|
|
41
|
+
* STDLIB_MATH_BASE_NAPI_MODULE_S_S( scale );
|
|
42
|
+
*/
|
|
43
|
+
#define STDLIB_MATH_BASE_NAPI_MODULE_S_S( fcn ) \
|
|
44
|
+
static napi_value stdlib_math_base_napi_s_s_wrapper( \
|
|
45
|
+
napi_env env, \
|
|
46
|
+
napi_callback_info info \
|
|
47
|
+
) { \
|
|
48
|
+
return stdlib_math_base_napi_s_s( env, info, fcn ); \
|
|
49
|
+
}; \
|
|
50
|
+
static napi_value stdlib_math_base_napi_s_s_init( \
|
|
51
|
+
napi_env env, \
|
|
52
|
+
napi_value exports \
|
|
53
|
+
) { \
|
|
54
|
+
napi_value f; \
|
|
55
|
+
napi_status status = napi_create_function( \
|
|
56
|
+
env, \
|
|
57
|
+
"exports", \
|
|
58
|
+
NAPI_AUTO_LENGTH, \
|
|
59
|
+
stdlib_math_base_napi_s_s_wrapper, \
|
|
60
|
+
NULL, \
|
|
61
|
+
&f \
|
|
62
|
+
); \
|
|
63
|
+
assert( status == napi_ok ); \
|
|
64
|
+
return f; \
|
|
65
|
+
}; \
|
|
66
|
+
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_s_s_init )
|
|
67
|
+
|
|
68
|
+
/*
|
|
69
|
+
* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
|
|
70
|
+
*/
|
|
71
|
+
#ifdef __cplusplus
|
|
72
|
+
extern "C" {
|
|
73
|
+
#endif
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Invokes a unary function accepting and returning signed 8-bit integers.
|
|
77
|
+
*/
|
|
78
|
+
napi_value stdlib_math_base_napi_s_s( napi_env env, napi_callback_info info, int8_t (*fcn)( int8_t ) );
|
|
79
|
+
|
|
80
|
+
#ifdef __cplusplus
|
|
81
|
+
}
|
|
82
|
+
#endif
|
|
83
|
+
|
|
84
|
+
#endif // !STDLIB_MATH_BASE_NAPI_UNARY_S_S_H
|
|
@@ -0,0 +1,84 @@
|
|
|
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_T_T_H
|
|
20
|
+
#define STDLIB_MATH_BASE_NAPI_UNARY_T_T_H
|
|
21
|
+
|
|
22
|
+
#include <node_api.h>
|
|
23
|
+
#include <assert.h>
|
|
24
|
+
#include <stdint.h>
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Macro for registering a Node-API module exporting an interface invoking a unary function accepting and returning 16-bit unsigned integers.
|
|
28
|
+
*
|
|
29
|
+
* @param fcn unary function
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* #include <stdint.h>
|
|
33
|
+
*
|
|
34
|
+
* static uint16_t scale( const uint16_t x ) {
|
|
35
|
+
* return x * 10;
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* // ...
|
|
39
|
+
*
|
|
40
|
+
* // Register a Node-API module:
|
|
41
|
+
* STDLIB_MATH_BASE_NAPI_MODULE_T_T( scale );
|
|
42
|
+
*/
|
|
43
|
+
#define STDLIB_MATH_BASE_NAPI_MODULE_T_T( fcn ) \
|
|
44
|
+
static napi_value stdlib_math_base_napi_t_t_wrapper( \
|
|
45
|
+
napi_env env, \
|
|
46
|
+
napi_callback_info info \
|
|
47
|
+
) { \
|
|
48
|
+
return stdlib_math_base_napi_t_t( env, info, fcn ); \
|
|
49
|
+
}; \
|
|
50
|
+
static napi_value stdlib_math_base_napi_t_t_init( \
|
|
51
|
+
napi_env env, \
|
|
52
|
+
napi_value exports \
|
|
53
|
+
) { \
|
|
54
|
+
napi_value f; \
|
|
55
|
+
napi_status status = napi_create_function( \
|
|
56
|
+
env, \
|
|
57
|
+
"exports", \
|
|
58
|
+
NAPI_AUTO_LENGTH, \
|
|
59
|
+
stdlib_math_base_napi_t_t_wrapper, \
|
|
60
|
+
NULL, \
|
|
61
|
+
&f \
|
|
62
|
+
); \
|
|
63
|
+
assert( status == napi_ok ); \
|
|
64
|
+
return f; \
|
|
65
|
+
}; \
|
|
66
|
+
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_t_t_init )
|
|
67
|
+
|
|
68
|
+
/*
|
|
69
|
+
* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
|
|
70
|
+
*/
|
|
71
|
+
#ifdef __cplusplus
|
|
72
|
+
extern "C" {
|
|
73
|
+
#endif
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Invokes a unary function accepting and returning unsigned 16-bit integers.
|
|
77
|
+
*/
|
|
78
|
+
napi_value stdlib_math_base_napi_t_t( napi_env env, napi_callback_info info, uint16_t (*fcn)( uint16_t ) );
|
|
79
|
+
|
|
80
|
+
#ifdef __cplusplus
|
|
81
|
+
}
|
|
82
|
+
#endif
|
|
83
|
+
|
|
84
|
+
#endif // !STDLIB_MATH_BASE_NAPI_UNARY_T_T_H
|
|
@@ -0,0 +1,84 @@
|
|
|
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_U_U_H
|
|
20
|
+
#define STDLIB_MATH_BASE_NAPI_UNARY_U_U_H
|
|
21
|
+
|
|
22
|
+
#include <node_api.h>
|
|
23
|
+
#include <assert.h>
|
|
24
|
+
#include <stdint.h>
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Macro for registering a Node-API module exporting an interface invoking a unary function accepting and returning 32-bit unsigned integers.
|
|
28
|
+
*
|
|
29
|
+
* @param fcn unary function
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* #include <stdint.h>
|
|
33
|
+
*
|
|
34
|
+
* static uint32_t scale( const uint32_t x ) {
|
|
35
|
+
* return x * 10;
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* // ...
|
|
39
|
+
*
|
|
40
|
+
* // Register a Node-API module:
|
|
41
|
+
* STDLIB_MATH_BASE_NAPI_MODULE_U_U( scale );
|
|
42
|
+
*/
|
|
43
|
+
#define STDLIB_MATH_BASE_NAPI_MODULE_U_U( fcn ) \
|
|
44
|
+
static napi_value stdlib_math_base_napi_u_u_wrapper( \
|
|
45
|
+
napi_env env, \
|
|
46
|
+
napi_callback_info info \
|
|
47
|
+
) { \
|
|
48
|
+
return stdlib_math_base_napi_u_u( env, info, fcn ); \
|
|
49
|
+
}; \
|
|
50
|
+
static napi_value stdlib_math_base_napi_u_u_init( \
|
|
51
|
+
napi_env env, \
|
|
52
|
+
napi_value exports \
|
|
53
|
+
) { \
|
|
54
|
+
napi_value f; \
|
|
55
|
+
napi_status status = napi_create_function( \
|
|
56
|
+
env, \
|
|
57
|
+
"exports", \
|
|
58
|
+
NAPI_AUTO_LENGTH, \
|
|
59
|
+
stdlib_math_base_napi_u_u_wrapper, \
|
|
60
|
+
NULL, \
|
|
61
|
+
&f \
|
|
62
|
+
); \
|
|
63
|
+
assert( status == napi_ok ); \
|
|
64
|
+
return f; \
|
|
65
|
+
}; \
|
|
66
|
+
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_u_u_init )
|
|
67
|
+
|
|
68
|
+
/*
|
|
69
|
+
* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
|
|
70
|
+
*/
|
|
71
|
+
#ifdef __cplusplus
|
|
72
|
+
extern "C" {
|
|
73
|
+
#endif
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Invokes a unary function accepting and returning unsigned 32-bit integers.
|
|
77
|
+
*/
|
|
78
|
+
napi_value stdlib_math_base_napi_u_u( napi_env env, napi_callback_info info, uint32_t (*fcn)( uint32_t ) );
|
|
79
|
+
|
|
80
|
+
#ifdef __cplusplus
|
|
81
|
+
}
|
|
82
|
+
#endif
|
|
83
|
+
|
|
84
|
+
#endif // !STDLIB_MATH_BASE_NAPI_UNARY_U_U_H
|
|
@@ -0,0 +1,84 @@
|
|
|
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_D_H
|
|
20
|
+
#define STDLIB_MATH_BASE_NAPI_UNARY_Z_D_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 a double-precision complex floating-point number and returning a double-precision floating-point number.
|
|
28
|
+
*
|
|
29
|
+
* @param fcn unary function
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* #include "stdlib/complex/float64/ctor.h"
|
|
33
|
+
*
|
|
34
|
+
* static double fcn( const stdlib_complex128_t x ) {
|
|
35
|
+
* // ...
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* // ...
|
|
39
|
+
*
|
|
40
|
+
* // Register a Node-API module:
|
|
41
|
+
* STDLIB_MATH_BASE_NAPI_MODULE_Z_D( fcn );
|
|
42
|
+
*/
|
|
43
|
+
#define STDLIB_MATH_BASE_NAPI_MODULE_Z_D( fcn ) \
|
|
44
|
+
static napi_value stdlib_math_base_napi_z_d_wrapper( \
|
|
45
|
+
napi_env env, \
|
|
46
|
+
napi_callback_info info \
|
|
47
|
+
) { \
|
|
48
|
+
return stdlib_math_base_napi_z_d( env, info, fcn ); \
|
|
49
|
+
}; \
|
|
50
|
+
static napi_value stdlib_math_base_napi_z_d_init( \
|
|
51
|
+
napi_env env, \
|
|
52
|
+
napi_value exports \
|
|
53
|
+
) { \
|
|
54
|
+
napi_value f; \
|
|
55
|
+
napi_status status = napi_create_function( \
|
|
56
|
+
env, \
|
|
57
|
+
"exports", \
|
|
58
|
+
NAPI_AUTO_LENGTH, \
|
|
59
|
+
stdlib_math_base_napi_z_d_wrapper, \
|
|
60
|
+
NULL, \
|
|
61
|
+
&f \
|
|
62
|
+
); \
|
|
63
|
+
assert( status == napi_ok ); \
|
|
64
|
+
return f; \
|
|
65
|
+
}; \
|
|
66
|
+
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_z_d_init )
|
|
67
|
+
|
|
68
|
+
/*
|
|
69
|
+
* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
|
|
70
|
+
*/
|
|
71
|
+
#ifdef __cplusplus
|
|
72
|
+
extern "C" {
|
|
73
|
+
#endif
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Invokes a unary function accepting a double-precision complex floating-point number and returning a double-precision floating-point number.
|
|
77
|
+
*/
|
|
78
|
+
napi_value stdlib_math_base_napi_z_d( napi_env env, napi_callback_info info, double (*fcn)( stdlib_complex128_t ) );
|
|
79
|
+
|
|
80
|
+
#ifdef __cplusplus
|
|
81
|
+
}
|
|
82
|
+
#endif
|
|
83
|
+
|
|
84
|
+
#endif // !STDLIB_MATH_BASE_NAPI_UNARY_Z_D_H
|