Revert previous ser-unix change. Locks up serial device.
[deliverable/binutils-gdb.git] / gdb / language.c
index ebdcefe5628581eb23a68ff8b734d3babda5aa43..fd81f6738c97ad846f489599aac741569882ad0d 100644 (file)
 #include "target.h"
 #include "parser-defs.h"
 
-extern void _initialize_language PARAMS ((void));
+extern void _initialize_language (void);
 
-static void
-show_language_command PARAMS ((char *, int));
+static void show_language_command (char *, int);
 
-static void
-set_language_command PARAMS ((char *, int));
+static void set_language_command (char *, int);
 
-static void
-show_type_command PARAMS ((char *, int));
+static void show_type_command (char *, int);
 
-static void
-set_type_command PARAMS ((char *, int));
+static void set_type_command (char *, int);
 
-static void
-show_range_command PARAMS ((char *, int));
+static void show_range_command (char *, int);
 
-static void
-set_range_command PARAMS ((char *, int));
+static void set_range_command (char *, int);
 
-static void
-set_range_str PARAMS ((void));
+static void set_range_str (void);
 
-static void
-set_type_str PARAMS ((void));
+static void set_type_str (void);
 
-static void
-set_lang_str PARAMS ((void));
+static void set_lang_str (void);
 
-static void
-unk_lang_error PARAMS ((char *));
+static void unk_lang_error (char *);
 
-static int
-unk_lang_parser PARAMS ((void));
+static int unk_lang_parser (void);
 
-static void
-show_check PARAMS ((char *, int));
+static void show_check (char *, int);
 
-static void
-set_check PARAMS ((char *, int));
+static void set_check (char *, int);
 
-static void
-set_type_range PARAMS ((void));
+static void set_type_range (void);
 
 static void unk_lang_emit_char (int c, struct ui_file *stream, int quoter);
 
@@ -94,8 +80,7 @@ static void unk_lang_printstr (struct ui_file * stream, char *string,
                               unsigned int length, int width,
                               int force_ellipses);
 
-static struct type *
-  unk_lang_create_fundamental_type PARAMS ((struct objfile *, int));
+static struct type *unk_lang_create_fundamental_type (struct objfile *, int);
 
 static void unk_lang_print_type (struct type *, char *, struct ui_file *,
                                 int, int);
@@ -394,7 +379,8 @@ set_lang_str ()
 {
   char *prefix = "";
 
-  free (language);
+  if (language)
+    free (language);
   if (language_mode == language_mode_auto)
     prefix = "auto; currently ";
 
@@ -406,7 +392,8 @@ set_type_str ()
 {
   char *tmp = NULL, *prefix = "";
 
-  free (type);
+  if (type)
+    free (type);
   if (type_mode == type_mode_auto)
     prefix = "auto; currently ";
 
@@ -451,7 +438,8 @@ set_range_str ()
       error ("Unrecognized range check setting.");
     }
 
-  free (range);
+  if (range)
+    free (range);
   range = concat (pref, tmp, NULL);
 }
 
@@ -545,6 +533,11 @@ local_hex_format_custom (pre)
   return form;
 }
 
+#if 0
+/* FIXME: cagney/2000-03-04: This function does not appear to be used.
+   It can be deleted once 5.0 has been released. */
+/* FIXME: cagney/2000-03-04: This code assumes that the compiler
+   supports ``long long''. */
 /* Converts a number to hexadecimal (without leading "0x") and stores it in a
    static string.  Returns a pointer to this string. */
 
@@ -562,6 +555,7 @@ longest_raw_hex_string (num)
   sprintf (res_longest_raw_hex_string, "%llx", ll);
   return res_longest_raw_hex_string;
 }
+#endif
 
 /* Converts a number to hexadecimal and stores it in a static
    string.  Returns a pointer to this string. */
@@ -624,9 +618,7 @@ longest_local_hex_string_custom (num, width)
      can use local_hex_string_custom 
    */
   return local_hex_string_custom ((unsigned long) num, width);
-#endif
-
-#if defined (PRINTF_HAS_LONG_LONG)
+#elif defined (PRINTF_HAS_LONG_LONG)
   /* Just use printf.  */
   strcpy (format, local_hex_format_prefix ()); /* 0x */
   strcat (format, "%");
@@ -822,6 +814,7 @@ integral_type (type)
       return (TYPE_CODE (type) != TYPE_CODE_INT) &&
        (TYPE_CODE (type) != TYPE_CODE_ENUM) ? 0 : 1;
     case language_m2:
+    case language_pascal:
       return TYPE_CODE (type) != TYPE_CODE_INT ? 0 : 1;
     case language_chill:
       error ("Missing Chill support in function integral_type.");      /*FIXME */
@@ -857,6 +850,7 @@ character_type (type)
     {
     case language_chill:
     case language_m2:
+    case language_pascal:
       return TYPE_CODE (type) != TYPE_CODE_CHAR ? 0 : 1;
 
     case language_c:
@@ -879,6 +873,7 @@ string_type (type)
     {
     case language_chill:
     case language_m2:
+    case language_pascal:
       return TYPE_CODE (type) != TYPE_CODE_STRING ? 0 : 1;
 
     case language_c:
@@ -943,6 +938,11 @@ structured_type (type)
       return (TYPE_CODE (type) == TYPE_CODE_STRUCT) ||
        (TYPE_CODE (type) == TYPE_CODE_UNION) ||
        (TYPE_CODE (type) == TYPE_CODE_ARRAY);
+   case language_pascal:
+      return (TYPE_CODE(type) == TYPE_CODE_STRUCT) ||
+        (TYPE_CODE(type) == TYPE_CODE_UNION) ||
+        (TYPE_CODE(type) == TYPE_CODE_SET) ||
+           (TYPE_CODE(type) == TYPE_CODE_ARRAY);
     case language_m2:
       return (TYPE_CODE (type) == TYPE_CODE_STRUCT) ||
        (TYPE_CODE (type) == TYPE_CODE_SET) ||
@@ -974,7 +974,11 @@ lang_bool_type ()
        }
       return builtin_type_f_logical_s2;
     case language_cplus:
-      sym = lookup_symbol ("bool", NULL, VAR_NAMESPACE, NULL, NULL);
+    case language_pascal:
+      if (current_language->la_language==language_cplus)
+        {sym = lookup_symbol ("bool", NULL, VAR_NAMESPACE, NULL, NULL);}
+      else
+        {sym = lookup_symbol ("boolean", NULL, VAR_NAMESPACE, NULL, NULL);}
       if (sym)
        {
          type = SYMBOL_TYPE (sym);
@@ -1168,6 +1172,21 @@ binop_type_check (arg1, arg2, op)
            }
 #endif
 
+#ifdef _LANG_pascal
+      case language_pascal:
+        switch(op)
+        {
+        case BINOP_DIV:
+           if (!float_type(t1) && !float_type(t2))
+              type_op_error ("Arguments to %s must be floating point numbers.",op);
+           break;
+        case BINOP_INTDIV:
+           if (!integral_type(t1) || !integral_type(t2))
+              type_op_error ("Arguments to %s must be of integral type.",op);
+           break;
+        }
+#endif
+
 #ifdef _LANG_chill
        case language_chill:
          error ("Missing Chill support in function binop_type_check.");        /*FIXME */
This page took 0.025781 seconds and 4 git commands to generate.