* remote-mips.c (mips_request): Use unsigned long during parsing
[deliverable/binutils-gdb.git] / gdb / c-lang.c
index e152aa21d4fcd44f57d213300e0887cd838a9b0b..a104e6129e9538da49f0d268f716ea12f5c2021a 100644 (file)
@@ -1,5 +1,5 @@
 /* C language support routines for GDB, the GNU debugger.
-   Copyright 1992, 1993 Free Software Foundation, Inc.
+   Copyright 1992, 1993, 1994 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -15,7 +15,7 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
 #include "symtab.h"
@@ -25,6 +25,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "language.h"
 #include "c-lang.h"
 
+static void emit_char PARAMS ((int, GDB_FILE *, int));
+
 /* 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. */
@@ -78,7 +80,7 @@ emit_char (c, stream, quoter)
     }
 }
 
-static void
+void
 c_printchar (c, stream)
      int c;
      GDB_FILE *stream;
@@ -93,7 +95,7 @@ c_printchar (c, stream)
    are printed as appropriate.  Print ellipses at the end if we
    had to stop before printing LENGTH characters, or if FORCE_ELLIPSES.  */
 
-static void
+void
 c_printstr (stream, string, length, force_ellipses)
      GDB_FILE *stream;
      char *string;
@@ -116,7 +118,7 @@ c_printstr (stream, string, length, force_ellipses)
 
   if (length == 0)
     {
-      fputs_filtered ("\"\"", gdb_stdout);
+      fputs_filtered ("\"\"", stream);
       return;
     }
 
@@ -211,7 +213,7 @@ c_printstr (stream, string, length, force_ellipses)
    starts taking it's fundamental type information directly from the
    debugging information supplied by the compiler.  fnf@cygnus.com */
 
-static struct type *
+struct type *
 c_create_fundamental_type (objfile, typeid)
      struct objfile *objfile;
      int typeid;
@@ -243,7 +245,7 @@ c_create_fundamental_type (objfile, typeid)
       case FT_SIGNED_CHAR:
        type = init_type (TYPE_CODE_INT,
                          TARGET_CHAR_BIT / TARGET_CHAR_BIT,
-                         TYPE_FLAG_SIGNED, "signed char", objfile);
+                         0, "signed char", objfile);
        break;
       case FT_UNSIGNED_CHAR:
        type = init_type (TYPE_CODE_INT,
@@ -258,7 +260,7 @@ c_create_fundamental_type (objfile, typeid)
       case FT_SIGNED_SHORT:
        type = init_type (TYPE_CODE_INT,
                          TARGET_SHORT_BIT / TARGET_CHAR_BIT,
-                         TYPE_FLAG_SIGNED, "short", objfile);  /* FIXME-fnf */
+                         0, "short", objfile); /* FIXME-fnf */
        break;
       case FT_UNSIGNED_SHORT:
        type = init_type (TYPE_CODE_INT,
@@ -273,7 +275,7 @@ c_create_fundamental_type (objfile, typeid)
       case FT_SIGNED_INTEGER:
        type = init_type (TYPE_CODE_INT,
                          TARGET_INT_BIT / TARGET_CHAR_BIT,
-                         TYPE_FLAG_SIGNED, "int", objfile); /* FIXME -fnf */
+                         0, "int", objfile); /* FIXME -fnf */
        break;
       case FT_UNSIGNED_INTEGER:
        type = init_type (TYPE_CODE_INT,
@@ -288,7 +290,7 @@ c_create_fundamental_type (objfile, typeid)
       case FT_SIGNED_LONG:
        type = init_type (TYPE_CODE_INT,
                          TARGET_LONG_BIT / TARGET_CHAR_BIT,
-                         TYPE_FLAG_SIGNED, "long", objfile); /* FIXME -fnf */
+                         0, "long", objfile); /* FIXME -fnf */
        break;
       case FT_UNSIGNED_LONG:
        type = init_type (TYPE_CODE_INT,
@@ -303,7 +305,7 @@ c_create_fundamental_type (objfile, typeid)
       case FT_SIGNED_LONG_LONG:
        type = init_type (TYPE_CODE_INT,
                          TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
-                         TYPE_FLAG_SIGNED, "signed long long", objfile);
+                         0, "signed long long", objfile);
        break;
       case FT_UNSIGNED_LONG_LONG:
        type = init_type (TYPE_CODE_INT,
@@ -333,7 +335,7 @@ c_create_fundamental_type (objfile, typeid)
 /* Table mapping opcodes into strings for printing operators
    and precedences of the operators.  */
 
-static const struct op_print c_op_print_tab[] =
+const struct op_print c_op_print_tab[] =
   {
     {",",  BINOP_COMMA, PREC_COMMA, 0},
     {"=",  BINOP_ASSIGN, PREC_ASSIGN, 1},
@@ -369,7 +371,7 @@ static const struct op_print c_op_print_tab[] =
     {NULL, 0, 0, 0}
 };
 \f
-struct type ** const (c_builtin_types[]) = 
+struct type ** CONST_PTR (c_builtin_types[]) = 
 {
   &builtin_type_int,
   &builtin_type_long,
@@ -399,19 +401,21 @@ const struct language_defn c_language_defn = {
   type_check_off,
   c_parse,
   c_error,
+  evaluate_subexp_standard,
   c_printchar,                 /* Print a character constant */
   c_printstr,                  /* Function to print string constant */
   c_create_fundamental_type,   /* Create fundamental type in this language */
   c_print_type,                        /* Print a type using appropriate syntax */
   c_val_print,                 /* Print a value using appropriate syntax */
-  &BUILTIN_TYPE_LONGEST,       /* longest signed   integral type */
-  &BUILTIN_TYPE_UNSIGNED_LONGEST,/* longest unsigned integral type */
-  &builtin_type_double,                /* longest floating point type */ /*FIXME*/
+  c_value_print,               /* Print a top-level value */
   {"",     "",    "",  ""},    /* Binary format info */
   {"0%lo",  "0",   "o", ""},   /* Octal format info */
   {"%ld",   "",    "d", ""},   /* Decimal format info */
   {"0x%lx", "0x",  "x", ""},   /* Hex format info */
   c_op_print_tab,              /* expression operators for printing */
+  1,                           /* c-style arrays */
+  0,                           /* String lower bound */
+  &builtin_type_char,          /* Type of string elements */ 
   LANG_MAGIC
 };
 
@@ -423,19 +427,47 @@ const struct language_defn cplus_language_defn = {
   type_check_off,
   c_parse,
   c_error,
+  evaluate_subexp_standard,
   c_printchar,                 /* Print a character constant */
   c_printstr,                  /* Function to print string constant */
   c_create_fundamental_type,   /* Create fundamental type in this language */
   c_print_type,                        /* Print a type using appropriate syntax */
   c_val_print,                 /* Print a value using appropriate syntax */
-  &BUILTIN_TYPE_LONGEST,        /* longest signed   integral type */
-  &BUILTIN_TYPE_UNSIGNED_LONGEST,/* longest unsigned integral type */
-  &builtin_type_double,                /* longest floating point type */ /*FIXME*/
+  c_value_print,               /* Print a top-level value */
   {"",      "",    "",   ""},  /* Binary format info */
   {"0%lo",   "0",   "o",  ""}, /* Octal format info */
   {"%ld",    "",    "d",  ""}, /* Decimal format info */
   {"0x%lx",  "0x",  "x",  ""}, /* Hex format info */
   c_op_print_tab,              /* expression operators for printing */
+  1,                           /* c-style arrays */
+  0,                           /* String lower bound */
+  &builtin_type_char,          /* Type of string elements */ 
+  LANG_MAGIC
+};
+
+const struct language_defn asm_language_defn = {
+  "asm",                       /* Language name */
+  language_asm,
+  c_builtin_types,
+  range_check_off,
+  type_check_off,
+  c_parse,
+  c_error,
+  evaluate_subexp_standard,
+  c_printchar,                 /* Print a character constant */
+  c_printstr,                  /* Function to print string constant */
+  c_create_fundamental_type,   /* Create fundamental type in this language */
+  c_print_type,                        /* Print a type using appropriate syntax */
+  c_val_print,                 /* Print a value using appropriate syntax */
+  c_value_print,               /* Print a top-level value */
+  {"",     "",    "",  ""},    /* Binary format info */
+  {"0%lo",  "0",   "o", ""},   /* Octal format info */
+  {"%ld",   "",    "d", ""},   /* Decimal format info */
+  {"0x%lx", "0x",  "x", ""},   /* Hex format info */
+  c_op_print_tab,              /* expression operators for printing */
+  1,                           /* c-style arrays */
+  0,                           /* String lower bound */
+  &builtin_type_char,          /* Type of string elements */ 
   LANG_MAGIC
 };
 
@@ -444,4 +476,5 @@ _initialize_c_language ()
 {
   add_language (&c_language_defn);
   add_language (&cplus_language_defn);
+  add_language (&asm_language_defn);
 }
This page took 0.027134 seconds and 4 git commands to generate.