From 8c9eec15a8be7f8d6eb537dfdb598ad961f58153 Mon Sep 17 00:00:00 2001 From: Edwin Brady Date: Mon, 18 May 2020 19:03:41 +0100 Subject: [PATCH] Calculate OS from scheme code This way if you distribute scheme it won't have an OS hard coded based on the machine it was generated on --- src/Compiler/Scheme/Common.idr | 2 +- support/chez/support.ss | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Compiler/Scheme/Common.idr b/src/Compiler/Scheme/Common.idr index 05362a1..1774212 100644 --- a/src/Compiler/Scheme/Common.idr +++ b/src/Compiler/Scheme/Common.idr @@ -425,7 +425,7 @@ parameters (schExtPrim : Int -> ExtPrim -> List NamedCExp -> Core String, schExtCommon i VoidElim [_, _] = pure "(display \"Error: Executed 'void'\")" schExtCommon i SysOS [] - = pure $ show os + = pure $ "(blodwen-os)" schExtCommon i (Unknown n) args = throw (InternalError ("Can't compile unknown external primitive " ++ show n)) schExtCommon i prim args diff --git a/support/chez/support.ss b/support/chez/support.ss index 3434818..5e36f73 100644 --- a/support/chez/support.ss +++ b/support/chez/support.ss @@ -1,3 +1,10 @@ +(define (blodwen-os) + (case (machine-type) + [(i3le ti3le a6le ta6le) "unix"] + [(i3osx ti3osx a6osx ta6osx) "darwin"] + [(i3nt ti3nt a6nt ta6nt) "windows"] + [else "unknown"])) + (define blodwen-read-args (lambda (desc) (case (vector-ref desc 0) ((0) '())