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
This commit is contained in:
Edwin Brady 2020-05-18 19:03:41 +01:00
parent 0ef2885548
commit 8c9eec15a8
2 changed files with 8 additions and 1 deletions

View File

@ -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

View File

@ -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) '())