Record compiler name and version at build time

This commit is contained in:
Lassi Kortela 2019-08-27 15:21:00 +03:00
parent c72f12b85c
commit 1f55ef2a3b
2 changed files with 14 additions and 1 deletions

View File

@ -55,6 +55,17 @@ static value_t envst_language(void)
return head; 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) static value_t envst_os(void)
{ {
value_t head, tail; value_t head, tail;
@ -94,8 +105,8 @@ value_t builtin_environment_stack(value_t *args, uint32_t nargs)
(void)args; (void)args;
argcount("environment-stack", nargs, 0); argcount("environment-stack", nargs, 0);
head = tail = fl_cons(envst_language(), FL_NIL); head = tail = fl_cons(envst_language(), FL_NIL);
push(&tail, envst_language_c());
push(&tail, envst_os()); push(&tail, envst_os());
push(&tail, envst_computer()); push(&tail, envst_computer());
return head; return head;

View File

@ -3,6 +3,8 @@ typedef uintptr_t ufixnum_t;
typedef intptr_t fixnum_t; typedef intptr_t fixnum_t;
#define BITS64 #define BITS64
#define SCHEME_C_COMPILER_NAME "GCC" // TODO: wrong
#define SCHEME_C_COMPILER_VERSION __VERSION__
#ifdef BITS64 #ifdef BITS64
#define UINT64_TOP_BIT 0x8000000000000000ULL #define UINT64_TOP_BIT 0x8000000000000000ULL