include Makefile.upstream
# figure out what stuff in org.xwt.plat.* this platform requires (its superclasses)
-all_java_sources := $(patsubst src/%.java, build/java/%.java, $(shell find src -name '*.java'))
+all_java_sources := $(filter-out build/java/org/xwt/mips/%, $(patsubst src/%.java, build/java/%.java, $(shell find src -name '*.java')))
+all_java_sources += build/java/org/xwt/translators/FreetypeVM.java
java_sources := $(all_java_sources)
nonplat_java_sources := $(filter-out build/java/org/xwt/plat/%, $(all_java_sources))
plat_java_sources := $(filter build/java/org/xwt/plat/%, $(all_java_sources))
+build/java/org/xwt/translators/FreetypeVM.java: build/res/freetype.mips build/class/org/xwt/mips/Compiler.class
+ mkdir -p build/java/org/xwt/translators
+ (echo -e 'package org.xwt.translators;\nimport org.xwt.mips.*;\n'; \
+ java -Xint -cp build/class org.xwt.mips.Compiler FreetypeVM build/res/freetype.mips)\
+ > $@
+
build/java/org/xwt/%.java: src/org/xwt/%.java
make build/class/org/xwt/util/Preprocessor.class
@echo -e "\n\033[1mpreprocessing .java -> .java: $<\033[0m"
mkdir -p `dirname $@`; java -cp build/class org.xwt.util.Preprocessor < $< > $@
+
build/java/%.java: src/%.java ; @echo linking $@; mkdir -p $(@D); ln -fs `echo $(@D)/ | sed 's_[^/]*//*_../_g'`/$< $@
build/cc/%.cc: src/%.c ; @echo linking $@; mkdir -p $(@D); ln -fs `echo $(@D)/ | sed 's_[^/]*//*_../_g'`/$< $@
mkdir -p build/class/org/xwt/util/
./.jikes $<
+build/class/org/xwt/mips/Compiler.class: src/org/xwt/mips/*.* .jikes
+ @echo -e "\n\033[1mcompiling .java -> .class: $<\033[0m"
+ mkdir -p build/class/org/xwt/mips/
+ ./.jikes $<
+
+
# this forces a clean build every time because jikes is so damn buggy
preprocess: $(all_java_sources)
compile: .compile
-Lupstream/freetype-2.1.4/src/objs \
-o $@ \
$^ \
- -Wl,-s \
- -lfreetype
+ -lfreetype \
+# -Wl,-s \
.install_libmspack-20030726:; make .install_libmspack-20030726_mips-unknown-elf target=mips-unknown-elf
build/res/libmspack.mips: build/mips/org/xwt/translators/MSPack.c.o build/mips/org/xwt/mips/crt0.c.o build/mips/org/xwt/mips/syscalls.c.o
-Lupstream/libmspack-20030726/build-mips-unknown-elf \
-o $@ \
$^ \
- -Wl,-s \
- -lmspack
+ -lmspack \
+# -Wl,-s \
public final Res res;
public int max_ascent;
public int max_descent;
- boolean latinCharsPreloaded = true; ///< true if a request to preload ASCII 32-127 has begun
+ boolean latinCharsPreloaded = false; ///< true if a request to preload ASCII 32-127 has begun
Glyph[] glyphs = new Glyph[65535];
public static class Glyph {
p("// This file was generated by MipsToJava");
if (packageName != null) p("package " + packageName + ";");
- p("public class " + className + " extends Runtime {");
+ p("public class " + className + " extends org.xwt.mips.Runtime {");
p("");
p(" // program counter");
p(" private int pc = 0;");
}
public ELF(Object img) throws IOException, ELFException {
- if (img instanceof String) image = new MyRandomAccessFile((String)img,"r");
- image = img;
+ if (img instanceof String) {
+ image = fd = new MyRandomAccessFile((String)img, "r");
+ } else {
+ image = img;
+ }
seek(0);
header = new ELFHeader();
pheaders = new PHeader[header.phnum];
public abstract class Runtime implements Syscalls, Errno,Registers {
/** Pages are 4k in size */
- final static int PAGE_SIZE = 4096;
- final static int PAGE_WORDS = (int)(PAGE_SIZE >>> 2);
- final static int PAGE_SHIFT = 12;
+ public final static int PAGE_SIZE = 4096;
+ public final static int PAGE_WORDS = (int)(PAGE_SIZE >>> 2);
+ public final static int PAGE_SHIFT = 12;
/** There are 65536 pages available for a total of 256mb of addressable memory */
protected final static int TOTAL_PAGES = 65536;
/** The top 256 pages are reserved for the stack. Arguments and userdata info use up the first few pages */
private static byte[] image = null;
private int mem_allocated = 0;
- private org.xwt.mips.Interpreter vm = null;
+ private org.xwt.mips.Runtime vm = null;
private Res loadedStream = null;
InputStream is = res.getInputStream();
byte[] fontstream = InputStreamToByteArray.convert(is);
if (image == null) image = InputStreamToByteArray.convert(Main.builtin.getInputStream("freetype.mips"));
- vm = new org.xwt.mips.Interpreter(image);
+ //vm = new org.xwt.mips.Interpreter(image);
+ vm = new FreetypeVM();
int baseAddr = vm.sbrk(fontstream.length);
vm.copyout(fontstream, baseAddr, fontstream.length);
vm.setUserInfo(0, baseAddr);