Replacing a bogus file with a semi-bogus one (sharing through devo).
[deliverable/binutils-gdb.git] / gdb / jv-lang.c
index d7b0070319f573578885160adef453b94ea7f6ac..c8524462c2e5fb43515b76953030a69f47bcfa36 100644 (file)
@@ -1,5 +1,5 @@
 /* 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.
 
@@ -32,6 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "c-lang.h"
 #include "jv-lang.h"
 #include "gdbcore.h"
+#include <ctype.h>
 
 struct type *java_int_type;
 struct type *java_byte_type;
@@ -43,16 +44,17 @@ struct type *java_float_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)
@@ -559,7 +561,9 @@ java_link_class_type (type, clas)
   return type;
 }
 
-struct type*
+static struct type *java_object_type;
+
+struct type *
 get_java_object_type ()
 {
   return java_object_type;
@@ -707,65 +711,42 @@ java_value_string (ptr, len)
    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))
+  switch (c)
     {
-      if (c == '\\' || c == quoter)
-       {
-         fputs_filtered ("\\", stream);
-       }
-      fprintf_filtered (stream, "%c", c);
-    }
-  else
-    {
-      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;
@@ -950,8 +931,9 @@ const struct language_defn java_language_defn = {
   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 */
This page took 0.025048 seconds and 4 git commands to generate.