2003-01-09 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+ * expr.c, gjavah.c, javaop.h, jcf-dump.c, jcf-io.c, jcf-reader.c,
+ jcf-write.c, jcf.h, jv-scan.c: Don't rely on the `DEFUN', `AND' or
+ `__STDC__' macros.
+
* jv-scan.c, parse.y: Remove VPARAMS, VA_OPEN, VA_FIXEDARG and
VA_CLOSE.
jint INT_temp;
#undef RET /* Defined by config/i386/i386.h */
-#undef AND /* Causes problems with opcodes for iand and land. */
#undef PTR
#define BCODE byte_ops
#define BYTE_type_node byte_type_node
string, an error results. */
static void
-DEFUN(print_name, (stream, jcf, name_index),
- FILE* stream AND JCF* jcf AND int name_index)
+print_name (FILE* stream, JCF* jcf, int name_index)
{
if (JPOOL_TAG (jcf, name_index) != CONSTANT_Utf8)
{
}
static void
-DEFUN(print_field_info, (stream, jcf, name_index, sig_index, flags),
- FILE *stream AND JCF* jcf
- AND int name_index AND int sig_index AND JCF_u2 flags)
+print_field_info (FILE *stream, JCF* jcf, int name_index, int sig_index,
+ JCF_u2 flags)
{
char *override = NULL;
static void
-DEFUN(print_method_info, (stream, jcf, name_index, sig_index, flags),
- FILE *stream AND JCF* jcf
- AND int name_index AND int sig_index AND JCF_u2 flags)
+print_method_info (FILE *stream, JCF* jcf, int name_index, int sig_index,
+ JCF_u2 flags)
{
const unsigned char *str;
int length, is_init = 0;
}
static void
-DEFUN(print_c_decl, (stream, jcf, name_index, signature_index, is_init,
- name_override, flags),
- FILE* stream AND JCF* jcf
- AND int name_index AND int signature_index
- AND int is_init AND const char *name_override AND int flags)
+print_c_decl (FILE* stream, JCF* jcf, int name_index, int signature_index,
+ int is_init, const char *name_override, int flags)
{
if (JPOOL_TAG (jcf, signature_index) != CONSTANT_Utf8)
{
/* Print the unqualified method name followed by the signature. */
static void
-DEFUN(print_full_cxx_name, (stream, jcf, name_index, signature_index,
- is_init, name_override, flags),
- FILE* stream AND JCF* jcf
- AND int name_index AND int signature_index AND int is_init
- AND const char *name_override AND int flags)
+print_full_cxx_name (FILE* stream, JCF* jcf, int name_index,
+ int signature_index, int is_init,
+ const char *name_override, int flags)
{
int length = JPOOL_UTF_LENGTH (jcf, signature_index);
const unsigned char *str0 = JPOOL_UTF_DATA (jcf, signature_index);
/* This is a helper for print_stub_or_jni. */
static void
-DEFUN (print_name_for_stub_or_jni, (stream, jcf, name_index, signature_index,
- is_init, name_override, flags),
- FILE *stream AND JCF *jcf
- AND int name_index AND int signature_index
- AND int is_init AND const char *name_override AND int flags)
+print_name_for_stub_or_jni (FILE *stream, JCF *jcf, int name_index,
+ int signature_index, int is_init,
+ const char *name_override, int flags)
{
const char *const prefix = flag_jni ? "Java_" : "";
print_cxx_classname (stream, prefix, jcf, jcf->this_class, 1);
}
static void
-DEFUN(print_stub_or_jni, (stream, jcf, name_index, signature_index, is_init,
- name_override, flags),
- FILE* stream AND JCF* jcf
- AND int name_index AND int signature_index
- AND int is_init AND const char *name_override AND int flags)
+print_stub_or_jni (FILE* stream, JCF* jcf, int name_index,
+ int signature_index, int is_init,
+ const char *name_override, int flags)
{
if (JPOOL_TAG (jcf, signature_index) != CONSTANT_Utf8)
{
}
static void
-DEFUN(print_mangled_classname, (stream, jcf, prefix, index),
- FILE *stream AND JCF *jcf AND const char *prefix AND int index)
+print_mangled_classname (FILE *stream, JCF *jcf, const char *prefix, int index)
{
int name_index = JPOOL_USHORT1 (jcf, index);
fputs (prefix, stream);
\f
static void
-DEFUN(process_file, (jcf, out),
- JCF *jcf AND FILE *out)
+process_file (JCF *jcf, FILE *out)
{
int code, i;
uint32 field_start, method_end, method_start;
}
int
-DEFUN(main, (argc, argv),
- int argc AND char** argv)
+main (int argc, char** argv)
{
JCF jcf;
int argi;
#endif
typedef uint16 jchar;
-#ifdef __STDC__
typedef signed char jbyte;
-#else
-typedef char jbyte;
-#endif
typedef int16 jshort;
typedef int32 jint;
typedef int64 jlong;
#define PRINT_SIGNATURE_ARGS_ONLY 2
static int
-DEFUN(utf8_equal_string, (jcf, index, value),
- JCF *jcf AND int index AND const char * value)
+utf8_equal_string (JCF *jcf, int index, const char * value)
{
if (CPOOL_INDEX_IN_RANGE (&jcf->cpool, index)
&& JPOOL_TAG (jcf, index) == CONSTANT_Utf8)
#include "javaop.h"
static void
-DEFUN(print_constant_ref, (stream, jcf, index),
- FILE *stream AND JCF *jcf AND int index)
+print_constant_ref (FILE *stream, JCF *jcf, int index)
{
fprintf (stream, "#%d=<", index);
if (index <= 0 || index >= JPOOL_SIZE(jcf))
or 'm' (method flags). */
static void
-DEFUN (print_access_flags, (stream, flags, context),
- FILE *stream AND uint16 flags AND char context)
+print_access_flags (FILE *stream, uint16 flags, char context)
{
if (flags & ACC_PUBLIC) fprintf (stream, " public");
if (flags & ACC_PRIVATE) fprintf (stream, " private");
static void
-DEFUN(print_name, (stream, jcf, name_index),
- FILE* stream AND JCF* jcf AND int name_index)
+print_name (FILE* stream, JCF* jcf, int name_index)
{
if (JPOOL_TAG (jcf, name_index) != CONSTANT_Utf8)
fprintf (stream, "<not a UTF8 constant>");
print it tersely, otherwise more verbosely. */
static void
-DEFUN(print_constant_terse, (out, jcf, index, expected),
- FILE *out AND JCF *jcf AND int index AND int expected)
+print_constant_terse (FILE *out, JCF *jcf, int index, int expected)
{
if (! CPOOL_INDEX_IN_RANGE (&jcf->cpool, index))
fprintf (out, "<constant pool index %d not in range>", index);
If verbosity==2, add more descriptive text. */
static void
-DEFUN(print_constant, (out, jcf, index, verbosity),
- FILE *out AND JCF *jcf AND int index AND int verbosity)
+print_constant (FILE *out, JCF *jcf, int index, int verbosity)
{
int j, n;
jlong num;
}
static void
-DEFUN(print_constant_pool, (jcf),
- JCF *jcf)
+print_constant_pool (JCF *jcf)
{
int i;
for (i = 1; i < JPOOL_SIZE(jcf); i++)
}
static void
-DEFUN(print_signature_type, (stream, ptr, limit),
- FILE* stream AND const unsigned char **ptr AND const unsigned char *limit)
+print_signature_type (FILE* stream, const unsigned char **ptr,
+ const unsigned char *limit)
{
int array_size;
if ((*ptr) >= limit)
}
static void
-DEFUN(print_signature, (stream, jcf, signature_index, int options),
- FILE* stream AND JCF *jcf AND int signature_index AND int options)
+print_signature (FILE* stream, JCF *jcf, int signature_index, int options)
{
if (JPOOL_TAG (jcf, signature_index) != CONSTANT_Utf8)
print_constant_terse (out, jcf, signature_index, CONSTANT_Utf8);
static void
-DEFUN(print_exception_table, (jcf, entries, count),
- JCF *jcf AND const unsigned char *entries AND int count)
+print_exception_table (JCF *jcf, const unsigned char *entries, int count)
{
/* Print exception table. */
int i = count;
#include "jcf-reader.c"
static void
-DEFUN(process_class, (jcf),
- JCF *jcf)
+process_class (JCF *jcf)
{
int code;
if (jcf_parse_preamble (jcf) != 0)
}
int
-DEFUN(main, (argc, argv),
- int argc AND char** argv)
+main (int argc, char** argv)
{
JCF jcf[1];
int argi, opt;
\f
static void
-DEFUN(disassemble_method, (jcf, byte_ops, len),
- JCF* jcf AND const unsigned char *byte_ops AND int len)
+disassemble_method (JCF* jcf, const unsigned char *byte_ops, int len)
{
-#undef AND /* Causes problems with opcodes for iand and land. */
#undef PTR
int PC;
int i;
#endif
int
-DEFUN(jcf_unexpected_eof, (jcf, count),
- JCF *jcf AND int count ATTRIBUTE_UNUSED)
+jcf_unexpected_eof (JCF *jcf, int count ATTRIBUTE_UNUSED)
{
if (jcf->filename)
fprintf (stderr, "Premature end of .class file %s.\n", jcf->filename);
}
void
-DEFUN(jcf_trim_old_input, (jcf),
- JCF *jcf)
+jcf_trim_old_input (JCF *jcf)
{
int count = jcf->read_ptr - jcf->buffer;
if (count > 0)
}
int
-DEFUN(jcf_filbuf_from_stdio, (jcf, count),
- JCF *jcf AND int count)
+jcf_filbuf_from_stdio (JCF *jcf, int count)
{
FILE *file = (FILE*) (jcf->read_state);
if (count > jcf->buffer_end - jcf->read_ptr)
*/
ZipFile *
-DEFUN(opendir_in_zip, (zipfile, is_system),
- const char *zipfile AND int is_system)
+opendir_in_zip (const char *zipfile, int is_system)
{
struct ZipFile* zipf;
char magic [4];
*/
int
-DEFUN(open_in_zip, (jcf, zipfile, zipmember, is_system),
- JCF *jcf AND const char *zipfile AND const char *zipmember
- AND int is_system)
+open_in_zip (JCF *jcf, const char *zipfile, const char *zipmember,
+ int is_system)
{
ZipDirectory *zipd;
int i, len;
/* Read data from zip archive member. */
int
-DEFUN(read_zip_member, (jcf, zipd, zipf),
- JCF *jcf AND ZipDirectory *zipd AND ZipFile *zipf)
+read_zip_member (JCF *jcf, ZipDirectory *zipd, ZipFile *zipf)
{
jcf->filbuf = jcf_unexpected_eof;
jcf->zipd = (void *)zipd;
}
const char *
-DEFUN(open_class, (filename, jcf, fd, dep_name),
- const char *filename AND JCF *jcf AND int fd AND const char *dep_name)
+open_class (const char *filename, JCF *jcf, int fd, const char *dep_name)
{
if (jcf)
{
const char *
-DEFUN(find_classfile, (filename, jcf, dep_name),
- char *filename AND JCF *jcf AND const char *dep_name)
+find_classfile (char *filename, JCF *jcf, const char *dep_name)
{
int fd = open (filename, O_RDONLY | O_BINARY);
if (fd < 0)
dirent **). */
static int
-DEFUN(compare_path, (key, entry),
- const void *key AND const void *entry)
+compare_path (const void *key, const void *entry)
{
return strcmp ((const char *) key,
(*((const struct dirent **) entry))->d_name);
/* Returns nonzero if ENTRY names a .java or .class file. */
static int
-DEFUN(java_or_class_file, (entry),
- const struct dirent *entry)
+java_or_class_file (const struct dirent *entry)
{
const char *base = basename (entry->d_name);
return (fnmatch ("*.java", base, 0) == 0 ||
name. */
static int
-DEFUN(memoized_dirlist_lookup_eq, (entry, key),
- const void *entry AND const void *key)
+memoized_dirlist_lookup_eq (const void *entry, const void *key)
{
return strcmp ((const char *) key,
((const memoized_dirlist_entry *) entry)->dir) == 0;
know that it cannot succeed. FILENAME and BUF are as for stat. */
static int
-DEFUN(caching_stat, (filename, buf),
- char *filename AND struct stat *buf)
+caching_stat (char *filename, struct stat *buf)
{
#if JCF_USE_SCANDIR
char *sep;
stored in TABLE_ENTRY (also a char *). */
static int
-DEFUN(memoized_class_lookup_eq, (table_entry, classname),
- const void *table_entry AND const void *classname)
+memoized_class_lookup_eq (const void *table_entry, const void *classname)
{
return strcmp ((const char *)classname, (const char *)table_entry) == 0;
}
file. */
const char *
-DEFUN(find_class, (classname, classname_length, jcf, source_ok),
- const char *classname AND int classname_length AND JCF *jcf AND int source_ok)
-
+find_class (const char *classname, int classname_length, JCF *jcf,
+ int source_ok)
{
int fd;
int i, k, java = -1, class = -1;
}
void
-DEFUN(jcf_print_char, (stream, ch),
- FILE *stream AND int ch)
+jcf_print_char (FILE *stream, int ch)
{
switch (ch)
{
/* Print UTF8 string at STR of length LENGTH bytes to STREAM. */
void
-DEFUN(jcf_print_utf8, (stream, str, length),
- FILE *stream AND register const unsigned char *str AND int length)
+jcf_print_utf8 (FILE *stream, register const unsigned char *str, int length)
{
const unsigned char * limit = str + length;
while (str < limit)
/* Same as jcf_print_utf8, but print IN_CHAR as OUT_CHAR. */
void
-DEFUN(jcf_print_utf8_replace, (stream, str, length, in_char, out_char),
- FILE *stream AND const unsigned char *str AND int length
- AND int in_char AND int out_char)
+jcf_print_utf8_replace (FILE *stream, const unsigned char *str, int length,
+ int in_char, int out_char)
{
const unsigned char *limit = str + length;
while (str < limit)
any classes, fields, or methods are valid.*/
int
-DEFUN(verify_constant_pool, (jcf),
- JCF *jcf)
+verify_constant_pool (JCF *jcf)
{
int i, n;
for (i = 1; i < JPOOL_SIZE (jcf); i++)
}
void
-DEFUN(format_uint, (buffer, value, base),
- char *buffer AND uint64 value AND int base)
+format_uint (char *buffer, uint64 value, int base)
{
#define WRITE_BUF_SIZE (4 + sizeof(uint64) * 8)
char buf[WRITE_BUF_SIZE];
}
void
-DEFUN(format_int, (buffer, value, base),
- char *buffer AND jlong value AND int base)
+format_int (char *buffer, jlong value, int base)
{
uint64 abs_value;
if (value < 0)
#endif
static int
-DEFUN(get_attribute, (jcf),
- JCF *jcf)
+get_attribute (JCF *jcf)
{
uint16 attribute_name = (JCF_FILL (jcf, 6), JCF_readu2 (jcf));
uint32 attribute_length = JCF_readu4 (jcf);
/* Read and handle the pre-amble. */
static int
-DEFUN(jcf_parse_preamble, (jcf),
- JCF* jcf)
+jcf_parse_preamble (JCF* jcf)
{
uint32 magic = (JCF_FILL (jcf, 8), JCF_readu4 (jcf));
uint16 minor_version ATTRIBUTE_UNUSED = JCF_readu2 (jcf);
Return -2 if a bad cross-reference (index of other constant) was seen.
*/
static int
-DEFUN(jcf_parse_constant_pool, (jcf),
- JCF* jcf)
+jcf_parse_constant_pool (JCF* jcf)
{
int i, n;
JPOOL_SIZE (jcf) = (JCF_FILL (jcf, 2), JCF_readu2 (jcf));
/* Read various class flags and numbers. */
static void
-DEFUN(jcf_parse_class, (jcf),
- JCF* jcf)
+jcf_parse_class (JCF* jcf)
{
int i;
uint16 interfaces_count;
/* Read fields. */
static int
-DEFUN(jcf_parse_fields, (jcf),
- JCF* jcf)
+jcf_parse_fields (JCF* jcf)
{
int i, j;
uint16 fields_count;
/* Read methods. */
static int
-DEFUN(jcf_parse_one_method, (jcf),
- JCF* jcf)
+jcf_parse_one_method (JCF* jcf)
{
int i;
uint16 access_flags = (JCF_FILL (jcf, 8), JCF_readu2 (jcf));
}
static int
-DEFUN(jcf_parse_methods, (jcf),
- JCF* jcf)
+jcf_parse_methods (JCF* jcf)
{
int i;
uint16 methods_count;
/* Read attributes. */
static int
-DEFUN(jcf_parse_final_attributes, (jcf),
- JCF *jcf)
+jcf_parse_final_attributes (JCF *jcf)
{
int i;
uint16 attributes_count = (JCF_FILL (jcf, 2), JCF_readu2 (jcf));
#include "real.h"
#include "java-tree.h"
#include "obstack.h"
-#undef AND
#include "rtl.h"
#include "flags.h"
#include "java-opcodes.h"
#ifndef GCC_JCF_H
#define GCC_JCF_H
#include "javaop.h"
-#ifndef DEFUN
-#if defined (__STDC__)
-#define AND ,
-#define PTR void *
-#define DEFUN(name, arglist, args) name(args)
-#else
-#define PTR char *
-#define AND ;
-#define DEFUN(name, arglist, args) name arglist args;
-#endif
-#endif /* !DEFUN */
-
-#ifndef PARAMS
-#if defined (__STDC__)
-#define PARAMS (paramlist) paramlist
-#else
-#define PARAMS (paramlist) ()
-#endif
-#endif
#ifndef JCF_u4
#define JCF_u4 unsigned long
/* jc1-lite main entry point */
int
-DEFUN (main, (argc, argv),
- int argc AND char **argv)
+main (int argc, char **argv)
{
int i = 1;
const char *output_file = NULL;