/* Fortran language support routines for GDB, the GNU debugger.
- Copyright 1993, 1994 Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1996 Free Software Foundation, Inc.
Contributed by Motorola. Adapted from the C parser by Farooq Butt
(fmbutt@engage.sps.mot.com).
struct type *builtin_type_f_complex_s32;
struct type *builtin_type_f_void;
+/* Following is dubious stuff that had been in the xcoff reader. */
+
+struct saved_fcn
+{
+ long line_offset; /* Line offset for function */
+ struct saved_fcn *next;
+};
+
+
+struct saved_bf_symnum
+{
+ long symnum_fcn; /* Symnum of function (i.e. .function directive) */
+ long symnum_bf; /* Symnum of .bf for this function */
+ struct saved_bf_symnum *next;
+};
+
+typedef struct saved_fcn SAVED_FUNCTION, *SAVED_FUNCTION_PTR;
+typedef struct saved_bf_symnum SAVED_BF, *SAVED_BF_PTR;
+
+/* Local functions */
+
+#if 0
+static void clear_function_list PARAMS ((void));
+static long get_bf_for_fcn PARAMS ((long));
+static void clear_bf_list PARAMS ((void));
+static void patch_all_commons_by_name PARAMS ((char *, CORE_ADDR, int));
+static SAVED_F77_COMMON_PTR find_first_common_named PARAMS ((char *));
+static void add_common_entry PARAMS ((struct symbol *));
+static void add_common_block PARAMS ((char *, CORE_ADDR, int, char *));
+static SAVED_FUNCTION *allocate_saved_function_node PARAMS ((void));
+static SAVED_BF_PTR allocate_saved_bf_node PARAMS ((void));
+static COMMON_ENTRY_PTR allocate_common_entry_node PARAMS ((void));
+static SAVED_F77_COMMON_PTR allocate_saved_f77_common_node PARAMS ((void));
+static void patch_common_entries PARAMS ((SAVED_F77_COMMON_PTR, CORE_ADDR, int));
+#endif
+
+static struct type *f_create_fundamental_type PARAMS ((struct objfile *, int));
+static void f_printstr PARAMS ((GDB_FILE *stream, char *string, unsigned int length, int width, int force_ellipses));
+static void f_printchar PARAMS ((int c, GDB_FILE *stream));
+static void f_emit_char PARAMS ((int c, GDB_FILE *stream, int quoter));
+
/* Print the character C on STREAM as part of the contents of a literal
string whose delimiter is QUOTER. Note that that format for printing
characters and strings is language specific.
be replaced with a true F77 version. */
static void
-emit_char (c, stream, quoter)
+f_emit_char (c, stream, quoter)
register int c;
- FILE *stream;
+ GDB_FILE *stream;
int quoter;
{
c &= 0xFF; /* Avoid sign bit follies */
FILE *stream;
{
fputs_filtered ("'", stream);
- emit_char (c, stream, '\'');
+ LA_EMIT_CHAR (c, stream, '\'');
fputs_filtered ("'", stream);
}
be replaced with a true F77 version. */
static void
-f_printstr (stream, string, length, force_ellipses)
+f_printstr (stream, string, length, width, force_ellipses)
FILE *stream;
char *string;
unsigned int length;
+ int width;
int force_ellipses;
{
register unsigned int i;
fputs_filtered ("'", stream);
in_quotes = 1;
}
- emit_char (string[i], stream, '"');
+ LA_EMIT_CHAR (string[i], stream, '"');
++things_printed;
}
}
{ NULL, 0, 0, 0 }
};
\f
-struct type ** const (f_builtin_types[]) =
+struct type ** CONST_PTR (f_builtin_types[]) =
{
&builtin_type_f_character,
&builtin_type_f_logical,
0
};
-int c_value_print();
+/* This is declared in c-lang.h but it is silly to import that file for what
+ is already just a hack. */
+extern int
+c_value_print PARAMS ((struct value *, GDB_FILE *, int, enum val_prettyprint));
const struct language_defn f_language_defn = {
"fortran",
evaluate_subexp_standard,
f_printchar, /* Print character constant */
f_printstr, /* function to print string constant */
+ f_emit_char, /* Function to print a single character */
f_create_fundamental_type, /* Create fundamental type in this language */
f_print_type, /* Print a type using appropriate syntax */
f_val_print, /* Print a value using appropriate syntax */
add_language (&f_language_defn);
}
-/* Following is dubious stuff that had been in the xcoff reader. */
-
-struct saved_fcn
-{
- long line_offset; /* Line offset for function */
- struct saved_fcn *next;
-};
-
-
-struct saved_bf_symnum
-{
- long symnum_fcn; /* Symnum of function (i.e. .function directive) */
- long symnum_bf; /* Symnum of .bf for this function */
- struct saved_bf_symnum *next;
-};
-
-typedef struct saved_fcn SAVED_FUNCTION, *SAVED_FUNCTION_PTR;
-typedef struct saved_bf_symnum SAVED_BF, *SAVED_BF_PTR;
-
-
-SAVED_BF_PTR allocate_saved_bf_node()
+#if 0
+static SAVED_BF_PTR
+allocate_saved_bf_node()
{
SAVED_BF_PTR new;
return(new);
}
-SAVED_FUNCTION *allocate_saved_function_node()
+static SAVED_FUNCTION *
+allocate_saved_function_node()
{
SAVED_FUNCTION *new;
return(new);
}
-SAVED_F77_COMMON_PTR allocate_saved_f77_common_node()
+static SAVED_F77_COMMON_PTR allocate_saved_f77_common_node()
{
SAVED_F77_COMMON_PTR new;
return(new);
}
-COMMON_ENTRY_PTR allocate_common_entry_node()
+static COMMON_ENTRY_PTR allocate_common_entry_node()
{
COMMON_ENTRY_PTR new;
new = (COMMON_ENTRY_PTR) xmalloc (sizeof (COMMON_ENTRY));
return(new);
}
-
+#endif
SAVED_F77_COMMON_PTR head_common_list=NULL; /* Ptr to 1st saved COMMON */
SAVED_F77_COMMON_PTR tail_common_list=NULL; /* Ptr to last saved COMMON */
SAVED_F77_COMMON_PTR current_common=NULL; /* Ptr to current COMMON */
+#if 0
static SAVED_BF_PTR saved_bf_list=NULL; /* Ptr to (.bf,function)
list*/
static SAVED_BF_PTR saved_bf_list_end=NULL; /* Ptr to above list's end */
static SAVED_BF_PTR tmp_bf_ptr; /* Generic temporary for use
in macros */
-
/* The following function simply enters a given common block onto
the global common block chain */
-void add_common_block(name,offset,secnum,func_stab)
+static void
+add_common_block(name,offset,secnum,func_stab)
char *name;
CORE_ADDR offset;
int secnum;
char *func_stab;
-
{
SAVED_F77_COMMON_PTR tmp;
char *c,*local_copy_func_stab;
tail_common_list->next = tmp;
tail_common_list = tmp;
}
-
}
-
+#endif
/* The following function simply enters a given common entry onto
the "current_common" block that has been saved away. */
-void add_common_entry(entry_sym_ptr)
+#if 0
+static void
+add_common_entry(entry_sym_ptr)
struct symbol *entry_sym_ptr;
{
COMMON_ENTRY_PTR tmp;
current_common->end_of_entries = tmp;
}
}
-
-
}
+#endif
/* This routine finds the first encountred COMMON block named "name" */
-SAVED_F77_COMMON_PTR find_first_common_named(name)
+#if 0
+static SAVED_F77_COMMON_PTR
+find_first_common_named(name)
char *name;
{
}
return(NULL);
}
+#endif
/* This routine finds the first encountred COMMON block named "name"
that belongs to function funcname */
}
-
+#if 0
/* The following function is called to patch up the offsets
for the statics contained in the COMMON block named
"name." */
-
-void patch_common_entries (blk, offset, secnum)
+static void
+patch_common_entries (blk, offset, secnum)
SAVED_F77_COMMON_PTR blk;
CORE_ADDR offset;
int secnum;
blk->secnum = secnum;
}
-
/* Patch all commons named "name" that need patching.Since COMMON
blocks occur with relative infrequency, we simply do a linear scan on
the name. Eventually, the best way to do this will be a
hashed-lookup. Secnum is the section number for the .bss section
(which is where common data lives). */
-
-void patch_all_commons_by_name (name, offset, secnum)
+static void
+patch_all_commons_by_name (name, offset, secnum)
char *name;
CORE_ADDR offset;
int secnum;
tmp = tmp->next;
}
-
}
-
-
-
-
+#endif
/* This macro adds the symbol-number for the start of the function
(the symbol number of the .bf) referenced by symnum_fcn to a
first by a queueing algorithm and upon failure fall back to
a linear scan. */
+#if 0
#define ADD_BF_SYMNUM(bf_sym,fcn_sym) \
\
if (saved_bf_list == NULL) \
saved_bf_list_end->next = tmp_bf_ptr; \
saved_bf_list_end = tmp_bf_ptr; \
}
-
+#endif
/* This function frees the entire (.bf,function) list */
-void
+#if 0
+static void
clear_bf_list()
{
}
saved_bf_list = NULL;
}
+#endif
int global_remote_debug;
-long
+#if 0
+
+static long
get_bf_for_fcn (the_function)
long the_function;
{
}
static SAVED_FUNCTION_PTR saved_function_list=NULL;
-#if 0 /* Currently unused */
static SAVED_FUNCTION_PTR saved_function_list_end=NULL;
-#endif
-void clear_function_list()
+static void
+clear_function_list()
{
SAVED_FUNCTION_PTR tmp = saved_function_list;
SAVED_FUNCTION_PTR next = NULL;
saved_function_list = NULL;
}
+#endif
+