mirror of
https://github.com/Maschell/ghs-demangle-java.git
synced 2024-11-21 23:49:16 +01:00
Formatting, fix some bugs
This commit is contained in:
parent
d1819ad7c1
commit
64d89ee4a5
@ -8,10 +8,6 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Hello world!
|
||||
*
|
||||
*/
|
||||
public class App {
|
||||
|
||||
static String[] templatePrefixes = new String[] { "tm", "ps", "pt" /* XXX from libiberty cplus-dem.c */ };
|
||||
@ -25,32 +21,25 @@ public class App {
|
||||
init();
|
||||
|
||||
|
||||
demangle("__sti___17_RZApplication_cpp_8fdb2739");
|
||||
|
||||
BufferedReader reader;
|
||||
try {
|
||||
reader = new BufferedReader(new FileReader("functions.txt"));
|
||||
reader = new BufferedReader(new FileReader(args[0]));
|
||||
String line = reader.readLine();
|
||||
while (line != null) {
|
||||
String newStr = line;
|
||||
try {
|
||||
newStr = demangle(line);
|
||||
|
||||
// System.out.println(newStr);
|
||||
|
||||
System.out.println(newStr);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
System.out.println(newStr);
|
||||
System.out.println(line);
|
||||
}
|
||||
// read next line
|
||||
line = reader.readLine();
|
||||
}
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void init() {
|
||||
@ -232,9 +221,8 @@ public class App {
|
||||
if (end == -1) throw new IllegalArgumentException("Unexpected end of string. Expected \"Z\".");
|
||||
|
||||
current = remainder.getValue().substring(0, end);
|
||||
remainder.setValue(name.substring(end + 1));
|
||||
remainder.setValue(name.substring(end + 2));
|
||||
} else {
|
||||
|
||||
current = ReadString(remainder.getValue(), remainder);
|
||||
}
|
||||
|
||||
@ -415,7 +403,11 @@ public class App {
|
||||
name = name.substring(0, mstart);
|
||||
|
||||
while (true) {
|
||||
if (!StartsWithAny(remainder, templatePrefixes)) throw new IllegalArgumentException("Unexpected template argument prefix.");
|
||||
if (!StartsWithAny(remainder, templatePrefixes)) {
|
||||
// throw new IllegalArgumentException("Unexpected template argument prefix. " + remainder);
|
||||
return name;
|
||||
|
||||
}
|
||||
|
||||
/* format of remainder should be <type>__<len>_<arg> */
|
||||
int lstart = remainder.indexOf("__");
|
||||
@ -569,7 +561,7 @@ public class App {
|
||||
break;
|
||||
}
|
||||
|
||||
if (end > start) valid = false;
|
||||
if (end < start) valid = false;
|
||||
|
||||
if (valid) {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user