@@ -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.
@@ -673,6 +736,132 @@ The function accepts the following arguments:
673
736
void stdlib_math_base_napi_i_i( napi_env env, napi_callback_info info, int32_t (*fcn)( int32_t ) );
674
737
```
675
738
739
+ #### STDLIB_MATH_BASE_NAPI_MODULE_T_T( fcn )
740
+
741
+ Macro for registering a Node-API module exporting an interface for invoking a unary function accepting and returning 16-bit unsigned integers.
742
+
743
+ ``` c
744
+ #include < stdint.h>
745
+
746
+ static uint16_t scale ( const uint16_t x ) {
747
+ return x * 10;
748
+ }
749
+
750
+ // ...
751
+
752
+ // Register a Node-API module:
753
+ STDLIB_MATH_BASE_NAPI_MODULE_T_T( scale );
754
+ ```
755
+
756
+ The macro expects the following arguments:
757
+
758
+ - **fcn**: `uint16_t (*fcn)( uint16_t )` unary function.
759
+
760
+ When used, this macro should be used **instead of** `NAPI_MODULE`. The macro includes `NAPI_MODULE`, thus ensuring Node-API module registration.
761
+
762
+ #### stdlib_math_base_napi_t_t( env, info, fcn )
763
+
764
+ Invokes a unary function accepting and returning unsigned 16-bit integers.
765
+
766
+ ```c
767
+ #include <node_api.h>
768
+ #include <stdint.h>
769
+
770
+ // ...
771
+
772
+ static uint16_t identity( const uint16_t x ) {
773
+ return x;
774
+ }
775
+
776
+ // ...
777
+
778
+ /**
779
+ * Receives JavaScript callback invocation data.
780
+ *
781
+ * @param env environment under which the function is invoked
782
+ * @param info callback data
783
+ * @return Node-API value
784
+ */
785
+ napi_value addon( napi_env env, napi_callback_info info ) {
786
+ return stdlib_math_base_napi_t_t( env, info, identity );
787
+ }
788
+
789
+ // ...
790
+ ```
791
+
792
+ The function accepts the following arguments:
793
+
794
+ - ** env** : ` [in] napi_env ` environment under which the function is invoked.
795
+ - ** info** : ` [in] napi_callback_info ` callback data.
796
+ - ** fcn** : ` [in] uint16_t (*fcn)( uint16_t ) ` unary function.
797
+
798
+ ``` c
799
+ void stdlib_math_base_napi_t_t ( napi_env env, napi_callback_info info, uint16_t (* fcn)( uint16_t ) );
800
+ ```
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