*** empty log message ***
[cacao.git] / tests / jvm98 / db.diff
diff --git a/tests/jvm98/db.diff b/tests/jvm98/db.diff
new file mode 100644 (file)
index 0000000..4ae5bfc
--- /dev/null
@@ -0,0 +1,457 @@
+diff -Nu db1/Database.java db/Database.java
+--- db1/Database.java  Wed Jun 17 23:23:16 1998
++++ db/Database.java   Sat Nov 30 16:02:53 2002
+@@ -30,9 +30,6 @@
+  * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
+  */
+-package spec.benchmarks._209_db;
+-import spec.harness.*;
+-import spec.io.*;
+ import java.util.*;
+ import java.io.*;
+@@ -51,11 +48,11 @@
+    private void read_fmt(String filename)
+       {
+       int len, act;
+-      spec.io.FileInputStream fis;
++      java.io.FileInputStream fis;
+       String f;
+       try {
+-         fis = new spec.io.FileInputStream(filename);
++         fis = new java.io.FileInputStream(filename);
+          StreamTokenizer tok = new StreamTokenizer(fis);
+          tok.commentChar(0);
+@@ -81,11 +78,11 @@
+             switch(tok.ttype)
+                {
+                case StreamTokenizer.TT_NUMBER:
+-                  spec.harness.Context.out.println("token=TT_NUMBER: "+tok.nval);
++                  System.out.println("token=TT_NUMBER: "+tok.nval);
+                break;
+                case StreamTokenizer.TT_WORD:
+-                  spec.harness.Context.out.println("token=TT_WORD:   "+tok.sval);
++                  System.out.println("token=TT_WORD:   "+tok.sval);
+                break;
+                case '"':
+@@ -108,7 +105,7 @@
+          }
+       catch (IOException e)
+          {
+-         spec.harness.Context.out.println("ERROR opening/parsing format file "+filename);
++         System.out.println("ERROR opening/parsing format file "+filename);
+          System.exit(1);
+          };
+@@ -135,12 +132,12 @@
+       boolean OK;
+       byte buffer[] = null;
+-      spec.harness.Context.out.print("Reading database "+dbname+" ... ");
+-      spec.harness.Context.out.flush();
++      System.out.print("Reading database "+dbname+" ... ");
++      System.out.flush();
+       try {
+-          spec.io.FileInputStream sif = new spec.io.FileInputStream(filename);
+-          n = sif.getContentLength();
++          java.io.FileInputStream sif = new java.io.FileInputStream(filename);
++          n = (int) new java.io.File(".", filename).length();
+           buffer = new byte[n];
+           int bytes_read;
+@@ -150,7 +147,7 @@
+           sif.close();
+         sif = null;           // 03/11/98 rrh
+           if ( act != n ){
+-            spec.harness.Context.out.println("ERROR reading input file");
++            System.out.println("ERROR reading input file");
+             //System.exit(1);
+             return;
+           }
+@@ -160,18 +157,18 @@
+       {
+       if ( n == 0 )
+          {
+-         spec.harness.Context.out.println("Empty database");
++         System.out.println("Empty database");
+          return;
+          }
+-      spec.harness.Context.out.println("ERROR opening/reading input file \""+filename+"\"");
++      System.out.println("ERROR opening/reading input file \""+filename+"\"");
+ //    System.exit(1);
+       };
+       entry = new Entry();
+-      spec.harness.Context.out.print("OK\nBuilding database ...");
+-      spec.harness.Context.out.flush();
++      System.out.print("OK\nBuilding database ...");
++      System.out.flush();
+       n = buffer.length;
+       s = e = 0;
+@@ -200,7 +197,7 @@
+       buffer = null;     // 03/11/98 rrh
+-      spec.harness.Context.out.println("Done.");
++      System.out.println("Done.");
+       }
+@@ -209,21 +206,21 @@
+       Entry entry;
+       String s;
+       Enumeration e = entries.elements();
+-      spec.io.FileOutputStream fos = null;
++      java.io.FileOutputStream fos = null;
+       byte buffer[] = new byte[64*1024];
+       int c, len;
+-      spec.harness.Context.out.print("Saving database "+dbname+" ... ");
+-      spec.harness.Context.out.flush();
++      System.out.print("Saving database "+dbname+" ... ");
++      System.out.flush();
+       try
+          {
+-         fos = new spec.io.FileOutputStream(dbname+".dat");
++         fos = new java.io.FileOutputStream(dbname+".dat");
+          }
+       catch (IOException ex)
+          {
+-         spec.harness.Context.out.println("\nERROR creating output file "+dbname+".dat");
++         System.out.println("\nERROR creating output file "+dbname+".dat");
+ //       System.exit(1);
+          }
+@@ -246,7 +243,7 @@
+                {
+                try {fos.write(buffer, 0, c);} catch(IOException ex)
+                   {
+-                  spec.harness.Context.out.println("ERROR writing to output file "+dbname+".dat");
++                  System.out.println("ERROR writing to output file "+dbname+".dat");
+ //                System.exit(1);
+                   }
+@@ -267,7 +264,7 @@
+             {
+             try {fos.write(buffer, 0, c);} catch(IOException ex)
+                {
+-               spec.harness.Context.out.println("ERROR writing to output file "+dbname+".dat");
++               System.out.println("ERROR writing to output file "+dbname+".dat");
+ //             System.exit(1);
+                }
+@@ -288,14 +285,14 @@
+              }
+          catch(IOException ex)
+             {
+-            spec.harness.Context.out.println("ERROR writing to output file "+dbname+".dat");
++            System.out.println("ERROR writing to output file "+dbname+".dat");
+ //          System.exit(1);
+             }
+       buffer = null;     // 03/11/98 rrh
+       fos = null;        // 03/11/98 rrh
+-      spec.harness.Context.out.println("Done.");
++      System.out.println("Done.");
+       }
+@@ -346,7 +343,7 @@
+          printRec();
+          }
+       else
+-         spec.harness.Context.out.println("Invalid record number ("+(rec+1)+")");
++         System.out.println("Invalid record number ("+(rec+1)+")");
+       }
+@@ -387,7 +384,7 @@
+       if ( (current_record >= index.length) || (current_record < 0) )
+          return;
+-      spec.harness.Context.out.println("---- Record number "+(current_record+1)+" ----");
++      System.out.println("---- Record number "+(current_record+1)+" ----");
+       entry = index[current_record];
+@@ -400,18 +397,18 @@
+          s = ((String)f.nextElement());
+          if ( s != null )
+-            spec.harness.Context.out.print(s);
++            System.out.print(s);
+          else
+             {
+             s = (String)i.nextElement();
+-            spec.harness.Context.out.println(s);
++            System.out.println(s);
+             }
+          }
+       i = null;     // 03/11/98 rrh
+       f = null;     // 03/11/98 rrh
+-      spec.harness.Context.out.println();
++      System.out.println();
+       }
+@@ -445,15 +442,15 @@
+          if ( field != null )
+             {
+             // These create too much output for benchmark - rrh
+-            //spec.harness.Context.out.print(field);
+-            //spec.harness.Context.out.flush();
++            //System.out.print(field);
++            //System.out.flush();
+             }
+          else
+             {
+             try { s = dis.readLine(); }
+             catch (IOException e)
+                {
+-               spec.harness.Context.out.println("input error");
++               System.out.println("input error");
+ //             System.exit(1);
+                }
+@@ -485,20 +482,20 @@
+          if ( field != null )
+             {
+             // Reduce output
+-            //spec.harness.Context.out.print(field);
+-            //spec.harness.Context.out.flush();
++            //System.out.print(field);
++            //System.out.flush();
+             }
+          else
+             {
+             os = (String)(((Entry)index[current_record]).items.elementAt(fn));
+             // Reduce output
+-            //spec.harness.Context.out.print(" ("+os+") ");
+-            //spec.harness.Context.out.flush();
++            //System.out.print(" ("+os+") ");
++            //System.out.flush();
+             try { s = dis.readLine(); }
+             catch (IOException e)
+                {
+-               spec.harness.Context.out.println("input error");
++               System.out.println("input error");
+ //             System.exit(1);
+                }
+@@ -520,7 +517,7 @@
+    public void status()
+       {
+       if ( index == null ) set_index();
+-      spec.harness.Context.out.println("Record "+(current_record+1)+" of "+index.length);
++      System.out.println("Record "+(current_record+1)+" of "+index.length);
+       }
+    private String fieldValue;
+@@ -546,15 +543,15 @@
+          if ( fs != null )
+             {
+             // Reduce output
+-            //spec.harness.Context.out.print(fs);
+-            //spec.harness.Context.out.flush();
++            //System.out.print(fs);
++            //System.out.flush();
+             }
+          else
+             {
+             try { fieldValue = dis.readLine(); }
+             catch (IOException ex)
+                {
+-               spec.harness.Context.out.println("input error");
++               System.out.println("input error");
+ //             System.exit(1);
+                }
+@@ -595,25 +592,25 @@
+       if ( fn != fnum )
+          {
+          // Reduce output
+-         //spec.harness.Context.out.print("Sorting on requested fieldname ... ");
+-         //spec.harness.Context.out.flush();
++         //System.out.print("Sorting on requested fieldname ... ");
++         //System.out.flush();
+          shell_sort(fn);
+          }
+       else
+          {
+-         //spec.harness.Context.out.print("Already sorted");
++         //System.out.print("Already sorted");
+          }
+       // Reduce output
+-      //spec.harness.Context.out.print("\nSearching ... ");
+-      //spec.harness.Context.out.flush();
++      //System.out.print("\nSearching ... ");
++      //System.out.flush();
+       if ( (rec = lookup(fieldValue, fnum)) < 0 )
+-         spec.harness.Context.out.println("NOT found");
++         System.out.println("NOT found");
+       else
+          {
+-         spec.harness.Context.out.println();
++         System.out.println();
+          while ( rec >= 0 )
+             {
+diff -Nu db1/Main.java db/Main.java
+--- db1/Main.java      Wed Jun 17 23:23:17 1998
++++ db/Main.java       Sat Nov 30 16:02:53 2002
+@@ -23,33 +23,30 @@
+  * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
+  */
+-package spec.benchmarks._209_db;
+-import spec.harness.*;
+-
+ import java.io.*;
+ import java.util.*;
+-public class Main implements SpecBenchmark
+-{
++public class Main {
++
+       private boolean standalone = true;
+ static void help()
+    {
+-   spec.harness.Context.out.println("a - add record");
+-   spec.harness.Context.out.println("b - show beginning record");
+-   spec.harness.Context.out.println("d - delete record");
+-   spec.harness.Context.out.println("e - show end record");
+-   spec.harness.Context.out.println("f - find record");
+-   spec.harness.Context.out.println("m - modify record");
+-   spec.harness.Context.out.println("n - next entry");
+-   spec.harness.Context.out.println("p - previous record");
+-   spec.harness.Context.out.println("q - quit");
+-   spec.harness.Context.out.println("w - write database");
+-   spec.harness.Context.out.println("s - sort");
+-   spec.harness.Context.out.println(". - current record number");
+-   spec.harness.Context.out.println("x - Total records");
+-   spec.harness.Context.out.println("num - goto record number 'num'");
++   System.out.println("a - add record");
++   System.out.println("b - show beginning record");
++   System.out.println("d - delete record");
++   System.out.println("e - show end record");
++   System.out.println("f - find record");
++   System.out.println("m - modify record");
++   System.out.println("n - next entry");
++   System.out.println("p - previous record");
++   System.out.println("q - quit");
++   System.out.println("w - write database");
++   System.out.println("s - sort");
++   System.out.println(". - current record number");
++   System.out.println("x - Total records");
++   System.out.println("num - goto record number 'num'");
+    }
+@@ -57,7 +54,7 @@
+     static long runBenchmark( String[] args ) {
+     
+-     int speed =  spec.harness.Context.getSpeed();   
++     int speed = 100;   
+     
+ //      if( args.length == 0 ) {
+         if( speed == 100 ) {
+@@ -95,13 +92,13 @@
+     long starttime = System.currentTimeMillis();
+     try {
+       int iter = 1; //spec.harness.Context.getSpeed();
+-      spec.harness.Context.out.println( "db " + iter + " iterations " );
++      System.out.println( "db " + iter + " iterations " );
+       
+       for( int i = 0 ; i < iter ; i++ ) { //**NS**
+             run(argv);
+       }
+     } catch (IOException e) {
+-        spec.harness.Context.out.println("Error in run() method");
++        System.out.println("Error in run() method");
+     }
+     return System.currentTimeMillis() - starttime;
+   }
+@@ -113,7 +110,7 @@
+    String s;
+    Database db;
+    DataInputStream dis = null;
+-   dis = new DataInputStream( new spec.io.FileInputStream( arg[1]) );
++   dis = new DataInputStream( new java.io.FileInputStream( arg[1]) );
+    
+    boolean OK = true;
+    boolean changed = false;
+@@ -127,7 +124,7 @@
+    while ( OK )
+       {
+       // Reduce output
+-      //spec.harness.Context.out.print(": "); spec.harness.Context.out.flush();
++      //System.out.print(": "); System.out.flush();
+       s = dis.readLine();
+@@ -148,27 +145,27 @@
+          {
+          case 'a':
+             db.add(db.getEntry(dis));
+-            //spec.harness.Context.out.println("Number of records: "+db.numRecords());
++            //System.out.println("Number of records: "+db.numRecords());
+             // Really reduce output
+-            //spec.harness.Context.out.println(db.numRecords()+" ");
++            //System.out.println(db.numRecords()+" ");
+             changed = true;
+          break;
+          case 'h':  help(); break;
+          case 'd':
+-          //spec.harness.Context.out.print("Delete record "+(db.currentRec()+1)+" y/n? ");
+-          //spec.harness.Context.out.print("d "+(db.currentRec()+1)+" y/n? ");
+-          //spec.harness.Context.out.print(db.currentRec()+1+" ");
+-          //spec.harness.Context.out.flush();
++          //System.out.print("Delete record "+(db.currentRec()+1)+" y/n? ");
++          //System.out.print("d "+(db.currentRec()+1)+" y/n? ");
++          //System.out.print(db.currentRec()+1+" ");
++          //System.out.flush();
+             s = dis.readLine();
+           if ( s.length() > 0 )
+              {
+              if ( s.charAt(0) == 'y' )
+                 {
+                 db.remove();
+-                  //spec.harness.Context.out.println("Number of records: "+db.numRecords());
+-                  //spec.harness.Context.out.println(db.numRecords());
++                  //System.out.println("Number of records: "+db.numRecords());
++                  //System.out.println(db.numRecords());
+                   changed = true;
+                 }
+                }
+@@ -213,7 +210,7 @@
+    if ( changed )
+       {
+-      spec.harness.Context.out.print("Save database (y or n)? "); spec.harness.Context.out.flush();
++      System.out.print("Save database (y or n)? "); System.out.flush();
+       s = dis.readLine();
+       if ( (s.charAt(0) != 'n') && standalone )