1/** 2 * Copyright (c) 2024 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// Autogenerated file -- DO NOT EDIT! 17 18#ifndef ES2PANDA_PUBLIC_ES2PANDA_LIB 19#define ES2PANDA_PUBLIC_ES2PANDA_LIB 20 21// Switch off the linter for C header 22// NOLINTBEGIN 23// 24 25#include <stdbool.h> 26#include <stddef.h> 27#include <stdint.h> 28#include <uchar.h> 29 30#ifdef __cplusplus 31extern "C" { 32#endif 33 34#define ES2PANDA_LIB_VERSION 1 35 36typedef struct es2panda_Config es2panda_Config; 37typedef struct es2panda_Context es2panda_Context; 38 39typedef struct es2panda_variantDoubleCharArrayBool { 40 int index; 41 union { 42 double d; 43 char *c; 44 bool b; 45 } variant; 46} es2panda_variantDoubleCharArrayBool; 47 48enum es2panda_variantIndex { 49 DOUBLE = 0, 50 CHAR = 1, 51 BOOL = 2, 52}; 53 54typedef struct es2panda_Program es2panda_Program; 55typedef struct es2panda_ExternalSource es2panda_ExternalSource; 56typedef struct es2panda_AstNode es2panda_AstNode; 57typedef struct es2panda_FunctionSignature es2panda_FunctionSignature; 58typedef struct es2panda_Language es2panda_Language; 59typedef struct es2panda_SourcePosition es2panda_SourcePosition; 60typedef struct es2panda_SourceRange es2panda_SourceRange; 61typedef struct es2panda_SrcDumper es2panda_SrcDumper; 62typedef struct es2panda_AstDumper es2panda_AstDumper; 63typedef struct es2panda_LabelPair es2panda_LabelPair; 64typedef struct es2panda_ScriptFunctionData es2panda_ScriptFunctionData; 65typedef struct es2panda_ImportSource es2panda_ImportSource; 66typedef struct es2panda_Signature es2panda_Signature; 67typedef struct es2panda_ValidationInfo es2panda_ValidationInfo; 68typedef struct es2panda_Type es2panda_Type; 69typedef struct es2panda_Variable es2panda_Variable; 70typedef struct es2panda_Scope es2panda_Scope; 71typedef struct es2panda_AstVisitor es2panda_AstVisitor; 72typedef struct es2panda_CodeGen es2panda_CodeGen; 73typedef struct es2panda_VReg es2panda_VReg; 74typedef void (*NodeTraverser)(es2panda_AstNode *); 75typedef es2panda_AstNode *(*NodeTransformer)(es2panda_AstNode *); 76typedef bool (*NodePredicate)(es2panda_AstNode *); 77 78enum es2panda_ContextState { 79 ES2PANDA_STATE_NEW, 80 ES2PANDA_STATE_PARSED, 81 ES2PANDA_STATE_SCOPE_INITED, 82 ES2PANDA_STATE_CHECKED, 83 ES2PANDA_STATE_LOWERED, 84 ES2PANDA_STATE_ASM_GENERATED, 85 ES2PANDA_STATE_BIN_GENERATED, 86 87 ES2PANDA_STATE_ERROR 88}; 89typedef enum es2panda_ContextState es2panda_ContextState; 90 91#include "generated/es2panda_lib/es2panda_lib_enums.inc" 92 93struct es2panda_Impl { 94 int version; 95 96 es2panda_Config *(*CreateConfig)(int argc, char const **argv); 97 void (*DestroyConfig)(es2panda_Config *config); 98 99 es2panda_Context *(*CreateContextFromFile)(es2panda_Config *config, char const *source_file_name); 100 es2panda_Context *(*CreateContextFromString)(es2panda_Config *config, char const *source, char const *file_name); 101 es2panda_Context *(*ProceedToState)(es2panda_Context *context, es2panda_ContextState state); // context is consumed 102 void (*DestroyContext)(es2panda_Context *context); 103 104 es2panda_ContextState (*ContextState)(es2panda_Context *context); 105 char const *(*ContextErrorMessage)(es2panda_Context *context); 106 107 es2panda_Program *(*ContextProgram)(es2panda_Context *context); 108 es2panda_AstNode *(*ProgramAst)(es2panda_Program *program); 109 es2panda_ExternalSource **(*ProgramExternalSources)(es2panda_Program *program, size_t *len_p); 110 char const *(*ExternalSourceName)(es2panda_ExternalSource *e_source); 111 es2panda_Program **(*ExternalSourcePrograms)(es2panda_ExternalSource *e_source, size_t *len_p); 112 void (*AstNodeForEach)(es2panda_AstNode *ast, void (*func)(es2panda_AstNode *, void *), void *arg); 113 114#define SET_NUMBER_LITERAL_DECL(name, type) bool (*SetNumberLiteral##name)(es2panda_AstNode * node, type new_value) 115 116 SET_NUMBER_LITERAL_DECL(Int, int32_t); 117 SET_NUMBER_LITERAL_DECL(Long, int64_t); 118 SET_NUMBER_LITERAL_DECL(Double, double); 119 SET_NUMBER_LITERAL_DECL(Float, float); 120 121#undef SET_NUMBER_LITERAL_DECL 122 123#include "generated/es2panda_lib/es2panda_lib_decl.inc" 124}; 125 126struct es2panda_Impl const *es2panda_GetImpl(int version); 127 128// NOLINTEND 129 130#ifdef __cplusplus 131} 132#endif 133 134#endif 135