diff --git a/.idea/libraries/dbus_java_3_2_4.xml b/.idea/libraries/dbus_java_3_2_4.xml
new file mode 100644
index 000000000..6acd1b359
--- /dev/null
+++ b/.idea/libraries/dbus_java_3_2_4.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/kotlinx_cli_jvm_0_1_0_dev_5.xml b/.idea/libraries/kotlinx_cli_jvm.xml
similarity index 71%
rename from .idea/libraries/kotlinx_cli_jvm_0_1_0_dev_5.xml
rename to .idea/libraries/kotlinx_cli_jvm.xml
index 7fee0aedc..759bb47a8 100644
--- a/.idea/libraries/kotlinx_cli_jvm_0_1_0_dev_5.xml
+++ b/.idea/libraries/kotlinx_cli_jvm.xml
@@ -1,7 +1,7 @@
-
+
-
+
diff --git a/compiler/build.gradle b/compiler/build.gradle
index 5e1834491..b5dc39077 100644
--- a/compiler/build.gradle
+++ b/compiler/build.gradle
@@ -21,8 +21,7 @@ sourceCompatibility = 11
repositories {
mavenLocal()
mavenCentral()
- jcenter()
- maven { url "https://dl.bintray.com/orangy/maven/" }
+ maven { url "https://kotlin.bintray.com/kotlinx" }
}
def prog8version = rootProject.file('compiler/res/version.txt').text.trim()
@@ -32,9 +31,9 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
// implementation "org.jetbrains.kotlin:kotlin-reflect"
implementation 'org.antlr:antlr4-runtime:4.8'
- implementation 'org.jetbrains.kotlinx:kotlinx-cli-jvm:0.1.0-dev-5'
- // implementation 'net.razorvine:ksim65:1.6'
- // implementation "com.github.hypfvieh:dbus-java:3.2.0"
+ implementation 'org.jetbrains.kotlinx:kotlinx-cli:0.3.1'
+ // implementation 'net.razorvine:ksim65:1.8'
+ // implementation "com.github.hypfvieh:dbus-java:3.2.4"
implementation project(':parser')
testImplementation "org.jetbrains.kotlin:kotlin-test-junit5"
diff --git a/compiler/compiler.iml b/compiler/compiler.iml
index 3abee245a..3f43bfff8 100644
--- a/compiler/compiler.iml
+++ b/compiler/compiler.iml
@@ -13,7 +13,7 @@
-
+
\ No newline at end of file
diff --git a/compiler/lib/dbus-java-3.2.0.jar b/compiler/lib/dbus-java-3.2.0.jar
deleted file mode 100644
index fe4fbc7a9..000000000
Binary files a/compiler/lib/dbus-java-3.2.0.jar and /dev/null differ
diff --git a/compiler/lib/dbus-java-3.2.4.jar b/compiler/lib/dbus-java-3.2.4.jar
new file mode 100644
index 000000000..3a0cff3c3
Binary files /dev/null and b/compiler/lib/dbus-java-3.2.4.jar differ
diff --git a/compiler/lib/kotlinx-cli-jvm-0.1.0-dev-5.jar b/compiler/lib/kotlinx-cli-jvm-0.1.0-dev-5.jar
deleted file mode 100644
index 2edc1e111..000000000
Binary files a/compiler/lib/kotlinx-cli-jvm-0.1.0-dev-5.jar and /dev/null differ
diff --git a/compiler/lib/kotlinx-cli-jvm-0.3.1.jar b/compiler/lib/kotlinx-cli-jvm-0.3.1.jar
new file mode 100644
index 000000000..9b93814ca
Binary files /dev/null and b/compiler/lib/kotlinx-cli-jvm-0.3.1.jar differ
diff --git a/compiler/src/prog8/CompilerMain.kt b/compiler/src/prog8/CompilerMain.kt
index 4b6d2f91b..726edb2b3 100644
--- a/compiler/src/prog8/CompilerMain.kt
+++ b/compiler/src/prog8/CompilerMain.kt
@@ -32,20 +32,20 @@ fun pathFrom(stringPath: String, vararg rest: String): Path = FileSystems.getDe
private fun compileMain(args: Array) {
- val cli = CommandLineInterface("prog8compiler")
- val startEmulator by cli.flagArgument("-emu", "auto-start emulator after successful compilation")
- val outputDir by cli.flagValueArgument("-out", "directory", "directory for output files instead of current directory", ".")
- val dontWriteAssembly by cli.flagArgument("-noasm", "don't create assembly code")
- val dontOptimize by cli.flagArgument("-noopt", "don't perform any optimizations")
- val watchMode by cli.flagArgument("-watch", "continuous compilation mode (watches for file changes), greatly increases compilation speed")
- val slowCodegenWarnings by cli.flagArgument("-slowwarn", "show debug warnings about slow/problematic assembly code generation")
- val compilationTarget by cli.flagValueArgument("-target", "compilertarget",
- "target output of the compiler, currently '${C64Target.name}' and '${Cx16Target.name}' available", C64Target.name)
- val moduleFiles by cli.positionalArgumentsList("modules", "main module file(s) to compile", minArgs = 1)
+ val cli = ArgParser("prog8compiler")
+ val startEmulator by cli.option(ArgType.Boolean, shortName="emu", description = "auto-start emulator after successful compilation")
+ val outputDir by cli.option(ArgType.String, shortName = "out", description = "directory for output files instead of current directory").default(".")
+ val dontWriteAssembly by cli.option(ArgType.Boolean, shortName = "noasm", description="don't create assembly code")
+ val dontOptimize by cli.option(ArgType.Boolean, shortName = "noopt", description = "don't perform any optimizations")
+ val watchMode by cli.option(ArgType.Boolean, shortName = "watch", description = "continuous compilation mode (watches for file changes), greatly increases compilation speed")
+ val slowCodegenWarnings by cli.option(ArgType.Boolean, shortName = "slowwarn", description="show debug warnings about slow/problematic assembly code generation")
+ val compilationTarget by cli.option(ArgType.String, shortName = "target", description = "target output of the compiler, currently '${C64Target.name}' and '${Cx16Target.name}' available").default(C64Target.name)
+ val moduleFiles by cli.argument(ArgType.String, fullName = "modules", description = "main module file(s) to compile").multiple(999)
try {
cli.parse(args)
- } catch (e: Exception) {
+ } catch (e: IllegalStateException) {
+ System.err.println(e.message)
exitProcess(1)
}
@@ -55,7 +55,7 @@ private fun compileMain(args: Array) {
exitProcess(1)
}
- if(watchMode) {
+ if(watchMode==true) {
val watchservice = FileSystems.getDefault().newWatchService()
val allImportedFiles = mutableSetOf()
@@ -64,7 +64,7 @@ private fun compileMain(args: Array) {
val results = mutableListOf()
for(filepathRaw in moduleFiles) {
val filepath = pathFrom(filepathRaw).normalize()
- val compilationResult = compileProgram(filepath, !dontOptimize, !dontWriteAssembly, slowCodegenWarnings, compilationTarget, outputPath)
+ val compilationResult = compileProgram(filepath, dontOptimize!=true, dontWriteAssembly!=true, slowCodegenWarnings==true, compilationTarget, outputPath)
results.add(compilationResult)
}
@@ -101,7 +101,7 @@ private fun compileMain(args: Array) {
val filepath = pathFrom(filepathRaw).normalize()
val compilationResult: CompilationResult
try {
- compilationResult = compileProgram(filepath, !dontOptimize, !dontWriteAssembly, slowCodegenWarnings, compilationTarget, outputPath)
+ compilationResult = compileProgram(filepath, dontOptimize!=true, dontWriteAssembly!=true, slowCodegenWarnings==true, compilationTarget, outputPath)
if(!compilationResult.success)
exitProcess(1)
} catch (x: ParsingFailedError) {
@@ -110,10 +110,10 @@ private fun compileMain(args: Array) {
exitProcess(1)
}
- if (startEmulator) {
+ if (startEmulator==true) {
if (compilationResult.programName.isEmpty())
println("\nCan't start emulator because no program was assembled.")
- else if(startEmulator) {
+ else {
CompilationTarget.instance.machine.launchEmulator(compilationResult.programName)
}
}