[cleanup] Cleanup after rebasing

This commit is contained in:
Kamil Shakirov 2021-10-22 15:59:15 +06:00
parent 26b94f09f7
commit 1e6f9dad71
6 changed files with 82 additions and 84 deletions

View File

@ -1001,9 +1001,9 @@ footer = do
// main function
int main(int argc, char *argv[])
{
\{
(if contains "idris_support.h" !(get HeaderFiles)
then "idris2_setArgs(argc, argv);" else "")
\{ ifThenElse (contains "idris_support.h" !(get HeaderFiles))
"idris2_setArgs(argc, argv);"
""
}
Value *mainExprVal = __mainExpression_0();
trampoline(mainExprVal);

View File

@ -99,10 +99,9 @@ schHeader chez libs whole
\{ showSep "\n" (map (\x => "(load-shared-object \"" ++ escapeStringChez x ++ "\")") libs) }
\{
(if whole
then "(let ()"
else "(source-directories (cons (getenv \"IDRIS2_INC_SRC\") (source-directories)))")
\{ ifThenElse whole
"(let ()"
"(source-directories (cons (getenv \"IDRIS2_INC_SRC\") (source-directories)))"
}
"""
@ -112,8 +111,8 @@ schFooter prof whole = """
(collect 4)
(blodwen-run-finalisers)
\{ (if prof then "(profile-dump-html)" else "") }
\{ (if whole then ")" else "") }
\{ ifThenElse prof "(profile-dump-html)" "" }
\{ ifThenElse whole ")" "" }
"""
showChezChar : Char -> String -> String
@ -391,9 +390,9 @@ getFgnCall version (n, fc, d) = schFgnDef fc n d version
export
startChezPreamble : String
startChezPreamble = #"""
startChezPreamble = """
#!/bin/sh
# \#{ (generatedString "Chez") }
# \{ (generatedString "Chez") }
set -e # exit on any error
@ -403,44 +402,44 @@ startChezPreamble = #"""
DIR=$(dirname "$(readlink -f -- "$0")")
fi
"""#
"""
startChez : String -> String -> String
startChez appdir target = startChezPreamble ++ #"""
export LD_LIBRARY_PATH="$DIR/\#{ appdir }":$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH="$DIR/\#{ appdir }":$DYLD_LIBRARY_PATH
export IDRIS2_INC_SRC="$DIR/\#{ appdir }"
startChez appdir target = startChezPreamble ++ """
export LD_LIBRARY_PATH="$DIR/\{ appdir }":$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH="$DIR/\{ appdir }":$DYLD_LIBRARY_PATH
export IDRIS2_INC_SRC="$DIR/\{ appdir }"
"$DIR/\#{ target }" "$@"
"""#
"$DIR/\{ target }" "$@"
"""
startChezCmd : String -> String -> String -> String
startChezCmd chez appdir target progType = #"""
startChezCmd : String -> String -> String -> String -> String
startChezCmd chez appdir target progType = """
@echo off
rem \#{ (generatedString "Chez") }
rem \{ (generatedString "Chez") }
set APPDIR=%~dp0
set PATH=%APPDIR%\#{ appdir };%PATH%
set IDRIS2_INC_SRC=%APPDIR%\#{ appdir }
set PATH=%APPDIR%\{ appdir };%PATH%
set IDRIS2_INC_SRC=%APPDIR%\{ appdir }
"\#{ chez }" \#{ progType } "%APPDIR%\#{ target }" %*
"""#
"\{ chez }" \{ progType } "%APPDIR%\{ target }" %*
"""
startChezWinSh : String -> String -> String -> String
startChezWinSh chez appdir target progType = #"""
startChezWinSh : String -> String -> String -> String -> String
startChezWinSh chez appdir target progType = """
#!/bin/sh
# \#{ (generatedString "Chez") }
# \{ (generatedString "Chez") }
set -e # exit on any error
DIR=$(dirname "$(readlink -f -- "$0" || cygpath -a -- "$0")")
PATH="$DIR/\#{ appdir }":$PATH
PATH="$DIR/\{ appdir }":$PATH
export IDRIS2_INC_SRC="$DIR/\#{ appdir }"
export IDRIS2_INC_SRC="$DIR/\{ appdir }"
"\#{ chez }" \#{ progType } "$DIR/\#{ target }" "$@"
"""#
"\{ chez }" \{ progType } "$DIR/\{ target }" "$@"
"""
||| Compile a TT expression to Chez Scheme
compileToSS : Ref Ctxt Defs ->

View File

@ -47,9 +47,8 @@ schHeader libs compilationUnits = """
[(i3osx ti3osx a6osx ta6osx tarm64osx) (load-shared-object "libc.dylib")]
[(i3nt ti3nt a6nt ta6nt) (load-shared-object "msvcrt.dll")]
[else (load-shared-object "libc.so")]
\{
unlines [" (load-shared-object \"" ++ escapeStringChez lib ++ "\")" | lib <- libs]
})
\{ unlines [" (load-shared-object \"" ++ escapeStringChez lib ++ "\")" | lib <- libs] })
"""
schFooter : String
@ -60,47 +59,47 @@ schFooter = """
"""
startChez : String -> String -> String -> String
startChez chez appDirSh targetSh = Chez.startChezPreamble ++ #"""
export LD_LIBRARY_PATH="$DIR/\#{ appDirSh }":$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH="$DIR/\#{ appDirSh }":$DYLD_LIBRARY_PATH
startChez chez appDirSh targetSh = Chez.startChezPreamble ++ """
export LD_LIBRARY_PATH="$DIR/\{ appDirSh }":$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH="$DIR/\{ appDirSh }":$DYLD_LIBRARY_PATH
"\#{ chez }" -q \
--libdirs "$DIR/\#{ appDirSh }" \
--program "$DIR/\#{ targetSh }" \
"\{ chez }" -q \
--libdirs "$DIR/\{ appDirSh }" \
--program "$DIR/\{ targetSh }" \
"$@"
"""#
"""
startChezCmd : String -> String -> String -> String
startChezCmd chez appDirSh targetSh = #"""
startChezCmd chez appDirSh targetSh = """
@echo off
rem \#{ (generatedString "ChezSep") }
rem \{ (generatedString "ChezSep") }
set APPDIR=%~dp0
set PATH=%APPDIR%\#{ appDirSh };%PATH%
set PATH=%APPDIR%\{ appDirSh };%PATH%
"\#{ chez }" -q \
--libdirs "%APPDIR%\#{ appDirSh }" \
--program "%APPDIR%\#{ targetSh }" \
"\{ chez }" -q \
--libdirs "%APPDIR%\{ appDirSh }" \
--program "%APPDIR%\{ targetSh }" \
%*
"""#
"""
startChezWinSh : String -> String -> String -> String
startChezWinSh chez appDirSh targetSh = #"""
startChezWinSh chez appDirSh targetSh = """
#!/bin/sh
# \#{ (generatedString "ChezSep") }
# \{ (generatedString "ChezSep") }
set -e # exit on any error
DIR=$(dirname "$(readlink -f -- "$0" || cygpath -a -- "$0")")
PATH="$DIR/\#{ appDirSh }":$PATH
PATH="$DIR/\{ appDirSh }":$PATH
"\#{ chez }" --program "$DIR/\#{ targetSh }" "$@"
"\#{ chez }" -q \
--libdirs "$DIR/\#{ appDirSh }" \
--program "$DIR/\#{ targetSh }" \
"\{ chez }" --program "$DIR/\{ targetSh }" "$@"
"\{ chez }" -q \
--libdirs "$DIR/\{ appDirSh }" \
--program "$DIR/\{ targetSh }" \
"$@"
"""#
"""
-- TODO: parallelise this
compileChezLibraries : (chez : String) -> (libDir : String) -> (ssFiles : List String) -> Core ()

View File

@ -53,7 +53,7 @@ schHeader prof libs = """
(require rnrs/io/ports-6) ; for files
(require srfi/19) ; for file handling and data
(require ffi/unsafe ffi/unsafe/define) ; for calling C
\{ (if prof then "(require profile)" else "") }
\{ ifThenElse prof "(require profile)" "" }
(require racket/flonum) ; for float-typed transcendental functions
\{ libs }
(let ()
@ -335,9 +335,9 @@ getFgnCall : {auto f : Ref Done (List String) } ->
getFgnCall appdir (n, fc, d) = schFgnDef appdir fc n d
startRacket : String -> String -> String -> String
startRacket racket appdir target = #"""
startRacket racket appdir target = """
#!/bin/sh
# \#{ (generatedString "Racket") }
# \{ (generatedString "Racket") }
set -e # exit on any error
@ -347,36 +347,36 @@ startRacket racket appdir target = #"""
DIR=$(dirname "$(readlink -f -- "$0")")
fi
export LD_LIBRARY_PATH="$DIR/\#{ appdir }":$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH="$DIR/\#{ appdir }":$DYLD_LIBRARY_PATH
export LD_LIBRARY_PATH="$DIR/\{ appdir }":$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH="$DIR/\{ appdir }":$DYLD_LIBRARY_PATH
\#{ racket } "$DIR/\#{ target }" "$@"
"""#
\{ racket } "$DIR/\{ target }" "$@"
"""
startRacketCmd : String -> String -> String -> String
startRacketCmd racket appdir target = #"""
startRacketCmd racket appdir target = """
@echo off
rem \#{ (generatedString "Racket") }
rem \{ (generatedString "Racket") }
set APPDIR=%~dp0
set PATH=%APPDIR%\#{ appdir };%PATH%
set PATH=%APPDIR%\{ appdir };%PATH%
\#{ racket } "%APPDIR%\#{ target }" %*
"""#
\{ racket } "%APPDIR%\{ target }" %*
"""
startRacketWinSh : String -> String -> String -> String
startRacketWinSh racket appdir target = #"""
startRacketWinSh racket appdir target = """
#!/bin/sh
# \#{ (generatedString "Racket") }
# \{ (generatedString "Racket") }
set -e # exit on any error
DIR=$(dirname "$(readlink -f -- "$0" || cygpath -a -- "$0")")
PATH="$DIR/\#{ appdir }":$PATH
PATH="$DIR/\{ appdir }":$PATH
\#{ racket } "$DIR/\#{ target }" "$@"
"""#
\{ racket } "$DIR/\{ target }" "$@"
"""
compileToRKT : Ref Ctxt Defs ->
String -> ClosedTerm -> (outfile : String) -> Core ()

View File

@ -41,12 +41,12 @@ outputDirWithDefault d = fromMaybe (build_dir d </> "exec") (output_dir d)
public export
toString : Dirs -> String
toString d@(MkDirs wdir sdir bdir ldir odir dfix edirs pdirs ldirs ddirs) = """
Working Directory: \{ show wdir }
Working Directory: \{ wdir }
Source Directory: \{ show sdir }
Build Directory: \{ show bdir }
Local Depend Directory: \{ show ldir }
Output Directory: \{ show (outputDirWithDefault d) }
Installation Prefix: \{ show dfix }
Build Directory: \{ bdir }
Local Depend Directory: \{ ldir }
Output Directory: \{ (outputDirWithDefault d) }
Installation Prefix: \{ dfix }
Extra Directories: \{ show edirs }
Package Directories: \{ show pdirs }
CG Library Directories: \{ show ldirs }

View File

@ -248,15 +248,15 @@ opts x _ = pure $ if (x `elem` optionFlags)
-- bash autocompletion script using the given function name
completionScript : (fun : String) -> String
completionScript fun = let fun' = "_" ++ fun in #"""
\#{ fun' }()
completionScript fun = let fun' = "_" ++ fun in """
\{ fun' }()
{
ED=$([ -z $2 ] && echo "--" || echo $2)
COMPREPLY=($(idris2 --bash-completion $ED $3))
}
complete -F \#{ fun' } -o default idris2
"""#
complete -F \{ fun' } -o default idris2
"""
--------------------------------------------------------------------------------
-- Processing Options