KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > soot > jimple > toolkits > pointer > nativemethods > NativeMethodClass


1 /* Soot - a J*va Optimization Framework
2  * Copyright (C) 2003 Feng Qian
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */

19
20 /**
21  * NativeMethodClass defines side-effect simulation of native methods
22  * in a class.
23  */

24 package soot.jimple.toolkits.pointer.nativemethods;
25
26 import soot.*;
27 import soot.jimple.toolkits.pointer.representations.*;
28 import soot.jimple.toolkits.pointer.util.*;
29
30 public abstract class NativeMethodClass {
31
32   private static final boolean DEBUG = false;
33   protected NativeHelper helper;
34   public NativeMethodClass(NativeHelper helper) {
35       this.helper = helper;
36   }
37
38   /* If a native method has no side effect, call this method.
39    * Currently, it does nothing.
40    */

41   public static void defaultMethod(SootMethod method,
42                    ReferenceVariable thisVar,
43                    ReferenceVariable returnVar,
44                    ReferenceVariable params[]){
45     if (DEBUG) {
46       G.v().out.println("No side effects : "+method.toString());
47     }
48   }
49
50   /* To be implemented by individual classes */
51   public abstract void simulateMethod(SootMethod method,
52                       ReferenceVariable thisVar,
53                       ReferenceVariable returnVar,
54                       ReferenceVariable params[]);
55
56   
57 }
58
Popular Tags