1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-09-28 03:55:23 +00:00

Add the -R option

This commit is contained in:
Karol Stasiak 2019-09-14 02:40:03 +02:00
parent 3ce2249399
commit 6c4dc81c1b
5 changed files with 15 additions and 5 deletions

View File

@ -2,6 +2,8 @@
## Current version ## Current version
* Added `-R` option for specifying extra commandline parameters for emulators.
* Added full 16-bit multiplication. * Added full 16-bit multiplication.
* Added preliminary support for EasyFlash. * Added preliminary support for EasyFlash.

View File

@ -60,6 +60,8 @@ Unlike `-I`, this does not replace the default include directory and allows usin
* `-r <program>` Run given program after successful compilation. Useful for automatically launching emulators without any external scripting. * `-r <program>` Run given program after successful compilation. Useful for automatically launching emulators without any external scripting.
* `-R <param>` Adds a parameter to the command line of the program run with `-r`. All `-R` options are added in order, before the output file name.
* `-D <feature>=<value>` Defines a feature value for the preprocessor. * `-D <feature>=<value>` Defines a feature value for the preprocessor.
* `-finput_intel_syntax`, `-finput_zilog_syntax` * `-finput_intel_syntax`, `-finput_zilog_syntax`

View File

@ -37,9 +37,9 @@ x64 hello_world.prg
The following options are obligatory when compiling your sources: The following options are obligatory when compiling your sources:
* `-o FILENAME` specifies the base name for your output file, an appropriate file extension will be appended. * `-o <FILENAME>` specifies the base name for your output file, an appropriate file extension will be appended.
* `-t PLATFORM` specifies the target platform. * `-t <PLATFORM>` specifies the target platform.
Each platform is defined in an `.ini` file in the include directory. Each platform is defined in an `.ini` file in the include directory.
For the list of supported platforms, see [Supported platforms](target-platforms.md) For the list of supported platforms, see [Supported platforms](target-platforms.md)
@ -58,7 +58,7 @@ You may be also interested in the following:
* `-g` additionally generate a label file * `-g` additionally generate a label file
* `-r PROGRAM` automatically launch given program after successful compilation * `-r <PROGRAM>` automatically launch given program after successful compilation; you can supply extra params for it with `-R <PARAM>`
* `-Wall` enable all warnings * `-Wall` enable all warnings

View File

@ -10,6 +10,7 @@ case class Context(errorReporting: Logger,
inputFileNames: List[String], inputFileNames: List[String],
outputFileName: Option[String] = None, outputFileName: Option[String] = None,
runFileName: Option[String] = None, runFileName: Option[String] = None,
runParams: Seq[String] = Vector(),
optimizationLevel: Option[Int] = None, optimizationLevel: Option[Int] = None,
zpRegisterSize: Option[Int] = None, zpRegisterSize: Option[Int] = None,
platform: Option[String] = None, platform: Option[String] = None,

View File

@ -135,8 +135,9 @@ object Main {
errorReporting.debug(s"Total time: ${Math.round((System.nanoTime() - startTime)/1e6)} ms") errorReporting.debug(s"Total time: ${Math.round((System.nanoTime() - startTime)/1e6)} ms")
c.runFileName.foreach{ program => c.runFileName.foreach{ program =>
val outputAbsolutePath = Paths.get(defaultPrgOutput).toAbsolutePath.toString val outputAbsolutePath = Paths.get(defaultPrgOutput).toAbsolutePath.toString
errorReporting.debug(s"Running: $program $outputAbsolutePath") val cmdline = program +: c.runParams :+ outputAbsolutePath
new ProcessBuilder(program, outputAbsolutePath).start() errorReporting.debug(s"Running: ${cmdline.mkString(" ")}")
new ProcessBuilder(cmdline.toArray: _*).directory(new File(program).getParentFile).start()
} }
if (platform.generateBbcMicroInfFile) { if (platform.generateBbcMicroInfFile) {
val start = platform.codeAllocators("default").startAt val start = platform.codeAllocators("default").startAt
@ -409,6 +410,10 @@ object Main {
c.copy(runFileName = Some(p)) c.copy(runFileName = Some(p))
}.description("Program to run after successful compilation.") }.description("Program to run after successful compilation.")
parameter("-R", "--run-param").placeholder("<param>").action { (p, c) =>
c.copy(runParams = c.runParams :+ p)
}.description("Adds a commandline parameter to the program launched with -r")
parameter("-D", "--define").placeholder("<feature>=<value>").action { (p, c) => parameter("-D", "--define").placeholder("<feature>=<value>").action { (p, c) =>
val tokens = p.split('=') val tokens = p.split('=')
if (tokens.length == 2) { if (tokens.length == 2) {