* breakpoint.c, breakpoint.h (breakpoint_init_inferior): New function
[deliverable/binutils-gdb.git] / gdb / ch-lang.c
index 6104675a225a219b88c4e074c8f965a5f97c0499..2f7406103d0cca891a53a3140e59ddd3988fa18e 100644 (file)
@@ -25,6 +25,30 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "language.h"
 #include "ch-lang.h"
 
+
+/* For now, Chill uses a simple mangling algorithm whereby you simply
+   discard everything after the occurance of two successive CPLUS_MARKER
+   characters to derive the demangled form. */
+
+char *
+chill_demangle (mangled)
+     const char *mangled;
+{
+  char *joiner;
+  char *demangled;
+
+  joiner = strchr (mangled, CPLUS_MARKER);
+  if (joiner != NULL && *(joiner + 1) == CPLUS_MARKER)
+    {
+      demangled = savestring (mangled, joiner - mangled);
+    }
+  else
+    {
+      demangled = NULL;
+    }
+  return (demangled);
+}
+
 static void
 chill_printchar (c, stream)
      register int c;
@@ -164,7 +188,6 @@ chill_create_fundamental_type (objfile, typeid)
      int typeid;
 {
   register struct type *type = NULL;
-  register int nbytes;
 
   switch (typeid)
     {
@@ -173,16 +196,20 @@ chill_create_fundamental_type (objfile, typeid)
           language, create the equivalent of a C integer type with the
           name "<?type?>".  When all the dust settles from the type
           reconstruction work, this should probably become an error. */
-       type = init_type (TYPE_CODE_INT,
-                         TARGET_INT_BIT / TARGET_CHAR_BIT,
-                         0, "<?type?>", objfile);
+       type = init_type (TYPE_CODE_INT, 2, 0, "<?type?>", objfile);
         warning ("internal error: no chill fundamental type %d", typeid);
        break;
+      case FT_VOID:
+       /* FIXME:  Currently the GNU Chill compiler emits some DWARF entries for
+          typedefs, unrelated to anything directly in the code being compiled,
+          that have some FT_VOID types.  Just fake it for now. */
+       type = init_type (TYPE_CODE_VOID, 0, 0, "<?VOID?>", objfile);
+       break;
       case FT_BOOLEAN:
        type = init_type (TYPE_CODE_BOOL, 1, TYPE_FLAG_UNSIGNED, "BOOL", objfile);
        break;
       case FT_CHAR:
-       type = init_type (TYPE_CODE_INT, 1, TYPE_FLAG_UNSIGNED, "CHAR", objfile);
+       type = init_type (TYPE_CODE_CHAR, 1, TYPE_FLAG_UNSIGNED, "CHAR", objfile);
        break;
       case FT_SIGNED_CHAR:
        type = init_type (TYPE_CODE_INT, 1, TYPE_FLAG_SIGNED, "BYTE", objfile);
@@ -196,10 +223,14 @@ chill_create_fundamental_type (objfile, typeid)
       case FT_UNSIGNED_SHORT:          /* Chill ints are 2 bytes */
        type = init_type (TYPE_CODE_INT, 2, TYPE_FLAG_UNSIGNED, "UINT", objfile);
        break;
-      case FT_INTEGER:                 /* Chill longs are 4 bytes */
+      case FT_INTEGER:                 /* FIXME? */
+      case FT_SIGNED_INTEGER:          /* FIXME? */
+      case FT_LONG:                    /* Chill longs are 4 bytes */
+      case FT_SIGNED_LONG:             /* Chill longs are 4 bytes */
        type = init_type (TYPE_CODE_INT, 4, TYPE_FLAG_SIGNED, "LONG", objfile);
        break;
-      case FT_UNSIGNED_INTEGER:                /* Chill longs are 4 bytes */
+      case FT_UNSIGNED_INTEGER:                /* FIXME? */
+      case FT_UNSIGNED_LONG:           /* Chill longs are 4 bytes */
        type = init_type (TYPE_CODE_INT, 4, TYPE_FLAG_UNSIGNED, "ULONG", objfile);
        break;
       case FT_FLOAT:
@@ -215,11 +246,12 @@ chill_create_fundamental_type (objfile, typeid)
 \f
 /* Table of operators and their precedences for printing expressions.  */
 
-const static struct op_print chill_op_print_tab[] = {
+static const struct op_print chill_op_print_tab[] = {
     {"AND", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0},
     {"OR",  BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0},
     {"NOT", UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
-    {"MOD", BINOP_REM, PREC_MUL, 0},
+    {"MOD", BINOP_MOD, PREC_MUL, 0},
+    {"REM", BINOP_REM, PREC_MUL, 0},
     {":=",  BINOP_ASSIGN, PREC_ASSIGN, 1},
     {"=",   BINOP_EQUAL, PREC_EQUAL, 0},
     {"/=",  BINOP_NOTEQUAL, PREC_EQUAL, 0},
@@ -231,6 +263,7 @@ const static struct op_print chill_op_print_tab[] = {
     {"-",   BINOP_SUB, PREC_ADD, 0},
     {"*",   BINOP_MUL, PREC_MUL, 0},
     {"/",   BINOP_DIV, PREC_MUL, 0},
+    {"//",  BINOP_CONCAT, PREC_PREFIX, 0},     /* FIXME: precedence? */
     {"-",   UNOP_NEG, PREC_PREFIX, 0},
     {NULL,  0, 0, 0}
 };
@@ -265,13 +298,15 @@ const struct language_defn chill_language_defn = {
   chill_printchar,             /* print a character constant */
   chill_printstr,              /* function to print a string constant */
   chill_create_fundamental_type,/* Create fundamental type in this language */
+  chill_print_type,            /* Print a type using appropriate syntax */
+  chill_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_chill_real,    /* longest floating point type */
   {"",      "B'",  "",   ""},  /* Binary format info */
-  {"O'%o",  "O'",  "o",  ""},  /* Octal format info */
-  {"D'%d",  "D'",  "d",  ""},  /* Decimal format info */
-  {"H'%x",  "H'",  "x",  ""},  /* Hex format info */
+  {"O'%lo",  "O'",  "o",  ""}, /* Octal format info */
+  {"D'%ld",  "D'",  "d",  ""}, /* Decimal format info */
+  {"H'%lx",  "H'",  "x",  ""}, /* Hex format info */
   chill_op_print_tab,          /* expression operators for printing */
   LANG_MAGIC
 };
@@ -279,7 +314,7 @@ const struct language_defn chill_language_defn = {
 /* Initialization for Chill */
 
 void
-_initialize_chill_exp ()
+_initialize_chill_language ()
 {
   builtin_type_chill_bool =
     init_type (TYPE_CODE_BOOL, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
This page took 0.024439 seconds and 4 git commands to generate.