1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_ACELITE_JSI_INTERNAL_H 17 #define OHOS_ACELITE_JSI_INTERNAL_H 18 19 #include "jsi_config.h" 20 #if (ENABLE_JERRY == 1) 21 #include "jerryscript.h" 22 #endif 23 24 /** 25 * Macros for conversions between jsi-values and jerry-values. 26 */ 27 #if (ENABLE_JERRY == 1) 28 #define AS_JERRY_VALUE(jsiValue) (jerry_value_t)(uintptr_t) jsiValue 29 #define AS_JLENGTH_VALUE(jsiValue) (jerry_length_t)(uintptr_t) jsiValue 30 #define AS_JSI_VALUE(jValue) (JSIValue)(uintptr_t) jValue 31 #endif 32 33 /** 34 * A convenience macro to create jerry-values. 35 */ 36 #if (ENABLE_JERRY == 1) 37 #define JERRY_CREATE(var, create) jerry_value_t var = (create); 38 #endif 39 40 /** 41 * Key words for native module callbacks. 42 */ 43 constexpr char ON_TERMINATE[] = "onTerminate"; 44 constexpr char ON_DESTROY_HANDLER[] = "onDestroyHandler"; 45 constexpr char ON_TERMINATE_HANDLER[] = "onTerminateHandler"; 46 47 #endif // OHOS_ACELITE_JSI_INTERNAL_H 48