-} /* _tuiHandleResizeDuringIO */
-
-
-/*
- ** _updateCommandInfo().
- ** Function to update the command window information.
- */
-static void
-_updateCommandInfo (int sizeOfString)
-{
-
- if ((sizeOfString +
- cmdWin->detail.commandInfo.curch) > cmdWin->generic.width)
- {
- int newCurch = sizeOfString + cmdWin->detail.commandInfo.curch;
-
- tuiStartNewLines (1);
- cmdWin->detail.commandInfo.curch = newCurch - cmdWin->generic.width;
- }
- else
- cmdWin->detail.commandInfo.curch += sizeOfString;
-
- return;
-} /* _updateCommandInfo */
-
-
-/* Looked at in main.c, fputs_unfiltered(), to decide
- * if it's safe to do standard output to the command window.
- */
-int tui_owns_terminal = 0;
-
-/* Called to set up the terminal for TUI (curses) I/O.
- * We do this either on our way "in" to GDB after target
- * program execution, or else within tuiDo just before
- * going off to TUI routines.
- */
-
-void
-tuiTermSetup (int turn_off_echo)
-{
- char *buffer;
- int start;
- int end;
- int endcol;
- extern char *term_scroll_region;
- extern char *term_cursor_move;
- extern char *term_memory_lock;
- extern char *term_memory_unlock;
-
- /* Turn off echoing, since the TUI does not
- * expect echoing. Below I only put in the TERMIOS
- * case, since that is what applies on HP-UX. turn_off_echo
- * is 1 except for the case where we're being called
- * on a "quit", in which case we want to leave echo on.
- */
- if (turn_off_echo)
- {
-#ifdef HAVE_TERMIOS
- struct termios tio;
- tcgetattr (0, &tio);
- tio.c_lflag &= ~(ECHO);
- tcsetattr (0, TCSANOW, &tio);
-#endif
- }
-
- /* Compute the start and end lines of the command
- * region. (Actually we only use end here)
- */
- start = winList[CMD_WIN]->generic.origin.y;
- end = start + winList[CMD_WIN]->generic.height - 1;
- endcol = winList[CMD_WIN]->generic.width - 1;
-
- if (term_memory_unlock)
- {
-
- /* Un-do the effect of the memory lock in terminal_inferior() */
- tputs (term_memory_unlock, 1, (int (*) (int)) putchar);
- fflush (stdout);
-
- }
- else if (term_scroll_region)
- {
-
- /* Un-do the effect of setting scroll region in terminal_inferior() */
- /* I'm actually not sure how to do this (we don't know for
- * sure what the scroll region was *before* we changed it),
- * but I'll guess that setting it to the whole screen is
- * the right thing. So, ...
- */
-
- /* Set scroll region to be 0..end */
- buffer = (char *) tgoto (term_scroll_region, end, 0);
- tputs (buffer, 1, (int (*) (int)) putchar);
-
- } /* else we're out of luck */
-
- /* This is an attempt to keep the logical & physical
- * cursor in synch, going into curses. Without this,
- * curses seems to be confused by the fact that
- * GDB has physically moved the curser on it. One
- * visible effect of removing this code is that the
- * locator window fails to get updated and the line
- * of text that *should* go into the locator window
- * often goes to the wrong place.
- */
- /* What's done here is to tell curses to write a ' '
- * at the bottom right corner of the screen.
- * The idea is to wind up with the cursor in a known
- * place.
- * Note I'm relying on refresh()
- * only writing what changed (the space),
- * not the whole screen.
- */
- standend ();
- move (end, endcol - 1);
- addch (' ');
- refresh ();
-
- tui_owns_terminal = 1;
-} /* tuiTermSetup */
-
-
-/* Called to set up the terminal for target program I/O, meaning I/O
- * is confined to the command-window area. We also call this on our
- * way out of tuiDo, thus setting up the terminal this way for
- * debugger command I/O. */
-void
-tuiTermUnsetup (int turn_on_echo, int to_column)
-{
- int start;
- int end;
- int curline;
- char *buffer;
- /* The next bunch of things are from readline */
- extern char *term_scroll_region;
- extern char *term_cursor_move;
- extern char *term_memory_lock;
- extern char *term_memory_unlock;
- extern char *term_se;
-
- /* We need to turn on echoing, since the TUI turns it off */
- /* Below I only put in the TERMIOS case, since that
- * is what applies on HP-UX.
- */
- if (turn_on_echo)
- {
-#ifdef HAVE_TERMIOS
- struct termios tio;
- tcgetattr (0, &tio);
- tio.c_lflag |= (ECHO);
- tcsetattr (0, TCSANOW, &tio);
-#endif
- }
-
- /* Compute the start and end lines of the command
- * region, as well as the last "real" line of
- * the region (normally same as end, except when
- * we're first populating the region)
- */
- start = winList[CMD_WIN]->generic.origin.y;
- end = start + winList[CMD_WIN]->generic.height - 1;
- curline = start + winList[CMD_WIN]->detail.commandInfo.curLine;
-
- /* We want to confine target I/O to the command region.
- * In order to do so, we must either have "memory lock"
- * (hpterm's) or "scroll regions" (xterm's).
- */
- if (term_cursor_move && term_memory_lock)
- {
-
- /* Memory lock means lock region above cursor.
- * So first position the cursor, then call memory lock.
- */
- buffer = tgoto (term_cursor_move, 0, start);
- tputs (buffer, 1, (int (*) (int)) putchar);
- tputs (term_memory_lock, 1, (int (*) (int)) putchar);
-
- }
- else if (term_scroll_region)
- {
-
- /* Set the scroll region to the command window */
- buffer = tgoto (term_scroll_region, end, start);
- tputs (buffer, 1, (int (*) (int)) putchar);
-
- } /* else we can't do anything about target I/O */
-
- /* Also turn off standout mode, in case it is on */
- if (term_se != NULL)
- tputs (term_se, 1, (int (*) (int)) putchar);
-
- /* Now go to the appropriate spot on the end line */
- buffer = tgoto (term_cursor_move, to_column, end);
- tputs (buffer, 1, (int (*) (int)) putchar);
- fflush (stdout);
-
- tui_owns_terminal = 0;
-} /* tuiTermUnsetup */