My favorites | Sign in
Project Home Downloads Wiki Issues Source
Repository:
Checkout   Browse   Changes   Clones  
Changes to /demos/jvm_format_4.py
a5969b4fc301 vs. a7887d5d8446 Compare: vs.  Format:
Revision a7887d5d8446
Go to: 
Project members, sign in to write a code review
/demos/jvm_format_4.py   a5969b4fc301 /demos/jvm_format_4.py   a7887d5d8446
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 import sys, random, string 3 import sys, random, string
4 4
5 PATH_INSTALL = "./" 5 PATH_INSTALL = "./"
6 sys.path.append(PATH_INSTALL + "/core") 6 sys.path.append(PATH_INSTALL + "/core")
7 sys.path.append(PATH_INSTALL + "/core/bytecodes") 7 sys.path.append(PATH_INSTALL + "/core/bytecodes")
8 8
9 import jvm 9 import jvm
10 10
11 TEST = "./examples/java/test/orig/Test1.class" 11 TEST = "./examples/java/test/orig/Test1.class"
12 TEST_REF = "./examples/java/Hello.class" 12 TEST_REF = "./examples/java/Hello.class"
13 TEST_OUTPUT = "./examples/java/test/new/Test1.class" 13 TEST_OUTPUT = "./examples/java/test/new/Test1.class"
14 14
15 j = jvm.JVMFormat( open(TEST).read() ) 15 j = jvm.JVMFormat( open(TEST).read() )
16 j2 = jvm.JVMFormat( open(TEST_REF).read() ) 16 j2 = jvm.JVMFormat( open(TEST_REF).read() )
17 17
18 # Insert a method with java dependances methods/class 18 # Insert a method with java dependances methods/class
19 j.insert_direct_method( "toto2", j2.get_method("test5")[0] ) 19 j.insert_direct_method( "toto2", j2.get_method("test5")[0] )
20 20
21 # SAVE CLASS 21 # SAVE CLASS
22 fd = open( TEST_OUTPUT, "w" ) 22 fd = open( TEST_OUTPUT, "w" )
23 fd.write( j.save() ) 23 fd.write( j.save() )
24 fd.close() 24 fd.close()
Powered by Google Project Hosting