This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: Rename ser_unix_* to ser_base_*


This renames the "ser_unix" functions in ser-base.c to use "ser_base",
and also removes the "nop" element in the name.  No other changes.

Pre-approved by Mark, applied.

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

2005-03-25  Mark Mitchell  <mark@codesourcery.com>

	* ser-base.c (ser_unix_write): Rename to ...
	(ser_base_write): ... this.
	(ser_unix_nop_flush_output): Rename to ...
	(ser_base_flush_output): ... this.
	(ser_unix_flush_input): Rename to ...
	(ser_base_flush_input): ... this.
	(ser_unix_nop_send_break): Rename to ...
	(ser_base_send_break): ... this.
	(ser_unix_nop_drain_output): Rename to ...
	(ser_base_drain_output): ... this.
	(ser_unix_nop_raw): Rename to ...
	(ser_base_raw): ... this.
	(ser_unix_nop_get_tty_state): Rename to ...
	(ser_base_set_tty_state): ... this.
	(ser_unix_nop_noflush_set_tty_state): Rename to ...
	(ser_base_noflush_set_tty_state): ... this.
	(ser_unix_nop_print_tty_state): Rename to ...
	(ser_base_print_tty_state): ... this.
	(ser_unix_nop_setbaudrate): Rename to ...
	(ser_base_setbaudrate): ... this.
	(ser_unix_nop_setstopbits): Rename to ...
	(ser_base_setstopbits): ... this.
	(ser_unix_async): Rename to ...
	(ser_base_async): ... this.
	* ser-base.h (ser_unix_write): Rename to ...
	(ser_base_write): ... this.
	(ser_unix_nop_flush_output): Rename to ...
	(ser_base_flush_output): ... this.
	(ser_unix_flush_input): Rename to ...
	(ser_base_flush_input): ... this.
	(ser_unix_nop_send_break): Rename to ...
	(ser_base_send_break): ... this.
	(ser_unix_nop_drain_output): Rename to ...
	(ser_base_drain_output): ... this.
	(ser_unix_nop_raw): Rename to ...
	(ser_base_raw): ... this.
	(ser_unix_nop_get_tty_state): Rename to ...
	(ser_base_set_tty_state): ... this.
	(ser_unix_nop_noflush_set_tty_state): Rename to ...
	(ser_base_noflush_set_tty_state): ... this.
	(ser_unix_nop_print_tty_state): Rename to ...
	(ser_base_print_tty_state): ... this.
	(ser_unix_nop_setbaudrate): Rename to ...
	(ser_base_setbaudrate): ... this.
	(ser_unix_nop_setstopbits): Rename to ...
	(ser_base_setstopbits): ... this.
	(ser_unix_async): Rename to ...
	(ser_base_async): ... this.
	* ser-pipe.c (_initialize_ser_pipe): Update accordingly.
	* ser-tcp.c (_initialize_ser_tcp): Likewise.
	* ser-unix.c (hardwire_flush_input): Likewise.
	(_initializer_ser_hardwire): Likewise.

Index: ser-base.c
===================================================================
RCS file: /cvs/src/src/gdb/ser-base.c,v
retrieving revision 1.1
diff -c -5 -p -r1.1 ser-base.c
*** ser-base.c	25 Mar 2005 19:47:23 -0000	1.1
--- ser-base.c	25 Mar 2005 19:57:54 -0000
*************** push_event (void *context)
*** 173,183 ****
    /* re-schedule */
    reschedule (scb);
  }
  
  int
! ser_unix_write (struct serial *scb, const char *str, int len)
  {
    int cc;
  
    while (len > 0)
      {
--- 173,183 ----
    /* re-schedule */
    reschedule (scb);
  }
  
  int
! ser_base_write (struct serial *scb, const char *str, int len)
  {
    int cc;
  
    while (len > 0)
      {
*************** ser_unix_write (struct serial *scb, cons
*** 190,206 ****
      }
    return 0;
  }
  
  int
! ser_unix_nop_flush_output (struct serial *scb)
  {
    return 0;
  }
  
  int
! ser_unix_flush_input (struct serial *scb)
  {
    if (scb->bufcnt >= 0)
      {
        scb->bufcnt = 0;
        scb->bufp = scb->buf;
--- 190,206 ----
      }
    return 0;
  }
  
  int
! ser_base_flush_output (struct serial *scb)
  {
    return 0;
  }
  
  int
! ser_base_flush_input (struct serial *scb)
  {
    if (scb->bufcnt >= 0)
      {
        scb->bufcnt = 0;
        scb->bufp = scb->buf;
*************** ser_unix_flush_input (struct serial *scb
*** 209,281 ****
    else
      return SERIAL_ERROR;
  }
  
  int
! ser_unix_nop_send_break (struct serial *scb)
  {
    return 0;
  }
  
  int
! ser_unix_nop_drain_output (struct serial *scb)
  {
    return 0;
  }
  
  void
! ser_unix_nop_raw (struct serial *scb)
  {
    return;			/* Always in raw mode */
  }
  
  serial_ttystate
! ser_unix_nop_get_tty_state (struct serial *scb)
  {
    /* allocate a dummy */
    return (serial_ttystate) XMALLOC (int);
  }
  
  int
! ser_unix_nop_set_tty_state (struct serial *scb, serial_ttystate ttystate)
  {
    return 0;
  }
  
  int
! ser_unix_nop_noflush_set_tty_state (struct serial *scb,
! 				    serial_ttystate new_ttystate,
! 				    serial_ttystate old_ttystate)
  {
    return 0;
  }
  
  void
! ser_unix_nop_print_tty_state (struct serial *scb, 
! 			      serial_ttystate ttystate,
! 			      struct ui_file *stream)
  {
    /* Nothing to print.  */
    return;
  }
  
  int
! ser_unix_nop_setbaudrate (struct serial *scb, int rate)
  {
    return 0;			/* Never fails! */
  }
  
  int
! ser_unix_nop_setstopbits (struct serial *scb, int num)
  {
    return 0;			/* Never fails! */
  }
  
  /* Put the SERIAL device into/out-of ASYNC mode.  */
  
  void
! ser_unix_async (struct serial *scb,
  		int async_p)
  {
    if (async_p)
      {
        /* Force a re-schedule. */
--- 209,281 ----
    else
      return SERIAL_ERROR;
  }
  
  int
! ser_base_send_break (struct serial *scb)
  {
    return 0;
  }
  
  int
! ser_base_drain_output (struct serial *scb)
  {
    return 0;
  }
  
  void
! ser_base_raw (struct serial *scb)
  {
    return;			/* Always in raw mode */
  }
  
  serial_ttystate
! ser_base_get_tty_state (struct serial *scb)
  {
    /* allocate a dummy */
    return (serial_ttystate) XMALLOC (int);
  }
  
  int
! ser_base_set_tty_state (struct serial *scb, serial_ttystate ttystate)
  {
    return 0;
  }
  
  int
! ser_base_noflush_set_tty_state (struct serial *scb,
! 				serial_ttystate new_ttystate,
! 				serial_ttystate old_ttystate)
  {
    return 0;
  }
  
  void
! ser_base_print_tty_state (struct serial *scb, 
! 			  serial_ttystate ttystate,
! 			  struct ui_file *stream)
  {
    /* Nothing to print.  */
    return;
  }
  
  int
! ser_base_setbaudrate (struct serial *scb, int rate)
  {
    return 0;			/* Never fails! */
  }
  
  int
! ser_base_setstopbits (struct serial *scb, int num)
  {
    return 0;			/* Never fails! */
  }
  
  /* Put the SERIAL device into/out-of ASYNC mode.  */
  
  void
! ser_base_async (struct serial *scb,
  		int async_p)
  {
    if (async_p)
      {
        /* Force a re-schedule. */
Index: ser-base.h
===================================================================
RCS file: /cvs/src/src/gdb/ser-base.h,v
retrieving revision 1.1
diff -c -5 -p -r1.1 ser-base.h
*** ser-base.h	25 Mar 2005 19:47:23 -0000	1.1
--- ser-base.h	25 Mar 2005 19:57:54 -0000
***************
*** 24,50 ****
  
  struct serial;
  struct ui_file;
  
  extern void reschedule (struct serial *scb);
! extern int ser_unix_nop_flush_output (struct serial *scb);
! extern int ser_unix_flush_input (struct serial *scb);
! extern int ser_unix_nop_send_break (struct serial *scb);
! extern void ser_unix_nop_raw (struct serial *scb);
! extern serial_ttystate ser_unix_nop_get_tty_state (struct serial *scb);
! extern int ser_unix_nop_set_tty_state (struct serial *scb,
! 				       serial_ttystate ttystate);
! extern void ser_unix_nop_print_tty_state (struct serial *scb,
! 					  serial_ttystate ttystate,
! 					  struct ui_file *stream);
! extern int ser_unix_nop_noflush_set_tty_state (struct serial *scb,
! 					       serial_ttystate new_ttystate,
! 					       serial_ttystate old_ttystate);
! extern int ser_unix_nop_setbaudrate (struct serial *scb, int rate);
! extern int ser_unix_nop_setstopbits (struct serial *scb, int rate);
! extern int ser_unix_nop_drain_output (struct serial *scb);
  
! extern int ser_unix_write (struct serial *scb, const char *str, int len);
  
! extern void ser_unix_async (struct serial *scb, int async_p);
  
  #endif
--- 24,50 ----
  
  struct serial;
  struct ui_file;
  
  extern void reschedule (struct serial *scb);
! extern int ser_base_flush_output (struct serial *scb);
! extern int ser_base_flush_input (struct serial *scb);
! extern int ser_base_send_break (struct serial *scb);
! extern void ser_base_raw (struct serial *scb);
! extern serial_ttystate ser_base_get_tty_state (struct serial *scb);
! extern int ser_base_set_tty_state (struct serial *scb,
! 				   serial_ttystate ttystate);
! extern void ser_base_print_tty_state (struct serial *scb,
! 				      serial_ttystate ttystate,
! 				      struct ui_file *stream);
! extern int ser_base_noflush_set_tty_state (struct serial *scb,
! 					   serial_ttystate new_ttystate,
! 					   serial_ttystate old_ttystate);
! extern int ser_base_setbaudrate (struct serial *scb, int rate);
! extern int ser_base_setstopbits (struct serial *scb, int rate);
! extern int ser_base_drain_output (struct serial *scb);
  
! extern int ser_base_write (struct serial *scb, const char *str, int len);
  
! extern void ser_base_async (struct serial *scb, int async_p);
  
  #endif
Index: ser-pipe.c
===================================================================
RCS file: /cvs/src/src/gdb/ser-pipe.c,v
retrieving revision 1.14
diff -c -5 -p -r1.14 ser-pipe.c
*** ser-pipe.c	25 Mar 2005 19:47:23 -0000	1.14
--- ser-pipe.c	25 Mar 2005 19:57:54 -0000
*************** _initialize_ser_pipe (void)
*** 143,162 ****
    ops->name = "pipe";
    ops->next = 0;
    ops->open = pipe_open;
    ops->close = pipe_close;
    ops->readchar = ser_unix_readchar;
!   ops->write = ser_unix_write;
!   ops->flush_output = ser_unix_nop_flush_output;
!   ops->flush_input = ser_unix_flush_input;
!   ops->send_break = ser_unix_nop_send_break;
!   ops->go_raw = ser_unix_nop_raw;
!   ops->get_tty_state = ser_unix_nop_get_tty_state;
!   ops->set_tty_state = ser_unix_nop_set_tty_state;
!   ops->print_tty_state = ser_unix_nop_print_tty_state;
!   ops->noflush_set_tty_state = ser_unix_nop_noflush_set_tty_state;
!   ops->setbaudrate = ser_unix_nop_setbaudrate;
!   ops->setstopbits = ser_unix_nop_setstopbits;
!   ops->drain_output = ser_unix_nop_drain_output;
!   ops->async = ser_unix_async;
    serial_add_interface (ops);
  }
--- 143,162 ----
    ops->name = "pipe";
    ops->next = 0;
    ops->open = pipe_open;
    ops->close = pipe_close;
    ops->readchar = ser_unix_readchar;
!   ops->write = ser_base_write;
!   ops->flush_output = ser_base_flush_output;
!   ops->flush_input = ser_base_flush_input;
!   ops->send_break = ser_base_send_break;
!   ops->go_raw = ser_base_raw;
!   ops->get_tty_state = ser_base_get_tty_state;
!   ops->set_tty_state = ser_base_set_tty_state;
!   ops->print_tty_state = ser_base_print_tty_state;
!   ops->noflush_set_tty_state = ser_base_noflush_set_tty_state;
!   ops->setbaudrate = ser_base_setbaudrate;
!   ops->setstopbits = ser_base_setstopbits;
!   ops->drain_output = ser_base_drain_output;
!   ops->async = ser_base_async;
    serial_add_interface (ops);
  }
Index: ser-tcp.c
===================================================================
RCS file: /cvs/src/src/gdb/ser-tcp.c,v
retrieving revision 1.19
diff -c -5 -p -r1.19 ser-tcp.c
*** ser-tcp.c	25 Mar 2005 19:47:23 -0000	1.19
--- ser-tcp.c	25 Mar 2005 19:57:54 -0000
*************** _initialize_ser_tcp (void)
*** 214,233 ****
    ops->name = "tcp";
    ops->next = 0;
    ops->open = net_open;
    ops->close = net_close;
    ops->readchar = ser_unix_readchar;
!   ops->write = ser_unix_write;
!   ops->flush_output = ser_unix_nop_flush_output;
!   ops->flush_input = ser_unix_flush_input;
!   ops->send_break = ser_unix_nop_send_break;
!   ops->go_raw = ser_unix_nop_raw;
!   ops->get_tty_state = ser_unix_nop_get_tty_state;
!   ops->set_tty_state = ser_unix_nop_set_tty_state;
!   ops->print_tty_state = ser_unix_nop_print_tty_state;
!   ops->noflush_set_tty_state = ser_unix_nop_noflush_set_tty_state;
!   ops->setbaudrate = ser_unix_nop_setbaudrate;
!   ops->setstopbits = ser_unix_nop_setstopbits;
!   ops->drain_output = ser_unix_nop_drain_output;
!   ops->async = ser_unix_async;
    serial_add_interface (ops);
  }
--- 214,233 ----
    ops->name = "tcp";
    ops->next = 0;
    ops->open = net_open;
    ops->close = net_close;
    ops->readchar = ser_unix_readchar;
!   ops->write = ser_base_write;
!   ops->flush_output = ser_base_flush_output;
!   ops->flush_input = ser_base_flush_input;
!   ops->send_break = ser_base_send_break;
!   ops->go_raw = ser_base_raw;
!   ops->get_tty_state = ser_base_get_tty_state;
!   ops->set_tty_state = ser_base_set_tty_state;
!   ops->print_tty_state = ser_base_print_tty_state;
!   ops->noflush_set_tty_state = ser_base_noflush_set_tty_state;
!   ops->setbaudrate = ser_base_setbaudrate;
!   ops->setstopbits = ser_base_setstopbits;
!   ops->drain_output = ser_base_drain_output;
!   ops->async = ser_base_async;
    serial_add_interface (ops);
  }
Index: ser-unix.c
===================================================================
RCS file: /cvs/src/src/gdb/ser-unix.c,v
retrieving revision 1.23
diff -c -5 -p -r1.23 ser-unix.c
*** ser-unix.c	25 Mar 2005 19:47:23 -0000	1.23
--- ser-unix.c	25 Mar 2005 19:57:54 -0000
*************** hardwire_flush_output (struct serial *sc
*** 327,337 ****
  }
  
  static int
  hardwire_flush_input (struct serial *scb)
  {
!   ser_unix_flush_input (scb);
  
  #ifdef HAVE_TERMIOS
    return tcflush (scb->fd, TCIFLUSH);
  #endif
  
--- 327,337 ----
  }
  
  static int
  hardwire_flush_input (struct serial *scb)
  {
!   ser_base_flush_input (scb);
  
  #ifdef HAVE_TERMIOS
    return tcflush (scb->fd, TCIFLUSH);
  #endif
  
*************** _initialize_ser_hardwire (void)
*** 1060,1070 ****
    ops->close = hardwire_close;
    /* FIXME: Don't replace this with the equivalent ser_unix*() until
       the old TERMIOS/SGTTY/... timer code has been flushed. cagney
       1999-09-16. */
    ops->readchar = hardwire_readchar;
!   ops->write = ser_unix_write;
    ops->flush_output = hardwire_flush_output;
    ops->flush_input = hardwire_flush_input;
    ops->send_break = hardwire_send_break;
    ops->go_raw = hardwire_raw;
    ops->get_tty_state = hardwire_get_tty_state;
--- 1060,1070 ----
    ops->close = hardwire_close;
    /* FIXME: Don't replace this with the equivalent ser_unix*() until
       the old TERMIOS/SGTTY/... timer code has been flushed. cagney
       1999-09-16. */
    ops->readchar = hardwire_readchar;
!   ops->write = ser_base_write;
    ops->flush_output = hardwire_flush_output;
    ops->flush_input = hardwire_flush_input;
    ops->send_break = hardwire_send_break;
    ops->go_raw = hardwire_raw;
    ops->get_tty_state = hardwire_get_tty_state;
*************** _initialize_ser_hardwire (void)
*** 1072,1079 ****
    ops->print_tty_state = hardwire_print_tty_state;
    ops->noflush_set_tty_state = hardwire_noflush_set_tty_state;
    ops->setbaudrate = hardwire_setbaudrate;
    ops->setstopbits = hardwire_setstopbits;
    ops->drain_output = hardwire_drain_output;
!   ops->async = ser_unix_async;
    serial_add_interface (ops);
  }
--- 1072,1079 ----
    ops->print_tty_state = hardwire_print_tty_state;
    ops->noflush_set_tty_state = hardwire_noflush_set_tty_state;
    ops->setbaudrate = hardwire_setbaudrate;
    ops->setstopbits = hardwire_setstopbits;
    ops->drain_output = hardwire_drain_output;
!   ops->async = ser_base_async;
    serial_add_interface (ops);
  }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]