new classgen part 3
authorbrian <brian@brianweb.net>
Thu, 27 May 2004 07:00:21 +0000 (00:00 -0700)
committerbrian <brian@brianweb.net>
Thu, 27 May 2004 07:00:21 +0000 (00:00 -0700)
darcs-hash:20040527070021-24bed-e728da5bbd9ae316835c88a19af571425f714d9d.gz

src/org/ibex/nestedvm/Runtime.java
src/org/ibex/nestedvm/UnixRuntime.java
src/org/ibex/nestedvm/util/Sort.java [deleted file]

index 5a1a895..ee02214 100644 (file)
@@ -6,7 +6,6 @@ package org.ibex.nestedvm;
 
 import org.ibex.nestedvm.util.*;
 import java.io.*;
 
 import org.ibex.nestedvm.util.*;
 import java.io.*;
-import java.util.Arrays;
 
 public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
     public static final String VERSION = "1.0";
 
 public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
     public static final String VERSION = "1.0";
index 24a5ece..728d9cd 100644 (file)
@@ -1,6 +1,8 @@
 package org.ibex.nestedvm;
 
 import org.ibex.nestedvm.util.*;
 package org.ibex.nestedvm;
 
 import org.ibex.nestedvm.util.*;
+// FEATURE: This is ugly, this stuff needs to be in org.ibex.util or something
+import org.ibex.classgen.util.Sort;
 import java.io.*;
 import java.util.*;
 import java.net.*;
 import java.io.*;
 import java.util.*;
 import java.net.*;
@@ -913,54 +915,6 @@ public abstract class UnixRuntime extends Runtime implements Cloneable {
         }
         return 0;
     }
         }
         return 0;
     }
-        
-    
-    /*public int sys_opensocket(int cstring, int port) throws FaultException, ErrnoException {
-        String hostname = cstring(cstring);
-        try {
-            FD fd = new SocketFD(new Socket(hostname,port));
-            int n = addFD(fd);
-            if(n == -1) fd.close();
-            return n;
-        } catch(IOException e) {
-            return -EIO;
-        }
-    }
-    
-    private static class ListenSocketFD extends FD {
-        ServerSocket s;
-        public ListenSocketFD(ServerSocket s) { this.s = s; }
-        public int flags() { return 0; }
-        // FEATURE: What should these be?
-        public FStat _fstat() { return new FStat(); }
-        public void _close() { try { s.close(); } catch(IOException e) { } }
-    }
-    
-    public int sys_listensocket(int port) {
-        try {
-            ListenSocketFD fd = new ListenSocketFD(new ServerSocket(port));
-            int n = addFD(fd);
-            if(n == -1) fd.close();
-            return n;            
-        } catch(IOException e) {
-            return -EIO;
-        }
-    }
-    
-    public int sys_accept(int fdn) {
-        if(fdn < 0 || fdn >= OPEN_MAX) return -EBADFD;
-        if(fds[fdn] == null) return -EBADFD;
-        if(!(fds[fdn] instanceof ListenSocketFD)) return -EBADFD;
-        try {
-            ServerSocket s = ((ListenSocketFD)fds[fdn]).s;
-            SocketFD fd = new SocketFD(s.accept());
-            int n = addFD(fd);
-            if(n == -1) fd.close();
-            return n;
-        } catch(IOException e) {
-            return -EIO;
-        }
-    }*/
     
     //  FEATURE: Run through the fork/wait stuff one more time
     public static class GlobalState {    
     
     //  FEATURE: Run through the fork/wait stuff one more time
     public static class GlobalState {    
diff --git a/src/org/ibex/nestedvm/util/Sort.java b/src/org/ibex/nestedvm/util/Sort.java
deleted file mode 100644 (file)
index a2bba16..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.ibex.nestedvm.util;
-
-public final class Sort {
-    private Sort() { }
-    
-    public interface Comparable { public int compareTo(Object o); }
-    public interface CompareFunc { public int compare(Object a, Object b); }
-    
-    private static final CompareFunc comparableCompareFunc = new CompareFunc() {
-        public int compare(Object a,Object b) { return ((Comparable)a).compareTo(b); }
-    };
-    
-    public static void sort(Comparable[] a) { sort(a,comparableCompareFunc); }
-    public static void sort(Object[] a, CompareFunc c) { sort(a,c,0,a.length-1); }
-    
-    private static void sort(Object[] a, CompareFunc c, int start, int end) {
-        Object tmp;
-        if(start >= end) return;
-        if(end-start <= 6) {
-            for(int i=start+1;i<=end;i++) {
-                tmp = a[i];
-                int j;
-                for(j=i-1;j>=start;j--) {
-                    if(c.compare(a[j],tmp) <= 0) break;
-                    a[j+1] = a[j];
-                }
-                a[j+1] = tmp;
-            }
-            return;
-        }
-        
-        Object pivot = a[end];
-        int lo = start - 1;
-        int hi = end;
-        
-        do {
-            while((lo < hi) && c.compare(a[++lo],pivot) < 0) { }
-            while((hi > lo) && c.compare(a[--hi],pivot) > 0) { }
-            tmp = a[lo]; a[lo] = a[hi]; a[hi] = tmp;
-        } while(lo < hi);
-        
-        tmp = a[lo]; a[lo] = a[end]; a[end] = tmp;
-        
-        sort(a, c, start, lo-1);
-        sort(a, c, lo+1, end);
-    }
-}