mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-11-24 15:07:37 +03:00
Write compiler version into generated files
This commit is contained in:
parent
fb1d118b2d
commit
9c63e90fd2
@ -11,6 +11,7 @@ modules =
|
||||
Compiler.CaseOpts,
|
||||
Compiler.Common,
|
||||
Compiler.CompileExpr,
|
||||
Compiler.Generated,
|
||||
Compiler.Inline,
|
||||
Compiler.LambdaLift,
|
||||
Compiler.Separate,
|
||||
|
8
src/Compiler/Generated.idr
Normal file
8
src/Compiler/Generated.idr
Normal file
@ -0,0 +1,8 @@
|
||||
module Compiler.Generated
|
||||
|
||||
import Idris.Version
|
||||
|
||||
export
|
||||
generatedString : String -> String
|
||||
generatedString backend =
|
||||
"@" ++ "generated by Idris " ++ (show version) ++ ", " ++ backend ++ " backend"
|
@ -2,6 +2,7 @@ module Compiler.Scheme.Chez
|
||||
|
||||
import Compiler.Common
|
||||
import Compiler.CompileExpr
|
||||
import Compiler.Generated
|
||||
import Compiler.Inline
|
||||
import Compiler.Scheme.Common
|
||||
|
||||
@ -85,7 +86,7 @@ findLibs ds
|
||||
schHeader : String -> List String -> Bool -> String
|
||||
schHeader chez libs whole
|
||||
= (if os /= "windows" then "#!" ++ chez ++ " --script\n\n" else "") ++
|
||||
"; @" ++ "generated\n" ++
|
||||
"; " ++ (generatedString "Chez") ++ "\n" ++
|
||||
"(import (chezscheme))\n" ++
|
||||
"(case (machine-type)\n" ++
|
||||
" [(i3fb ti3fb a6fb ta6fb) #f]\n" ++
|
||||
@ -385,7 +386,7 @@ export
|
||||
startChezPreamble : String
|
||||
startChezPreamble = unlines
|
||||
[ "#!/bin/sh"
|
||||
, "# this file is @" ++ "generated by Idris2 compiler, Chez backend"
|
||||
, "# " ++ (generatedString "Chez")
|
||||
, ""
|
||||
, "set -e # exit on any error"
|
||||
, ""
|
||||
@ -416,7 +417,7 @@ startChezCmd chez appdir target = unlines
|
||||
startChezWinSh : String -> String -> String -> String
|
||||
startChezWinSh chez appdir target = unlines
|
||||
[ "#!/bin/sh"
|
||||
, "# this file is @" ++ "generated by Idris2 compiler, Chez backend"
|
||||
, "# " ++ (generatedString "Chez")
|
||||
, ""
|
||||
, "set -e # exit on any error"
|
||||
, ""
|
||||
|
@ -2,6 +2,7 @@ module Compiler.Scheme.ChezSep
|
||||
|
||||
import Compiler.Common
|
||||
import Compiler.CompileExpr
|
||||
import Compiler.Generated
|
||||
import Compiler.Inline
|
||||
import Compiler.Scheme.Common
|
||||
import Compiler.Scheme.Chez
|
||||
@ -78,7 +79,7 @@ startChezCmd chez appDirSh targetSh = unlines
|
||||
startChezWinSh : String -> String -> String -> String
|
||||
startChezWinSh chez appDirSh targetSh = unlines
|
||||
[ "#!/bin/sh"
|
||||
, "# this file is @" ++ "generated by Idris2 compiler, Chez backend"
|
||||
, "# " ++ (generatedString "Chez")
|
||||
, ""
|
||||
, "set -e # exit on any error"
|
||||
, ""
|
||||
|
@ -2,6 +2,7 @@ module Compiler.Scheme.Gambit
|
||||
|
||||
import Compiler.Common
|
||||
import Compiler.CompileExpr
|
||||
import Compiler.Generated
|
||||
import Compiler.Inline
|
||||
import Compiler.Scheme.Common
|
||||
|
||||
@ -49,7 +50,7 @@ findGSCBackend =
|
||||
|
||||
schHeader : String
|
||||
schHeader =
|
||||
"; @" ++ "generated\n" ++
|
||||
"; " ++ (generatedString "Gambit") ++ "\n" ++
|
||||
"(declare (block)\n" ++
|
||||
"(inlining-limit 450)\n" ++
|
||||
"(standard-bindings)\n" ++
|
||||
|
@ -2,6 +2,7 @@ module Compiler.Scheme.Racket
|
||||
|
||||
import Compiler.Common
|
||||
import Compiler.CompileExpr
|
||||
import Compiler.Generated
|
||||
import Compiler.Inline
|
||||
import Compiler.Scheme.Common
|
||||
|
||||
@ -43,7 +44,7 @@ findRacoExe =
|
||||
schHeader : Bool -> String -> String
|
||||
schHeader prof libs
|
||||
= "#lang racket/base\n" ++
|
||||
"; @" ++ "generated\n" ++
|
||||
"; " ++ (generatedString "Racket") ++ "\n" ++
|
||||
"(require racket/async-channel)\n" ++ -- for asynchronous channels
|
||||
"(require racket/future)\n" ++ -- for parallelism/concurrency
|
||||
"(require racket/math)\n" ++ -- for math ops
|
||||
@ -331,7 +332,7 @@ getFgnCall appdir (n, fc, d) = schFgnDef appdir fc n d
|
||||
startRacket : String -> String -> String -> String
|
||||
startRacket racket appdir target = unlines
|
||||
[ "#!/bin/sh"
|
||||
, "# this file is @" ++ "generated by Idris2 compiler, Racket backend"
|
||||
, "# " ++ (generatedString "Racket")
|
||||
, ""
|
||||
, "set -e # exit on any error"
|
||||
, ""
|
||||
@ -356,7 +357,7 @@ startRacketCmd racket appdir target = unlines
|
||||
startRacketWinSh : String -> String -> String -> String
|
||||
startRacketWinSh racket appdir target = unlines
|
||||
[ "#!/bin/sh"
|
||||
, "# this file is @" ++ "generated by Idris2 compiler, Racket backend"
|
||||
, "# " ++ (generatedString "Racket")
|
||||
, ""
|
||||
, "set -e # exit on any error"
|
||||
, ""
|
||||
|
Loading…
Reference in New Issue
Block a user