@stdlib/math-base-napi-ternary 0.3.0 → 0.3.2

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.
@@ -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_IID_D_H
20
+ #define STDLIB_MATH_BASE_NAPI_TERNARY_IID_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 two signed 32-bit integers 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 int32_t 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_IID_D( fcn );
42
+ */
43
+ #define STDLIB_MATH_BASE_NAPI_MODULE_IID_D( fcn ) \
44
+ static napi_value stdlib_math_base_napi_iid_d_wrapper( \
45
+ napi_env env, \
46
+ napi_callback_info info \
47
+ ) { \
48
+ return stdlib_math_base_napi_iid_d( env, info, fcn ); \
49
+ }; \
50
+ static napi_value stdlib_math_base_napi_iid_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_iid_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_iid_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 two signed 32-bit integers and a double-precision floating-point number and returning a double-precision floating-point number.
77
+ */
78
+ napi_value stdlib_math_base_napi_iid_d( napi_env env, napi_callback_info info, double (*fcn)( int32_t, int32_t, double ) );
79
+
80
+ #ifdef __cplusplus
81
+ }
82
+ #endif
83
+
84
+ #endif // !STDLIB_MATH_BASE_NAPI_TERNARY_IID_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_III_D_H
20
+ #define STDLIB_MATH_BASE_NAPI_TERNARY_III_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 three 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 int32_t 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_III_D( fcn );
42
+ */
43
+ #define STDLIB_MATH_BASE_NAPI_MODULE_III_D( fcn ) \
44
+ static napi_value stdlib_math_base_napi_iii_d_wrapper( \
45
+ napi_env env, \
46
+ napi_callback_info info \
47
+ ) { \
48
+ return stdlib_math_base_napi_iii_d( env, info, fcn ); \
49
+ }; \
50
+ static napi_value stdlib_math_base_napi_iii_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_iii_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_iii_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 three signed 32-bit integers and returning a double-precision floating-point number.
77
+ */
78
+ napi_value stdlib_math_base_napi_iii_d( napi_env env, napi_callback_info info, double (*fcn)( int32_t, int32_t, int32_t ) );
79
+
80
+ #ifdef __cplusplus
81
+ }
82
+ #endif
83
+
84
+ #endif // !STDLIB_MATH_BASE_NAPI_TERNARY_III_D_H
@@ -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_ZZZ_Z_H
20
+ #define STDLIB_MATH_BASE_NAPI_TERNARY_ZZZ_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 ternary function accepting and returning double-precision complex floating-point numbers.
28
+ *
29
+ * @param fcn ternary function
30
+ *
31
+ * @example
32
+ * #include "stdlib/complex/float64/ctor.h"
33
+ * #include "stdlib/complex/float64/reim.h"
34
+ *
35
+ * static stdlib_complex128_t add( const stdlib_complex128_t x, const stdlib_complex128_t y, const stdlib_complex128_t z ) {
36
+ * double xre;
37
+ * double xim;
38
+ * double yre;
39
+ * double yim;
40
+ * double zre;
41
+ * double zim;
42
+ * double re;
43
+ * double im;
44
+ *
45
+ * stdlib_complex128_reim( x, &xre, &xim );
46
+ * stdlib_complex128_reim( y, &yre, &yim );
47
+ * stdlib_complex128_reim( z, &zre, &zim );
48
+ *
49
+ * re = xre + yre + zre;
50
+ * im = xim + yim + zim;
51
+ *
52
+ * return stdlib_complex128( re, im );
53
+ * }
54
+ *
55
+ * // ...
56
+ *
57
+ * // Register a Node-API module:
58
+ * STDLIB_MATH_BASE_NAPI_MODULE_ZZZ_Z( add );
59
+ */
60
+ #define STDLIB_MATH_BASE_NAPI_MODULE_ZZZ_Z( fcn ) \
61
+ static napi_value stdlib_math_base_napi_zzz_z_wrapper( \
62
+ napi_env env, \
63
+ napi_callback_info info \
64
+ ) { \
65
+ return stdlib_math_base_napi_zzz_z( env, info, fcn ); \
66
+ }; \
67
+ static napi_value stdlib_math_base_napi_zzz_z_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_zzz_z_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_zzz_z_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 double-precision complex floating-point numbers.
94
+ */
95
+ napi_value stdlib_math_base_napi_zzz_z( napi_env env, napi_callback_info info, stdlib_complex128_t (*fcn)( stdlib_complex128_t, stdlib_complex128_t, stdlib_complex128_t ) );
96
+
97
+ #ifdef __cplusplus
98
+ }
99
+ #endif
100
+
101
+ #endif // !STDLIB_MATH_BASE_NAPI_TERNARY_ZZZ_Z_H
@@ -19,155 +19,16 @@
19
19
  #ifndef STDLIB_MATH_BASE_NAPI_TERNARY_H
20
20
  #define STDLIB_MATH_BASE_NAPI_TERNARY_H
21
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 fcn; \
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
- &fcn \
59
- ); \
60
- assert( status == napi_ok ); \
61
- return fcn; \
62
- }; \
63
- NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_ddd_d_init )
64
-
65
- /**
66
- * Macro for registering a Node-API module exporting an interface invoking a ternary function accepting and returning single-precision floating-point numbers.
67
- *
68
- * @param fcn ternary function
69
- *
70
- * @example
71
- * static float addf( const float x, const float y, const float z ) {
72
- * return x + y + z;
73
- * }
74
- *
75
- * // ...
76
- *
77
- * // Register a Node-API module:
78
- * STDLIB_MATH_BASE_NAPI_MODULE_FFF_F( addf );
79
- */
80
- #define STDLIB_MATH_BASE_NAPI_MODULE_FFF_F( fcn ) \
81
- static napi_value stdlib_math_base_napi_fff_f_wrapper( \
82
- napi_env env, \
83
- napi_callback_info info \
84
- ) { \
85
- return stdlib_math_base_napi_fff_f( env, info, fcn ); \
86
- }; \
87
- static napi_value stdlib_math_base_napi_fff_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_fff_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_fff_f_init )
104
-
105
- /**
106
- * 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.
107
- *
108
- * @param fcn ternary function
109
- *
110
- * @example
111
- * #include <stdint.h>
112
- *
113
- * static double fcn( const double x, const int_32 y, const int_32 z ) {
114
- * // ...
115
- * }
116
- *
117
- * // ...
118
- *
119
- * // Register a Node-API module:
120
- * STDLIB_MATH_BASE_NAPI_MODULE_DII_D( fcn );
121
- */
122
- #define STDLIB_MATH_BASE_NAPI_MODULE_DII_D( fcn ) \
123
- static napi_value stdlib_math_base_napi_dii_d_wrapper( \
124
- napi_env env, \
125
- napi_callback_info info \
126
- ) { \
127
- return stdlib_math_base_napi_dii_d( env, info, fcn ); \
128
- }; \
129
- static napi_value stdlib_math_base_napi_dii_d_init( \
130
- napi_env env, \
131
- napi_value exports \
132
- ) { \
133
- napi_value fcn; \
134
- napi_status status = napi_create_function( \
135
- env, \
136
- "exports", \
137
- NAPI_AUTO_LENGTH, \
138
- stdlib_math_base_napi_dii_d_wrapper, \
139
- NULL, \
140
- &fcn \
141
- ); \
142
- assert( status == napi_ok ); \
143
- return fcn; \
144
- }; \
145
- NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_dii_d_init )
146
-
147
- /*
148
- * If C++, prevent name mangling so that the compiler emits a ternary file having undecorated names, thus mirroring the behavior of a C compiler.
149
- */
150
- #ifdef __cplusplus
151
- extern "C" {
152
- #endif
153
-
154
- /**
155
- * Invokes a ternary function accepting and returning double-precision floating-point numbers.
156
- */
157
- napi_value stdlib_math_base_napi_ddd_d( napi_env env, napi_callback_info info, double (*fcn)( double, double, double ) );
158
-
159
- /**
160
- * Invokes a ternary function accepting and returning single-precision floating-point numbers.
161
- */
162
- napi_value stdlib_math_base_napi_fff_f( napi_env env, napi_callback_info info, float (*fcn)( float, float, float ) );
163
-
164
- /**
165
- * 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.
166
- */
167
- napi_value stdlib_math_base_napi_dii_d( napi_env env, napi_callback_info info, double (*fcn)( double, int32_t, int32_t ) );
168
-
169
- #ifdef __cplusplus
170
- }
171
- #endif
22
+ // NOTE: keep in alphabetical order...
23
+ #include "stdlib/math/base/napi/ternary/ccc_c.h"
24
+ #include "stdlib/math/base/napi/ternary/ddd_d.h"
25
+ #include "stdlib/math/base/napi/ternary/did_d.h"
26
+ #include "stdlib/math/base/napi/ternary/dii_d.h"
27
+ #include "stdlib/math/base/napi/ternary/fff_f.h"
28
+ #include "stdlib/math/base/napi/ternary/fif_f.h"
29
+ #include "stdlib/math/base/napi/ternary/fii_f.h"
30
+ #include "stdlib/math/base/napi/ternary/iid_d.h"
31
+ #include "stdlib/math/base/napi/ternary/iii_d.h"
32
+ #include "stdlib/math/base/napi/ternary/zzz_z.h"
172
33
 
173
34
  #endif // !STDLIB_MATH_BASE_NAPI_TERNARY_H
package/manifest.json CHANGED
@@ -1,38 +1,52 @@
1
1
  {
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/main.c"
29
- ],
30
- "include": [
31
- "./include"
32
- ],
33
- "libraries": [],
34
- "libpath": [],
35
- "dependencies": []
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/ccc_c.c",
29
+ "./src/ddd_d.c",
30
+ "./src/did_d.c",
31
+ "./src/dii_d.c",
32
+ "./src/fff_f.c",
33
+ "./src/fif_f.c",
34
+ "./src/fii_f.c",
35
+ "./src/iid_d.c",
36
+ "./src/iii_d.c",
37
+ "./src/zzz_z.c"
38
+ ],
39
+ "include": [
40
+ "./include"
41
+ ],
42
+ "libraries": [],
43
+ "libpath": [],
44
+ "dependencies": [
45
+ "@stdlib/complex-float32-ctor",
46
+ "@stdlib/complex-float64-ctor",
47
+ "@stdlib/complex-float64-reim",
48
+ "@stdlib/complex-float32-reim"
49
+ ]
50
+ }
51
+ ]
38
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/math-base-napi-ternary",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "C APIs for registering a Node-API module exporting an interface for invoking a ternary numerical function.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -34,7 +34,11 @@
34
34
  "url": "https://github.com/stdlib-js/stdlib/issues"
35
35
  },
36
36
  "dependencies": {
37
- "@stdlib/utils-library-manifest": "^0.2.1"
37
+ "@stdlib/complex-float32-ctor": "^0.1.0",
38
+ "@stdlib/complex-float32-reim": "^0.1.3",
39
+ "@stdlib/complex-float64-ctor": "^0.1.1",
40
+ "@stdlib/complex-float64-reim": "^0.1.3",
41
+ "@stdlib/utils-library-manifest": "^0.2.3"
38
42
  },
39
43
  "devDependencies": {},
40
44
  "engines": {
@@ -65,11 +69,6 @@
65
69
  "map",
66
70
  "transform"
67
71
  ],
68
- "__stdlib__": {
69
- "envs": {
70
- "browser": false
71
- }
72
- },
73
72
  "funding": {
74
73
  "type": "opencollective",
75
74
  "url": "https://opencollective.com/stdlib"