/* Java language support routines for GDB, the GNU debugger.
- Copyright 1997 Free Software Foundation, Inc.
+ Copyright 1997, 1998 Free Software Foundation, Inc.
This file is part of GDB.
#include "c-lang.h"
#include "jv-lang.h"
#include "gdbcore.h"
+#include <ctype.h>
struct type *java_int_type;
struct type *java_byte_type;
struct type *java_double_type;
struct type *java_void_type;
-struct type *java_object_type;
+static void java_emit_char PARAMS ((int c, GDB_FILE *stream, int quoter));
/* This objfile contains symtabs that have been dynamically created
to record dynamically loaded Java classes and dynamically
compiled java methods. */
-struct objfile *dynamics_objfile = NULL;
-struct type *java_link_class_type PARAMS((struct type*, value_ptr));
+static struct objfile *dynamics_objfile = NULL;
-struct objfile *
+static struct type *java_link_class_type PARAMS ((struct type *, value_ptr));
+
+static struct objfile *
get_dynamics_objfile ()
{
if (dynamics_objfile == NULL)
return type;
}
-struct type*
+static struct type *java_object_type;
+
+struct type *
get_java_object_type ()
{
return java_object_type;
struct type *type;
int dims;
{
- if (dims == 0)
- return type;
- error ("array types not implemented");
+ struct type *range_type;
+
+ while (dims-- > 0)
+ {
+ range_type = create_range_type (NULL, builtin_type_int, 0, 0);
+
+ type = create_array_type (NULL, type, range_type);
+ }
+
+ return type;
}
/* Create a Java string in the inferior from a (Utf8) literal. */
string whose delimiter is QUOTER. Note that that format for printing
characters and strings is language specific. */
-void
+static void
java_emit_char (c, stream, quoter)
- register int c;
+ int c;
GDB_FILE *stream;
int quoter;
{
- if (PRINT_LITERAL_FORM (c))
- {
- if (c == '\\' || c == quoter)
- {
- fputs_filtered ("\\", stream);
- }
- fprintf_filtered (stream, "%c", c);
- }
- else
+ switch (c)
{
- switch (c)
- {
- case '\n':
- fputs_filtered ("\\n", stream);
- break;
- case '\b':
- fputs_filtered ("\\b", stream);
- break;
- case '\t':
- fputs_filtered ("\\t", stream);
- break;
- case '\f':
- fputs_filtered ("\\f", stream);
- break;
- case '\r':
- fputs_filtered ("\\r", stream);
- break;
- case '\033':
- fputs_filtered ("\\e", stream);
- break;
- case '\007':
- fputs_filtered ("\\a", stream);
- break;
- default:
- if (c < 256)
- fprintf_filtered (stream, "\\%.3o", (unsigned int) c);
- else
- fprintf_filtered (stream, "\\u%.4x", (unsigned int) c);
- break;
- }
+ case '\\':
+ case '\'':
+ fprintf_filtered (stream, "\\%c", c);
+ break;
+ case '\b':
+ fputs_filtered ("\\b", stream);
+ break;
+ case '\t':
+ fputs_filtered ("\\t", stream);
+ break;
+ case '\n':
+ fputs_filtered ("\\n", stream);
+ break;
+ case '\f':
+ fputs_filtered ("\\f", stream);
+ break;
+ case '\r':
+ fputs_filtered ("\\r", stream);
+ break;
+ default:
+ if (isprint (c))
+ fputc_filtered (c, stream);
+ else
+ fprintf_filtered (stream, "\\u%.4x", (unsigned int) c);
+ break;
}
}
-void
-java_printchar (c, stream)
- int c;
- GDB_FILE *stream;
-{
- fputs_filtered ("'", stream);
- java_emit_char (c, stream, '\'');
- fputs_filtered ("'", stream);
-}
-
static value_ptr
evaluate_subexp_java (expect_type, exp, pos, noside)
struct type *expect_type;
java_parse,
java_error,
evaluate_subexp_java,
- java_printchar, /* Print a character constant */
+ c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
+ java_emit_char, /* Function to print a single character */
java_create_fundamental_type, /* Create fundamental type in this language */
java_print_type, /* Print a type using appropriate syntax */
java_val_print, /* Print a value using appropriate syntax */