diff options
author | apbianco <apbianco@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-08-08 03:33:36 +0000 |
---|---|---|
committer | apbianco <apbianco@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-08-08 03:33:36 +0000 |
commit | 52725f92f682bc42dd91efec05d6ed44e49e4e13 (patch) | |
tree | 3231a690fb29e8d59f05640bc2d73c4114d8b28e /gcc/java/jcf-reader.c | |
parent | dbf72e3b2af17e4807c966f8853f23519088c172 (diff) | |
download | gcc-52725f92f682bc42dd91efec05d6ed44e49e4e13.tar.gz |
2000-08-07 Alexandre Petit-Bianco <apbianco@cygnus.com
* parse.y (build_dot_class_method_invocation): Changed parameter
name to `type.' Build signature from `type' and convert it to a
STRING_CST if it's an array.
(patch_incomplete_class_ref): `build_dot_class_method_invocation'
to use `ref_type' directly.
2000-08-01 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (maybe_yank_clinit): When generating bytecode: non empty
method bodies not to rule out discarding `<clinit>'; don't use
<clinit> to initialize static fields with constant initializers.
2000-08-01 Alexandre Petit-Bianco <apbianco@cygnus.com>
* gjavah.c (print_method_info): Added `synth' parameter. Skip
synthetic methods.
(method_synthetic): New global.
(HANDLE_METHOD): Recognize synthetic method and tell
`print_method_info' about it.
(HANDLE_END_METHOD): Do not issue an additional `;\n' if we're
processing a synthetic method.
* jcf-reader.c (skip_attribute): New function.
( skip_attribute): Likewise.
2000-08-01 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (build_outer_field_access): Fixed comments.
(fix_constructors): Emit the initialization of this$<n> before
calling $finit$.
(resolve_qualified_expression_name): Build an access to `decl' if
necessary.
2000-07-31 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse-scan.y (curent_class): Non longer const.
(inner_qualifier, inner_qualifier_length): Deleted.
(current_class_length): New global.
(bracket_count): Fixed typo in leading comment.
(anonymous_count): New global.
(class_instance_creation_expression:): Handle anonymous classes.
(anonymous_class_creation:): New rule.
(push_class_context): Rewritten.
(pop_class_context): Likewise.
(INNER_QUALIFIER): Macro deleted.
(report_class_declaration): call `push_class_context' when
entering the function. `fprintf' format modified not to use
INNER_QUALIFIER.
(report_class_declaration): Assign `package_name' and
`current_class' to NULL separatly.
2000-07-31 Alexandre Petit-Bianco <apbianco@cygnus.com>
* expr.c (build_invokeinterface): Call layout_class_methods on
target interface.
(http://gcc.gnu.org/ml/gcc-patches/2000-08/msg00339.html)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35560 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/java/jcf-reader.c')
-rw-r--r-- | gcc/java/jcf-reader.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/gcc/java/jcf-reader.c b/gcc/java/jcf-reader.c index 878c4de86b1..1b081e54fbe 100644 --- a/gcc/java/jcf-reader.c +++ b/gcc/java/jcf-reader.c @@ -27,6 +27,8 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ #include "zipfile.h" static int get_attribute PARAMS ((JCF *)); +static int peek_attribute PARAMS ((JCF *, int, const char *, int)); +static void skip_attribute PARAMS ((JCF *, int)); static int jcf_parse_preamble PARAMS ((JCF *)); static int jcf_parse_constant_pool PARAMS ((JCF *)); static void jcf_parse_class PARAMS ((JCF *)); @@ -35,6 +37,64 @@ static int jcf_parse_one_method PARAMS ((JCF *)); static int jcf_parse_methods PARAMS ((JCF *)); static int jcf_parse_final_attributes PARAMS ((JCF *)); +/* Go through all available attribute (ATTRIBUTE_NUMER) and try to + identify PEEKED_NAME. Return 1 if PEEKED_NAME was found, 0 + otherwise. JCF is restored to its initial position before + returning. */ + +static int +peek_attribute (jcf, attribute_number, peeked_name, peeked_name_length) + JCF *jcf; + int attribute_number; + const char *peeked_name; + int peeked_name_length; +{ + int to_return = 0; + long absolute_offset = (long)JCF_TELL (jcf); + int i; + + for (i = 0; !to_return && i < attribute_number; i++) + { + uint16 attribute_name = (JCF_FILL (jcf, 6), JCF_readu2 (jcf)); + uint32 attribute_length = JCF_readu4 (jcf); + int name_length; + const unsigned char *name_data; + + JCF_FILL (jcf, (long) attribute_length); + if (attribute_name <= 0 || attribute_name >= JPOOL_SIZE(jcf) + || JPOOL_TAG (jcf, attribute_name) != CONSTANT_Utf8) + continue; + + name_length = JPOOL_UTF_LENGTH (jcf, attribute_name); + name_data = JPOOL_UTF_DATA (jcf, attribute_name); + + if (name_length == peeked_name_length + && ! memcmp (name_data, peeked_name, peeked_name_length)) + { + to_return = 1; + break; + } + + JCF_SKIP (jcf, attribute_length); + } + + JCF_SEEK (jcf, absolute_offset); + return to_return; +} + +static void +skip_attribute (jcf, number_of_attribute) + JCF *jcf; + int number_of_attribute; +{ + while (number_of_attribute--) + { + JCF_FILL (jcf, 6); + (void) JCF_readu2 (jcf); + JCF_SKIP (jcf, JCF_readu4 (jcf)); + } +} + static int DEFUN(get_attribute, (jcf), JCF *jcf) |