Skip to content

Commit 392a664

Browse files
committed
Merge branch 'develop' of https://github.com/stdlib-js/stdlib into develop
2 parents 746eae4 + dd8cae0 commit 392a664

File tree

280 files changed

+8106
-3014
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

280 files changed

+8106
-3014
lines changed

lib/node_modules/@stdlib/array/fixed-endian-float32/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,13 @@ logEach( '%s', out );
422422

423423
<section class="related">
424424

425+
* * *
426+
427+
## See Also
428+
429+
- <span class="package-name">[`@stdlib/array/fixed-endian-float64`][@stdlib/array/fixed-endian-float64]</span><span class="delimiter">: </span><span class="description">Float64Array having a specified byte order.</span>
430+
- <span class="package-name">[`@stdlib/array/float32`][@stdlib/array/float32]</span><span class="delimiter">: </span><span class="description">Float32Array.</span>
431+
425432
</section>
426433

427434
<!-- /.related -->
@@ -438,6 +445,12 @@ logEach( '%s', out );
438445

439446
[@stdlib/array/float32]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/float32
440447

448+
<!-- <related-links> -->
449+
450+
[@stdlib/array/fixed-endian-float64]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/fixed-endian-float64
451+
452+
<!-- </related-links> -->
453+
441454
</section>
442455

443456
<!-- /.links -->

lib/node_modules/@stdlib/math/base/napi/binary/README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,46 @@ The function accepts the following arguments:
331331
void stdlib_math_base_napi_di_d( napi_env env, napi_callback_info info, double (*fcn)( double, int32_t ) );
332332
```
333333
334+
#### stdlib_math_base_napi_id_d( env, info, fcn )
335+
336+
Invokes a binary function accepting a signed 32-bit integer and a double-precision floating-point number and returning a double-precision floating-point number.
337+
338+
```c
339+
#include <node_api.h>
340+
#include <stdint.h>
341+
342+
// ...
343+
344+
static double mul( const int32_t x, const double y ) {
345+
return x * y;
346+
}
347+
348+
// ...
349+
350+
/**
351+
* Receives JavaScript callback invocation data.
352+
*
353+
* @param env environment under which the function is invoked
354+
* @param info callback data
355+
* @return Node-API value
356+
*/
357+
napi_value addon( napi_env env, napi_callback_info info ) {
358+
return stdlib_math_base_napi_id_d( env, info, mul );
359+
}
360+
361+
// ...
362+
```
363+
364+
The function accepts the following arguments:
365+
366+
- **env**: `[in] napi_env` environment under which the function is invoked.
367+
- **info**: `[in] napi_callback_info` callback data.
368+
- **fcn**: `[in] double (*fcn)( int32_t, double )` binary function.
369+
370+
```c
371+
void stdlib_math_base_napi_id_d( napi_env env, napi_callback_info info, double (*fcn)( int32_t, double ) );
372+
```
373+
334374
#### stdlib_math_base_napi_ii_i( env, info, fcn )
335375
336376
Invokes a binary function accepting and returning signed 32-bit integers.
@@ -820,6 +860,29 @@ The macro expects the following arguments:
820860

821861
When used, this macro should be used **instead of** `NAPI_MODULE`. The macro includes `NAPI_MODULE`, thus ensuring Node-API module registration.
822862

863+
#### STDLIB_MATH_BASE_NAPI_MODULE_ID_D( fcn )
864+
865+
Macro for registering a Node-API module exporting an interface invoking a binary function accepting a signed 32-bit integer and a double-precision floating-point number and returning a double-precision floating-point number.
866+
867+
```c
868+
#include <stdint.h>
869+
870+
static double mul( const int32_t x, const double y ) {
871+
return x * y;
872+
}
873+
874+
// ...
875+
876+
// Register a Node-API module:
877+
STDLIB_MATH_BASE_NAPI_MODULE_ID_D( mul );
878+
```
879+
880+
The macro expects the following arguments:
881+
882+
- **fcn**: `double (*fcn)( int32_t, double )` binary function.
883+
884+
When used, this macro should be used **instead of** `NAPI_MODULE`. The macro includes `NAPI_MODULE`, thus ensuring Node-API module registration.
885+
823886
#### STDLIB_MATH_BASE_NAPI_MODULE_FI_F( fcn )
824887
825888
Macro for registering a Node-API module exporting an interface invoking a binary function accepting a single-precision floating-point number and a signed 32-bit integer and returning a single-precision floating-point number.

lib/node_modules/@stdlib/math/base/napi/binary/include/stdlib/math/base/napi/binary.h

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,48 @@
342342
}; \
343343
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_di_d_init )
344344

345+
/**
346+
* Macro for registering a Node-API module exporting an interface invoking a binary function accepting a signed 32-bit integer and a double-precision floating-point number and returning a double-precision floating-point number.
347+
*
348+
* @param fcn binary function
349+
*
350+
* @example
351+
* #include <stdint.h>
352+
*
353+
* static double mul( const int32_t n, const double x ) {
354+
* return x * n;
355+
* }
356+
*
357+
* // ...
358+
*
359+
* // Register a Node-API module:
360+
* STDLIB_MATH_BASE_NAPI_MODULE_ID_D( mul );
361+
*/
362+
#define STDLIB_MATH_BASE_NAPI_MODULE_ID_D( fcn ) \
363+
static napi_value stdlib_math_base_napi_id_d_wrapper( \
364+
napi_env env, \
365+
napi_callback_info info \
366+
) { \
367+
return stdlib_math_base_napi_id_d( env, info, fcn ); \
368+
}; \
369+
static napi_value stdlib_math_base_napi_id_d_init( \
370+
napi_env env, \
371+
napi_value exports \
372+
) { \
373+
napi_value fcn; \
374+
napi_status status = napi_create_function( \
375+
env, \
376+
"exports", \
377+
NAPI_AUTO_LENGTH, \
378+
stdlib_math_base_napi_id_d_wrapper, \
379+
NULL, \
380+
&fcn \
381+
); \
382+
assert( status == napi_ok ); \
383+
return fcn; \
384+
}; \
385+
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_id_d_init )
386+
345387
/**
346388
* Macro for registering a Node-API module exporting an interface invoking a binary function accepting a single-precision floating-point number and a signed 32-bit integer and returning a single-precision floating-point number.
347389
*
@@ -690,6 +732,11 @@ napi_value stdlib_math_base_napi_cc_c( napi_env env, napi_callback_info info, st
690732
*/
691733
napi_value stdlib_math_base_napi_di_d( napi_env env, napi_callback_info info, double (*fcn)( double, int32_t ) );
692734

735+
/**
736+
* Invokes a binary function accepting a signed 32-bit integer and a double-precision floating-point number and returning a double-precision floating-point number.
737+
*/
738+
napi_value stdlib_math_base_napi_id_d( napi_env env, napi_callback_info info, double (*fcn)( int32_t, double ) );
739+
693740
/**
694741
* Invokes a binary function accepting signed 32-bit integers and returning a double-precision floating-point number.
695742
*/

lib/node_modules/@stdlib/math/base/napi/binary/src/main.c

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,68 @@ napi_value stdlib_math_base_napi_di_d( napi_env env, napi_callback_info info, do
524524
return v;
525525
}
526526

527+
/**
528+
* Invokes a binary function accepting a signed 32-bit integer and a double-precision floating-point number and returning a double-precision floating-point number.
529+
*
530+
* ## Notes
531+
*
532+
* - This function expects that the callback `info` argument provides access to the following JavaScript arguments:
533+
*
534+
* - `x`: input value.
535+
* - `y`: input value.
536+
*
537+
* @param env environment under which the function is invoked
538+
* @param info callback data
539+
* @param fcn binary function
540+
* @return function return value as a Node-API double-precision floating-point number
541+
*/
542+
napi_value stdlib_math_base_napi_id_d( napi_env env, napi_callback_info info, double (*fcn)( int32_t, double ) ) {
543+
napi_status status;
544+
545+
size_t argc = 2;
546+
napi_value argv[ 2 ];
547+
status = napi_get_cb_info( env, info, &argc, argv, NULL, NULL );
548+
assert( status == napi_ok );
549+
550+
if ( argc < 2 ) {
551+
status = napi_throw_error( env, NULL, "invalid invocation. Must provide two numbers." );
552+
assert( status == napi_ok );
553+
return NULL;
554+
}
555+
556+
napi_valuetype vtype0;
557+
status = napi_typeof( env, argv[ 0 ], &vtype0 );
558+
assert( status == napi_ok );
559+
if ( vtype0 != napi_number ) {
560+
status = napi_throw_type_error( env, NULL, "invalid argument. First argument must be a number." );
561+
assert( status == napi_ok );
562+
return NULL;
563+
}
564+
565+
napi_valuetype vtype1;
566+
status = napi_typeof( env, argv[ 1 ], &vtype1 );
567+
assert( status == napi_ok );
568+
if ( vtype1 != napi_number ) {
569+
status = napi_throw_type_error( env, NULL, "invalid argument. Second argument must be a number." );
570+
assert( status == napi_ok );
571+
return NULL;
572+
}
573+
574+
int32_t x;
575+
status = napi_get_value_int32( env, argv[ 0 ], &x );
576+
assert( status == napi_ok );
577+
578+
double y;
579+
status = napi_get_value_double( env, argv[ 1 ], &y );
580+
assert( status == napi_ok );
581+
582+
napi_value v;
583+
status = napi_create_double( env, fcn( x, y ), &v );
584+
assert( status == napi_ok );
585+
586+
return v;
587+
}
588+
527589
/**
528590
* Invokes a binary function accepting signed 32-bit integers and returning a double-precision floating-point number.
529591
*

lib/node_modules/@stdlib/math/base/napi/ternary/README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,46 @@ The function accepts the following arguments:
222222
void stdlib_math_base_napi_dii_d( napi_env env, napi_callback_info info, double (*fcn)( double, int32_t, int32_t ) );
223223
```
224224

225+
#### stdlib_math_base_napi_iid_d( env, info, fcn )
226+
227+
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.
228+
229+
```c
230+
#include <node_api.h>
231+
#include <stdint.h>
232+
233+
// ...
234+
235+
static double fcn( const int32_t x, const int32_t y, const double z ) {
236+
// ...
237+
}
238+
239+
// ...
240+
241+
/**
242+
* Receives JavaScript callback invocation data.
243+
*
244+
* @param env environment under which the function is invoked
245+
* @param info callback data
246+
* @return Node-API value
247+
*/
248+
napi_value addon( napi_env env, napi_callback_info info ) {
249+
return stdlib_math_base_napi_iid_d( env, info, fcn );
250+
}
251+
252+
// ...
253+
```
254+
255+
The function accepts the following arguments:
256+
257+
- **env**: `[in] napi_env` environment under which the function is invoked.
258+
- **info**: `[in] napi_callback_info` callback data.
259+
- **fcn**: `[in] double (*fcn)( int32_t, int32_t, double )` ternary function.
260+
261+
```c
262+
void stdlib_math_base_napi_iid_d( napi_env env, napi_callback_info info, double (*fcn)( int32_t, int32_t, double ) );
263+
```
264+
225265
#### STDLIB_MATH_BASE_NAPI_MODULE_DDD_D( fcn )
226266

227267
Macro for registering a Node-API module exporting an interface for invoking a ternary function accepting and returning double-precision floating-point numbers.
@@ -287,6 +327,29 @@ The macro expects the following arguments:
287327
288328
When used, this macro should be used **instead of** `NAPI_MODULE`. The macro includes `NAPI_MODULE`, thus ensuring Node-API module registration.
289329
330+
#### STDLIB_MATH_BASE_NAPI_MODULE_IID_D( fcn )
331+
332+
Macro for registering a Node-API module exporting an interface for 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.
333+
334+
```c
335+
#include <stdint.h>
336+
337+
static double fcn( const int32_t x, const int32_t y, const double z ) {
338+
// ...
339+
}
340+
341+
// ...
342+
343+
// Register a Node-API module:
344+
STDLIB_MATH_BASE_NAPI_MODULE_IID_D( fcn );
345+
```
346+
347+
The macro expects the following arguments:
348+
349+
- **fcn**: `double (*fcn)( int32_t, int32_t, double )` ternary function.
350+
351+
When used, this macro should be used **instead of** `NAPI_MODULE`. The macro includes `NAPI_MODULE`, thus ensuring Node-API module registration.
352+
290353
</section>
291354

292355
<!-- /.usage -->

lib/node_modules/@stdlib/math/base/napi/ternary/include/stdlib/math/base/napi/ternary.h

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,48 @@
144144
}; \
145145
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_dii_d_init )
146146

147+
/**
148+
* 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.
149+
*
150+
* @param fcn ternary function
151+
*
152+
* @example
153+
* #include <stdint.h>
154+
*
155+
* static double fcn( const int_32 x, const int_32 y, const double z ) {
156+
* // ...
157+
* }
158+
*
159+
* // ...
160+
*
161+
* // Register a Node-API module:
162+
* STDLIB_MATH_BASE_NAPI_MODULE_IID_D( fcn );
163+
*/
164+
#define STDLIB_MATH_BASE_NAPI_MODULE_IID_D( fcn ) \
165+
static napi_value stdlib_math_base_napi_iid_d_wrapper( \
166+
napi_env env, \
167+
napi_callback_info info \
168+
) { \
169+
return stdlib_math_base_napi_iid_d( env, info, fcn ); \
170+
}; \
171+
static napi_value stdlib_math_base_napi_iid_d_init( \
172+
napi_env env, \
173+
napi_value exports \
174+
) { \
175+
napi_value fcn; \
176+
napi_status status = napi_create_function( \
177+
env, \
178+
"exports", \
179+
NAPI_AUTO_LENGTH, \
180+
stdlib_math_base_napi_iid_d_wrapper, \
181+
NULL, \
182+
&fcn \
183+
); \
184+
assert( status == napi_ok ); \
185+
return fcn; \
186+
}; \
187+
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_iid_d_init )
188+
147189
/*
148190
* If C++, prevent name mangling so that the compiler emits a ternary file having undecorated names, thus mirroring the behavior of a C compiler.
149191
*/
@@ -166,6 +208,11 @@ napi_value stdlib_math_base_napi_fff_f( napi_env env, napi_callback_info info, f
166208
*/
167209
napi_value stdlib_math_base_napi_dii_d( napi_env env, napi_callback_info info, double (*fcn)( double, int32_t, int32_t ) );
168210

211+
/**
212+
* 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.
213+
*/
214+
napi_value stdlib_math_base_napi_iid_d( napi_env env, napi_callback_info info, double (*fcn)( int32_t, int32_t, double ) );
215+
169216
#ifdef __cplusplus
170217
}
171218
#endif

0 commit comments

Comments
 (0)