From 1f55ef2a3b88facd698b981fb07c2be57956da1f Mon Sep 17 00:00:00 2001 From: Lassi Kortela Date: Tue, 27 Aug 2019 15:21:00 +0300 Subject: [PATCH] Record compiler name and version at build time --- c/env_unix.c | 13 ++++++++++++- c/scheme_compiler_gnuc.h | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/c/env_unix.c b/c/env_unix.c index 9ad68d6..3391d57 100644 --- a/c/env_unix.c +++ b/c/env_unix.c @@ -55,6 +55,17 @@ static value_t envst_language(void) return head; } +static value_t envst_language_c(void) +{ + value_t head, tail; + + head = tail = fl_cons(symbol("language"), FL_NIL); + push_pair(&tail, "implementation-name", string_from_cstr( + SCHEME_C_COMPILER_NAME)); + push_pair(&tail, "implementation-version", + string_from_cstr(SCHEME_C_COMPILER_VERSION)); + return head; +} static value_t envst_os(void) { value_t head, tail; @@ -94,8 +105,8 @@ value_t builtin_environment_stack(value_t *args, uint32_t nargs) (void)args; argcount("environment-stack", nargs, 0); - head = tail = fl_cons(envst_language(), FL_NIL); + push(&tail, envst_language_c()); push(&tail, envst_os()); push(&tail, envst_computer()); return head; diff --git a/c/scheme_compiler_gnuc.h b/c/scheme_compiler_gnuc.h index 69c4f2e..c7a11a4 100644 --- a/c/scheme_compiler_gnuc.h +++ b/c/scheme_compiler_gnuc.h @@ -3,6 +3,8 @@ typedef uintptr_t ufixnum_t; typedef intptr_t fixnum_t; #define BITS64 +#define SCHEME_C_COMPILER_NAME "GCC" // TODO: wrong +#define SCHEME_C_COMPILER_VERSION __VERSION__ #ifdef BITS64 #define UINT64_TOP_BIT 0x8000000000000000ULL