@stdlib/math-base-napi-ternary 0.0.4 → 0.0.8
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 +40 -24
- package/include/stdlib/math/base/napi/ternary.h +4 -4
- package/package.json +5 -4
- package/src/main.c +2 -2
- package/CHANGELOG.md +0 -5
- package/binding.gyp +0 -170
package/NOTICE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Copyright (c) 2016-
|
|
1
|
+
Copyright (c) 2016-2022 The Stdlib Authors.
|
package/README.md
CHANGED
|
@@ -20,9 +20,9 @@ limitations under the License.
|
|
|
20
20
|
|
|
21
21
|
# ternary
|
|
22
22
|
|
|
23
|
-
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] [![dependencies][dependencies-image]][dependencies-url]
|
|
23
|
+
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
|
|
24
24
|
|
|
25
|
-
> C APIs for registering
|
|
25
|
+
> C APIs for registering a Node-API module exporting interfaces for invoking ternary numerical functions.
|
|
26
26
|
|
|
27
27
|
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
|
|
28
28
|
|
|
@@ -108,16 +108,6 @@ console.log( headerDir );
|
|
|
108
108
|
|
|
109
109
|
<!-- C usage documentation. -->
|
|
110
110
|
|
|
111
|
-
<section class="installation">
|
|
112
|
-
|
|
113
|
-
## Installation
|
|
114
|
-
|
|
115
|
-
```bash
|
|
116
|
-
npm install @stdlib/math-base-napi-ternary
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
</section>
|
|
120
|
-
|
|
121
111
|
<section class="usage">
|
|
122
112
|
|
|
123
113
|
### Usage
|
|
@@ -142,11 +132,11 @@ static double add( const double x, const double y, const double z ) {
|
|
|
142
132
|
// ...
|
|
143
133
|
|
|
144
134
|
/**
|
|
145
|
-
* Receives JavaScript callback invocation data
|
|
135
|
+
* Receives JavaScript callback invocation data.
|
|
146
136
|
*
|
|
147
137
|
* @param env environment under which the function is invoked
|
|
148
138
|
* @param info callback data
|
|
149
|
-
* @return
|
|
139
|
+
* @return Node-API value
|
|
150
140
|
*/
|
|
151
141
|
napi_value addon( napi_env env, napi_callback_info info ) {
|
|
152
142
|
return stdlib_math_base_napi_ddd_d( env, info, add );
|
|
@@ -181,11 +171,11 @@ static float addf( const float x, const float y, const float z ) {
|
|
|
181
171
|
// ...
|
|
182
172
|
|
|
183
173
|
/**
|
|
184
|
-
* Receives JavaScript callback invocation data
|
|
174
|
+
* Receives JavaScript callback invocation data.
|
|
185
175
|
*
|
|
186
176
|
* @param env environment under which the function is invoked
|
|
187
177
|
* @param info callback data
|
|
188
|
-
* @return
|
|
178
|
+
* @return Node-API value
|
|
189
179
|
*/
|
|
190
180
|
napi_value addon( napi_env env, napi_callback_info info ) {
|
|
191
181
|
return stdlib_math_base_napi_fff_f( env, info, addf );
|
|
@@ -206,7 +196,7 @@ void stdlib_math_base_napi_fff_f( napi_env env, napi_callback_info info, float (
|
|
|
206
196
|
|
|
207
197
|
#### STDLIB_MATH_BASE_NAPI_MODULE_DDD_D( fcn )
|
|
208
198
|
|
|
209
|
-
Macro for registering
|
|
199
|
+
Macro for registering a Node-API module exporting an interface for invoking a ternary function accepting and returning double-precision floating-point numbers.
|
|
210
200
|
|
|
211
201
|
```c
|
|
212
202
|
static double add( const double x, const double y, const double z ) {
|
|
@@ -215,7 +205,7 @@ static double add( const double x, const double y, const double z ) {
|
|
|
215
205
|
|
|
216
206
|
// ...
|
|
217
207
|
|
|
218
|
-
// Register
|
|
208
|
+
// Register a Node-API module:
|
|
219
209
|
STDLIB_MATH_BASE_NAPI_MODULE_DDD_D( add );
|
|
220
210
|
```
|
|
221
211
|
|
|
@@ -223,11 +213,11 @@ The macro expects the following arguments:
|
|
|
223
213
|
|
|
224
214
|
- **fcn**: `double (*fcn)( double, double, double )` ternary function.
|
|
225
215
|
|
|
226
|
-
When used, this macro should be used **instead of** `NAPI_MODULE`. The macro includes `NAPI_MODULE`, thus ensuring
|
|
216
|
+
When used, this macro should be used **instead of** `NAPI_MODULE`. The macro includes `NAPI_MODULE`, thus ensuring Node-API module registration.
|
|
227
217
|
|
|
228
218
|
#### STDLIB_MATH_BASE_NAPI_MODULE_FFF_F( fcn )
|
|
229
219
|
|
|
230
|
-
Macro for registering
|
|
220
|
+
Macro for registering a Node-API module exporting an interface for invoking a ternary function accepting and returning single-precision floating-point numbers.
|
|
231
221
|
|
|
232
222
|
```c
|
|
233
223
|
static float addf( const float x, const float y, const float z ) {
|
|
@@ -236,7 +226,7 @@ static float addf( const float x, const float y, const float z ) {
|
|
|
236
226
|
|
|
237
227
|
// ...
|
|
238
228
|
|
|
239
|
-
// Register
|
|
229
|
+
// Register a Node-API module:
|
|
240
230
|
STDLIB_MATH_BASE_NAPI_MODULE_FFF_F( addf );
|
|
241
231
|
```
|
|
242
232
|
|
|
@@ -244,7 +234,7 @@ The macro expects the following arguments:
|
|
|
244
234
|
|
|
245
235
|
- **fcn**: `float (*fcn)( float, float, float )` ternary function.
|
|
246
236
|
|
|
247
|
-
When used, this macro should be used **instead of** `NAPI_MODULE`. The macro includes `NAPI_MODULE`, thus ensuring
|
|
237
|
+
When used, this macro should be used **instead of** `NAPI_MODULE`. The macro includes `NAPI_MODULE`, thus ensuring Node-API module registration.
|
|
248
238
|
|
|
249
239
|
</section>
|
|
250
240
|
|
|
@@ -286,6 +276,14 @@ When used, this macro should be used **instead of** `NAPI_MODULE`. The macro inc
|
|
|
286
276
|
|
|
287
277
|
<!-- /.references -->
|
|
288
278
|
|
|
279
|
+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
|
|
280
|
+
|
|
281
|
+
<section class="related">
|
|
282
|
+
|
|
283
|
+
</section>
|
|
284
|
+
|
|
285
|
+
<!-- /.related -->
|
|
286
|
+
|
|
289
287
|
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
290
288
|
|
|
291
289
|
|
|
@@ -299,6 +297,10 @@ This package is part of [stdlib][stdlib], a standard library for JavaScript and
|
|
|
299
297
|
|
|
300
298
|
For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib].
|
|
301
299
|
|
|
300
|
+
#### Community
|
|
301
|
+
|
|
302
|
+
[![Chat][chat-image]][chat-url]
|
|
303
|
+
|
|
302
304
|
---
|
|
303
305
|
|
|
304
306
|
## License
|
|
@@ -308,7 +310,7 @@ See [LICENSE][stdlib-license].
|
|
|
308
310
|
|
|
309
311
|
## Copyright
|
|
310
312
|
|
|
311
|
-
Copyright © 2016-
|
|
313
|
+
Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
|
|
312
314
|
|
|
313
315
|
</section>
|
|
314
316
|
|
|
@@ -327,9 +329,23 @@ Copyright © 2016-2021. The Stdlib [Authors][stdlib-authors].
|
|
|
327
329
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/math-base-napi-ternary/main.svg
|
|
328
330
|
[coverage-url]: https://codecov.io/github/stdlib-js/math-base-napi-ternary?branch=main
|
|
329
331
|
|
|
330
|
-
|
|
332
|
+
<!--
|
|
333
|
+
|
|
334
|
+
[dependencies-image]: https://img.shields.io/david/stdlib-js/math-base-napi-ternary.svg
|
|
331
335
|
[dependencies-url]: https://david-dm.org/stdlib-js/math-base-napi-ternary/main
|
|
332
336
|
|
|
337
|
+
-->
|
|
338
|
+
|
|
339
|
+
[umd]: https://github.com/umdjs/umd
|
|
340
|
+
[es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
|
|
341
|
+
|
|
342
|
+
[deno-url]: https://github.com/stdlib-js/math-base-napi-ternary/tree/deno
|
|
343
|
+
[umd-url]: https://github.com/stdlib-js/math-base-napi-ternary/tree/umd
|
|
344
|
+
[esm-url]: https://github.com/stdlib-js/math-base-napi-ternary/tree/esm
|
|
345
|
+
|
|
346
|
+
[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
|
|
347
|
+
[chat-url]: https://gitter.im/stdlib-js/stdlib/
|
|
348
|
+
|
|
333
349
|
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
334
350
|
|
|
335
351
|
[stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
#include <assert.h>
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
* Macro for registering
|
|
26
|
+
* Macro for registering a Node-API module exporting an interface invoking a ternary function accepting and returning double-precision floating-point numbers.
|
|
27
27
|
*
|
|
28
28
|
* @param fcn ternary function
|
|
29
29
|
*
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
*
|
|
35
35
|
* // ...
|
|
36
36
|
*
|
|
37
|
-
* // Register
|
|
37
|
+
* // Register a Node-API module:
|
|
38
38
|
* STDLIB_MATH_BASE_NAPI_MODULE_DDD_D( add );
|
|
39
39
|
*/
|
|
40
40
|
#define STDLIB_MATH_BASE_NAPI_MODULE_DDD_D( fcn ) \
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_ddd_d_init )
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
|
-
* Macro for registering
|
|
66
|
+
* Macro for registering a Node-API module exporting an interface invoking a ternary function accepting and returning single-precision floating-point numbers.
|
|
67
67
|
*
|
|
68
68
|
* @param fcn ternary function
|
|
69
69
|
*
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
*
|
|
75
75
|
* // ...
|
|
76
76
|
*
|
|
77
|
-
* // Register
|
|
77
|
+
* // Register a Node-API module:
|
|
78
78
|
* STDLIB_MATH_BASE_NAPI_MODULE_FFF_F( addf );
|
|
79
79
|
*/
|
|
80
80
|
#define STDLIB_MATH_BASE_NAPI_MODULE_FFF_F( fcn ) \
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/math-base-napi-ternary",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "C APIs for registering
|
|
3
|
+
"version": "0.0.8",
|
|
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": {
|
|
7
7
|
"name": "The Stdlib Authors",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
],
|
|
16
16
|
"main": "./lib",
|
|
17
17
|
"browser": "./lib/browser.js",
|
|
18
|
-
"gypfile":
|
|
18
|
+
"gypfile": false,
|
|
19
19
|
"directories": {
|
|
20
20
|
"benchmark": "./benchmark",
|
|
21
21
|
"doc": "./docs",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"examples": "make examples",
|
|
33
33
|
"benchmark": "make benchmark"
|
|
34
34
|
},
|
|
35
|
-
"homepage": "https://
|
|
35
|
+
"homepage": "https://stdlib.io",
|
|
36
36
|
"repository": {
|
|
37
37
|
"type": "git",
|
|
38
38
|
"url": "git://github.com/stdlib-js/math-base-napi-ternary.git"
|
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
"math",
|
|
75
75
|
"napi",
|
|
76
76
|
"n-api",
|
|
77
|
+
"node-api",
|
|
77
78
|
"addon",
|
|
78
79
|
"ternary",
|
|
79
80
|
"map",
|
package/src/main.c
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
* @param env environment under which the function is invoked
|
|
36
36
|
* @param info callback data
|
|
37
37
|
* @param fcn ternary function
|
|
38
|
-
* @return function return value as
|
|
38
|
+
* @return function return value as a Node-API double-precision floating-point number
|
|
39
39
|
*/
|
|
40
40
|
napi_value stdlib_math_base_napi_ddd_d( napi_env env, napi_callback_info info, double (*fcn)( double, double, double ) ) {
|
|
41
41
|
napi_status status;
|
|
@@ -111,7 +111,7 @@ napi_value stdlib_math_base_napi_ddd_d( napi_env env, napi_callback_info info, d
|
|
|
111
111
|
* @param env environment under which the function is invoked
|
|
112
112
|
* @param info callback data
|
|
113
113
|
* @param fcn ternary function
|
|
114
|
-
* @return function return value as
|
|
114
|
+
* @return function return value as a Node-API double-precision floating-point number
|
|
115
115
|
*/
|
|
116
116
|
napi_value stdlib_math_base_napi_fff_f( napi_env env, napi_callback_info info, float (*fcn)( float, float, float ) ) {
|
|
117
117
|
napi_status status;
|
package/CHANGELOG.md
DELETED
package/binding.gyp
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
# @license Apache-2.0
|
|
2
|
-
#
|
|
3
|
-
# Copyright (c) 2020 The Stdlib Authors.
|
|
4
|
-
#
|
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
# you may not use this file except in compliance with the License.
|
|
7
|
-
# You may obtain a copy of the License at
|
|
8
|
-
#
|
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
#
|
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
# See the License for the specific language governing permissions and
|
|
15
|
-
# limitations under the License.
|
|
16
|
-
|
|
17
|
-
# A `.gyp` file for building a Node.js native add-on.
|
|
18
|
-
#
|
|
19
|
-
# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md
|
|
20
|
-
# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md
|
|
21
|
-
{
|
|
22
|
-
# List of files to include in this file:
|
|
23
|
-
'includes': [
|
|
24
|
-
'./include.gypi',
|
|
25
|
-
],
|
|
26
|
-
|
|
27
|
-
# Define variables to be used throughout the configuration for all targets:
|
|
28
|
-
'variables': {
|
|
29
|
-
# Target name should match the add-on export name:
|
|
30
|
-
'addon_target_name%': 'addon',
|
|
31
|
-
|
|
32
|
-
# Set variables based on the host OS:
|
|
33
|
-
'conditions': [
|
|
34
|
-
[
|
|
35
|
-
'OS=="win"',
|
|
36
|
-
{
|
|
37
|
-
# Define the object file suffix:
|
|
38
|
-
'obj': 'obj',
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
# Define the object file suffix:
|
|
42
|
-
'obj': 'o',
|
|
43
|
-
}
|
|
44
|
-
], # end condition (OS=="win")
|
|
45
|
-
], # end conditions
|
|
46
|
-
}, # end variables
|
|
47
|
-
|
|
48
|
-
# Define compile targets:
|
|
49
|
-
'targets': [
|
|
50
|
-
|
|
51
|
-
# Target to generate an add-on:
|
|
52
|
-
{
|
|
53
|
-
# The target name should match the add-on export name:
|
|
54
|
-
'target_name': '<(addon_target_name)',
|
|
55
|
-
|
|
56
|
-
# Define dependencies:
|
|
57
|
-
'dependencies': [],
|
|
58
|
-
|
|
59
|
-
# Define directories which contain relevant include headers:
|
|
60
|
-
'include_dirs': [
|
|
61
|
-
# Local include directory:
|
|
62
|
-
'<@(include_dirs)',
|
|
63
|
-
],
|
|
64
|
-
|
|
65
|
-
# List of source files:
|
|
66
|
-
'sources': [
|
|
67
|
-
'<@(src_files)',
|
|
68
|
-
],
|
|
69
|
-
|
|
70
|
-
# Settings which should be applied when a target's object files are used as linker input:
|
|
71
|
-
'link_settings': {
|
|
72
|
-
# Define libraries:
|
|
73
|
-
'libraries': [
|
|
74
|
-
'<@(libraries)',
|
|
75
|
-
],
|
|
76
|
-
|
|
77
|
-
# Define library directories:
|
|
78
|
-
'library_dirs': [
|
|
79
|
-
'<@(library_dirs)',
|
|
80
|
-
],
|
|
81
|
-
},
|
|
82
|
-
|
|
83
|
-
# C/C++ compiler flags:
|
|
84
|
-
'cflags': [
|
|
85
|
-
# Enable commonly used warning options:
|
|
86
|
-
'-Wall',
|
|
87
|
-
|
|
88
|
-
# Aggressive optimization:
|
|
89
|
-
'-O3',
|
|
90
|
-
],
|
|
91
|
-
|
|
92
|
-
# C specific compiler flags:
|
|
93
|
-
'cflags_c': [
|
|
94
|
-
# Specify the C standard to which a program is expected to conform:
|
|
95
|
-
'-std=c99',
|
|
96
|
-
],
|
|
97
|
-
|
|
98
|
-
# C++ specific compiler flags:
|
|
99
|
-
'cflags_cpp': [
|
|
100
|
-
# Specify the C++ standard to which a program is expected to conform:
|
|
101
|
-
'-std=c++11',
|
|
102
|
-
],
|
|
103
|
-
|
|
104
|
-
# Linker flags:
|
|
105
|
-
'ldflags': [],
|
|
106
|
-
|
|
107
|
-
# Apply conditions based on the host OS:
|
|
108
|
-
'conditions': [
|
|
109
|
-
[
|
|
110
|
-
'OS=="mac"',
|
|
111
|
-
{
|
|
112
|
-
# Linker flags:
|
|
113
|
-
'ldflags': [
|
|
114
|
-
'-undefined dynamic_lookup',
|
|
115
|
-
'-Wl,-no-pie',
|
|
116
|
-
'-Wl,-search_paths_first',
|
|
117
|
-
],
|
|
118
|
-
},
|
|
119
|
-
], # end condition (OS=="mac")
|
|
120
|
-
[
|
|
121
|
-
'OS!="win"',
|
|
122
|
-
{
|
|
123
|
-
# C/C++ flags:
|
|
124
|
-
'cflags': [
|
|
125
|
-
# Generate platform-independent code:
|
|
126
|
-
'-fPIC',
|
|
127
|
-
],
|
|
128
|
-
},
|
|
129
|
-
], # end condition (OS!="win")
|
|
130
|
-
], # end conditions
|
|
131
|
-
}, # end target <(addon_target_name)
|
|
132
|
-
|
|
133
|
-
# Target to copy a generated add-on to a standard location:
|
|
134
|
-
{
|
|
135
|
-
'target_name': 'copy_addon',
|
|
136
|
-
|
|
137
|
-
# Declare that the output of this target is not linked:
|
|
138
|
-
'type': 'none',
|
|
139
|
-
|
|
140
|
-
# Define dependencies:
|
|
141
|
-
'dependencies': [
|
|
142
|
-
# Require that the add-on be generated before building this target:
|
|
143
|
-
'<(addon_target_name)',
|
|
144
|
-
],
|
|
145
|
-
|
|
146
|
-
# Define a list of actions:
|
|
147
|
-
'actions': [
|
|
148
|
-
{
|
|
149
|
-
'action_name': 'copy_addon',
|
|
150
|
-
'message': 'Copying addon...',
|
|
151
|
-
|
|
152
|
-
# Explicitly list the inputs in the command-line invocation below:
|
|
153
|
-
'inputs': [],
|
|
154
|
-
|
|
155
|
-
# Declare the expected outputs:
|
|
156
|
-
'outputs': [
|
|
157
|
-
'<(addon_output_dir)/<(addon_target_name).node',
|
|
158
|
-
],
|
|
159
|
-
|
|
160
|
-
# Define the command-line invocation:
|
|
161
|
-
'action': [
|
|
162
|
-
'cp',
|
|
163
|
-
'<(PRODUCT_DIR)/<(addon_target_name).node',
|
|
164
|
-
'<(addon_output_dir)/<(addon_target_name).node',
|
|
165
|
-
],
|
|
166
|
-
},
|
|
167
|
-
], # end actions
|
|
168
|
-
}, # end target copy_addon
|
|
169
|
-
], # end targets
|
|
170
|
-
}
|