java-gobject-introspection r169 - in trunk: . src/org/gnome/gir/compiler stub-examples
- From: walters svn gnome org
- To: svn-commits-list gnome org
- Subject: java-gobject-introspection r169 - in trunk: . src/org/gnome/gir/compiler stub-examples
- Date: Fri, 30 Jan 2009 06:23:18 +0000 (UTC)
Author: walters
Date: Fri Jan 30 06:23:17 2009
New Revision: 169
URL: http://svn.gnome.org/viewvc/java-gobject-introspection?rev=169&view=rev
Log:
Docs build. Woo!
Modified:
trunk/src/org/gnome/gir/compiler/DocFactory.java
trunk/stub-examples/TestEnum.java
trunk/wscript
Modified: trunk/src/org/gnome/gir/compiler/DocFactory.java
==============================================================================
--- trunk/src/org/gnome/gir/compiler/DocFactory.java (original)
+++ trunk/src/org/gnome/gir/compiler/DocFactory.java Fri Jan 30 06:23:17 2009
@@ -74,15 +74,16 @@
if ((access & Opcodes.ACC_PROTECTED) != 0) {
modifiers.add("protected");
}
- if ((access & Opcodes.ACC_FINAL) != 0) {
+ if ((access & Opcodes.ACC_FINAL) != 0 &&
+ (access & Opcodes.ACC_ENUM) == 0) {
modifiers.add("final");
}
if ((access & Opcodes.ACC_STATIC) != 0) {
modifiers.add("static");
- }
+ }/* far too much stuff has synchronized - why?
if ((access & Opcodes.ACC_SYNCHRONIZED) != 0) {
modifiers.add("synchronized");
- }
+ }*/
if ((access & Opcodes.ACC_VOLATILE) != 0) {
modifiers.add("volatile");
}
@@ -101,6 +102,9 @@
private class ClassJavafier implements ClassVisitor {
Writer out;
+ boolean isInterface;
+ boolean isEnum;
+ boolean isInner;
String clsName;
public ClassJavafier(Writer out) {
@@ -109,12 +113,18 @@
@Override
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
- clsName = name;
+ isInner = name.contains("$");
+ isInterface = (access & Opcodes.ACC_INTERFACE) != 0;
+ isEnum = (access & Opcodes.ACC_ENUM) != 0;
+ clsName = stripInternals(name);
try {
- out.write(strAccess(access));
- if ((access & Opcodes.ACC_INTERFACE) != 0)
+ out.write("package ");
+ out.write(getPackage(name));
+ out.write(";\n\n");
+ out.write(strAccess(access));
+ if (isInterface)
out.write(" interface ");
- else if ((access & Opcodes.ACC_ENUM) != 0)
+ else if (isEnum)
out.write(" enum ");
else
out.write(" class ");
@@ -123,10 +133,15 @@
if (innerIdx > 0)
iname = iname.substring(innerIdx + 1);
out.write(iname);
- out.write(" extends ");
- out.write(replaceInternals(superName));
+ if (!isInterface && !isEnum) {
+ out.write(" extends ");
+ out.write(replaceInternals(superName));
+ }
if (interfaces != null && interfaces.length > 0) {
- out.write(" implements ");
+ if (!isInterface)
+ out.write(" implements ");
+ else
+ out.write(" extends ");
List<String> ifaces = new ArrayList<String>();
for (String iface : Arrays.asList(interfaces)) {
ifaces.add(replaceInternals(iface));
@@ -134,6 +149,10 @@
out.write(join(",", ifaces));
}
out.write(" {\n");
+
+ if (isEnum) {
+ out.write("FOO;\n\n");
+ }
} catch (IOException e) {
throw new RuntimeException(e);
}
@@ -171,19 +190,25 @@
@Override
public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {
- if (name.equals("<clinit>"))
+ if (name.equals("<clinit>") || (access & Opcodes.ACC_PRIVATE) != 0)
return null;
Type[] args = Type.getArgumentTypes(descriptor);
Type retType = Type.getReturnType(descriptor);
try {
- out.write(strAccess(access));
- out.write(" " + toJava(retType));
+ out.write(strAccess(access));
if (name.equals("<init>"))
name = clsName;
+ else {
+ if (!isInterface && !isInner)
+ out.write(" native ");
+ out.write(" " + toJava(retType));
+ }
+
out.write(" " + name + " (");
for (int i = 0; i < args.length; i++) {
out.write(toJava(args[i]));
+ out.write(" arg" + i);
if (i < args.length - 1)
out.write(", ");
}
@@ -232,13 +257,23 @@
}
}
+ private static final String getPackage(String path) {
+ int idx = path.lastIndexOf('/');
+ return path.substring(0, idx).replace('/', '.');
+ }
+
private static final String stripInternals(String path) {
int idx = path.lastIndexOf('/');
- return path.substring(idx+1);
+ String name = path.substring(idx+1);
+ idx = name.indexOf('$');
+ if (idx < 0)
+ return name;
+
+ return name.substring(idx+1);
}
private static final String replaceInternals(String path) {
- return path.replace('/', '.');
+ return path.replace('$', '.').replace('/', '.');
}
private void generateOne(File jarpath, File girpath, File outpath) throws Exception {
@@ -248,9 +283,9 @@
List<? extends ZipEntry> entries = Collections.list(zf.entries());
for (ZipEntry entry : entries) {
- String name = stripInternals(entry.getName().replace(".class", ""));
- if (name.contains("$"))
+ if (entry.getName().contains("$"))
continue;
+ String name = stripInternals(entry.getName().replace(".class", ""));
File javaOutPath = new File(outpath, entry.getName().replace(".class", ".java"));
javaOutPath.getParentFile().mkdirs();
Modified: trunk/stub-examples/TestEnum.java
==============================================================================
--- trunk/stub-examples/TestEnum.java (original)
+++ trunk/stub-examples/TestEnum.java Fri Jan 30 06:23:17 2009
@@ -1,9 +1,8 @@
import com.sun.jna.FromNativeContext;
-import com.sun.jna.NativeMapped;
-public enum TestEnum implements NativeMapped {
+public enum TestEnum implements com.sun.jna.NativeMapped {
FOO,
BAR;
Modified: trunk/wscript
==============================================================================
--- trunk/wscript (original)
+++ trunk/wscript Fri Jan 30 06:23:17 2009
@@ -127,6 +127,7 @@
#testinvoke.unit_test = 1
def shutdown():
+ pass
# if Options.is_install:
# destdir = Build.bld.get_install_path('${PREFIX}/share/javadoc')
# try:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]