* hash.h: Likewise.
* input-file.c: Likewise.
* input-file.h: Likewise.
* input-scrub.c: Likewise.
* itbl-ops.c: Likewise.
* itbl-ops.h: Likewise.
+2003-11-23 Kazu Hirata <kazu@cs.umass.edu>
+
+ * hash.c: Convert to ISO-C.
+ * hash.h: Likewise.
+ * input-file.c: Likewise.
+ * input-file.h: Likewise.
+ * input-scrub.c: Likewise.
+ * itbl-ops.c: Likewise.
+ * itbl-ops.h: Likewise.
+
2003-11-23 Kazu Hirata <kazu@cs.umass.edu>
* config/tc-h8300.c (Hmode): Make it global.
/* Create a hash table. This return a control block. */
struct hash_control *
-hash_new ()
+hash_new (void)
{
unsigned int size;
struct hash_control *ret;
/* Delete a hash table, freeing all allocated memory. */
void
-hash_die (table)
- struct hash_control *table;
+hash_die (struct hash_control *table)
{
obstack_free (&table->memory, 0);
free (table);
Each time we look up a string, we move it to the start of the list
for its hash code, to take advantage of referential locality. */
-static struct hash_entry *hash_lookup PARAMS ((struct hash_control *,
- const char *,
- struct hash_entry ***,
- unsigned long *));
+static struct hash_entry *hash_lookup (struct hash_control *,
+ const char *,
+ struct hash_entry ***,
+ unsigned long *);
static struct hash_entry *
-hash_lookup (table, key, plist, phash)
- struct hash_control *table;
- const char *key;
- struct hash_entry ***plist;
- unsigned long *phash;
+hash_lookup (struct hash_control *table, const char *key,
+ struct hash_entry ***plist, unsigned long *phash)
{
register unsigned long hash;
unsigned int len;
hash table. */
const char *
-hash_insert (table, key, value)
- struct hash_control *table;
- const char *key;
- PTR value;
+hash_insert (struct hash_control *table, const char *key, PTR value)
{
struct hash_entry *p;
struct hash_entry **list;
error. If an entry already exists, its value is replaced. */
const char *
-hash_jam (table, key, value)
- struct hash_control *table;
- const char *key;
- PTR value;
+hash_jam (struct hash_control *table, const char *key, PTR value)
{
struct hash_entry *p;
struct hash_entry **list;
table, this does nothing and returns NULL. */
PTR
-hash_replace (table, key, value)
- struct hash_control *table;
- const char *key;
- PTR value;
+hash_replace (struct hash_control *table, const char *key, PTR value)
{
struct hash_entry *p;
PTR ret;
if the entry is not found. */
PTR
-hash_find (table, key)
- struct hash_control *table;
- const char *key;
+hash_find (struct hash_control *table, const char *key)
{
struct hash_entry *p;
for that entry, or NULL if there is no such entry. */
PTR
-hash_delete (table, key)
- struct hash_control *table;
- const char *key;
+hash_delete (struct hash_control *table, const char *key)
{
struct hash_entry *p;
struct hash_entry **list;
hash table. */
void
-hash_traverse (table, pfn)
- struct hash_control *table;
- void (*pfn) PARAMS ((const char *key, PTR value));
+hash_traverse (struct hash_control *table,
+ void (*pfn) (const char *key, PTR value))
{
unsigned int i;
name of the hash table, used for printing a header. */
void
-hash_print_statistics (f, name, table)
- FILE *f ATTRIBUTE_UNUSED;
- const char *name ATTRIBUTE_UNUSED;
- struct hash_control *table ATTRIBUTE_UNUSED;
+hash_print_statistics (FILE *f ATTRIBUTE_UNUSED,
+ const char *name ATTRIBUTE_UNUSED,
+ struct hash_control *table ATTRIBUTE_UNUSED)
{
#ifdef HASH_STATISTICS
unsigned int i;
/* Create a hash table. This return a control block. */
-extern struct hash_control *hash_new PARAMS ((void));
+extern struct hash_control *hash_new (void);
/* Delete a hash table, freeing all allocated memory. */
-extern void hash_die PARAMS ((struct hash_control *));
+extern void hash_die (struct hash_control *);
/* Insert an entry into a hash table. This returns NULL on success.
On error, it returns a printable string indicating the error. It
is considered to be an error if the entry already exists in the
hash table. */
-extern const char *hash_insert PARAMS ((struct hash_control *,
- const char *key, PTR value));
+extern const char *hash_insert (struct hash_control *,
+ const char *key, PTR value);
/* Insert or replace an entry in a hash table. This returns NULL on
success. On error, it returns a printable string indicating the
error. If an entry already exists, its value is replaced. */
-extern const char *hash_jam PARAMS ((struct hash_control *,
- const char *key, PTR value));
+extern const char *hash_jam (struct hash_control *,
+ const char *key, PTR value);
/* Replace an existing entry in a hash table. This returns the old
value stored for the entry. If the entry is not found in the hash
table, this does nothing and returns NULL. */
-extern PTR hash_replace PARAMS ((struct hash_control *, const char *key,
- PTR value));
+extern PTR hash_replace (struct hash_control *, const char *key,
+ PTR value);
/* Find an entry in a hash table, returning its value. Returns NULL
if the entry is not found. */
-extern PTR hash_find PARAMS ((struct hash_control *, const char *key));
+extern PTR hash_find (struct hash_control *, const char *key);
/* Delete an entry from a hash table. This returns the value stored
for that entry, or NULL if there is no such entry. */
-extern PTR hash_delete PARAMS ((struct hash_control *, const char *key));
+extern PTR hash_delete (struct hash_control *, const char *key);
/* Traverse a hash table. Call the function on every entry in the
hash table. */
-extern void hash_traverse PARAMS ((struct hash_control *,
- void (*pfn) (const char *key, PTR value)));
+extern void hash_traverse (struct hash_control *,
+ void (*pfn) (const char *key, PTR value));
/* Print hash table statistics on the specified file. NAME is the
name of the hash table, used for printing a header. */
-extern void hash_print_statistics PARAMS ((FILE *, const char *name,
- struct hash_control *));
+extern void hash_print_statistics (FILE *, const char *name,
+ struct hash_control *);
#endif /* HASH_H */
#include "input-file.h"
#include "safe-ctype.h"
-static int input_file_get PARAMS ((char *, int));
+static int input_file_get (char *, int);
/* This variable is non-zero if the file currently being read should be
preprocessed by app. It is zero if the file can be read straight in. */
/* These hooks accommodate most operating systems. */
void
-input_file_begin ()
+input_file_begin (void)
{
f_in = (FILE *) 0;
}
void
-input_file_end ()
+input_file_end (void)
{
}
/* Return BUFFER_SIZE. */
unsigned int
-input_file_buffer_size ()
+input_file_buffer_size (void)
{
return (BUFFER_SIZE);
}
int
-input_file_is_open ()
+input_file_is_open (void)
{
return f_in != (FILE *) 0;
}
can be restored with input_file_pop (). */
char *
-input_file_push ()
+input_file_push (void)
{
register struct saved_file *saved;
}
void
-input_file_pop (arg)
- char *arg;
+input_file_pop (char *arg)
{
register struct saved_file *saved = (struct saved_file *) arg;
}
\f
void
-input_file_open (filename, pre)
- char *filename; /* "" means use stdin. Must not be 0. */
- int pre;
+input_file_open (char *filename, /* "" means use stdin. Must not be 0. */
+ int pre)
{
int c;
char buf[80];
/* Close input file. */
void
-input_file_close ()
+input_file_close (void)
{
/* Don't close a null file pointer. */
if (f_in != NULL)
/* This function is passed to do_scrub_chars. */
static int
-input_file_get (buf, buflen)
- char *buf;
- int buflen;
+input_file_get (char *buf, int buflen)
{
int size;
/* Read a buffer from the input file. */
char *
-input_file_give_next_buffer (where)
- char *where; /* Where to place 1st character of new buffer. */
+input_file_give_next_buffer (char *where /* Where to place 1st character of new buffer. */)
{
char *return_value; /* -> Last char of what we read, + 1. */
register int size;
* about I/O errors. No I/O errors are fatal: an end-of-file may be faked.
*/
-char *input_file_give_next_buffer PARAMS ((char *where));
-char *input_file_push PARAMS ((void));
-unsigned int input_file_buffer_size PARAMS ((void));
-int input_file_is_open PARAMS ((void));
-void input_file_begin PARAMS ((void));
-void input_file_close PARAMS ((void));
-void input_file_end PARAMS ((void));
-void input_file_open PARAMS ((char *filename, int pre));
-void input_file_pop PARAMS ((char *arg));
+char *input_file_give_next_buffer (char *where);
+char *input_file_push (void);
+unsigned int input_file_buffer_size (void);
+int input_file_is_open (void);
+void input_file_begin (void);
+void input_file_close (void);
+void input_file_end (void);
+void input_file_open (char *filename, int pre);
+void input_file_pop (char *arg);
char * saved_position; /* Caller's saved position in buf. */
};
-static struct input_save *input_scrub_push PARAMS ((char *saved_position));
-static char *input_scrub_pop PARAMS ((struct input_save *arg));
-static void as_1_char PARAMS ((unsigned int c, FILE * stream));
+static struct input_save *input_scrub_push (char *saved_position);
+static char *input_scrub_pop (struct input_save *arg);
+static void as_1_char (unsigned int c, FILE * stream);
/* Saved information about the file that .include'd this one. When we hit EOF,
we automatically pop to that file. */
area, which can be restored by passing it to input_scrub_pop(). */
static struct input_save *
-input_scrub_push (saved_position)
- char *saved_position;
+input_scrub_push (char *saved_position)
{
register struct input_save *saved;
}
static char *
-input_scrub_pop (saved)
- struct input_save *saved;
+input_scrub_pop (struct input_save *saved)
{
char *saved_position;
}
\f
void
-input_scrub_begin ()
+input_scrub_begin (void)
{
know (strlen (BEFORE_STRING) == BEFORE_SIZE);
know (strlen (AFTER_STRING) == AFTER_SIZE
}
void
-input_scrub_end ()
+input_scrub_end (void)
{
if (buffer_start)
{
Return start of caller's part of buffer. */
char *
-input_scrub_new_file (filename)
- char *filename;
+input_scrub_new_file (char *filename)
{
input_file_open (filename, !flag_no_comments);
physical_input_file = filename[0] ? filename : _("{standard input}");
input_scrub_new_file. */
char *
-input_scrub_include_file (filename, position)
- char *filename;
- char *position;
+input_scrub_include_file (char *filename, char *position)
{
next_saved_file = input_scrub_push (position);
return input_scrub_new_file (filename);
expanding a macro. */
void
-input_scrub_include_sb (from, position, is_expansion)
- sb *from;
- char *position;
- int is_expansion;
+input_scrub_include_sb (sb *from, char *position, int is_expansion)
{
if (macro_nest > max_macro_nest)
as_fatal (_("macros nested too deeply"));
}
void
-input_scrub_close ()
+input_scrub_close (void)
{
input_file_close ();
}
char *
-input_scrub_next_buffer (bufp)
- char **bufp;
+input_scrub_next_buffer (char **bufp)
{
register char *limit; /*->just after last char of buffer. */
messages and so on. Return TRUE if we opened any file. */
int
-seen_at_least_1_file ()
+seen_at_least_1_file (void)
{
return (physical_input_file != NULL);
}
void
-bump_line_counters ()
+bump_line_counters (void)
{
if (sb_index < 0)
{
Returns nonzero if the filename actually changes. */
int
-new_logical_line (fname, line_number)
- char *fname; /* DON'T destroy it! We point to it! */
- int line_number;
+new_logical_line (char *fname, /* DON'T destroy it! We point to it! */
+ int line_number)
{
if (line_number >= 0)
logical_input_line = line_number;
up declarations like that, and it's easier to avoid it. */
void
-as_where (namep, linep)
- char **namep;
- unsigned int *linep;
+as_where (char **namep, unsigned int *linep)
{
if (logical_input_file != NULL
&& (linep == NULL || logical_input_line >= 0))
No free '\n' at end of line. */
void
-as_howmuch (stream)
- FILE *stream; /* Opened for write please. */
+as_howmuch (FILE *stream /* Opened for write please. */)
{
register char *p; /* Scan input line. */
}
static void
-as_1_char (c, stream)
- unsigned int c;
- FILE *stream;
+as_1_char (unsigned int c, FILE *stream)
{
if (c > 127)
{
};
/* local prototypes */
-static unsigned long build_opcode PARAMS ((struct itbl_entry *e));
-static e_type get_type PARAMS ((int yytype));
-static e_processor get_processor PARAMS ((int yyproc));
-static struct itbl_entry **get_entries PARAMS ((e_processor processor,
- e_type type));
-static struct itbl_entry *find_entry_byname PARAMS ((e_processor processor,
- e_type type, char *name));
-static struct itbl_entry *find_entry_byval PARAMS ((e_processor processor,
- e_type type, unsigned long val, struct itbl_range *r));
-static struct itbl_entry *alloc_entry PARAMS ((e_processor processor,
- e_type type, char *name, unsigned long value));
-static unsigned long apply_range PARAMS ((unsigned long value,
- struct itbl_range r));
-static unsigned long extract_range PARAMS ((unsigned long value,
- struct itbl_range r));
-static struct itbl_field *alloc_field PARAMS ((e_type type, int sbit,
- int ebit, unsigned long flags));
+static unsigned long build_opcode (struct itbl_entry *e);
+static e_type get_type (int yytype);
+static e_processor get_processor (int yyproc);
+static struct itbl_entry **get_entries (e_processor processor,
+ e_type type);
+static struct itbl_entry *find_entry_byname (e_processor processor,
+ e_type type, char *name);
+static struct itbl_entry *find_entry_byval (e_processor processor,
+ e_type type, unsigned long val, struct itbl_range *r);
+static struct itbl_entry *alloc_entry (e_processor processor,
+ e_type type, char *name, unsigned long value);
+static unsigned long apply_range (unsigned long value, struct itbl_range r);
+static unsigned long extract_range (unsigned long value, struct itbl_range r);
+static struct itbl_field *alloc_field (e_type type, int sbit,
+ int ebit, unsigned long flags);
/*======================================================================*/
/* Interfaces to the parser */
/* These routines are visible to the main part of the assembler */
-int itbl_parse PARAMS ((char *insntbl));
-void itbl_init PARAMS ((void));
-char *itbl_get_field PARAMS ((char **s));
-unsigned long itbl_assemble PARAMS ((char *name, char *operands));
-int itbl_disassemble PARAMS ((char *str, unsigned long insn));
-int itbl_parse PARAMS ((char *tbl)); /* parses insn tbl */
-int itbl_get_reg_val PARAMS ((char *name, unsigned long *pval));
-int itbl_get_val PARAMS ((e_processor processor, e_type type, char *name,
- unsigned long *pval));
-char *itbl_get_name PARAMS ((e_processor processor, e_type type,
- unsigned long val));
+int itbl_parse (char *insntbl);
+void itbl_init (void);
+char *itbl_get_field (char **s);
+unsigned long itbl_assemble (char *name, char *operands);
+int itbl_disassemble (char *str, unsigned long insn);
+int itbl_parse (char *tbl); /* parses insn tbl */
+int itbl_get_reg_val (char *name, unsigned long *pval);
+int itbl_get_val (e_processor processor, e_type type, char *name,
+ unsigned long *pval);
+char *itbl_get_name (e_processor processor, e_type type, unsigned long val);
/* These routines are called by the table parser used to build the
dynamic list of new processor instructions and registers. */
-struct itbl_entry *itbl_add_reg PARAMS ((int yyproc, int yytype,
- char *regname, int regnum));
-struct itbl_entry *itbl_add_insn PARAMS ((int yyproc, char *name,
- unsigned long value, int sbit, int ebit, unsigned long flags));
-struct itbl_field *itbl_add_operand PARAMS ((struct itbl_entry * e, int yytype,
- int sbit, int ebit, unsigned long flags));
+struct itbl_entry *itbl_add_reg (int yyproc, int yytype,
+ char *regname, int regnum);
+struct itbl_entry *itbl_add_insn (int yyproc, char *name,
+ unsigned long value, int sbit, int ebit, unsigned long flags);
+struct itbl_field *itbl_add_operand (struct itbl_entry * e, int yytype,
+ int sbit, int ebit, unsigned long flags);