+1998-12-14 Tom Tromey <tromey@cygnus.com>
+
+ * gjavah.c (decompile_method): Decompile `return null'.
+ (process_file): Generate `#pragma interface'.
+ (method_declared): New global.
+ (print_method_info): Set it.
+ (HANDLE_CODE_ATTRIBUTE): Only print it method_declared set.
+ (print_method_info): Handle abstract methods.
+
Sun Dec 13 17:31:40 1998 Per Bothner <bothner@cygnus.com>
* parse.y (patch_method_invocation): If class_decl is null
#define HANDLE_CONSTANTVALUE(VALUEINDEX) current_field_value = (VALUEINDEX)
+static int method_declared = 0;
static int method_access = 0;
#define HANDLE_METHOD(ACCESS_FLAGS, NAME, SIGNATURE, ATTRIBUTE_COUNT) \
if (out) { decompiled = 0; \
}
#define HANDLE_CODE_ATTRIBUTE(MAX_STACK, MAX_LOCALS, CODE_LENGTH) \
- if (out) decompile_method (out, jcf, CODE_LENGTH);
+ if (out && method_declared) decompile_method (out, jcf, CODE_LENGTH);
static int decompiled = 0;
#define HANDLE_END_METHOD() \
int length, is_init = 0;
char *override = NULL;
+ method_declared = 0;
method_access = flags;
if (JPOOL_TAG (jcf, name_index) != CONSTANT_Utf8)
fprintf (stream, "<not a UTF8 constant>");
fputs ("virtual ", out);
}
print_c_decl (out, jcf, name_index, sig_index, flags, is_init, override);
+
+ if ((flags & ACC_ABSTRACT))
+ fputs (" = 0", out);
+ else
+ method_declared = 1;
}
/* Try to decompile a method body. Right now we just try to handle a
fputs (" { }", out);
decompiled = 1;
}
+ else if (code_len == 2
+ && codes[0] == OPCODE_aconst_null
+ && codes[1] == OPCODE_areturn)
+ {
+ /* Found `return null'. We don't want to depend on NULL being
+ defined. */
+ fputs (" { return 0; }", out);
+ decompiled = 1;
+ }
}
/* Print one piece of a signature. Returns pointer to next parseable
print_mangled_classname (out, jcf, "#define __", jcf->this_class);
fprintf (out, "__\n\n");
+
+ /* We do this to ensure that inline methods won't be `outlined'
+ by g++. This works as long as method and fields are not
+ added by the user. */
+ fprintf (out, "#pragma interface\n\n");
}
if (jcf->super_class && out)