Add more specific error messages to low-level message allocation code.
authorChris Hanson <org/chris-hanson/cph>
Tue, 7 Feb 1995 23:54:55 +0000 (23:54 +0000)
committerChris Hanson <org/chris-hanson/cph>
Tue, 7 Feb 1995 23:54:55 +0000 (23:54 +0000)
v7/src/microcode/os2msg.c
v7/src/microcode/os2top.c

index 2ddf411cceebdad67ae5c756dd58dd17114ed6cf..a1e809d958d90dfc8c5d0b5250331fb3535e9111 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: os2msg.c,v 1.4 1995/01/05 23:54:48 cph Exp $
+$Id: os2msg.c,v 1.5 1995/02/07 23:54:09 cph Exp $
 
 Copyright (c) 1994-95 Massachusetts Institute of Technology
 
@@ -224,12 +224,41 @@ OS2_initialize_message_lengths (void)
     }
 }
 
+void
+OS2_check_message_length_initializations (void)
+{
+  unsigned int type = 0;
+  while (1)
+    {
+      if ((MESSAGE_LENGTH (type)) == 0)
+       {
+         char buffer [64];
+         sprintf (buffer, "Message type %d not initialized.", type);
+         OS2_logic_error (buffer);
+       }
+      if (type == MSG_TYPE_MAX)
+       break;
+      type += 1;
+    }
+}
+
 msg_length_t
 OS2_message_type_length (msg_type_t type)
 {
-  msg_length_t length = (MESSAGE_LENGTH (type));
+  msg_length_t length;
+  if (type > MSG_TYPE_MAX)
+    {
+      char buffer [64];
+      sprintf (buffer, "Message type %d out of range.", type);
+      OS2_logic_error (buffer);
+    }
+  length = (MESSAGE_LENGTH (type));
   if (length == 0)
-    OS2_logic_error ("Message type has unknown length.");
+    {
+      char buffer [64];
+      sprintf (buffer, "Message type %d has unknown length.", type);
+      OS2_logic_error (buffer);
+    }
   return (length);
 }
 
index 53435214d2fb6c54b539c75187736cd177067c2a..37bf4cd4fbd414c1193bb658b5e34112c4fa3d42 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: os2top.c,v 1.10 1995/01/16 20:56:12 cph Exp $
+$Id: os2top.c,v 1.11 1995/02/07 23:54:55 cph Exp $
 
 Copyright (c) 1994-95 Massachusetts Institute of Technology
 
@@ -51,6 +51,8 @@ extern void OS2_initialize_scheme_thread (void);
 extern void OS2_initialize_tty (void);
 extern void OS2_initialize_window_primitives (void);
 
+extern void OS2_check_message_length_initializations (void);
+
 extern const char * OS_Name;
 extern const char * OS_Variant;
 extern HMTX OS2_create_queue_lock;
@@ -92,6 +94,9 @@ OS_initialize (void)
   OS2_initialize_tty ();
   OS2_initialize_window_primitives ();
   OS2_initialize_processes ();
+  /* This must be after all of initializations that can set message
+     lengths.  */
+  OS2_check_message_length_initializations ();
   OS_Name = "OS/2";
   {
     const char * version = (OS2_version_string ());