-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdecimal.cpp
More file actions
50 lines (45 loc) · 1.31 KB
/
Copy pathdecimal.cpp
File metadata and controls
50 lines (45 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*!
* decimal.js v10.5.0
* An arbitrary-precision Decimal type for JavaScript.
* https://github.com/MikeMcl/decimal.js
* Copyright (c) 2024 Huawei Device Co., Ltd.
* MIT Licence
*/
#include "native_engine/native_engine.h"
extern const char _binary_decimal_mjs_start[];
extern const char _binary_decimal_mjs_end[];
extern const char _binary_decimal_abc_start[];
extern const char _binary_decimal_abc_end[];
// Napi get mjs code function
extern "C" __attribute__((visibility("default")))
void NAPI_arkts_math_Decimal_GetMJSCode(const char **buf, int *buflen)
{
if (buf != nullptr) {
*buf = _binary_decimal_mjs_start;
}
if (buflen != nullptr) {
*buflen = _binary_decimal_mjs_end - _binary_decimal_mjs_start;
}
}
// Napi get abc code function
extern "C" __attribute__((visibility("default")))
void NAPI_arkts_math_Decimal_GetABCCode(const char **buf, int *buflen)
{
if (buf != nullptr) {
*buf = _binary_decimal_abc_start;
}
if (buflen != nullptr) {
*buflen = _binary_decimal_abc_end - _binary_decimal_abc_start;
}
}
/*
* Module define
*/
static napi_module DecimalModule = {
.nm_filename = nullptr,
.nm_modname = "arkts.math.Decimal",
};
extern "C" __attribute__((constructor)) void DecimalRegisterModule(void)
{
napi_module_register(&DecimalModule);
}