From: Brendan Hansen Date: Fri, 24 Nov 2023 19:32:41 +0000 (-0600) Subject: added: onyx version information to runtime X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=2703880aefe123cb56f82c6e02d5df601014433f;p=onyx.git added: onyx version information to runtime --- diff --git a/compiler/include/astnodes.h b/compiler/include/astnodes.h index 24b9bd9b..e92f9707 100644 --- a/compiler/include/astnodes.h +++ b/compiler/include/astnodes.h @@ -1,6 +1,10 @@ #ifndef ONYXASTNODES_H #define ONYXASTNODES_H +#define VERSION_MAJOR 0 +#define VERSION_MINOR 1 +#define VERSION_PATCH 8 + #include "stb_ds.h" #include "lex.h" #include "types.h" diff --git a/compiler/src/builtins.c b/compiler/src/builtins.c index 2ebcf646..c78a7f58 100644 --- a/compiler/src/builtins.c +++ b/compiler/src/builtins.c @@ -611,6 +611,17 @@ void introduce_build_options(bh_allocator a) { stack_trace->type_node = (AstType *) &basic_type_bool; symbol_builtin_introduce(p->scope, "Stack_Trace_Enabled", (AstNode *) stack_trace); + AstNumLit* version_major = make_int_literal(a, VERSION_MAJOR); + version_major->type_node = (AstType *) &basic_type_i32; + AstNumLit* version_minor = make_int_literal(a, VERSION_MINOR); + version_minor->type_node = (AstType *) &basic_type_i32; + AstNumLit* version_patch = make_int_literal(a, VERSION_PATCH); + version_patch->type_node = (AstType *) &basic_type_i32; + symbol_builtin_introduce(p->scope, "onyx_version_major", (AstNode *) version_major); + symbol_builtin_introduce(p->scope, "onyx_version_minor", (AstNode *) version_minor); + symbol_builtin_introduce(p->scope, "onyx_version_patch", (AstNode *) version_patch); + + i32 os; #ifdef _BH_LINUX os = 1; @@ -658,6 +669,5 @@ void introduce_build_options(bh_allocator a) { foreign_info->type_node = (AstType *) &basic_type_bool; symbol_builtin_introduce(p->scope, "Generated_Foreign_Info", (AstNode *) foreign_info); } - } diff --git a/compiler/src/onyx.c b/compiler/src/onyx.c index eb77f02f..a8ae0292 100644 --- a/compiler/src/onyx.c +++ b/compiler/src/onyx.c @@ -19,7 +19,10 @@ extern struct bh_allocator global_heap_allocator; #include "wasm_emit.h" #include "doc.h" -#define VERSION "v0.1.8" + +#define VERSION__(m,i,p) "v" #m "." #i "." #p +#define VERSION_(m,i,p) VERSION__(m,i,p) +#define VERSION VERSION_(VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH) #ifdef ONYX_RUNTIME_LIBRARY #define ONYX_RUNTIME_LIBRARY_MAPPED ONYX_RUNTIME_LIBRARY