no error about missing target when -vm is used.

also version 9.1
This commit is contained in:
Irmen de Jong 2023-07-11 18:13:49 +02:00
parent 795f80b4ec
commit 15ee90e99c
2 changed files with 14 additions and 7 deletions

View File

@ -50,7 +50,7 @@ private fun compileMain(args: Array<String>): Boolean {
val quietAssembler by cli.option(ArgType.Boolean, fullName = "quietasm", description = "don't print assembler output results") val quietAssembler by cli.option(ArgType.Boolean, fullName = "quietasm", description = "don't print assembler output results")
val slowCodegenWarnings by cli.option(ArgType.Boolean, fullName = "slowwarn", description="show debug warnings about slow/problematic assembly code generation") val slowCodegenWarnings by cli.option(ArgType.Boolean, fullName = "slowwarn", description="show debug warnings about slow/problematic assembly code generation")
val sourceDirs by cli.option(ArgType.String, fullName="srcdirs", description = "list of extra paths, separated with ${File.pathSeparator}, to search in for imported modules").multiple().delimiter(File.pathSeparator) val sourceDirs by cli.option(ArgType.String, fullName="srcdirs", description = "list of extra paths, separated with ${File.pathSeparator}, to search in for imported modules").multiple().delimiter(File.pathSeparator)
val compilationTarget by cli.option(ArgType.String, fullName = "target", description = "target output of the compiler (one of '${C64Target.NAME}', '${C128Target.NAME}', '${Cx16Target.NAME}', '${AtariTarget.NAME}', '${VMTarget.NAME}')").required() val compilationTarget by cli.option(ArgType.String, fullName = "target", description = "target output of the compiler (one of '${C64Target.NAME}', '${C128Target.NAME}', '${Cx16Target.NAME}', '${AtariTarget.NAME}', '${VMTarget.NAME}') (required)")
val startVm by cli.option(ArgType.Boolean, fullName = "vm", description = "load and run a .p8ir IR source file in the VM") val startVm by cli.option(ArgType.Boolean, fullName = "vm", description = "load and run a .p8ir IR source file in the VM")
val watchMode by cli.option(ArgType.Boolean, fullName = "watch", description = "continuous compilation mode (watch for file changes)") val watchMode by cli.option(ArgType.Boolean, fullName = "watch", description = "continuous compilation mode (watch for file changes)")
val varsHighBank by cli.option(ArgType.Int, fullName = "varshigh", description = "put uninitialized variables in high memory area instead of at the end of the program. On the cx16 target the value specifies the HiRAM bank (0=keep active), on other systems it is ignored.") val varsHighBank by cli.option(ArgType.Int, fullName = "varshigh", description = "put uninitialized variables in high memory area instead of at the end of the program. On the cx16 target the value specifies the HiRAM bank (0=keep active), on other systems it is ignored.")
@ -80,9 +80,16 @@ private fun compileMain(args: Array<String>): Boolean {
if(srcdirs.firstOrNull()!=".") if(srcdirs.firstOrNull()!=".")
srcdirs.add(0, ".") srcdirs.add(0, ".")
if (compilationTarget !in setOf(C64Target.NAME, C128Target.NAME, Cx16Target.NAME, AtariTarget.NAME, VMTarget.NAME)) { if(startVm==null) {
System.err.println("Invalid compilation target: $compilationTarget") if(compilationTarget==null) {
return false System.err.println("No compilation target specified")
return false
}
if (compilationTarget !in setOf(C64Target.NAME, C128Target.NAME, Cx16Target.NAME, AtariTarget.NAME, VMTarget.NAME)) {
System.err.println("Invalid compilation target: $compilationTarget")
return false
}
} }
if(varsHighBank==0 && compilationTarget==Cx16Target.NAME) { if(varsHighBank==0 && compilationTarget==Cx16Target.NAME) {
@ -134,7 +141,7 @@ private fun compileMain(args: Array<String>): Boolean {
asmListfile == true, asmListfile == true,
experimentalCodegen == true, experimentalCodegen == true,
varsHighBank, varsHighBank,
compilationTarget, compilationTarget!!,
evalStackAddr, evalStackAddr,
splitWordArrays == true, splitWordArrays == true,
processedSymbols, processedSymbols,
@ -203,7 +210,7 @@ private fun compileMain(args: Array<String>): Boolean {
asmListfile == true, asmListfile == true,
experimentalCodegen == true, experimentalCodegen == true,
varsHighBank, varsHighBank,
compilationTarget, compilationTarget!!,
evalStackAddr, evalStackAddr,
splitWordArrays == true, splitWordArrays == true,
processedSymbols, processedSymbols,

View File

@ -5,4 +5,4 @@ org.gradle.daemon=true
kotlin.code.style=official kotlin.code.style=official
javaVersion=11 javaVersion=11
kotlinVersion=1.9.0 kotlinVersion=1.9.0
version=9.1-SNAPSHOT version=9.1