annotated
[IRC.git] / Robust / src / Tests / ssJava / mp3decoder / BitReserve.java
index 24794c1aecfeee440410a1a4639469ede4c62af4..bd57b6ea834aba884c534609fd6ce316b90f1d1e 100644 (file)
@@ -38,6 +38,8 @@
 \r
 // REVIEW: there is no range checking, so buffer underflow or overflow\r
 // can silently occur.\r
+@LATTICE("SH<V,V<T,TOT<OFF,OFF<T,SH*,TOT*,OFF*")\r
+@METHODDEFAULT("OUT<V,V<C,C<IN,C*,THISLOC=V,GLOBALLOC=V")\r
 final class BitReserve\r
 {\r
    /**\r
@@ -45,30 +47,34 @@ final class BitReserve
     * Must be a power of 2. And x8, as each bit is stored as a single\r
     * entry.\r
     */\r
-       private static final int                BUFSIZE = 4096*8;\r
+    @LOC("T") private static final int BUFSIZE = 4096*8;\r
        \r
        /**\r
         * Mask that can be used to quickly implement the\r
         * modulus operation on BUFSIZE.\r
         */\r
-       private static final int                BUFSIZE_MASK = BUFSIZE-1;\r
+    @LOC("V") private static final int BUFSIZE_MASK = BUFSIZE-1;\r
        \r
-       private int                                     offset, totbit, buf_byte_idx;\r
-       private final int[]                     buf = new int[BUFSIZE];\r
-       private int                                     buf_bit_idx;\r
+    @LOC("OFF") private int offset;\r
+    @LOC("TOT") private int totbit;\r
+    @LOC("SH") private int buf_byte_idx;\r
+    @LOC("V") private final int[] buf;\r
+    @LOC("T") private int buf_bit_idx;\r
        \r
    BitReserve()\r
-   {\r
-         \r
-         offset = 0;\r
+   {     \r
+      offset = 0;\r
       totbit = 0;\r
-      buf_byte_idx = 0;          \r
+      buf_byte_idx = 0;\r
+      buf = new int[BUFSIZE];\r
    }\r
       \r
    \r
    /**\r
     * Return totbit Field.\r
        */\r
+\r
+   @RETURNLOC("OUT")\r
    public int hsstell() \r
    { \r
           return(totbit); \r
@@ -78,13 +84,15 @@ final class BitReserve
     * Read a number bits from the bit stream.\r
     * @param N the number of\r
        */\r
-   public int hgetbits(int N)\r
+   @LATTICE("OUT<SH,SH<THIS,THIS<C,C<GLOBAL,C*,SH*,THISLOC=THIS,GLOBALLOC=GLOBAL")\r
+   @RETURNLOC("OUT") \r
+   public int hgetbits(@LOC("C") int N)\r
    {\r
         totbit += N;\r
         \r
-        int val = 0;\r
+        @LOC("SH") int val = 0;\r
         \r
-        int pos = buf_byte_idx;\r
+        @LOC("THIS,BitReserve.SH") int pos = buf_byte_idx;\r
         if (pos+N < BUFSIZE)\r
         {\r
                while (N-- > 0)\r
@@ -133,11 +141,12 @@ final class BitReserve
     * Returns next bit from reserve.\r
     * @returns 0 if next bit is reset, or 1 if next bit is set.\r
     */\r
+   @RETURNLOC("OUT")\r
    public int hget1bit()\r
    {             \r
-         totbit++;       \r
-         int val = buf[buf_byte_idx];\r
-         buf_byte_idx = (buf_byte_idx+1) & BUFSIZE_MASK;\r
+      totbit++;          \r
+      @LOC("OUT") int val = buf[buf_byte_idx];\r
+      buf_byte_idx = (buf_byte_idx+1) & BUFSIZE_MASK;\r
       return val;\r
    }\r
    \r
@@ -177,9 +186,10 @@ final class BitReserve
    /**\r
     * Write 8 bits into the bit stream.\r
        */\r
-   public void hputbuf(int val)\r
+   @LATTICE("OUT<THIS,THIS<IN,THISLOC=THIS,GLOBALLOC=IN")\r
+   public void hputbuf(@LOC("IN") int val)\r
    {             \r
-          int ofs = offset;\r
+           @LOC("THIS,BitReserve.OFF") int ofs = offset;\r
           buf[ofs++] = val & 0x80;\r
           buf[ofs++] = val & 0x40;\r
           buf[ofs++] = val & 0x20;\r
@@ -210,9 +220,10 @@ final class BitReserve
    /**\r
     * Rewind N bytes in Stream.\r
        */\r
-   public void rewindNbytes(int N)\r
+   @LATTICE("THIS<BIT,BIT<N,THISLOC=THIS,GLOBALLOC=N")\r
+   public void rewindNbytes(@LOC("N") int N)\r
    {\r
-      int bits = (N << 3);\r
+          @LOC("BIT") int bits = (N << 3);\r
          totbit -= bits;\r
          buf_byte_idx -= bits;   \r
          if (buf_byte_idx<0)\r