@ -52,8 +52,9 @@ public class ClassBundle implements OptionHandler {
String classPath ;
String classPath ;
String destDir ;
String destDir ;
String tableFile ;
String inTableFile ;
String toTableFile ;
String outTableFile ;
String outRevTableFile ;
IdentifierMatcher loading ;
IdentifierMatcher loading ;
IdentifierMatcher preserving ;
IdentifierMatcher preserving ;
@ -103,21 +104,39 @@ public class ClassBundle implements OptionHandler {
return ;
return ;
}
}
if ( option . equals ( "table" ) ) {
if ( option . equals ( "verbose" ) ) {
if ( values . size ( ) ! = 1 )
throw new IllegalArgumentException
( "Verbose takes one int parameter" ) ;
GlobalOptions . verboseLevel
= ( ( Integer ) values . iterator ( ) . next ( ) ) . intValue ( ) ;
return ;
}
if ( option . equals ( "intable" ) | | option . equals ( "table" ) ) {
if ( values . size ( ) ! = 1 )
if ( values . size ( ) ! = 1 )
throw new IllegalArgumentException
throw new IllegalArgumentException
( "Only one destination path allowed" ) ;
( "Only one destination path allowed" ) ;
tableFile = ( String ) values . iterator ( ) . next ( ) ;
inT ableFile = ( String ) values . iterator ( ) . next ( ) ;
return ;
return ;
}
}
if ( option . equals ( "revtable" ) ) {
if ( option . equals ( "out table" ) ) {
if ( values . size ( ) ! = 1 )
if ( values . size ( ) ! = 1 )
throw new IllegalArgumentException
throw new IllegalArgumentException
( "Only one destination path allowed" ) ;
( "Only one destination path allowed" ) ;
to TableFile = ( String ) values . iterator ( ) . next ( ) ;
ou tTableFile = ( String ) values . iterator ( ) . next ( ) ;
return ;
return ;
}
}
if ( option . equals ( "outrevtable" ) | | option . equals ( "revtable" ) ) {
if ( values . size ( ) ! = 1 )
throw new IllegalArgumentException
( "Only one destination path allowed" ) ;
outRevTableFile = ( String ) values . iterator ( ) . next ( ) ;
return ;
}
if ( option . equals ( "strip" ) ) {
if ( option . equals ( "strip" ) ) {
next_token :
next_token :
for ( Iterator iter = values . iterator ( ) ; iter . hasNext ( ) ; ) {
for ( Iterator iter = values . iterator ( ) ; iter . hasNext ( ) ; ) {
@ -359,25 +378,41 @@ public class ClassBundle implements OptionHandler {
public void readTable ( ) {
public void readTable ( ) {
try {
try {
TranslationTable table = new TranslationTable ( ) ;
TranslationTable table = new TranslationTable ( ) ;
InputStream input = new FileInputStream ( t ableFile) ;
InputStream input = new FileInputStream ( inT ableFile) ;
table . load ( input ) ;
table . load ( input ) ;
input . close ( ) ;
input . close ( ) ;
basePackage . readTable ( table ) ;
basePackage . readTable ( table ) ;
} catch ( java . io . IOException ex ) {
} catch ( java . io . IOException ex ) {
GlobalOptions . err . println ( "Can't read rename table " + tableFile ) ;
GlobalOptions . err . println ( "Can't read rename table "
+ inTableFile ) ;
ex . printStackTrace ( GlobalOptions . err ) ;
ex . printStackTrace ( GlobalOptions . err ) ;
}
}
}
}
public void writeTable ( ) {
public void writeTable ( ) {
TranslationTable table = new TranslationTable ( ) ;
TranslationTable table = new TranslationTable ( ) ;
basePackage . writeTable ( table ) ;
basePackage . writeTable ( table , false ) ;
try {
try {
OutputStream out = new FileOutputStream ( to TableFile ) ;
OutputStream out = new FileOutputStream ( ou tTableFile) ;
table . store ( out ) ;
table . store ( out ) ;
out . close ( ) ;
out . close ( ) ;
} catch ( java . io . IOException ex ) {
} catch ( java . io . IOException ex ) {
GlobalOptions . err . println ( "Can't write rename table " + toTableFile ) ;
GlobalOptions . err . println ( "Can't write rename table "
+ outTableFile ) ;
ex . printStackTrace ( GlobalOptions . err ) ;
}
}
public void writeRevTable ( ) {
TranslationTable revtable = new TranslationTable ( ) ;
basePackage . writeTable ( revtable , true ) ;
try {
OutputStream out = new FileOutputStream ( outRevTableFile ) ;
revtable . store ( out ) ;
out . close ( ) ;
} catch ( java . io . IOException ex ) {
GlobalOptions . err . println ( "Can't write rename table "
+ outRevTableFile ) ;
ex . printStackTrace ( GlobalOptions . err ) ;
ex . printStackTrace ( GlobalOptions . err ) ;
}
}
}
}
@ -477,11 +512,13 @@ public class ClassBundle implements OptionHandler {
GlobalOptions . err . println ( "Renaming methods" ) ;
GlobalOptions . err . println ( "Renaming methods" ) ;
time = System . currentTimeMillis ( ) ;
time = System . currentTimeMillis ( ) ;
if ( t ableFile ! = null )
if ( inT ableFile ! = null )
readTable ( ) ;
readTable ( ) ;
buildTable ( renamer ) ;
buildTable ( renamer ) ;
if ( to TableFile ! = null )
if ( ou tTableFile ! = null )
writeTable ( ) ;
writeTable ( ) ;
if ( outRevTableFile ! = null )
writeRevTable ( ) ;
System . err . println ( "Time used: " + ( System . currentTimeMillis ( ) - time ) ) ;
System . err . println ( "Time used: " + ( System . currentTimeMillis ( ) - time ) ) ;
GlobalOptions . err . println ( "Transforming the classes" ) ;
GlobalOptions . err . println ( "Transforming the classes" ) ;