Skip to content

Commit 15ee90e

Browse files
committed
no error about missing target when -vm is used.
also version 9.1
1 parent 795f80b commit 15ee90e

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

compiler/src/prog8/CompilerMain.kt

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ private fun compileMain(args: Array<String>): Boolean {
5050
val quietAssembler by cli.option(ArgType.Boolean, fullName = "quietasm", description = "don't print assembler output results")
5151
val slowCodegenWarnings by cli.option(ArgType.Boolean, fullName = "slowwarn", description="show debug warnings about slow/problematic assembly code generation")
5252
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)
53-
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()
53+
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)")
5454
val startVm by cli.option(ArgType.Boolean, fullName = "vm", description = "load and run a .p8ir IR source file in the VM")
5555
val watchMode by cli.option(ArgType.Boolean, fullName = "watch", description = "continuous compilation mode (watch for file changes)")
5656
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 {
8080
if(srcdirs.firstOrNull()!=".")
8181
srcdirs.add(0, ".")
8282

83-
if (compilationTarget !in setOf(C64Target.NAME, C128Target.NAME, Cx16Target.NAME, AtariTarget.NAME, VMTarget.NAME)) {
84-
System.err.println("Invalid compilation target: $compilationTarget")
85-
return false
83+
if(startVm==null) {
84+
if(compilationTarget==null) {
85+
System.err.println("No compilation target specified")
86+
return false
87+
}
88+
89+
if (compilationTarget !in setOf(C64Target.NAME, C128Target.NAME, Cx16Target.NAME, AtariTarget.NAME, VMTarget.NAME)) {
90+
System.err.println("Invalid compilation target: $compilationTarget")
91+
return false
92+
}
8693
}
8794

8895
if(varsHighBank==0 && compilationTarget==Cx16Target.NAME) {
@@ -134,7 +141,7 @@ private fun compileMain(args: Array<String>): Boolean {
134141
asmListfile == true,
135142
experimentalCodegen == true,
136143
varsHighBank,
137-
compilationTarget,
144+
compilationTarget!!,
138145
evalStackAddr,
139146
splitWordArrays == true,
140147
processedSymbols,
@@ -203,7 +210,7 @@ private fun compileMain(args: Array<String>): Boolean {
203210
asmListfile == true,
204211
experimentalCodegen == true,
205212
varsHighBank,
206-
compilationTarget,
213+
compilationTarget!!,
207214
evalStackAddr,
208215
splitWordArrays == true,
209216
processedSymbols,

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ org.gradle.daemon=true
55
kotlin.code.style=official
66
javaVersion=11
77
kotlinVersion=1.9.0
8-
version=9.1-SNAPSHOT
8+
version=9.1

0 commit comments

Comments
 (0)