2003/09/28 00:43:30
authormegacz <megacz@xwt.org>
Fri, 30 Jan 2004 07:38:31 +0000 (07:38 +0000)
committermegacz <megacz@xwt.org>
Fri, 30 Jan 2004 07:38:31 +0000 (07:38 +0000)
darcs-hash:20040130073831-2ba56-7240518c18064ccc06efc1f67a1c4be095866f1f.gz

src/org/xwt/Glyph.java
src/org/xwt/translators/Freetype.java [moved from src/org/xwt/translators/Font.java with 96% similarity]
src/org/xwt/translators/MSPack.c [new file with mode: 0644]
src/org/xwt/translators/MSPack.java [new file with mode: 0644]

index 6840f65..e998845 100644 (file)
@@ -20,8 +20,8 @@ public class Glyph {
         if (ret != null) return ret;
 
         // FEATURE: be smarter here
-        if (c < 256) Font.renderGlyphs(res, pointsize, 0, 255, glyphCache);
-        else Font.renderGlyphs(res, pointsize, (int)c, (int)c, glyphCache);
+        if (c < 256) Freetype.renderGlyphs(res, pointsize, 0, 255, glyphCache);
+        else Freetype.renderGlyphs(res, pointsize, (int)c, (int)c, glyphCache);
 
         ret = (Glyph)glyphCache.get(res, new Integer((((int)c) << 16) | pointsize));
         if (ret != null) return ret;
similarity index 96%
rename from src/org/xwt/translators/Font.java
rename to src/org/xwt/translators/Freetype.java
index de71002..ccb3004 100644 (file)
@@ -6,9 +6,9 @@ import java.util.zip.*;
 
 // FEATURE: use streams, not memoryfont's
 // FEATURE: kerning pairs
-public class Font {
+public class Freetype {
 
-    Font() { }
+    Freetype() { }
 
     private static org.xwt.mips.Interpreter vm = null;
 
@@ -67,7 +67,7 @@ public class Font {
                 glyphCache.put(res, new Integer((g << 16) | pointsize), glyph);
             }
         } catch (Exception e) {
-            Log.log(Font.class, e);
+            Log.log(Freetype.class, e);
         }
     }
 }
diff --git a/src/org/xwt/translators/MSPack.c b/src/org/xwt/translators/MSPack.c
new file mode 100644 (file)
index 0000000..42bafcf
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2003 Adam Megacz, see the COPYING file for licensing [GPL]
+
+/* NOTE: _user_info is defined in crt0.c. It points to a 4096 byte
+   block of memory that contains 1024 32-bit values that can be set
+   with the setUserInfo() method of MIPSEmu.
+
+   The VM will pause after initialization.  When unpaused, it expects
+   that:
+
+       FIXME
+
+*/
+
+int main(int argc, char** argv) {
+  // FIXME: do some cool stuff here
+}
diff --git a/src/org/xwt/translators/MSPack.java b/src/org/xwt/translators/MSPack.java
new file mode 100644 (file)
index 0000000..00316de
--- /dev/null
@@ -0,0 +1,40 @@
+package org.xwt.translators;
+import org.xwt.*;
+import org.xwt.util.*;
+import java.io.*;
+import java.util.zip.*;
+
+public class MSPack {
+
+    MSPack() { }
+
+    private static org.xwt.mips.Interpreter vm = null;
+
+    public static synchronized void unpack(InputStream theCabFile) {
+        try {           
+            if (vm == null) {
+                InputStream bis = Platform.getBuiltinInputStream();
+                ZipInputStream zis = new ZipInputStream(bis);
+                for(ZipEntry ze = zis.getNextEntry(); ze != null && !ze.getName().equals("libmspack.mips"); ze = zis.getNextEntry()) { }
+                byte[] image = InputStreamToByteArray.convert(zis);
+                vm = new org.xwt.mips.Interpreter(image);
+                vm.start(new String[]{ "libmspack.mips" });
+                vm.execute();
+            }
+
+            int CAB_RESERVED = 256*1024;
+            int baseAddr = vm.sbrk(CAB_RESERVED);
+            
+            byte[] cabstream = InputStreamToByteArray.convert(theCabFile);
+            vm.copyout(cabstream, baseAddr, cabstream.length);
+            vm.setUserInfo(0, baseAddr);
+            vm.setUserInfo(1, cabstream.length);
+            
+            vm.execute();
+            // FIXME: do more stuff here
+
+        } catch (Exception e) {
+            Log.log(MSPack.class, e);
+        }
+    }
+}