• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*!
2  *  decimal.js v10.4.3
3  *  An arbitrary-precision Decimal type for JavaScript.
4  *  https://github.com/MikeMcl/decimal.js
5  *  Copyright (c) 2024 Huawei Device Co., Ltd.
6  *  MIT Licence
7  */
8 
9 #include "native_engine/native_engine.h"
10 
11 extern const char _binary_decimal_mjs_start[];
12 extern const char _binary_decimal_mjs_end[];
13 extern const char _binary_decimal_abc_start[];
14 extern const char _binary_decimal_abc_end[];
15 
16 // Napi get mjs code function
17 extern "C" __attribute__((visibility("default")))
NAPI_arkts_math_Decimal_GetMJSCode(const char ** buf,int * buflen)18 void NAPI_arkts_math_Decimal_GetMJSCode(const char **buf, int *buflen)
19 {
20     if (buf != nullptr) {
21         *buf = _binary_decimal_mjs_start;
22     }
23     if (buflen != nullptr) {
24         *buflen = _binary_decimal_mjs_end - _binary_decimal_mjs_start;
25     }
26 }
27 
28 // Napi get abc code function
29 extern "C" __attribute__((visibility("default")))
NAPI_arkts_math_Decimal_GetABCCode(const char ** buf,int * buflen)30 void NAPI_arkts_math_Decimal_GetABCCode(const char **buf, int *buflen)
31 {
32     if (buf != nullptr) {
33         *buf = _binary_decimal_abc_start;
34     }
35     if (buflen != nullptr) {
36         *buflen = _binary_decimal_abc_end - _binary_decimal_abc_start;
37     }
38 }
39 
40 /*
41  * Module define
42  */
43 static napi_module DecimalModule = {
44     .nm_filename = nullptr,
45     .nm_modname = "arkts.math.Decimal",
46 };
DecimalRegisterModule(void)47 extern "C" __attribute__((constructor)) void DecimalRegisterModule(void)
48 {
49     napi_module_register(&DecimalModule);
50 }
51