summaryrefslogtreecommitdiff
path: root/src/binary.h
diff options
context:
space:
mode:
authorBen Smith <binjimin@gmail.com>2019-01-23 15:12:42 -0800
committerGitHub <noreply@github.com>2019-01-23 15:12:42 -0800
commit12e8de7f5b3a5be01e3e6347c64168ea34b85a38 (patch)
tree65d9e0c3f81620a2931f48de214f14d5cf97eab1 /src/binary.h
parentc37eef7de4df2b4d523b8b1daecf5207a0da4ec2 (diff)
downloadwabt-12e8de7f5b3a5be01e3e6347c64168ea34b85a38.tar.gz
wabt-12e8de7f5b3a5be01e3e6347c64168ea34b85a38.tar.bz2
wabt-12e8de7f5b3a5be01e3e6347c64168ea34b85a38.zip
Implement parsing and writing of DataCount section (#998)
Diffstat (limited to 'src/binary.h')
-rw-r--r--src/binary.h21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/binary.h b/src/binary.h
index eee09f66..747c28e2 100644
--- a/src/binary.h
+++ b/src/binary.h
@@ -41,6 +41,7 @@
V(Export, export, 7) \
V(Start, start, 8) \
V(Elem, elem, 9) \
+ V(DataCount, data_count, 12) \
V(Code, code, 10) \
V(Data, data, 11)
@@ -51,14 +52,23 @@ enum class BinarySection {
#define V(Name, name, code) Name = code,
WABT_FOREACH_BINARY_SECTION(V)
#undef V
- Invalid,
+ Invalid = ~0,
First = Custom,
- Last = Data,
+ Last = DataCount,
};
/* clang-format on */
static const int kBinarySectionCount = WABT_ENUM_COUNT(BinarySection);
+enum class BinarySectionOrder {
+#define V(Name, name, code) Name,
+ WABT_FOREACH_BINARY_SECTION(V)
+#undef V
+};
+
+BinarySectionOrder GetSectionOrder(BinarySection);
+const char* GetSectionName(BinarySection);
+
enum class NameSectionSubsection {
Module = 0,
Function = 1,
@@ -71,13 +81,6 @@ enum class SegmentFlags : uint8_t {
IndexOther = 2,
};
-extern const char* g_section_name[];
-
-static WABT_INLINE const char* GetSectionName(BinarySection sec) {
- assert(static_cast<int>(sec) < kBinarySectionCount);
- return g_section_name[static_cast<size_t>(sec)];
-}
-
} // namespace wabt
#endif /* WABT_BINARY_H_ */