@@ -106,6 +106,69 @@ console.log( headerDir );
106
106
107
107
<!-- NOTE: keep in alphabetical order according to the suffix X_X -->
108
108
109
+ #### STDLIB_MATH_BASE_NAPI_MODULE_B_B( fcn )
110
+
111
+ Macro for registering a Node-API module exporting an interface for invoking a unary function accepting and returning 8-bit unsigned integers.
112
+
113
+ ``` c
114
+ #include < stdint.h>
115
+
116
+ static uint8_t scale ( const uint8_t x ) {
117
+ return x * 10;
118
+ }
119
+
120
+ // ...
121
+
122
+ // Register a Node-API module:
123
+ STDLIB_MATH_BASE_NAPI_MODULE_B_B( scale );
124
+ ```
125
+
126
+ The macro expects the following arguments:
127
+
128
+ - **fcn**: `uint8_t (*fcn)( uint8_t )` unary function.
129
+
130
+ When used, this macro should be used **instead of** `NAPI_MODULE`. The macro includes `NAPI_MODULE`, thus ensuring Node-API module registration.
131
+
132
+ #### stdlib_math_base_napi_b_b( env, info, fcn )
133
+
134
+ Invokes a unary function accepting and returning unsigned 8-bit integers.
135
+
136
+ ```c
137
+ #include <node_api.h>
138
+ #include <stdint.h>
139
+
140
+ // ...
141
+
142
+ static uint8_t identity( const uint8_t x ) {
143
+ return x;
144
+ }
145
+
146
+ // ...
147
+
148
+ /**
149
+ * Receives JavaScript callback invocation data.
150
+ *
151
+ * @param env environment under which the function is invoked
152
+ * @param info callback data
153
+ * @return Node-API value
154
+ */
155
+ napi_value addon( napi_env env, napi_callback_info info ) {
156
+ return stdlib_math_base_napi_b_b( env, info, identity );
157
+ }
158
+
159
+ // ...
160
+ ```
161
+
162
+ The function accepts the following arguments:
163
+
164
+ - ** env** : ` [in] napi_env ` environment under which the function is invoked.
165
+ - ** info** : ` [in] napi_callback_info ` callback data.
166
+ - ** fcn** : ` [in] uint8_t (*fcn)( uint8_t ) ` unary function.
167
+
168
+ ``` c
169
+ void stdlib_math_base_napi_b_b ( napi_env env, napi_callback_info info, uint8_t (* fcn)( uint8_t ) );
170
+ ```
171
+
109
172
#### STDLIB_MATH_BASE_NAPI_MODULE_C_C( fcn )
110
173
111
174
Macro for registering a Node-API module exporting an interface for invoking a unary function accepting and returning single-precision complex floating-point numbers.
@@ -610,6 +673,69 @@ The function accepts the following arguments:
610
673
void stdlib_math_base_napi_i_f ( napi_env env, napi_callback_info info, float (* fcn)( int32_t ) );
611
674
```
612
675
676
+ #### STDLIB_MATH_BASE_NAPI_MODULE_T_T( fcn )
677
+
678
+ Macro for registering a Node-API module exporting an interface for invoking a unary function accepting and returning 16-bit unsigned integers.
679
+
680
+ ```c
681
+ #include <stdint.h>
682
+
683
+ static uint16_t scale( const uint16_t x ) {
684
+ return x * 10;
685
+ }
686
+
687
+ // ...
688
+
689
+ // Register a Node-API module:
690
+ STDLIB_MATH_BASE_NAPI_MODULE_T_T( scale );
691
+ ```
692
+
693
+ The macro expects the following arguments:
694
+
695
+ - ** fcn** : ` uint16_t (*fcn)( uint16_t ) ` unary function.
696
+
697
+ When used, this macro should be used ** instead of** ` NAPI_MODULE ` . The macro includes ` NAPI_MODULE ` , thus ensuring Node-API module registration.
698
+
699
+ #### stdlib_math_base_napi_t_t( env, info, fcn )
700
+
701
+ Invokes a unary function accepting and returning unsigned 16-bit integers.
702
+
703
+ ``` c
704
+ #include < node_api.h>
705
+ #include < stdint.h>
706
+
707
+ // ...
708
+
709
+ static uint16_t identity ( const uint16_t x ) {
710
+ return x;
711
+ }
712
+
713
+ // ...
714
+
715
+ /**
716
+ * Receives JavaScript callback invocation data.
717
+ *
718
+ * @param env environment under which the function is invoked
719
+ * @param info callback data
720
+ * @return Node-API value
721
+ * /
722
+ napi_value addon( napi_env env, napi_callback_info info ) {
723
+ return stdlib_math_base_napi_t_t( env, info, identity );
724
+ }
725
+
726
+ // ...
727
+ ```
728
+
729
+ The function accepts the following arguments:
730
+
731
+ - **env**: `[in] napi_env` environment under which the function is invoked.
732
+ - **info**: `[in] napi_callback_info` callback data.
733
+ - **fcn**: `[in] uint16_t (*fcn)( uint16_t )` unary function.
734
+
735
+ ```c
736
+ void stdlib_math_base_napi_t_t( napi_env env, napi_callback_info info, uint16_t (*fcn)( uint16_t ) );
737
+ ```
738
+
613
739
#### STDLIB_MATH_BASE_NAPI_MODULE_I_I( fcn )
614
740
615
741
Macro for registering a Node-API module exporting an interface for invoking a unary function accepting and returning 32-bit signed integers.
@@ -673,6 +799,69 @@ The function accepts the following arguments:
673
799
void stdlib_math_base_napi_i_i ( napi_env env, napi_callback_info info, int32_t (* fcn)( int32_t ) );
674
800
```
675
801
802
+ #### STDLIB_MATH_BASE_NAPI_MODULE_U_U( fcn )
803
+
804
+ Macro for registering a Node-API module exporting an interface for invoking a unary function accepting and returning 32-bit unsigned integers.
805
+
806
+ ```c
807
+ #include <stdint.h>
808
+
809
+ static uint32_t scale( const uint32_t x ) {
810
+ return x * 10;
811
+ }
812
+
813
+ // ...
814
+
815
+ // Register a Node-API module:
816
+ STDLIB_MATH_BASE_NAPI_MODULE_U_U( scale );
817
+ ```
818
+
819
+ The macro expects the following arguments:
820
+
821
+ - ** fcn** : ` uint32_t (*fcn)( uint32_t ) ` unary function.
822
+
823
+ When used, this macro should be used ** instead of** ` NAPI_MODULE ` . The macro includes ` NAPI_MODULE ` , thus ensuring Node-API module registration.
824
+
825
+ #### stdlib_math_base_napi_u_u( env, info, fcn )
826
+
827
+ Invokes a unary function accepting and returning unsigned 32-bit integers.
828
+
829
+ ``` c
830
+ #include < node_api.h>
831
+ #include < stdint.h>
832
+
833
+ // ...
834
+
835
+ static uint32_t identity ( const uint32_t x ) {
836
+ return x;
837
+ }
838
+
839
+ // ...
840
+
841
+ /**
842
+ * Receives JavaScript callback invocation data.
843
+ *
844
+ * @param env environment under which the function is invoked
845
+ * @param info callback data
846
+ * @return Node-API value
847
+ * /
848
+ napi_value addon( napi_env env, napi_callback_info info ) {
849
+ return stdlib_math_base_napi_u_u( env, info, identity );
850
+ }
851
+
852
+ // ...
853
+ ```
854
+
855
+ The function accepts the following arguments:
856
+
857
+ - **env**: `[in] napi_env` environment under which the function is invoked.
858
+ - **info**: `[in] napi_callback_info` callback data.
859
+ - **fcn**: `[in] uint32_t (*fcn)( uint32_t )` unary function.
860
+
861
+ ```c
862
+ void stdlib_math_base_napi_u_u( napi_env env, napi_callback_info info, uint32_t (*fcn)( uint32_t ) );
863
+ ```
864
+
676
865
#### STDLIB_MATH_BASE_NAPI_MODULE_Z_D( fcn )
677
866
678
867
Macro for registering a Node-API module exporting an interface for invoking a unary function accepting a double-precision complex floating-point number and returning a double-precision floating-point number.
0 commit comments