From c096eb37487295610ff43825163d676b35799c5d Mon Sep 17 00:00:00 2001 From: Mustafa Quraish Date: Sat, 5 Feb 2022 02:07:25 -0500 Subject: Add `OS_IS_MACOS` and `OS_IS_LINUX` constants as builtins --- src/builtins.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/builtins.c b/src/builtins.c index 97ac9ee..541e628 100644 --- a/src/builtins.c +++ b/src/builtins.c @@ -40,6 +40,14 @@ void initialize_builtins() { push_posix_constants(); +#if __APPLE__ + push_constant("OS_IS_MACOS", 1); + push_constant("OS_IS_LINUX", 0); +#else + push_constant("OS_IS_MACOS", 0); + push_constant("OS_IS_LINUX", 1); +#endif + Node *node; // FIXME: The `TYPE_ANY` is a hack node = Node_new(AST_BUILTIN); -- cgit v1.2.3