mirror of
https://github.com/irmen/prog8.git
synced 2024-11-26 11:49:22 +00:00
added -check command line option
This commit is contained in:
parent
f948917124
commit
73864c8101
@ -174,6 +174,7 @@ sub normalize(float value) -> float {
|
||||
}
|
||||
|
||||
sub push(float value) {
|
||||
; note: this *should* be inlined, however since the VM has separate program counter and value stacks, this also works
|
||||
%ir {{
|
||||
loadm.f fr65535,floats.push.value
|
||||
push.f fr65535
|
||||
@ -182,6 +183,7 @@ sub push(float value) {
|
||||
}
|
||||
|
||||
sub pop() -> float {
|
||||
; note: this *should* be inlined, however since the VM has separate program counter and value stacks, this also works
|
||||
%ir {{
|
||||
pop.f fr65535
|
||||
returnr.f fr65535
|
||||
|
@ -37,6 +37,7 @@ fun pathFrom(stringPath: String, vararg rest: String): Path = FileSystems.getDe
|
||||
private fun compileMain(args: Array<String>): Boolean {
|
||||
val cli = ArgParser("prog8compiler", prefixStyle = ArgParser.OptionPrefixStyle.JVM)
|
||||
val asmListfile by cli.option(ArgType.Boolean, fullName = "asmlist", description = "make the assembler produce a listing file as well")
|
||||
val checkSource by cli.option(ArgType.Boolean, fullName = "check", description = "quickly check program for errors, no output will be produced")
|
||||
val symbolDefs by cli.option(ArgType.String, fullName = "D", description = "define assembly symbol(s) with -D SYMBOL=VALUE").multiple()
|
||||
val startEmulator1 by cli.option(ArgType.Boolean, fullName = "emu", description = "auto-start emulator after successful compilation")
|
||||
val startEmulator2 by cli.option(ArgType.Boolean, fullName = "emu2", description = "auto-start alternative emulator after successful compilation")
|
||||
@ -142,8 +143,8 @@ private fun compileMain(args: Array<String>): Boolean {
|
||||
val filepath = pathFrom(filepathRaw).normalize()
|
||||
val compilerArgs = CompilerArguments(
|
||||
filepath,
|
||||
dontOptimize != true,
|
||||
dontWriteAssembly != true,
|
||||
if(checkSource==true) false else dontOptimize != true,
|
||||
if(checkSource==true) false else dontWriteAssembly != true,
|
||||
warnSymbolShadowing == true,
|
||||
quietAssembler == true,
|
||||
asmListfile == true,
|
||||
@ -161,6 +162,10 @@ private fun compileMain(args: Array<String>): Boolean {
|
||||
outputPath
|
||||
)
|
||||
val compilationResult = compileProgram(compilerArgs)
|
||||
|
||||
if(checkSource==true)
|
||||
println("No output produced.")
|
||||
|
||||
if(compilationResult!=null)
|
||||
results.add(compilationResult)
|
||||
}
|
||||
@ -214,8 +219,8 @@ private fun compileMain(args: Array<String>): Boolean {
|
||||
try {
|
||||
val compilerArgs = CompilerArguments(
|
||||
filepath,
|
||||
dontOptimize != true,
|
||||
dontWriteAssembly != true,
|
||||
if(checkSource==true) false else dontOptimize != true,
|
||||
if(checkSource==true) false else dontWriteAssembly != true,
|
||||
warnSymbolShadowing == true,
|
||||
quietAssembler == true,
|
||||
asmListfile == true,
|
||||
@ -233,6 +238,10 @@ private fun compileMain(args: Array<String>): Boolean {
|
||||
outputPath
|
||||
)
|
||||
val result = compileProgram(compilerArgs)
|
||||
|
||||
if(checkSource==true)
|
||||
println("No output produced.")
|
||||
|
||||
if(result==null)
|
||||
return false
|
||||
else
|
||||
|
@ -172,6 +172,9 @@ One or more .p8 module files
|
||||
``-asmlist``
|
||||
Generate an assembler listing file as well.
|
||||
|
||||
``-check``
|
||||
Quickly check the program for errors. No output will be produced.
|
||||
|
||||
``-breakinstr``
|
||||
Also output a CPU instruction for a ``%breakpoint``, as well as the entry in the vice monitor list file.
|
||||
This can be useful on emulators/systems that don't parse the breakpoint information in the list file,
|
||||
|
@ -2,7 +2,7 @@
|
||||
TODO
|
||||
====
|
||||
|
||||
- add -nowarnunused, or %option ignore_unused (module scope), to suppress all warnings about unused symbols. Useful in libraries.
|
||||
- add -nowarnunused, or %option ignore_unused (module and block scope), to suppress all warnings about unused symbols. Useful in libraries.
|
||||
put this in all library code, like %option no_symbol_prefixing, and get rid of the "trick" it uses currently to suppress unused symbol warnings for library modules.
|
||||
|
||||
- [on branch: shortcircuit] investigate McCarthy evaluation again? this may also reduce code size perhaps for things like if a>4 or a<2 ....
|
||||
|
Loading…
Reference in New Issue
Block a user