Updating shared values
authordavid <david>
Fri, 24 Jun 2011 23:12:24 +0000 (23:12 +0000)
committerdavid <david>
Fri, 24 Jun 2011 23:12:24 +0000 (23:12 +0000)
Robust/src/ClassLibrary/SSJava/InputStream.java
Robust/src/ClassLibrary/SSJava/Math.java
Robust/src/ClassLibrary/SSJava/PushbackInputStream.java
Robust/src/ClassLibrary/SSJava/String.java
Robust/src/ClassLibrary/SSJava/System.java

index 55dd5d78fa6f53b710c39c2b8208f39a6c5dc843..28302a79cbe3ac4f7803eaa42c208ba18d4abecb 100644 (file)
@@ -35,8 +35,8 @@ this exception to your version of the library, but you are not
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
 
-//removed because no packages
-//package java.io;
+//package java.io; //NO PACKAGES FOR CLASS FILES
 
 /**
   * This abstract class forms the base of the hierarchy of classes that read
@@ -50,7 +50,7 @@ exception statement from your version. */
   */
 @LATTICE("")
 @METHODDEFAULT("OUT<IN,THISLOC=IN,GLOBALLOC=IN")
-public abstract class InputStream
+    public abstract class InputStream //implements Closeable //COMPILER CANNOT HANDLE IMPLEMENTS
 {
   /**
    * Default, no-arg, public constructor
@@ -70,7 +70,7 @@ public abstract class InputStream
    *
    * @exception IOException If an error occurs
    */
-  @RETURNLOC("")
+  @RETURNLOC("OUT")
   public int available() throws IOException
   {
     return 0;
@@ -126,7 +126,7 @@ public abstract class InputStream
    * @return <code>true</code> if mark/reset functionality is
    * supported, <code>false</code> otherwise 
    */
-  @RETURN
+  @RETURNLOC("OUT")
   public boolean markSupported()
   {
     return false;
@@ -162,7 +162,7 @@ public abstract class InputStream
    *
    * @exception IOException If an error occurs.
    */
-  @RETURN
+  @RETURNLOC("OUT")
   public int read(@LOC("IN") byte[] b) throws IOException
   {
     return read(b, 0, b.length);
@@ -196,14 +196,15 @@ public abstract class InputStream
    *
    * @exception IOException If an error occurs.
    */
-  @LATTICE("OUT<")
-  @RETURN("")
-  public int read(byte[] b, int off, int len) throws IOException
+  @LATTICE("OUT<SH,SH<IN,SH*")
+  @RETURNLOC("OUT")
+      public int read(@LOC("OUT") byte[] b, @LOC("IN") int off, @LOC("IN") int len) throws IOException
   {
     if (off < 0 || len < 0 || b.length - off < len)
       throw new IndexOutOfBoundsException();
 
-    int i, ch;
+    @LOC("SH") int i;
+    @LOC("SH") int ch;
 
     for (i = 0; i < len; ++i)
       try
@@ -247,7 +248,7 @@ public abstract class InputStream
    * This method reads and discards bytes into a byte array until the
    * specified number of bytes were skipped or until either the end of stream
    * is reached or a read attempt returns a short count.  Subclasses can
-   * override this metho to provide a more efficient implementation where
+   * override this method to provide a more efficient implementation where
    * one exists.
    *
    * @param n The requested number of bytes to skip
@@ -256,6 +257,7 @@ public abstract class InputStream
    *
    * @exception IOException If an error occurs
    */
+
   public long skip(long n) throws IOException
   {
     // Throw away n bytes by reading them into a temp byte[].
@@ -264,9 +266,9 @@ public abstract class InputStream
     byte[] tmpbuf = new byte[buflen];
     final long origN = n;
 
-    while (n > 0L)
+    while (n > 0)
       {
-       int numread = read(tmpbuf, 0, n > buflen ? buflen : (int) n);
+        int numread = read(tmpbuf, 0, n > buflen ? buflen : (int) n);
        if (numread <= 0)
          break;
        n -= numread;
index 45a62c1059c0dc8f150ce50bf52545cc8b4df9aa..35e6ab9885da2e55c48c70e5116d34ce3b987e18 100644 (file)
@@ -40,8 +40,9 @@ public class Math {
   public static long max(long a, long b) {
     return (a>b)?a:b;
   }
-
-  public static double min(double a, double b) {
+  
+  @RETURNLOC("IN")
+  public static double min(@LOC("IN") double a, @LOC("IN") double b) {
     return (a<b)?a:b;
   }
 
index c5a17035402059c369ac1b890dc325d738fa9ba4..06403f84800365cee914fc222d7d2b7fd4d8d416 100644 (file)
@@ -51,7 +51,7 @@ exception statement from your version. */
   * @author Aaron M. Renn (arenn@urbanophile.com)
   * @author Warren Levy (warrenl@cygnus.com)
   */
-@LATTICE("IN<T,IN<SH,SH<F,SH*")
+@LATTICE("IN<T,IN<POS,POS<SH,SH<F,SH*,POS*")
 @METHODDEFAULT("OUT<SH,SH<IN,SH*,THISLOC=OUT,GLOBALLOC=OUT")
 public class PushbackInputStream extends FilterInputStream
 {
@@ -72,7 +72,7 @@ public class PushbackInputStream extends FilterInputStream
    * <code>pos</code> is 0 the buffer is full and <code>buf.length</code> when 
    * it is empty
    */
-  @LOC("SH") protected int pos;
+  @LOC("POS") protected int pos;
 
   /**
    * This method initializes a <code>PushbackInputStream</code> to
@@ -207,11 +207,13 @@ public class PushbackInputStream extends FilterInputStream
    *
    * @exception IOException If an error occurs.
    */
-  @LATTICE("OUT<SH,SH*,THISLOCAL=SH")
-  @RETURNLOC("OUT")
-  public synchronized int read(@LOC("OUT") byte[] b, @LOC("SH") int off, @LOC("SH") int len) throws IOException
+  @LATTICE("THIS<BUF,THISLOCAL=THIS")
+  @RETURNLOC("THIS")
+  public synchronized int read(@LOC("THIS,PushbackInputStream.POS") byte[] b,
+                               @LOC("THIS,PushbackInputStream.POS") int off,
+                               @LOC("THIS,PushbackInputStream.POS") int len) throws IOException
   {
-    @LOC("SH") int numBytes = Math.min(buf.length - pos,len);
+    @LOC("THIS,PushbackInputStream.POS") int numBytes = Math.min(buf.length - pos,len);
 
     if (numBytes > 0)
       {
index b0abb612c8372b725642f1e513b9dd2b8d4e9cab..2710ebdb25d7f5439528d182e7230a71b089358b 100644 (file)
@@ -13,7 +13,7 @@ public class String {
   private String() {
   }
   
-  public String(String str) {
+  public String(@LOC("IN") String str) {
     this.value=str.value;
     this.count=str.count;
     this.offset=str.offset;
@@ -36,6 +36,7 @@ public class String {
   }
 
   @LATTICE("O<V,V<C,C<IN,THISLOC=IN,C*")
+  @RETURNLOC("O")
   public String concat(@LOC("IN") String str) {
     @LOC("O") String newstr=new String(); // create new one, it has OUT location
     @LOC("C") int newCount=this.count+str.count;
@@ -60,6 +61,7 @@ public class String {
     return newstr;
   }
   
+  @RETURNLOC("O")
   public boolean equals(@LOC("IN") Object o) {
     if (o.getType()!=getType()) // values are coming from [IN] and [THISLOC]
       return false;
@@ -82,19 +84,25 @@ public class String {
       return o.toString();
   }
   
+  @LATTICE("O<V,V<C,C<IN,THISLOC=IN,C*")
+  @RETURNLOC("O")
   public byte[] getBytes() {
-    byte str[]=new byte[count];
-    for(int i=0; i<count; i++)
+    @LOC("V") byte str[]=new byte[count];
+    for(@LOC("C") int i=0; i<count; i++)
       str[i]=(byte)value[i+offset];
     return str;
   }
-
+  
+  @RETURNLOC("IN")
   public int length() {
     return count;
   }
   
-  public static native int convertdoubletochar(double val, char [] chararray);
-
+  @RETURNLOC("O")
+  public char charAt(@LOC("IN") int index){
+    return value[index];
+  }
 
+    //public static native int convertdoubletochar(double val, char [] chararray);
 
 }
index 472542ef54558dab03e9fe65ee460702d0334c9c..4c773f08c887e8b675404a7d67cdd1cb57797990 100644 (file)
@@ -1,3 +1,5 @@
+@LATTICE("")
+@METHODDEFAULT("OUT<IN")
 public class System {
   public static void printInt(int x) {
     String s = String.valueOf(x);
@@ -14,7 +16,7 @@ public class System {
 
   public static native void printString(String s);
 
-  public static void println(String s) {
+    public static void println(@LOC("IN") String s) {
     System.printString(s + "\n");
   }