1 /* 2 * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 3 * 4 * HDF is dual licensed: you can use it either under the terms of 5 * the GPL, or the BSD license, at your option. 6 * See the LICENSE file in the root of this repository for complete details. 7 */ 8 9 #ifndef HCS_COMPILER_OPCODE_H 10 #define HCS_COMPILER_OPCODE_H 11 12 #include "hcs_parser.h" 13 14 #define HCS_NODE_OP 0x01 15 #define HCS_TERM_OP 0x02 16 #define HCS_NODEREF_OP 0x03 17 #define HCS_ARRAY_OP 0x04 18 #define HCS_BYTE_OP 0x10 19 #define HCS_WORD_OP 0x11 20 #define HCS_DWORD_OP 0x12 21 #define HCS_QWORD_OP 0x13 22 #define HCS_STRING_OP 0x14 23 24 typedef struct { 25 uint8_t opCode; 26 uint32_t size; 27 const char *opStr; 28 } OpCodeMapEntry; 29 30 const OpCodeMapEntry *HcsGetOpCodeMap(void); 31 32 const OpCodeMapEntry *HcsParserObjectTypeToByteCode(uint32_t objectType); 33 34 void HcsCalculateOpcodeSize(ParserObject *object); 35 36 const char *HcsOpcodeToStr(uint16_t opCode); 37 38 #endif // HCS_COMPILER_OPCODE_H 39