@stdlib/math-base-napi-binary 0.2.1 → 0.3.0
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/README.md +158 -36
- package/include/stdlib/math/base/napi/binary.h +112 -22
- package/manifest.json +4 -4
- package/package.json +6 -6
- package/src/main.c +134 -10
- package/include.gypi +0 -53
package/README.md
CHANGED
|
@@ -211,8 +211,8 @@ void stdlib_math_base_napi_ff_f( napi_env env, napi_callback_info info, float (*
|
|
|
211
211
|
Invokes a binary function accepting and returning double-precision complex floating-point numbers.
|
|
212
212
|
|
|
213
213
|
```c
|
|
214
|
-
#include "stdlib/complex/float64.h"
|
|
215
|
-
#include "stdlib/complex/reim.h"
|
|
214
|
+
#include "stdlib/complex/float64/ctor.h"
|
|
215
|
+
#include "stdlib/complex/float64/reim.h"
|
|
216
216
|
#include <node_api.h>
|
|
217
217
|
|
|
218
218
|
// ...
|
|
@@ -225,8 +225,8 @@ static stdlib_complex128_t add( const stdlib_complex128_t x, const stdlib_comple
|
|
|
225
225
|
double re;
|
|
226
226
|
double im;
|
|
227
227
|
|
|
228
|
-
|
|
229
|
-
|
|
228
|
+
stdlib_complex128_reim( x, &xre, &xim );
|
|
229
|
+
stdlib_complex128_reim( y, &yre, &yim );
|
|
230
230
|
|
|
231
231
|
re = xre + yre;
|
|
232
232
|
im = xim + yim;
|
|
@@ -265,8 +265,8 @@ void stdlib_math_base_napi_zz_z( napi_env env, napi_callback_info info, stdlib_c
|
|
|
265
265
|
Invokes a binary function accepting and returning single-precision complex floating-point numbers.
|
|
266
266
|
|
|
267
267
|
```c
|
|
268
|
-
#include "stdlib/complex/float64.h"
|
|
269
|
-
#include "stdlib/complex/reim.h"
|
|
268
|
+
#include "stdlib/complex/float64/ctor.h"
|
|
269
|
+
#include "stdlib/complex/float64/reim.h"
|
|
270
270
|
#include <node_api.h>
|
|
271
271
|
|
|
272
272
|
// ...
|
|
@@ -279,8 +279,8 @@ static stdlib_complex64_t add( const stdlib_complex64_t x, const stdlib_complex6
|
|
|
279
279
|
float re;
|
|
280
280
|
float im;
|
|
281
281
|
|
|
282
|
-
|
|
283
|
-
|
|
282
|
+
stdlib_complex64_reim( x, &xre, &xim );
|
|
283
|
+
stdlib_complex64_reim( y, &yre, &yim );
|
|
284
284
|
|
|
285
285
|
re = xre + yre;
|
|
286
286
|
im = xim + yim;
|
|
@@ -354,6 +354,86 @@ The function accepts the following arguments:
|
|
|
354
354
|
void stdlib_math_base_napi_di_d( napi_env env, napi_callback_info info, double (*fcn)( double, int32_t ) );
|
|
355
355
|
```
|
|
356
356
|
|
|
357
|
+
#### stdlib_math_base_napi_ii_i( env, info, fcn )
|
|
358
|
+
|
|
359
|
+
Invokes a binary function accepting and returning signed 32-bit integers.
|
|
360
|
+
|
|
361
|
+
```c
|
|
362
|
+
#include <node_api.h>
|
|
363
|
+
#include <stdint.h>
|
|
364
|
+
|
|
365
|
+
// ...
|
|
366
|
+
|
|
367
|
+
static int32_t mul( const int32_t x, const int32_t y ) {
|
|
368
|
+
return x * y;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
// ...
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Receives JavaScript callback invocation data.
|
|
375
|
+
*
|
|
376
|
+
* @param env environment under which the function is invoked
|
|
377
|
+
* @param info callback data
|
|
378
|
+
* @return Node-API value
|
|
379
|
+
*/
|
|
380
|
+
napi_value addon( napi_env env, napi_callback_info info ) {
|
|
381
|
+
return stdlib_math_base_napi_ii_i( env, info, mul );
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
// ...
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
The function accepts the following arguments:
|
|
388
|
+
|
|
389
|
+
- **env**: `[in] napi_env` environment under which the function is invoked.
|
|
390
|
+
- **info**: `[in] napi_callback_info` callback data.
|
|
391
|
+
- **fcn**: `[in] int32_t (*fcn)( int32_t, int32_t )` binary function.
|
|
392
|
+
|
|
393
|
+
```c
|
|
394
|
+
void stdlib_math_base_napi_ii_i( napi_env env, napi_callback_info info, int32_t (*fcn)( int32_t, int32_t ) );
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
#### stdlib_math_base_napi_ii_d( env, info, fcn )
|
|
398
|
+
|
|
399
|
+
Invokes a binary function accepting signed 32-bit integers and returning a double-precision floating-point number.
|
|
400
|
+
|
|
401
|
+
```c
|
|
402
|
+
#include <node_api.h>
|
|
403
|
+
#include <stdint.h>
|
|
404
|
+
|
|
405
|
+
// ...
|
|
406
|
+
|
|
407
|
+
static double mul( const int32_t x, const int32_t y ) {
|
|
408
|
+
return x * y;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
// ...
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Receives JavaScript callback invocation data.
|
|
415
|
+
*
|
|
416
|
+
* @param env environment under which the function is invoked
|
|
417
|
+
* @param info callback data
|
|
418
|
+
* @return Node-API value
|
|
419
|
+
*/
|
|
420
|
+
napi_value addon( napi_env env, napi_callback_info info ) {
|
|
421
|
+
return stdlib_math_base_napi_ii_d( env, info, mul );
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
// ...
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
The function accepts the following arguments:
|
|
428
|
+
|
|
429
|
+
- **env**: `[in] napi_env` environment under which the function is invoked.
|
|
430
|
+
- **info**: `[in] napi_callback_info` callback data.
|
|
431
|
+
- **fcn**: `[in] double (*fcn)( int32_t, int32_t )` binary function.
|
|
432
|
+
|
|
433
|
+
```c
|
|
434
|
+
void stdlib_math_base_napi_ii_d( napi_env env, napi_callback_info info, double (*fcn)( int32_t, int32_t ) );
|
|
435
|
+
```
|
|
436
|
+
|
|
357
437
|
#### stdlib_math_base_napi_fi_f( env, info, fcn )
|
|
358
438
|
|
|
359
439
|
Invokes a binary function accepting a single-precision floating-point number and a signed 32-bit integer and returning a single-precision floating-point number.
|
|
@@ -399,8 +479,8 @@ void stdlib_math_base_napi_fi_f( napi_env env, napi_callback_info info, float (*
|
|
|
399
479
|
Invokes a binary function accepting a double-precision complex floating-point number and a signed 32-bit integer and returning a double-precision complex floating-point number.
|
|
400
480
|
|
|
401
481
|
```c
|
|
402
|
-
#include "stdlib/complex/float64.h"
|
|
403
|
-
#include "stdlib/complex/reim.h"
|
|
482
|
+
#include "stdlib/complex/float64/ctor.h"
|
|
483
|
+
#include "stdlib/complex/float64/reim.h"
|
|
404
484
|
#include <node_api.h>
|
|
405
485
|
#include <stdint.h>
|
|
406
486
|
|
|
@@ -412,7 +492,7 @@ static stdlib_complex128_t mul( const stdlib_complex128_t x, const int32_t y ) {
|
|
|
412
492
|
double re;
|
|
413
493
|
double im;
|
|
414
494
|
|
|
415
|
-
|
|
495
|
+
stdlib_complex128_reim( x, &xre, &xim );
|
|
416
496
|
|
|
417
497
|
re = xre * y;
|
|
418
498
|
im = xim * y;
|
|
@@ -451,8 +531,8 @@ void stdlib_math_base_napi_zi_z( napi_env env, napi_callback_info info, stdlib_c
|
|
|
451
531
|
Invokes a binary function accepting a single-precision complex floating-point number and a signed 32-bit integer and returning a single-precision complex floating-point number.
|
|
452
532
|
|
|
453
533
|
```c
|
|
454
|
-
#include "stdlib/complex/float64.h"
|
|
455
|
-
#include "stdlib/complex/
|
|
534
|
+
#include "stdlib/complex/float64/ctor.h"
|
|
535
|
+
#include "stdlib/complex/float32/reim.h"
|
|
456
536
|
#include <node_api.h>
|
|
457
537
|
#include <stdint.h>
|
|
458
538
|
|
|
@@ -464,7 +544,7 @@ static stdlib_complex64_t mul( const stdlib_complex64_t x, const int32_t y ) {
|
|
|
464
544
|
float re;
|
|
465
545
|
float im;
|
|
466
546
|
|
|
467
|
-
|
|
547
|
+
stdlib_complex64_reim( x, &xre, &xim );
|
|
468
548
|
|
|
469
549
|
re = xre * y;
|
|
470
550
|
im = xim * y;
|
|
@@ -519,6 +599,48 @@ The macro expects the following arguments:
|
|
|
519
599
|
|
|
520
600
|
When used, this macro should be used **instead of** `NAPI_MODULE`. The macro includes `NAPI_MODULE`, thus ensuring Node-API module registration.
|
|
521
601
|
|
|
602
|
+
#### STDLIB_MATH_BASE_NAPI_MODULE_II_I( fcn )
|
|
603
|
+
|
|
604
|
+
Macro for registering a Node-API module exporting an interface for invoking a binary function accepting and returning signed 32-bit integers.
|
|
605
|
+
|
|
606
|
+
```c
|
|
607
|
+
static int32_t add( const int32_t x, const int32_t y ) {
|
|
608
|
+
return x + y;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
// ...
|
|
612
|
+
|
|
613
|
+
// Register a Node-API module:
|
|
614
|
+
STDLIB_MATH_BASE_NAPI_MODULE_II_I( add );
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
The macro expects the following arguments:
|
|
618
|
+
|
|
619
|
+
- **fcn**: `int32_t (*fcn)( int32_t, int32_t )` binary function.
|
|
620
|
+
|
|
621
|
+
When used, this macro should be used **instead of** `NAPI_MODULE`. The macro includes `NAPI_MODULE`, thus ensuring Node-API module registration.
|
|
622
|
+
|
|
623
|
+
#### STDLIB_MATH_BASE_NAPI_MODULE_II_D( fcn )
|
|
624
|
+
|
|
625
|
+
Macro for registering a Node-API module exporting an interface for invoking a binary function accepting signed 32-bit integers and returning a double-precision floating-point number.
|
|
626
|
+
|
|
627
|
+
```c
|
|
628
|
+
static double add( const int32_t x, const int32_t y ) {
|
|
629
|
+
return x + y;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
// ...
|
|
633
|
+
|
|
634
|
+
// Register a Node-API module:
|
|
635
|
+
STDLIB_MATH_BASE_NAPI_MODULE_II_D( add );
|
|
636
|
+
```
|
|
637
|
+
|
|
638
|
+
The macro expects the following arguments:
|
|
639
|
+
|
|
640
|
+
- **fcn**: `double (*fcn)( int32_t, int32_t )` binary function.
|
|
641
|
+
|
|
642
|
+
When used, this macro should be used **instead of** `NAPI_MODULE`. The macro includes `NAPI_MODULE`, thus ensuring Node-API module registration.
|
|
643
|
+
|
|
522
644
|
#### STDLIB_MATH_BASE_NAPI_MODULE_FF_F( fcn )
|
|
523
645
|
|
|
524
646
|
Macro for registering a Node-API module exporting an interface for invoking a binary function accepting and returning single-precision floating-point numbers.
|
|
@@ -545,8 +667,8 @@ When used, this macro should be used **instead of** `NAPI_MODULE`. The macro inc
|
|
|
545
667
|
Macro for registering a Node-API module exporting an interface for invoking a binary function accepting and returning double-precision complex floating-point numbers.
|
|
546
668
|
|
|
547
669
|
```c
|
|
548
|
-
#include "stdlib/complex/float64.h"
|
|
549
|
-
#include "stdlib/complex/reim.h"
|
|
670
|
+
#include "stdlib/complex/float64/ctor.h"
|
|
671
|
+
#include "stdlib/complex/float64/reim.h"
|
|
550
672
|
|
|
551
673
|
static stdlib_complex128_t add( const stdlib_complex128_t x, const stdlib_complex128_t y ) {
|
|
552
674
|
double xre;
|
|
@@ -556,8 +678,8 @@ static stdlib_complex128_t add( const stdlib_complex128_t x, const stdlib_comple
|
|
|
556
678
|
double re;
|
|
557
679
|
double im;
|
|
558
680
|
|
|
559
|
-
|
|
560
|
-
|
|
681
|
+
stdlib_complex128_reim( x, &xre, &xim );
|
|
682
|
+
stdlib_complex128_reim( y, &yre, &yim );
|
|
561
683
|
|
|
562
684
|
re = xre + yre;
|
|
563
685
|
im = xim + yim;
|
|
@@ -582,8 +704,8 @@ When used, this macro should be used **instead of** `NAPI_MODULE`. The macro inc
|
|
|
582
704
|
Macro for registering a Node-API module exporting an interface for invoking a binary function accepting and returning single-precision complex floating-point numbers.
|
|
583
705
|
|
|
584
706
|
```c
|
|
585
|
-
#include "stdlib/complex/float32.h"
|
|
586
|
-
#include "stdlib/complex/
|
|
707
|
+
#include "stdlib/complex/float32/ctor.h"
|
|
708
|
+
#include "stdlib/complex/float32/reim.h"
|
|
587
709
|
|
|
588
710
|
static stdlib_complex64_t add( const stdlib_complex64_t x, const stdlib_complex64_t y ) {
|
|
589
711
|
float xre;
|
|
@@ -593,8 +715,8 @@ static stdlib_complex64_t add( const stdlib_complex64_t x, const stdlib_complex6
|
|
|
593
715
|
float re;
|
|
594
716
|
float im;
|
|
595
717
|
|
|
596
|
-
|
|
597
|
-
|
|
718
|
+
stdlib_complex64_reim( x, &xre, &xim );
|
|
719
|
+
stdlib_complex64_reim( y, &yre, &yim );
|
|
598
720
|
|
|
599
721
|
re = xre + yre;
|
|
600
722
|
im = xim + yim;
|
|
@@ -665,8 +787,8 @@ When used, this macro should be used **instead of** `NAPI_MODULE`. The macro inc
|
|
|
665
787
|
Macro for registering a Node-API module exporting an interface invoking a binary function accepting a double-precision complex floating-point number and a signed 32-bit and returning a double-precision complex floating-point number.
|
|
666
788
|
|
|
667
789
|
```c
|
|
668
|
-
#include "stdlib/complex/float64.h"
|
|
669
|
-
#include "stdlib/complex/reim.h"
|
|
790
|
+
#include "stdlib/complex/float64/ctor.h"
|
|
791
|
+
#include "stdlib/complex/float64/reim.h"
|
|
670
792
|
#include <stdint.h>
|
|
671
793
|
|
|
672
794
|
static stdlib_complex128_t mul( const stdlib_complex128_t x, const int32_t y ) {
|
|
@@ -675,7 +797,7 @@ static stdlib_complex128_t mul( const stdlib_complex128_t x, const int32_t y ) {
|
|
|
675
797
|
double re;
|
|
676
798
|
double im;
|
|
677
799
|
|
|
678
|
-
|
|
800
|
+
stdlib_complex128_reim( x, &xre, &xim );
|
|
679
801
|
|
|
680
802
|
re = xre * y;
|
|
681
803
|
im = xim * y;
|
|
@@ -700,8 +822,8 @@ When used, this macro should be used **instead of** `NAPI_MODULE`. The macro inc
|
|
|
700
822
|
Macro for registering a Node-API module exporting an interface invoking a binary function accepting a single-precision complex floating-point number and a signed 32-bit integer and returning a single-precision complex floating-point number.
|
|
701
823
|
|
|
702
824
|
```c
|
|
703
|
-
#include "stdlib/complex/float32.h"
|
|
704
|
-
#include "stdlib/complex/
|
|
825
|
+
#include "stdlib/complex/float32/ctor.h"
|
|
826
|
+
#include "stdlib/complex/float32/reim.h"
|
|
705
827
|
#include <stdint.h>
|
|
706
828
|
|
|
707
829
|
static stdlib_complex64_t add( const stdlib_complex64_t x, const int32_t y ) {
|
|
@@ -710,7 +832,7 @@ static stdlib_complex64_t add( const stdlib_complex64_t x, const int32_t y ) {
|
|
|
710
832
|
float re;
|
|
711
833
|
float im;
|
|
712
834
|
|
|
713
|
-
|
|
835
|
+
stdlib_complex64_reim( x, &xre, &xim );
|
|
714
836
|
|
|
715
837
|
re = xre * y;
|
|
716
838
|
im = xim * y;
|
|
@@ -735,8 +857,8 @@ When used, this macro should be used **instead of** `NAPI_MODULE`. The macro inc
|
|
|
735
857
|
Macro for registering a Node-API module exporting an interface invoking a binary function accepting a double-precision complex floating-point number and a double-precision floating-point number and returning a double-precision complex floating-point number.
|
|
736
858
|
|
|
737
859
|
```c
|
|
738
|
-
#include "stdlib/complex/float64.h"
|
|
739
|
-
#include "stdlib/complex/reim.h"
|
|
860
|
+
#include "stdlib/complex/float64/ctor.h"
|
|
861
|
+
#include "stdlib/complex/float64/reim.h"
|
|
740
862
|
|
|
741
863
|
static stdlib_complex128_t mul( const stdlib_complex128_t x, const double y ) {
|
|
742
864
|
double xre;
|
|
@@ -744,7 +866,7 @@ static stdlib_complex128_t mul( const stdlib_complex128_t x, const double y ) {
|
|
|
744
866
|
double re;
|
|
745
867
|
double im;
|
|
746
868
|
|
|
747
|
-
|
|
869
|
+
stdlib_complex128_reim( x, &xre, &xim );
|
|
748
870
|
|
|
749
871
|
re = xre * y;
|
|
750
872
|
im = xim * y;
|
|
@@ -769,8 +891,8 @@ When used, this macro should be used **instead of** `NAPI_MODULE`. The macro inc
|
|
|
769
891
|
Macro for registering a Node-API module exporting an interface invoking a binary function accepting a single-precision complex floating-point number and a single-precision floating-point number and returning a single-precision complex floating-point number.
|
|
770
892
|
|
|
771
893
|
```c
|
|
772
|
-
#include "stdlib/complex/float32.h"
|
|
773
|
-
#include "stdlib/complex/
|
|
894
|
+
#include "stdlib/complex/float32/ctor.h"
|
|
895
|
+
#include "stdlib/complex/float32/reim.h"
|
|
774
896
|
|
|
775
897
|
static stdlib_complex64_t add( const stdlib_complex64_t x, const float y ) {
|
|
776
898
|
float xre;
|
|
@@ -778,7 +900,7 @@ static stdlib_complex64_t add( const stdlib_complex64_t x, const float y ) {
|
|
|
778
900
|
float re;
|
|
779
901
|
float im;
|
|
780
902
|
|
|
781
|
-
|
|
903
|
+
stdlib_complex64_reim( x, &xre, &xim );
|
|
782
904
|
|
|
783
905
|
re = xre * y;
|
|
784
906
|
im = xim * y;
|
|
@@ -884,8 +1006,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
884
1006
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/math-base-napi-binary.svg
|
|
885
1007
|
[npm-url]: https://npmjs.org/package/@stdlib/math-base-napi-binary
|
|
886
1008
|
|
|
887
|
-
[test-image]: https://github.com/stdlib-js/math-base-napi-binary/actions/workflows/test.yml/badge.svg?branch=v0.
|
|
888
|
-
[test-url]: https://github.com/stdlib-js/math-base-napi-binary/actions/workflows/test.yml?query=branch:v0.
|
|
1009
|
+
[test-image]: https://github.com/stdlib-js/math-base-napi-binary/actions/workflows/test.yml/badge.svg?branch=v0.3.0
|
|
1010
|
+
[test-url]: https://github.com/stdlib-js/math-base-napi-binary/actions/workflows/test.yml?query=branch:v0.3.0
|
|
889
1011
|
|
|
890
1012
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/math-base-napi-binary/main.svg
|
|
891
1013
|
[coverage-url]: https://codecov.io/github/stdlib-js/math-base-napi-binary?branch=main
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
#ifndef STDLIB_MATH_BASE_NAPI_BINARY_H
|
|
20
20
|
#define STDLIB_MATH_BASE_NAPI_BINARY_H
|
|
21
21
|
|
|
22
|
-
#include "stdlib/complex/float32.h"
|
|
23
|
-
#include "stdlib/complex/float64.h"
|
|
22
|
+
#include "stdlib/complex/float32/ctor.h"
|
|
23
|
+
#include "stdlib/complex/float64/ctor.h"
|
|
24
24
|
#include <node_api.h>
|
|
25
25
|
#include <assert.h>
|
|
26
26
|
|
|
@@ -64,6 +64,86 @@
|
|
|
64
64
|
}; \
|
|
65
65
|
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_dd_d_init )
|
|
66
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Macro for registering a Node-API module exporting an interface invoking a binary function accepting and returning signed 32-bit integers.
|
|
69
|
+
*
|
|
70
|
+
* @param fcn binary function
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* static int_32 add( const int_32 x, const int_32 y ) {
|
|
74
|
+
* return x + y;
|
|
75
|
+
* }
|
|
76
|
+
*
|
|
77
|
+
* // ...
|
|
78
|
+
*
|
|
79
|
+
* // Register a Node-API module:
|
|
80
|
+
* STDLIB_MATH_BASE_NAPI_MODULE_II_I( add );
|
|
81
|
+
*/
|
|
82
|
+
#define STDLIB_MATH_BASE_NAPI_MODULE_II_I( fcn ) \
|
|
83
|
+
static napi_value stdlib_math_base_napi_ii_i_wrapper( \
|
|
84
|
+
napi_env env, \
|
|
85
|
+
napi_callback_info info \
|
|
86
|
+
) { \
|
|
87
|
+
return stdlib_math_base_napi_ii_i( env, info, fcn ); \
|
|
88
|
+
}; \
|
|
89
|
+
static napi_value stdlib_math_base_napi_ii_i_init( \
|
|
90
|
+
napi_env env, \
|
|
91
|
+
napi_value exports \
|
|
92
|
+
) { \
|
|
93
|
+
napi_value fcn; \
|
|
94
|
+
napi_status status = napi_create_function( \
|
|
95
|
+
env, \
|
|
96
|
+
"exports", \
|
|
97
|
+
NAPI_AUTO_LENGTH, \
|
|
98
|
+
stdlib_math_base_napi_ii_i_wrapper, \
|
|
99
|
+
NULL, \
|
|
100
|
+
&fcn \
|
|
101
|
+
); \
|
|
102
|
+
assert( status == napi_ok ); \
|
|
103
|
+
return fcn; \
|
|
104
|
+
}; \
|
|
105
|
+
NAPI_MODULE( NODE_GYP_MODULE_NAME, stdlib_math_base_napi_ii_i_init )
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Macro for registering a Node-API module exporting an interface invoking a binary function accepting signed 32-bit integers and returning a double-precision floating-point number.
|
|
109
|
+
*
|
|
110
|
+
* @param fcn binary function
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* static double add( const int_32 x, const int_32 y ) {
|
|
114
|
+
* return x + y;
|
|
115
|
+
* }
|
|
116
|
+
*
|
|
117
|
+
* // ...
|
|
118
|
+
*
|
|
119
|
+
* // Register a Node-API module:
|
|
120
|
+
* STDLIB_MATH_BASE_NAPI_MODULE_II_D( add );
|
|
121
|
+
*/
|
|
122
|
+
#define STDLIB_MATH_BASE_NAPI_MODULE_II_D( fcn ) \
|
|
123
|
+
static napi_value stdlib_math_base_napi_ii_d_wrapper( \
|
|
124
|
+
napi_env env, \
|
|
125
|
+
napi_callback_info info \
|
|
126
|
+
) { \
|
|
127
|
+
return stdlib_math_base_napi_ii_d( env, info, fcn ); \
|
|
128
|
+
}; \
|
|
129
|
+
static napi_value stdlib_math_base_napi_ii_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_ii_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_ii_d_init )
|
|
146
|
+
|
|
67
147
|
/**
|
|
68
148
|
* Macro for registering a Node-API module exporting an interface invoking a binary function accepting and returning single-precision floating-point numbers.
|
|
69
149
|
*
|
|
@@ -110,8 +190,8 @@
|
|
|
110
190
|
* @param fcn binary function
|
|
111
191
|
*
|
|
112
192
|
* @example
|
|
113
|
-
* #include "stdlib/complex/float64.h"
|
|
114
|
-
* #include "stdlib/complex/reim.h"
|
|
193
|
+
* #include "stdlib/complex/float64/ctor.h"
|
|
194
|
+
* #include "stdlib/complex/float64/reim.h"
|
|
115
195
|
*
|
|
116
196
|
* static stdlib_complex128_t add( const stdlib_complex128_t x, const stdlib_complex128_t y ) {
|
|
117
197
|
* double xre;
|
|
@@ -121,8 +201,8 @@
|
|
|
121
201
|
* double re;
|
|
122
202
|
* double im;
|
|
123
203
|
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
204
|
+
* stdlib_complex128_reim( x, &xre, &xim );
|
|
205
|
+
* stdlib_complex128_reim( y, &yre, &yim );
|
|
126
206
|
*
|
|
127
207
|
* re = xre + yre;
|
|
128
208
|
* im = xim + yim;
|
|
@@ -166,8 +246,8 @@
|
|
|
166
246
|
* @param fcn binary function
|
|
167
247
|
*
|
|
168
248
|
* @example
|
|
169
|
-
* #include "stdlib/complex/float32.h"
|
|
170
|
-
* #include "stdlib/complex/
|
|
249
|
+
* #include "stdlib/complex/float32/ctor.h"
|
|
250
|
+
* #include "stdlib/complex/float32/reim.h"
|
|
171
251
|
*
|
|
172
252
|
* static stdlib_complex64_t add( const stdlib_complex64_t x, const stdlib_complex64_t y ) {
|
|
173
253
|
* float xre;
|
|
@@ -177,8 +257,8 @@
|
|
|
177
257
|
* float re;
|
|
178
258
|
* float im;
|
|
179
259
|
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
260
|
+
* stdlib_complex64_reim( x, &xre, &xim );
|
|
261
|
+
* stdlib_complex64_reim( y, &yre, &yim );
|
|
182
262
|
*
|
|
183
263
|
* re = xre + yre;
|
|
184
264
|
* im = xim + yim;
|
|
@@ -306,15 +386,15 @@
|
|
|
306
386
|
* @param fcn binary function
|
|
307
387
|
*
|
|
308
388
|
* @example
|
|
309
|
-
* #include "stdlib/complex/float64.h"
|
|
310
|
-
* #include "stdlib/complex/reim.h"
|
|
389
|
+
* #include "stdlib/complex/float64/ctor.h"
|
|
390
|
+
* #include "stdlib/complex/float64/reim.h"
|
|
311
391
|
* #include <stdint.h>
|
|
312
392
|
*
|
|
313
393
|
* static stdlib_complex128_t mul( const stdlib_complex128_t x, const int32_t n ) {
|
|
314
394
|
* double re;
|
|
315
395
|
* double im;
|
|
316
396
|
*
|
|
317
|
-
*
|
|
397
|
+
* stdlib_complex128_reim( x, &re, &im );
|
|
318
398
|
* return stdlib_complex128( re*n, im*n );
|
|
319
399
|
* }
|
|
320
400
|
*
|
|
@@ -354,15 +434,15 @@
|
|
|
354
434
|
* @param fcn binary function
|
|
355
435
|
*
|
|
356
436
|
* @example
|
|
357
|
-
* #include "stdlib/complex/float32.h"
|
|
358
|
-
* #include "stdlib/complex/
|
|
437
|
+
* #include "stdlib/complex/float32/ctor.h"
|
|
438
|
+
* #include "stdlib/complex/float32/reim.h"
|
|
359
439
|
* #include <stdint.h>
|
|
360
440
|
*
|
|
361
441
|
* static stdlib_complex64_t mul( const stdlib_complex64_t x, const int32_t n ) {
|
|
362
442
|
* float re;
|
|
363
443
|
* float im;
|
|
364
444
|
*
|
|
365
|
-
*
|
|
445
|
+
* stdlib_complex64_reim( x, &re, &im );
|
|
366
446
|
* return stdlib_complex64( re*n, im*n );
|
|
367
447
|
* }
|
|
368
448
|
*
|
|
@@ -402,14 +482,14 @@
|
|
|
402
482
|
* @param fcn binary function
|
|
403
483
|
*
|
|
404
484
|
* @example
|
|
405
|
-
* #include "stdlib/complex/float64.h"
|
|
406
|
-
* #include "stdlib/complex/reim.h"
|
|
485
|
+
* #include "stdlib/complex/float64/ctor.h"
|
|
486
|
+
* #include "stdlib/complex/float64/reim.h"
|
|
407
487
|
*
|
|
408
488
|
* static stdlib_complex128_t mul( const stdlib_complex128_t x, const double n ) {
|
|
409
489
|
* double re;
|
|
410
490
|
* double im;
|
|
411
491
|
*
|
|
412
|
-
*
|
|
492
|
+
* stdlib_complex128_reim( x, &re, &im );
|
|
413
493
|
* return stdlib_complex128( re*n, im*n );
|
|
414
494
|
* }
|
|
415
495
|
*
|
|
@@ -449,14 +529,14 @@
|
|
|
449
529
|
* @param fcn binary function
|
|
450
530
|
*
|
|
451
531
|
* @example
|
|
452
|
-
* #include "stdlib/complex/float32.h"
|
|
453
|
-
* #include "stdlib/complex/
|
|
532
|
+
* #include "stdlib/complex/float32/ctor.h"
|
|
533
|
+
* #include "stdlib/complex/float32/reim.h"
|
|
454
534
|
*
|
|
455
535
|
* static stdlib_complex64_t mul( const stdlib_complex64_t x, const float n ) {
|
|
456
536
|
* float re;
|
|
457
537
|
* float im;
|
|
458
538
|
*
|
|
459
|
-
*
|
|
539
|
+
* stdlib_complex64_reim( x, &re, &im );
|
|
460
540
|
* return stdlib_complex64( re*n, im*n );
|
|
461
541
|
* }
|
|
462
542
|
*
|
|
@@ -522,6 +602,16 @@ napi_value stdlib_math_base_napi_cc_c( napi_env env, napi_callback_info info, st
|
|
|
522
602
|
*/
|
|
523
603
|
napi_value stdlib_math_base_napi_di_d( napi_env env, napi_callback_info info, double (*fcn)( double, int32_t ) );
|
|
524
604
|
|
|
605
|
+
/**
|
|
606
|
+
* Invokes a binary function accepting signed 32-bit integers and returning a double-precision floating-point number.
|
|
607
|
+
*/
|
|
608
|
+
napi_value stdlib_math_base_napi_ii_d( napi_env env, napi_callback_info info, double (*fcn)( int32_t, int32_t ) );
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* Invokes a binary function accepting and returning signed 32-bit integers.
|
|
612
|
+
*/
|
|
613
|
+
napi_value stdlib_math_base_napi_ii_i( napi_env env, napi_callback_info info, int32_t (*fcn)( int32_t, int32_t ) );
|
|
614
|
+
|
|
525
615
|
/**
|
|
526
616
|
* Invokes a binary function accepting a single-precision floating-point number and a signed 32-bit integer and returning a single-precision floating-point number.
|
|
527
617
|
*/
|
package/manifest.json
CHANGED
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"libraries": [],
|
|
34
34
|
"libpath": [],
|
|
35
35
|
"dependencies": [
|
|
36
|
-
"@stdlib/complex-float32",
|
|
37
|
-
"@stdlib/complex-float64",
|
|
38
|
-
"@stdlib/complex-reim",
|
|
39
|
-
"@stdlib/complex-
|
|
36
|
+
"@stdlib/complex-float32-ctor",
|
|
37
|
+
"@stdlib/complex-float64-ctor",
|
|
38
|
+
"@stdlib/complex-float64-reim",
|
|
39
|
+
"@stdlib/complex-float32-reim"
|
|
40
40
|
]
|
|
41
41
|
}
|
|
42
42
|
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/math-base-napi-binary",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "C APIs for registering a Node-API module exporting an interface for invoking a binary numerical function.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@stdlib/complex-float32": "^0.2
|
|
38
|
-
"@stdlib/complex-
|
|
39
|
-
"@stdlib/complex-
|
|
40
|
-
"@stdlib/complex-
|
|
41
|
-
"@stdlib/utils-library-manifest": "^0.2.
|
|
37
|
+
"@stdlib/complex-float32-ctor": "^0.0.2",
|
|
38
|
+
"@stdlib/complex-float32-reim": "^0.1.2",
|
|
39
|
+
"@stdlib/complex-float64-ctor": "^0.0.3",
|
|
40
|
+
"@stdlib/complex-float64-reim": "^0.1.2",
|
|
41
|
+
"@stdlib/utils-library-manifest": "^0.2.2"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {},
|
|
44
44
|
"engines": {
|
package/src/main.c
CHANGED
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
#include "stdlib/math/base/napi/binary.h"
|
|
20
|
-
#include "stdlib/complex/float64.h"
|
|
21
|
-
#include "stdlib/complex/float32.h"
|
|
22
|
-
#include "stdlib/complex/reim.h"
|
|
23
|
-
#include "stdlib/complex/
|
|
20
|
+
#include "stdlib/complex/float64/ctor.h"
|
|
21
|
+
#include "stdlib/complex/float32/ctor.h"
|
|
22
|
+
#include "stdlib/complex/float64/reim.h"
|
|
23
|
+
#include "stdlib/complex/float32/reim.h"
|
|
24
24
|
#include <node_api.h>
|
|
25
25
|
#include <stdint.h>
|
|
26
26
|
#include <assert.h>
|
|
@@ -283,7 +283,7 @@ napi_value stdlib_math_base_napi_zz_z( napi_env env, napi_callback_info info, st
|
|
|
283
283
|
stdlib_complex128_t v = fcn( stdlib_complex128( re0, im0 ), stdlib_complex128( re1, im1 ) );
|
|
284
284
|
double re;
|
|
285
285
|
double im;
|
|
286
|
-
|
|
286
|
+
stdlib_complex128_reim( v, &re, &im );
|
|
287
287
|
|
|
288
288
|
napi_value obj;
|
|
289
289
|
status = napi_create_object( env, &obj );
|
|
@@ -439,7 +439,7 @@ napi_value stdlib_math_base_napi_cc_c( napi_env env, napi_callback_info info, st
|
|
|
439
439
|
stdlib_complex64_t v = fcn( stdlib_complex64( (float)re0, (float)im0 ), stdlib_complex64( (float)re1, (float)im1 ) );
|
|
440
440
|
float re;
|
|
441
441
|
float im;
|
|
442
|
-
|
|
442
|
+
stdlib_complex64_reim( v, &re, &im );
|
|
443
443
|
|
|
444
444
|
napi_value obj;
|
|
445
445
|
status = napi_create_object( env, &obj );
|
|
@@ -524,6 +524,130 @@ napi_value stdlib_math_base_napi_di_d( napi_env env, napi_callback_info info, do
|
|
|
524
524
|
return v;
|
|
525
525
|
}
|
|
526
526
|
|
|
527
|
+
/**
|
|
528
|
+
* Invokes a binary function accepting signed 32-bit integers 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_ii_d( napi_env env, napi_callback_info info, double (*fcn)( int32_t, int32_t ) ) {
|
|
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
|
+
int32_t y;
|
|
579
|
+
status = napi_get_value_int32( 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
|
+
|
|
589
|
+
/**
|
|
590
|
+
* Invokes a binary function accepting and returning signed 32-bit integers.
|
|
591
|
+
*
|
|
592
|
+
* ## Notes
|
|
593
|
+
*
|
|
594
|
+
* - This function expects that the callback `info` argument provides access to the following JavaScript arguments:
|
|
595
|
+
*
|
|
596
|
+
* - `x`: input value.
|
|
597
|
+
* - `y`: input value.
|
|
598
|
+
*
|
|
599
|
+
* @param env environment under which the function is invoked
|
|
600
|
+
* @param info callback data
|
|
601
|
+
* @param fcn binary function
|
|
602
|
+
* @return function return value as a Node-API signed 32-bit integer
|
|
603
|
+
*/
|
|
604
|
+
napi_value stdlib_math_base_napi_ii_i( napi_env env, napi_callback_info info, int32_t (*fcn)( int32_t, int32_t ) ) {
|
|
605
|
+
napi_status status;
|
|
606
|
+
|
|
607
|
+
size_t argc = 2;
|
|
608
|
+
napi_value argv[ 2 ];
|
|
609
|
+
status = napi_get_cb_info( env, info, &argc, argv, NULL, NULL );
|
|
610
|
+
assert( status == napi_ok );
|
|
611
|
+
|
|
612
|
+
if ( argc < 2 ) {
|
|
613
|
+
status = napi_throw_error( env, NULL, "invalid invocation. Must provide two numbers." );
|
|
614
|
+
assert( status == napi_ok );
|
|
615
|
+
return NULL;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
napi_valuetype vtype0;
|
|
619
|
+
status = napi_typeof( env, argv[ 0 ], &vtype0 );
|
|
620
|
+
assert( status == napi_ok );
|
|
621
|
+
if ( vtype0 != napi_number ) {
|
|
622
|
+
status = napi_throw_type_error( env, NULL, "invalid argument. First argument must be a number." );
|
|
623
|
+
assert( status == napi_ok );
|
|
624
|
+
return NULL;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
napi_valuetype vtype1;
|
|
628
|
+
status = napi_typeof( env, argv[ 1 ], &vtype1 );
|
|
629
|
+
assert( status == napi_ok );
|
|
630
|
+
if ( vtype1 != napi_number ) {
|
|
631
|
+
status = napi_throw_type_error( env, NULL, "invalid argument. Second argument must be a number." );
|
|
632
|
+
assert( status == napi_ok );
|
|
633
|
+
return NULL;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
int32_t x;
|
|
637
|
+
status = napi_get_value_int32( env, argv[ 0 ], &x );
|
|
638
|
+
assert( status == napi_ok );
|
|
639
|
+
|
|
640
|
+
int32_t y;
|
|
641
|
+
status = napi_get_value_int32( env, argv[ 1 ], &y );
|
|
642
|
+
assert( status == napi_ok );
|
|
643
|
+
|
|
644
|
+
napi_value v;
|
|
645
|
+
status = napi_create_int32( env, fcn( x, y ), &v );
|
|
646
|
+
assert( status == napi_ok );
|
|
647
|
+
|
|
648
|
+
return v;
|
|
649
|
+
}
|
|
650
|
+
|
|
527
651
|
/**
|
|
528
652
|
* Invokes a binary function accepting a single-precision floating-point number and a signed 32-bit integer and returning a single-precision floating-point number.
|
|
529
653
|
*
|
|
@@ -682,7 +806,7 @@ napi_value stdlib_math_base_napi_zi_z( napi_env env, napi_callback_info info, st
|
|
|
682
806
|
stdlib_complex128_t v = fcn( stdlib_complex128( re0, im0 ), y );
|
|
683
807
|
double re;
|
|
684
808
|
double im;
|
|
685
|
-
|
|
809
|
+
stdlib_complex128_reim( v, &re, &im );
|
|
686
810
|
|
|
687
811
|
napi_value obj;
|
|
688
812
|
status = napi_create_object( env, &obj );
|
|
@@ -801,7 +925,7 @@ napi_value stdlib_math_base_napi_ci_c( napi_env env, napi_callback_info info, st
|
|
|
801
925
|
stdlib_complex64_t v = fcn( stdlib_complex64( (float)re0, (float)im0 ), y );
|
|
802
926
|
float re;
|
|
803
927
|
float im;
|
|
804
|
-
|
|
928
|
+
stdlib_complex64_reim( v, &re, &im );
|
|
805
929
|
|
|
806
930
|
napi_value obj;
|
|
807
931
|
status = napi_create_object( env, &obj );
|
|
@@ -920,7 +1044,7 @@ napi_value stdlib_math_base_napi_zd_z( napi_env env, napi_callback_info info, st
|
|
|
920
1044
|
stdlib_complex128_t v = fcn( stdlib_complex128( re0, im0 ), y );
|
|
921
1045
|
double re;
|
|
922
1046
|
double im;
|
|
923
|
-
|
|
1047
|
+
stdlib_complex128_reim( v, &re, &im );
|
|
924
1048
|
|
|
925
1049
|
napi_value obj;
|
|
926
1050
|
status = napi_create_object( env, &obj );
|
|
@@ -1039,7 +1163,7 @@ napi_value stdlib_math_base_napi_cf_c( napi_env env, napi_callback_info info, st
|
|
|
1039
1163
|
stdlib_complex64_t v = fcn( stdlib_complex64( (float)re0, (float)im0 ), (float)y );
|
|
1040
1164
|
float re;
|
|
1041
1165
|
float im;
|
|
1042
|
-
|
|
1166
|
+
stdlib_complex64_reim( v, &re, &im );
|
|
1043
1167
|
|
|
1044
1168
|
napi_value obj;
|
|
1045
1169
|
status = napi_create_object( env, &obj );
|
package/include.gypi
DELETED
|
@@ -1,53 +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 include file for building a Node.js native add-on.
|
|
18
|
-
#
|
|
19
|
-
# Main documentation:
|
|
20
|
-
#
|
|
21
|
-
# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md
|
|
22
|
-
# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md
|
|
23
|
-
{
|
|
24
|
-
# Define variables to be used throughout the configuration for all targets:
|
|
25
|
-
'variables': {
|
|
26
|
-
# Source directory:
|
|
27
|
-
'src_dir': './src',
|
|
28
|
-
|
|
29
|
-
# Include directories:
|
|
30
|
-
'include_dirs': [
|
|
31
|
-
'<!@(node -e "var arr = require(\'@stdlib/utils-library-manifest\')(\'./manifest.json\',{},{\'basedir\':process.cwd(),\'paths\':\'posix\'}).include; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }")',
|
|
32
|
-
],
|
|
33
|
-
|
|
34
|
-
# Add-on destination directory:
|
|
35
|
-
'addon_output_dir': './src',
|
|
36
|
-
|
|
37
|
-
# Source files:
|
|
38
|
-
'src_files': [
|
|
39
|
-
'<(src_dir)/addon.c',
|
|
40
|
-
'<!@(node -e "var arr = require(\'@stdlib/utils-library-manifest\')(\'./manifest.json\',{},{\'basedir\':process.cwd(),\'paths\':\'posix\'}).src; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }")',
|
|
41
|
-
],
|
|
42
|
-
|
|
43
|
-
# Library dependencies:
|
|
44
|
-
'libraries': [
|
|
45
|
-
'<!@(node -e "var arr = require(\'@stdlib/utils-library-manifest\')(\'./manifest.json\',{},{\'basedir\':process.cwd(),\'paths\':\'posix\'}).libraries; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }")',
|
|
46
|
-
],
|
|
47
|
-
|
|
48
|
-
# Library directories:
|
|
49
|
-
'library_dirs': [
|
|
50
|
-
'<!@(node -e "var arr = require(\'@stdlib/utils-library-manifest\')(\'./manifest.json\',{},{\'basedir\':process.cwd(),\'paths\':\'posix\'}).libpath; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }")',
|
|
51
|
-
],
|
|
52
|
-
}, # end variables
|
|
53
|
-
}
|