Update/correct copyright notices.
[deliverable/binutils-gdb.git] / gdb / ser-mac.c
index df0040edbf20aa23d0f79c61167eba97aa18f87a..ed0b693eb9af4baef1a0581e3ef6dc6079f1b3ab 100644 (file)
@@ -1,5 +1,5 @@
 /* Remote serial interface for local (hardwired) serial ports for Macintosh.
-   Copyright 1994 Free Software Foundation, Inc.
+   Copyright 1994, 1995, 1996, 1998, 2000 Free Software Foundation, Inc.
    Contributed by Cygnus Support.  Written by Stan Shebs.
 
    This file is part of GDB.
@@ -16,7 +16,8 @@
 
    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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
 #include "serial.h"
@@ -34,15 +35,15 @@ struct mac_ttystate
     int bogus;
   };
 
-static int mac_open PARAMS ((serial_t scb, const char *name));
-static void mac_raw PARAMS ((serial_t scb));
-static int mac_readchar PARAMS ((serial_t scb, int timeout));
-static int mac_setbaudrate PARAMS ((serial_t scb, int rate));
-static int mac_write PARAMS ((serial_t scb, const char *str, int len));
-static void mac_close PARAMS ((serial_t scb));
-static serial_ttystate mac_get_tty_state PARAMS ((serial_t scb));
-static int mac_set_tty_state PARAMS ((serial_t scb, serial_ttystate state));
-static char *aptr PARAMS ((short p));
+static int mac_open (serial_t scb, const char *name);
+static void mac_raw (serial_t scb);
+static int mac_readchar (serial_t scb, int timeout);
+static int mac_setbaudrate (serial_t scb, int rate);
+static int mac_write (serial_t scb, const char *str, int len);
+static void mac_close (serial_t scb);
+static serial_ttystate mac_get_tty_state (serial_t scb);
+static int mac_set_tty_state (serial_t scb, serial_ttystate state);
+static char *aptr (short p);
 
 short input_refnum;
 short output_refnum;
@@ -51,9 +52,7 @@ char *mac_input_buffer;
 char *mac_output_buffer;
 
 static int
-mac_open (scb, name)
-     serial_t scb;
-     const char *name;
+mac_open (serial_t scb, const char *name)
 {
   OSErr err;
 
@@ -100,11 +99,11 @@ mac_open (scb, name)
       return (-1);
     }
   /* We got something open. */
-  if (1 /* using custom buffer */)
+  if (1 /* using custom buffer */ )
     SerSetBuf (input_refnum, mac_input_buffer, 4096);
   /* Set to a GDB-preferred state. */
-  SerReset (input_refnum,  stop10|noParity|data8|baud9600);
-  SerReset (output_refnum, stop10|noParity|data8|baud9600);
+  SerReset (input_refnum, stop10 | noParity | data8 | baud9600);
+  SerReset (output_refnum, stop10 | noParity | data8 | baud9600);
   {
     CntrlParam cb;
     struct SerShk *handshake;
@@ -120,7 +119,7 @@ mac_open (scb, name)
     handshake->evts = 0;
     handshake->fInX = 0;
     handshake->fDTR = 0;
-    err = PBControl ((ParmBlkPtr) &cb, 0);
+    err = PBControl ((ParmBlkPtr) & cb, 0);
     if (err < 0)
       return (-1);
   }
@@ -130,15 +129,13 @@ mac_open (scb, name)
 }
 
 static int
-mac_noop (scb)
-     serial_t scb;
+mac_noop (serial_t scb)
 {
   return 0;
 }
 
 static void
-mac_raw (scb)
-     serial_t scb;
+mac_raw (serial_t scb)
 {
   /* Always effectively in raw mode. */
 }
@@ -149,9 +146,7 @@ mac_raw (scb)
    dead, or -3 for any other error (see errno in that case). */
 
 static int
-mac_readchar (scb, timeout)
-     serial_t scb;
-     int timeout;
+mac_readchar (serial_t scb, int timeout)
 {
   int status, n;
   /* time_t */ unsigned long start_time, now;
@@ -168,7 +163,7 @@ mac_readchar (scb, timeout)
     {
       cb.ioCRefNum = input_refnum;
       cb.csCode = 2;
-      err = PBStatus ((ParmBlkPtr) &cb, 0);
+      err = PBStatus ((ParmBlkPtr) & cb, 0);
       if (err < 0)
        return SERIAL_ERROR;
       n = *((long *) &cb.csParam[0]);
@@ -177,7 +172,7 @@ mac_readchar (scb, timeout)
          pb.ioRefNum = input_refnum;
          pb.ioBuffer = (Ptr) (scb->buf);
          pb.ioReqCount = (n > 64 ? 64 : n);
-         err = PBRead ((ParmBlkPtr) &pb, 0);
+         err = PBRead ((ParmBlkPtr) & pb, 0);
          if (err < 0)
            return SERIAL_ERROR;
          scb->bufcnt = pb.ioReqCount;
@@ -203,8 +198,7 @@ mac_readchar (scb, timeout)
    vector.  Someday, they may do something real... */
 
 static serial_ttystate
-mac_get_tty_state (scb)
-     serial_t scb;
+mac_get_tty_state (serial_t scb)
 {
   struct mac_ttystate *state;
 
@@ -214,26 +208,22 @@ mac_get_tty_state (scb)
 }
 
 static int
-mac_set_tty_state (scb, ttystate)
-     serial_t scb;
-     serial_ttystate ttystate;
+mac_set_tty_state (serial_t scb, serial_ttystate ttystate)
 {
   return 0;
 }
 
 static int
-mac_noflush_set_tty_state (scb, new_ttystate, old_ttystate)
-     serial_t scb;
-     serial_ttystate new_ttystate;
-     serial_ttystate old_ttystate;
+mac_noflush_set_tty_state (serial_t scb, serial_ttystate new_ttystate,
+                          serial_ttystate old_ttystate)
 {
   return 0;
 }
 
 static void
-mac_print_tty_state (scb, ttystate)
-     serial_t scb;
-     serial_ttystate ttystate;
+mac_print_tty_state (serial_t scb,
+                    serial_ttystate ttystate,
+                    struct ui_file *stream)
 {
   /* Nothing to print.  */
   return;
@@ -243,29 +233,68 @@ mac_print_tty_state (scb, ttystate)
    to what the serial driver wants, we should use it.  Until
    we get one, this table will have to do.  */
 
-static struct {
+static struct
+{
   int real_rate;
   int bits;
-} mac_baud_rate_table[] = {
-  { 57600, baud57600 },
-  { 38400, 1 },
-  { 19200, baud19200 },
-  { 9600, baud9600 },
-  { 7200, baud7200 },
-  { 4800, baud4800 },
-  { 3600, baud3600 },
-  { 2400, baud2400 },
-  { 1800, baud1800 },
-  { 1200, baud1200 },
-  { 600, baud600 },
-  { 300, baud300 },
-  { 0, 0 }
+}
+mac_baud_rate_table[] =
+{
+  {
+    57600, baud57600
+  }
+  ,
+  {
+    38400, 1
+  }
+  ,
+  {
+    19200, baud19200
+  }
+  ,
+  {
+    9600, baud9600
+  }
+  ,
+  {
+    7200, baud7200
+  }
+  ,
+  {
+    4800, baud4800
+  }
+  ,
+  {
+    3600, baud3600
+  }
+  ,
+  {
+    2400, baud2400
+  }
+  ,
+  {
+    1800, baud1800
+  }
+  ,
+  {
+    1200, baud1200
+  }
+  ,
+  {
+    600, baud600
+  }
+  ,
+  {
+    300, baud300
+  }
+  ,
+  {
+    0, 0
+  }
 };
 
 static int
-mac_set_baud_rate (scb, rate)
-     serial_t scb;
-     int rate;
+mac_set_baud_rate (serial_t scb, int rate)
 {
   int i, bits;
 
@@ -277,14 +306,12 @@ mac_set_baud_rate (scb, rate)
          break;
        }
     }
-  SerReset (input_refnum,  stop10|noParity|data8|bits);
-  SerReset (output_refnum, stop10|noParity|data8|bits);
+  SerReset (input_refnum, stop10 | noParity | data8 | bits);
+  SerReset (output_refnum, stop10 | noParity | data8 | bits);
 }
 
 static int
-mac_set_stop_bits (scb, num)
-     serial_t scb;
-     int num;
+mac_set_stop_bits (serial_t scb, int num)
 {
   return 0;
 }
@@ -292,10 +319,7 @@ mac_set_stop_bits (scb, num)
 int first_mac_write = 0;
 
 static int
-mac_write (scb, str, len)
-     serial_t scb;
-     const char *str;
-     int len;
+mac_write (serial_t scb, const char *str, int len)
 {
   OSErr err;
   IOParam pb;
@@ -307,7 +331,7 @@ mac_write (scb, str, len)
   pb.ioRefNum = output_refnum;
   pb.ioBuffer = (Ptr) str;
   pb.ioReqCount = len;
-  err = PBWrite ((ParmBlkPtr) &pb, 0);
+  err = PBWrite ((ParmBlkPtr) & pb, 0);
   if (err < 0)
     {
       return 1;
@@ -320,14 +344,14 @@ mac_close (serial_t scb)
 {
   if (input_refnum)
     {
-      if (1 /* custom buffer */)
+      if (1 /* custom buffer */ )
        SerSetBuf (input_refnum, mac_input_buffer, 0);
       CloseDriver (input_refnum);
       input_refnum = 0;
     }
   if (output_refnum)
     {
-      if (0 /* custom buffer */)
+      if (0 /* custom buffer */ )
        SerSetBuf (input_refnum, mac_output_buffer, 0);
       CloseDriver (output_refnum);
       output_refnum = 0;
@@ -356,7 +380,7 @@ static struct serial_ops mac_ops =
 };
 
 void
-_initialize_ser_mac ()
+_initialize_ser_mac (void)
 {
   serial_add_interface (&mac_ops);
 }
This page took 0.039681 seconds and 4 git commands to generate.