• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 #include "common.h"
17 
impl_ProceedToState(KNativePointer contextPtr,KInt state)18 KNativePointer impl_ProceedToState(KNativePointer contextPtr, KInt state)
19 {
20     auto context = reinterpret_cast<es2panda_Context *>(contextPtr);
21     return GetPublicImpl()->ProceedToState(context, es2panda_ContextState(state));
22 }
TS_INTEROP_2(ProceedToState,KNativePointer,KNativePointer,KInt)23 TS_INTEROP_2(ProceedToState, KNativePointer, KNativePointer, KInt)
24 
25 KNativePointer impl_ContextProgram(KNativePointer contextPtr)
26 {
27     auto context = reinterpret_cast<es2panda_Context *>(contextPtr);
28     return GetPublicImpl()->ContextProgram(context);
29 }
TS_INTEROP_1(ContextProgram,KNativePointer,KNativePointer)30 TS_INTEROP_1(ContextProgram, KNativePointer, KNativePointer)
31 
32 KNativePointer impl_CreateContextFromString(KNativePointer configPtr, KStringPtr &sourcePtr, KStringPtr &filenamePtr)
33 {
34     auto config = reinterpret_cast<es2panda_Config *>(configPtr);
35     return GetPublicImpl()->CreateContextFromString(config, sourcePtr.data(), filenamePtr.data());
36 }
TS_INTEROP_3(CreateContextFromString,KNativePointer,KNativePointer,KStringPtr,KStringPtr)37 TS_INTEROP_3(CreateContextFromString, KNativePointer, KNativePointer, KStringPtr, KStringPtr)
38 
39 KInt impl_GenerateTsDeclarationsFromContext(KNativePointer contextPtr, KStringPtr &outputDeclEts, KStringPtr &outputEts,
40                                             KBoolean exportAll, KStringPtr &recordFile)
41 {
42     auto context = reinterpret_cast<es2panda_Context *>(contextPtr);
43     return static_cast<KInt>(GetPublicImpl()->GenerateTsDeclarationsFromContext(
44         context, outputDeclEts.data(), outputEts.data(), exportAll != 0, recordFile.data()));
45 }
TS_INTEROP_5(GenerateTsDeclarationsFromContext,KInt,KNativePointer,KStringPtr,KStringPtr,KBoolean,KStringPtr)46 TS_INTEROP_5(GenerateTsDeclarationsFromContext, KInt, KNativePointer, KStringPtr, KStringPtr, KBoolean, KStringPtr)
47 
48 KNativePointer impl_CreateContextFromFile(KNativePointer configPtr, KStringPtr &filenamePtr)
49 {
50     auto config = reinterpret_cast<es2panda_Config *>(configPtr);
51     return GetPublicImpl()->CreateContextFromFile(config, GetStringCopy(filenamePtr));
52 }
TS_INTEROP_2(CreateContextFromFile,KNativePointer,KNativePointer,KStringPtr)53 TS_INTEROP_2(CreateContextFromFile, KNativePointer, KNativePointer, KStringPtr)
54 
55 KInt impl_ContextState(KNativePointer contextPtr)
56 {
57     auto context = reinterpret_cast<es2panda_Context *>(contextPtr);
58 
59     return static_cast<KInt>(GetPublicImpl()->ContextState(context));
60 }
TS_INTEROP_1(ContextState,KInt,KNativePointer)61 TS_INTEROP_1(ContextState, KInt, KNativePointer)
62 
63 KNativePointer impl_ContextErrorMessage(KNativePointer contextPtr)
64 {
65     auto context = reinterpret_cast<es2panda_Context *>(contextPtr);
66     return new std::string(GetPublicImpl()->ContextErrorMessage(context));
67 }
TS_INTEROP_1(ContextErrorMessage,KNativePointer,KNativePointer)68 TS_INTEROP_1(ContextErrorMessage, KNativePointer, KNativePointer)
69 
70 KNativePointer impl_GetAllErrorMessages(KNativePointer contextPtr)
71 {
72     auto context = reinterpret_cast<es2panda_Context *>(contextPtr);
73     return new std::string(GetPublicImpl()->GetAllErrorMessages(context));
74 }
75 TS_INTEROP_1(GetAllErrorMessages, KNativePointer, KNativePointer)
76