@stdlib/math-base-napi-ternary 0.3.0 → 0.3.1
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 +537 -26
- package/include/stdlib/math/base/napi/ternary/ccc_c.h +101 -0
- package/include/stdlib/math/base/napi/ternary/ddd_d.h +81 -0
- package/include/stdlib/math/base/napi/ternary/did_d.h +84 -0
- package/include/stdlib/math/base/napi/ternary/dii_d.h +84 -0
- package/include/stdlib/math/base/napi/ternary/fff_f.h +81 -0
- package/include/stdlib/math/base/napi/ternary/fif_f.h +84 -0
- package/include/stdlib/math/base/napi/ternary/fii_f.h +84 -0
- package/include/stdlib/math/base/napi/ternary/iid_d.h +84 -0
- package/include/stdlib/math/base/napi/ternary/iii_d.h +84 -0
- package/include/stdlib/math/base/napi/ternary/zzz_z.h +101 -0
- package/include/stdlib/math/base/napi/ternary.h +11 -150
- package/manifest.json +50 -36
- package/package.json +6 -2
- package/src/ccc_c.c +230 -0
- package/src/ddd_d.c +97 -0
- package/src/did_d.c +98 -0
- package/src/dii_d.c +98 -0
- package/src/fff_f.c +97 -0
- package/src/fif_f.c +98 -0
- package/src/fii_f.c +98 -0
- package/src/iid_d.c +98 -0
- package/src/iii_d.c +98 -0
- package/src/zzz_z.c +230 -0
- package/src/main.c +0 -250
|
@@ -0,0 +1,101 @@
|
|
|
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_TERNARY_CCC_C_H
|
|
20
|
+
#define STDLIB_MATH_BASE_NAPI_TERNARY_CCC_C_H
|
|
21
|
+
|
|
22
|
+
#include "stdlib/complex/float32/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 ternary function accepting and returning single-precision complex floating-point numbers.
|
|
28
|
+
*
|
|
29
|
+
* @param fcn ternary function
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* #include "stdlib/complex/float32/ctor.h"
|
|
33
|
+
* #include "stdlib/complex/float32/reim.h"
|
|
34
|
+
*
|
|
35
|
+
* static stdlib_complex64_t add( const stdlib_complex64_t x, const stdlib_complex64_t y, const stdlib_complex64_t z ) {
|
|
36
|
+
* float xre;
|
|
37
|
+
* float xim;
|
|
38
|
+
* float yre;
|
|
39
|
+
* float yim;
|
|
40
|
+
* float zre;
|
|
41
|
+
* float zim;
|
|
42
|
+
* float re;
|
|
43
|
+
* float im;
|
|
44
|
+
*
|
|
45
|
+
* stdlib_complex64_reim( x, &xre, &xim );
|
|
46
|
+
* stdlib_complex64_reim( y, &yre, &yim );
|
|
47
|
+
* stdlib_complex64_reim( z, &zre, &zim );
|
|
48
|
+
*
|
|
49
|
+
* re = xre + yre + zre;
|
|
50
|
+
* im = xim + yim + zim;
|
|
51
|
+
*
|
|
52
|
+
* return stdlib_complex64( re, im );
|
|
53
|
+
* }
|
|
54
|
+
*
|
|
55
|
+
* // ...
|
|
56
|
+
*
|
|
57
|
+
* // Register a Node-API module:
|
|
58
|
+
* STDLIB_MATH_BASE_NAPI_MODULE_CCC_C( add );
|
|
59
|
+
*/
|
|
60
|
+
#define STDLIB_MATH_BASE_NAPI_MODULE_CCC_C( fcn ) \
|
|
61
|
+
static napi_value stdlib_math_base_napi_ccc_c_wrapper( \
|
|
62
|
+
napi_env env, \
|
|
63
|
+
napi_callback_info info \
|
|
64
|
+
) { \
|
|
65
|
+
return stdlib_math_base_napi_ccc_c( env, info, fcn ); \
|
|
66
|
+
}; \
|
|
67
|
+
static napi_value stdlib_math_base_napi_ccc_c_init( \
|
|
68
|
+
napi_env env, \
|
|
69
|
+
napi_value exports \
|
|
70
|
+
) { \
|
|
71
|
+
napi_value f; \
|
|
72
|
+
napi_status status = napi_create_function( \
|
|
73
|
+
env, \
|
|
74
|
+
"exports", \
|
|
75
|
+
NAPI_AUTO_LENGTH, \
|
|
76
|
+
stdlib_math_base_napi_ccc_c_wrapper, \
|
|
77
|
+
NULL, \
|
|
78
|
+
&f \
|
|
79
|
+
); \
|
|
80
|
+
assert( status == napi_ok ); \
|
|
81
|
+
return f; \
|
|
82
|
+
}; \
|
|
83
|
+
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_ccc_c_init )
|
|
84
|
+
|
|
85
|
+
/*
|
|
86
|
+
* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
|
|
87
|
+
*/
|
|
88
|
+
#ifdef __cplusplus
|
|
89
|
+
extern "C" {
|
|
90
|
+
#endif
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Invokes a ternary function accepting and returning single-precision complex floating-point numbers.
|
|
94
|
+
*/
|
|
95
|
+
napi_value stdlib_math_base_napi_ccc_c( napi_env env, napi_callback_info info, stdlib_complex64_t (*fcn)( stdlib_complex64_t, stdlib_complex64_t, stdlib_complex64_t ) );
|
|
96
|
+
|
|
97
|
+
#ifdef __cplusplus
|
|
98
|
+
}
|
|
99
|
+
#endif
|
|
100
|
+
|
|
101
|
+
#endif // !STDLIB_MATH_BASE_NAPI_TERNARY_CCC_C_H
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2020 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_TERNARY_DDD_D_H
|
|
20
|
+
#define STDLIB_MATH_BASE_NAPI_TERNARY_DDD_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 ternary function accepting and returning double-precision floating-point numbers.
|
|
27
|
+
*
|
|
28
|
+
* @param fcn ternary function
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* static double add( const double x, const double y, const double z ) {
|
|
32
|
+
* return x + y + z;
|
|
33
|
+
* }
|
|
34
|
+
*
|
|
35
|
+
* // ...
|
|
36
|
+
*
|
|
37
|
+
* // Register a Node-API module:
|
|
38
|
+
* STDLIB_MATH_BASE_NAPI_MODULE_DDD_D( add );
|
|
39
|
+
*/
|
|
40
|
+
#define STDLIB_MATH_BASE_NAPI_MODULE_DDD_D( fcn ) \
|
|
41
|
+
static napi_value stdlib_math_base_napi_ddd_d_wrapper( \
|
|
42
|
+
napi_env env, \
|
|
43
|
+
napi_callback_info info \
|
|
44
|
+
) { \
|
|
45
|
+
return stdlib_math_base_napi_ddd_d( env, info, fcn ); \
|
|
46
|
+
}; \
|
|
47
|
+
static napi_value stdlib_math_base_napi_ddd_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_ddd_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_ddd_d_init )
|
|
64
|
+
|
|
65
|
+
/*
|
|
66
|
+
* If C++, prevent name mangling so that the compiler emits a ternary 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 ternary function accepting and returning double-precision floating-point numbers.
|
|
74
|
+
*/
|
|
75
|
+
napi_value stdlib_math_base_napi_ddd_d( napi_env env, napi_callback_info info, double (*fcn)( double, double, double ) );
|
|
76
|
+
|
|
77
|
+
#ifdef __cplusplus
|
|
78
|
+
}
|
|
79
|
+
#endif
|
|
80
|
+
|
|
81
|
+
#endif // !STDLIB_MATH_BASE_NAPI_TERNARY_DDD_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_TERNARY_DID_D_H
|
|
20
|
+
#define STDLIB_MATH_BASE_NAPI_TERNARY_DID_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 ternary function accepting a double-precision floating-point number, a signed 32-bit integer, and a double-precision floating-point number and returning a double-precision floating-point number.
|
|
28
|
+
*
|
|
29
|
+
* @param fcn ternary function
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* #include <stdint.h>
|
|
33
|
+
*
|
|
34
|
+
* static double fcn( const double x, const int32_t y, const double z ) {
|
|
35
|
+
* // ...
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* // ...
|
|
39
|
+
*
|
|
40
|
+
* // Register a Node-API module:
|
|
41
|
+
* STDLIB_MATH_BASE_NAPI_MODULE_DID_D( fcn );
|
|
42
|
+
*/
|
|
43
|
+
#define STDLIB_MATH_BASE_NAPI_MODULE_DID_D( fcn ) \
|
|
44
|
+
static napi_value stdlib_math_base_napi_did_d_wrapper( \
|
|
45
|
+
napi_env env, \
|
|
46
|
+
napi_callback_info info \
|
|
47
|
+
) { \
|
|
48
|
+
return stdlib_math_base_napi_did_d( env, info, fcn ); \
|
|
49
|
+
}; \
|
|
50
|
+
static napi_value stdlib_math_base_napi_did_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_did_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_did_d_init )
|
|
67
|
+
|
|
68
|
+
/*
|
|
69
|
+
* If C++, prevent name mangling so that the compiler emits a ternary 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 ternary function accepting a double-precision floating-point number, a signed 32-bit integer, and a double-precision floating-point number and returning a double-precision floating-point number.
|
|
77
|
+
*/
|
|
78
|
+
napi_value stdlib_math_base_napi_did_d( napi_env env, napi_callback_info info, double (*fcn)( double, int32_t, double ) );
|
|
79
|
+
|
|
80
|
+
#ifdef __cplusplus
|
|
81
|
+
}
|
|
82
|
+
#endif
|
|
83
|
+
|
|
84
|
+
#endif // !STDLIB_MATH_BASE_NAPI_TERNARY_DID_D_H
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2020 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_TERNARY_DII_D_H
|
|
20
|
+
#define STDLIB_MATH_BASE_NAPI_TERNARY_DII_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 ternary function accepting a double-precision floating-point number and two signed 32-bit integers and returning a double-precision floating-point number.
|
|
28
|
+
*
|
|
29
|
+
* @param fcn ternary function
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* #include <stdint.h>
|
|
33
|
+
*
|
|
34
|
+
* static double fcn( const double x, const int32_t y, const int32_t z ) {
|
|
35
|
+
* // ...
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* // ...
|
|
39
|
+
*
|
|
40
|
+
* // Register a Node-API module:
|
|
41
|
+
* STDLIB_MATH_BASE_NAPI_MODULE_DII_D( fcn );
|
|
42
|
+
*/
|
|
43
|
+
#define STDLIB_MATH_BASE_NAPI_MODULE_DII_D( fcn ) \
|
|
44
|
+
static napi_value stdlib_math_base_napi_dii_d_wrapper( \
|
|
45
|
+
napi_env env, \
|
|
46
|
+
napi_callback_info info \
|
|
47
|
+
) { \
|
|
48
|
+
return stdlib_math_base_napi_dii_d( env, info, fcn ); \
|
|
49
|
+
}; \
|
|
50
|
+
static napi_value stdlib_math_base_napi_dii_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_dii_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_dii_d_init )
|
|
67
|
+
|
|
68
|
+
/*
|
|
69
|
+
* If C++, prevent name mangling so that the compiler emits a ternary 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 ternary function accepting a double-precision floating-point number and two signed 32-bit integers and returning a double-precision floating-point number.
|
|
77
|
+
*/
|
|
78
|
+
napi_value stdlib_math_base_napi_dii_d( napi_env env, napi_callback_info info, double (*fcn)( double, int32_t, int32_t ) );
|
|
79
|
+
|
|
80
|
+
#ifdef __cplusplus
|
|
81
|
+
}
|
|
82
|
+
#endif
|
|
83
|
+
|
|
84
|
+
#endif // !STDLIB_MATH_BASE_NAPI_TERNARY_DII_D_H
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2020 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_TERNARY_FFF_F_H
|
|
20
|
+
#define STDLIB_MATH_BASE_NAPI_TERNARY_FFF_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 ternary function accepting and returning single-precision floating-point numbers.
|
|
27
|
+
*
|
|
28
|
+
* @param fcn ternary function
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* static float addf( const float x, const float y, const float z ) {
|
|
32
|
+
* return x + y + z;
|
|
33
|
+
* }
|
|
34
|
+
*
|
|
35
|
+
* // ...
|
|
36
|
+
*
|
|
37
|
+
* // Register a Node-API module:
|
|
38
|
+
* STDLIB_MATH_BASE_NAPI_MODULE_FFF_F( addf );
|
|
39
|
+
*/
|
|
40
|
+
#define STDLIB_MATH_BASE_NAPI_MODULE_FFF_F( fcn ) \
|
|
41
|
+
static napi_value stdlib_math_base_napi_fff_f_wrapper( \
|
|
42
|
+
napi_env env, \
|
|
43
|
+
napi_callback_info info \
|
|
44
|
+
) { \
|
|
45
|
+
return stdlib_math_base_napi_fff_f( env, info, fcn ); \
|
|
46
|
+
}; \
|
|
47
|
+
static napi_value stdlib_math_base_napi_fff_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_fff_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_fff_f_init )
|
|
64
|
+
|
|
65
|
+
/*
|
|
66
|
+
* If C++, prevent name mangling so that the compiler emits a ternary 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 ternary function accepting and returning single-precision floating-point numbers.
|
|
74
|
+
*/
|
|
75
|
+
napi_value stdlib_math_base_napi_fff_f( napi_env env, napi_callback_info info, float (*fcn)( float, float, float ) );
|
|
76
|
+
|
|
77
|
+
#ifdef __cplusplus
|
|
78
|
+
}
|
|
79
|
+
#endif
|
|
80
|
+
|
|
81
|
+
#endif // !STDLIB_MATH_BASE_NAPI_TERNARY_FFF_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_TERNARY_FIF_F_H
|
|
20
|
+
#define STDLIB_MATH_BASE_NAPI_TERNARY_FIF_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 ternary function accepting a single-precision floating-point number, a signed 32-bit integer, and a single-precision floating-point number and returning a single-precision floating-point number.
|
|
28
|
+
*
|
|
29
|
+
* @param fcn ternary function
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* #include <stdint.h>
|
|
33
|
+
*
|
|
34
|
+
* static float fcn( const float x, const int32_t y, const float z ) {
|
|
35
|
+
* // ...
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* // ...
|
|
39
|
+
*
|
|
40
|
+
* // Register a Node-API module:
|
|
41
|
+
* STDLIB_MATH_BASE_NAPI_MODULE_FIF_F( fcn );
|
|
42
|
+
*/
|
|
43
|
+
#define STDLIB_MATH_BASE_NAPI_MODULE_FIF_F( fcn ) \
|
|
44
|
+
static napi_value stdlib_math_base_napi_fif_f_wrapper( \
|
|
45
|
+
napi_env env, \
|
|
46
|
+
napi_callback_info info \
|
|
47
|
+
) { \
|
|
48
|
+
return stdlib_math_base_napi_fif_f( env, info, fcn ); \
|
|
49
|
+
}; \
|
|
50
|
+
static napi_value stdlib_math_base_napi_fif_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_fif_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_fif_f_init )
|
|
67
|
+
|
|
68
|
+
/*
|
|
69
|
+
* If C++, prevent name mangling so that the compiler emits a ternary 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 ternary function accepting a single-precision floating-point number, a signed 32-bit integer, and a single-precision floating-point number and returning a single-precision floating-point number.
|
|
77
|
+
*/
|
|
78
|
+
napi_value stdlib_math_base_napi_fif_f( napi_env env, napi_callback_info info, float (*fcn)( float, int32_t, float ) );
|
|
79
|
+
|
|
80
|
+
#ifdef __cplusplus
|
|
81
|
+
}
|
|
82
|
+
#endif
|
|
83
|
+
|
|
84
|
+
#endif // !STDLIB_MATH_BASE_NAPI_TERNARY_FIF_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_TERNARY_FII_F_H
|
|
20
|
+
#define STDLIB_MATH_BASE_NAPI_TERNARY_FII_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 ternary function accepting a single-precision floating-point number and two signed 32-bit integers and returning a single-precision floating-point number.
|
|
28
|
+
*
|
|
29
|
+
* @param fcn ternary function
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* #include <stdint.h>
|
|
33
|
+
*
|
|
34
|
+
* static float fcn( const float x, const int32_t y, const int32_t z ) {
|
|
35
|
+
* // ...
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* // ...
|
|
39
|
+
*
|
|
40
|
+
* // Register a Node-API module:
|
|
41
|
+
* STDLIB_MATH_BASE_NAPI_MODULE_FII_F( fcn );
|
|
42
|
+
*/
|
|
43
|
+
#define STDLIB_MATH_BASE_NAPI_MODULE_FII_F( fcn ) \
|
|
44
|
+
static napi_value stdlib_math_base_napi_fii_f_wrapper( \
|
|
45
|
+
napi_env env, \
|
|
46
|
+
napi_callback_info info \
|
|
47
|
+
) { \
|
|
48
|
+
return stdlib_math_base_napi_fii_f( env, info, fcn ); \
|
|
49
|
+
}; \
|
|
50
|
+
static napi_value stdlib_math_base_napi_fii_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_fii_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_fii_f_init )
|
|
67
|
+
|
|
68
|
+
/*
|
|
69
|
+
* If C++, prevent name mangling so that the compiler emits a ternary 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 ternary function accepting a single-precision floating-point number and two signed 32-bit integers and returning a single-precision floating-point number.
|
|
77
|
+
*/
|
|
78
|
+
napi_value stdlib_math_base_napi_fii_f( napi_env env, napi_callback_info info, float (*fcn)( float, int32_t, int32_t ) );
|
|
79
|
+
|
|
80
|
+
#ifdef __cplusplus
|
|
81
|
+
}
|
|
82
|
+
#endif
|
|
83
|
+
|
|
84
|
+
#endif // !STDLIB_MATH_BASE_NAPI_TERNARY_FII_F_H
|