diff --git a/include/ast.hpp b/include/ast.hpp index e54da3b..a67d1f7 100644 --- a/include/ast.hpp +++ b/include/ast.hpp @@ -15,8 +15,10 @@ namespace broma { Windows = 2, Android = 4, iOS = 8, - Android32 = 20, // includes Android - Android64 = 36, // includes Android + Android32 = 16 | 4, // includes Android + Android64 = 32 | 4, // includes Android + MacIntel = 64 | 1, + MacArm = 128 | 1, }; inline Platform str_to_platform(std::string const& str) { @@ -24,6 +26,8 @@ namespace broma { if (str == "win") return Platform::Windows; if (str == "android") return Platform::Android; if (str == "ios") return Platform::iOS; + if (str == "imac") return Platform::MacIntel; + if (str == "m1") return Platform::MacArm; if (str == "android32") return Platform::Android32; if (str == "android64") return Platform::Android64; return Platform::None; @@ -49,7 +53,8 @@ namespace broma { /// @brief Binding offsets for each platform. struct PlatformNumber { - ptrdiff_t mac = -1; + ptrdiff_t imac = -1; + ptrdiff_t m1 = -1; ptrdiff_t ios = -1; ptrdiff_t win = -1; ptrdiff_t android32 = -1; diff --git a/src/basic_components.hpp b/src/basic_components.hpp index 9f6ad3d..7f4f008 100644 --- a/src/basic_components.hpp +++ b/src/basic_components.hpp @@ -88,6 +88,8 @@ namespace broma { keyword(android); keyword(android32); keyword(android64); + keyword(m1); + keyword(imac); keyword(PAD); #undef keyword @@ -103,5 +105,5 @@ namespace broma { /// @brief A platform identifier (mac, win, ios, android). template - struct tagged_platform : tagged_for_each> {}; + struct tagged_platform : tagged_for_each> {}; } // namespace broma diff --git a/src/bind.hpp b/src/bind.hpp index 298a8fc..972c6f5 100644 --- a/src/bind.hpp +++ b/src/bind.hpp @@ -45,8 +45,11 @@ namespace broma { size_t out = std::stoul(input.string(), nullptr, 16); switch (scratch->wip_bind_platform) { - case Platform::Mac: - scratch->wip_bind.mac = out; + case Platform::MacIntel: + scratch->wip_bind.imac = out; + break; + case Platform::MacArm: + scratch->wip_bind.m1 = out; break; case Platform::iOS: scratch->wip_bind.ios = out; diff --git a/src/member.hpp b/src/member.hpp index 344d849..9c458ec 100644 --- a/src/member.hpp +++ b/src/member.hpp @@ -84,8 +84,10 @@ namespace broma { scratch->wip_bind = p; if (auto platform = scratch->wip_platform_block) { - if ((platform.value() & Platform::Mac) != Platform::None) - scratch->wip_bind.mac = 0; + if ((platform.value() & Platform::MacIntel) != Platform::None) + scratch->wip_bind.imac = 0; + if ((platform.value() & Platform::MacArm) != Platform::None) + scratch->wip_bind.m1 = 0; if ((platform.value() & Platform::iOS) != Platform::None) scratch->wip_bind.ios = 0; if ((platform.value() & Platform::Windows) != Platform::None) @@ -111,7 +113,8 @@ namespace broma { auto platform = scratch->wip_platform_block.value(); - scratch->wip_bind.mac = (platform & Platform::Mac) != Platform::None ? out : 0; + scratch->wip_bind.imac = (platform & Platform::MacIntel) != Platform::None ? out : 0; + scratch->wip_bind.m1 = (platform & Platform::MacArm) != Platform::None ? out : 0; scratch->wip_bind.ios = (platform & Platform::iOS) != Platform::None ? out : 0; scratch->wip_bind.win = (platform & Platform::Windows) != Platform::None ? out : 0; scratch->wip_bind.android32 = (platform & Platform::Android32) != Platform::None ? out : 0; diff --git a/test/free.bro b/test/free.bro index 769533c..d004f3d 100644 --- a/test/free.bro +++ b/test/free.bro @@ -1,4 +1,4 @@ -void say_hello(int a, int b, int c) = win 0x0, mac 0x24, ios 0x343; +void say_hello(int a, int b, int c) = win 0x0, imac 0x24, m1 0x554, ios 0x343; void i_hate_mat(std::string a, std::vector b, std::vector& points) = mac 0x33; diff --git a/test/test.cpp b/test/test.cpp index 9fcbcac..421c5a5 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -11,7 +11,8 @@ void print_func(broma::FunctionProto& func, broma::PlatformNumber& addrs) { } std::cout << ") = " << std::hex; std::cout << "win 0x" << addrs.win << ", "; - std::cout << "mac 0x" << addrs.mac << ", "; + std::cout << "imac 0x" << addrs.imac << ", "; + std::cout << "m1 0x" << addrs.m1 << ", "; std::cout << "ios 0x" << addrs.ios << ";\n"; std::cout << std::dec; }