Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

JavaIoPrintStreamReflection.java

00001 package gov.nasa.arc.ase.jpf.jvm.reflection;
00002 
00003 import gov.nasa.arc.ase.jpf.jvm.*;
00004 import de.fub.bytecode.generic.InstructionHandle;
00005 
00006 public class JavaIoPrintStreamReflection extends Reflection {
00007   public InstructionHandle executeMethod(MethodInfo mi, boolean atomic) {
00008     String name = mi.getFullName();
00009 
00010     if(name.equals("java.io.PrintStream.println()V")) {
00011       println();
00012       return exit();
00013     }
00014 
00015     if(name.equals("java.io.PrintStream.print(Ljava/lang/String;)V")) {
00016       String s = da.convert2String(th.getLocalVariable(1));
00017       print(s);
00018       return exit();
00019     }
00020 
00021     if(name.equals("java.io.PrintStream.println(Ljava/lang/String;)V")) {
00022       String s = da.convert2String(th.getLocalVariable(1));
00023       println(s);
00024       return exit();
00025     }
00026 
00027     if(name.equals("java.io.PrintStream.print(I)V")) {
00028       int i = th.getLocalVariable(1);
00029       print(i);
00030       return exit();
00031     }
00032 
00033     if(name.equals("java.io.PrintStream.println(I)V")) {
00034       int i = th.getLocalVariable(1);
00035       println(i);
00036       return exit();
00037     }
00038 
00039     if(name.equals("java.io.PrintStream.print(F)V")) {
00040       float f = Types.intToFloat(th.getLocalVariable(1));
00041       print(f);
00042       return exit();
00043     }
00044 
00045     if(name.equals("java.io.PrintStream.println(F)V")) {
00046       float f = Types.intToFloat(th.getLocalVariable(1));
00047       println(f);
00048       return exit();
00049     }
00050 
00051     return super.executeMethod(mi, atomic);
00052   }  
00053   public boolean isMethodExecutable(MethodInfo mi) {
00054     String name = mi.getFullName();
00055 
00056     if(name.equals("java.io.PrintStream.println()V"))
00057       return true;
00058 
00059     if(name.equals("java.io.PrintStream.print(Ljava/lang/String;)V"))
00060       return true;
00061 
00062     if(name.equals("java.io.PrintStream.println(Ljava/lang/String;)V"))
00063       return true;
00064 
00065     if(name.equals("java.io.PrintStream.print(I)V"))
00066       return true;
00067 
00068     if(name.equals("java.io.PrintStream.println(I)V"))
00069       return true;
00070 
00071     if(name.equals("java.io.PrintStream.print(F)V"))
00072       return true;
00073 
00074     if(name.equals("java.io.PrintStream.println(F)V"))
00075       return true;
00076 
00077     return super.isMethodExecutable(mi);
00078   }  
00079   public void print(float f) {
00080     if(VirtualMachine.options.verify_print) System.out.print(f);
00081   }  
00082   public void print(int i) {
00083     if(VirtualMachine.options.verify_print) System.out.print(i);
00084   }  
00085   public void print(String s) {
00086     if(VirtualMachine.options.verify_print) System.out.print(s);
00087   }  
00088   public void println() {
00089     if(VirtualMachine.options.verify_print) System.out.println();
00090   }  
00091   public void println(float f) {
00092     if(VirtualMachine.options.verify_print) System.out.println(f);
00093   }  
00094   public void println(int i) {
00095     if(VirtualMachine.options.verify_print) System.out.println(i);
00096   }  
00097   public void println(String s) {
00098     if(VirtualMachine.options.verify_print) System.out.println(s);
00099   }  
00100 }

Generated at Thu Feb 7 06:48:17 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001