Where Online Learning is simpler!
The C and C++ Include Header Files
cat -n /usr/include/wabt/binary.h
1 /* 2 * Copyright 2016 WebAssembly Community Group participants 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef WABT_BINARY_H_ 18 #define WABT_BINARY_H_ 19 20 #include "wabt/common.h" 21 22 #define WABT_BINARY_MAGIC 0x6d736100 23 #define WABT_BINARY_VERSION 1 24 #define WABT_BINARY_LIMITS_HAS_MAX_FLAG 0x1 25 #define WABT_BINARY_LIMITS_IS_SHARED_FLAG 0x2 26 #define WABT_BINARY_LIMITS_IS_64_FLAG 0x4 27 #define WABT_BINARY_LIMITS_ALL_FLAGS \ 28 (WABT_BINARY_LIMITS_HAS_MAX_FLAG | WABT_BINARY_LIMITS_IS_SHARED_FLAG | \ 29 WABT_BINARY_LIMITS_IS_64_FLAG) 30 31 #define WABT_BINARY_SECTION_NAME "name" 32 #define WABT_BINARY_SECTION_RELOC "reloc" 33 #define WABT_BINARY_SECTION_LINKING "linking" 34 #define WABT_BINARY_SECTION_TARGET_FEATURES "target_features" 35 #define WABT_BINARY_SECTION_DYLINK "dylink" 36 #define WABT_BINARY_SECTION_DYLINK0 "dylink.0" 37 #define WABT_BINARY_SECTION_CODE_METADATA "metadata.code." 38 39 #define WABT_FOREACH_BINARY_SECTION(V) \ 40 V(Custom, custom, 0) \ 41 V(Type, type, 1) \ 42 V(Import, import, 2) \ 43 V(Function, function, 3) \ 44 V(Table, table, 4) \ 45 V(Memory, memory, 5) \ 46 V(Tag, tag, 13) \ 47 V(Global, global, 6) \ 48 V(Export, export, 7) \ 49 V(Start, start, 8) \ 50 V(Elem, elem, 9) \ 51 V(DataCount, data_count, 12) \ 52 V(Code, code, 10) \ 53 V(Data, data, 11) 54 55 namespace wabt { 56 57 /* clang-format off */ 58 enum class BinarySection { 59 #define V(Name, name, code) Name = code, 60 WABT_FOREACH_BINARY_SECTION(V) 61 #undef V 62 Invalid = ~0, 63 64 First = Custom, 65 Last = Tag, 66 }; 67 /* clang-format on */ 68 constexpr int kBinarySectionCount = WABT_ENUM_COUNT(BinarySection); 69 70 enum class BinarySectionOrder { 71 #define V(Name, name, code) Name, 72 WABT_FOREACH_BINARY_SECTION(V) 73 #undef V 74 }; 75 76 BinarySectionOrder GetSectionOrder(BinarySection); 77 const char* GetSectionName(BinarySection); 78 79 // See 80 // https://github.com/WebAssembly/extended-name-section/blob/main/proposals/extended-name-section/Overview.md 81 enum class NameSectionSubsection { 82 Module = 0, 83 Function = 1, 84 Local = 2, 85 Label = 3, 86 Type = 4, 87 Table = 5, 88 Memory = 6, 89 Global = 7, 90 ElemSegment = 8, 91 DataSegment = 9, 92 Field = 10, 93 Tag = 11, 94 95 First = Module, 96 Last = Tag, 97 }; 98 const char* GetNameSectionSubsectionName(NameSectionSubsection subsec); 99 100 } // namespace wabt 101 102 #endif /* WABT_BINARY_H_ */