1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-09-17 01:55:22 +00:00

Moved some KC-files to stdlib. Added option for multiple include paths.

This commit is contained in:
jespergravgaard 2018-08-31 22:52:10 +02:00
parent 7f29a344ae
commit 17ad45d453
13 changed files with 12 additions and 8 deletions

View File

@ -6,6 +6,7 @@ import picocli.CommandLine;
import java.io.*;
import java.nio.file.*;
import java.util.List;
import java.util.concurrent.Callable;
import static junit.framework.TestCase.fail;
@ -19,7 +20,7 @@ public class KickC implements Callable<Void> {
private Path kcFile = null;
@CommandLine.Option(names = {"-I", "-libdir" }, description = "Path to a library folder, where the compiler looks for included files.")
private Path libDir = null;
private List<Path> libDirs = null;
@CommandLine.Option(names = {"-o"}, description = "Name of the output file. By default it is the same as the input file with extension .asm")
private String asmFileName = null;
@ -46,8 +47,10 @@ public class KickC implements Callable<Void> {
Compiler compiler = new Compiler();
compiler.addImportPath(".");
if(libDir != null) {
compiler.addImportPath(libDir.toString());
if(libDirs != null) {
for(Path libDir : libDirs) {
compiler.addImportPath(libDir.toString());
}
}
String fileBaseName = getFileBaseName(kcFile);

View File

@ -25,13 +25,13 @@ import static org.junit.Assert.assertTrue;
*/
public class TestPrograms {
ReferenceHelper helper;
String stdlibPath = "src/main/kc/stdlib";
String testPath = "src/test/java/dk/camelot64/kickc/test/kc";
ReferenceHelper helper = new ReferenceHelper("dk/camelot64/kickc/test/ref/");
String testPath;
public TestPrograms() {
testPath = "src/test/java/dk/camelot64/kickc/test/kc";
helper = new ReferenceHelper("dk/camelot64/kickc/test/ref/");
}
@BeforeClass
@ -1003,6 +1003,7 @@ public class TestPrograms {
private void testFile(String fileName) throws IOException, URISyntaxException {
System.out.println("Testing output for " + fileName);
Compiler compiler = new Compiler();
compiler.addImportPath(stdlibPath);
compiler.addImportPath(testPath);
Program program = compiler.compile(fileName);

View File

@ -1,4 +1,4 @@
// Simple outines for working with memory
// Simple routines for working with memory
// Fill some memory with a value
void fill(byte* start, word size, byte val) {