Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA]: Fix utils.c and printcmd.c for tui
@ 2001-07-18 15:04 Stephane Carrez
  2001-07-19  9:22 ` Andrew Cagney
  0 siblings, 1 reply; 2+ messages in thread
From: Stephane Carrez @ 2001-07-18 15:04 UTC (permalink / raw)
  To: gdb-patches

Hi!

The following patch simplifies the tui portions in utils.c and printcmd.c
by calling simple tui functions rather than having some tui specific code.
I've not found a better solution (yet) to solve these tui dependencies in
gdb common code.

Can you approve this patch?

	Stephane

gdb/ChangeLog
2001-07-18  Stephane Carrez  <Stephane.Carrez@worldnet.fr>

	* utils.c (init_page_info): Use tui_get_command_dimension.
	* printcmd.c (disassemble_command): Simplify tui specific code,
	use tui_is_window_visible, tui_show_assembly.

gdb/tui/ChangeLog
2001-07-18  Stephane Carrez  <Stephane.Carrez@worldnet.fr>

	* tui.h (tui_show_assembly): Declare.
	(tui_is_window_visible): Declare.
	* tui.c (tui_show_assembly): New function.
	(tui_is_window_visible): New function.
	(tui_get_command_dimension): New function.
Index: utils.c
===================================================================
RCS file: /cvs/src/src/gdb/utils.c,v
retrieving revision 1.45
diff -u -i -r1.45 utils.c
--- utils.c	2001/07/15 20:34:14	1.45
+++ utils.c	2001/07/18 21:02:52
@@ -1500,12 +1500,7 @@
 init_page_info (void)
 {
 #if defined(TUI)
-  if (tui_version && m_winPtrNotNull (cmdWin))
-    {
-      lines_per_page = cmdWin->generic.height;
-      chars_per_line = cmdWin->generic.width;
-    }
-  else
+  if (!tui_get_command_dimension (&chars_per_line, &lines_per_page))
 #endif
     {
       /* These defaults will be used if we are unable to get the correct
Index: printcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/printcmd.c,v
retrieving revision 1.23
diff -u -i -r1.23 printcmd.c
--- printcmd.c	2001/07/10 21:24:48	1.23
+++ printcmd.c	2001/07/18 21:03:01
@@ -1396,8 +1396,7 @@
 
 #if defined(TUI)
   if (tui_version && *exp == '$')
-    display_it = ((TuiStatus) tuiDo (
-		  (TuiOpaqueFuncPtr) tui_vSetLayoutTo, exp) == TUI_FAILURE);
+    display_it = (tui_set_layout (exp) == TUI_FAILURE);
 #endif
 
   if (display_it)
@@ -2335,9 +2334,7 @@
 	error ("No function contains program counter for selected frame.\n");
 #if defined(TUI)
       else if (tui_version)
-	low = (CORE_ADDR) tuiDo ((TuiOpaqueFuncPtr) tui_vGetLowDisassemblyAddress,
-				 (Opaque) low,
-				 (Opaque) pc);
+	low = tuiGetLowDisassemblyAddress (low, pc);
 #endif
       low += FUNCTION_START_OFFSET;
     }
@@ -2349,9 +2346,7 @@
 	error ("No function contains specified address.\n");
 #if defined(TUI)
       else if (tui_version)
-	low = (CORE_ADDR) tuiDo ((TuiOpaqueFuncPtr) tui_vGetLowDisassemblyAddress,
-				 (Opaque) low,
-				 (Opaque) pc);
+	low = tuiGetLowDisassemblyAddress (low, pc);
 #endif
 #if 0
       if (overlay_debugging)
@@ -2378,8 +2373,7 @@
     }
 
 #if defined(TUI)
-  if (!tui_version ||
-      m_winPtrIsNull (disassemWin) || !disassemWin->generic.isVisible)
+  if (!tui_is_window_visible (DISASSEM_WIN))
 #endif
     {
       printf_filtered ("Dump of assembler code ");
@@ -2427,8 +2421,7 @@
 #if defined(TUI)
   else
     {
-      tuiDo ((TuiOpaqueFuncPtr) tui_vAddWinToLayout, DISASSEM_WIN);
-      tuiDo ((TuiOpaqueFuncPtr) tui_vUpdateSourceWindowsWithAddr, low);
+      tui_show_assembly (low);
     }
 #endif
 }
From Stephane.Carrez@worldnet.fr Wed Jul 18 15:05:00 2001
From: Stephane Carrez <Stephane.Carrez@worldnet.fr>
To: gdb-patches@sources.redhat.com
Subject: [PATCH]: Cleanup tui to remove tuiDo/tui_vDo
Date: Wed, 18 Jul 2001 15:05:00 -0000
Message-id: <3B56092C.7541C9@worldnet.fr>
X-SW-Source: 2001-07/msg00464.html
Content-length: 22054

Hi!

The transition problem that existed in the past is managed in a different way.
This made the use of the tuiDo() and tui_vDo() operations obsolete.

I've committed the patch below to remove the calls to tuiDo() /tui_vDo()
and also vcatch_errors().

	Stephane

2001-07-18  Stephane Carrez  <Stephane.Carrez@worldnet.fr>

	* tuiIO.c (_tuiHandleResizeDuringIO): Call tuiRefreshAll.
	(tuiRead, tui_vread): Remove.
	
	* tui.c (va_catch_errors, tuiDo, tuiDoAndReturnToTop): Remove.
	(vcatch_errors, _tui_vDo): Remove.
	* tui.h (tuiDo, tuiDoAndReturnToTop): Remove.

	* tuiLayout.c (tuiSetLayout): Remove vcatch_errors.
	(tui_set_layout): Rename of _tuiSetLayoutTo, public.
	(_tuiToggleLayout_command): Merge with _tui_vToggleLayout_command.
	(_tuiToggleSplitLayout_command): Merge with _tui_vToggleSplitLayout_command.
	(_tuiLayout_command): Call tui_set_layout.

	* tuiRegs.c (_tuiScrollRegsBackward_command): Call tui_scroll.
	(_tuiScrollRegsForward_command): Likewise.
	(_tuiShowFloat_command): Call _tui_vShowRegisters_commandSupport.
	(_tuiShowGeneral_command): Likewise.
	(_tuiShowSpecial_command): Likewise.
	(_tuiToggleFloatRegs_command): Call tuiToggleFloatRegs.
	* tuiWin.c (tui_scroll): Rename of tui_vScroll, update parameters.
	(_tuiScrollForward_command): Call tui_scroll.
	(_tuiScrollBackward_command): Likewise.
	(_tuiScrollLeft_command): Likewise.
	(_tuiScrollRight_command): Likewise.
	(_tuiSetFocus_command): Call _tuiSetFocus.
	(_tuiRefreshAll_command): Call tuiRefreshAll.
	(_tuiSetWinHeight_command): Call _tuiSetWinHeight.
	(_tuiXDBsetWinHeight_command): Call _tuiXDBsetWinHeight.
	* tuiWin.h (tui_scroll): Rename of tui_vScroll, update parameters.
Index: tui.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tui.c,v
retrieving revision 1.8
diff -u -p -r1.8 tui.c
--- tui.c	2001/07/17 21:37:18	1.8
+++ tui.c	2001/07/18 21:59:47
@@ -63,7 +63,6 @@ extern char *tgoto ();
 static void _tuiReset (void);
 static void _toggle_command (char *, int);
 static void _tui_vToggle_command (va_list);
-static Opaque _tui_vDo (TuiOpaqueFuncPtr, va_list);
 
 
 
@@ -277,92 +276,6 @@ tui_vGetLowDisassemblyAddress (va_list a
 }				/* tui_vGetLowDisassemblyAddress */
 
 
-/*
-   ** tuiDo().
-   **        General purpose function to execute a tui function.  Transitions
-   **        between curses and the are handled here.  This function is called
-   **        by non-tui gdb functions.
-   **
-   **        Errors are caught here.
-   **        If there is no error, the value returned by 'func' is returned.
-   **        If there is an error, then zero is returned.
-   **
-   **       Must not be called with immediate_quit in effect (bad things might
-   **       happen, say we got a signal in the middle of a memcpy to quit_return).
-   **       This is an OK restriction; with very few exceptions immediate_quit can
-   **       be replaced by judicious use of QUIT.
- */
-Opaque
-tuiDo (TuiOpaqueFuncPtr func, ...)
-{
-  extern int terminal_is_ours;
-
-  Opaque ret = (Opaque) NULL;
-
-  /* It is an error to be tuiDo'ing if we
-     * don't own the terminal.
-   */
-  if (!terminal_is_ours)
-    return ret;
-
-  if (tui_version)
-    {
-      va_list args;
-
-      va_start (args, func);
-      ret = _tui_vDo (func, args);
-      va_end (args);
-    }
-
-  return ret;
-}				/* tuiDo */
-
-
-/*
-   ** tuiDoAndReturnToTop().
-   **        General purpose function to execute a tui function.  Transitions
-   **        between curses and the are handled here.  This function is called
-   **        by non-tui gdb functions who wish to reset gdb to the top level.
-   **        After the tuiDo is performed, a return to the top level occurs.
-   **
-   **        Errors are caught here.
-   **        If there is no error, the value returned by 'func' is returned.
-   **        If there is an error, then zero is returned.
-   **
-   **       Must not be called with immediate_quit in effect (bad things might
-   **       happen, say we got a signal in the middle of a memcpy to quit_return).
-   **       This is an OK restriction; with very few exceptions immediate_quit can
-   **       be replaced by judicious use of QUIT.
-   **
- */
-Opaque
-tuiDoAndReturnToTop (TuiOpaqueFuncPtr func, ...)
-{
-  extern int terminal_is_ours;
-
-  Opaque ret = (Opaque) NULL;
-
-  /* It is an error to be tuiDo'ing if we
-     * don't own the terminal.
-   */
-  if (!terminal_is_ours)
-    return ret;
-
-  if (tui_version)
-    {
-      va_list args;
-
-      va_start (args, func);
-      ret = _tui_vDo (func, args);
-
-      /* force a return to the top level */
-      return_to_top_level (RETURN_ERROR);
-    }
-
-  return ret;
-}				/* tuiDoAndReturnToTop */
-
-
 void
 tui_vSelectSourceSymtab (va_list args)
 {
@@ -407,84 +320,6 @@ Usage:\ttoggle $fregs\n\ttoggle breakpoi
 }				/* _initialize_tui */
 
 
-/*
-   ** va_catch_errors().
-   **       General purpose function to execute a function, catching errors.
-   **       If there is no error, the value returned by 'func' is returned.
-   **       If there is error, then zero is returned.
-   **       Note that 'func' must take a variable argument list as well.
-   **
-   **       Must not be called with immediate_quit in effect (bad things might
-   **       happen, say we got a signal in the middle of a memcpy to quit_return).
-   **       This is an OK restriction; with very few exceptions immediate_quit can
-   **       be replaced by judicious use of QUIT.
- */
-Opaque
-va_catch_errors (TuiOpaqueFuncPtr func, va_list args)
-{
-  Opaque ret = (Opaque) NULL;
-
-  /*
-     ** We could have used catch_errors(), but it doesn't handle variable args.
-     ** Also, for the tui, we always want to catch all errors, so we don't
-     ** need to pass a mask, or an error string.
-   */
-  jmp_buf saved_error;
-  jmp_buf saved_quit;
-  jmp_buf tmp_jmp;
-  struct cleanup *saved_cleanup_chain;
-  char *saved_error_pre_print;
-  char *saved_quit_pre_print;
-  extern jmp_buf error_return;
-  extern jmp_buf quit_return;
-
-  saved_cleanup_chain = save_cleanups ();
-  saved_error_pre_print = error_pre_print;
-  saved_quit_pre_print = quit_pre_print;
-
-  memcpy ((char *) saved_error, (char *) error_return, sizeof (jmp_buf));
-  error_pre_print = "";
-  memcpy (saved_quit, quit_return, sizeof (jmp_buf));
-  quit_pre_print = "";
-
-  if (setjmp (tmp_jmp) == 0)
-    {
-      va_list argList = args;
-      memcpy (error_return, tmp_jmp, sizeof (jmp_buf));
-      memcpy (quit_return, tmp_jmp, sizeof (jmp_buf));
-      ret = func (argList);
-    }
-  restore_cleanups (saved_cleanup_chain);
-  memcpy (error_return, saved_error, sizeof (jmp_buf));
-  error_pre_print = saved_error_pre_print;
-  memcpy (quit_return, saved_quit, sizeof (jmp_buf));
-  quit_pre_print = saved_quit_pre_print;
-
-  return ret;
-}
-
-/*
-   ** vcatch_errors().
-   **        Catch errors occurring in tui or non tui function, handling
-   **        variable param lists. Note that 'func' must take a variable
-   **        argument list as well.
- */
-Opaque
-vcatch_errors (OpaqueFuncPtr func, ...)
-{
-  Opaque ret = (Opaque) NULL;
-  va_list args;
-  va_start (args, func);
-/*
-   va_arg(args, OpaqueFuncPtr);
- */
-  ret = va_catch_errors (func, args);
-  va_end (args);
-
-  return ret;
-}
-
-
 void
 strcat_to_buf (char *buf, int buflen, char *itemToAdd)
 {
@@ -522,51 +357,6 @@ strcat_to_buf_with_fmt (char *buf, int b
 ** Static Functions
 ************************/
 
-
-/*
-   ** _tui_vDo().
-   **        General purpose function to execute a tui function.  Transitions
-   **        between curses and the are handled here.  This function is called
-   **        by non-tui gdb functions.
-   **
-   **        Errors are caught here.
-   **        If there is no error, the value returned by 'func' is returned.
-   **        If there is an error, then zero is returned.
-   **
-   **       Must not be called with immediate_quit in effect (bad things might
-   **       happen, say we got a signal in the middle of a memcpy to quit_return).
-   **       This is an OK restriction; with very few exceptions immediate_quit can
-   **       be replaced by judicious use of QUIT.
- */
-static Opaque
-_tui_vDo (TuiOpaqueFuncPtr func, va_list args)
-{
-  extern int terminal_is_ours;
-
-  Opaque ret = (Opaque) NULL;
-
-  /* It is an error to be tuiDo'ing if we
-     * don't own the terminal.
-   */
-  if (!terminal_is_ours)
-    return ret;
-
-  if (tui_version)
-    {
-      /* If doing command window the "XDB way" (command window
-         * is unmanaged by curses...
-       */
-      /* Set up terminal for TUI */
-      tuiTermSetup (1);
-
-      ret = va_catch_errors (func, args);
-
-      /* Set up terminal for command window */
-      tuiTermUnsetup (1, cmdWin->detail.commandInfo.curch);
-    }
-
-  return ret;
-}				/* _tui_vDo */
 
 
 static void
Index: tui.h
===================================================================
RCS file: /cvs/src/src/gdb/tui/tui.h,v
retrieving revision 1.6
diff -u -p -r1.6 tui.h
--- tui.h	2001/07/16 22:05:02	1.6
+++ tui.h	2001/07/18 21:59:47
@@ -97,8 +97,6 @@ extern void tuiCleanUp (void);
 extern void tuiError (char *, int);
 extern void tui_vError (va_list);
 extern void tuiFree (char *);
-extern Opaque tuiDo (TuiOpaqueFuncPtr, ...);
-extern Opaque tuiDoAndReturnToTop (TuiOpaqueFuncPtr, ...);
 extern Opaque tuiGetLowDisassemblyAddress (Opaque, Opaque);
 extern Opaque tui_vGetLowDisassemblyAddress (va_list);
 extern void tui_vSelectSourceSymtab (va_list);
Index: tuiIO.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tuiIO.c,v
retrieving revision 1.6
diff -u -p -r1.6 tuiIO.c
--- tuiIO.c	2001/07/14 19:31:09	1.6
+++ tuiIO.c	2001/07/18 21:59:48
@@ -277,39 +277,6 @@ tui_vwgetch (va_list args)
 
 
 /*
-   ** tui_vread()
-   **   Wrapper around read() with paramets in a va_list
- */
-unsigned int
-tui_vread (va_list args)
-{
-  int result = 0;
-  int filedes = va_arg (args, int);
-  char *buf = va_arg (args, char *);
-  int nbytes = va_arg (args, int);
-
-  result = read (filedes, buf, nbytes);
-
-  return result;
-}				/* tui_vread() */
-
-/*
-   ** tuiRead()
-   **    Function to perform a read() catching resize events
- */
-int
-tuiRead (int filedes, char *buf, int nbytes)
-{
-  int result = 0;
-
-  result = (int) vcatch_errors ((OpaqueFuncPtr) tui_vread, filedes, buf, nbytes);
-  *buf = _tuiHandleResizeDuringIO (*buf);
-
-  return result;
-}				/* tuiRead */
-
-
-/*
    ** tuiGetc().
    **        Get a character from the command window.
    **           This is called from the readline package,
@@ -464,7 +431,7 @@ _tuiHandleResizeDuringIO (unsigned int o
 {
   if (tuiWinResized ())
     {
-      tuiDo ((TuiOpaqueFuncPtr) tuiRefreshAll);
+      tuiRefreshAll ();
       dont_repeat ();
       tuiSetWinResizedTo (FALSE);
       rl_reset ();
Index: tuiLayout.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tuiLayout.c,v
retrieving revision 1.10
diff -u -p -r1.10 tuiLayout.c
--- tuiLayout.c	2001/07/18 20:59:00	1.10
+++ tuiLayout.c	2001/07/18 21:59:50
@@ -60,7 +60,6 @@ static void _tuiToggleSplitLayout_comman
 static void _tui_vToggleSplitLayout_command (va_list);
 static CORE_ADDR _extractDisplayStartAddr (void);
 static void _tuiHandleXDBLayout (TuiLayoutDefPtr);
-static TuiStatus _tuiSetLayoutTo (char *);
 
 
 /***************************************
@@ -201,8 +200,7 @@ tuiSetLayout (TuiLayoutType layoutType,
 		         ** 2. if target was compiled without -g
 		         ** We still want to show the assembly though!
 		       */
-		      addr = vcatch_errors ((OpaqueFuncPtr)
-					    tuiGetBeginAsmAddress);
+		      addr = tuiGetBeginAsmAddress ();
 		      tuiSetWinFocusTo (disassemWin);
 		      layoutDef->displayMode = DISASSEM_WIN;
 		      layoutDef->split = FALSE;
@@ -215,8 +213,7 @@ tuiSetLayout (TuiLayoutType layoutType,
 		         ** 2. if target was compiled without -g
 		         ** We still want to show the assembly though!
 		       */
-		      addr = vcatch_errors ((OpaqueFuncPtr)
-					    tuiGetBeginAsmAddress);
+		      addr = tuiGetBeginAsmAddress ();
 		      if (winWithFocus == srcWin)
 			tuiSetWinFocusTo (srcWin);
 		      else
@@ -239,8 +236,7 @@ tuiSetLayout (TuiLayoutType layoutType,
 		         ** 2. if target was compiled without -g
 		         ** We still want to show the assembly though!
 		       */
-		      addr = vcatch_errors ((OpaqueFuncPtr)
-					    tuiGetBeginAsmAddress);
+		      addr = tuiGetBeginAsmAddress ();
 		      if (winWithFocus != dataWin)
 			tuiSetWinFocusTo (disassemWin);
 		      else
@@ -478,8 +474,8 @@ Source/Disassembly/Command layouts.\n");
    **    Function to set the layout to SRC, ASM, SPLIT, NEXT, PREV, DATA, REGS,
    **        $REGS, $GREGS, $FREGS, $SREGS.
  */
-static TuiStatus
-_tuiSetLayoutTo (char *layoutName)
+TuiStatus
+tui_set_layout (const char *layoutName)
 {
   TuiStatus status = TUI_SUCCESS;
 
@@ -578,7 +574,7 @@ _tuiSetLayoutTo (char *layoutName)
     status = TUI_FAILURE;
 
   return status;
-}				/* _tuiSetLayoutTo */
+}
 
 
 static CORE_ADDR
@@ -635,12 +631,6 @@ _tuiHandleXDBLayout (TuiLayoutDefPtr lay
 static void
 _tuiToggleLayout_command (char *arg, int fromTTY)
 {
-  tuiDo ((TuiOpaqueFuncPtr) _tui_vToggleLayout_command, arg, fromTTY);
-}
-
-static void
-_tui_vToggleLayout_command (va_list args)
-{
   TuiLayoutDefPtr layoutDef = tuiLayoutDef ();
 
   if (layoutDef->displayMode == SRC_WIN)
@@ -651,37 +641,27 @@ _tui_vToggleLayout_command (va_list args
   if (!layoutDef->split)
     _tuiHandleXDBLayout (layoutDef);
 
-  return;
-}				/* _tuiToggleLayout_command */
+}
 
 
 static void
 _tuiToggleSplitLayout_command (char *arg, int fromTTY)
 {
-  tuiDo ((TuiOpaqueFuncPtr) _tui_vToggleSplitLayout_command, arg, fromTTY);
-}
-
-static void
-_tui_vToggleSplitLayout_command (va_list args)
-{
   TuiLayoutDefPtr layoutDef = tuiLayoutDef ();
 
   layoutDef->split = (!layoutDef->split);
   _tuiHandleXDBLayout (layoutDef);
 
-  return;
-}				/* _tui_vToggleSplitLayout_command */
+}
 
 
 static void
 _tuiLayout_command (char *arg, int fromTTY)
 {
-  if ((TuiStatus) tuiDo (
-		   (TuiOpaqueFuncPtr) tui_vSetLayoutTo, arg) != TUI_SUCCESS)
+  if (tui_set_layout (arg) != TUI_SUCCESS)
     warning ("Invalid layout specified.\n%s", LAYOUT_USAGE);
 
-  return;
-}				/* _tuiLayout_command */
+}
 
 /*
    ** _nextLayout().
Index: tuiRegs.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tuiRegs.c,v
retrieving revision 1.7
diff -u -p -r1.7 tuiRegs.c
--- tuiRegs.c	2001/07/17 06:44:57	1.7
+++ tuiRegs.c	2001/07/18 21:59:54
@@ -30,6 +30,8 @@
 #include "target.h"
 #include "tuiLayout.h"
 #include "tuiWin.h"
+#include "tuiDataWin.h"
+#include "tuiGeneralWin.h"
 #include "tui-file.h"
 
 /*****************************************
@@ -80,11 +82,10 @@ static int _tuiRegValueHasChanged
 static void _tuiShowFloat_command (char *, int);
 static void _tuiShowGeneral_command (char *, int);
 static void _tuiShowSpecial_command (char *, int);
-static void _tui_vShowRegisters_commandSupport (va_list);
+static void _tui_vShowRegisters_commandSupport (TuiRegisterDisplayType);
 static void _tuiToggleFloatRegs_command (char *, int);
 static void _tuiScrollRegsForward_command (char *, int);
 static void _tuiScrollRegsBackward_command (char *, int);
-static void _tui_vShowRegisters_commandSupport (va_list);
 
 
 
@@ -961,9 +962,8 @@ _tuiDisplayRegister (int regNum,
 
 
 static void
-_tui_vShowRegisters_commandSupport (va_list args)
+_tui_vShowRegisters_commandSupport (TuiRegisterDisplayType dpyType)
 {
-  TuiRegisterDisplayType dpyType = va_arg (args, TuiRegisterDisplayType);
 
   if (m_winPtrNotNull (dataWin) && dataWin->generic.isVisible)
     {				/* Data window already displayed, show the registers */
@@ -983,8 +983,7 @@ _tuiShowFloat_command (char *arg, int fr
   if (m_winPtrIsNull (dataWin) || !dataWin->generic.isVisible ||
       (dataWin->detail.dataDisplayInfo.regsDisplayType != TUI_SFLOAT_REGS &&
        dataWin->detail.dataDisplayInfo.regsDisplayType != TUI_DFLOAT_REGS))
-    tuiDo ((TuiOpaqueFuncPtr) _tui_vShowRegisters_commandSupport,
-	   (tuiLayoutDef ())->floatRegsDisplayType);
+    _tui_vShowRegisters_commandSupport ((tuiLayoutDef ())->floatRegsDisplayType);
 
   return;
 }				/* _tuiShowFloat_command */
@@ -993,28 +992,22 @@ _tuiShowFloat_command (char *arg, int fr
 static void
 _tuiShowGeneral_command (char *arg, int fromTTY)
 {
-  tuiDo ((TuiOpaqueFuncPtr) _tui_vShowRegisters_commandSupport,
-	 TUI_GENERAL_REGS);
-
-  return;
-}				/* _tuiShowGeneral_command */
+  _tui_vShowRegisters_commandSupport (TUI_GENERAL_REGS);
+}
 
 
 static void
 _tuiShowSpecial_command (char *arg, int fromTTY)
 {
-  tuiDo ((TuiOpaqueFuncPtr) _tui_vShowRegisters_commandSupport,
-	 TUI_SPECIAL_REGS);
-
-  return;
-}				/* _tuiShowSpecial_command */
+  _tui_vShowRegisters_commandSupport (TUI_SPECIAL_REGS);
+}
 
 
 static void
 _tuiToggleFloatRegs_command (char *arg, int fromTTY)
 {
   if (m_winPtrNotNull (dataWin) && dataWin->generic.isVisible)
-    tuiDo ((TuiOpaqueFuncPtr) tuiToggleFloatRegs);
+    tuiToggleFloatRegs ();
   else
     {
       TuiLayoutDefPtr layoutDef = tuiLayoutDef ();
@@ -1033,16 +1026,12 @@ _tuiToggleFloatRegs_command (char *arg, 
 static void
 _tuiScrollRegsForward_command (char *arg, int fromTTY)
 {
-  tuiDo ((TuiOpaqueFuncPtr) tui_vScroll, FORWARD_SCROLL, dataWin, 1);
-
-  return;
-}				/* _tuiScrollRegsForward_command */
+  tui_scroll (FORWARD_SCROLL, dataWin, 1);
+}
 
 
 static void
 _tuiScrollRegsBackward_command (char *arg, int fromTTY)
 {
-  tuiDo ((TuiOpaqueFuncPtr) tui_vScroll, BACKWARD_SCROLL, dataWin, 1);
-
-  return;
-}				/* _tuiScrollRegsBackward_command */
+  tui_scroll (BACKWARD_SCROLL, dataWin, 1);
+}
Index: tuiWin.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tuiWin.c,v
retrieving revision 1.8
diff -u -p -r1.8 tuiWin.c
--- tuiWin.c	2001/07/17 22:22:40	1.8
+++ tuiWin.c	2001/07/18 22:00:19
@@ -311,16 +311,14 @@ tuiScrollRight (TuiWinInfoPtr winToScrol
 
 
 /*
-   ** tui_vScroll().
+   ** tui_scroll().
    **    Scroll a window.  Arguments are passed through a va_list.
  */
 void
-tui_vScroll (va_list args)
+tui_scroll (TuiScrollDirection direction,
+	    TuiWinInfoPtr winToScroll,
+	    int numToScroll)
 {
-  TuiScrollDirection direction = va_arg (args, TuiScrollDirection);
-  TuiWinInfoPtr winToScroll = va_arg (args, TuiWinInfoPtr);
-  int numToScroll = va_arg (args, int);
-
   switch (direction)
     {
     case FORWARD_SCROLL:
@@ -338,9 +336,7 @@ tui_vScroll (va_list args)
     default:
       break;
     }
-
-  return;
-}				/* tui_vScroll */
+}
 
 
 /*
@@ -583,13 +579,8 @@ _tuiScrollForward_command (char *arg, in
     _parseScrollingArgs (arg, &winToScroll, (int *) NULL);
   else
     _parseScrollingArgs (arg, &winToScroll, &numToScroll);
-  tuiDo ((TuiOpaqueFuncPtr) tui_vScroll,
-	 FORWARD_SCROLL,
-	 winToScroll,
-	 numToScroll);
-
-  return;
-}				/* _tuiScrollForward_command */
+  tui_scroll (FORWARD_SCROLL, winToScroll, numToScroll);
+}
 
 
 /*
@@ -605,13 +596,8 @@ _tuiScrollBackward_command (char *arg, i
     _parseScrollingArgs (arg, &winToScroll, (int *) NULL);
   else
     _parseScrollingArgs (arg, &winToScroll, &numToScroll);
-  tuiDo ((TuiOpaqueFuncPtr) tui_vScroll,
-	 BACKWARD_SCROLL,
-	 winToScroll,
-	 numToScroll);
-
-  return;
-}				/* _tuiScrollBackward_command */
+  tui_scroll (BACKWARD_SCROLL, winToScroll, numToScroll);
+}
 
 
 /*
@@ -624,13 +610,8 @@ _tuiScrollLeft_command (char *arg, int f
   TuiWinInfoPtr winToScroll;
 
   _parseScrollingArgs (arg, &winToScroll, &numToScroll);
-  tuiDo ((TuiOpaqueFuncPtr) tui_vScroll,
-	 LEFT_SCROLL,
-	 winToScroll,
-	 numToScroll);
-
-  return;
-}				/* _tuiScrollLeft_command */
+  tui_scroll (LEFT_SCROLL, winToScroll, numToScroll);
+}
 
 
 /*
@@ -643,13 +624,8 @@ _tuiScrollRight_command (char *arg, int 
   TuiWinInfoPtr winToScroll;
 
   _parseScrollingArgs (arg, &winToScroll, &numToScroll);
-  tuiDo ((TuiOpaqueFuncPtr) tui_vScroll,
-	 RIGHT_SCROLL,
-	 winToScroll,
-	 numToScroll);
-
-  return;
-}				/* _tuiScrollRight_command */
+  tui_scroll (RIGHT_SCROLL, winToScroll, numToScroll);
+}
 
 
 /*
@@ -718,10 +694,8 @@ _tui_vSetFocus (va_list args)
 static void
 _tuiSetFocus_command (char *arg, int fromTTY)
 {
-  tuiDo ((TuiOpaqueFuncPtr) _tui_vSetFocus, arg, fromTTY);
-
-  return;
-}				/* tui_SetFocus */
+  _tuiSetFocus (arg, fromTTY);
+}
 
 
 /*
@@ -756,7 +730,7 @@ _tuiAllWindowsInfo (char *arg, int fromT
 static void
 _tuiRefreshAll_command (char *arg, int fromTTY)
 {
-  tuiDo ((TuiOpaqueFuncPtr) tuiRefreshAll);
+  tuiRefreshAll ();
 }
 
 
@@ -894,10 +868,8 @@ _tui_vSetWinHeight (va_list args)
 static void
 _tuiSetWinHeight_command (char *arg, int fromTTY)
 {
-  tuiDo ((TuiOpaqueFuncPtr) _tui_vSetWinHeight, arg, fromTTY);
-
-  return;
-}				/* _tuiSetWinHeight_command */
+  _tuiSetWinHeight (arg, fromTTY);
+}
 
 
 /*
@@ -956,10 +928,8 @@ _tui_vXDBsetWinHeight (va_list args)
 static void
 _tuiXDBsetWinHeight_command (char *arg, int fromTTY)
 {
-  tuiDo ((TuiOpaqueFuncPtr) _tui_vXDBsetWinHeight, arg, fromTTY);
-
-  return;
-}				/* _tuiXDBsetWinHeight_command */
+  _tuiXDBsetWinHeight (arg, fromTTY);
+}
 
 
 /*
Index: tuiWin.h
===================================================================
RCS file: /cvs/src/src/gdb/tui/tuiWin.h,v
retrieving revision 1.3
diff -u -p -r1.3 tuiWin.h
--- tuiWin.h	2001/07/14 19:01:25	1.3
+++ tuiWin.h	2001/07/18 22:00:19
@@ -35,7 +35,7 @@ extern void tuiScrollForward (TuiWinInfo
 extern void tuiScrollBackward (TuiWinInfoPtr, int);
 extern void tuiScrollLeft (TuiWinInfoPtr, int);
 extern void tuiScrollRight (TuiWinInfoPtr, int);
-extern void tui_vScroll (va_list);
+extern void tui_scroll (TuiScrollDirection, TuiWinInfoPtr, int);
 extern void tuiSetWinFocusTo (TuiWinInfoPtr);
 extern void tuiClearWinFocusFrom (TuiWinInfoPtr);
 extern void tuiClearWinFocus (void);
From Stephane.Carrez@worldnet.fr Wed Jul 18 15:09:00 2001
From: Stephane Carrez <Stephane.Carrez@worldnet.fr>
To: gdb-patches@sources.redhat.com
Subject: Re: [PATCH]: Cleanup tui to remove tuiDo/tui_vDo
Date: Wed, 18 Jul 2001 15:09:00 -0000
Message-id: <3B560A19.9E83CA4A@worldnet.fr>
References: <3B56092C.7541C9@worldnet.fr>
X-SW-Source: 2001-07/msg00465.html
Content-length: 325

Hi!

> The transition problem that existed in the past is managed in a different way.
?

That is, the curses transition between outside of TUI code (gdb main code) and
inside tui code (curses management).  This management involved switching to
or exiting from curses terminal each time tui functions are entered.

	Stephane


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-07-19  9:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-18 15:04 [RFA]: Fix utils.c and printcmd.c for tui Stephane Carrez
2001-07-19  9:22 ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox