aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/tui')
-rw-r--r--gdb/tui/tui-command.c59
-rw-r--r--gdb/tui/tui-data.c1010
-rw-r--r--gdb/tui/tui-data.h461
-rw-r--r--gdb/tui/tui-disasm.c176
-rw-r--r--gdb/tui/tui-file.c2
-rw-r--r--gdb/tui/tui-hooks.c23
-rw-r--r--gdb/tui/tui-hooks.h28
-rw-r--r--gdb/tui/tui-interp.c2
-rw-r--r--gdb/tui/tui-io.c94
-rw-r--r--gdb/tui/tui-layout.c1070
-rw-r--r--gdb/tui/tui-layout.h18
-rw-r--r--gdb/tui/tui-regs.c853
-rw-r--r--gdb/tui/tui-regs.h2
-rw-r--r--gdb/tui/tui-source.c253
-rw-r--r--gdb/tui/tui-source.h25
-rw-r--r--gdb/tui/tui-stack.c166
-rw-r--r--gdb/tui/tui-stack.h21
-rw-r--r--gdb/tui/tui-win.c1196
-rw-r--r--gdb/tui/tui-win.h39
-rw-r--r--gdb/tui/tui-windata.c302
-rw-r--r--gdb/tui/tui-windata.h40
-rw-r--r--gdb/tui/tui-wingeneral.c239
-rw-r--r--gdb/tui/tui-wingeneral.h54
-rw-r--r--gdb/tui/tui-winsource.c556
-rw-r--r--gdb/tui/tui-winsource.h83
-rw-r--r--gdb/tui/tui.c128
-rw-r--r--gdb/tui/tui.h106
27 files changed, 3210 insertions, 3796 deletions
diff --git a/gdb/tui/tui-command.c b/gdb/tui/tui-command.c
index 4b1c0fd..bdb96e2 100644
--- a/gdb/tui/tui-command.c
+++ b/gdb/tui/tui-command.c
@@ -29,13 +29,7 @@
#include "tui/tui-win.h"
#include "tui/tui-io.h"
-#ifdef HAVE_NCURSES_H
-#include <ncurses.h>
-#else
-#ifdef HAVE_CURSES_H
-#include <curses.h>
-#endif
-#endif
+#include "gdb_curses.h"
/*****************************************
@@ -52,20 +46,20 @@
unsigned int
tui_dispatch_ctrl_char (unsigned int ch)
{
- TuiWinInfoPtr winInfo = tuiWinWithFocus ();
- WINDOW *w = cmdWin->generic.handle;
+ struct tui_win_info *win_info = tui_win_with_focus ();
+ WINDOW *w = TUI_CMD_WIN->generic.handle;
/*
** If the command window has the logical focus, or no-one does
** assume it is the command window; in this case, pass the
** character on through and do nothing here.
*/
- if (winInfo == (TuiWinInfoPtr) NULL || winInfo == cmdWin)
+ if (win_info == NULL || win_info == TUI_CMD_WIN)
return ch;
else
{
- unsigned int c = 0, chCopy = ch;
- register int i;
+ unsigned int c = 0, ch_copy = ch;
+ int i;
char *term;
/* If this is an xterm, page next/prev keys aren't returned
@@ -77,57 +71,58 @@ tui_dispatch_ctrl_char (unsigned int ch)
term[i] = toupper (term[i]);
if ((strcmp (term, "XTERM") == 0) && key_is_start_sequence (ch))
{
- unsigned int pageCh = 0, tmpChar;
+ unsigned int page_ch = 0;
+ unsigned int tmp_char;
- tmpChar = 0;
- while (!key_is_end_sequence (tmpChar))
+ tmp_char = 0;
+ while (!key_is_end_sequence (tmp_char))
{
- tmpChar = (int) wgetch (w);
- if (tmpChar == ERR)
+ tmp_char = (int) wgetch (w);
+ if (tmp_char == ERR)
{
return ch;
}
- if (!tmpChar)
+ if (!tmp_char)
break;
- if (tmpChar == 53)
- pageCh = KEY_PPAGE;
- else if (tmpChar == 54)
- pageCh = KEY_NPAGE;
+ if (tmp_char == 53)
+ page_ch = KEY_PPAGE;
+ else if (tmp_char == 54)
+ page_ch = KEY_NPAGE;
else
{
return 0;
}
}
- chCopy = pageCh;
+ ch_copy = page_ch;
}
- switch (chCopy)
+ switch (ch_copy)
{
case KEY_NPAGE:
- tuiScrollForward (winInfo, 0);
+ tui_scroll_forward (win_info, 0);
break;
case KEY_PPAGE:
- tuiScrollBackward (winInfo, 0);
+ tui_scroll_backward (win_info, 0);
break;
case KEY_DOWN:
case KEY_SF:
- tuiScrollForward (winInfo, 1);
+ tui_scroll_forward (win_info, 1);
break;
case KEY_UP:
case KEY_SR:
- tuiScrollBackward (winInfo, 1);
+ tui_scroll_backward (win_info, 1);
break;
case KEY_RIGHT:
- tuiScrollLeft (winInfo, 1);
+ tui_scroll_left (win_info, 1);
break;
case KEY_LEFT:
- tuiScrollRight (winInfo, 1);
+ tui_scroll_right (win_info, 1);
break;
case '\f':
- tuiRefreshAll ();
+ tui_refresh_all_win ();
break;
default:
- c = chCopy;
+ c = ch_copy;
break;
}
return c;
diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c
index c6f4fb5..2b6faa3 100644
--- a/gdb/tui/tui-data.c
+++ b/gdb/tui/tui-data.c
@@ -1,7 +1,7 @@
/* TUI data manipulation routines.
- Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation,
- Inc.
+ Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
+ Foundation, Inc.
Contributed by Hewlett-Packard Company.
@@ -28,44 +28,38 @@
#include "tui/tui-data.h"
#include "tui/tui-wingeneral.h"
-#ifdef HAVE_NCURSES_H
-#include <ncurses.h>
-#else
-#ifdef HAVE_CURSES_H
-#include <curses.h>
-#endif
-#endif
+#include "gdb_string.h"
+#include "gdb_curses.h"
/****************************
** GLOBAL DECLARATIONS
****************************/
-TuiWinInfoPtr winList[MAX_MAJOR_WINDOWS];
+struct tui_win_info *(tui_win_list[MAX_MAJOR_WINDOWS]);
/***************************
** Private data
****************************/
-static TuiLayoutType _currentLayout = UNDEFINED_LAYOUT;
-static int _termHeight, _termWidth;
-static TuiGenWinInfo _locator;
-static TuiGenWinInfo _execInfo[2];
-static TuiWinInfoPtr _srcWinList[2];
-static TuiList _sourceWindows =
-{(OpaqueList) _srcWinList, 0};
-static int _defaultTabLen = DEFAULT_TAB_LEN;
-static TuiWinInfoPtr _winWithFocus = (TuiWinInfoPtr) NULL;
-static TuiLayoutDef _layoutDef =
-{SRC_WIN, /* displayMode */
- FALSE, /* split */
- TUI_UNDEFINED_REGS, /* regsDisplayType */
- TUI_SFLOAT_REGS}; /* floatRegsDisplayType */
-static int _winResized = FALSE;
+static enum tui_layout_type current_layout = UNDEFINED_LAYOUT;
+static int term_height, term_width;
+static struct tui_gen_win_info _locator;
+static struct tui_gen_win_info exec_info[2];
+static struct tui_win_info * src_win_list[2];
+static struct tui_list source_windows = {(void **) src_win_list, 0};
+static int default_tab_len = DEFAULT_TAB_LEN;
+static struct tui_win_info * win_with_focus = (struct tui_win_info *) NULL;
+static struct tui_layout_def layout_def =
+{SRC_WIN, /* DISPLAY_MODE */
+ FALSE, /* SPLIT */
+ TUI_UNDEFINED_REGS, /* REGS_DISPLAY_TYPE */
+ TUI_SFLOAT_REGS}; /* FLOAT_REGS_DISPLAY_TYPE */
+static int win_resized = FALSE;
/*********************************
** Static function forward decls
**********************************/
-static void freeContent (TuiWinContent, int, TuiWinType);
-static void freeContentElements (TuiWinContent, int, TuiWinType);
+static void free_content (tui_win_content, int, enum tui_win_type);
+static void free_content_elements (tui_win_content, int, enum tui_win_type);
@@ -73,314 +67,252 @@ static void freeContentElements (TuiWinContent, int, TuiWinType);
** PUBLIC FUNCTIONS
**********************************/
+int
+tui_win_is_source_type (enum tui_win_type win_type)
+{
+ return (win_type == SRC_WIN || win_type == DISASSEM_WIN);
+}
+
+int
+tui_win_is_auxillary (enum tui_win_type win_type)
+{
+ return (win_type > MAX_MAJOR_WINDOWS);
+}
+
+int
+tui_win_has_locator (struct tui_win_info *win_info)
+{
+ return (win_info != NULL \
+ && win_info->detail.source_info.has_locator);
+}
+
+void
+tui_set_win_highlight (struct tui_win_info *win_info, int highlight)
+{
+ if (win_info != NULL)
+ win_info->is_highlighted = highlight;
+}
+
/******************************************
** ACCESSORS & MUTATORS FOR PRIVATE DATA
******************************************/
-/*
- ** tuiWinResized().
- ** Answer a whether the terminal window has been resized or not
- */
+/* Answer a whether the terminal window has been resized or not. */
int
-tuiWinResized (void)
+tui_win_resized (void)
{
- return _winResized;
-} /* tuiWinResized */
+ return win_resized;
+}
-/*
- ** tuiSetWinResized().
- ** Set a whether the terminal window has been resized or not
- */
+/* Set a whether the terminal window has been resized or not. */
void
-tuiSetWinResizedTo (int resized)
+tui_set_win_resized_to (int resized)
{
- _winResized = resized;
-
- return;
-} /* tuiSetWinResizedTo */
+ win_resized = resized;
+}
-/*
- ** tuiLayoutDef().
- ** Answer a pointer to the current layout definition
- */
-TuiLayoutDefPtr
-tuiLayoutDef (void)
+/* Answer a pointer to the current layout definition. */
+struct tui_layout_def *
+tui_layout_def (void)
{
- return &_layoutDef;
-} /* tuiLayoutDef */
+ return &layout_def;
+}
-/*
- ** tuiWinWithFocus().
- ** Answer the window with the logical focus
- */
-TuiWinInfoPtr
-tuiWinWithFocus (void)
+/* Answer the window with the logical focus. */
+struct tui_win_info *
+tui_win_with_focus (void)
{
- return _winWithFocus;
-} /* tuiWinWithFocus */
+ return win_with_focus;
+}
-/*
- ** tuiSetWinWithFocus().
- ** Set the window that has the logical focus
- */
+/* Set the window that has the logical focus. */
void
-tuiSetWinWithFocus (TuiWinInfoPtr winInfo)
+tui_set_win_with_focus (struct tui_win_info * win_info)
{
- _winWithFocus = winInfo;
-
- return;
-} /* tuiSetWinWithFocus */
+ win_with_focus = win_info;
+}
-/*
- ** tuiDefaultTabLen().
- ** Answer the length in chars, of tabs
- */
+/* Answer the length in chars, of tabs. */
int
-tuiDefaultTabLen (void)
+tui_default_tab_len (void)
{
- return _defaultTabLen;
-} /* tuiDefaultTabLen */
+ return default_tab_len;
+}
-/*
- ** tuiSetDefaultTabLen().
- ** Set the length in chars, of tabs
- */
+/* Set the length in chars, of tabs. */
void
-tuiSetDefaultTabLen (int len)
+tui_set_default_tab_len (int len)
{
- _defaultTabLen = len;
-
- return;
-} /* tuiSetDefaultTabLen */
+ default_tab_len = len;
+}
-/*
- ** currentSourceWin()
- ** Accessor for the current source window. Usually there is only
- ** one source window (either source or disassembly), but both can
- ** be displayed at the same time.
- */
-TuiListPtr
-sourceWindows (void)
+/* Accessor for the current source window. Usually there is only one
+ source window (either source or disassembly), but both can be
+ displayed at the same time. */
+struct tui_list *
+tui_source_windows (void)
{
- return &_sourceWindows;
-} /* currentSourceWindows */
+ return &source_windows;
+}
-/*
- ** clearSourceWindows()
- ** Clear the list of source windows. Usually there is only one
- ** source window (either source or disassembly), but both can be
- ** displayed at the same time.
- */
+/* Clear the list of source windows. Usually there is only one source
+ window (either source or disassembly), but both can be displayed at
+ the same time. */
void
-clearSourceWindows (void)
+tui_clear_source_windows (void)
{
- _sourceWindows.list[0] = (Opaque) NULL;
- _sourceWindows.list[1] = (Opaque) NULL;
- _sourceWindows.count = 0;
-
- return;
-} /* currentSourceWindows */
+ source_windows.list[0] = NULL;
+ source_windows.list[1] = NULL;
+ source_windows.count = 0;
+}
-/*
- ** clearSourceWindowsDetail()
- ** Clear the pertinant detail in the source windows.
- */
+/* Clear the pertinant detail in the source windows. */
void
-clearSourceWindowsDetail (void)
+tui_clear_source_windows_detail (void)
{
int i;
- for (i = 0; i < (sourceWindows ())->count; i++)
- clearWinDetail ((TuiWinInfoPtr) (sourceWindows ())->list[i]);
-
- return;
-} /* currentSourceWindows */
+ for (i = 0; i < (tui_source_windows ())->count; i++)
+ tui_clear_win_detail ((struct tui_win_info *) (tui_source_windows ())->list[i]);
+}
-/*
- ** addSourceWindowToList().
- ** Add a window to the list of source windows. Usually there is
- ** only one source window (either source or disassembly), but
- ** both can be displayed at the same time.
- */
+/* Add a window to the list of source windows. Usually there is only
+ one source window (either source or disassembly), but both can be
+ displayed at the same time. */
void
-addToSourceWindows (TuiWinInfoPtr winInfo)
+tui_add_to_source_windows (struct tui_win_info * win_info)
{
- if (_sourceWindows.count < 2)
- _sourceWindows.list[_sourceWindows.count++] = (Opaque) winInfo;
-
- return;
-} /* addToSourceWindows */
+ if (source_windows.count < 2)
+ source_windows.list[source_windows.count++] = (void *) win_info;
+}
-/*
- ** clearWinDetail()
- ** Clear the pertinant detail in the windows.
- */
+/* Clear the pertinant detail in the windows. */
void
-clearWinDetail (TuiWinInfoPtr winInfo)
+tui_clear_win_detail (struct tui_win_info * win_info)
{
- if (m_winPtrNotNull (winInfo))
+ if (win_info != NULL)
{
- switch (winInfo->generic.type)
+ switch (win_info->generic.type)
{
case SRC_WIN:
case DISASSEM_WIN:
- winInfo->detail.sourceInfo.startLineOrAddr.addr = 0;
- winInfo->detail.sourceInfo.horizontalOffset = 0;
+ win_info->detail.source_info.start_line_or_addr.addr = 0;
+ win_info->detail.source_info.horizontal_offset = 0;
break;
case CMD_WIN:
- winInfo->detail.commandInfo.curLine =
- winInfo->detail.commandInfo.curch = 0;
+ win_info->detail.command_info.cur_line =
+ win_info->detail.command_info.curch = 0;
break;
case DATA_WIN:
- winInfo->detail.dataDisplayInfo.dataContent =
- (TuiWinContent) NULL;
- winInfo->detail.dataDisplayInfo.dataContentCount = 0;
- winInfo->detail.dataDisplayInfo.regsContent =
- (TuiWinContent) NULL;
- winInfo->detail.dataDisplayInfo.regsContentCount = 0;
- winInfo->detail.dataDisplayInfo.regsDisplayType =
+ win_info->detail.data_display_info.data_content =
+ (tui_win_content) NULL;
+ win_info->detail.data_display_info.data_content_count = 0;
+ win_info->detail.data_display_info.regs_content =
+ (tui_win_content) NULL;
+ win_info->detail.data_display_info.regs_content_count = 0;
+ win_info->detail.data_display_info.regs_display_type =
TUI_UNDEFINED_REGS;
- winInfo->detail.dataDisplayInfo.regsColumnCount = 1;
- winInfo->detail.dataDisplayInfo.displayRegs = FALSE;
+ win_info->detail.data_display_info.regs_column_count = 1;
+ win_info->detail.data_display_info.display_regs = FALSE;
break;
default:
break;
}
}
-
- return;
-} /* clearWinDetail */
+}
-/*
- ** sourceExecInfoPtr().
- ** Accessor for the source execution info ptr.
- */
-TuiGenWinInfoPtr
-sourceExecInfoWinPtr (void)
+/* Accessor for the source execution info ptr. */
+struct tui_gen_win_info *
+tui_source_exec_info_win_ptr (void)
{
- return &_execInfo[0];
-} /* sourceExecInfoWinPtr */
+ return &exec_info[0];
+}
-/*
- ** disassemExecInfoPtr().
- ** Accessor for the disassem execution info ptr.
- */
-TuiGenWinInfoPtr
-disassemExecInfoWinPtr (void)
+/* Accessor for the disassem execution info ptr. */
+struct tui_gen_win_info *
+tui_disassem_exec_info_win_ptr (void)
{
- return &_execInfo[1];
-} /* disassemExecInfoWinPtr */
+ return &exec_info[1];
+}
-/*
- ** locatorWinInfoPtr().
- ** Accessor for the locator win info. Answers a pointer to the
- ** static locator win info struct.
- */
-TuiGenWinInfoPtr
-locatorWinInfoPtr (void)
+/* Accessor for the locator win info. Answers a pointer to the static
+ locator win info struct. */
+struct tui_gen_win_info *
+tui_locator_win_info_ptr (void)
{
return &_locator;
-} /* locatorWinInfoPtr */
+}
-/*
- ** termHeight().
- ** Accessor for the termHeight
- */
+/* Accessor for the term_height. */
int
-termHeight (void)
+tui_term_height (void)
{
- return _termHeight;
-} /* termHeight */
+ return term_height;
+}
-/*
- ** setTermHeightTo().
- ** Mutator for the term height
- */
+/* Mutator for the term height. */
void
-setTermHeightTo (int h)
+tui_set_term_height_to (int h)
{
- _termHeight = h;
-
- return;
-} /* setTermHeightTo */
+ term_height = h;
+}
-/*
- ** termWidth().
- ** Accessor for the termWidth
- */
+/* Accessor for the term_width. */
int
-termWidth (void)
+tui_term_width (void)
{
- return _termWidth;
-} /* termWidth */
+ return term_width;
+}
-/*
- ** setTermWidth().
- ** Mutator for the termWidth
- */
+/* Mutator for the term_width. */
void
-setTermWidthTo (int w)
+tui_set_term_width_to (int w)
{
- _termWidth = w;
-
- return;
-} /* setTermWidthTo */
+ term_width = w;
+}
-/*
- ** currentLayout().
- ** Accessor for the current layout
- */
-TuiLayoutType
-currentLayout (void)
+/* Accessor for the current layout. */
+enum tui_layout_type
+tui_current_layout (void)
{
- return _currentLayout;
-} /* currentLayout */
+ return current_layout;
+}
-/*
- ** setCurrentLayoutTo().
- ** Mutator for the current layout
- */
+/* Mutator for the current layout. */
void
-setCurrentLayoutTo (TuiLayoutType newLayout)
+tui_set_current_layout_to (enum tui_layout_type new_layout)
{
- _currentLayout = newLayout;
-
- return;
-} /* setCurrentLayoutTo */
+ current_layout = new_layout;
+}
-/*
- ** setGenWinOrigin().
- ** Set the origin of the window
- */
+/* Set the origin of the window. */
void
-setGenWinOrigin (TuiGenWinInfoPtr winInfo, int x, int y)
+set_gen_win_origin (struct tui_gen_win_info * win_info, int x, int y)
{
- winInfo->origin.x = x;
- winInfo->origin.y = y;
-
- return;
-} /* setGenWinOrigin */
+ win_info->origin.x = x;
+ win_info->origin.y = y;
+}
/*****************************
@@ -388,25 +320,22 @@ setGenWinOrigin (TuiGenWinInfoPtr winInfo, int x, int y)
*****************************/
-/*
- ** tuiNextWin().
- ** Answer the next window in the list, cycling back to the top
- ** if necessary
- */
-TuiWinInfoPtr
-tuiNextWin (TuiWinInfoPtr curWin)
+/* Answer the next window in the list, cycling back to the top if
+ necessary. */
+struct tui_win_info *
+tui_next_win (struct tui_win_info * cur_win)
{
- TuiWinType type = curWin->generic.type;
- TuiWinInfoPtr nextWin = (TuiWinInfoPtr) NULL;
+ enum tui_win_type type = cur_win->generic.type;
+ struct tui_win_info * next_win = (struct tui_win_info *) NULL;
- if (curWin->generic.type == CMD_WIN)
+ if (cur_win->generic.type == CMD_WIN)
type = SRC_WIN;
else
- type = curWin->generic.type + 1;
- while (type != curWin->generic.type && m_winPtrIsNull (nextWin))
+ type = cur_win->generic.type + 1;
+ while (type != cur_win->generic.type && (next_win == NULL))
{
- if (winList[type] && winList[type]->generic.isVisible)
- nextWin = winList[type];
+ if (tui_win_list[type] && tui_win_list[type]->generic.is_visible)
+ next_win = tui_win_list[type];
else
{
if (type == CMD_WIN)
@@ -416,29 +345,26 @@ tuiNextWin (TuiWinInfoPtr curWin)
}
}
- return nextWin;
-} /* tuiNextWin */
+ return next_win;
+}
-/*
- ** tuiPrevWin().
- ** Answer the prev window in the list, cycling back to the bottom
- ** if necessary
- */
-TuiWinInfoPtr
-tuiPrevWin (TuiWinInfoPtr curWin)
+/* Answer the prev window in the list, cycling back to the bottom if
+ necessary. */
+struct tui_win_info *
+tui_prev_win (struct tui_win_info * cur_win)
{
- TuiWinType type = curWin->generic.type;
- TuiWinInfoPtr prev = (TuiWinInfoPtr) NULL;
+ enum tui_win_type type = cur_win->generic.type;
+ struct tui_win_info * prev = (struct tui_win_info *) NULL;
- if (curWin->generic.type == SRC_WIN)
+ if (cur_win->generic.type == SRC_WIN)
type = CMD_WIN;
else
- type = curWin->generic.type - 1;
- while (type != curWin->generic.type && m_winPtrIsNull (prev))
+ type = cur_win->generic.type - 1;
+ while (type != cur_win->generic.type && (prev == NULL))
{
- if (winList[type]->generic.isVisible)
- prev = winList[type];
+ if (tui_win_list[type]->generic.is_visible)
+ prev = tui_win_list[type];
else
{
if (type == SRC_WIN)
@@ -452,46 +378,40 @@ tuiPrevWin (TuiWinInfoPtr curWin)
}
-/*
- ** partialWinByName().
- ** Answer the window represented by name
- */
-TuiWinInfoPtr
-partialWinByName (char *name)
+/* Answer the window represented by name. */
+struct tui_win_info *
+tui_partial_win_by_name (char *name)
{
- TuiWinInfoPtr winInfo = (TuiWinInfoPtr) NULL;
+ struct tui_win_info * win_info = (struct tui_win_info *) NULL;
if (name != (char *) NULL)
{
int i = 0;
- while (i < MAX_MAJOR_WINDOWS && m_winPtrIsNull (winInfo))
+ while (i < MAX_MAJOR_WINDOWS && win_info == NULL)
{
- if (winList[i] != 0)
+ if (tui_win_list[i] != 0)
{
- char *curName = winName (&winList[i]->generic);
- if (strlen (name) <= strlen (curName) &&
- strncmp (name, curName, strlen (name)) == 0)
- winInfo = winList[i];
+ char *cur_name = tui_win_name (&tui_win_list[i]->generic);
+ if (strlen (name) <= strlen (cur_name) &&
+ strncmp (name, cur_name, strlen (name)) == 0)
+ win_info = tui_win_list[i];
}
i++;
}
}
- return winInfo;
-} /* partialWinByName */
+ return win_info;
+}
-/*
- ** winName().
- ** Answer the name of the window
- */
+/* Answer the name of the window. */
char *
-winName (TuiGenWinInfoPtr winInfo)
+tui_win_name (struct tui_gen_win_info * win_info)
{
char *name = (char *) NULL;
- switch (winInfo->type)
+ switch (win_info->type)
{
case SRC_WIN:
name = SRC_NAME;
@@ -511,184 +431,161 @@ winName (TuiGenWinInfoPtr winInfo)
}
return name;
-} /* winName */
+}
-/*
- ** initializeStaticData
- */
void
-initializeStaticData (void)
+tui_initialize_static_data (void)
{
- initGenericPart (sourceExecInfoWinPtr ());
- initGenericPart (disassemExecInfoWinPtr ());
- initGenericPart (locatorWinInfoPtr ());
-
- return;
-} /* initializeStaticData */
+ tui_init_generic_part (tui_source_exec_info_win_ptr ());
+ tui_init_generic_part (tui_disassem_exec_info_win_ptr ());
+ tui_init_generic_part (tui_locator_win_info_ptr ());
+}
-/*
- ** allocGenericWinInfo().
- */
-TuiGenWinInfoPtr
-allocGenericWinInfo (void)
+struct tui_gen_win_info *
+tui_alloc_generic_win_info (void)
{
- TuiGenWinInfoPtr win;
+ struct tui_gen_win_info * win;
- if ((win = (TuiGenWinInfoPtr) xmalloc (
- sizeof (TuiGenWinInfoPtr))) != (TuiGenWinInfoPtr) NULL)
- initGenericPart (win);
+ if ((win = (struct tui_gen_win_info *) xmalloc (
+ sizeof (struct tui_gen_win_info *))) != (struct tui_gen_win_info *) NULL)
+ tui_init_generic_part (win);
return win;
-} /* allocGenericWinInfo */
+}
-/*
- ** initGenericPart().
- */
void
-initGenericPart (TuiGenWinInfoPtr win)
+tui_init_generic_part (struct tui_gen_win_info * win)
{
win->width =
win->height =
win->origin.x =
win->origin.y =
- win->viewportHeight =
- win->contentSize =
- win->lastVisibleLine = 0;
+ win->viewport_height =
+ win->content_size =
+ win->last_visible_line = 0;
win->handle = (WINDOW *) NULL;
- win->content = (OpaquePtr) NULL;
- win->contentInUse =
- win->isVisible = FALSE;
+ win->content = NULL;
+ win->content_in_use =
+ win->is_visible = FALSE;
win->title = 0;
}
/*
- ** initContentElement().
+ ** init_content_element().
*/
void
-initContentElement (TuiWinElementPtr element, TuiWinType type)
+init_content_element (struct tui_win_element * element, enum tui_win_type type)
{
element->highlight = FALSE;
switch (type)
{
case SRC_WIN:
case DISASSEM_WIN:
- element->whichElement.source.line = (char *) NULL;
- element->whichElement.source.lineOrAddr.lineNo = 0;
- element->whichElement.source.isExecPoint = FALSE;
- element->whichElement.source.hasBreak = FALSE;
+ element->which_element.source.line = (char *) NULL;
+ element->which_element.source.line_or_addr.line_no = 0;
+ element->which_element.source.is_exec_point = FALSE;
+ element->which_element.source.has_break = FALSE;
break;
case DATA_WIN:
- initGenericPart (&element->whichElement.dataWindow);
- element->whichElement.dataWindow.type = DATA_ITEM_WIN;
- ((TuiGenWinInfoPtr) & element->whichElement.dataWindow)->content =
- (OpaquePtr) allocContent (1, DATA_ITEM_WIN);
- ((TuiGenWinInfoPtr)
- & element->whichElement.dataWindow)->contentSize = 1;
+ tui_init_generic_part (&element->which_element.data_window);
+ element->which_element.data_window.type = DATA_ITEM_WIN;
+ ((struct tui_gen_win_info *) & element->which_element.data_window)->content =
+ (void **) tui_alloc_content (1, DATA_ITEM_WIN);
+ ((struct tui_gen_win_info *)
+ & element->which_element.data_window)->content_size = 1;
break;
case CMD_WIN:
- element->whichElement.command.line = (char *) NULL;
+ element->which_element.command.line = (char *) NULL;
break;
case DATA_ITEM_WIN:
- element->whichElement.data.name = (char *) NULL;
- element->whichElement.data.type = TUI_REGISTER;
- element->whichElement.data.itemNo = UNDEFINED_ITEM;
- element->whichElement.data.value = (Opaque) NULL;
- element->whichElement.data.highlight = FALSE;
+ element->which_element.data.name = (char *) NULL;
+ element->which_element.data.type = TUI_REGISTER;
+ element->which_element.data.item_no = UNDEFINED_ITEM;
+ element->which_element.data.value = NULL;
+ element->which_element.data.highlight = FALSE;
break;
case LOCATOR_WIN:
- element->whichElement.locator.fileName[0] =
- element->whichElement.locator.procName[0] = (char) 0;
- element->whichElement.locator.lineNo = 0;
- element->whichElement.locator.addr = 0;
+ element->which_element.locator.file_name[0] =
+ element->which_element.locator.proc_name[0] = (char) 0;
+ element->which_element.locator.line_no = 0;
+ element->which_element.locator.addr = 0;
break;
case EXEC_INFO_WIN:
- memset(element->whichElement.simpleString, ' ',
- sizeof(element->whichElement.simpleString));
+ memset(element->which_element.simple_string, ' ',
+ sizeof(element->which_element.simple_string));
break;
default:
break;
}
- return;
-} /* initContentElement */
+}
-/*
- ** initWinInfo().
- */
void
-initWinInfo (TuiWinInfoPtr winInfo)
+init_win_info (struct tui_win_info * win_info)
{
- initGenericPart (&winInfo->generic);
- winInfo->canHighlight =
- winInfo->isHighlighted = FALSE;
- switch (winInfo->generic.type)
+ tui_init_generic_part (&win_info->generic);
+ win_info->can_highlight =
+ win_info->is_highlighted = FALSE;
+ switch (win_info->generic.type)
{
case SRC_WIN:
case DISASSEM_WIN:
- winInfo->detail.sourceInfo.executionInfo = (TuiGenWinInfoPtr) NULL;
- winInfo->detail.sourceInfo.hasLocator = FALSE;
- winInfo->detail.sourceInfo.horizontalOffset = 0;
- winInfo->detail.sourceInfo.startLineOrAddr.addr = 0;
- winInfo->detail.sourceInfo.filename = 0;
+ win_info->detail.source_info.execution_info = (struct tui_gen_win_info *) NULL;
+ win_info->detail.source_info.has_locator = FALSE;
+ win_info->detail.source_info.horizontal_offset = 0;
+ win_info->detail.source_info.start_line_or_addr.addr = 0;
+ win_info->detail.source_info.filename = 0;
break;
case DATA_WIN:
- winInfo->detail.dataDisplayInfo.dataContent = (TuiWinContent) NULL;
- winInfo->detail.dataDisplayInfo.dataContentCount = 0;
- winInfo->detail.dataDisplayInfo.regsContent = (TuiWinContent) NULL;
- winInfo->detail.dataDisplayInfo.regsContentCount = 0;
- winInfo->detail.dataDisplayInfo.regsDisplayType =
+ win_info->detail.data_display_info.data_content = (tui_win_content) NULL;
+ win_info->detail.data_display_info.data_content_count = 0;
+ win_info->detail.data_display_info.regs_content = (tui_win_content) NULL;
+ win_info->detail.data_display_info.regs_content_count = 0;
+ win_info->detail.data_display_info.regs_display_type =
TUI_UNDEFINED_REGS;
- winInfo->detail.dataDisplayInfo.regsColumnCount = 1;
- winInfo->detail.dataDisplayInfo.displayRegs = FALSE;
+ win_info->detail.data_display_info.regs_column_count = 1;
+ win_info->detail.data_display_info.display_regs = FALSE;
break;
case CMD_WIN:
- winInfo->detail.commandInfo.curLine = 0;
- winInfo->detail.commandInfo.curch = 0;
+ win_info->detail.command_info.cur_line = 0;
+ win_info->detail.command_info.curch = 0;
break;
default:
- winInfo->detail.opaque = (Opaque) NULL;
+ win_info->detail.opaque = NULL;
break;
}
-
- return;
-} /* initWinInfo */
+}
-/*
- ** allocWinInfo().
- */
-TuiWinInfoPtr
-allocWinInfo (TuiWinType type)
+struct tui_win_info *
+tui_alloc_win_info (enum tui_win_type type)
{
- TuiWinInfoPtr winInfo = (TuiWinInfoPtr) NULL;
+ struct tui_win_info * win_info = (struct tui_win_info *) NULL;
- winInfo = (TuiWinInfoPtr) xmalloc (sizeof (TuiWinInfo));
- if (m_winPtrNotNull (winInfo))
+ win_info = (struct tui_win_info *) xmalloc (sizeof (struct tui_win_info));
+ if ((win_info != NULL))
{
- winInfo->generic.type = type;
- initWinInfo (winInfo);
+ win_info->generic.type = type;
+ init_win_info (win_info);
}
- return winInfo;
-} /* allocWinInfo */
+ return win_info;
+}
-/*
- ** allocContent().
- ** Allocates the content and elements in a block.
- */
-TuiWinContent
-allocContent (int numElements, TuiWinType type)
+/* Allocates the content and elements in a block. */
+tui_win_content
+tui_alloc_content (int num_elements, enum tui_win_type type)
{
- TuiWinContent content = (TuiWinContent) NULL;
- char *elementBlockPtr = (char *) NULL;
+ tui_win_content content = (tui_win_content) NULL;
+ char *element_block_ptr = (char *) NULL;
int i;
- if ((content = (TuiWinContent)
- xmalloc (sizeof (TuiWinElementPtr) * numElements)) != (TuiWinContent) NULL)
+ if ((content = (tui_win_content)
+ xmalloc (sizeof (struct tui_win_element *) * num_elements)) != (tui_win_content) NULL)
{ /*
** All windows, except the data window, can allocate the elements
** in a chunk. The data window cannot because items can be
@@ -696,284 +593,262 @@ allocContent (int numElements, TuiWinType type)
*/
if (type != DATA_WIN)
{
- if ((elementBlockPtr = (char *)
- xmalloc (sizeof (TuiWinElement) * numElements)) != (char *) NULL)
+ if ((element_block_ptr = (char *)
+ xmalloc (sizeof (struct tui_win_element) * num_elements)) != (char *) NULL)
{
- for (i = 0; i < numElements; i++)
+ for (i = 0; i < num_elements; i++)
{
- content[i] = (TuiWinElementPtr) elementBlockPtr;
- initContentElement (content[i], type);
- elementBlockPtr += sizeof (TuiWinElement);
+ content[i] = (struct tui_win_element *) element_block_ptr;
+ init_content_element (content[i], type);
+ element_block_ptr += sizeof (struct tui_win_element);
}
}
else
{
- tuiFree ((char *) content);
- content = (TuiWinContent) NULL;
+ xfree (content);
+ content = (tui_win_content) NULL;
}
}
}
return content;
-} /* allocContent */
+}
-/*
- ** addContentElements().
- ** Adds the input number of elements to the windows's content. If
- ** no content has been allocated yet, allocContent() is called to
- ** do this. The index of the first element added is returned,
- ** unless there is a memory allocation error, in which case, (-1)
- ** is returned.
- */
+/* Adds the input number of elements to the windows's content. If no
+ content has been allocated yet, alloc_content() is called to do
+ this. The index of the first element added is returned, unless
+ there is a memory allocation error, in which case, (-1) is
+ returned. */
int
-addContentElements (TuiGenWinInfoPtr winInfo, int numElements)
+tui_add_content_elements (struct tui_gen_win_info * win_info, int num_elements)
{
- TuiWinElementPtr elementPtr;
- int i, indexStart;
+ struct tui_win_element * element_ptr;
+ int i, index_start;
- if (winInfo->content == (OpaquePtr) NULL)
+ if (win_info->content == NULL)
{
- winInfo->content = (OpaquePtr) allocContent (numElements, winInfo->type);
- indexStart = 0;
+ win_info->content = (void **) tui_alloc_content (num_elements, win_info->type);
+ index_start = 0;
}
else
- indexStart = winInfo->contentSize;
- if (winInfo->content != (OpaquePtr) NULL)
+ index_start = win_info->content_size;
+ if (win_info->content != NULL)
{
- for (i = indexStart; (i < numElements + indexStart); i++)
+ for (i = index_start; (i < num_elements + index_start); i++)
{
- if ((elementPtr = (TuiWinElementPtr)
- xmalloc (sizeof (TuiWinElement))) != (TuiWinElementPtr) NULL)
+ if ((element_ptr = (struct tui_win_element *)
+ xmalloc (sizeof (struct tui_win_element))) != (struct tui_win_element *) NULL)
{
- winInfo->content[i] = (Opaque) elementPtr;
- initContentElement (elementPtr, winInfo->type);
- winInfo->contentSize++;
+ win_info->content[i] = (void *) element_ptr;
+ init_content_element (element_ptr, win_info->type);
+ win_info->content_size++;
}
else /* things must be really hosed now! We ran out of memory!? */
return (-1);
}
}
- return indexStart;
-} /* addContentElements */
+ return index_start;
+}
-/* Delete all curses windows associated with winInfo, leaving everything
+/* Delete all curses windows associated with win_info, leaving everything
else intact. */
void
-tuiDelWindow (TuiWinInfoPtr winInfo)
+tui_del_window (struct tui_win_info * win_info)
{
- TuiGenWinInfoPtr genericWin;
+ struct tui_gen_win_info * generic_win;
- switch (winInfo->generic.type)
+ switch (win_info->generic.type)
{
case SRC_WIN:
case DISASSEM_WIN:
- genericWin = locatorWinInfoPtr ();
- if (genericWin != (TuiGenWinInfoPtr) NULL)
+ generic_win = tui_locator_win_info_ptr ();
+ if (generic_win != (struct tui_gen_win_info *) NULL)
{
- tuiDelwin (genericWin->handle);
- genericWin->handle = (WINDOW *) NULL;
- genericWin->isVisible = FALSE;
+ tui_delete_win (generic_win->handle);
+ generic_win->handle = (WINDOW *) NULL;
+ generic_win->is_visible = FALSE;
}
- if (winInfo->detail.sourceInfo.filename)
+ if (win_info->detail.source_info.filename)
{
- xfree (winInfo->detail.sourceInfo.filename);
- winInfo->detail.sourceInfo.filename = 0;
+ xfree (win_info->detail.source_info.filename);
+ win_info->detail.source_info.filename = 0;
}
- genericWin = winInfo->detail.sourceInfo.executionInfo;
- if (genericWin != (TuiGenWinInfoPtr) NULL)
+ generic_win = win_info->detail.source_info.execution_info;
+ if (generic_win != (struct tui_gen_win_info *) NULL)
{
- tuiDelwin (genericWin->handle);
- genericWin->handle = (WINDOW *) NULL;
- genericWin->isVisible = FALSE;
+ tui_delete_win (generic_win->handle);
+ generic_win->handle = (WINDOW *) NULL;
+ generic_win->is_visible = FALSE;
}
break;
case DATA_WIN:
- if (winInfo->generic.content != (OpaquePtr) NULL)
+ if (win_info->generic.content != NULL)
{
- tuiDelDataWindows (winInfo->detail.dataDisplayInfo.regsContent,
- winInfo->detail.dataDisplayInfo.regsContentCount);
- tuiDelDataWindows (winInfo->detail.dataDisplayInfo.dataContent,
- winInfo->detail.dataDisplayInfo.dataContentCount);
+ tui_del_data_windows (win_info->detail.data_display_info.regs_content,
+ win_info->detail.data_display_info.regs_content_count);
+ tui_del_data_windows (win_info->detail.data_display_info.data_content,
+ win_info->detail.data_display_info.data_content_count);
}
break;
default:
break;
}
- if (winInfo->generic.handle != (WINDOW *) NULL)
+ if (win_info->generic.handle != (WINDOW *) NULL)
{
- tuiDelwin (winInfo->generic.handle);
- winInfo->generic.handle = (WINDOW *) NULL;
- winInfo->generic.isVisible = FALSE;
+ tui_delete_win (win_info->generic.handle);
+ win_info->generic.handle = (WINDOW *) NULL;
+ win_info->generic.is_visible = FALSE;
}
}
-/*
- ** freeWindow().
- */
void
-freeWindow (TuiWinInfoPtr winInfo)
+tui_free_window (struct tui_win_info * win_info)
{
- TuiGenWinInfoPtr genericWin;
+ struct tui_gen_win_info * generic_win;
- switch (winInfo->generic.type)
+ switch (win_info->generic.type)
{
case SRC_WIN:
case DISASSEM_WIN:
- genericWin = locatorWinInfoPtr ();
- if (genericWin != (TuiGenWinInfoPtr) NULL)
+ generic_win = tui_locator_win_info_ptr ();
+ if (generic_win != (struct tui_gen_win_info *) NULL)
{
- tuiDelwin (genericWin->handle);
- genericWin->handle = (WINDOW *) NULL;
+ tui_delete_win (generic_win->handle);
+ generic_win->handle = (WINDOW *) NULL;
}
- freeWinContent (genericWin);
- if (winInfo->detail.sourceInfo.filename)
+ tui_free_win_content (generic_win);
+ if (win_info->detail.source_info.filename)
{
- xfree (winInfo->detail.sourceInfo.filename);
- winInfo->detail.sourceInfo.filename = 0;
+ xfree (win_info->detail.source_info.filename);
+ win_info->detail.source_info.filename = 0;
}
- genericWin = winInfo->detail.sourceInfo.executionInfo;
- if (genericWin != (TuiGenWinInfoPtr) NULL)
+ generic_win = win_info->detail.source_info.execution_info;
+ if (generic_win != (struct tui_gen_win_info *) NULL)
{
- tuiDelwin (genericWin->handle);
- genericWin->handle = (WINDOW *) NULL;
- freeWinContent (genericWin);
+ tui_delete_win (generic_win->handle);
+ generic_win->handle = (WINDOW *) NULL;
+ tui_free_win_content (generic_win);
}
break;
case DATA_WIN:
- if (winInfo->generic.content != (OpaquePtr) NULL)
+ if (win_info->generic.content != NULL)
{
- freeDataContent (
- winInfo->detail.dataDisplayInfo.regsContent,
- winInfo->detail.dataDisplayInfo.regsContentCount);
- winInfo->detail.dataDisplayInfo.regsContent =
- (TuiWinContent) NULL;
- winInfo->detail.dataDisplayInfo.regsContentCount = 0;
- freeDataContent (
- winInfo->detail.dataDisplayInfo.dataContent,
- winInfo->detail.dataDisplayInfo.dataContentCount);
- winInfo->detail.dataDisplayInfo.dataContent =
- (TuiWinContent) NULL;
- winInfo->detail.dataDisplayInfo.dataContentCount = 0;
- winInfo->detail.dataDisplayInfo.regsDisplayType =
+ tui_free_data_content (win_info->detail.data_display_info.regs_content,
+ win_info->detail.data_display_info.regs_content_count);
+ win_info->detail.data_display_info.regs_content =
+ (tui_win_content) NULL;
+ win_info->detail.data_display_info.regs_content_count = 0;
+ tui_free_data_content (win_info->detail.data_display_info.data_content,
+ win_info->detail.data_display_info.data_content_count);
+ win_info->detail.data_display_info.data_content =
+ (tui_win_content) NULL;
+ win_info->detail.data_display_info.data_content_count = 0;
+ win_info->detail.data_display_info.regs_display_type =
TUI_UNDEFINED_REGS;
- winInfo->detail.dataDisplayInfo.regsColumnCount = 1;
- winInfo->detail.dataDisplayInfo.displayRegs = FALSE;
- winInfo->generic.content = (OpaquePtr) NULL;
- winInfo->generic.contentSize = 0;
+ win_info->detail.data_display_info.regs_column_count = 1;
+ win_info->detail.data_display_info.display_regs = FALSE;
+ win_info->generic.content = NULL;
+ win_info->generic.content_size = 0;
}
break;
default:
break;
}
- if (winInfo->generic.handle != (WINDOW *) NULL)
+ if (win_info->generic.handle != (WINDOW *) NULL)
{
- tuiDelwin (winInfo->generic.handle);
- winInfo->generic.handle = (WINDOW *) NULL;
- freeWinContent (&winInfo->generic);
+ tui_delete_win (win_info->generic.handle);
+ win_info->generic.handle = (WINDOW *) NULL;
+ tui_free_win_content (&win_info->generic);
}
- if (winInfo->generic.title)
- xfree (winInfo->generic.title);
- xfree (winInfo);
+ if (win_info->generic.title)
+ xfree (win_info->generic.title);
+ xfree (win_info);
}
-/*
- ** freeAllSourceWinsContent().
- */
void
-freeAllSourceWinsContent (void)
+tui_free_all_source_wins_content (void)
{
int i;
- for (i = 0; i < (sourceWindows ())->count; i++)
+ for (i = 0; i < (tui_source_windows ())->count; i++)
{
- TuiWinInfoPtr winInfo = (TuiWinInfoPtr) (sourceWindows ())->list[i];
+ struct tui_win_info * win_info = (struct tui_win_info *) (tui_source_windows ())->list[i];
- if (m_winPtrNotNull (winInfo))
+ if (win_info != NULL)
{
- freeWinContent (&(winInfo->generic));
- freeWinContent (winInfo->detail.sourceInfo.executionInfo);
+ tui_free_win_content (&(win_info->generic));
+ tui_free_win_content (win_info->detail.source_info.execution_info);
}
}
-
- return;
-} /* freeAllSourceWinsContent */
+}
-/*
- ** freeWinContent().
- */
void
-freeWinContent (TuiGenWinInfoPtr winInfo)
+tui_free_win_content (struct tui_gen_win_info * win_info)
{
- if (winInfo->content != (OpaquePtr) NULL)
+ if (win_info->content != NULL)
{
- freeContent ((TuiWinContent) winInfo->content,
- winInfo->contentSize,
- winInfo->type);
- winInfo->content = (OpaquePtr) NULL;
+ free_content ((tui_win_content) win_info->content,
+ win_info->content_size,
+ win_info->type);
+ win_info->content = NULL;
}
- winInfo->contentSize = 0;
-
- return;
-} /* freeWinContent */
+ win_info->content_size = 0;
+}
void
-tuiDelDataWindows (TuiWinContent content, int contentSize)
+tui_del_data_windows (tui_win_content content, int content_size)
{
int i;
/*
- ** Remember that data window content elements are of type TuiGenWinInfoPtr,
+ ** Remember that data window content elements are of type struct tui_gen_win_info *,
** each of which whose single element is a data element.
*/
- for (i = 0; i < contentSize; i++)
+ for (i = 0; i < content_size; i++)
{
- TuiGenWinInfoPtr genericWin = &content[i]->whichElement.dataWindow;
+ struct tui_gen_win_info * generic_win = &content[i]->which_element.data_window;
- if (genericWin != (TuiGenWinInfoPtr) NULL)
+ if (generic_win != (struct tui_gen_win_info *) NULL)
{
- tuiDelwin (genericWin->handle);
- genericWin->handle = (WINDOW *) NULL;
- genericWin->isVisible = FALSE;
+ tui_delete_win (generic_win->handle);
+ generic_win->handle = (WINDOW *) NULL;
+ generic_win->is_visible = FALSE;
}
}
-
- return;
-} /* tuiDelDataWindows */
+}
void
-freeDataContent (TuiWinContent content, int contentSize)
+tui_free_data_content (tui_win_content content, int content_size)
{
int i;
/*
- ** Remember that data window content elements are of type TuiGenWinInfoPtr,
+ ** Remember that data window content elements are of type struct tui_gen_win_info *,
** each of which whose single element is a data element.
*/
- for (i = 0; i < contentSize; i++)
+ for (i = 0; i < content_size; i++)
{
- TuiGenWinInfoPtr genericWin = &content[i]->whichElement.dataWindow;
+ struct tui_gen_win_info * generic_win = &content[i]->which_element.data_window;
- if (genericWin != (TuiGenWinInfoPtr) NULL)
+ if (generic_win != (struct tui_gen_win_info *) NULL)
{
- tuiDelwin (genericWin->handle);
- genericWin->handle = (WINDOW *) NULL;
- freeWinContent (genericWin);
+ tui_delete_win (generic_win->handle);
+ generic_win->handle = (WINDOW *) NULL;
+ tui_free_win_content (generic_win);
}
}
- freeContent (content,
- contentSize,
+ free_content (content,
+ content_size,
DATA_WIN);
-
- return;
-} /* freeDataContent */
+}
/**********************************
@@ -981,65 +856,58 @@ freeDataContent (TuiWinContent content, int contentSize)
**********************************/
-/*
- ** freeContent().
- */
static void
-freeContent (TuiWinContent content, int contentSize, TuiWinType winType)
+free_content (tui_win_content content, int content_size, enum tui_win_type win_type)
{
- if (content != (TuiWinContent) NULL)
+ if (content != (tui_win_content) NULL)
{
- freeContentElements (content, contentSize, winType);
- tuiFree ((char *) content);
+ free_content_elements (content, content_size, win_type);
+ xfree (content);
}
-
- return;
-} /* freeContent */
+}
/*
- ** freeContentElements().
+ ** free_content_elements().
*/
static void
-freeContentElements (TuiWinContent content, int contentSize, TuiWinType type)
+free_content_elements (tui_win_content content, int content_size, enum tui_win_type type)
{
- if (content != (TuiWinContent) NULL)
+ if (content != (tui_win_content) NULL)
{
int i;
if (type == SRC_WIN || type == DISASSEM_WIN)
{
/* free whole source block */
- if (content[0]->whichElement.source.line != (char *) NULL)
- tuiFree (content[0]->whichElement.source.line);
+ xfree (content[0]->which_element.source.line);
}
else
{
- for (i = 0; i < contentSize; i++)
+ for (i = 0; i < content_size; i++)
{
- TuiWinElementPtr element;
+ struct tui_win_element * element;
element = content[i];
- if (element != (TuiWinElementPtr) NULL)
+ if (element != (struct tui_win_element *) NULL)
{
switch (type)
{
case DATA_WIN:
- tuiFree ((char *) element);
+ xfree (element);
break;
case DATA_ITEM_WIN:
/*
** Note that data elements are not allocated
** in a single block, but individually, as needed.
*/
- if (element->whichElement.data.type != TUI_REGISTER)
- tuiFree ((char *)
- element->whichElement.data.name);
- tuiFree ((char *) element->whichElement.data.value);
- tuiFree ((char *) element);
+ if (element->which_element.data.type != TUI_REGISTER)
+ xfree ((void *)element->which_element.data.name);
+ xfree (element->which_element.data.value);
+ xfree (element);
break;
case CMD_WIN:
- tuiFree ((char *) element->whichElement.command.line);
+ xfree (element->which_element.command.line);
break;
default:
break;
@@ -1048,8 +916,6 @@ freeContentElements (TuiWinContent content, int contentSize, TuiWinType type)
}
}
if (type != DATA_WIN && type != DATA_ITEM_WIN)
- tuiFree ((char *) content[0]); /* free the element block */
+ xfree (content[0]); /* free the element block */
}
-
- return;
-} /* freeContentElements */
+}
diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h
index ea7c786..dd8c230 100644
--- a/gdb/tui/tui-data.h
+++ b/gdb/tui/tui-data.h
@@ -25,29 +25,31 @@
#ifndef TUI_DATA_H
#define TUI_DATA_H
-#if defined (HAVE_NCURSES_H)
-#include <ncurses.h>
-#elif defined (HAVE_CURSES_H)
-#include <curses.h>
-#endif
+#include "tui/tui.h" /* For enum tui_win_type. */
+#include "gdb_curses.h" /* For WINDOW. */
+
+/* This is a point definition. */
+struct tui_point
+{
+ int x, y;
+};
/* Generic window information */
- typedef struct _TuiGenWinInfo
- {
- WINDOW *handle; /* window handle */
- TuiWinType type; /* type of window */
- int width; /* window width */
- int height; /* window height */
- TuiPoint origin; /* origin of window */
- OpaquePtr content; /* content of window */
- int contentSize; /* Size of content (# of elements) */
- int contentInUse; /* Can it be used, or is it already used? */
- int viewportHeight; /* viewport height */
- int lastVisibleLine; /* index of last visible line */
- int isVisible; /* whether the window is visible or not */
- char* title; /* Window title to display. */
- }
-TuiGenWinInfo, *TuiGenWinInfoPtr;
+struct tui_gen_win_info
+{
+ WINDOW *handle; /* window handle */
+ enum tui_win_type type; /* type of window */
+ int width; /* window width */
+ int height; /* window height */
+ struct tui_point origin; /* origin of window */
+ void **content; /* content of window */
+ int content_size; /* Size of content (# of elements) */
+ int content_in_use; /* Can it be used, or is it already used? */
+ int viewport_height; /* viewport height */
+ int last_visible_line; /* index of last visible line */
+ int is_visible; /* whether the window is visible or not */
+ char *title; /* Window title to display. */
+};
/* Constant definitions */
#define DEFAULT_TAB_LEN 8
@@ -95,120 +97,109 @@ TuiGenWinInfo, *TuiGenWinInfoPtr;
#define TUI_GENERAL_SPECIAL_REGS_NAME "$REGS"
#define TUI_GENERAL_SPECIAL_REGS_NAME_LOWER "$regs"
-/* Scroll direction enum */
-typedef enum tui_scroll_direction
- {
- FORWARD_SCROLL,
- BACKWARD_SCROLL,
- LEFT_SCROLL,
- RIGHT_SCROLL
- }
-TuiScrollDirection, *TuiScrollDirectionPtr;
+/* Scroll direction enum. */
+enum tui_scroll_direction
+{
+ FORWARD_SCROLL,
+ BACKWARD_SCROLL,
+ LEFT_SCROLL,
+ RIGHT_SCROLL
+};
-/* General list struct */
-typedef struct _TuiList
- {
- OpaqueList list;
- int count;
- }
-TuiList, *TuiListPtr;
+/* General list struct. */
+struct tui_list
+{
+ void **list;
+ int count;
+};
/* The kinds of layouts available */
-typedef enum
- {
- SRC_COMMAND,
- DISASSEM_COMMAND,
- SRC_DISASSEM_COMMAND,
- SRC_DATA_COMMAND,
- DISASSEM_DATA_COMMAND,
- UNDEFINED_LAYOUT
- }
-TuiLayoutType, *TuiLayoutTypePtr;
+enum tui_layout_type
+{
+ SRC_COMMAND,
+ DISASSEM_COMMAND,
+ SRC_DISASSEM_COMMAND,
+ SRC_DATA_COMMAND,
+ DISASSEM_DATA_COMMAND,
+ UNDEFINED_LAYOUT
+};
/* Basic data types that can be displayed in the data window. */
-typedef enum _TuiDataType
- {
- TUI_REGISTER,
- TUI_SCALAR,
- TUI_COMPLEX,
- TUI_STRUCT
- }
-TuiDataType, TuiDataTypePtr;
+enum tui_data_type
+{
+ TUI_REGISTER,
+ TUI_SCALAR,
+ TUI_COMPLEX,
+ TUI_STRUCT
+};
/* Types of register displays */
-typedef enum tui_register_display_type
- {
- TUI_UNDEFINED_REGS,
- TUI_GENERAL_REGS,
- TUI_SFLOAT_REGS,
- TUI_DFLOAT_REGS,
- TUI_SPECIAL_REGS,
- TUI_GENERAL_AND_SPECIAL_REGS
- }
-TuiRegisterDisplayType, *TuiRegisterDisplayTypePtr;
+enum tui_register_display_type
+{
+ TUI_UNDEFINED_REGS,
+ TUI_GENERAL_REGS,
+ TUI_SFLOAT_REGS,
+ TUI_DFLOAT_REGS,
+ TUI_SPECIAL_REGS,
+ TUI_GENERAL_AND_SPECIAL_REGS
+};
/* Structure describing source line or line address */
-typedef union _TuiLineOrAddress
- {
- int lineNo;
- CORE_ADDR addr;
- }
-TuiLineOrAddress, *TuiLineOrAddressPtr;
+union tui_line_or_address
+{
+ int line_no;
+ CORE_ADDR addr;
+};
/* Current Layout definition */
-typedef struct _TuiLayoutDef
- {
- TuiWinType displayMode;
- int split;
- TuiRegisterDisplayType regsDisplayType;
- TuiRegisterDisplayType floatRegsDisplayType;
- }
-TuiLayoutDef, *TuiLayoutDefPtr;
+struct tui_layout_def
+{
+ enum tui_win_type display_mode;
+ int split;
+ enum tui_register_display_type regs_display_type;
+ enum tui_register_display_type float_regs_display_type;
+};
/* Elements in the Source/Disassembly Window */
-typedef struct _TuiSourceElement
- {
- char *line;
- TuiLineOrAddress lineOrAddr;
- int isExecPoint;
- int hasBreak;
- }
-TuiSourceElement, *TuiSourceElementPtr;
+struct tui_source_element
+{
+ char *line;
+ union tui_line_or_address line_or_addr;
+ int is_exec_point;
+ int has_break;
+};
/* Elements in the data display window content */
-typedef struct _TuiDataElement
- {
- const char *name;
- int itemNo; /* the register number, or data display number */
- TuiDataType type;
- Opaque value;
- int highlight;
- }
-TuiDataElement, *TuiDataElementPtr;
+struct tui_data_element
+{
+ const char *name;
+ int item_no; /* the register number, or data display number */
+ enum tui_data_type type;
+ void *value;
+ int highlight;
+};
/* Elements in the command window content */
-typedef struct _TuiCommandElement
- {
- char *line;
- }
-TuiCommandElement, *TuiCommandElementPtr;
+struct tui_command_element
+{
+ char *line;
+};
#define MAX_LOCATOR_ELEMENT_LEN 100
/* Elements in the locator window content */
-typedef struct _TuiLocatorElement
- {
- char fileName[MAX_LOCATOR_ELEMENT_LEN];
- char procName[MAX_LOCATOR_ELEMENT_LEN];
- int lineNo;
- CORE_ADDR addr;
- }
-TuiLocatorElement, *TuiLocatorElementPtr;
+struct tui_locator_element
+{
+ char file_name[MAX_LOCATOR_ELEMENT_LEN];
+ char proc_name[MAX_LOCATOR_ELEMENT_LEN];
+ int line_no;
+ CORE_ADDR addr;
+};
/* Flags to tell what kind of breakpoint is at current line. */
#define TUI_BP_ENABLED 0x01
@@ -223,164 +214,136 @@ TuiLocatorElement, *TuiLocatorElementPtr;
#define TUI_EXEC_POS 2
#define TUI_EXECINFO_SIZE 4
-typedef char TuiExecInfoContent[TUI_EXECINFO_SIZE];
+typedef char tui_exec_info_content[TUI_EXECINFO_SIZE];
/* An content element in a window */
-typedef union
- {
- TuiSourceElement source; /* the source elements */
- TuiGenWinInfo dataWindow; /* data display elements */
- TuiDataElement data; /* elements of dataWindow */
- TuiCommandElement command; /* command elements */
- TuiLocatorElement locator; /* locator elements */
- TuiExecInfoContent simpleString; /* simple char based elements */
- }
-TuiWhichElement, *TuiWhichElementPtr;
-
-typedef struct _TuiWinElement
- {
- int highlight;
- TuiWhichElement whichElement;
- }
-TuiWinElement, *TuiWinElementPtr;
+union tui_which_element
+{
+ struct tui_source_element source; /* the source elements */
+ struct tui_gen_win_info data_window; /* data display elements */
+ struct tui_data_element data; /* elements of data_window */
+ struct tui_command_element command; /* command elements */
+ struct tui_locator_element locator; /* locator elements */
+ tui_exec_info_content simple_string; /* simple char based elements */
+};
+
+struct tui_win_element
+{
+ int highlight;
+ union tui_which_element which_element;
+};
/* This describes the content of the window. */
-typedef TuiWinElementPtr *TuiWinContent;
+typedef struct tui_win_element **tui_win_content;
/* This struct defines the specific information about a data display window */
-typedef struct _TuiDataInfo
- {
- TuiWinContent dataContent; /* start of data display content */
- int dataContentCount;
- TuiWinContent regsContent; /* start of regs display content */
- int regsContentCount;
- TuiRegisterDisplayType regsDisplayType;
- int regsColumnCount;
- int displayRegs; /* Should regs be displayed at all? */
- }
-TuiDataInfo, *TuiDataInfoPtr;
-
-
-typedef struct _TuiSourceInfo
- {
- int hasLocator; /* Does locator belongs to this window? */
- TuiGenWinInfoPtr executionInfo; /* execution information window */
- int horizontalOffset; /* used for horizontal scroll */
- TuiLineOrAddress startLineOrAddr;
- char* filename;
- }
-TuiSourceInfo, *TuiSourceInfoPtr;
-
-
-typedef struct _TuiCommandInfo
- {
- int curLine; /* The current line position */
- int curch; /* The current cursor position */
- int start_line;
- }
-TuiCommandInfo, *TuiCommandInfoPtr;
+struct tui_data_info
+{
+ tui_win_content data_content; /* start of data display content */
+ int data_content_count;
+ tui_win_content regs_content; /* start of regs display content */
+ int regs_content_count;
+ enum tui_register_display_type regs_display_type;
+ int regs_column_count;
+ int display_regs; /* Should regs be displayed at all? */
+};
+
+
+struct tui_source_info
+{
+ int has_locator; /* Does locator belongs to this window? */
+ /* Execution information window. */
+ struct tui_gen_win_info *execution_info;
+ int horizontal_offset; /* used for horizontal scroll */
+ union tui_line_or_address start_line_or_addr;
+ char* filename;
+};
+
+
+struct tui_command_info
+{
+ int cur_line; /* The current line position */
+ int curch; /* The current cursor position */
+ int start_line;
+};
/* This defines information about each logical window */
-typedef struct _TuiWinInfo
+struct tui_win_info
+{
+ struct tui_gen_win_info generic; /* general window information */
+ union
{
- TuiGenWinInfo generic; /* general window information */
- union
- {
- TuiSourceInfo sourceInfo;
- TuiDataInfo dataDisplayInfo;
- TuiCommandInfo commandInfo;
- Opaque opaque;
- }
- detail;
- int canHighlight; /* Can this window ever be highlighted? */
- int isHighlighted; /* Is this window highlighted? */
+ struct tui_source_info source_info;
+ struct tui_data_info data_display_info;
+ struct tui_command_info command_info;
+ void *opaque;
}
-TuiWinInfo, *TuiWinInfoPtr;
-
-/* MACROS (prefixed with m_) */
-
-/* Testing macros */
-#define m_genWinPtrIsNull(winInfo) \
- ((winInfo) == (TuiGenWinInfoPtr)NULL)
-#define m_genWinPtrNotNull(winInfo) \
- ((winInfo) != (TuiGenWinInfoPtr)NULL)
-#define m_winPtrIsNull(winInfo) \
- ((winInfo) == (TuiWinInfoPtr)NULL)
-#define m_winPtrNotNull(winInfo) \
- ((winInfo) != (TuiWinInfoPtr)NULL)
-
-#define m_winIsSourceType(type) \
- (type == SRC_WIN || type == DISASSEM_WIN)
-#define m_winIsAuxillary(winType) \
- (winType > MAX_MAJOR_WINDOWS)
-#define m_hasLocator(winInfo) \
- ( ((winInfo) != (TuiWinInfoPtr)NULL) ? \
- (winInfo->detail.sourceInfo.hasLocator) : \
- FALSE )
-
-#define m_setWinHighlightOn(winInfo) \
- if ((winInfo) != (TuiWinInfoPtr)NULL) \
- (winInfo)->isHighlighted = TRUE
-#define m_setWinHighlightOff(winInfo) \
- if ((winInfo) != (TuiWinInfoPtr)NULL) \
- (winInfo)->isHighlighted = FALSE
+ detail;
+ int can_highlight; /* Can this window ever be highlighted? */
+ int is_highlighted; /* Is this window highlighted? */
+};
+
+extern int tui_win_is_source_type (enum tui_win_type win_type);
+extern int tui_win_is_auxillary (enum tui_win_type win_type);
+extern int tui_win_has_locator (struct tui_win_info *win_info);
+extern void tui_set_win_highlight (struct tui_win_info *win_info,
+ int highlight);
/* Global Data */
-extern TuiWinInfoPtr winList[MAX_MAJOR_WINDOWS];
+extern struct tui_win_info *(tui_win_list[MAX_MAJOR_WINDOWS]);
-/* Macros */
-#define srcWin winList[SRC_WIN]
-#define disassemWin winList[DISASSEM_WIN]
-#define dataWin winList[DATA_WIN]
-#define cmdWin winList[CMD_WIN]
+#define TUI_SRC_WIN tui_win_list[SRC_WIN]
+#define TUI_DISASM_WIN tui_win_list[DISASSEM_WIN]
+#define TUI_DATA_WIN tui_win_list[DATA_WIN]
+#define TUI_CMD_WIN tui_win_list[CMD_WIN]
/* Data Manipulation Functions */
-extern void initializeStaticData (void);
-extern TuiGenWinInfoPtr allocGenericWinInfo (void);
-extern TuiWinInfoPtr allocWinInfo (TuiWinType);
-extern void initGenericPart (TuiGenWinInfoPtr);
-extern void initWinInfo (TuiWinInfoPtr);
-extern TuiWinContent allocContent (int, TuiWinType);
-extern int addContentElements (TuiGenWinInfoPtr, int);
-extern void initContentElement (TuiWinElementPtr, TuiWinType);
-extern void freeWindow (TuiWinInfoPtr);
-extern void freeWinContent (TuiGenWinInfoPtr);
-extern void freeDataContent (TuiWinContent, int);
-extern void freeAllSourceWinsContent (void);
-extern void tuiDelWindow (TuiWinInfoPtr);
-extern void tuiDelDataWindows (TuiWinContent, int);
-extern TuiWinInfoPtr partialWinByName (char *);
-extern char *winName (TuiGenWinInfoPtr);
-extern TuiLayoutType currentLayout (void);
-extern void setCurrentLayoutTo (TuiLayoutType);
-extern int termHeight (void);
-extern void setTermHeightTo (int);
-extern int termWidth (void);
-extern void setTermWidthTo (int);
-extern void setGenWinOrigin (TuiGenWinInfoPtr, int, int);
-extern TuiGenWinInfoPtr locatorWinInfoPtr (void);
-extern TuiGenWinInfoPtr sourceExecInfoWinPtr (void);
-extern TuiGenWinInfoPtr disassemExecInfoWinPtr (void);
-extern TuiListPtr sourceWindows (void);
-extern void clearSourceWindows (void);
-extern void clearSourceWindowsDetail (void);
-extern void clearWinDetail (TuiWinInfoPtr winInfo);
-extern void tuiAddToSourceWindows (TuiWinInfoPtr);
-extern int tuiDefaultTabLen (void);
-extern void tuiSetDefaultTabLen (int);
-extern TuiWinInfoPtr tuiWinWithFocus (void);
-extern void tuiSetWinWithFocus (TuiWinInfoPtr);
-extern TuiLayoutDefPtr tuiLayoutDef (void);
-extern int tuiWinResized (void);
-extern void tuiSetWinResizedTo (int);
-
-extern TuiWinInfoPtr tuiNextWin (TuiWinInfoPtr);
-extern TuiWinInfoPtr tuiPrevWin (TuiWinInfoPtr);
-
-extern void addToSourceWindows (TuiWinInfoPtr winInfo);
+extern void tui_initialize_static_data (void);
+extern struct tui_gen_win_info *tui_alloc_generic_win_info (void);
+extern struct tui_win_info *tui_alloc_win_info (enum tui_win_type);
+extern void tui_init_generic_part (struct tui_gen_win_info *);
+extern void tui_init_win_info (struct tui_win_info *);
+extern tui_win_content tui_alloc_content (int, enum tui_win_type);
+extern int tui_add_content_elements (struct tui_gen_win_info *, int);
+extern void tui_init_content_element (struct tui_win_element *, enum tui_win_type);
+extern void tui_free_window (struct tui_win_info *);
+extern void tui_free_win_content (struct tui_gen_win_info *);
+extern void tui_free_data_content (tui_win_content, int);
+extern void tui_free_all_source_wins_content (void);
+extern void tui_del_window (struct tui_win_info *);
+extern void tui_del_data_windows (tui_win_content, int);
+extern struct tui_win_info *tui_partial_win_by_name (char *);
+extern char *tui_win_name (struct tui_gen_win_info *);
+extern enum tui_layout_type tui_current_layout (void);
+extern void tui_set_current_layout_to (enum tui_layout_type);
+extern int tui_term_height (void);
+extern void tui_set_term_height_to (int);
+extern int tui_term_width (void);
+extern void tui_set_term_width_to (int);
+extern void tui_set_gen_win_origin (struct tui_gen_win_info *, int, int);
+extern struct tui_gen_win_info *tui_locator_win_info_ptr (void);
+extern struct tui_gen_win_info *tui_source_exec_info_win_ptr (void);
+extern struct tui_gen_win_info *tui_disassem_exec_info_win_ptr (void);
+extern struct tui_list * tui_source_windows (void);
+extern void tui_clear_source_windows (void);
+extern void tui_clear_source_windows_detail (void);
+extern void tui_clear_win_detail (struct tui_win_info * win_info);
+extern void tui_add_to_source_windows (struct tui_win_info *);
+extern int tui_default_tab_len (void);
+extern void tui_set_default_tab_len (int);
+extern struct tui_win_info *tui_win_with_focus (void);
+extern void tui_set_win_with_focus (struct tui_win_info *);
+extern struct tui_layout_def * tui_layout_def (void);
+extern int tui_win_resized (void);
+extern void tui_set_win_resized_to (int);
+
+extern struct tui_win_info *tui_next_win (struct tui_win_info *);
+extern struct tui_win_info *tui_prev_win (struct tui_win_info *);
+
+extern void tui_add_to_source_windows (struct tui_win_info * win_info);
#endif /* TUI_DATA_H */
diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c
index 99143a4..19226b3 100644
--- a/gdb/tui/tui-disasm.c
+++ b/gdb/tui/tui-disasm.c
@@ -29,7 +29,7 @@
#include "value.h"
#include "source.h"
#include "disasm.h"
-
+#include "gdb_string.h"
#include "tui/tui.h"
#include "tui/tui-data.h"
#include "tui/tui-win.h"
@@ -38,13 +38,7 @@
#include "tui/tui-stack.h"
#include "tui/tui-file.h"
-#ifdef HAVE_NCURSES_H
-#include <ncurses.h>
-#else
-#ifdef HAVE_CURSES_H
-#include <curses.h>
-#endif
-#endif
+#include "gdb_curses.h"
struct tui_asm_line
{
@@ -95,24 +89,24 @@ tui_disassemble (struct tui_asm_line* lines, CORE_ADDR pc, int count)
static CORE_ADDR
tui_find_disassembly_address (CORE_ADDR pc, int from)
{
- register CORE_ADDR newLow;
- int maxLines;
+ CORE_ADDR new_low;
+ int max_lines;
int i;
struct tui_asm_line* lines;
- maxLines = (from > 0) ? from : - from;
- if (maxLines <= 1)
+ max_lines = (from > 0) ? from : - from;
+ if (max_lines <= 1)
return pc;
lines = (struct tui_asm_line*) alloca (sizeof (struct tui_asm_line)
- * maxLines);
- memset (lines, 0, sizeof (struct tui_asm_line) * maxLines);
+ * max_lines);
+ memset (lines, 0, sizeof (struct tui_asm_line) * max_lines);
- newLow = pc;
+ new_low = pc;
if (from > 0)
{
- tui_disassemble (lines, pc, maxLines);
- newLow = lines[maxLines - 1].addr;
+ tui_disassemble (lines, pc, max_lines);
+ new_low = lines[max_lines - 1].addr;
}
else
{
@@ -123,17 +117,17 @@ tui_find_disassembly_address (CORE_ADDR pc, int from)
/* Find backward an address which is a symbol
and for which disassembling from that address will fill
completely the window. */
- pos = maxLines - 1;
+ pos = max_lines - 1;
do {
- newLow -= 1 * maxLines;
- msymbol = lookup_minimal_symbol_by_pc_section (newLow, 0);
+ new_low -= 1 * max_lines;
+ msymbol = lookup_minimal_symbol_by_pc_section (new_low, 0);
if (msymbol)
- newLow = SYMBOL_VALUE_ADDRESS (msymbol);
+ new_low = SYMBOL_VALUE_ADDRESS (msymbol);
else
- newLow += 1 * maxLines;
+ new_low += 1 * max_lines;
- tui_disassemble (lines, newLow, maxLines);
+ tui_disassemble (lines, new_low, max_lines);
last_addr = lines[pos].addr;
} while (last_addr > pc && msymbol);
@@ -148,7 +142,7 @@ tui_find_disassembly_address (CORE_ADDR pc, int from)
CORE_ADDR next_addr;
pos++;
- if (pos >= maxLines)
+ if (pos >= max_lines)
pos = 0;
next_addr = tui_disassemble (&lines[pos], last_addr, 1);
@@ -159,29 +153,29 @@ tui_find_disassembly_address (CORE_ADDR pc, int from)
last_addr = next_addr;
} while (last_addr <= pc);
pos++;
- if (pos >= maxLines)
+ if (pos >= max_lines)
pos = 0;
- newLow = lines[pos].addr;
+ new_low = lines[pos].addr;
}
- for (i = 0; i < maxLines; i++)
+ for (i = 0; i < max_lines; i++)
{
xfree (lines[i].addr_string);
xfree (lines[i].insn);
}
- return newLow;
+ return new_low;
}
/* Function to set the disassembly window's content. */
enum tui_status
tui_set_disassem_content (CORE_ADDR pc)
{
- TuiStatus ret = TUI_FAILURE;
- register int i;
- register int offset = disassemWin->detail.sourceInfo.horizontalOffset;
- register int lineWidth, maxLines;
+ enum tui_status ret = TUI_FAILURE;
+ int i;
+ int offset = TUI_DISASM_WIN->detail.source_info.horizontal_offset;
+ int line_width, max_lines;
CORE_ADDR cur_pc;
- TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
- int tab_len = tuiDefaultTabLen ();
+ struct tui_gen_win_info * locator = tui_locator_win_info_ptr ();
+ int tab_len = tui_default_tab_len ();
struct tui_asm_line* lines;
int insn_pos;
int addr_size, max_size;
@@ -190,29 +184,29 @@ tui_set_disassem_content (CORE_ADDR pc)
if (pc == 0)
return TUI_FAILURE;
- ret = tuiAllocSourceBuffer (disassemWin);
+ ret = tui_alloc_source_buffer (TUI_DISASM_WIN);
if (ret != TUI_SUCCESS)
return ret;
- disassemWin->detail.sourceInfo.startLineOrAddr.addr = pc;
+ TUI_DISASM_WIN->detail.source_info.start_line_or_addr.addr = pc;
cur_pc = (CORE_ADDR)
- (((TuiWinElementPtr) locator->content[0])->whichElement.locator.addr);
+ (((struct tui_win_element *) locator->content[0])->which_element.locator.addr);
- maxLines = disassemWin->generic.height - 2; /* account for hilite */
+ max_lines = TUI_DISASM_WIN->generic.height - 2; /* account for hilite */
/* Get temporary table that will hold all strings (addr & insn). */
lines = (struct tui_asm_line*) alloca (sizeof (struct tui_asm_line)
- * maxLines);
- memset (lines, 0, sizeof (struct tui_asm_line) * maxLines);
+ * max_lines);
+ memset (lines, 0, sizeof (struct tui_asm_line) * max_lines);
- lineWidth = disassemWin->generic.width - 1;
+ line_width = TUI_DISASM_WIN->generic.width - 1;
- tui_disassemble (lines, pc, maxLines);
+ tui_disassemble (lines, pc, max_lines);
/* See what is the maximum length of an address and of a line. */
addr_size = 0;
max_size = 0;
- for (i = 0; i < maxLines; i++)
+ for (i = 0; i < max_lines; i++)
{
size_t len = strlen (lines[i].addr_string);
if (len > addr_size)
@@ -229,22 +223,22 @@ tui_set_disassem_content (CORE_ADDR pc)
insn_pos = (1 + (addr_size / tab_len)) * tab_len;
/* Now construct each line */
- for (i = 0; i < maxLines; i++)
+ for (i = 0; i < max_lines; i++)
{
- TuiWinElementPtr element;
- TuiSourceElement* src;
- int curLen;
+ struct tui_win_element * element;
+ struct tui_source_element* src;
+ int cur_len;
- element = (TuiWinElementPtr) disassemWin->generic.content[i];
- src = &element->whichElement.source;
+ element = (struct tui_win_element *) TUI_DISASM_WIN->generic.content[i];
+ src = &element->which_element.source;
strcpy (line, lines[i].addr_string);
- curLen = strlen (line);
+ cur_len = strlen (line);
/* Add spaces to make the instructions start on the same column */
- while (curLen < insn_pos)
+ while (cur_len < insn_pos)
{
strcat (line, " ");
- curLen++;
+ cur_len++;
}
strcat (line, lines[i].insn);
@@ -255,38 +249,38 @@ tui_set_disassem_content (CORE_ADDR pc)
else
src->line[0] = '\0';
- src->lineOrAddr.addr = lines[i].addr;
- src->isExecPoint = lines[i].addr == cur_pc;
+ src->line_or_addr.addr = lines[i].addr;
+ src->is_exec_point = lines[i].addr == cur_pc;
/* See whether there is a breakpoint installed. */
- src->hasBreak = (!src->isExecPoint
+ src->has_break = (!src->is_exec_point
&& breakpoint_here_p (pc) != no_breakpoint_here);
xfree (lines[i].addr_string);
xfree (lines[i].insn);
}
- disassemWin->generic.contentSize = i;
+ TUI_DISASM_WIN->generic.content_size = i;
return TUI_SUCCESS;
}
/* Function to display the disassembly window with disassembled code. */
void
-tui_show_disassem (CORE_ADDR startAddr)
+tui_show_disassem (CORE_ADDR start_addr)
{
- struct symtab *s = find_pc_symtab (startAddr);
- TuiWinInfoPtr winWithFocus = tuiWinWithFocus ();
- TuiLineOrAddress val;
+ struct symtab *s = find_pc_symtab (start_addr);
+ struct tui_win_info * win_with_focus = tui_win_with_focus ();
+ union tui_line_or_address val;
- val.addr = startAddr;
- tuiAddWinToLayout (DISASSEM_WIN);
- tuiUpdateSourceWindow (disassemWin, s, val, FALSE);
+ val.addr = start_addr;
+ tui_add_win_to_layout (DISASSEM_WIN);
+ tui_update_source_window (TUI_DISASM_WIN, s, val, FALSE);
/*
** if the focus was in the src win, put it in the asm win, if the
** source view isn't split
*/
- if (currentLayout () != SRC_DISASSEM_COMMAND && winWithFocus == srcWin)
- tuiSetWinFocusTo (disassemWin);
+ if (tui_current_layout () != SRC_DISASSEM_COMMAND && win_with_focus == TUI_SRC_WIN)
+ tui_set_win_focus_to (TUI_DISASM_WIN);
return;
}
@@ -294,29 +288,29 @@ tui_show_disassem (CORE_ADDR startAddr)
/* Function to display the disassembly window. */
void
-tui_show_disassem_and_update_source (CORE_ADDR startAddr)
+tui_show_disassem_and_update_source (CORE_ADDR start_addr)
{
struct symtab_and_line sal;
- tui_show_disassem (startAddr);
- if (currentLayout () == SRC_DISASSEM_COMMAND)
+ tui_show_disassem (start_addr);
+ if (tui_current_layout () == SRC_DISASSEM_COMMAND)
{
- TuiLineOrAddress val;
+ union tui_line_or_address val;
/*
** Update what is in the source window if it is displayed too,
** note that it follows what is in the disassembly window and visa-versa
*/
- sal = find_pc_line (startAddr, 0);
- val.lineNo = sal.line;
- tuiUpdateSourceWindow (srcWin, sal.symtab, val, TRUE);
+ sal = find_pc_line (start_addr, 0);
+ val.line_no = sal.line;
+ tui_update_source_window (TUI_SRC_WIN, sal.symtab, val, TRUE);
if (sal.symtab)
{
set_current_source_symtab_and_line (&sal);
- tuiUpdateLocatorFilename (sal.symtab->filename);
+ tui_update_locator_filename (sal.symtab->filename);
}
else
- tuiUpdateLocatorFilename ("?");
+ tui_update_locator_filename ("?");
}
return;
@@ -325,12 +319,12 @@ tui_show_disassem_and_update_source (CORE_ADDR startAddr)
CORE_ADDR
tui_get_begin_asm_address (void)
{
- TuiGenWinInfoPtr locator;
- TuiLocatorElementPtr element;
+ struct tui_gen_win_info * locator;
+ struct tui_locator_element * element;
CORE_ADDR addr;
- locator = locatorWinInfoPtr ();
- element = &((TuiWinElementPtr) locator->content[0])->whichElement.locator;
+ locator = tui_locator_win_info_ptr ();
+ element = &((struct tui_win_element *) locator->content[0])->which_element.locator;
if (element->addr == 0)
{
@@ -358,13 +352,13 @@ tui_get_begin_asm_address (void)
disassembly window. This may or may not be the same as the
low address input. */
CORE_ADDR
-tuiGetLowDisassemblyAddress (CORE_ADDR low, CORE_ADDR pc)
+tui_get_low_disassembly_address (CORE_ADDR low, CORE_ADDR pc)
{
int pos;
/* Determine where to start the disassembly so that the pc is about in the
middle of the viewport. */
- pos = tuiDefaultWinViewportHeight (DISASSEM_WIN, DISASSEM_COMMAND) / 2;
+ pos = tui_default_win_viewport_height (DISASSEM_WIN, DISASSEM_COMMAND) / 2;
pc = tui_find_disassembly_address (pc, -pos);
if (pc < low)
@@ -374,30 +368,30 @@ tuiGetLowDisassemblyAddress (CORE_ADDR low, CORE_ADDR pc)
/* Scroll the disassembly forward or backward vertically. */
void
-tui_vertical_disassem_scroll (enum tui_scroll_direction scrollDirection,
- int numToScroll)
+tui_vertical_disassem_scroll (enum tui_scroll_direction scroll_direction,
+ int num_to_scroll)
{
- if (disassemWin->generic.content != (OpaquePtr) NULL)
+ if (TUI_DISASM_WIN->generic.content != NULL)
{
CORE_ADDR pc;
- TuiWinContent content;
+ tui_win_content content;
struct symtab *s;
- TuiLineOrAddress val;
- int maxLines, dir;
+ union tui_line_or_address val;
+ int max_lines, dir;
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
- content = (TuiWinContent) disassemWin->generic.content;
+ content = (tui_win_content) TUI_DISASM_WIN->generic.content;
if (cursal.symtab == (struct symtab *) NULL)
s = find_pc_symtab (get_frame_pc (deprecated_selected_frame));
else
s = cursal.symtab;
/* account for hilite */
- maxLines = disassemWin->generic.height - 2;
- pc = content[0]->whichElement.source.lineOrAddr.addr;
- dir = (scrollDirection == FORWARD_SCROLL) ? maxLines : - maxLines;
+ max_lines = TUI_DISASM_WIN->generic.height - 2;
+ pc = content[0]->which_element.source.line_or_addr.addr;
+ dir = (scroll_direction == FORWARD_SCROLL) ? max_lines : - max_lines;
val.addr = tui_find_disassembly_address (pc, dir);
- tuiUpdateSourceWindowAsIs (disassemWin, s, val, FALSE);
+ tui_update_source_window_as_is (TUI_DISASM_WIN, s, val, FALSE);
}
}
diff --git a/gdb/tui/tui-file.c b/gdb/tui/tui-file.c
index 36fc097..5d2740e 100644
--- a/gdb/tui/tui-file.c
+++ b/gdb/tui/tui-file.c
@@ -25,7 +25,7 @@
#include "tui.h"
-#include <string.h>
+#include "gdb_string.h"
/* A ``struct ui_file'' that is compatible with all the legacy
code. */
diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c
index f0f2060..fbdf5bf 100644
--- a/gdb/tui/tui-hooks.c
+++ b/gdb/tui/tui-hooks.c
@@ -1,6 +1,6 @@
/* GDB hooks for TUI.
- Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GDB.
@@ -40,6 +40,7 @@
#include <fcntl.h>
#include "tui/tui.h"
+#include "tui/tui-hooks.h"
#include "tui/tui-data.h"
#include "tui/tui-layout.h"
#include "tui/tui-io.h"
@@ -49,13 +50,7 @@
#include "tui/tui-windata.h"
#include "tui/tui-winsource.h"
-#ifdef HAVE_NCURSES_H
-#include <ncurses.h>
-#else
-#ifdef HAVE_CURSES_H
-#include <curses.h>
-#endif
-#endif
+#include "gdb_curses.h"
int tui_target_has_run = 0;
@@ -141,7 +136,7 @@ tui_registers_changed_hook (void)
{
tui_refreshing_registers = 1;
#if 0
- tuiCheckDataValues (fi);
+ tui_check_data_values (fi);
#endif
tui_refreshing_registers = 0;
}
@@ -156,7 +151,7 @@ tui_register_changed_hook (int regno)
if (fi && tui_refreshing_registers == 0)
{
tui_refreshing_registers = 1;
- tuiCheckDataValues (fi);
+ tui_check_data_values (fi);
tui_refreshing_registers = 0;
}
}
@@ -250,13 +245,13 @@ tui_selected_frame_level_changed_hook (int level)
select_source_symtab (s);
/* Display the frame position (even if there is no symbols). */
- tuiShowFrameInfo (fi);
+ tui_show_frame_info (fi);
/* Refresh the register window if it's visible. */
if (tui_is_window_visible (DATA_WIN))
{
tui_refreshing_registers = 1;
- tuiCheckDataValues (fi);
+ tui_check_data_values (fi);
tui_refreshing_registers = 0;
}
}
@@ -268,7 +263,7 @@ tui_print_frame_info_listing_hook (struct symtab *s, int line,
int stopline, int noerror)
{
select_source_symtab (s);
- tuiShowFrameInfo (deprecated_selected_frame);
+ tui_show_frame_info (deprecated_selected_frame);
}
/* Called when the target process died or is detached.
@@ -276,7 +271,7 @@ tui_print_frame_info_listing_hook (struct symtab *s, int line,
static void
tui_detach_hook (void)
{
- tuiShowFrameInfo (0);
+ tui_show_frame_info (0);
tui_display_main ();
}
diff --git a/gdb/tui/tui-hooks.h b/gdb/tui/tui-hooks.h
new file mode 100644
index 0000000..fa1137d
--- /dev/null
+++ b/gdb/tui/tui-hooks.h
@@ -0,0 +1,28 @@
+/* External/Public TUI hools header file, for GDB the GNU debugger.
+
+ Copyright 2004 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ 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. */
+
+#ifndef TUI_HOOKS_H
+#define TUI_HOOKS_H
+
+extern void tui_install_hooks (void);
+extern void tui_remove_hooks (void);
+
+#endif
diff --git a/gdb/tui/tui-interp.c b/gdb/tui/tui-interp.c
index 82b4dcd..1e1d643 100644
--- a/gdb/tui/tui-interp.c
+++ b/gdb/tui/tui-interp.c
@@ -53,7 +53,7 @@ tui_init (void)
/* Install exit handler to leave the screen in a good shape. */
atexit (tui_exit);
- initializeStaticData ();
+ tui_initialize_static_data ();
tui_initialize_io ();
tui_initialize_readline ();
diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c
index 61b1f93..addb3b0 100644
--- a/gdb/tui/tui-io.c
+++ b/gdb/tui/tui-io.c
@@ -43,13 +43,7 @@
#include <signal.h>
#include <stdio.h>
-#ifdef HAVE_NCURSES_H
-#include <ncurses.h>
-#else
-#ifdef HAVE_CURSES_H
-#include <curses.h>
-#endif
-#endif
+#include "gdb_curses.h"
int
key_is_start_sequence (int ch)
@@ -147,7 +141,7 @@ static int tui_readline_pipe[2];
This may be the main gdb prompt or a secondary prompt. */
static char *tui_rl_saved_prompt;
-static unsigned int _tuiHandleResizeDuringIO (unsigned int);
+static unsigned int tui_handle_resize_during_io (unsigned int);
static void
tui_putc (char c)
@@ -167,7 +161,7 @@ tui_puts (const char *string)
char c;
WINDOW *w;
- w = cmdWin->generic.handle;
+ w = TUI_CMD_WIN->generic.handle;
while ((c = *string++) != 0)
{
/* Catch annotation and discard them. We need two \032 and
@@ -184,9 +178,9 @@ tui_puts (const char *string)
else if (c == '\n')
tui_skip_line = -1;
}
- getyx (w, cmdWin->detail.commandInfo.curLine,
- cmdWin->detail.commandInfo.curch);
- cmdWin->detail.commandInfo.start_line = cmdWin->detail.commandInfo.curLine;
+ getyx (w, TUI_CMD_WIN->detail.command_info.cur_line,
+ TUI_CMD_WIN->detail.command_info.curch);
+ TUI_CMD_WIN->detail.command_info.start_line = TUI_CMD_WIN->detail.command_info.cur_line;
/* We could defer the following. */
wrefresh (w);
@@ -211,18 +205,18 @@ tui_redisplay_readline (void)
/* Detect when we temporarily left SingleKey and now the readline
edit buffer is empty, automatically restore the SingleKey mode. */
- if (tui_current_key_mode == tui_one_command_mode && rl_end == 0)
- tui_set_key_mode (tui_single_key_mode);
+ if (tui_current_key_mode == TUI_ONE_COMMAND_MODE && rl_end == 0)
+ tui_set_key_mode (TUI_SINGLE_KEY_MODE);
- if (tui_current_key_mode == tui_single_key_mode)
+ if (tui_current_key_mode == TUI_SINGLE_KEY_MODE)
prompt = "";
else
prompt = tui_rl_saved_prompt;
c_pos = -1;
c_line = -1;
- w = cmdWin->generic.handle;
- start_line = cmdWin->detail.commandInfo.start_line;
+ w = TUI_CMD_WIN->generic.handle;
+ start_line = TUI_CMD_WIN->detail.command_info.start_line;
wmove (w, start_line, 0);
prev_col = 0;
height = 1;
@@ -255,8 +249,8 @@ tui_redisplay_readline (void)
}
if (c == '\n')
{
- getyx (w, cmdWin->detail.commandInfo.start_line,
- cmdWin->detail.commandInfo.curch);
+ getyx (w, TUI_CMD_WIN->detail.command_info.start_line,
+ TUI_CMD_WIN->detail.command_info.curch);
}
getyx (w, line, col);
if (col < prev_col)
@@ -264,15 +258,15 @@ tui_redisplay_readline (void)
prev_col = col;
}
wclrtobot (w);
- getyx (w, cmdWin->detail.commandInfo.start_line,
- cmdWin->detail.commandInfo.curch);
+ getyx (w, TUI_CMD_WIN->detail.command_info.start_line,
+ TUI_CMD_WIN->detail.command_info.curch);
if (c_line >= 0)
{
wmove (w, c_line, c_pos);
- cmdWin->detail.commandInfo.curLine = c_line;
- cmdWin->detail.commandInfo.curch = c_pos;
+ TUI_CMD_WIN->detail.command_info.cur_line = c_line;
+ TUI_CMD_WIN->detail.command_info.curch = c_pos;
}
- cmdWin->detail.commandInfo.start_line -= height - 1;
+ TUI_CMD_WIN->detail.command_info.start_line -= height - 1;
wrefresh (w);
fflush(stdout);
@@ -322,8 +316,7 @@ tui_readline_output (int code, gdb_client_data data)
Comes from readline/complete.c */
static char *
-printable_part (pathname)
- char *pathname;
+printable_part (char *pathname)
{
char *temp;
@@ -360,8 +353,7 @@ printable_part (pathname)
} while (0)
static int
-print_filename (to_print, full_pathname)
- char *to_print, *full_pathname;
+print_filename (char *to_print, char *full_pathname)
{
int printed_len = 0;
char *s;
@@ -376,7 +368,7 @@ print_filename (to_print, full_pathname)
/* The user must press "y" or "n". Non-zero return means "y" pressed.
Comes from readline/complete.c */
static int
-get_y_or_n ()
+get_y_or_n (void)
{
extern int _rl_abort_internal ();
int c;
@@ -402,9 +394,7 @@ get_y_or_n ()
Comes from readline/complete.c and modified to write in
the TUI command window using tui_putc/tui_puts. */
static void
-tui_rl_display_match_list (matches, len, max)
- char **matches;
- int len, max;
+tui_rl_display_match_list (char **matches, int len, int max)
{
typedef int QSFUNC (const void *, const void *);
extern int _rl_qsort_string_compare (const void*, const void*);
@@ -415,7 +405,7 @@ tui_rl_display_match_list (matches, len, max)
char *temp;
/* Screen dimension correspond to the TUI command window. */
- int screenwidth = cmdWin->generic.width;
+ int screenwidth = TUI_CMD_WIN->generic.width;
/* If there are many items, then ask the user if she really wants to
see them all. */
@@ -584,13 +574,13 @@ tui_cont_sig (int sig)
resetty ();
/* Force a refresh of the screen. */
- tuiRefreshAll ();
+ tui_refresh_all_win ();
/* Update cursor position on the screen. */
- wmove (cmdWin->generic.handle,
- cmdWin->detail.commandInfo.start_line,
- cmdWin->detail.commandInfo.curch);
- wrefresh (cmdWin->generic.handle);
+ wmove (TUI_CMD_WIN->generic.handle,
+ TUI_CMD_WIN->detail.command_info.start_line,
+ TUI_CMD_WIN->detail.command_info.curch);
+ wrefresh (TUI_CMD_WIN->generic.handle);
}
signal (sig, tui_cont_sig);
}
@@ -598,7 +588,7 @@ tui_cont_sig (int sig)
/* Initialize the IO for gdb in curses mode. */
void
-tui_initialize_io ()
+tui_initialize_io (void)
{
#ifdef SIGCONT
signal (SIGCONT, tui_cont_sig);
@@ -651,7 +641,7 @@ tui_getc (FILE *fp)
int ch;
WINDOW *w;
- w = cmdWin->generic.handle;
+ w = TUI_CMD_WIN->generic.handle;
#ifdef TUI_USE_PIPE_FOR_READLINE
/* Flush readline output. */
@@ -659,7 +649,7 @@ tui_getc (FILE *fp)
#endif
ch = wgetch (w);
- ch = _tuiHandleResizeDuringIO (ch);
+ ch = tui_handle_resize_during_io (ch);
/* The \n must be echoed because it will not be printed by readline. */
if (ch == '\n')
@@ -671,7 +661,7 @@ tui_getc (FILE *fp)
user we recognized the command. */
if (rl_end == 0)
{
- wmove (w, cmdWin->detail.commandInfo.curLine, 0);
+ wmove (w, TUI_CMD_WIN->detail.command_info.cur_line, 0);
/* Clear the line. This will blink the gdb prompt since
it will be redrawn at the same line. */
@@ -681,8 +671,8 @@ tui_getc (FILE *fp)
}
else
{
- wmove (w, cmdWin->detail.commandInfo.curLine,
- cmdWin->detail.commandInfo.curch);
+ wmove (w, TUI_CMD_WIN->detail.command_info.cur_line,
+ TUI_CMD_WIN->detail.command_info.curch);
waddch (w, ch);
}
}
@@ -693,11 +683,7 @@ tui_getc (FILE *fp)
}
if (ch == '\n' || ch == '\r' || ch == '\f')
- cmdWin->detail.commandInfo.curch = 0;
-#if 0
- else
- tuiIncrCommandCharCountBy (1);
-#endif
+ TUI_CMD_WIN->detail.command_info.curch = 0;
if (ch == KEY_BACKSPACE)
return '\b';
@@ -708,15 +694,15 @@ tui_getc (FILE *fp)
/* Cleanup when a resize has occured.
Returns the character that must be processed. */
static unsigned int
-_tuiHandleResizeDuringIO (unsigned int originalCh)
+tui_handle_resize_during_io (unsigned int original_ch)
{
- if (tuiWinResized ())
+ if (tui_win_resized ())
{
- tuiRefreshAll ();
+ tui_refresh_all_win ();
dont_repeat ();
- tuiSetWinResizedTo (FALSE);
+ tui_set_win_resized_to (FALSE);
return '\n';
}
else
- return originalCh;
+ return original_ch;
}
diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index e4093c1..4e3de8f 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -39,37 +39,31 @@
#include "tui/tui-winsource.h"
#include "tui/tui-disasm.h"
-#ifdef HAVE_NCURSES_H
-#include <ncurses.h>
-#else
-#ifdef HAVE_CURSES_H
-#include <curses.h>
-#endif
-#endif
+#include "gdb_curses.h"
/*******************************
** Static Local Decls
********************************/
-static void showLayout (TuiLayoutType);
-static void _initGenWinInfo (TuiGenWinInfoPtr, TuiWinType, int, int, int, int);
-static void _initAndMakeWin (Opaque *, TuiWinType, int, int, int, int, int);
-static void _showSourceOrDisassemAndCommand (TuiLayoutType);
-static void _makeSourceOrDisassemWindow (TuiWinInfoPtr *, TuiWinType, int, int);
-static void _makeCommandWindow (TuiWinInfoPtr *, int, int);
-static void _makeSourceWindow (TuiWinInfoPtr *, int, int);
-static void _makeDisassemWindow (TuiWinInfoPtr *, int, int);
-static void _makeDataWindow (TuiWinInfoPtr *, int, int);
-static void _showSourceCommand (void);
-static void _showDisassemCommand (void);
-static void _showSourceDisassemCommand (void);
-static void _showData (TuiLayoutType);
-static TuiLayoutType _nextLayout (void);
-static TuiLayoutType _prevLayout (void);
-static void _tuiLayout_command (char *, int);
-static void _tuiToggleLayout_command (char *, int);
-static void _tuiToggleSplitLayout_command (char *, int);
-static CORE_ADDR _extractDisplayStartAddr (void);
-static void _tuiHandleXDBLayout (TuiLayoutDefPtr);
+static void show_layout (enum tui_layout_type);
+static void init_gen_win_info (struct tui_gen_win_info *, enum tui_win_type, int, int, int, int);
+static void init_and_make_win (void **, enum tui_win_type, int, int, int, int, int);
+static void show_source_or_disasm_and_command (enum tui_layout_type);
+static void make_source_or_disasm_window (struct tui_win_info * *, enum tui_win_type, int, int);
+static void make_command_window (struct tui_win_info * *, int, int);
+static void make_source_window (struct tui_win_info * *, int, int);
+static void make_disasm_window (struct tui_win_info * *, int, int);
+static void make_data_window (struct tui_win_info * *, int, int);
+static void show_source_command (void);
+static void show_disasm_command (void);
+static void show_source_disasm_command (void);
+static void show_data (enum tui_layout_type);
+static enum tui_layout_type next_layout (void);
+static enum tui_layout_type prev_layout (void);
+static void tui_layout_command (char *, int);
+static void tui_toggle_layout_command (char *, int);
+static void tui_toggle_split_layout_command (char *, int);
+static CORE_ADDR extract_display_start_addr (void);
+static void tui_handle_xdb_layout (struct tui_layout_def *);
/***************************************
@@ -80,45 +74,45 @@ static void _tuiHandleXDBLayout (TuiLayoutDefPtr);
/* Show the screen layout defined. */
static void
-showLayout (TuiLayoutType layout)
+show_layout (enum tui_layout_type layout)
{
- TuiLayoutType curLayout = currentLayout ();
+ enum tui_layout_type cur_layout = tui_current_layout ();
- if (layout != curLayout)
+ if (layout != cur_layout)
{
/*
** Since the new layout may cause changes in window size, we
** should free the content and reallocate on next display of
** source/asm
*/
- freeAllSourceWinsContent ();
- clearSourceWindows ();
+ tui_free_all_source_wins_content ();
+ tui_clear_source_windows ();
if (layout == SRC_DATA_COMMAND || layout == DISASSEM_DATA_COMMAND)
{
- _showData (layout);
- refreshAll (winList);
+ show_data (layout);
+ tui_refresh_all (tui_win_list);
}
else
{
/* First make the current layout be invisible */
- m_allBeInvisible ();
- m_beInvisible (locatorWinInfoPtr ());
+ tui_make_all_invisible ();
+ tui_make_invisible (tui_locator_win_info_ptr ());
switch (layout)
{
/* Now show the new layout */
case SRC_COMMAND:
- _showSourceCommand ();
- addToSourceWindows (srcWin);
+ show_source_command ();
+ tui_add_to_source_windows (TUI_SRC_WIN);
break;
case DISASSEM_COMMAND:
- _showDisassemCommand ();
- addToSourceWindows (disassemWin);
+ show_disasm_command ();
+ tui_add_to_source_windows (TUI_DISASM_WIN);
break;
case SRC_DISASSEM_COMMAND:
- _showSourceDisassemCommand ();
- addToSourceWindows (srcWin);
- addToSourceWindows (disassemWin);
+ show_source_disasm_command ();
+ tui_add_to_source_windows (TUI_SRC_WIN);
+ tui_add_to_source_windows (TUI_DISASM_WIN);
break;
default:
break;
@@ -128,62 +122,60 @@ showLayout (TuiLayoutType layout)
}
-/*
- ** tuiSetLayout()
- ** Function to set the layout to SRC_COMMAND, DISASSEM_COMMAND,
- ** SRC_DISASSEM_COMMAND, SRC_DATA_COMMAND, or DISASSEM_DATA_COMMAND.
- ** If the layout is SRC_DATA_COMMAND, DISASSEM_DATA_COMMAND, or
- ** UNDEFINED_LAYOUT, then the data window is populated according
- ** to regsDisplayType.
- */
-TuiStatus
-tuiSetLayout (TuiLayoutType layoutType,
- TuiRegisterDisplayType regsDisplayType)
+/* Function to set the layout to SRC_COMMAND, DISASSEM_COMMAND,
+ SRC_DISASSEM_COMMAND, SRC_DATA_COMMAND, or DISASSEM_DATA_COMMAND.
+ If the layout is SRC_DATA_COMMAND, DISASSEM_DATA_COMMAND, or
+ UNDEFINED_LAYOUT, then the data window is populated according to
+ regs_display_type. */
+enum tui_status
+tui_set_layout (enum tui_layout_type layout_type,
+ enum tui_register_display_type regs_display_type)
{
- TuiStatus status = TUI_SUCCESS;
+ enum tui_status status = TUI_SUCCESS;
- if (layoutType != UNDEFINED_LAYOUT || regsDisplayType != TUI_UNDEFINED_REGS)
+ if (layout_type != UNDEFINED_LAYOUT || regs_display_type != TUI_UNDEFINED_REGS)
{
- TuiLayoutType curLayout = currentLayout (), newLayout = UNDEFINED_LAYOUT;
- int regsPopulate = FALSE;
- CORE_ADDR addr = _extractDisplayStartAddr ();
- TuiWinInfoPtr newWinWithFocus = (TuiWinInfoPtr) NULL, winWithFocus = tuiWinWithFocus ();
- TuiLayoutDefPtr layoutDef = tuiLayoutDef ();
+ enum tui_layout_type cur_layout = tui_current_layout (), new_layout = UNDEFINED_LAYOUT;
+ int regs_populate = FALSE;
+ CORE_ADDR addr = extract_display_start_addr ();
+ struct tui_win_info * new_win_with_focus = (struct tui_win_info *) NULL;
+ struct tui_win_info * win_with_focus = tui_win_with_focus ();
+ struct tui_layout_def * layout_def = tui_layout_def ();
- if (layoutType == UNDEFINED_LAYOUT &&
- regsDisplayType != TUI_UNDEFINED_REGS)
+ if (layout_type == UNDEFINED_LAYOUT &&
+ regs_display_type != TUI_UNDEFINED_REGS)
{
- if (curLayout == SRC_DISASSEM_COMMAND)
- newLayout = DISASSEM_DATA_COMMAND;
- else if (curLayout == SRC_COMMAND || curLayout == SRC_DATA_COMMAND)
- newLayout = SRC_DATA_COMMAND;
- else if (curLayout == DISASSEM_COMMAND ||
- curLayout == DISASSEM_DATA_COMMAND)
- newLayout = DISASSEM_DATA_COMMAND;
+ if (cur_layout == SRC_DISASSEM_COMMAND)
+ new_layout = DISASSEM_DATA_COMMAND;
+ else if (cur_layout == SRC_COMMAND || cur_layout == SRC_DATA_COMMAND)
+ new_layout = SRC_DATA_COMMAND;
+ else if (cur_layout == DISASSEM_COMMAND ||
+ cur_layout == DISASSEM_DATA_COMMAND)
+ new_layout = DISASSEM_DATA_COMMAND;
}
else
- newLayout = layoutType;
+ new_layout = layout_type;
- regsPopulate = (newLayout == SRC_DATA_COMMAND ||
- newLayout == DISASSEM_DATA_COMMAND ||
- regsDisplayType != TUI_UNDEFINED_REGS);
- if (newLayout != curLayout || regsDisplayType != TUI_UNDEFINED_REGS)
+ regs_populate = (new_layout == SRC_DATA_COMMAND ||
+ new_layout == DISASSEM_DATA_COMMAND ||
+ regs_display_type != TUI_UNDEFINED_REGS);
+ if (new_layout != cur_layout || regs_display_type != TUI_UNDEFINED_REGS)
{
- if (newLayout != curLayout)
+ if (new_layout != cur_layout)
{
- showLayout (newLayout);
+ show_layout (new_layout);
/*
** Now determine where focus should be
*/
- if (winWithFocus != cmdWin)
+ if (win_with_focus != TUI_CMD_WIN)
{
- switch (newLayout)
+ switch (new_layout)
{
case SRC_COMMAND:
- tuiSetWinFocusTo (srcWin);
- layoutDef->displayMode = SRC_WIN;
- layoutDef->split = FALSE;
+ tui_set_win_focus_to (TUI_SRC_WIN);
+ layout_def->display_mode = SRC_WIN;
+ layout_def->split = FALSE;
break;
case DISASSEM_COMMAND:
/* the previous layout was not showing
@@ -194,9 +186,9 @@ tuiSetLayout (TuiLayoutType layoutType,
** We still want to show the assembly though!
*/
addr = tui_get_begin_asm_address ();
- tuiSetWinFocusTo (disassemWin);
- layoutDef->displayMode = DISASSEM_WIN;
- layoutDef->split = FALSE;
+ tui_set_win_focus_to (TUI_DISASM_WIN);
+ layout_def->display_mode = DISASSEM_WIN;
+ layout_def->split = FALSE;
break;
case SRC_DISASSEM_COMMAND:
/* the previous layout was not showing
@@ -207,19 +199,19 @@ tuiSetLayout (TuiLayoutType layoutType,
** We still want to show the assembly though!
*/
addr = tui_get_begin_asm_address ();
- if (winWithFocus == srcWin)
- tuiSetWinFocusTo (srcWin);
+ if (win_with_focus == TUI_SRC_WIN)
+ tui_set_win_focus_to (TUI_SRC_WIN);
else
- tuiSetWinFocusTo (disassemWin);
- layoutDef->split = TRUE;
+ tui_set_win_focus_to (TUI_DISASM_WIN);
+ layout_def->split = TRUE;
break;
case SRC_DATA_COMMAND:
- if (winWithFocus != dataWin)
- tuiSetWinFocusTo (srcWin);
+ if (win_with_focus != TUI_DATA_WIN)
+ tui_set_win_focus_to (TUI_SRC_WIN);
else
- tuiSetWinFocusTo (dataWin);
- layoutDef->displayMode = SRC_WIN;
- layoutDef->split = FALSE;
+ tui_set_win_focus_to (TUI_DATA_WIN);
+ layout_def->display_mode = SRC_WIN;
+ layout_def->split = FALSE;
break;
case DISASSEM_DATA_COMMAND:
/* the previous layout was not showing
@@ -230,35 +222,35 @@ tuiSetLayout (TuiLayoutType layoutType,
** We still want to show the assembly though!
*/
addr = tui_get_begin_asm_address ();
- if (winWithFocus != dataWin)
- tuiSetWinFocusTo (disassemWin);
+ if (win_with_focus != TUI_DATA_WIN)
+ tui_set_win_focus_to (TUI_DISASM_WIN);
else
- tuiSetWinFocusTo (dataWin);
- layoutDef->displayMode = DISASSEM_WIN;
- layoutDef->split = FALSE;
+ tui_set_win_focus_to (TUI_DATA_WIN);
+ layout_def->display_mode = DISASSEM_WIN;
+ layout_def->split = FALSE;
break;
default:
break;
}
}
- if (newWinWithFocus != (TuiWinInfoPtr) NULL)
- tuiSetWinFocusTo (newWinWithFocus);
+ if (new_win_with_focus != (struct tui_win_info *) NULL)
+ tui_set_win_focus_to (new_win_with_focus);
/*
** Now update the window content
*/
- if (!regsPopulate &&
- (newLayout == SRC_DATA_COMMAND ||
- newLayout == DISASSEM_DATA_COMMAND))
- tuiDisplayAllData ();
+ if (!regs_populate &&
+ (new_layout == SRC_DATA_COMMAND ||
+ new_layout == DISASSEM_DATA_COMMAND))
+ tui_display_all_data ();
- tuiUpdateSourceWindowsWithAddr (addr);
+ tui_update_source_windows_with_addr (addr);
}
- if (regsPopulate)
+ if (regs_populate)
{
- layoutDef->regsDisplayType =
- (regsDisplayType == TUI_UNDEFINED_REGS ?
- TUI_GENERAL_REGS : regsDisplayType);
- tui_show_registers (layoutDef->regsDisplayType);
+ layout_def->regs_display_type =
+ (regs_display_type == TUI_UNDEFINED_REGS ?
+ TUI_GENERAL_REGS : regs_display_type);
+ tui_show_registers (layout_def->regs_display_type);
}
}
}
@@ -268,92 +260,84 @@ tuiSetLayout (TuiLayoutType layoutType,
return status;
}
-/*
- ** tuiAddWinToLayout().
- ** Add the specified window to the layout in a logical way.
- ** This means setting up the most logical layout given the
- ** window to be added.
- */
+/* Add the specified window to the layout in a logical way. This
+ means setting up the most logical layout given the window to be
+ added. */
void
-tuiAddWinToLayout (TuiWinType type)
+tui_add_win_to_layout (enum tui_win_type type)
{
- TuiLayoutType curLayout = currentLayout ();
+ enum tui_layout_type cur_layout = tui_current_layout ();
switch (type)
{
case SRC_WIN:
- if (curLayout != SRC_COMMAND &&
- curLayout != SRC_DISASSEM_COMMAND &&
- curLayout != SRC_DATA_COMMAND)
+ if (cur_layout != SRC_COMMAND &&
+ cur_layout != SRC_DISASSEM_COMMAND &&
+ cur_layout != SRC_DATA_COMMAND)
{
- clearSourceWindowsDetail ();
- if (curLayout == DISASSEM_DATA_COMMAND)
- showLayout (SRC_DATA_COMMAND);
+ tui_clear_source_windows_detail ();
+ if (cur_layout == DISASSEM_DATA_COMMAND)
+ show_layout (SRC_DATA_COMMAND);
else
- showLayout (SRC_COMMAND);
+ show_layout (SRC_COMMAND);
}
break;
case DISASSEM_WIN:
- if (curLayout != DISASSEM_COMMAND &&
- curLayout != SRC_DISASSEM_COMMAND &&
- curLayout != DISASSEM_DATA_COMMAND)
+ if (cur_layout != DISASSEM_COMMAND &&
+ cur_layout != SRC_DISASSEM_COMMAND &&
+ cur_layout != DISASSEM_DATA_COMMAND)
{
- clearSourceWindowsDetail ();
- if (curLayout == SRC_DATA_COMMAND)
- showLayout (DISASSEM_DATA_COMMAND);
+ tui_clear_source_windows_detail ();
+ if (cur_layout == SRC_DATA_COMMAND)
+ show_layout (DISASSEM_DATA_COMMAND);
else
- showLayout (DISASSEM_COMMAND);
+ show_layout (DISASSEM_COMMAND);
}
break;
case DATA_WIN:
- if (curLayout != SRC_DATA_COMMAND &&
- curLayout != DISASSEM_DATA_COMMAND)
+ if (cur_layout != SRC_DATA_COMMAND &&
+ cur_layout != DISASSEM_DATA_COMMAND)
{
- if (curLayout == DISASSEM_COMMAND)
- showLayout (DISASSEM_DATA_COMMAND);
+ if (cur_layout == DISASSEM_COMMAND)
+ show_layout (DISASSEM_DATA_COMMAND);
else
- showLayout (SRC_DATA_COMMAND);
+ show_layout (SRC_DATA_COMMAND);
}
break;
default:
break;
}
-
- return;
-} /* tuiAddWinToLayout */
+}
-/*
- ** tuiDefaultWinHeight().
- ** Answer the height of a window. If it hasn't been created yet,
- ** answer what the height of a window would be based upon its
- ** type and the layout.
- */
+/* Answer the height of a window. If it hasn't been created yet,
+ answer what the height of a window would be based upon its type and
+ the layout. */
int
-tuiDefaultWinHeight (TuiWinType type, TuiLayoutType layout)
+tui_default_win_height (enum tui_win_type type, enum tui_layout_type layout)
{
int h;
- if (winList[type] != (TuiWinInfoPtr) NULL)
- h = winList[type]->generic.height;
+ if (tui_win_list[type] != (struct tui_win_info *) NULL)
+ h = tui_win_list[type]->generic.height;
else
{
switch (layout)
{
case SRC_COMMAND:
case DISASSEM_COMMAND:
- if (m_winPtrIsNull (cmdWin))
- h = termHeight () / 2;
+ if (TUI_CMD_WIN == NULL)
+ h = tui_term_height () / 2;
else
- h = termHeight () - cmdWin->generic.height;
+ h = tui_term_height () - TUI_CMD_WIN->generic.height;
break;
case SRC_DISASSEM_COMMAND:
case SRC_DATA_COMMAND:
case DISASSEM_DATA_COMMAND:
- if (m_winPtrIsNull (cmdWin))
- h = termHeight () / 3;
+ if (TUI_CMD_WIN == NULL)
+ h = tui_term_height () / 3;
else
- h = (termHeight () - cmdWin->generic.height) / 2;
+ h = (tui_term_height () - TUI_CMD_WIN->generic.height) / 2;
break;
default:
h = 0;
@@ -362,40 +346,35 @@ tuiDefaultWinHeight (TuiWinType type, TuiLayoutType layout)
}
return h;
-} /* tuiDefaultWinHeight */
+}
-/*
- ** tuiDefaultWinViewportHeight().
- ** Answer the height of a window. If it hasn't been created yet,
- ** answer what the height of a window would be based upon its
- ** type and the layout.
- */
+/* Answer the height of a window. If it hasn't been created yet,
+ answer what the height of a window would be based upon its type and
+ the layout. */
int
-tuiDefaultWinViewportHeight (TuiWinType type, TuiLayoutType layout)
+tui_default_win_viewport_height (enum tui_win_type type,
+ enum tui_layout_type layout)
{
int h;
- h = tuiDefaultWinHeight (type, layout);
+ h = tui_default_win_height (type, layout);
- if (winList[type] == cmdWin)
+ if (tui_win_list[type] == TUI_CMD_WIN)
h -= 1;
else
h -= 2;
return h;
-} /* tuiDefaultWinViewportHeight */
+}
-/*
- ** _initialize_tuiLayout().
- ** Function to initialize gdb commands, for tui window layout
- ** manipulation.
- */
+/* Function to initialize gdb commands, for tui window layout
+ manipulation. */
void
-_initialize_tuiLayout (void)
+_initialize_tui_layout (void)
{
- add_com ("layout", class_tui, _tuiLayout_command,
+ add_com ("layout", class_tui, tui_layout_command,
"Change the layout of windows.\n\
Usage: layout prev | next | <layout_name> \n\
Layout names are:\n\
@@ -410,9 +389,9 @@ Layout names are:\n\
the window that has current logical focus.\n");
if (xdb_commands)
{
- add_com ("td", class_tui, _tuiToggleLayout_command,
+ add_com ("td", class_tui, tui_toggle_layout_command,
"Toggle between Source/Command and Disassembly/Command layouts.\n");
- add_com ("ts", class_tui, _tuiToggleSplitLayout_command,
+ add_com ("ts", class_tui, tui_toggle_split_layout_command,
"Toggle between Source/Command or Disassembly/Command and \n\
Source/Disassembly/Command layouts.\n");
}
@@ -424,84 +403,81 @@ Source/Disassembly/Command layouts.\n");
**************************/
-/*
- ** _tuiSetLayoutTo()
- ** Function to set the layout to SRC, ASM, SPLIT, NEXT, PREV, DATA, REGS,
- ** $REGS, $GREGS, $FREGS, $SREGS.
- */
-TuiStatus
-tui_set_layout (const char *layoutName)
+/* Function to set the layout to SRC, ASM, SPLIT, NEXT, PREV, DATA,
+ REGS, $REGS, $GREGS, $FREGS, $SREGS. */
+enum tui_status
+tui_set_layout_for_display_command (const char *layout_name)
{
- TuiStatus status = TUI_SUCCESS;
+ enum tui_status status = TUI_SUCCESS;
- if (layoutName != (char *) NULL)
+ if (layout_name != (char *) NULL)
{
- register int i;
- register char *bufPtr;
- TuiLayoutType newLayout = UNDEFINED_LAYOUT;
- TuiRegisterDisplayType dpyType = TUI_UNDEFINED_REGS;
- TuiLayoutType curLayout = currentLayout ();
+ int i;
+ char *buf_ptr;
+ enum tui_layout_type new_layout = UNDEFINED_LAYOUT;
+ enum tui_register_display_type dpy_type = TUI_UNDEFINED_REGS;
+ enum tui_layout_type cur_layout = tui_current_layout ();
- bufPtr = (char *) xstrdup (layoutName);
- for (i = 0; (i < strlen (layoutName)); i++)
- bufPtr[i] = toupper (bufPtr[i]);
+ buf_ptr = (char *) xstrdup (layout_name);
+ for (i = 0; (i < strlen (layout_name)); i++)
+ buf_ptr[i] = toupper (buf_ptr[i]);
/* First check for ambiguous input */
- if (strlen (bufPtr) <= 1 && (*bufPtr == 'S' || *bufPtr == '$'))
+ if (strlen (buf_ptr) <= 1 && (*buf_ptr == 'S' || *buf_ptr == '$'))
{
warning ("Ambiguous command input.\n");
status = TUI_FAILURE;
}
else
{
- if (subset_compare (bufPtr, "SRC"))
- newLayout = SRC_COMMAND;
- else if (subset_compare (bufPtr, "ASM"))
- newLayout = DISASSEM_COMMAND;
- else if (subset_compare (bufPtr, "SPLIT"))
- newLayout = SRC_DISASSEM_COMMAND;
- else if (subset_compare (bufPtr, "REGS") ||
- subset_compare (bufPtr, TUI_GENERAL_SPECIAL_REGS_NAME) ||
- subset_compare (bufPtr, TUI_GENERAL_REGS_NAME) ||
- subset_compare (bufPtr, TUI_FLOAT_REGS_NAME) ||
- subset_compare (bufPtr, TUI_SPECIAL_REGS_NAME))
+ if (subset_compare (buf_ptr, "SRC"))
+ new_layout = SRC_COMMAND;
+ else if (subset_compare (buf_ptr, "ASM"))
+ new_layout = DISASSEM_COMMAND;
+ else if (subset_compare (buf_ptr, "SPLIT"))
+ new_layout = SRC_DISASSEM_COMMAND;
+ else if (subset_compare (buf_ptr, "REGS") ||
+ subset_compare (buf_ptr, TUI_GENERAL_SPECIAL_REGS_NAME) ||
+ subset_compare (buf_ptr, TUI_GENERAL_REGS_NAME) ||
+ subset_compare (buf_ptr, TUI_FLOAT_REGS_NAME) ||
+ subset_compare (buf_ptr, TUI_SPECIAL_REGS_NAME))
{
- if (curLayout == SRC_COMMAND || curLayout == SRC_DATA_COMMAND)
- newLayout = SRC_DATA_COMMAND;
+ if (cur_layout == SRC_COMMAND || cur_layout == SRC_DATA_COMMAND)
+ new_layout = SRC_DATA_COMMAND;
else
- newLayout = DISASSEM_DATA_COMMAND;
+ new_layout = DISASSEM_DATA_COMMAND;
/* could ifdef out the following code. when compile with -z, there are null
pointer references that cause a core dump if 'layout regs' is the first
layout command issued by the user. HP has asked us to hook up this code
- edie epstein
*/
- if (subset_compare (bufPtr, TUI_FLOAT_REGS_NAME))
+ if (subset_compare (buf_ptr, TUI_FLOAT_REGS_NAME))
{
- if (dataWin->detail.dataDisplayInfo.regsDisplayType !=
+ if (TUI_DATA_WIN->detail.data_display_info.regs_display_type !=
TUI_SFLOAT_REGS &&
- dataWin->detail.dataDisplayInfo.regsDisplayType !=
+ TUI_DATA_WIN->detail.data_display_info.regs_display_type !=
TUI_DFLOAT_REGS)
- dpyType = TUI_SFLOAT_REGS;
+ dpy_type = TUI_SFLOAT_REGS;
else
- dpyType =
- dataWin->detail.dataDisplayInfo.regsDisplayType;
+ dpy_type =
+ TUI_DATA_WIN->detail.data_display_info.regs_display_type;
}
- else if (subset_compare (bufPtr,
+ else if (subset_compare (buf_ptr,
TUI_GENERAL_SPECIAL_REGS_NAME))
- dpyType = TUI_GENERAL_AND_SPECIAL_REGS;
- else if (subset_compare (bufPtr, TUI_GENERAL_REGS_NAME))
- dpyType = TUI_GENERAL_REGS;
- else if (subset_compare (bufPtr, TUI_SPECIAL_REGS_NAME))
- dpyType = TUI_SPECIAL_REGS;
- else if (dataWin)
+ dpy_type = TUI_GENERAL_AND_SPECIAL_REGS;
+ else if (subset_compare (buf_ptr, TUI_GENERAL_REGS_NAME))
+ dpy_type = TUI_GENERAL_REGS;
+ else if (subset_compare (buf_ptr, TUI_SPECIAL_REGS_NAME))
+ dpy_type = TUI_SPECIAL_REGS;
+ else if (TUI_DATA_WIN)
{
- if (dataWin->detail.dataDisplayInfo.regsDisplayType !=
+ if (TUI_DATA_WIN->detail.data_display_info.regs_display_type !=
TUI_UNDEFINED_REGS)
- dpyType =
- dataWin->detail.dataDisplayInfo.regsDisplayType;
+ dpy_type =
+ TUI_DATA_WIN->detail.data_display_info.regs_display_type;
else
- dpyType = TUI_GENERAL_REGS;
+ dpy_type = TUI_GENERAL_REGS;
}
/* end of potential ifdef
@@ -511,18 +487,18 @@ tui_set_layout (const char *layoutName)
general purpose registers
*/
-/* dpyType = TUI_GENERAL_REGS;
+/* dpy_type = TUI_GENERAL_REGS;
*/
}
- else if (subset_compare (bufPtr, "NEXT"))
- newLayout = _nextLayout ();
- else if (subset_compare (bufPtr, "PREV"))
- newLayout = _prevLayout ();
+ else if (subset_compare (buf_ptr, "NEXT"))
+ new_layout = next_layout ();
+ else if (subset_compare (buf_ptr, "PREV"))
+ new_layout = prev_layout ();
else
status = TUI_FAILURE;
- xfree (bufPtr);
+ xfree (buf_ptr);
- tuiSetLayout (newLayout, dpyType);
+ tui_set_layout (new_layout, dpy_type);
}
}
else
@@ -533,26 +509,26 @@ tui_set_layout (const char *layoutName)
static CORE_ADDR
-_extractDisplayStartAddr (void)
+extract_display_start_addr (void)
{
- TuiLayoutType curLayout = currentLayout ();
+ enum tui_layout_type cur_layout = tui_current_layout ();
CORE_ADDR addr;
CORE_ADDR pc;
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
- switch (curLayout)
+ switch (cur_layout)
{
case SRC_COMMAND:
case SRC_DATA_COMMAND:
find_line_pc (cursal.symtab,
- srcWin->detail.sourceInfo.startLineOrAddr.lineNo,
+ TUI_SRC_WIN->detail.source_info.start_line_or_addr.line_no,
&pc);
addr = pc;
break;
case DISASSEM_COMMAND:
case SRC_DISASSEM_COMMAND:
case DISASSEM_DATA_COMMAND:
- addr = disassemWin->detail.sourceInfo.startLineOrAddr.addr;
+ addr = TUI_DISASM_WIN->detail.source_info.start_line_or_addr.addr;
break;
default:
addr = 0;
@@ -560,589 +536,539 @@ _extractDisplayStartAddr (void)
}
return addr;
-} /* _extractDisplayStartAddr */
+}
static void
-_tuiHandleXDBLayout (TuiLayoutDefPtr layoutDef)
+tui_handle_xdb_layout (struct tui_layout_def * layout_def)
{
- if (layoutDef->split)
+ if (layout_def->split)
{
- tuiSetLayout (SRC_DISASSEM_COMMAND, TUI_UNDEFINED_REGS);
- tuiSetWinFocusTo (winList[layoutDef->displayMode]);
+ tui_set_layout (SRC_DISASSEM_COMMAND, TUI_UNDEFINED_REGS);
+ tui_set_win_focus_to (tui_win_list[layout_def->display_mode]);
}
else
{
- if (layoutDef->displayMode == SRC_WIN)
- tuiSetLayout (SRC_COMMAND, TUI_UNDEFINED_REGS);
+ if (layout_def->display_mode == SRC_WIN)
+ tui_set_layout (SRC_COMMAND, TUI_UNDEFINED_REGS);
else
- tuiSetLayout (DISASSEM_DATA_COMMAND, layoutDef->regsDisplayType);
+ tui_set_layout (DISASSEM_DATA_COMMAND, layout_def->regs_display_type);
}
-
-
- return;
-} /* _tuiHandleXDBLayout */
+}
static void
-_tuiToggleLayout_command (char *arg, int fromTTY)
+tui_toggle_layout_command (char *arg, int from_tty)
{
- TuiLayoutDefPtr layoutDef = tuiLayoutDef ();
+ struct tui_layout_def * layout_def = tui_layout_def ();
/* Make sure the curses mode is enabled. */
tui_enable ();
- if (layoutDef->displayMode == SRC_WIN)
- layoutDef->displayMode = DISASSEM_WIN;
+ if (layout_def->display_mode == SRC_WIN)
+ layout_def->display_mode = DISASSEM_WIN;
else
- layoutDef->displayMode = SRC_WIN;
-
- if (!layoutDef->split)
- _tuiHandleXDBLayout (layoutDef);
+ layout_def->display_mode = SRC_WIN;
+ if (!layout_def->split)
+ tui_handle_xdb_layout (layout_def);
}
static void
-_tuiToggleSplitLayout_command (char *arg, int fromTTY)
+tui_toggle_split_layout_command (char *arg, int from_tty)
{
- TuiLayoutDefPtr layoutDef = tuiLayoutDef ();
+ struct tui_layout_def * layout_def = tui_layout_def ();
/* Make sure the curses mode is enabled. */
tui_enable ();
- layoutDef->split = (!layoutDef->split);
- _tuiHandleXDBLayout (layoutDef);
-
+ layout_def->split = (!layout_def->split);
+ tui_handle_xdb_layout (layout_def);
}
static void
-_tuiLayout_command (char *arg, int fromTTY)
+tui_layout_command (char *arg, int from_tty)
{
/* Make sure the curses mode is enabled. */
tui_enable ();
/* Switch to the selected layout. */
- if (tui_set_layout (arg) != TUI_SUCCESS)
+ if (tui_set_layout_for_display_command (arg) != TUI_SUCCESS)
warning ("Invalid layout specified.\n%s", LAYOUT_USAGE);
}
-/*
- ** _nextLayout().
- ** Answer the previous layout to cycle to.
- */
-static TuiLayoutType
-_nextLayout (void)
+/* Answer the previous layout to cycle to. */
+static enum tui_layout_type
+next_layout (void)
{
- TuiLayoutType newLayout;
+ enum tui_layout_type new_layout;
- newLayout = currentLayout ();
- if (newLayout == UNDEFINED_LAYOUT)
- newLayout = SRC_COMMAND;
+ new_layout = tui_current_layout ();
+ if (new_layout == UNDEFINED_LAYOUT)
+ new_layout = SRC_COMMAND;
else
{
- newLayout++;
- if (newLayout == UNDEFINED_LAYOUT)
- newLayout = SRC_COMMAND;
+ new_layout++;
+ if (new_layout == UNDEFINED_LAYOUT)
+ new_layout = SRC_COMMAND;
}
- return newLayout;
-} /* _nextLayout */
+ return new_layout;
+}
-/*
- ** _prevLayout().
- ** Answer the next layout to cycle to.
- */
-static TuiLayoutType
-_prevLayout (void)
+/* Answer the next layout to cycle to. */
+static enum tui_layout_type
+prev_layout (void)
{
- TuiLayoutType newLayout;
+ enum tui_layout_type new_layout;
- newLayout = currentLayout ();
- if (newLayout == SRC_COMMAND)
- newLayout = DISASSEM_DATA_COMMAND;
+ new_layout = tui_current_layout ();
+ if (new_layout == SRC_COMMAND)
+ new_layout = DISASSEM_DATA_COMMAND;
else
{
- newLayout--;
- if (newLayout == UNDEFINED_LAYOUT)
- newLayout = DISASSEM_DATA_COMMAND;
+ new_layout--;
+ if (new_layout == UNDEFINED_LAYOUT)
+ new_layout = DISASSEM_DATA_COMMAND;
}
- return newLayout;
-} /* _prevLayout */
+ return new_layout;
+}
-/*
- ** _makeCommandWindow().
- */
static void
-_makeCommandWindow (TuiWinInfoPtr * winInfoPtr, int height, int originY)
+make_command_window (struct tui_win_info * * win_info_ptr, int height, int origin_y)
{
- _initAndMakeWin ((Opaque *) winInfoPtr,
+ init_and_make_win ((void **) win_info_ptr,
CMD_WIN,
height,
- termWidth (),
+ tui_term_width (),
0,
- originY,
+ origin_y,
DONT_BOX_WINDOW);
- (*winInfoPtr)->canHighlight = FALSE;
-
- return;
-} /* _makeCommandWindow */
+ (*win_info_ptr)->can_highlight = FALSE;
+}
/*
- ** _makeSourceWindow().
+ ** make_source_window().
*/
static void
-_makeSourceWindow (TuiWinInfoPtr * winInfoPtr, int height, int originY)
+make_source_window (struct tui_win_info * * win_info_ptr, int height, int origin_y)
{
- _makeSourceOrDisassemWindow (winInfoPtr, SRC_WIN, height, originY);
+ make_source_or_disasm_window (win_info_ptr, SRC_WIN, height, origin_y);
return;
-} /* _makeSourceWindow */
+} /* make_source_window */
/*
- ** _makeDisassemWindow().
+ ** make_disasm_window().
*/
static void
-_makeDisassemWindow (TuiWinInfoPtr * winInfoPtr, int height, int originY)
+make_disasm_window (struct tui_win_info * * win_info_ptr, int height, int origin_y)
{
- _makeSourceOrDisassemWindow (winInfoPtr, DISASSEM_WIN, height, originY);
+ make_source_or_disasm_window (win_info_ptr, DISASSEM_WIN, height, origin_y);
return;
-} /* _makeDisassemWindow */
+} /* make_disasm_window */
-/*
- ** _makeDataWindow().
- */
static void
-_makeDataWindow (TuiWinInfoPtr * winInfoPtr, int height, int originY)
+make_data_window (struct tui_win_info * * win_info_ptr, int height, int origin_y)
{
- _initAndMakeWin ((Opaque *) winInfoPtr,
+ init_and_make_win ((void **) win_info_ptr,
DATA_WIN,
height,
- termWidth (),
+ tui_term_width (),
0,
- originY,
+ origin_y,
BOX_WINDOW);
-
- return;
-} /* _makeDataWindow */
+}
-/*
- ** _showSourceCommand().
- ** Show the Source/Command layout
- */
+/* Show the Source/Command layout. */
static void
-_showSourceCommand (void)
+show_source_command (void)
{
- _showSourceOrDisassemAndCommand (SRC_COMMAND);
-
- return;
-} /* _showSourceCommand */
+ show_source_or_disasm_and_command (SRC_COMMAND);
+}
-/*
- ** _showDisassemCommand().
- ** Show the Dissassem/Command layout
- */
+/* Show the Dissassem/Command layout. */
static void
-_showDisassemCommand (void)
+show_disasm_command (void)
{
- _showSourceOrDisassemAndCommand (DISASSEM_COMMAND);
-
- return;
-} /* _showDisassemCommand */
+ show_source_or_disasm_and_command (DISASSEM_COMMAND);
+}
-/*
- ** _showSourceDisassemCommand().
- ** Show the Source/Disassem/Command layout
- */
+/* Show the Source/Disassem/Command layout. */
static void
-_showSourceDisassemCommand (void)
+show_source_disasm_command (void)
{
- if (currentLayout () != SRC_DISASSEM_COMMAND)
+ if (tui_current_layout () != SRC_DISASSEM_COMMAND)
{
- int cmdHeight, srcHeight, asmHeight;
+ int cmd_height, src_height, asm_height;
- if (m_winPtrNotNull (cmdWin))
- cmdHeight = cmdWin->generic.height;
+ if (TUI_CMD_WIN != NULL)
+ cmd_height = TUI_CMD_WIN->generic.height;
else
- cmdHeight = termHeight () / 3;
+ cmd_height = tui_term_height () / 3;
- srcHeight = (termHeight () - cmdHeight) / 2;
- asmHeight = termHeight () - (srcHeight + cmdHeight);
+ src_height = (tui_term_height () - cmd_height) / 2;
+ asm_height = tui_term_height () - (src_height + cmd_height);
- if (m_winPtrIsNull (srcWin))
- _makeSourceWindow (&srcWin, srcHeight, 0);
+ if (TUI_SRC_WIN == NULL)
+ make_source_window (&TUI_SRC_WIN, src_height, 0);
else
{
- _initGenWinInfo (&srcWin->generic,
- srcWin->generic.type,
- srcHeight,
- srcWin->generic.width,
- srcWin->detail.sourceInfo.executionInfo->width,
+ init_gen_win_info (&TUI_SRC_WIN->generic,
+ TUI_SRC_WIN->generic.type,
+ src_height,
+ TUI_SRC_WIN->generic.width,
+ TUI_SRC_WIN->detail.source_info.execution_info->width,
0);
- srcWin->canHighlight = TRUE;
- _initGenWinInfo (srcWin->detail.sourceInfo.executionInfo,
+ TUI_SRC_WIN->can_highlight = TRUE;
+ init_gen_win_info (TUI_SRC_WIN->detail.source_info.execution_info,
EXEC_INFO_WIN,
- srcHeight,
+ src_height,
3,
0,
0);
- m_beVisible (srcWin);
- m_beVisible (srcWin->detail.sourceInfo.executionInfo);
- srcWin->detail.sourceInfo.hasLocator = FALSE;;
+ tui_make_visible (&TUI_SRC_WIN->generic);
+ tui_make_visible (TUI_SRC_WIN->detail.source_info.execution_info);
+ TUI_SRC_WIN->detail.source_info.has_locator = FALSE;;
}
- if (m_winPtrNotNull (srcWin))
+ if (TUI_SRC_WIN != NULL)
{
- TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
+ struct tui_gen_win_info * locator = tui_locator_win_info_ptr ();
- tuiShowSourceContent (srcWin);
- if (m_winPtrIsNull (disassemWin))
+ tui_show_source_content (TUI_SRC_WIN);
+ if (TUI_DISASM_WIN == NULL)
{
- _makeDisassemWindow (&disassemWin, asmHeight, srcHeight - 1);
- _initAndMakeWin ((Opaque *) & locator,
+ make_disasm_window (&TUI_DISASM_WIN, asm_height, src_height - 1);
+ init_and_make_win ((void **) & locator,
LOCATOR_WIN,
2 /* 1 */ ,
- termWidth (),
+ tui_term_width (),
0,
- (srcHeight + asmHeight) - 1,
+ (src_height + asm_height) - 1,
DONT_BOX_WINDOW);
}
else
{
- _initGenWinInfo (locator,
+ init_gen_win_info (locator,
LOCATOR_WIN,
2 /* 1 */ ,
- termWidth (),
+ tui_term_width (),
0,
- (srcHeight + asmHeight) - 1);
- disassemWin->detail.sourceInfo.hasLocator = TRUE;
- _initGenWinInfo (
- &disassemWin->generic,
- disassemWin->generic.type,
- asmHeight,
- disassemWin->generic.width,
- disassemWin->detail.sourceInfo.executionInfo->width,
- srcHeight - 1);
- _initGenWinInfo (disassemWin->detail.sourceInfo.executionInfo,
+ (src_height + asm_height) - 1);
+ TUI_DISASM_WIN->detail.source_info.has_locator = TRUE;
+ init_gen_win_info (
+ &TUI_DISASM_WIN->generic,
+ TUI_DISASM_WIN->generic.type,
+ asm_height,
+ TUI_DISASM_WIN->generic.width,
+ TUI_DISASM_WIN->detail.source_info.execution_info->width,
+ src_height - 1);
+ init_gen_win_info (TUI_DISASM_WIN->detail.source_info.execution_info,
EXEC_INFO_WIN,
- asmHeight,
+ asm_height,
3,
0,
- srcHeight - 1);
- disassemWin->canHighlight = TRUE;
- m_beVisible (disassemWin);
- m_beVisible (disassemWin->detail.sourceInfo.executionInfo);
+ src_height - 1);
+ TUI_DISASM_WIN->can_highlight = TRUE;
+ tui_make_visible (&TUI_DISASM_WIN->generic);
+ tui_make_visible (TUI_DISASM_WIN->detail.source_info.execution_info);
}
- if (m_winPtrNotNull (disassemWin))
+ if (TUI_DISASM_WIN != NULL)
{
- srcWin->detail.sourceInfo.hasLocator = FALSE;
- disassemWin->detail.sourceInfo.hasLocator = TRUE;
- m_beVisible (locator);
- tuiShowLocatorContent ();
- tuiShowSourceContent (disassemWin);
-
- if (m_winPtrIsNull (cmdWin))
- _makeCommandWindow (&cmdWin,
- cmdHeight,
- termHeight () - cmdHeight);
+ TUI_SRC_WIN->detail.source_info.has_locator = FALSE;
+ TUI_DISASM_WIN->detail.source_info.has_locator = TRUE;
+ tui_make_visible (locator);
+ tui_show_locator_content ();
+ tui_show_source_content (TUI_DISASM_WIN);
+
+ if (TUI_CMD_WIN == NULL)
+ make_command_window (&TUI_CMD_WIN,
+ cmd_height,
+ tui_term_height () - cmd_height);
else
{
- _initGenWinInfo (&cmdWin->generic,
- cmdWin->generic.type,
- cmdWin->generic.height,
- cmdWin->generic.width,
+ init_gen_win_info (&TUI_CMD_WIN->generic,
+ TUI_CMD_WIN->generic.type,
+ TUI_CMD_WIN->generic.height,
+ TUI_CMD_WIN->generic.width,
0,
- cmdWin->generic.origin.y);
- cmdWin->canHighlight = FALSE;
- m_beVisible (cmdWin);
+ TUI_CMD_WIN->generic.origin.y);
+ TUI_CMD_WIN->can_highlight = FALSE;
+ tui_make_visible (&TUI_CMD_WIN->generic);
}
- if (m_winPtrNotNull (cmdWin))
- tuiRefreshWin (&cmdWin->generic);
+ if (TUI_CMD_WIN != NULL)
+ tui_refresh_win (&TUI_CMD_WIN->generic);
}
}
- setCurrentLayoutTo (SRC_DISASSEM_COMMAND);
+ tui_set_current_layout_to (SRC_DISASSEM_COMMAND);
}
-
- return;
-} /* _showSourceDisassemCommand */
+}
-/*
- ** _showData().
- ** Show the Source/Data/Command or the Dissassembly/Data/Command layout
- */
+/* Show the Source/Data/Command or the Dissassembly/Data/Command
+ layout. */
static void
-_showData (TuiLayoutType newLayout)
+show_data (enum tui_layout_type new_layout)
{
- int totalHeight = (termHeight () - cmdWin->generic.height);
- int srcHeight, dataHeight;
- TuiWinType winType;
- TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
-
-
- dataHeight = totalHeight / 2;
- srcHeight = totalHeight - dataHeight;
- m_allBeInvisible ();
- m_beInvisible (locator);
- _makeDataWindow (&dataWin, dataHeight, 0);
- dataWin->canHighlight = TRUE;
- if (newLayout == SRC_DATA_COMMAND)
- winType = SRC_WIN;
+ int total_height = (tui_term_height () - TUI_CMD_WIN->generic.height);
+ int src_height, data_height;
+ enum tui_win_type win_type;
+ struct tui_gen_win_info * locator = tui_locator_win_info_ptr ();
+
+
+ data_height = total_height / 2;
+ src_height = total_height - data_height;
+ tui_make_all_invisible ();
+ tui_make_invisible (locator);
+ make_data_window (&TUI_DATA_WIN, data_height, 0);
+ TUI_DATA_WIN->can_highlight = TRUE;
+ if (new_layout == SRC_DATA_COMMAND)
+ win_type = SRC_WIN;
else
- winType = DISASSEM_WIN;
- if (m_winPtrIsNull (winList[winType]))
+ win_type = DISASSEM_WIN;
+ if (tui_win_list[win_type] == NULL)
{
- if (winType == SRC_WIN)
- _makeSourceWindow (&winList[winType], srcHeight, dataHeight - 1);
+ if (win_type == SRC_WIN)
+ make_source_window (&tui_win_list[win_type], src_height, data_height - 1);
else
- _makeDisassemWindow (&winList[winType], srcHeight, dataHeight - 1);
- _initAndMakeWin ((Opaque *) & locator,
+ make_disasm_window (&tui_win_list[win_type], src_height, data_height - 1);
+ init_and_make_win ((void **) & locator,
LOCATOR_WIN,
2 /* 1 */ ,
- termWidth (),
+ tui_term_width (),
0,
- totalHeight - 1,
+ total_height - 1,
DONT_BOX_WINDOW);
}
else
{
- _initGenWinInfo (&winList[winType]->generic,
- winList[winType]->generic.type,
- srcHeight,
- winList[winType]->generic.width,
- winList[winType]->detail.sourceInfo.executionInfo->width,
- dataHeight - 1);
- _initGenWinInfo (winList[winType]->detail.sourceInfo.executionInfo,
+ init_gen_win_info (&tui_win_list[win_type]->generic,
+ tui_win_list[win_type]->generic.type,
+ src_height,
+ tui_win_list[win_type]->generic.width,
+ tui_win_list[win_type]->detail.source_info.execution_info->width,
+ data_height - 1);
+ init_gen_win_info (tui_win_list[win_type]->detail.source_info.execution_info,
EXEC_INFO_WIN,
- srcHeight,
+ src_height,
3,
0,
- dataHeight - 1);
- m_beVisible (winList[winType]);
- m_beVisible (winList[winType]->detail.sourceInfo.executionInfo);
- _initGenWinInfo (locator,
+ data_height - 1);
+ tui_make_visible (&tui_win_list[win_type]->generic);
+ tui_make_visible (tui_win_list[win_type]->detail.source_info.execution_info);
+ init_gen_win_info (locator,
LOCATOR_WIN,
2 /* 1 */ ,
- termWidth (),
+ tui_term_width (),
0,
- totalHeight - 1);
+ total_height - 1);
}
- winList[winType]->detail.sourceInfo.hasLocator = TRUE;
- m_beVisible (locator);
- tuiShowLocatorContent ();
- addToSourceWindows (winList[winType]);
- setCurrentLayoutTo (newLayout);
-
- return;
-} /* _showData */
+ tui_win_list[win_type]->detail.source_info.has_locator = TRUE;
+ tui_make_visible (locator);
+ tui_show_locator_content ();
+ tui_add_to_source_windows (tui_win_list[win_type]);
+ tui_set_current_layout_to (new_layout);
+}
/*
- ** _initGenWinInfo().
+ ** init_gen_win_info().
*/
static void
-_initGenWinInfo (TuiGenWinInfoPtr winInfo, TuiWinType type,
- int height, int width, int originX, int originY)
+init_gen_win_info (struct tui_gen_win_info * win_info, enum tui_win_type type,
+ int height, int width, int origin_x, int origin_y)
{
int h = height;
- winInfo->type = type;
- winInfo->width = width;
- winInfo->height = h;
+ win_info->type = type;
+ win_info->width = width;
+ win_info->height = h;
if (h > 1)
{
- winInfo->viewportHeight = h - 1;
- if (winInfo->type != CMD_WIN)
- winInfo->viewportHeight--;
+ win_info->viewport_height = h - 1;
+ if (win_info->type != CMD_WIN)
+ win_info->viewport_height--;
}
else
- winInfo->viewportHeight = 1;
- winInfo->origin.x = originX;
- winInfo->origin.y = originY;
+ win_info->viewport_height = 1;
+ win_info->origin.x = origin_x;
+ win_info->origin.y = origin_y;
return;
-} /* _initGenWinInfo */
+} /* init_gen_win_info */
/*
- ** _initAndMakeWin().
+ ** init_and_make_win().
*/
static void
-_initAndMakeWin (Opaque * winInfoPtr, TuiWinType winType,
- int height, int width, int originX, int originY, int boxIt)
+init_and_make_win (void ** win_info_ptr, enum tui_win_type win_type,
+ int height, int width, int origin_x, int origin_y, int box_it)
{
- Opaque opaqueWinInfo = *winInfoPtr;
- TuiGenWinInfoPtr generic;
+ void *opaque_win_info = *win_info_ptr;
+ struct tui_gen_win_info * generic;
- if (opaqueWinInfo == (Opaque) NULL)
+ if (opaque_win_info == NULL)
{
- if (m_winIsAuxillary (winType))
- opaqueWinInfo = (Opaque) allocGenericWinInfo ();
+ if (tui_win_is_auxillary (win_type))
+ opaque_win_info = (void *) tui_alloc_generic_win_info ();
else
- opaqueWinInfo = (Opaque) allocWinInfo (winType);
+ opaque_win_info = (void *) tui_alloc_win_info (win_type);
}
- if (m_winIsAuxillary (winType))
- generic = (TuiGenWinInfoPtr) opaqueWinInfo;
+ if (tui_win_is_auxillary (win_type))
+ generic = (struct tui_gen_win_info *) opaque_win_info;
else
- generic = &((TuiWinInfoPtr) opaqueWinInfo)->generic;
+ generic = &((struct tui_win_info *) opaque_win_info)->generic;
- if (opaqueWinInfo != (Opaque) NULL)
+ if (opaque_win_info != NULL)
{
- _initGenWinInfo (generic, winType, height, width, originX, originY);
- if (!m_winIsAuxillary (winType))
+ init_gen_win_info (generic, win_type, height, width, origin_x, origin_y);
+ if (!tui_win_is_auxillary (win_type))
{
if (generic->type == CMD_WIN)
- ((TuiWinInfoPtr) opaqueWinInfo)->canHighlight = FALSE;
+ ((struct tui_win_info *) opaque_win_info)->can_highlight = FALSE;
else
- ((TuiWinInfoPtr) opaqueWinInfo)->canHighlight = TRUE;
+ ((struct tui_win_info *) opaque_win_info)->can_highlight = TRUE;
}
- makeWindow (generic, boxIt);
+ tui_make_window (generic, box_it);
}
- *winInfoPtr = opaqueWinInfo;
+ *win_info_ptr = opaque_win_info;
}
-/*
- ** _makeSourceOrDisassemWindow().
- */
static void
-_makeSourceOrDisassemWindow (TuiWinInfoPtr * winInfoPtr, TuiWinType type,
- int height, int originY)
+make_source_or_disasm_window (struct tui_win_info * * win_info_ptr, enum tui_win_type type,
+ int height, int origin_y)
{
- TuiGenWinInfoPtr executionInfo = (TuiGenWinInfoPtr) NULL;
+ struct tui_gen_win_info * execution_info = (struct tui_gen_win_info *) NULL;
/*
** Create the exeuction info window.
*/
if (type == SRC_WIN)
- executionInfo = sourceExecInfoWinPtr ();
+ execution_info = tui_source_exec_info_win_ptr ();
else
- executionInfo = disassemExecInfoWinPtr ();
- _initAndMakeWin ((Opaque *) & executionInfo,
+ execution_info = tui_disassem_exec_info_win_ptr ();
+ init_and_make_win ((void **) & execution_info,
EXEC_INFO_WIN,
height,
3,
0,
- originY,
+ origin_y,
DONT_BOX_WINDOW);
/*
** Now create the source window.
*/
- _initAndMakeWin ((Opaque *) winInfoPtr,
+ init_and_make_win ((void **) win_info_ptr,
type,
height,
- termWidth () - executionInfo->width,
- executionInfo->width,
- originY,
+ tui_term_width () - execution_info->width,
+ execution_info->width,
+ origin_y,
BOX_WINDOW);
- (*winInfoPtr)->detail.sourceInfo.executionInfo = executionInfo;
-
- return;
-} /* _makeSourceOrDisassemWindow */
+ (*win_info_ptr)->detail.source_info.execution_info = execution_info;
+}
-/*
- ** _showSourceOrDisassemAndCommand().
- ** Show the Source/Command or the Disassem layout
- */
+/* Show the Source/Command or the Disassem layout. */
static void
-_showSourceOrDisassemAndCommand (TuiLayoutType layoutType)
+show_source_or_disasm_and_command (enum tui_layout_type layout_type)
{
- if (currentLayout () != layoutType)
+ if (tui_current_layout () != layout_type)
{
- TuiWinInfoPtr *winInfoPtr;
- int srcHeight, cmdHeight;
- TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
+ struct tui_win_info * *win_info_ptr;
+ int src_height, cmd_height;
+ struct tui_gen_win_info * locator = tui_locator_win_info_ptr ();
- if (m_winPtrNotNull (cmdWin))
- cmdHeight = cmdWin->generic.height;
+ if (TUI_CMD_WIN != NULL)
+ cmd_height = TUI_CMD_WIN->generic.height;
else
- cmdHeight = termHeight () / 3;
- srcHeight = termHeight () - cmdHeight;
+ cmd_height = tui_term_height () / 3;
+ src_height = tui_term_height () - cmd_height;
- if (layoutType == SRC_COMMAND)
- winInfoPtr = &srcWin;
+ if (layout_type == SRC_COMMAND)
+ win_info_ptr = &TUI_SRC_WIN;
else
- winInfoPtr = &disassemWin;
+ win_info_ptr = &TUI_DISASM_WIN;
- if (m_winPtrIsNull (*winInfoPtr))
+ if ((*win_info_ptr) == NULL)
{
- if (layoutType == SRC_COMMAND)
- _makeSourceWindow (winInfoPtr, srcHeight - 1, 0);
+ if (layout_type == SRC_COMMAND)
+ make_source_window (win_info_ptr, src_height - 1, 0);
else
- _makeDisassemWindow (winInfoPtr, srcHeight - 1, 0);
- _initAndMakeWin ((Opaque *) & locator,
+ make_disasm_window (win_info_ptr, src_height - 1, 0);
+ init_and_make_win ((void **) & locator,
LOCATOR_WIN,
2 /* 1 */ ,
- termWidth (),
+ tui_term_width (),
0,
- srcHeight - 1,
+ src_height - 1,
DONT_BOX_WINDOW);
}
else
{
- _initGenWinInfo (locator,
+ init_gen_win_info (locator,
LOCATOR_WIN,
2 /* 1 */ ,
- termWidth (),
+ tui_term_width (),
0,
- srcHeight - 1);
- (*winInfoPtr)->detail.sourceInfo.hasLocator = TRUE;
- _initGenWinInfo (
- &(*winInfoPtr)->generic,
- (*winInfoPtr)->generic.type,
- srcHeight - 1,
- (*winInfoPtr)->generic.width,
- (*winInfoPtr)->detail.sourceInfo.executionInfo->width,
+ src_height - 1);
+ (*win_info_ptr)->detail.source_info.has_locator = TRUE;
+ init_gen_win_info (
+ &(*win_info_ptr)->generic,
+ (*win_info_ptr)->generic.type,
+ src_height - 1,
+ (*win_info_ptr)->generic.width,
+ (*win_info_ptr)->detail.source_info.execution_info->width,
0);
- _initGenWinInfo ((*winInfoPtr)->detail.sourceInfo.executionInfo,
+ init_gen_win_info ((*win_info_ptr)->detail.source_info.execution_info,
EXEC_INFO_WIN,
- srcHeight - 1,
+ src_height - 1,
3,
0,
0);
- (*winInfoPtr)->canHighlight = TRUE;
- m_beVisible (*winInfoPtr);
- m_beVisible ((*winInfoPtr)->detail.sourceInfo.executionInfo);
+ (*win_info_ptr)->can_highlight = TRUE;
+ tui_make_visible (&(*win_info_ptr)->generic);
+ tui_make_visible ((*win_info_ptr)->detail.source_info.execution_info);
}
- if (m_winPtrNotNull (*winInfoPtr))
+ if ((*win_info_ptr) != NULL)
{
- (*winInfoPtr)->detail.sourceInfo.hasLocator = TRUE;
- m_beVisible (locator);
- tuiShowLocatorContent ();
- tuiShowSourceContent (*winInfoPtr);
+ (*win_info_ptr)->detail.source_info.has_locator = TRUE;
+ tui_make_visible (locator);
+ tui_show_locator_content ();
+ tui_show_source_content (*win_info_ptr);
- if (m_winPtrIsNull (cmdWin))
+ if (TUI_CMD_WIN == NULL)
{
- _makeCommandWindow (&cmdWin, cmdHeight, srcHeight);
- tuiRefreshWin (&cmdWin->generic);
+ make_command_window (&TUI_CMD_WIN, cmd_height, src_height);
+ tui_refresh_win (&TUI_CMD_WIN->generic);
}
else
{
- _initGenWinInfo (&cmdWin->generic,
- cmdWin->generic.type,
- cmdWin->generic.height,
- cmdWin->generic.width,
- cmdWin->generic.origin.x,
- cmdWin->generic.origin.y);
- cmdWin->canHighlight = FALSE;
- m_beVisible (cmdWin);
+ init_gen_win_info (&TUI_CMD_WIN->generic,
+ TUI_CMD_WIN->generic.type,
+ TUI_CMD_WIN->generic.height,
+ TUI_CMD_WIN->generic.width,
+ TUI_CMD_WIN->generic.origin.x,
+ TUI_CMD_WIN->generic.origin.y);
+ TUI_CMD_WIN->can_highlight = FALSE;
+ tui_make_visible (&TUI_CMD_WIN->generic);
}
}
- setCurrentLayoutTo (layoutType);
+ tui_set_current_layout_to (layout_type);
}
-
- return;
-} /* _showSourceOrDisassemAndCommand */
+}
diff --git a/gdb/tui/tui-layout.h b/gdb/tui/tui-layout.h
index f6b0ed7..5df1f0b 100644
--- a/gdb/tui/tui-layout.h
+++ b/gdb/tui/tui-layout.h
@@ -1,5 +1,8 @@
/* TUI layout window management.
- Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+
+ Copyright 1998, 1999, 2000, 2001, 2002, 2004 Free Software
+ Foundation, Inc.
+
Contributed by Hewlett-Packard Company.
This file is part of GDB.
@@ -22,9 +25,14 @@
#ifndef TUI_LAYOUT_H
#define TUI_LAYOUT_H
-extern void tuiAddWinToLayout (TuiWinType);
-extern int tuiDefaultWinHeight (TuiWinType, TuiLayoutType);
-extern int tuiDefaultWinViewportHeight (TuiWinType, TuiLayoutType);
-extern TuiStatus tuiSetLayout (TuiLayoutType, TuiRegisterDisplayType);
+#include "tui/tui.h"
+#include "tui/tui-data.h"
+
+extern void tui_add_win_to_layout (enum tui_win_type);
+extern int tui_default_win_height (enum tui_win_type, enum tui_layout_type);
+extern int tui_default_win_viewport_height (enum tui_win_type,
+ enum tui_layout_type);
+extern enum tui_status tui_set_layout (enum tui_layout_type,
+ enum tui_register_display_type);
#endif /*TUI_LAYOUT_H */
diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index 68520b9..7ce92c2 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -32,19 +32,14 @@
#include "regcache.h"
#include "inferior.h"
#include "target.h"
+#include "gdb_string.h"
#include "tui/tui-layout.h"
#include "tui/tui-win.h"
#include "tui/tui-windata.h"
#include "tui/tui-wingeneral.h"
#include "tui/tui-file.h"
-#ifdef HAVE_NCURSES_H
-#include <ncurses.h>
-#else
-#ifdef HAVE_CURSES_H
-#include <curses.h>
-#endif
-#endif
+#include "gdb_curses.h"
/*****************************************
** LOCAL DEFINITIONS **
@@ -76,28 +71,28 @@
/*****************************************
** STATIC LOCAL FUNCTIONS FORWARD DECLS **
******************************************/
-static TuiStatus _tuiSetRegsContent
- (int, int, struct frame_info *, TuiRegisterDisplayType, int);
-static const char *_tuiRegisterName (int);
-static TuiStatus _tuiGetRegisterRawValue (int, char *, struct frame_info *);
-static void _tuiSetRegisterElement
- (int, struct frame_info *, TuiDataElementPtr, int);
-static void _tuiDisplayRegister (int, TuiGenWinInfoPtr, enum precision_type);
-static void _tuiRegisterFormat
- (char *, int, int, TuiDataElementPtr, enum precision_type);
-static TuiStatus _tuiSetGeneralRegsContent (int);
-static TuiStatus _tuiSetSpecialRegsContent (int);
-static TuiStatus _tuiSetGeneralAndSpecialRegsContent (int);
-static TuiStatus _tuiSetFloatRegsContent (TuiRegisterDisplayType, int);
-static int _tuiRegValueHasChanged
- (TuiDataElementPtr, struct frame_info *, char *);
-static void _tuiShowFloat_command (char *, int);
-static void _tuiShowGeneral_command (char *, int);
-static void _tuiShowSpecial_command (char *, int);
-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 enum tui_status tui_set_regs_content
+ (int, int, struct frame_info *, enum tui_register_display_type, int);
+static const char *tui_register_name (int);
+static enum tui_status tui_get_register_raw_value (int, char *, struct frame_info *);
+static void tui_set_register_element
+ (int, struct frame_info *, struct tui_data_element *, int);
+static void tui_display_register (int, struct tui_gen_win_info *, enum precision_type);
+static void tui_register_format
+ (char *, int, int, struct tui_data_element *, enum precision_type);
+static enum tui_status tui_set_general_regs_content (int);
+static enum tui_status tui_set_special_regs_content (int);
+static enum tui_status tui_set_general_and_special_regs_content (int);
+static enum tui_status tui_set_float_regs_content (enum tui_register_display_type, int);
+static int tui_reg_value_has_changed
+ (struct tui_data_element *, struct frame_info *, char *);
+static void tui_show_float_command (char *, int);
+static void tui_show_general_command (char *, int);
+static void tui_show_special_command (char *, int);
+static void tui_v_show_registers_command_support (enum tui_register_display_type);
+static void _tui_toggle_float_regs_command (char *, int);
+static void tui_scroll_regs_forward_command (char *, int);
+static void tui_scroll_regs_backward_command (char *, int);
@@ -110,35 +105,35 @@ static void _tuiScrollRegsBackward_command (char *, int);
int
tui_last_regs_line_no (void)
{
- register int numLines = (-1);
+ int num_lines = (-1);
- if (dataWin->detail.dataDisplayInfo.regsContentCount > 0)
+ if (TUI_DATA_WIN->detail.data_display_info.regs_content_count > 0)
{
- numLines = (dataWin->detail.dataDisplayInfo.regsContentCount /
- dataWin->detail.dataDisplayInfo.regsColumnCount);
- if (dataWin->detail.dataDisplayInfo.regsContentCount %
- dataWin->detail.dataDisplayInfo.regsColumnCount)
- numLines++;
+ num_lines = (TUI_DATA_WIN->detail.data_display_info.regs_content_count /
+ TUI_DATA_WIN->detail.data_display_info.regs_column_count);
+ if (TUI_DATA_WIN->detail.data_display_info.regs_content_count %
+ TUI_DATA_WIN->detail.data_display_info.regs_column_count)
+ num_lines++;
}
- return numLines;
+ return num_lines;
}
-/* Answer the line number that the register element at elementNo is
- on. If elementNo is greater than the number of register elements
+/* Answer the line number that the register element at element_no is
+ on. If element_no is greater than the number of register elements
there are, -1 is returned. */
int
-tui_line_from_reg_element_no (int elementNo)
+tui_line_from_reg_element_no (int element_no)
{
- if (elementNo < dataWin->detail.dataDisplayInfo.regsContentCount)
+ if (element_no < TUI_DATA_WIN->detail.data_display_info.regs_content_count)
{
int i, line = (-1);
i = 1;
while (line == (-1))
{
- if (elementNo <
- (dataWin->detail.dataDisplayInfo.regsColumnCount * i))
+ if (element_no <
+ (TUI_DATA_WIN->detail.data_display_info.regs_column_count * i))
line = i - 1;
else
i++;
@@ -151,93 +146,90 @@ tui_line_from_reg_element_no (int elementNo)
}
-/* Answer the index of the first element in lineNo. If lineNo is past
+/* Answer the index of the first element in line_no. If line_no is past
the register area (-1) is returned. */
int
-tui_first_reg_element_no_inline (int lineNo)
+tui_first_reg_element_no_inline (int line_no)
{
- if ((lineNo * dataWin->detail.dataDisplayInfo.regsColumnCount)
- <= dataWin->detail.dataDisplayInfo.regsContentCount)
- return ((lineNo + 1) *
- dataWin->detail.dataDisplayInfo.regsColumnCount) -
- dataWin->detail.dataDisplayInfo.regsColumnCount;
+ if ((line_no * TUI_DATA_WIN->detail.data_display_info.regs_column_count)
+ <= TUI_DATA_WIN->detail.data_display_info.regs_content_count)
+ return ((line_no + 1) *
+ TUI_DATA_WIN->detail.data_display_info.regs_column_count) -
+ TUI_DATA_WIN->detail.data_display_info.regs_column_count;
else
return (-1);
}
-/*
- ** tuiLastRegElementNoInLine()
- ** Answer the index of the last element in lineNo. If lineNo is past
- ** the register area (-1) is returned.
- */
+/* Answer the index of the last element in line_no. If line_no is
+ past the register area (-1) is returned. */
int
-tuiLastRegElementNoInLine (int lineNo)
+tui_last_reg_element_no_in_line (int line_no)
{
- if ((lineNo * dataWin->detail.dataDisplayInfo.regsColumnCount) <=
- dataWin->detail.dataDisplayInfo.regsContentCount)
- return ((lineNo + 1) *
- dataWin->detail.dataDisplayInfo.regsColumnCount) - 1;
+ if ((line_no * TUI_DATA_WIN->detail.data_display_info.regs_column_count) <=
+ TUI_DATA_WIN->detail.data_display_info.regs_content_count)
+ return ((line_no + 1) *
+ TUI_DATA_WIN->detail.data_display_info.regs_column_count) - 1;
else
return (-1);
-} /* tuiLastRegElementNoInLine */
+}
/* Calculate the number of columns that should be used to display the
registers. */
int
-tui_calculate_regs_column_count (TuiRegisterDisplayType dpyType)
+tui_calculate_regs_column_count (enum tui_register_display_type dpy_type)
{
- int colCount, colWidth;
+ int col_count, col_width;
- if (IS_64BIT || dpyType == TUI_DFLOAT_REGS)
- colWidth = DOUBLE_FLOAT_VALUE_WIDTH + DOUBLE_FLOAT_LABEL_WIDTH;
+ if (IS_64BIT || dpy_type == TUI_DFLOAT_REGS)
+ col_width = DOUBLE_FLOAT_VALUE_WIDTH + DOUBLE_FLOAT_LABEL_WIDTH;
else
{
- if (dpyType == TUI_SFLOAT_REGS)
- colWidth = SINGLE_FLOAT_VALUE_WIDTH + SINGLE_FLOAT_LABEL_WIDTH;
+ if (dpy_type == TUI_SFLOAT_REGS)
+ col_width = SINGLE_FLOAT_VALUE_WIDTH + SINGLE_FLOAT_LABEL_WIDTH;
else
- colWidth = SINGLE_VALUE_WIDTH + SINGLE_LABEL_WIDTH;
+ col_width = SINGLE_VALUE_WIDTH + SINGLE_LABEL_WIDTH;
}
- colCount = (dataWin->generic.width - 2) / colWidth;
+ col_count = (TUI_DATA_WIN->generic.width - 2) / col_width;
- return colCount;
-} /* tuiCalulateRegsColumnCount */
+ return col_count;
+}
-/* Show the registers int the data window as indicated by dpyType. If
+/* Show the registers int the data window as indicated by dpy_type. If
there is any other registers being displayed, then they are
- cleared. What registers are displayed is dependent upon dpyType. */
+ cleared. What registers are displayed is dependent upon dpy_type. */
void
-tui_show_registers (TuiRegisterDisplayType dpyType)
+tui_show_registers (enum tui_register_display_type dpy_type)
{
- TuiStatus ret = TUI_FAILURE;
- int refreshValuesOnly = FALSE;
+ enum tui_status ret = TUI_FAILURE;
+ int refresh_values_only = FALSE;
/* Say that registers should be displayed, even if there is a problem */
- dataWin->detail.dataDisplayInfo.displayRegs = TRUE;
+ TUI_DATA_WIN->detail.data_display_info.display_regs = TRUE;
if (target_has_registers)
{
- refreshValuesOnly =
- (dpyType == dataWin->detail.dataDisplayInfo.regsDisplayType);
- switch (dpyType)
+ refresh_values_only =
+ (dpy_type == TUI_DATA_WIN->detail.data_display_info.regs_display_type);
+ switch (dpy_type)
{
case TUI_GENERAL_REGS:
- ret = _tuiSetGeneralRegsContent (refreshValuesOnly);
+ ret = tui_set_general_regs_content (refresh_values_only);
break;
case TUI_SFLOAT_REGS:
case TUI_DFLOAT_REGS:
- ret = _tuiSetFloatRegsContent (dpyType, refreshValuesOnly);
+ ret = tui_set_float_regs_content (dpy_type, refresh_values_only);
break;
/* could ifdef out */
case TUI_SPECIAL_REGS:
- ret = _tuiSetSpecialRegsContent (refreshValuesOnly);
+ ret = tui_set_special_regs_content (refresh_values_only);
break;
case TUI_GENERAL_AND_SPECIAL_REGS:
- ret = _tuiSetGeneralAndSpecialRegsContent (refreshValuesOnly);
+ ret = tui_set_general_and_special_regs_content (refresh_values_only);
break;
/* end of potential if def */
@@ -248,110 +240,110 @@ tui_show_registers (TuiRegisterDisplayType dpyType)
}
if (ret == TUI_FAILURE)
{
- dataWin->detail.dataDisplayInfo.regsDisplayType = TUI_UNDEFINED_REGS;
- tuiEraseDataContent (NO_REGS_STRING);
+ TUI_DATA_WIN->detail.data_display_info.regs_display_type = TUI_UNDEFINED_REGS;
+ tui_erase_data_content (NO_REGS_STRING);
}
else
{
int i;
/* Clear all notation of changed values */
- for (i = 0; (i < dataWin->detail.dataDisplayInfo.regsContentCount); i++)
+ for (i = 0; (i < TUI_DATA_WIN->detail.data_display_info.regs_content_count); i++)
{
- TuiGenWinInfoPtr dataItemWin;
+ struct tui_gen_win_info * data_item_win;
- dataItemWin = &dataWin->detail.dataDisplayInfo.
- regsContent[i]->whichElement.dataWindow;
- (&((TuiWinElementPtr)
- dataItemWin->content[0])->whichElement.data)->highlight = FALSE;
+ data_item_win = &TUI_DATA_WIN->detail.data_display_info.
+ regs_content[i]->which_element.data_window;
+ (&((struct tui_win_element *)
+ data_item_win->content[0])->which_element.data)->highlight = FALSE;
}
- dataWin->detail.dataDisplayInfo.regsDisplayType = dpyType;
- tuiDisplayAllData ();
+ TUI_DATA_WIN->detail.data_display_info.regs_display_type = dpy_type;
+ tui_display_all_data ();
}
- (tuiLayoutDef ())->regsDisplayType = dpyType;
+ (tui_layout_def ())->regs_display_type = dpy_type;
return;
}
/* Function to display the registers in the content from
- 'startElementNo' until the end of the register content or the end
+ 'start_element_no' until the end of the register content or the end
of the display height. No checking for displaying past the end of
the registers is done here. */
void
-tui_display_registers_from (int startElementNo)
+tui_display_registers_from (int start_element_no)
{
- if (dataWin->detail.dataDisplayInfo.regsContent != (TuiWinContent) NULL &&
- dataWin->detail.dataDisplayInfo.regsContentCount > 0)
+ if (TUI_DATA_WIN->detail.data_display_info.regs_content != (tui_win_content) NULL &&
+ TUI_DATA_WIN->detail.data_display_info.regs_content_count > 0)
{
- register int i = startElementNo;
- int j, valueCharsWide, itemWinWidth, curY, labelWidth;
+ int i = start_element_no;
+ int j, value_chars_wide, item_win_width, cur_y, label_width;
enum precision_type precision;
- precision = (dataWin->detail.dataDisplayInfo.regsDisplayType
+ precision = (TUI_DATA_WIN->detail.data_display_info.regs_display_type
== TUI_DFLOAT_REGS) ?
double_precision : unspecified_precision;
if (IS_64BIT ||
- dataWin->detail.dataDisplayInfo.regsDisplayType == TUI_DFLOAT_REGS)
+ TUI_DATA_WIN->detail.data_display_info.regs_display_type == TUI_DFLOAT_REGS)
{
- valueCharsWide = DOUBLE_FLOAT_VALUE_WIDTH;
- labelWidth = DOUBLE_FLOAT_LABEL_WIDTH;
+ value_chars_wide = DOUBLE_FLOAT_VALUE_WIDTH;
+ label_width = DOUBLE_FLOAT_LABEL_WIDTH;
}
else
{
- if (dataWin->detail.dataDisplayInfo.regsDisplayType ==
+ if (TUI_DATA_WIN->detail.data_display_info.regs_display_type ==
TUI_SFLOAT_REGS)
{
- valueCharsWide = SINGLE_FLOAT_VALUE_WIDTH;
- labelWidth = SINGLE_FLOAT_LABEL_WIDTH;
+ value_chars_wide = SINGLE_FLOAT_VALUE_WIDTH;
+ label_width = SINGLE_FLOAT_LABEL_WIDTH;
}
else
{
- valueCharsWide = SINGLE_VALUE_WIDTH;
- labelWidth = SINGLE_LABEL_WIDTH;
+ value_chars_wide = SINGLE_VALUE_WIDTH;
+ label_width = SINGLE_LABEL_WIDTH;
}
}
- itemWinWidth = valueCharsWide + labelWidth;
+ item_win_width = value_chars_wide + label_width;
/*
** Now create each data "sub" window, and write the display into it.
*/
- curY = 1;
- while (i < dataWin->detail.dataDisplayInfo.regsContentCount &&
- curY <= dataWin->generic.viewportHeight)
+ cur_y = 1;
+ while (i < TUI_DATA_WIN->detail.data_display_info.regs_content_count &&
+ cur_y <= TUI_DATA_WIN->generic.viewport_height)
{
for (j = 0;
- (j < dataWin->detail.dataDisplayInfo.regsColumnCount &&
- i < dataWin->detail.dataDisplayInfo.regsContentCount); j++)
+ (j < TUI_DATA_WIN->detail.data_display_info.regs_column_count &&
+ i < TUI_DATA_WIN->detail.data_display_info.regs_content_count); j++)
{
- TuiGenWinInfoPtr dataItemWin;
- TuiDataElementPtr dataElementPtr;
+ struct tui_gen_win_info * data_item_win;
+ struct tui_data_element * data_element_ptr;
/* create the window if necessary */
- dataItemWin = &dataWin->detail.dataDisplayInfo.
- regsContent[i]->whichElement.dataWindow;
- dataElementPtr = &((TuiWinElementPtr)
- dataItemWin->content[0])->whichElement.data;
- if (dataItemWin->handle == (WINDOW *) NULL)
+ data_item_win = &TUI_DATA_WIN->detail.data_display_info.
+ regs_content[i]->which_element.data_window;
+ data_element_ptr = &((struct tui_win_element *)
+ data_item_win->content[0])->which_element.data;
+ if (data_item_win->handle == (WINDOW *) NULL)
{
- dataItemWin->height = 1;
- dataItemWin->width = (precision == double_precision) ?
- itemWinWidth + 2 : itemWinWidth + 1;
- dataItemWin->origin.x = (itemWinWidth * j) + 1;
- dataItemWin->origin.y = curY;
- makeWindow (dataItemWin, DONT_BOX_WINDOW);
- scrollok (dataItemWin->handle, FALSE);
+ data_item_win->height = 1;
+ data_item_win->width = (precision == double_precision) ?
+ item_win_width + 2 : item_win_width + 1;
+ data_item_win->origin.x = (item_win_width * j) + 1;
+ data_item_win->origin.y = cur_y;
+ tui_make_window (data_item_win, DONT_BOX_WINDOW);
+ scrollok (data_item_win->handle, FALSE);
}
- touchwin (dataItemWin->handle);
+ touchwin (data_item_win->handle);
/*
** Get the printable representation of the register
** and display it
*/
- _tuiDisplayRegister (
- dataElementPtr->itemNo, dataItemWin, precision);
+ tui_display_register (
+ data_element_ptr->item_no, data_item_win, precision);
i++; /* next register */
}
- curY++; /* next row; */
+ cur_y++; /* next row; */
}
}
@@ -359,79 +351,73 @@ tui_display_registers_from (int startElementNo)
}
-/*
- ** tuiDisplayRegElementAtLine().
- ** Function to display the registers in the content from
- ** 'startElementNo' on 'startLineNo' until the end of the
- ** register content or the end of the display height.
- ** This function checks that we won't display off the end
- ** of the register display.
- */
+/* Function to display the registers in the content from
+ 'start_element_no' on 'start_line_no' until the end of the register
+ content or the end of the display height. This function checks
+ that we won't display off the end of the register display. */
void
-tuiDisplayRegElementAtLine (int startElementNo, int startLineNo)
+tui_display_reg_element_at_line (int start_element_no, int start_line_no)
{
- if (dataWin->detail.dataDisplayInfo.regsContent != (TuiWinContent) NULL &&
- dataWin->detail.dataDisplayInfo.regsContentCount > 0)
+ if (TUI_DATA_WIN->detail.data_display_info.regs_content != (tui_win_content) NULL &&
+ TUI_DATA_WIN->detail.data_display_info.regs_content_count > 0)
{
- register int elementNo = startElementNo;
+ int element_no = start_element_no;
- if (startElementNo != 0 && startLineNo != 0)
+ if (start_element_no != 0 && start_line_no != 0)
{
- register int lastLineNo, firstLineOnLastPage;
+ int last_line_no, first_line_on_last_page;
- lastLineNo = tui_last_regs_line_no ();
- firstLineOnLastPage = lastLineNo - (dataWin->generic.height - 2);
- if (firstLineOnLastPage < 0)
- firstLineOnLastPage = 0;
+ last_line_no = tui_last_regs_line_no ();
+ first_line_on_last_page = last_line_no - (TUI_DATA_WIN->generic.height - 2);
+ if (first_line_on_last_page < 0)
+ first_line_on_last_page = 0;
/*
** If there is no other data displayed except registers,
- ** and the elementNo causes us to scroll past the end of the
+ ** and the element_no causes us to scroll past the end of the
** registers, adjust what element to really start the display at.
*/
- if (dataWin->detail.dataDisplayInfo.dataContentCount <= 0 &&
- startLineNo > firstLineOnLastPage)
- elementNo = tui_first_reg_element_no_inline (firstLineOnLastPage);
+ if (TUI_DATA_WIN->detail.data_display_info.data_content_count <= 0 &&
+ start_line_no > first_line_on_last_page)
+ element_no = tui_first_reg_element_no_inline (first_line_on_last_page);
}
- tui_display_registers_from (elementNo);
+ tui_display_registers_from (element_no);
}
-
- return;
-} /* tuiDisplayRegElementAtLine */
+}
-/* Function to display the registers starting at line lineNo in the
+/* Function to display the registers starting at line line_no in the
data window. Answers the line number that the display actually
started from. If nothing is displayed (-1) is returned. */
int
-tui_display_registers_from_line (int lineNo, int forceDisplay)
+tui_display_registers_from_line (int line_no, int force_display)
{
- if (dataWin->detail.dataDisplayInfo.regsContentCount > 0)
+ if (TUI_DATA_WIN->detail.data_display_info.regs_content_count > 0)
{
- int line, elementNo;
+ int line, element_no;
- if (lineNo < 0)
+ if (line_no < 0)
line = 0;
- else if (forceDisplay)
+ else if (force_display)
{ /*
- ** If we must display regs (forceDisplay is true), then make
+ ** If we must display regs (force_display is true), then make
** sure that we don't display off the end of the registers.
*/
- if (lineNo >= tui_last_regs_line_no ())
+ if (line_no >= tui_last_regs_line_no ())
{
if ((line = tui_line_from_reg_element_no (
- dataWin->detail.dataDisplayInfo.regsContentCount - 1)) < 0)
+ TUI_DATA_WIN->detail.data_display_info.regs_content_count - 1)) < 0)
line = 0;
}
else
- line = lineNo;
+ line = line_no;
}
else
- line = lineNo;
+ line = line_no;
- elementNo = tui_first_reg_element_no_inline (line);
- if (elementNo < dataWin->detail.dataDisplayInfo.regsContentCount)
- tuiDisplayRegElementAtLine (elementNo, line);
+ element_no = tui_first_reg_element_no_inline (line);
+ if (element_no < TUI_DATA_WIN->detail.data_display_info.regs_content_count)
+ tui_display_reg_element_at_line (element_no, line);
else
line = (-1);
@@ -448,51 +434,51 @@ tui_display_registers_from_line (int lineNo, int forceDisplay)
void
tui_check_register_values (struct frame_info *frame)
{
- if (m_winPtrNotNull (dataWin) && dataWin->generic.isVisible)
+ if (TUI_DATA_WIN != NULL && TUI_DATA_WIN->generic.is_visible)
{
- if (dataWin->detail.dataDisplayInfo.regsContentCount <= 0 &&
- dataWin->detail.dataDisplayInfo.displayRegs)
- tui_show_registers ((tuiLayoutDef ())->regsDisplayType);
+ if (TUI_DATA_WIN->detail.data_display_info.regs_content_count <= 0 &&
+ TUI_DATA_WIN->detail.data_display_info.display_regs)
+ tui_show_registers ((tui_layout_def ())->regs_display_type);
else
{
int i, j;
- char rawBuf[MAX_REGISTER_SIZE];
+ char raw_buf[MAX_REGISTER_SIZE];
for (i = 0;
- (i < dataWin->detail.dataDisplayInfo.regsContentCount); i++)
+ (i < TUI_DATA_WIN->detail.data_display_info.regs_content_count); i++)
{
- TuiDataElementPtr dataElementPtr;
- TuiGenWinInfoPtr dataItemWinPtr;
- int wasHilighted;
-
- dataItemWinPtr = &dataWin->detail.dataDisplayInfo.
- regsContent[i]->whichElement.dataWindow;
- dataElementPtr = &((TuiWinElementPtr)
- dataItemWinPtr->content[0])->whichElement.data;
- wasHilighted = dataElementPtr->highlight;
- dataElementPtr->highlight =
- _tuiRegValueHasChanged (dataElementPtr, frame, &rawBuf[0]);
- if (dataElementPtr->highlight)
+ struct tui_data_element * data_element_ptr;
+ struct tui_gen_win_info * data_item_win_ptr;
+ int was_hilighted;
+
+ data_item_win_ptr = &TUI_DATA_WIN->detail.data_display_info.
+ regs_content[i]->which_element.data_window;
+ data_element_ptr = &((struct tui_win_element *)
+ data_item_win_ptr->content[0])->which_element.data;
+ was_hilighted = data_element_ptr->highlight;
+ data_element_ptr->highlight =
+ tui_reg_value_has_changed (data_element_ptr, frame, &raw_buf[0]);
+ if (data_element_ptr->highlight)
{
int size;
- size = DEPRECATED_REGISTER_RAW_SIZE (dataElementPtr->itemNo);
+ size = DEPRECATED_REGISTER_RAW_SIZE (data_element_ptr->item_no);
for (j = 0; j < size; j++)
- ((char *) dataElementPtr->value)[j] = rawBuf[j];
- _tuiDisplayRegister (
- dataElementPtr->itemNo,
- dataItemWinPtr,
- ((dataWin->detail.dataDisplayInfo.regsDisplayType ==
+ ((char *) data_element_ptr->value)[j] = raw_buf[j];
+ tui_display_register (
+ data_element_ptr->item_no,
+ data_item_win_ptr,
+ ((TUI_DATA_WIN->detail.data_display_info.regs_display_type ==
TUI_DFLOAT_REGS) ?
double_precision : unspecified_precision));
}
- else if (wasHilighted)
+ else if (was_hilighted)
{
- dataElementPtr->highlight = FALSE;
- _tuiDisplayRegister (
- dataElementPtr->itemNo,
- dataItemWinPtr,
- ((dataWin->detail.dataDisplayInfo.regsDisplayType ==
+ data_element_ptr->highlight = FALSE;
+ tui_display_register (
+ data_element_ptr->item_no,
+ data_item_win_ptr,
+ ((TUI_DATA_WIN->detail.data_display_info.regs_display_type ==
TUI_DFLOAT_REGS) ?
double_precision : unspecified_precision));
}
@@ -504,47 +490,47 @@ tui_check_register_values (struct frame_info *frame)
/*
- ** tuiToggleFloatRegs().
+ ** tui_toggle_float_regs().
*/
void
-tuiToggleFloatRegs (void)
+tui_toggle_float_regs (void)
{
- TuiLayoutDefPtr layoutDef = tuiLayoutDef ();
+ struct tui_layout_def * layout_def = tui_layout_def ();
- if (layoutDef->floatRegsDisplayType == TUI_SFLOAT_REGS)
- layoutDef->floatRegsDisplayType = TUI_DFLOAT_REGS;
+ if (layout_def->float_regs_display_type == TUI_SFLOAT_REGS)
+ layout_def->float_regs_display_type = TUI_DFLOAT_REGS;
else
- layoutDef->floatRegsDisplayType = TUI_SFLOAT_REGS;
+ layout_def->float_regs_display_type = TUI_SFLOAT_REGS;
- if (m_winPtrNotNull (dataWin) && dataWin->generic.isVisible &&
- (dataWin->detail.dataDisplayInfo.regsDisplayType == TUI_SFLOAT_REGS ||
- dataWin->detail.dataDisplayInfo.regsDisplayType == TUI_DFLOAT_REGS))
- tui_show_registers (layoutDef->floatRegsDisplayType);
+ if (TUI_DATA_WIN != NULL && TUI_DATA_WIN->generic.is_visible &&
+ (TUI_DATA_WIN->detail.data_display_info.regs_display_type == TUI_SFLOAT_REGS ||
+ TUI_DATA_WIN->detail.data_display_info.regs_display_type == TUI_DFLOAT_REGS))
+ tui_show_registers (layout_def->float_regs_display_type);
return;
-} /* tuiToggleFloatRegs */
+} /* tui_toggle_float_regs */
void
-_initialize_tuiRegs (void)
+_initialize_tui_regs (void)
{
if (xdb_commands)
{
- add_com ("fr", class_tui, _tuiShowFloat_command,
+ add_com ("fr", class_tui, tui_show_float_command,
"Display only floating point registers\n");
- add_com ("gr", class_tui, _tuiShowGeneral_command,
+ add_com ("gr", class_tui, tui_show_general_command,
"Display only general registers\n");
- add_com ("sr", class_tui, _tuiShowSpecial_command,
+ add_com ("sr", class_tui, tui_show_special_command,
"Display only special registers\n");
- add_com ("+r", class_tui, _tuiScrollRegsForward_command,
+ add_com ("+r", class_tui, tui_scroll_regs_forward_command,
"Scroll the registers window forward\n");
- add_com ("-r", class_tui, _tuiScrollRegsBackward_command,
+ add_com ("-r", class_tui, tui_scroll_regs_backward_command,
"Scroll the register window backward\n");
- add_com ("tf", class_tui, _tuiToggleFloatRegs_command,
+ add_com ("tf", class_tui, _tui_toggle_float_regs_command,
"Toggle between single and double precision floating point registers.\n");
add_cmd (TUI_FLOAT_REGS_NAME_LOWER,
class_tui,
- _tuiToggleFloatRegs_command,
+ _tui_toggle_float_regs_command,
"Toggle between single and double precision floating point \
registers.\n",
&togglelist);
@@ -558,13 +544,13 @@ registers.\n",
/*
- ** _tuiRegisterName().
+ ** tui_register_name().
** Return the register name.
*/
static const char *
-_tuiRegisterName (int regNum)
+tui_register_name (int reg_num)
{
- return REGISTER_NAME (regNum);
+ return REGISTER_NAME (reg_num);
}
extern int pagination_enabled;
@@ -577,13 +563,13 @@ tui_restore_gdbout (void *ui)
}
/*
- ** _tuiRegisterFormat
+ ** tui_register_format
** Function to format the register name and value into a buffer,
** suitable for printing or display
*/
static void
-_tuiRegisterFormat (char *buf, int bufLen, int regNum,
- TuiDataElementPtr dataElement,
+tui_register_format (char *buf, int buf_len, int reg_num,
+ struct tui_data_element * data_element,
enum precision_type precision)
{
struct ui_file *stream;
@@ -593,7 +579,7 @@ _tuiRegisterFormat (char *buf, int bufLen, int regNum,
char *p;
int pos;
- name = REGISTER_NAME (regNum);
+ name = REGISTER_NAME (reg_num);
if (name == 0)
{
strcpy (buf, "");
@@ -602,30 +588,30 @@ _tuiRegisterFormat (char *buf, int bufLen, int regNum,
pagination_enabled = 0;
old_stdout = gdb_stdout;
- stream = tui_sfileopen (bufLen);
+ stream = tui_sfileopen (buf_len);
gdb_stdout = stream;
cleanups = make_cleanup (tui_restore_gdbout, (void*) old_stdout);
gdbarch_print_registers_info (current_gdbarch, stream, deprecated_selected_frame,
- regNum, 1);
+ reg_num, 1);
/* Save formatted output in the buffer. */
p = tui_file_get_strbuf (stream);
pos = 0;
- while (*p && *p == *name++ && bufLen)
+ while (*p && *p == *name++ && buf_len)
{
*buf++ = *p++;
- bufLen--;
+ buf_len--;
pos++;
}
while (*p == ' ')
p++;
- while (pos < 8 && bufLen)
+ while (pos < 8 && buf_len)
{
*buf++ = ' ';
- bufLen--;
+ buf_len--;
pos++;
}
- strncpy (buf, p, bufLen);
+ strncpy (buf, p, buf_len);
/* Remove the possible \n. */
p = strchr (buf, '\n');
@@ -637,20 +623,18 @@ _tuiRegisterFormat (char *buf, int bufLen, int regNum,
#define NUM_GENERAL_REGS 32
-/*
- ** _tuiSetGeneralRegsContent().
- ** Set the content of the data window to consist of the general registers.
- */
-static TuiStatus
-_tuiSetGeneralRegsContent (int refreshValuesOnly)
+/* Set the content of the data window to consist of the general
+ registers. */
+static enum tui_status
+tui_set_general_regs_content (int refresh_values_only)
{
- return (_tuiSetRegsContent (0,
+ return (tui_set_regs_content (0,
NUM_GENERAL_REGS - 1,
deprecated_selected_frame,
TUI_GENERAL_REGS,
- refreshValuesOnly));
+ refresh_values_only));
-} /* _tuiSetGeneralRegsContent */
+}
#ifndef PCOQ_HEAD_REGNUM
@@ -659,365 +643,336 @@ _tuiSetGeneralRegsContent (int refreshValuesOnly)
#define START_SPECIAL_REGS PCOQ_HEAD_REGNUM
#endif
-/*
- ** _tuiSetSpecialRegsContent().
- ** Set the content of the data window to consist of the special registers.
- */
-static TuiStatus
-_tuiSetSpecialRegsContent (int refreshValuesOnly)
+/* Set the content of the data window to consist of the special
+ registers. */
+static enum tui_status
+tui_set_special_regs_content (int refresh_values_only)
{
- TuiStatus ret = TUI_FAILURE;
- int endRegNum;
+ enum tui_status ret = TUI_FAILURE;
+ int end_reg_num;
- endRegNum = FP0_REGNUM - 1;
- ret = _tuiSetRegsContent (START_SPECIAL_REGS,
- endRegNum,
+ end_reg_num = FP0_REGNUM - 1;
+ ret = tui_set_regs_content (START_SPECIAL_REGS,
+ end_reg_num,
deprecated_selected_frame,
TUI_SPECIAL_REGS,
- refreshValuesOnly);
+ refresh_values_only);
return ret;
-} /* _tuiSetSpecialRegsContent */
+}
-/*
- ** _tuiSetGeneralAndSpecialRegsContent().
- ** Set the content of the data window to consist of the special registers.
- */
-static TuiStatus
-_tuiSetGeneralAndSpecialRegsContent (int refreshValuesOnly)
+/* Set the content of the data window to consist of the special
+ registers. */
+static enum tui_status
+tui_set_general_and_special_regs_content (int refresh_values_only)
{
- TuiStatus ret = TUI_FAILURE;
- int endRegNum = (-1);
+ enum tui_status ret = TUI_FAILURE;
+ int end_reg_num = (-1);
- endRegNum = FP0_REGNUM - 1;
- ret = _tuiSetRegsContent (
- 0, endRegNum, deprecated_selected_frame, TUI_SPECIAL_REGS, refreshValuesOnly);
+ end_reg_num = FP0_REGNUM - 1;
+ ret = tui_set_regs_content (
+ 0, end_reg_num, deprecated_selected_frame, TUI_SPECIAL_REGS, refresh_values_only);
return ret;
-} /* _tuiSetGeneralAndSpecialRegsContent */
+}
-/*
- ** _tuiSetFloatRegsContent().
- ** Set the content of the data window to consist of the float registers.
- */
-static TuiStatus
-_tuiSetFloatRegsContent (TuiRegisterDisplayType dpyType, int refreshValuesOnly)
+/* Set the content of the data window to consist of the float
+ registers. */
+static enum tui_status
+tui_set_float_regs_content (enum tui_register_display_type dpy_type,
+ int refresh_values_only)
{
- TuiStatus ret = TUI_FAILURE;
- int startRegNum;
+ enum tui_status ret = TUI_FAILURE;
+ int start_reg_num;
- startRegNum = FP0_REGNUM;
- ret = _tuiSetRegsContent (startRegNum,
+ start_reg_num = FP0_REGNUM;
+ ret = tui_set_regs_content (start_reg_num,
NUM_REGS - 1,
deprecated_selected_frame,
- dpyType,
- refreshValuesOnly);
+ dpy_type,
+ refresh_values_only);
return ret;
-} /* _tuiSetFloatRegsContent */
+}
-/*
- ** _tuiRegValueHasChanged().
- ** Answer TRUE if the register's value has changed, FALSE otherwise.
- ** If TRUE, newValue is filled in with the new value.
- */
+/* Answer TRUE if the register's value has changed, FALSE otherwise.
+ If TRUE, new_value is filled in with the new value. */
static int
-_tuiRegValueHasChanged (TuiDataElementPtr dataElement,
- struct frame_info *frame,
- char *newValue)
+tui_reg_value_has_changed (struct tui_data_element * data_element,
+ struct frame_info *frame, char *new_value)
{
- int hasChanged = FALSE;
+ int has_changed = FALSE;
- if (dataElement->itemNo != UNDEFINED_ITEM &&
- _tuiRegisterName (dataElement->itemNo) != (char *) NULL)
+ if (data_element->item_no != UNDEFINED_ITEM &&
+ tui_register_name (data_element->item_no) != (char *) NULL)
{
- char rawBuf[MAX_REGISTER_SIZE];
+ char raw_buf[MAX_REGISTER_SIZE];
int i;
- if (_tuiGetRegisterRawValue (
- dataElement->itemNo, rawBuf, frame) == TUI_SUCCESS)
+ if (tui_get_register_raw_value (data_element->item_no, raw_buf, frame) == TUI_SUCCESS)
{
- int size = DEPRECATED_REGISTER_RAW_SIZE (dataElement->itemNo);
+ int size = DEPRECATED_REGISTER_RAW_SIZE (data_element->item_no);
- for (i = 0; (i < size && !hasChanged); i++)
- hasChanged = (((char *) dataElement->value)[i] != rawBuf[i]);
- if (hasChanged && newValue != (char *) NULL)
+ for (i = 0; (i < size && !has_changed); i++)
+ has_changed = (((char *) data_element->value)[i] != raw_buf[i]);
+ if (has_changed && new_value != (char *) NULL)
{
for (i = 0; i < size; i++)
- newValue[i] = rawBuf[i];
+ new_value[i] = raw_buf[i];
}
}
}
- return hasChanged;
-} /* _tuiRegValueHasChanged */
+ return has_changed;
+}
-/*
- ** _tuiGetRegisterRawValue().
- ** Get the register raw value. The raw value is returned in regValue.
- */
-static TuiStatus
-_tuiGetRegisterRawValue (int regNum, char *regValue, struct frame_info *frame)
+/* Get the register raw value. The raw value is returned in reg_value. */
+static enum tui_status
+tui_get_register_raw_value (int reg_num, char *reg_value, struct frame_info *frame)
{
- TuiStatus ret = TUI_FAILURE;
+ enum tui_status ret = TUI_FAILURE;
if (target_has_registers)
{
- get_frame_register (frame, regNum, regValue);
+ get_frame_register (frame, reg_num, reg_value);
/* NOTE: cagney/2003-03-13: This is bogus. It is refering to
the register cache and not the frame which could have pulled
the register value off the stack. */
- if (register_cached (regNum) >= 0)
+ if (register_cached (reg_num) >= 0)
ret = TUI_SUCCESS;
}
return ret;
-} /* _tuiGetRegisterRawValue */
+}
-/*
- ** _tuiSetRegisterElement().
- ** Function to initialize a data element with the input and
- ** the register value.
- */
+/* Function to initialize a data element with the input and the
+ register value. */
static void
-_tuiSetRegisterElement (int regNum, struct frame_info *frame,
- TuiDataElementPtr dataElement,
- int refreshValueOnly)
+tui_set_register_element (int reg_num, struct frame_info *frame,
+ struct tui_data_element * data_element,
+ int refresh_value_only)
{
- if (dataElement != (TuiDataElementPtr) NULL)
+ if (data_element != (struct tui_data_element *) NULL)
{
- if (!refreshValueOnly)
+ if (!refresh_value_only)
{
- dataElement->itemNo = regNum;
- dataElement->name = _tuiRegisterName (regNum);
- dataElement->highlight = FALSE;
+ data_element->item_no = reg_num;
+ data_element->name = tui_register_name (reg_num);
+ data_element->highlight = FALSE;
}
- if (dataElement->value == (Opaque) NULL)
- dataElement->value = (Opaque) xmalloc (MAX_REGISTER_SIZE);
- if (dataElement->value != (Opaque) NULL)
- _tuiGetRegisterRawValue (regNum, dataElement->value, frame);
+ if (data_element->value == NULL)
+ data_element->value = xmalloc (MAX_REGISTER_SIZE);
+ if (data_element->value != NULL)
+ tui_get_register_raw_value (reg_num, data_element->value, frame);
}
-
- return;
-} /* _tuiSetRegisterElement */
+}
-/*
- ** _tuiSetRegsContent().
- ** Set the content of the data window to consist of the registers
- ** numbered from startRegNum to endRegNum. Note that if
- ** refreshValuesOnly is TRUE, startRegNum and endRegNum are ignored.
- */
-static TuiStatus
-_tuiSetRegsContent (int startRegNum, int endRegNum,
+/* Set the content of the data window to consist of the registers
+ numbered from start_reg_num to end_reg_num. Note that if
+ refresh_values_only is TRUE, start_reg_num and end_reg_num are
+ ignored. */
+static enum tui_status
+tui_set_regs_content (int start_reg_num, int end_reg_num,
struct frame_info *frame,
- TuiRegisterDisplayType dpyType,
- int refreshValuesOnly)
+ enum tui_register_display_type dpy_type,
+ int refresh_values_only)
{
- TuiStatus ret = TUI_FAILURE;
- int numRegs = endRegNum - startRegNum + 1;
- int allocatedHere = FALSE;
+ enum tui_status ret = TUI_FAILURE;
+ int num_regs = end_reg_num - start_reg_num + 1;
+ int allocated_here = FALSE;
- if (dataWin->detail.dataDisplayInfo.regsContentCount > 0 &&
- !refreshValuesOnly)
+ if (TUI_DATA_WIN->detail.data_display_info.regs_content_count > 0 &&
+ !refresh_values_only)
{
- freeDataContent (dataWin->detail.dataDisplayInfo.regsContent,
- dataWin->detail.dataDisplayInfo.regsContentCount);
- dataWin->detail.dataDisplayInfo.regsContentCount = 0;
+ tui_free_data_content (TUI_DATA_WIN->detail.data_display_info.regs_content,
+ TUI_DATA_WIN->detail.data_display_info.regs_content_count);
+ TUI_DATA_WIN->detail.data_display_info.regs_content_count = 0;
}
- if (dataWin->detail.dataDisplayInfo.regsContentCount <= 0)
+ if (TUI_DATA_WIN->detail.data_display_info.regs_content_count <= 0)
{
- dataWin->detail.dataDisplayInfo.regsContent =
- allocContent (numRegs, DATA_WIN);
- allocatedHere = TRUE;
+ TUI_DATA_WIN->detail.data_display_info.regs_content =
+ tui_alloc_content (num_regs, DATA_WIN);
+ allocated_here = TRUE;
}
- if (dataWin->detail.dataDisplayInfo.regsContent != (TuiWinContent) NULL)
+ if (TUI_DATA_WIN->detail.data_display_info.regs_content != (tui_win_content) NULL)
{
int i;
- if (!refreshValuesOnly || allocatedHere)
+ if (!refresh_values_only || allocated_here)
{
- dataWin->generic.content = (OpaquePtr) NULL;
- dataWin->generic.contentSize = 0;
- addContentElements (&dataWin->generic, numRegs);
- dataWin->detail.dataDisplayInfo.regsContent =
- (TuiWinContent) dataWin->generic.content;
- dataWin->detail.dataDisplayInfo.regsContentCount = numRegs;
+ TUI_DATA_WIN->generic.content = NULL;
+ TUI_DATA_WIN->generic.content_size = 0;
+ tui_add_content_elements (&TUI_DATA_WIN->generic, num_regs);
+ TUI_DATA_WIN->detail.data_display_info.regs_content =
+ (tui_win_content) TUI_DATA_WIN->generic.content;
+ TUI_DATA_WIN->detail.data_display_info.regs_content_count = num_regs;
}
/*
** Now set the register names and values
*/
- for (i = startRegNum; (i <= endRegNum); i++)
+ for (i = start_reg_num; (i <= end_reg_num); i++)
{
- TuiGenWinInfoPtr dataItemWin;
+ struct tui_gen_win_info * data_item_win;
- dataItemWin = &dataWin->detail.dataDisplayInfo.
- regsContent[i - startRegNum]->whichElement.dataWindow;
- _tuiSetRegisterElement (
+ data_item_win = &TUI_DATA_WIN->detail.data_display_info.
+ regs_content[i - start_reg_num]->which_element.data_window;
+ tui_set_register_element (
i,
frame,
- &((TuiWinElementPtr) dataItemWin->content[0])->whichElement.data,
- !allocatedHere && refreshValuesOnly);
+ &((struct tui_win_element *) data_item_win->content[0])->which_element.data,
+ !allocated_here && refresh_values_only);
}
- dataWin->detail.dataDisplayInfo.regsColumnCount =
- tui_calculate_regs_column_count (dpyType);
+ TUI_DATA_WIN->detail.data_display_info.regs_column_count =
+ tui_calculate_regs_column_count (dpy_type);
#ifdef LATER
- if (dataWin->detail.dataDisplayInfo.dataContentCount > 0)
+ if (TUI_DATA_WIN->detail.data_display_info.data_content_count > 0)
{
/* delete all the windows? */
- /* realloc content equal to dataContentCount + regsContentCount */
- /* append dataWin->detail.dataDisplayInfo.dataContent to content */
+ /* realloc content equal to data_content_count + regs_content_count */
+ /* append TUI_DATA_WIN->detail.data_display_info.data_content to content */
}
#endif
- dataWin->generic.contentSize =
- dataWin->detail.dataDisplayInfo.regsContentCount +
- dataWin->detail.dataDisplayInfo.dataContentCount;
+ TUI_DATA_WIN->generic.content_size =
+ TUI_DATA_WIN->detail.data_display_info.regs_content_count +
+ TUI_DATA_WIN->detail.data_display_info.data_content_count;
ret = TUI_SUCCESS;
}
return ret;
-} /* _tuiSetRegsContent */
+}
-/*
- ** _tuiDisplayRegister().
- ** Function to display a register in a window. If hilite is TRUE,
- ** than the value will be displayed in reverse video
- */
+/* Function to display a register in a window. If hilite is TRUE,
+ than the value will be displayed in reverse video. */
static void
-_tuiDisplayRegister (int regNum,
- TuiGenWinInfoPtr winInfo, /* the data item window */
+tui_display_register (int reg_num,
+ struct tui_gen_win_info * win_info, /* the data item window */
enum precision_type precision)
{
- if (winInfo->handle != (WINDOW *) NULL)
+ if (win_info->handle != (WINDOW *) NULL)
{
int i;
char buf[40];
- int valueCharsWide, labelWidth;
- TuiDataElementPtr dataElementPtr = &((TuiWinContent)
- winInfo->content)[0]->whichElement.data;
+ int value_chars_wide, label_width;
+ struct tui_data_element * data_element_ptr = &((tui_win_content)
+ win_info->content)[0]->which_element.data;
if (IS_64BIT ||
- dataWin->detail.dataDisplayInfo.regsDisplayType == TUI_DFLOAT_REGS)
+ TUI_DATA_WIN->detail.data_display_info.regs_display_type == TUI_DFLOAT_REGS)
{
- valueCharsWide = DOUBLE_FLOAT_VALUE_WIDTH;
- labelWidth = DOUBLE_FLOAT_LABEL_WIDTH;
+ value_chars_wide = DOUBLE_FLOAT_VALUE_WIDTH;
+ label_width = DOUBLE_FLOAT_LABEL_WIDTH;
}
else
{
- if (dataWin->detail.dataDisplayInfo.regsDisplayType ==
+ if (TUI_DATA_WIN->detail.data_display_info.regs_display_type ==
TUI_SFLOAT_REGS)
{
- valueCharsWide = SINGLE_FLOAT_VALUE_WIDTH;
- labelWidth = SINGLE_FLOAT_LABEL_WIDTH;
+ value_chars_wide = SINGLE_FLOAT_VALUE_WIDTH;
+ label_width = SINGLE_FLOAT_LABEL_WIDTH;
}
else
{
- valueCharsWide = SINGLE_VALUE_WIDTH;
- labelWidth = SINGLE_LABEL_WIDTH;
+ value_chars_wide = SINGLE_VALUE_WIDTH;
+ label_width = SINGLE_LABEL_WIDTH;
}
}
buf[0] = (char) 0;
- _tuiRegisterFormat (buf,
- valueCharsWide + labelWidth,
- regNum,
- dataElementPtr,
+ tui_register_format (buf,
+ value_chars_wide + label_width,
+ reg_num,
+ data_element_ptr,
precision);
- if (dataElementPtr->highlight)
- wstandout (winInfo->handle);
+ if (data_element_ptr->highlight)
+ wstandout (win_info->handle);
- wmove (winInfo->handle, 0, 0);
- for (i = 1; i < winInfo->width; i++)
- waddch (winInfo->handle, ' ');
- wmove (winInfo->handle, 0, 0);
- waddstr (winInfo->handle, buf);
+ wmove (win_info->handle, 0, 0);
+ for (i = 1; i < win_info->width; i++)
+ waddch (win_info->handle, ' ');
+ wmove (win_info->handle, 0, 0);
+ waddstr (win_info->handle, buf);
- if (dataElementPtr->highlight)
- wstandend (winInfo->handle);
- tuiRefreshWin (winInfo);
+ if (data_element_ptr->highlight)
+ wstandend (win_info->handle);
+ tui_refresh_win (win_info);
}
- return;
-} /* _tuiDisplayRegister */
+}
static void
-_tui_vShowRegisters_commandSupport (TuiRegisterDisplayType dpyType)
+tui_v_show_registers_command_support (enum tui_register_display_type dpy_type)
{
- if (m_winPtrNotNull (dataWin) && dataWin->generic.isVisible)
+ if (TUI_DATA_WIN != NULL && TUI_DATA_WIN->generic.is_visible)
{ /* Data window already displayed, show the registers */
- if (dataWin->detail.dataDisplayInfo.regsDisplayType != dpyType)
- tui_show_registers (dpyType);
+ if (TUI_DATA_WIN->detail.data_display_info.regs_display_type != dpy_type)
+ tui_show_registers (dpy_type);
}
else
- (tuiLayoutDef ())->regsDisplayType = dpyType;
+ (tui_layout_def ())->regs_display_type = dpy_type;
return;
-} /* _tui_vShowRegisters_commandSupport */
+}
static void
-_tuiShowFloat_command (char *arg, int fromTTY)
+tui_show_float_command (char *arg, int from_tty)
{
- if (m_winPtrIsNull (dataWin) || !dataWin->generic.isVisible ||
- (dataWin->detail.dataDisplayInfo.regsDisplayType != TUI_SFLOAT_REGS &&
- dataWin->detail.dataDisplayInfo.regsDisplayType != TUI_DFLOAT_REGS))
- _tui_vShowRegisters_commandSupport ((tuiLayoutDef ())->floatRegsDisplayType);
-
- return;
-} /* _tuiShowFloat_command */
+ if (TUI_DATA_WIN == NULL || !TUI_DATA_WIN->generic.is_visible ||
+ (TUI_DATA_WIN->detail.data_display_info.regs_display_type != TUI_SFLOAT_REGS &&
+ TUI_DATA_WIN->detail.data_display_info.regs_display_type != TUI_DFLOAT_REGS))
+ tui_v_show_registers_command_support ((tui_layout_def ())->float_regs_display_type);
+}
static void
-_tuiShowGeneral_command (char *arg, int fromTTY)
+tui_show_general_command (char *arg, int from_tty)
{
- _tui_vShowRegisters_commandSupport (TUI_GENERAL_REGS);
+ tui_v_show_registers_command_support (TUI_GENERAL_REGS);
}
static void
-_tuiShowSpecial_command (char *arg, int fromTTY)
+tui_show_special_command (char *arg, int from_tty)
{
- _tui_vShowRegisters_commandSupport (TUI_SPECIAL_REGS);
+ tui_v_show_registers_command_support (TUI_SPECIAL_REGS);
}
static void
-_tuiToggleFloatRegs_command (char *arg, int fromTTY)
+_tui_toggle_float_regs_command (char *arg, int from_tty)
{
- if (m_winPtrNotNull (dataWin) && dataWin->generic.isVisible)
- tuiToggleFloatRegs ();
+ if (TUI_DATA_WIN != NULL && TUI_DATA_WIN->generic.is_visible)
+ tui_toggle_float_regs ();
else
{
- TuiLayoutDefPtr layoutDef = tuiLayoutDef ();
+ struct tui_layout_def * layout_def = tui_layout_def ();
- if (layoutDef->floatRegsDisplayType == TUI_SFLOAT_REGS)
- layoutDef->floatRegsDisplayType = TUI_DFLOAT_REGS;
+ if (layout_def->float_regs_display_type == TUI_SFLOAT_REGS)
+ layout_def->float_regs_display_type = TUI_DFLOAT_REGS;
else
- layoutDef->floatRegsDisplayType = TUI_SFLOAT_REGS;
+ layout_def->float_regs_display_type = TUI_SFLOAT_REGS;
}
-
-
- return;
-} /* _tuiToggleFloatRegs_command */
+}
static void
-_tuiScrollRegsForward_command (char *arg, int fromTTY)
+tui_scroll_regs_forward_command (char *arg, int from_tty)
{
- tui_scroll (FORWARD_SCROLL, dataWin, 1);
+ tui_scroll (FORWARD_SCROLL, TUI_DATA_WIN, 1);
}
static void
-_tuiScrollRegsBackward_command (char *arg, int fromTTY)
+tui_scroll_regs_backward_command (char *arg, int from_tty)
{
- tui_scroll (BACKWARD_SCROLL, dataWin, 1);
+ tui_scroll (BACKWARD_SCROLL, TUI_DATA_WIN, 1);
}
diff --git a/gdb/tui/tui-regs.h b/gdb/tui/tui-regs.h
index 19703a2..c4de123 100644
--- a/gdb/tui/tui-regs.h
+++ b/gdb/tui/tui-regs.h
@@ -25,7 +25,7 @@
#ifndef TUI_REGS_H
#define TUI_REGS_H
-#include "tui/tui-data.h" /* For TuiRegisterDisplayType. */
+#include "tui/tui-data.h" /* For struct tui_register_display_type. */
extern void tui_check_register_values (struct frame_info *);
extern void tui_show_registers (enum tui_register_display_type);
diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c
index f2d3762..5a148a6 100644
--- a/gdb/tui/tui-source.c
+++ b/gdb/tui/tui-source.c
@@ -1,7 +1,7 @@
/* TUI display source window.
- Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation,
- Inc.
+ Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
+ Foundation, Inc.
Contributed by Hewlett-Packard Company.
@@ -36,39 +36,33 @@
#include "tui/tui-winsource.h"
#include "tui/tui-source.h"
-#ifdef HAVE_NCURSES_H
-#include <ncurses.h>
-#else
-#ifdef HAVE_CURSES_H
-#include <curses.h>
-#endif
-#endif
+#include "gdb_curses.h"
/* Function to display source in the source window. */
-TuiStatus
-tuiSetSourceContent (struct symtab *s, int lineNo, int noerror)
+enum tui_status
+tui_set_source_content (struct symtab *s, int line_no, int noerror)
{
- TuiStatus ret = TUI_FAILURE;
+ enum tui_status ret = TUI_FAILURE;
if (s != (struct symtab *) NULL && s->filename != (char *) NULL)
{
- register FILE *stream;
- register int i, desc, c, lineWidth, nlines;
- register char *srcLine = 0;
+ FILE *stream;
+ int i, desc, c, line_width, nlines;
+ char *src_line = 0;
- if ((ret = tuiAllocSourceBuffer (srcWin)) == TUI_SUCCESS)
+ if ((ret = tui_alloc_source_buffer (TUI_SRC_WIN)) == TUI_SUCCESS)
{
- lineWidth = srcWin->generic.width - 1;
+ line_width = TUI_SRC_WIN->generic.width - 1;
/* Take hilite (window border) into account, when calculating
the number of lines */
- nlines = (lineNo + (srcWin->generic.height - 2)) - lineNo;
+ nlines = (line_no + (TUI_SRC_WIN->generic.height - 2)) - line_no;
desc = open_source_file (s);
if (desc < 0)
{
if (!noerror)
{
char *name = alloca (strlen (s->filename) + 100);
- sprintf (name, "%s:%d", s->filename, lineNo);
+ sprintf (name, "%s:%d", s->filename, line_no);
print_sys_errmsg (name, errno);
}
ret = TUI_FAILURE;
@@ -78,27 +72,27 @@ tuiSetSourceContent (struct symtab *s, int lineNo, int noerror)
if (s->line_charpos == 0)
find_source_lines (s, desc);
- if (lineNo < 1 || lineNo > s->nlines)
+ if (line_no < 1 || line_no > s->nlines)
{
close (desc);
printf_unfiltered (
"Line number %d out of range; %s has %d lines.\n",
- lineNo, s->filename, s->nlines);
+ line_no, s->filename, s->nlines);
}
- else if (lseek (desc, s->line_charpos[lineNo - 1], 0) < 0)
+ else if (lseek (desc, s->line_charpos[line_no - 1], 0) < 0)
{
close (desc);
perror_with_name (s->filename);
}
else
{
- register int offset, curLineNo, curLine, curLen, threshold;
- TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
- TuiSourceInfoPtr src = &srcWin->detail.sourceInfo;
+ int offset, cur_line_no, cur_line, cur_len, threshold;
+ struct tui_gen_win_info * locator = tui_locator_win_info_ptr ();
+ struct tui_source_info * src = &TUI_SRC_WIN->detail.source_info;
- if (srcWin->generic.title)
- xfree (srcWin->generic.title);
- srcWin->generic.title = xstrdup (s->filename);
+ if (TUI_SRC_WIN->generic.title)
+ xfree (TUI_SRC_WIN->generic.title);
+ TUI_SRC_WIN->generic.title = xstrdup (s->filename);
if (src->filename)
xfree (src->filename);
@@ -106,53 +100,53 @@ tuiSetSourceContent (struct symtab *s, int lineNo, int noerror)
/* Determine the threshold for the length of the line
and the offset to start the display. */
- offset = src->horizontalOffset;
- threshold = (lineWidth - 1) + offset;
+ offset = src->horizontal_offset;
+ threshold = (line_width - 1) + offset;
stream = fdopen (desc, FOPEN_RT);
clearerr (stream);
- curLine = 0;
- curLineNo = src->startLineOrAddr.lineNo = lineNo;
+ cur_line = 0;
+ cur_line_no = src->start_line_or_addr.line_no = line_no;
if (offset > 0)
- srcLine = (char *) xmalloc (
+ src_line = (char *) xmalloc (
(threshold + 1) * sizeof (char));
- while (curLine < nlines)
+ while (cur_line < nlines)
{
- TuiWinElementPtr element = (TuiWinElementPtr)
- srcWin->generic.content[curLine];
+ struct tui_win_element * element = (struct tui_win_element *)
+ TUI_SRC_WIN->generic.content[cur_line];
/* get the first character in the line */
c = fgetc (stream);
if (offset == 0)
- srcLine = ((TuiWinElementPtr)
- srcWin->generic.content[
- curLine])->whichElement.source.line;
+ src_line = ((struct tui_win_element *)
+ TUI_SRC_WIN->generic.content[
+ cur_line])->which_element.source.line;
/* Init the line with the line number */
- sprintf (srcLine, "%-6d", curLineNo);
- curLen = strlen (srcLine);
- i = curLen -
- ((curLen / tuiDefaultTabLen ()) * tuiDefaultTabLen ());
- while (i < tuiDefaultTabLen ())
+ sprintf (src_line, "%-6d", cur_line_no);
+ cur_len = strlen (src_line);
+ i = cur_len -
+ ((cur_len / tui_default_tab_len ()) * tui_default_tab_len ());
+ while (i < tui_default_tab_len ())
{
- srcLine[curLen] = ' ';
+ src_line[cur_len] = ' ';
i++;
- curLen++;
+ cur_len++;
}
- srcLine[curLen] = (char) 0;
+ src_line[cur_len] = (char) 0;
/* Set whether element is the execution point and
whether there is a break point on it. */
- element->whichElement.source.lineOrAddr.lineNo =
- curLineNo;
- element->whichElement.source.isExecPoint =
- (strcmp (((TuiWinElementPtr)
- locator->content[0])->whichElement.locator.fileName,
+ element->which_element.source.line_or_addr.line_no =
+ cur_line_no;
+ element->which_element.source.is_exec_point =
+ (strcmp (((struct tui_win_element *)
+ locator->content[0])->which_element.locator.file_name,
s->filename) == 0
- && curLineNo == ((TuiWinElementPtr)
- locator->content[0])->whichElement.locator.lineNo);
+ && cur_line_no == ((struct tui_win_element *)
+ locator->content[0])->which_element.locator.line_no);
if (c != EOF)
{
- i = strlen (srcLine) - 1;
+ i = strlen (src_line) - 1;
do
{
if ((c != '\n') &&
@@ -160,13 +154,13 @@ tuiSetSourceContent (struct symtab *s, int lineNo, int noerror)
{
if (c < 040 && c != '\t')
{
- srcLine[i++] = '^';
- srcLine[i] = c + 0100;
+ src_line[i++] = '^';
+ src_line[i] = c + 0100;
}
else if (c == 0177)
{
- srcLine[i++] = '^';
- srcLine[i] = '?';
+ src_line[i++] = '^';
+ src_line[i] = '?';
}
else
{ /* Store the charcter in the line
@@ -176,20 +170,20 @@ tuiSetSourceContent (struct symtab *s, int lineNo, int noerror)
buffer. */
if (c == '\t')
{
- int j, maxTabLen = tuiDefaultTabLen ();
+ int j, max_tab_len = tui_default_tab_len ();
for (j = i - (
- (i / maxTabLen) * maxTabLen);
- ((j < maxTabLen) &&
+ (i / max_tab_len) * max_tab_len);
+ ((j < max_tab_len) &&
i < threshold);
i++, j++)
- srcLine[i] = ' ';
+ src_line[i] = ' ';
i--;
}
else
- srcLine[i] = c;
+ src_line[i] = c;
}
- srcLine[i + 1] = 0;
+ src_line[i + 1] = 0;
}
else
{ /* If we have not reached EOL, then eat
@@ -202,21 +196,21 @@ tuiSetSourceContent (struct symtab *s, int lineNo, int noerror)
i < threshold && (c = fgetc (stream)));
}
/* Now copy the line taking the offset into account */
- if (strlen (srcLine) > offset)
- strcpy (((TuiWinElementPtr) srcWin->generic.content[
- curLine])->whichElement.source.line,
- &srcLine[offset]);
+ if (strlen (src_line) > offset)
+ strcpy (((struct tui_win_element *) TUI_SRC_WIN->generic.content[
+ cur_line])->which_element.source.line,
+ &src_line[offset]);
else
- ((TuiWinElementPtr)
- srcWin->generic.content[
- curLine])->whichElement.source.line[0] = (char) 0;
- curLine++;
- curLineNo++;
+ ((struct tui_win_element *)
+ TUI_SRC_WIN->generic.content[
+ cur_line])->which_element.source.line[0] = (char) 0;
+ cur_line++;
+ cur_line_no++;
}
if (offset > 0)
- tuiFree (srcLine);
+ xfree (src_line);
fclose (stream);
- srcWin->generic.contentSize = nlines;
+ TUI_SRC_WIN->generic.content_size = nlines;
ret = TUI_SUCCESS;
}
}
@@ -229,65 +223,65 @@ tuiSetSourceContent (struct symtab *s, int lineNo, int noerror)
/* elz: this function sets the contents of the source window to empty
except for a line in the middle with a warning message about the
source not being available. This function is called by
- tuiEraseSourceContents, which in turn is invoked when the source files
- cannot be accessed */
+ tui_erase_source_contents(), which in turn is invoked when the
+ source files cannot be accessed. */
void
-tuiSetSourceContentNil (TuiWinInfoPtr winInfo, char *warning_string)
+tui_set_source_content_nil (struct tui_win_info * win_info, char *warning_string)
{
- int lineWidth;
- int nLines;
+ int line_width;
+ int n_lines;
int curr_line = 0;
- lineWidth = winInfo->generic.width - 1;
- nLines = winInfo->generic.height - 2;
+ line_width = win_info->generic.width - 1;
+ n_lines = win_info->generic.height - 2;
/* set to empty each line in the window, except for the one
which contains the message */
- while (curr_line < winInfo->generic.contentSize)
+ while (curr_line < win_info->generic.content_size)
{
/* set the information related to each displayed line
to null: i.e. the line number is 0, there is no bp,
it is not where the program is stopped */
- TuiWinElementPtr element =
- (TuiWinElementPtr) winInfo->generic.content[curr_line];
- element->whichElement.source.lineOrAddr.lineNo = 0;
- element->whichElement.source.isExecPoint = FALSE;
- element->whichElement.source.hasBreak = FALSE;
+ struct tui_win_element * element =
+ (struct tui_win_element *) win_info->generic.content[curr_line];
+ element->which_element.source.line_or_addr.line_no = 0;
+ element->which_element.source.is_exec_point = FALSE;
+ element->which_element.source.has_break = FALSE;
/* set the contents of the line to blank */
- element->whichElement.source.line[0] = (char) 0;
+ element->which_element.source.line[0] = (char) 0;
- /* if the current line is in the middle of the screen, then we want to
- display the 'no source available' message in it.
- Note: the 'weird' arithmetic with the line width and height comes from
- the function tuiEraseSourceContent. We need to keep the screen and the
- window's actual contents in synch */
+ /* if the current line is in the middle of the screen, then we
+ want to display the 'no source available' message in it.
+ Note: the 'weird' arithmetic with the line width and height
+ comes from the function tui_erase_source_content(). We need
+ to keep the screen and the window's actual contents in synch. */
- if (curr_line == (nLines / 2 + 1))
+ if (curr_line == (n_lines / 2 + 1))
{
int i;
int xpos;
int warning_length = strlen (warning_string);
- char *srcLine;
+ char *src_line;
- srcLine = element->whichElement.source.line;
+ src_line = element->which_element.source.line;
- if (warning_length >= ((lineWidth - 1) / 2))
+ if (warning_length >= ((line_width - 1) / 2))
xpos = 1;
else
- xpos = (lineWidth - 1) / 2 - warning_length;
+ xpos = (line_width - 1) / 2 - warning_length;
for (i = 0; i < xpos; i++)
- srcLine[i] = ' ';
+ src_line[i] = ' ';
- sprintf (srcLine + i, "%s", warning_string);
+ sprintf (src_line + i, "%s", warning_string);
- for (i = xpos + warning_length; i < lineWidth; i++)
- srcLine[i] = ' ';
+ for (i = xpos + warning_length; i < line_width; i++)
+ src_line[i] = ' ';
- srcLine[i] = '\n';
+ src_line[i] = '\n';
} /* end if */
@@ -300,33 +294,34 @@ tuiSetSourceContentNil (TuiWinInfoPtr winInfo, char *warning_string)
/* Function to display source in the source window. This function
initializes the horizontal scroll to 0. */
void
-tuiShowSource (struct symtab *s, TuiLineOrAddress line, int noerror)
+tui_show_symtab_source (struct symtab *s, union tui_line_or_address line, int noerror)
{
- srcWin->detail.sourceInfo.horizontalOffset = 0;
- tuiUpdateSourceWindowAsIs(srcWin, s, line, noerror);
+ TUI_SRC_WIN->detail.source_info.horizontal_offset = 0;
+ tui_update_source_window_as_is (TUI_SRC_WIN, s, line, noerror);
}
-/* Answer whether the source is currently displayed in the source window. */
+/* Answer whether the source is currently displayed in the source
+ window. */
int
-tuiSourceIsDisplayed (char *fname)
+tui_source_is_displayed (char *fname)
{
- return (srcWin->generic.contentInUse &&
- (strcmp (((TuiWinElementPtr) (locatorWinInfoPtr ())->
- content[0])->whichElement.locator.fileName, fname) == 0));
+ return (TUI_SRC_WIN->generic.content_in_use &&
+ (strcmp (((struct tui_win_element *) (tui_locator_win_info_ptr ())->
+ content[0])->which_element.locator.file_name, fname) == 0));
}
/* Scroll the source forward or backward vertically. */
void
-tuiVerticalSourceScroll (TuiScrollDirection scrollDirection,
- int numToScroll)
+tui_vertical_source_scroll (enum tui_scroll_direction scroll_direction,
+ int num_to_scroll)
{
- if (srcWin->generic.content != (OpaquePtr) NULL)
+ if (TUI_SRC_WIN->generic.content != NULL)
{
- TuiLineOrAddress l;
+ union tui_line_or_address l;
struct symtab *s;
- TuiWinContent content = (TuiWinContent) srcWin->generic.content;
+ tui_win_content content = (tui_win_content) TUI_SRC_WIN->generic.content;
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
if (cursal.symtab == (struct symtab *) NULL)
@@ -334,23 +329,23 @@ tuiVerticalSourceScroll (TuiScrollDirection scrollDirection,
else
s = cursal.symtab;
- if (scrollDirection == FORWARD_SCROLL)
+ if (scroll_direction == FORWARD_SCROLL)
{
- l.lineNo = content[0]->whichElement.source.lineOrAddr.lineNo +
- numToScroll;
- if (l.lineNo > s->nlines)
- /*line = s->nlines - winInfo->generic.contentSize + 1; */
+ l.line_no = content[0]->which_element.source.line_or_addr.line_no +
+ num_to_scroll;
+ if (l.line_no > s->nlines)
+ /*line = s->nlines - win_info->generic.content_size + 1; */
/*elz: fix for dts 23398 */
- l.lineNo = content[0]->whichElement.source.lineOrAddr.lineNo;
+ l.line_no = content[0]->which_element.source.line_or_addr.line_no;
}
else
{
- l.lineNo = content[0]->whichElement.source.lineOrAddr.lineNo -
- numToScroll;
- if (l.lineNo <= 0)
- l.lineNo = 1;
+ l.line_no = content[0]->which_element.source.line_or_addr.line_no -
+ num_to_scroll;
+ if (l.line_no <= 0)
+ l.line_no = 1;
}
- print_source_lines (s, l.lineNo, l.lineNo + 1, 0);
+ print_source_lines (s, l.line_no, l.line_no + 1, 0);
}
}
diff --git a/gdb/tui/tui-source.h b/gdb/tui/tui-source.h
index 96cf865..3b61ca4 100644
--- a/gdb/tui/tui-source.h
+++ b/gdb/tui/tui-source.h
@@ -1,5 +1,8 @@
/* TUI display source window.
- Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+
+ Copyright 1998, 1999, 2000, 2001, 2002, 2004 Free Software
+ Foundation, Inc.
+
Contributed by Hewlett-Packard Company.
This file is part of GDB.
@@ -19,15 +22,19 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#ifndef _TUI_SOURCE_H
-#define _TUI_SOURCE_H
+#ifndef TUI_SOURCE_H
+#define TUI_SOURCE_H
+
+#include "tui/tui-data.h"
+
+struct symtab;
+struct tui_win_info;
-#include "defs.h"
+extern void tui_set_source_content_nil (struct tui_win_info *, char *);
-extern TuiStatus tuiSetSourceContent (struct symtab *, int, int);
-extern void tuiShowSource (struct symtab *, TuiLineOrAddress, int);
-extern int tuiSourceIsDisplayed (char *);
-extern void tuiVerticalSourceScroll (TuiScrollDirection, int);
+extern enum tui_status tui_set_source_content (struct symtab *, int, int);
+extern void tui_show_symtab_source (struct symtab *, union tui_line_or_address, int);
+extern int tui_source_is_displayed (char *);
+extern void tui_vertical_source_scroll (enum tui_scroll_direction, int);
#endif
-/*_TUI_SOURCE_H*/
diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c
index 6bf64bb..0ee5389 100644
--- a/gdb/tui/tui-stack.c
+++ b/gdb/tui/tui-stack.c
@@ -1,7 +1,7 @@
/* TUI display locator.
- Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation,
- Inc.
+ Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
+ Foundation, Inc.
Contributed by Hewlett-Packard Company.
@@ -30,7 +30,7 @@
#include "inferior.h"
#include "target.h"
#include "top.h"
-
+#include "gdb_string.h"
#include "tui/tui.h"
#include "tui/tui-data.h"
#include "tui/tui-stack.h"
@@ -39,13 +39,7 @@
#include "tui/tui-winsource.h"
#include "tui/tui-file.h"
-#ifdef HAVE_NCURSES_H
-#include <ncurses.h>
-#else
-#ifdef HAVE_CURSES_H
-#include <curses.h>
-#endif
-#endif
+#include "gdb_curses.h"
/* Get a printable name for the function at the address.
The symbol name is demangled if demangling is turned on.
@@ -66,7 +60,7 @@ static void tui_update_command (char *, int);
can on this single line: target name, process number, current
function, current line, current PC, SingleKey mode. */
static char*
-tui_make_status_line (TuiLocatorElement* loc)
+tui_make_status_line (struct tui_locator_element* loc)
{
char* string;
char line_buf[50], *pname;
@@ -94,13 +88,13 @@ tui_make_status_line (TuiLocatorElement* loc)
if (pid_width > MAX_PID_WIDTH)
pid_width = MAX_PID_WIDTH;
- status_size = termWidth ();
+ status_size = tui_term_width ();
string = (char *) xmalloc (status_size + 1);
buf = (char*) alloca (status_size + 1);
/* Translate line number and obtain its size. */
- if (loc->lineNo > 0)
- sprintf (line_buf, "%d", loc->lineNo);
+ if (loc->line_no > 0)
+ sprintf (line_buf, "%d", loc->line_no);
else
strcpy (line_buf, "??");
line_width = strlen (line_buf);
@@ -122,7 +116,7 @@ tui_make_status_line (TuiLocatorElement* loc)
- (sizeof (PROC_PREFIX) - 1 + 1)
- (sizeof (LINE_PREFIX) - 1 + line_width + 1)
- (sizeof (PC_PREFIX) - 1 + pc_width + 1)
- - (tui_current_key_mode == tui_single_key_mode
+ - (tui_current_key_mode == TUI_SINGLE_KEY_MODE
? (sizeof (SINGLE_KEY) - 1 + 1)
: 0));
@@ -152,7 +146,7 @@ tui_make_status_line (TuiLocatorElement* loc)
}
/* Now convert elements to string form */
- pname = loc->procName;
+ pname = loc->proc_name;
/* Now create the locator line from the string version
of the elements. We could use sprintf() here but
@@ -174,7 +168,7 @@ tui_make_status_line (TuiLocatorElement* loc)
}
/* Show whether we are in SingleKey mode. */
- if (tui_current_key_mode == tui_single_key_mode)
+ if (tui_current_key_mode == TUI_SINGLE_KEY_MODE)
{
strcat_to_buf (string, status_size, SINGLE_KEY);
strcat_to_buf (string, status_size, " ");
@@ -244,33 +238,30 @@ tui_get_function_from_frame (struct frame_info *fi)
return name;
}
-/*
- ** tuiShowLocatorContent()
- */
void
-tuiShowLocatorContent (void)
+tui_show_locator_content (void)
{
char *string;
- TuiGenWinInfoPtr locator;
+ struct tui_gen_win_info * locator;
- locator = locatorWinInfoPtr ();
+ locator = tui_locator_win_info_ptr ();
- if (m_genWinPtrNotNull (locator) && locator->handle != (WINDOW *) NULL)
+ if (locator != NULL && locator->handle != (WINDOW *) NULL)
{
- TuiWinElementPtr element;
+ struct tui_win_element * element;
- element = (TuiWinElementPtr) locator->content[0];
+ element = (struct tui_win_element *) locator->content[0];
- string = tui_make_status_line (&element->whichElement.locator);
+ string = tui_make_status_line (&element->which_element.locator);
wmove (locator->handle, 0, 0);
wstandout (locator->handle);
waddstr (locator->handle, string);
wclrtoeol (locator->handle);
wstandend (locator->handle);
- tuiRefreshWin (locator);
+ tui_refresh_win (locator);
wmove (locator->handle, 0, 0);
xfree (string);
- locator->contentInUse = TRUE;
+ locator->content_in_use = TRUE;
}
}
@@ -279,18 +270,18 @@ tuiShowLocatorContent (void)
static void
tui_set_locator_filename (const char *filename)
{
- TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
- TuiLocatorElementPtr element;
+ struct tui_gen_win_info * locator = tui_locator_win_info_ptr ();
+ struct tui_locator_element * element;
- if (locator->content[0] == (Opaque) NULL)
+ if (locator->content[0] == NULL)
{
tui_set_locator_info (filename, NULL, 0, 0);
return;
}
- element = &((TuiWinElementPtr) locator->content[0])->whichElement.locator;
- element->fileName[0] = 0;
- strcat_to_buf (element->fileName, MAX_LOCATOR_ELEMENT_LEN, filename);
+ element = &((struct tui_win_element *) locator->content[0])->which_element.locator;
+ element->file_name[0] = 0;
+ strcat_to_buf (element->file_name, MAX_LOCATOR_ELEMENT_LEN, filename);
}
/* Update the locator, with the provided arguments. */
@@ -298,69 +289,69 @@ static void
tui_set_locator_info (const char *filename, const char *procname, int lineno,
CORE_ADDR addr)
{
- TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
- TuiLocatorElementPtr element;
+ struct tui_gen_win_info * locator = tui_locator_win_info_ptr ();
+ struct tui_locator_element * element;
/* Allocate the locator content if necessary. */
- if (locator->contentSize <= 0)
+ if (locator->content_size <= 0)
{
- locator->content = (OpaquePtr) allocContent (1, locator->type);
- locator->contentSize = 1;
+ locator->content = (void **) tui_alloc_content (1, locator->type);
+ locator->content_size = 1;
}
- element = &((TuiWinElementPtr) locator->content[0])->whichElement.locator;
- element->procName[0] = (char) 0;
- strcat_to_buf (element->procName, MAX_LOCATOR_ELEMENT_LEN, procname);
- element->lineNo = lineno;
+ element = &((struct tui_win_element *) locator->content[0])->which_element.locator;
+ element->proc_name[0] = (char) 0;
+ strcat_to_buf (element->proc_name, MAX_LOCATOR_ELEMENT_LEN, procname);
+ element->line_no = lineno;
element->addr = addr;
tui_set_locator_filename (filename);
}
/* Update only the filename portion of the locator. */
void
-tuiUpdateLocatorFilename (const char *filename)
+tui_update_locator_filename (const char *filename)
{
tui_set_locator_filename (filename);
- tuiShowLocatorContent ();
+ tui_show_locator_content ();
}
/* Function to print the frame information for the TUI. */
void
-tuiShowFrameInfo (struct frame_info *fi)
+tui_show_frame_info (struct frame_info *fi)
{
- TuiWinInfoPtr winInfo;
- register int i;
+ struct tui_win_info * win_info;
+ int i;
if (fi)
{
- register int startLine, i;
+ int start_line, i;
CORE_ADDR low;
- TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
- int sourceAlreadyDisplayed;
+ struct tui_gen_win_info * locator = tui_locator_win_info_ptr ();
+ int source_already_displayed;
struct symtab_and_line sal;
find_frame_sal (fi, &sal);
- sourceAlreadyDisplayed = sal.symtab != 0
- && tuiSourceIsDisplayed (sal.symtab->filename);
+ source_already_displayed = sal.symtab != 0
+ && tui_source_is_displayed (sal.symtab->filename);
tui_set_locator_info (sal.symtab == 0 ? "??" : sal.symtab->filename,
tui_get_function_from_frame (fi),
sal.line,
get_frame_pc (fi));
- tuiShowLocatorContent ();
- startLine = 0;
- for (i = 0; i < (sourceWindows ())->count; i++)
+ tui_show_locator_content ();
+ start_line = 0;
+ for (i = 0; i < (tui_source_windows ())->count; i++)
{
- TuiWhichElement *item;
- winInfo = (TuiWinInfoPtr) (sourceWindows ())->list[i];
+ union tui_which_element *item;
+ win_info = (struct tui_win_info *) (tui_source_windows ())->list[i];
- item = &((TuiWinElementPtr) locator->content[0])->whichElement;
- if (winInfo == srcWin)
+ item = &((struct tui_win_element *) locator->content[0])->which_element;
+ if (win_info == TUI_SRC_WIN)
{
- startLine = (item->locator.lineNo -
- (winInfo->generic.viewportHeight / 2)) + 1;
- if (startLine <= 0)
- startLine = 1;
+ start_line = (item->locator.line_no -
+ (win_info->generic.viewport_height / 2)) + 1;
+ if (start_line <= 0)
+ start_line = 1;
}
else
{
@@ -368,56 +359,57 @@ tuiShowFrameInfo (struct frame_info *fi)
&low, (CORE_ADDR) NULL) == 0)
error ("No function contains program counter for selected frame.\n");
else
- low = tuiGetLowDisassemblyAddress (low, get_frame_pc (fi));
+ low = tui_get_low_disassembly_address (low, get_frame_pc (fi));
}
- if (winInfo == srcWin)
+ if (win_info == TUI_SRC_WIN)
{
- TuiLineOrAddress l;
- l.lineNo = startLine;
- if (!(sourceAlreadyDisplayed
- && tuiLineIsDisplayed (item->locator.lineNo, winInfo, TRUE)))
- tuiUpdateSourceWindow (winInfo, sal.symtab, l, TRUE);
+ union tui_line_or_address l;
+ l.line_no = start_line;
+ if (!(source_already_displayed
+ && tui_line_is_displayed (item->locator.line_no, win_info, TRUE)))
+ tui_update_source_window (win_info, sal.symtab, l, TRUE);
else
{
- l.lineNo = item->locator.lineNo;
- tuiSetIsExecPointAt (l, winInfo);
+ l.line_no = item->locator.line_no;
+ tui_set_is_exec_point_at (l, win_info);
}
}
else
{
- if (winInfo == disassemWin)
+ if (win_info == TUI_DISASM_WIN)
{
- TuiLineOrAddress a;
+ union tui_line_or_address a;
a.addr = low;
- if (!tuiAddrIsDisplayed (item->locator.addr, winInfo, TRUE))
- tuiUpdateSourceWindow (winInfo, sal.symtab, a, TRUE);
+ if (!tui_addr_is_displayed (item->locator.addr, win_info, TRUE))
+ tui_update_source_window (win_info, sal.symtab, a, TRUE);
else
{
a.addr = item->locator.addr;
- tuiSetIsExecPointAt (a, winInfo);
+ tui_set_is_exec_point_at (a, win_info);
}
}
}
- tuiUpdateExecInfo (winInfo);
+ tui_update_exec_info (win_info);
}
}
else
{
tui_set_locator_info (NULL, NULL, 0, (CORE_ADDR) 0);
- tuiShowLocatorContent ();
- for (i = 0; i < (sourceWindows ())->count; i++)
+ tui_show_locator_content ();
+ for (i = 0; i < (tui_source_windows ())->count; i++)
{
- winInfo = (TuiWinInfoPtr) (sourceWindows ())->list[i];
- tuiClearSourceContent (winInfo, EMPTY_SOURCE_PROMPT);
- tuiUpdateExecInfo (winInfo);
+ win_info = (struct tui_win_info *) (tui_source_windows ())->list[i];
+ tui_clear_source_content (win_info, EMPTY_SOURCE_PROMPT);
+ tui_update_exec_info (win_info);
}
}
}
-/* Function to initialize gdb commands, for tui window stack manipulation. */
+/* Function to initialize gdb commands, for tui window stack
+ manipulation. */
void
-_initialize_tuiStack (void)
+_initialize_tui_stack (void)
{
add_com ("update", class_tui, tui_update_command,
"Update the source window and locator to display the current "
diff --git a/gdb/tui/tui-stack.h b/gdb/tui/tui-stack.h
index 14be497..65725b3 100644
--- a/gdb/tui/tui-stack.h
+++ b/gdb/tui/tui-stack.h
@@ -1,5 +1,8 @@
/* TUI display locator.
- Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+
+ Copyright 1998, 1999, 2000, 2001, 2002, 2004 Free Software
+ Foundation, Inc.
+
Contributed by Hewlett-Packard Company.
This file is part of GDB.
@@ -19,15 +22,13 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#ifndef _TUI_STACK_H
-#define _TUI_STACK_H
-/*
- ** This header file supports
- */
+#ifndef TUI_STACK_H
+#define TUI_STACK_H
+
+struct frame_info;
-extern void tuiUpdateLocatorFilename (const char *);
-extern void tuiShowLocatorContent (void);
-extern void tuiShowFrameInfo (struct frame_info *);
+extern void tui_update_locator_filename (const char *);
+extern void tui_show_locator_content (void);
+extern void tui_show_frame_info (struct frame_info *);
#endif
-/*_TUI_STACK_H*/
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index a7d35ce..afd4b10 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -46,36 +46,30 @@
#include "tui/tui-winsource.h"
#include "tui/tui-windata.h"
-#ifdef HAVE_NCURSES_H
-#include <ncurses.h>
-#else
-#ifdef HAVE_CURSES_H
-#include <curses.h>
-#endif
-#endif
+#include "gdb_curses.h"
-#include <string.h>
+#include "gdb_string.h"
#include <ctype.h>
#include <readline/readline.h>
/*******************************
** Static Local Decls
********************************/
-static void _makeVisibleWithNewHeight (TuiWinInfoPtr);
-static void _makeInvisibleAndSetNewHeight (TuiWinInfoPtr, int);
-static TuiStatus _tuiAdjustWinHeights (TuiWinInfoPtr, int);
-static int _newHeightOk (TuiWinInfoPtr, int);
-static void _tuiSetTabWidth_command (char *, int);
-static void _tuiRefreshAll_command (char *, int);
-static void _tuiSetWinHeight_command (char *, int);
-static void _tuiXDBsetWinHeight_command (char *, int);
-static void _tuiAllWindowsInfo (char *, int);
-static void _tuiSetFocus_command (char *, int);
-static void _tuiScrollForward_command (char *, int);
-static void _tuiScrollBackward_command (char *, int);
-static void _tuiScrollLeft_command (char *, int);
-static void _tuiScrollRight_command (char *, int);
-static void _parseScrollingArgs (char *, TuiWinInfoPtr *, int *);
+static void make_visible_with_new_height (struct tui_win_info *);
+static void make_invisible_and_set_new_height (struct tui_win_info *, int);
+static enum tui_status tui_adjust_win_heights (struct tui_win_info *, int);
+static int new_height_ok (struct tui_win_info *, int);
+static void tui_set_tab_width_command (char *, int);
+static void tui_refresh_all_command (char *, int);
+static void tui_set_win_height_command (char *, int);
+static void tui_xdb_set_win_height_command (char *, int);
+static void tui_all_windows_info (char *, int);
+static void tui_set_focus_command (char *, int);
+static void tui_scroll_forward_command (char *, int);
+static void tui_scroll_backward_command (char *, int);
+static void tui_scroll_left_command (char *, int);
+static void tui_scroll_right_command (char *, int);
+static void parse_scrolling_args (char *, struct tui_win_info * *, int *);
/***************************************
@@ -241,7 +235,7 @@ translate (const char *name, struct tui_translate *table)
Returns 1 if the configuration has changed and the screen should
be redrawn. */
int
-tui_update_variables ()
+tui_update_variables (void)
{
int need_redraw = 0;
struct tui_translate *entry;
@@ -296,12 +290,9 @@ show_tui_cmd (char *args, int from_tty)
{
}
-/*
- ** _initialize_tuiWin().
- ** Function to initialize gdb commands, for tui window manipulation.
- */
+/* Function to initialize gdb commands, for tui window manipulation. */
void
-_initialize_tuiWin (void)
+_initialize_tui_win (void)
{
struct cmd_list_element *c;
static struct cmd_list_element *tui_setlist;
@@ -322,14 +313,14 @@ _initialize_tuiWin (void)
&tui_showlist, "show tui ",
0/*allow-unknown*/, &showlist);
- add_com ("refresh", class_tui, _tuiRefreshAll_command,
+ add_com ("refresh", class_tui, tui_refresh_all_command,
"Refresh the terminal display.\n");
if (xdb_commands)
add_com_alias ("U", "refresh", class_tui, 0);
- add_com ("tabset", class_tui, _tuiSetTabWidth_command,
+ add_com ("tabset", class_tui, tui_set_tab_width_command,
"Set the width (in characters) of tab stops.\n\
Usage: tabset <n>\n");
- add_com ("winheight", class_tui, _tuiSetWinHeight_command,
+ add_com ("winheight", class_tui, tui_set_win_height_command,
"Set the height of a specified window.\n\
Usage: winheight <win_name> [+ | -] <#lines>\n\
Window names are:\n\
@@ -338,9 +329,9 @@ cmd : the command window\n\
asm : the disassembly window\n\
regs : the register display\n");
add_com_alias ("wh", "winheight", class_tui, 0);
- add_info ("win", _tuiAllWindowsInfo,
+ add_info ("win", tui_all_windows_info,
"List of all displayed windows.\n");
- add_com ("focus", class_tui, _tuiSetFocus_command,
+ add_com ("focus", class_tui, tui_set_focus_command,
"Set focus to named window or next/prev window.\n\
Usage: focus {<win> | next | prev}\n\
Valid Window names are:\n\
@@ -349,16 +340,16 @@ asm : the disassembly window\n\
regs : the register display\n\
cmd : the command window\n");
add_com_alias ("fs", "focus", class_tui, 0);
- add_com ("+", class_tui, _tuiScrollForward_command,
+ add_com ("+", class_tui, tui_scroll_forward_command,
"Scroll window forward.\nUsage: + [win] [n]\n");
- add_com ("-", class_tui, _tuiScrollBackward_command,
+ add_com ("-", class_tui, tui_scroll_backward_command,
"Scroll window backward.\nUsage: - [win] [n]\n");
- add_com ("<", class_tui, _tuiScrollLeft_command,
+ add_com ("<", class_tui, tui_scroll_left_command,
"Scroll window forward.\nUsage: < [win] [n]\n");
- add_com (">", class_tui, _tuiScrollRight_command,
+ add_com (">", class_tui, tui_scroll_right_command,
"Scroll window backward.\nUsage: > [win] [n]\n");
if (xdb_commands)
- add_com ("w", class_xdb, _tuiXDBsetWinHeight_command,
+ add_com ("w", class_xdb, tui_xdb_set_win_height_command,
"XDB compatibility command for setting the height of a command window.\n\
Usage: w <#lines>\n");
@@ -407,7 +398,7 @@ Usage: w <#lines>\n");
/* Update gdb's knowledge of the terminal size. */
void
-tui_update_gdb_sizes ()
+tui_update_gdb_sizes (void)
{
char cmd[50];
int screenheight, screenwidth;
@@ -415,168 +406,142 @@ tui_update_gdb_sizes ()
rl_get_screen_size (&screenheight, &screenwidth);
/* Set to TUI command window dimension or use readline values. */
sprintf (cmd, "set width %d",
- tui_active ? cmdWin->generic.width : screenwidth);
+ tui_active ? TUI_CMD_WIN->generic.width : screenwidth);
execute_command (cmd, 0);
sprintf (cmd, "set height %d",
- tui_active ? cmdWin->generic.height : screenheight);
+ tui_active ? TUI_CMD_WIN->generic.height : screenheight);
execute_command (cmd, 0);
}
-/*
- ** tuiSetWinFocusTo
- ** Set the logical focus to winInfo
- */
+/* Set the logical focus to win_info. */
void
-tuiSetWinFocusTo (TuiWinInfoPtr winInfo)
+tui_set_win_focus_to (struct tui_win_info * win_info)
{
- if (m_winPtrNotNull (winInfo))
+ if (win_info != NULL)
{
- TuiWinInfoPtr winWithFocus = tuiWinWithFocus ();
-
- if (m_winPtrNotNull (winWithFocus) &&
- winWithFocus->generic.type != CMD_WIN)
- unhighlightWin (winWithFocus);
- tuiSetWinWithFocus (winInfo);
- if (winInfo->generic.type != CMD_WIN)
- highlightWin (winInfo);
+ struct tui_win_info * win_with_focus = tui_win_with_focus ();
+
+ if (win_with_focus != NULL
+ && win_with_focus->generic.type != CMD_WIN)
+ tui_unhighlight_win (win_with_focus);
+ tui_set_win_with_focus (win_info);
+ if (win_info->generic.type != CMD_WIN)
+ tui_highlight_win (win_info);
}
-
- return;
-} /* tuiSetWinFocusTo */
+}
-/*
- ** tuiScrollForward().
- */
void
-tuiScrollForward (TuiWinInfoPtr winToScroll, int numToScroll)
+tui_scroll_forward (struct tui_win_info * win_to_scroll, int num_to_scroll)
{
- if (winToScroll != cmdWin)
+ if (win_to_scroll != TUI_CMD_WIN)
{
- int _numToScroll = numToScroll;
+ int _num_to_scroll = num_to_scroll;
- if (numToScroll == 0)
- _numToScroll = winToScroll->generic.height - 3;
+ if (num_to_scroll == 0)
+ _num_to_scroll = win_to_scroll->generic.height - 3;
/*
** If we are scrolling the source or disassembly window, do a
** "psuedo" scroll since not all of the source is in memory,
- ** only what is in the viewport. If winToScroll is the
+ ** only what is in the viewport. If win_to_scroll is the
** command window do nothing since the term should handle it.
*/
- if (winToScroll == srcWin)
- tuiVerticalSourceScroll (FORWARD_SCROLL, _numToScroll);
- else if (winToScroll == disassemWin)
- tui_vertical_disassem_scroll (FORWARD_SCROLL, _numToScroll);
- else if (winToScroll == dataWin)
- tuiVerticalDataScroll (FORWARD_SCROLL, _numToScroll);
+ if (win_to_scroll == TUI_SRC_WIN)
+ tui_vertical_source_scroll (FORWARD_SCROLL, _num_to_scroll);
+ else if (win_to_scroll == TUI_DISASM_WIN)
+ tui_vertical_disassem_scroll (FORWARD_SCROLL, _num_to_scroll);
+ else if (win_to_scroll == TUI_DATA_WIN)
+ tui_vertical_data_scroll (FORWARD_SCROLL, _num_to_scroll);
}
+}
- return;
-} /* tuiScrollForward */
-
-
-/*
- ** tuiScrollBackward().
- */
void
-tuiScrollBackward (TuiWinInfoPtr winToScroll, int numToScroll)
+tui_scroll_backward (struct tui_win_info * win_to_scroll, int num_to_scroll)
{
- if (winToScroll != cmdWin)
+ if (win_to_scroll != TUI_CMD_WIN)
{
- int _numToScroll = numToScroll;
+ int _num_to_scroll = num_to_scroll;
- if (numToScroll == 0)
- _numToScroll = winToScroll->generic.height - 3;
+ if (num_to_scroll == 0)
+ _num_to_scroll = win_to_scroll->generic.height - 3;
/*
** If we are scrolling the source or disassembly window, do a
** "psuedo" scroll since not all of the source is in memory,
- ** only what is in the viewport. If winToScroll is the
+ ** only what is in the viewport. If win_to_scroll is the
** command window do nothing since the term should handle it.
*/
- if (winToScroll == srcWin)
- tuiVerticalSourceScroll (BACKWARD_SCROLL, _numToScroll);
- else if (winToScroll == disassemWin)
- tui_vertical_disassem_scroll (BACKWARD_SCROLL, _numToScroll);
- else if (winToScroll == dataWin)
- tuiVerticalDataScroll (BACKWARD_SCROLL, _numToScroll);
+ if (win_to_scroll == TUI_SRC_WIN)
+ tui_vertical_source_scroll (BACKWARD_SCROLL, _num_to_scroll);
+ else if (win_to_scroll == TUI_DISASM_WIN)
+ tui_vertical_disassem_scroll (BACKWARD_SCROLL, _num_to_scroll);
+ else if (win_to_scroll == TUI_DATA_WIN)
+ tui_vertical_data_scroll (BACKWARD_SCROLL, _num_to_scroll);
}
- return;
-} /* tuiScrollBackward */
+}
-/*
- ** tuiScrollLeft().
- */
void
-tuiScrollLeft (TuiWinInfoPtr winToScroll, int numToScroll)
+tui_scroll_left (struct tui_win_info * win_to_scroll, int num_to_scroll)
{
- if (winToScroll != cmdWin)
+ if (win_to_scroll != TUI_CMD_WIN)
{
- int _numToScroll = numToScroll;
+ int _num_to_scroll = num_to_scroll;
- if (_numToScroll == 0)
- _numToScroll = 1;
+ if (_num_to_scroll == 0)
+ _num_to_scroll = 1;
/*
** If we are scrolling the source or disassembly window, do a
** "psuedo" scroll since not all of the source is in memory,
- ** only what is in the viewport. If winToScroll is the
+ ** only what is in the viewport. If win_to_scroll is the
** command window do nothing since the term should handle it.
*/
- if (winToScroll == srcWin || winToScroll == disassemWin)
- tuiHorizontalSourceScroll (winToScroll, LEFT_SCROLL, _numToScroll);
+ if (win_to_scroll == TUI_SRC_WIN || win_to_scroll == TUI_DISASM_WIN)
+ tui_horizontal_source_scroll (win_to_scroll, LEFT_SCROLL, _num_to_scroll);
}
- return;
-} /* tuiScrollLeft */
+}
-/*
- ** tuiScrollRight().
- */
void
-tuiScrollRight (TuiWinInfoPtr winToScroll, int numToScroll)
+tui_scroll_right (struct tui_win_info * win_to_scroll, int num_to_scroll)
{
- if (winToScroll != cmdWin)
+ if (win_to_scroll != TUI_CMD_WIN)
{
- int _numToScroll = numToScroll;
+ int _num_to_scroll = num_to_scroll;
- if (_numToScroll == 0)
- _numToScroll = 1;
+ if (_num_to_scroll == 0)
+ _num_to_scroll = 1;
/*
** If we are scrolling the source or disassembly window, do a
** "psuedo" scroll since not all of the source is in memory,
- ** only what is in the viewport. If winToScroll is the
+ ** only what is in the viewport. If win_to_scroll is the
** command window do nothing since the term should handle it.
*/
- if (winToScroll == srcWin || winToScroll == disassemWin)
- tuiHorizontalSourceScroll (winToScroll, RIGHT_SCROLL, _numToScroll);
+ if (win_to_scroll == TUI_SRC_WIN || win_to_scroll == TUI_DISASM_WIN)
+ tui_horizontal_source_scroll (win_to_scroll, RIGHT_SCROLL, _num_to_scroll);
}
- return;
-} /* tuiScrollRight */
+}
-/*
- ** tui_scroll().
- ** Scroll a window. Arguments are passed through a va_list.
- */
+/* Scroll a window. Arguments are passed through a va_list. */
void
-tui_scroll (TuiScrollDirection direction,
- TuiWinInfoPtr winToScroll,
- int numToScroll)
+tui_scroll (enum tui_scroll_direction direction,
+ struct tui_win_info * win_to_scroll,
+ int num_to_scroll)
{
switch (direction)
{
case FORWARD_SCROLL:
- tuiScrollForward (winToScroll, numToScroll);
+ tui_scroll_forward (win_to_scroll, num_to_scroll);
break;
case BACKWARD_SCROLL:
- tuiScrollBackward (winToScroll, numToScroll);
+ tui_scroll_backward (win_to_scroll, num_to_scroll);
break;
case LEFT_SCROLL:
- tuiScrollLeft (winToScroll, numToScroll);
+ tui_scroll_left (win_to_scroll, num_to_scroll);
break;
case RIGHT_SCROLL:
- tuiScrollRight (winToScroll, numToScroll);
+ tui_scroll_right (win_to_scroll, num_to_scroll);
break;
default:
break;
@@ -584,221 +549,210 @@ tui_scroll (TuiScrollDirection direction,
}
-/*
- ** tuiRefreshAll().
- */
void
-tuiRefreshAll (void)
+tui_refresh_all_win (void)
{
- TuiWinType type;
+ enum tui_win_type type;
clearok (curscr, TRUE);
- refreshAll (winList);
+ tui_refresh_all (tui_win_list);
for (type = SRC_WIN; type < MAX_MAJOR_WINDOWS; type++)
{
- if (winList[type] && winList[type]->generic.isVisible)
+ if (tui_win_list[type] && tui_win_list[type]->generic.is_visible)
{
switch (type)
{
case SRC_WIN:
case DISASSEM_WIN:
- tuiShowSourceContent (winList[type]);
- checkAndDisplayHighlightIfNeeded (winList[type]);
- tuiEraseExecInfoContent (winList[type]);
- tuiUpdateExecInfo (winList[type]);
+ tui_show_source_content (tui_win_list[type]);
+ tui_check_and_display_highlight_if_needed (tui_win_list[type]);
+ tui_erase_exec_info_content (tui_win_list[type]);
+ tui_update_exec_info (tui_win_list[type]);
break;
case DATA_WIN:
- tuiRefreshDataWin ();
+ tui_refresh_data_win ();
break;
default:
break;
}
}
}
- tuiShowLocatorContent ();
+ tui_show_locator_content ();
}
-/*
- ** tuiResizeAll().
- ** Resize all the windows based on the the terminal size. This
- ** function gets called from within the readline sinwinch handler.
- */
+/* Resize all the windows based on the the terminal size. This
+ function gets called from within the readline sinwinch handler. */
void
-tuiResizeAll (void)
+tui_resize_all (void)
{
- int heightDiff, widthDiff;
+ int height_diff, width_diff;
int screenheight, screenwidth;
rl_get_screen_size (&screenheight, &screenwidth);
- widthDiff = screenwidth - termWidth ();
- heightDiff = screenheight - termHeight ();
- if (heightDiff || widthDiff)
+ width_diff = screenwidth - tui_term_width ();
+ height_diff = screenheight - tui_term_height ();
+ if (height_diff || width_diff)
{
- TuiLayoutType curLayout = currentLayout ();
- TuiWinInfoPtr winWithFocus = tuiWinWithFocus ();
- TuiWinInfoPtr firstWin, secondWin;
- TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
- TuiWinType winType;
- int newHeight, splitDiff, cmdSplitDiff, numWinsDisplayed = 2;
+ enum tui_layout_type cur_layout = tui_current_layout ();
+ struct tui_win_info * win_with_focus = tui_win_with_focus ();
+ struct tui_win_info *first_win;
+ struct tui_win_info *second_win;
+ struct tui_gen_win_info * locator = tui_locator_win_info_ptr ();
+ enum tui_win_type win_type;
+ int new_height, split_diff, cmd_split_diff, num_wins_displayed = 2;
/* turn keypad off while we resize */
- if (winWithFocus != cmdWin)
- keypad (cmdWin->generic.handle, FALSE);
+ if (win_with_focus != TUI_CMD_WIN)
+ keypad (TUI_CMD_WIN->generic.handle, FALSE);
tui_update_gdb_sizes ();
- setTermHeightTo (screenheight);
- setTermWidthTo (screenwidth);
- if (curLayout == SRC_DISASSEM_COMMAND ||
- curLayout == SRC_DATA_COMMAND || curLayout == DISASSEM_DATA_COMMAND)
- numWinsDisplayed++;
- splitDiff = heightDiff / numWinsDisplayed;
- cmdSplitDiff = splitDiff;
- if (heightDiff % numWinsDisplayed)
+ tui_set_term_height_to (screenheight);
+ tui_set_term_width_to (screenwidth);
+ if (cur_layout == SRC_DISASSEM_COMMAND ||
+ cur_layout == SRC_DATA_COMMAND || cur_layout == DISASSEM_DATA_COMMAND)
+ num_wins_displayed++;
+ split_diff = height_diff / num_wins_displayed;
+ cmd_split_diff = split_diff;
+ if (height_diff % num_wins_displayed)
{
- if (heightDiff < 0)
- cmdSplitDiff--;
+ if (height_diff < 0)
+ cmd_split_diff--;
else
- cmdSplitDiff++;
+ cmd_split_diff++;
}
/* now adjust each window */
clear ();
refresh ();
- switch (curLayout)
+ switch (cur_layout)
{
case SRC_COMMAND:
case DISASSEM_COMMAND:
- firstWin = (TuiWinInfoPtr) (sourceWindows ())->list[0];
- firstWin->generic.width += widthDiff;
- locator->width += widthDiff;
+ first_win = (struct tui_win_info *) (tui_source_windows ())->list[0];
+ first_win->generic.width += width_diff;
+ locator->width += width_diff;
/* check for invalid heights */
- if (heightDiff == 0)
- newHeight = firstWin->generic.height;
- else if ((firstWin->generic.height + splitDiff) >=
+ if (height_diff == 0)
+ new_height = first_win->generic.height;
+ else if ((first_win->generic.height + split_diff) >=
(screenheight - MIN_CMD_WIN_HEIGHT - 1))
- newHeight = screenheight - MIN_CMD_WIN_HEIGHT - 1;
- else if ((firstWin->generic.height + splitDiff) <= 0)
- newHeight = MIN_WIN_HEIGHT;
+ new_height = screenheight - MIN_CMD_WIN_HEIGHT - 1;
+ else if ((first_win->generic.height + split_diff) <= 0)
+ new_height = MIN_WIN_HEIGHT;
else
- newHeight = firstWin->generic.height + splitDiff;
-
- _makeInvisibleAndSetNewHeight (firstWin, newHeight);
- cmdWin->generic.origin.y = locator->origin.y + 1;
- cmdWin->generic.width += widthDiff;
- newHeight = screenheight - cmdWin->generic.origin.y;
- _makeInvisibleAndSetNewHeight (cmdWin, newHeight);
- _makeVisibleWithNewHeight (firstWin);
- _makeVisibleWithNewHeight (cmdWin);
- if (firstWin->generic.contentSize <= 0)
- tuiEraseSourceContent (firstWin, EMPTY_SOURCE_PROMPT);
+ new_height = first_win->generic.height + split_diff;
+
+ make_invisible_and_set_new_height (first_win, new_height);
+ TUI_CMD_WIN->generic.origin.y = locator->origin.y + 1;
+ TUI_CMD_WIN->generic.width += width_diff;
+ new_height = screenheight - TUI_CMD_WIN->generic.origin.y;
+ make_invisible_and_set_new_height (TUI_CMD_WIN, new_height);
+ make_visible_with_new_height (first_win);
+ make_visible_with_new_height (TUI_CMD_WIN);
+ if (first_win->generic.content_size <= 0)
+ tui_erase_source_content (first_win, EMPTY_SOURCE_PROMPT);
break;
default:
- if (curLayout == SRC_DISASSEM_COMMAND)
+ if (cur_layout == SRC_DISASSEM_COMMAND)
{
- firstWin = srcWin;
- firstWin->generic.width += widthDiff;
- secondWin = disassemWin;
- secondWin->generic.width += widthDiff;
+ first_win = TUI_SRC_WIN;
+ first_win->generic.width += width_diff;
+ second_win = TUI_DISASM_WIN;
+ second_win->generic.width += width_diff;
}
else
{
- firstWin = dataWin;
- firstWin->generic.width += widthDiff;
- secondWin = (TuiWinInfoPtr) (sourceWindows ())->list[0];
- secondWin->generic.width += widthDiff;
+ first_win = TUI_DATA_WIN;
+ first_win->generic.width += width_diff;
+ second_win = (struct tui_win_info *) (tui_source_windows ())->list[0];
+ second_win->generic.width += width_diff;
}
/* Change the first window's height/width */
/* check for invalid heights */
- if (heightDiff == 0)
- newHeight = firstWin->generic.height;
- else if ((firstWin->generic.height +
- secondWin->generic.height + (splitDiff * 2)) >=
+ if (height_diff == 0)
+ new_height = first_win->generic.height;
+ else if ((first_win->generic.height +
+ second_win->generic.height + (split_diff * 2)) >=
(screenheight - MIN_CMD_WIN_HEIGHT - 1))
- newHeight = (screenheight - MIN_CMD_WIN_HEIGHT - 1) / 2;
- else if ((firstWin->generic.height + splitDiff) <= 0)
- newHeight = MIN_WIN_HEIGHT;
+ new_height = (screenheight - MIN_CMD_WIN_HEIGHT - 1) / 2;
+ else if ((first_win->generic.height + split_diff) <= 0)
+ new_height = MIN_WIN_HEIGHT;
else
- newHeight = firstWin->generic.height + splitDiff;
- _makeInvisibleAndSetNewHeight (firstWin, newHeight);
+ new_height = first_win->generic.height + split_diff;
+ make_invisible_and_set_new_height (first_win, new_height);
- if (firstWin == dataWin && widthDiff != 0)
- firstWin->detail.dataDisplayInfo.regsColumnCount =
+ if (first_win == TUI_DATA_WIN && width_diff != 0)
+ first_win->detail.data_display_info.regs_column_count =
tui_calculate_regs_column_count (
- firstWin->detail.dataDisplayInfo.regsDisplayType);
- locator->width += widthDiff;
+ first_win->detail.data_display_info.regs_display_type);
+ locator->width += width_diff;
/* Change the second window's height/width */
/* check for invalid heights */
- if (heightDiff == 0)
- newHeight = secondWin->generic.height;
- else if ((firstWin->generic.height +
- secondWin->generic.height + (splitDiff * 2)) >=
+ if (height_diff == 0)
+ new_height = second_win->generic.height;
+ else if ((first_win->generic.height +
+ second_win->generic.height + (split_diff * 2)) >=
(screenheight - MIN_CMD_WIN_HEIGHT - 1))
{
- newHeight = screenheight - MIN_CMD_WIN_HEIGHT - 1;
- if (newHeight % 2)
- newHeight = (newHeight / 2) + 1;
+ new_height = screenheight - MIN_CMD_WIN_HEIGHT - 1;
+ if (new_height % 2)
+ new_height = (new_height / 2) + 1;
else
- newHeight /= 2;
+ new_height /= 2;
}
- else if ((secondWin->generic.height + splitDiff) <= 0)
- newHeight = MIN_WIN_HEIGHT;
+ else if ((second_win->generic.height + split_diff) <= 0)
+ new_height = MIN_WIN_HEIGHT;
else
- newHeight = secondWin->generic.height + splitDiff;
- secondWin->generic.origin.y = firstWin->generic.height - 1;
- _makeInvisibleAndSetNewHeight (secondWin, newHeight);
+ new_height = second_win->generic.height + split_diff;
+ second_win->generic.origin.y = first_win->generic.height - 1;
+ make_invisible_and_set_new_height (second_win, new_height);
/* Change the command window's height/width */
- cmdWin->generic.origin.y = locator->origin.y + 1;
- _makeInvisibleAndSetNewHeight (
- cmdWin, cmdWin->generic.height + cmdSplitDiff);
- _makeVisibleWithNewHeight (firstWin);
- _makeVisibleWithNewHeight (secondWin);
- _makeVisibleWithNewHeight (cmdWin);
- if (firstWin->generic.contentSize <= 0)
- tuiEraseSourceContent (firstWin, EMPTY_SOURCE_PROMPT);
- if (secondWin->generic.contentSize <= 0)
- tuiEraseSourceContent (secondWin, EMPTY_SOURCE_PROMPT);
+ TUI_CMD_WIN->generic.origin.y = locator->origin.y + 1;
+ make_invisible_and_set_new_height (
+ TUI_CMD_WIN, TUI_CMD_WIN->generic.height + cmd_split_diff);
+ make_visible_with_new_height (first_win);
+ make_visible_with_new_height (second_win);
+ make_visible_with_new_height (TUI_CMD_WIN);
+ if (first_win->generic.content_size <= 0)
+ tui_erase_source_content (first_win, EMPTY_SOURCE_PROMPT);
+ if (second_win->generic.content_size <= 0)
+ tui_erase_source_content (second_win, EMPTY_SOURCE_PROMPT);
break;
}
/*
** Now remove all invisible windows, and their content so that they get
** created again when called for with the new size
*/
- for (winType = SRC_WIN; (winType < MAX_MAJOR_WINDOWS); winType++)
+ for (win_type = SRC_WIN; (win_type < MAX_MAJOR_WINDOWS); win_type++)
{
- if (winType != CMD_WIN && m_winPtrNotNull (winList[winType]) &&
- !winList[winType]->generic.isVisible)
+ if (win_type != CMD_WIN && (tui_win_list[win_type] != NULL)
+ && !tui_win_list[win_type]->generic.is_visible)
{
- freeWindow (winList[winType]);
- winList[winType] = (TuiWinInfoPtr) NULL;
+ tui_free_window (tui_win_list[win_type]);
+ tui_win_list[win_type] = (struct tui_win_info *) NULL;
}
}
- tuiSetWinResizedTo (TRUE);
+ tui_set_win_resized_to (TRUE);
/* turn keypad back on, unless focus is in the command window */
- if (winWithFocus != cmdWin)
- keypad (cmdWin->generic.handle, TRUE);
+ if (win_with_focus != TUI_CMD_WIN)
+ keypad (TUI_CMD_WIN->generic.handle, TRUE);
}
- return;
-} /* tuiResizeAll */
+}
-/*
- ** tuiSigwinchHandler()
- ** SIGWINCH signal handler for the tui. This signal handler is
- ** always called, even when the readline package clears signals
- ** because it is set as the old_sigwinch() (TUI only)
- */
+/* SIGWINCH signal handler for the tui. This signal handler is always
+ called, even when the readline package clears signals because it is
+ set as the old_sigwinch() (TUI only). */
void
-tuiSigwinchHandler (int signal)
+tui_sigwinch_handler (int signal)
{
/*
** Say that a resize was done so that the readline can do it
** later when appropriate.
*/
- tuiSetWinResizedTo (TRUE);
-
- return;
-} /* tuiSigwinchHandler */
+ tui_set_win_resized_to (TRUE);
+}
@@ -807,177 +761,146 @@ tuiSigwinchHandler (int signal)
**************************/
-/*
- ** _tuiScrollForward_command().
- */
static void
-_tuiScrollForward_command (char *arg, int fromTTY)
+tui_scroll_forward_command (char *arg, int from_tty)
{
- int numToScroll = 1;
- TuiWinInfoPtr winToScroll;
+ int num_to_scroll = 1;
+ struct tui_win_info * win_to_scroll;
/* Make sure the curses mode is enabled. */
tui_enable ();
if (arg == (char *) NULL)
- _parseScrollingArgs (arg, &winToScroll, (int *) NULL);
+ parse_scrolling_args (arg, &win_to_scroll, (int *) NULL);
else
- _parseScrollingArgs (arg, &winToScroll, &numToScroll);
- tui_scroll (FORWARD_SCROLL, winToScroll, numToScroll);
+ parse_scrolling_args (arg, &win_to_scroll, &num_to_scroll);
+ tui_scroll (FORWARD_SCROLL, win_to_scroll, num_to_scroll);
}
-/*
- ** _tuiScrollBackward_command().
- */
static void
-_tuiScrollBackward_command (char *arg, int fromTTY)
+tui_scroll_backward_command (char *arg, int from_tty)
{
- int numToScroll = 1;
- TuiWinInfoPtr winToScroll;
+ int num_to_scroll = 1;
+ struct tui_win_info * win_to_scroll;
/* Make sure the curses mode is enabled. */
tui_enable ();
if (arg == (char *) NULL)
- _parseScrollingArgs (arg, &winToScroll, (int *) NULL);
+ parse_scrolling_args (arg, &win_to_scroll, (int *) NULL);
else
- _parseScrollingArgs (arg, &winToScroll, &numToScroll);
- tui_scroll (BACKWARD_SCROLL, winToScroll, numToScroll);
+ parse_scrolling_args (arg, &win_to_scroll, &num_to_scroll);
+ tui_scroll (BACKWARD_SCROLL, win_to_scroll, num_to_scroll);
}
-/*
- ** _tuiScrollLeft_command().
- */
static void
-_tuiScrollLeft_command (char *arg, int fromTTY)
+tui_scroll_left_command (char *arg, int from_tty)
{
- int numToScroll;
- TuiWinInfoPtr winToScroll;
+ int num_to_scroll;
+ struct tui_win_info * win_to_scroll;
/* Make sure the curses mode is enabled. */
tui_enable ();
- _parseScrollingArgs (arg, &winToScroll, &numToScroll);
- tui_scroll (LEFT_SCROLL, winToScroll, numToScroll);
+ parse_scrolling_args (arg, &win_to_scroll, &num_to_scroll);
+ tui_scroll (LEFT_SCROLL, win_to_scroll, num_to_scroll);
}
-/*
- ** _tuiScrollRight_command().
- */
static void
-_tuiScrollRight_command (char *arg, int fromTTY)
+tui_scroll_right_command (char *arg, int from_tty)
{
- int numToScroll;
- TuiWinInfoPtr winToScroll;
+ int num_to_scroll;
+ struct tui_win_info * win_to_scroll;
/* Make sure the curses mode is enabled. */
tui_enable ();
- _parseScrollingArgs (arg, &winToScroll, &numToScroll);
- tui_scroll (RIGHT_SCROLL, winToScroll, numToScroll);
+ parse_scrolling_args (arg, &win_to_scroll, &num_to_scroll);
+ tui_scroll (RIGHT_SCROLL, win_to_scroll, num_to_scroll);
}
-/*
- ** _tuiSetFocus().
- ** Set focus to the window named by 'arg'
- */
+/* Set focus to the window named by 'arg'. */
static void
-_tuiSetFocus (char *arg, int fromTTY)
+tui_set_focus (char *arg, int from_tty)
{
if (arg != (char *) NULL)
{
- char *bufPtr = (char *) xstrdup (arg);
+ char *buf_ptr = (char *) xstrdup (arg);
int i;
- TuiWinInfoPtr winInfo = (TuiWinInfoPtr) NULL;
+ struct tui_win_info * win_info = (struct tui_win_info *) NULL;
- for (i = 0; (i < strlen (bufPtr)); i++)
- bufPtr[i] = toupper (arg[i]);
+ for (i = 0; (i < strlen (buf_ptr)); i++)
+ buf_ptr[i] = toupper (arg[i]);
- if (subset_compare (bufPtr, "NEXT"))
- winInfo = tuiNextWin (tuiWinWithFocus ());
- else if (subset_compare (bufPtr, "PREV"))
- winInfo = tuiPrevWin (tuiWinWithFocus ());
+ if (subset_compare (buf_ptr, "NEXT"))
+ win_info = tui_next_win (tui_win_with_focus ());
+ else if (subset_compare (buf_ptr, "PREV"))
+ win_info = tui_prev_win (tui_win_with_focus ());
else
- winInfo = partialWinByName (bufPtr);
+ win_info = tui_partial_win_by_name (buf_ptr);
- if (winInfo == (TuiWinInfoPtr) NULL || !winInfo->generic.isVisible)
+ if (win_info == (struct tui_win_info *) NULL || !win_info->generic.is_visible)
warning ("Invalid window specified. \n\
The window name specified must be valid and visible.\n");
else
{
- tuiSetWinFocusTo (winInfo);
- keypad (cmdWin->generic.handle, (winInfo != cmdWin));
+ tui_set_win_focus_to (win_info);
+ keypad (TUI_CMD_WIN->generic.handle, (win_info != TUI_CMD_WIN));
}
- if (dataWin && dataWin->generic.isVisible)
- tuiRefreshDataWin ();
- tuiFree (bufPtr);
+ if (TUI_DATA_WIN && TUI_DATA_WIN->generic.is_visible)
+ tui_refresh_data_win ();
+ xfree (buf_ptr);
printf_filtered ("Focus set to %s window.\n",
- winName ((TuiGenWinInfoPtr) tuiWinWithFocus ()));
+ tui_win_name ((struct tui_gen_win_info *) tui_win_with_focus ()));
}
else
warning ("Incorrect Number of Arguments.\n%s", FOCUS_USAGE);
+}
- return;
-} /* _tuiSetFocus */
-
-/*
- ** _tuiSetFocus_command()
- */
static void
-_tuiSetFocus_command (char *arg, int fromTTY)
+tui_set_focus_command (char *arg, int from_tty)
{
/* Make sure the curses mode is enabled. */
tui_enable ();
- _tuiSetFocus (arg, fromTTY);
+ tui_set_focus (arg, from_tty);
}
-/*
- ** _tuiAllWindowsInfo().
- */
static void
-_tuiAllWindowsInfo (char *arg, int fromTTY)
+tui_all_windows_info (char *arg, int from_tty)
{
- TuiWinType type;
- TuiWinInfoPtr winWithFocus = tuiWinWithFocus ();
+ enum tui_win_type type;
+ struct tui_win_info * win_with_focus = tui_win_with_focus ();
for (type = SRC_WIN; (type < MAX_MAJOR_WINDOWS); type++)
- if (winList[type] && winList[type]->generic.isVisible)
+ if (tui_win_list[type] && tui_win_list[type]->generic.is_visible)
{
- if (winWithFocus == winList[type])
+ if (win_with_focus == tui_win_list[type])
printf_filtered (" %s\t(%d lines) <has focus>\n",
- winName (&winList[type]->generic),
- winList[type]->generic.height);
+ tui_win_name (&tui_win_list[type]->generic),
+ tui_win_list[type]->generic.height);
else
printf_filtered (" %s\t(%d lines)\n",
- winName (&winList[type]->generic),
- winList[type]->generic.height);
+ tui_win_name (&tui_win_list[type]->generic),
+ tui_win_list[type]->generic.height);
}
-
- return;
-} /* _tuiAllWindowsInfo */
+}
-/*
- ** _tuiRefreshAll_command().
- */
static void
-_tuiRefreshAll_command (char *arg, int fromTTY)
+tui_refresh_all_command (char *arg, int from_tty)
{
/* Make sure the curses mode is enabled. */
tui_enable ();
- tuiRefreshAll ();
+ tui_refresh_all_win ();
}
-/*
- ** _tuiSetWinTabWidth_command().
- ** Set the height of the specified window.
- */
+/* Set the height of the specified window. */
static void
-_tuiSetTabWidth_command (char *arg, int fromTTY)
+tui_set_tab_width_command (char *arg, int from_tty)
{
/* Make sure the curses mode is enabled. */
tui_enable ();
@@ -987,82 +910,77 @@ _tuiSetTabWidth_command (char *arg, int fromTTY)
ts = atoi (arg);
if (ts > 0)
- tuiSetDefaultTabLen (ts);
+ tui_set_default_tab_len (ts);
else
warning ("Tab widths greater than 0 must be specified.\n");
}
-
- return;
-} /* _tuiSetTabWidth_command */
+}
-/*
- ** _tuiSetWinHeight().
- ** Set the height of the specified window.
- */
+/* Set the height of the specified window. */
static void
-_tuiSetWinHeight (char *arg, int fromTTY)
+tui_set_win_height (char *arg, int from_tty)
{
/* Make sure the curses mode is enabled. */
tui_enable ();
if (arg != (char *) NULL)
{
char *buf = xstrdup (arg);
- char *bufPtr = buf;
+ char *buf_ptr = buf;
char *wname = (char *) NULL;
- int newHeight, i;
- TuiWinInfoPtr winInfo;
+ int new_height, i;
+ struct tui_win_info * win_info;
- wname = bufPtr;
- bufPtr = strchr (bufPtr, ' ');
- if (bufPtr != (char *) NULL)
+ wname = buf_ptr;
+ buf_ptr = strchr (buf_ptr, ' ');
+ if (buf_ptr != (char *) NULL)
{
- *bufPtr = (char) 0;
+ *buf_ptr = (char) 0;
/*
** Validate the window name
*/
for (i = 0; i < strlen (wname); i++)
wname[i] = toupper (wname[i]);
- winInfo = partialWinByName (wname);
+ win_info = tui_partial_win_by_name (wname);
- if (winInfo == (TuiWinInfoPtr) NULL || !winInfo->generic.isVisible)
+ if (win_info == (struct tui_win_info *) NULL || !win_info->generic.is_visible)
warning ("Invalid window specified. \n\
The window name specified must be valid and visible.\n");
else
{
/* Process the size */
- while (*(++bufPtr) == ' ')
+ while (*(++buf_ptr) == ' ')
;
- if (*bufPtr != (char) 0)
+ if (*buf_ptr != (char) 0)
{
int negate = FALSE;
- int fixedSize = TRUE;
- int inputNo;;
+ int fixed_size = TRUE;
+ int input_no;;
- if (*bufPtr == '+' || *bufPtr == '-')
+ if (*buf_ptr == '+' || *buf_ptr == '-')
{
- if (*bufPtr == '-')
+ if (*buf_ptr == '-')
negate = TRUE;
- fixedSize = FALSE;
- bufPtr++;
+ fixed_size = FALSE;
+ buf_ptr++;
}
- inputNo = atoi (bufPtr);
- if (inputNo > 0)
+ input_no = atoi (buf_ptr);
+ if (input_no > 0)
{
if (negate)
- inputNo *= (-1);
- if (fixedSize)
- newHeight = inputNo;
+ input_no *= (-1);
+ if (fixed_size)
+ new_height = input_no;
else
- newHeight = winInfo->generic.height + inputNo;
+ new_height = win_info->generic.height + input_no;
/*
** Now change the window's height, and adjust all
** other windows around it
*/
- if (_tuiAdjustWinHeights (winInfo,
- newHeight) == TUI_FAILURE)
+ if (tui_adjust_win_heights (win_info,
+ new_height) == TUI_FAILURE)
warning ("Invalid window height specified.\n%s",
WIN_HEIGHT_USAGE);
else
@@ -1078,48 +996,40 @@ The window name specified must be valid and visible.\n");
printf_filtered (WIN_HEIGHT_USAGE);
if (buf != (char *) NULL)
- tuiFree (buf);
+ xfree (buf);
}
else
printf_filtered (WIN_HEIGHT_USAGE);
+}
- return;
-} /* _tuiSetWinHeight */
-
-/*
- ** _tuiSetWinHeight_command().
- ** Set the height of the specified window, with va_list.
- */
+/* Set the height of the specified window, with va_list. */
static void
-_tuiSetWinHeight_command (char *arg, int fromTTY)
+tui_set_win_height_command (char *arg, int from_tty)
{
/* Make sure the curses mode is enabled. */
tui_enable ();
- _tuiSetWinHeight (arg, fromTTY);
+ tui_set_win_height (arg, from_tty);
}
-/*
- ** _tuiXDBsetWinHeight().
- ** XDB Compatibility command for setting the window height. This will
- ** increase or decrease the command window by the specified amount.
- */
+/* XDB Compatibility command for setting the window height. This will
+ increase or decrease the command window by the specified amount. */
static void
-_tuiXDBsetWinHeight (char *arg, int fromTTY)
+tui_xdb_set_win_height (char *arg, int from_tty)
{
/* Make sure the curses mode is enabled. */
tui_enable ();
if (arg != (char *) NULL)
{
- int inputNo = atoi (arg);
+ int input_no = atoi (arg);
- if (inputNo > 0)
+ if (input_no > 0)
{ /* Add 1 for the locator */
- int newHeight = termHeight () - (inputNo + 1);
+ int new_height = tui_term_height () - (input_no + 1);
- if (!_newHeightOk (winList[CMD_WIN], newHeight) ||
- _tuiAdjustWinHeights (winList[CMD_WIN],
- newHeight) == TUI_FAILURE)
+ if (!new_height_ok (tui_win_list[CMD_WIN], new_height) ||
+ tui_adjust_win_heights (tui_win_list[CMD_WIN],
+ new_height) == TUI_FAILURE)
warning ("Invalid window height specified.\n%s",
XDBWIN_HEIGHT_USAGE);
}
@@ -1129,226 +1039,215 @@ _tuiXDBsetWinHeight (char *arg, int fromTTY)
}
else
warning ("Invalid window height specified.\n%s", XDBWIN_HEIGHT_USAGE);
+}
- return;
-} /* _tuiXDBsetWinHeight */
-
-/*
- ** _tuiSetWinHeight_command().
- ** Set the height of the specified window, with va_list.
- */
+/* Set the height of the specified window, with va_list. */
static void
-_tuiXDBsetWinHeight_command (char *arg, int fromTTY)
+tui_xdb_set_win_height_command (char *arg, int from_tty)
{
- _tuiXDBsetWinHeight (arg, fromTTY);
+ tui_xdb_set_win_height (arg, from_tty);
}
-/*
- ** _tuiAdjustWinHeights().
- ** Function to adjust all window heights around the primary
- */
-static TuiStatus
-_tuiAdjustWinHeights (TuiWinInfoPtr primaryWinInfo, int newHeight)
+/* Function to adjust all window heights around the primary. */
+static enum tui_status
+tui_adjust_win_heights (struct tui_win_info * primary_win_info, int new_height)
{
- TuiStatus status = TUI_FAILURE;
+ enum tui_status status = TUI_FAILURE;
- if (_newHeightOk (primaryWinInfo, newHeight))
+ if (new_height_ok (primary_win_info, new_height))
{
status = TUI_SUCCESS;
- if (newHeight != primaryWinInfo->generic.height)
+ if (new_height != primary_win_info->generic.height)
{
int diff;
- TuiWinInfoPtr winInfo;
- TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
- TuiLayoutType curLayout = currentLayout ();
+ struct tui_win_info * win_info;
+ struct tui_gen_win_info * locator = tui_locator_win_info_ptr ();
+ enum tui_layout_type cur_layout = tui_current_layout ();
- diff = (newHeight - primaryWinInfo->generic.height) * (-1);
- if (curLayout == SRC_COMMAND || curLayout == DISASSEM_COMMAND)
+ diff = (new_height - primary_win_info->generic.height) * (-1);
+ if (cur_layout == SRC_COMMAND || cur_layout == DISASSEM_COMMAND)
{
- TuiWinInfoPtr srcWinInfo;
+ struct tui_win_info * src_win_info;
- _makeInvisibleAndSetNewHeight (primaryWinInfo, newHeight);
- if (primaryWinInfo->generic.type == CMD_WIN)
+ make_invisible_and_set_new_height (primary_win_info, new_height);
+ if (primary_win_info->generic.type == CMD_WIN)
{
- winInfo = (TuiWinInfoPtr) (sourceWindows ())->list[0];
- srcWinInfo = winInfo;
+ win_info = (struct tui_win_info *) (tui_source_windows ())->list[0];
+ src_win_info = win_info;
}
else
{
- winInfo = winList[CMD_WIN];
- srcWinInfo = primaryWinInfo;
+ win_info = tui_win_list[CMD_WIN];
+ src_win_info = primary_win_info;
}
- _makeInvisibleAndSetNewHeight (winInfo,
- winInfo->generic.height + diff);
- cmdWin->generic.origin.y = locator->origin.y + 1;
- _makeVisibleWithNewHeight (winInfo);
- _makeVisibleWithNewHeight (primaryWinInfo);
- if (srcWinInfo->generic.contentSize <= 0)
- tuiEraseSourceContent (srcWinInfo, EMPTY_SOURCE_PROMPT);
+ make_invisible_and_set_new_height (win_info,
+ win_info->generic.height + diff);
+ TUI_CMD_WIN->generic.origin.y = locator->origin.y + 1;
+ make_visible_with_new_height (win_info);
+ make_visible_with_new_height (primary_win_info);
+ if (src_win_info->generic.content_size <= 0)
+ tui_erase_source_content (src_win_info, EMPTY_SOURCE_PROMPT);
}
else
{
- TuiWinInfoPtr firstWin, secondWin;
+ struct tui_win_info *first_win;
+ struct tui_win_info *second_win;
- if (curLayout == SRC_DISASSEM_COMMAND)
+ if (cur_layout == SRC_DISASSEM_COMMAND)
{
- firstWin = srcWin;
- secondWin = disassemWin;
+ first_win = TUI_SRC_WIN;
+ second_win = TUI_DISASM_WIN;
}
else
{
- firstWin = dataWin;
- secondWin = (TuiWinInfoPtr) (sourceWindows ())->list[0];
+ first_win = TUI_DATA_WIN;
+ second_win = (struct tui_win_info *) (tui_source_windows ())->list[0];
}
- if (primaryWinInfo == cmdWin)
+ if (primary_win_info == TUI_CMD_WIN)
{ /*
** Split the change in height accross the 1st & 2nd windows
** adjusting them as well.
*/
- int firstSplitDiff = diff / 2; /* subtract the locator */
- int secondSplitDiff = firstSplitDiff;
+ int first_split_diff = diff / 2; /* subtract the locator */
+ int second_split_diff = first_split_diff;
if (diff % 2)
{
- if (firstWin->generic.height >
- secondWin->generic.height)
+ if (first_win->generic.height >
+ second_win->generic.height)
if (diff < 0)
- firstSplitDiff--;
+ first_split_diff--;
else
- firstSplitDiff++;
+ first_split_diff++;
else
{
if (diff < 0)
- secondSplitDiff--;
+ second_split_diff--;
else
- secondSplitDiff++;
+ second_split_diff++;
}
}
/* make sure that the minimum hieghts are honored */
- while ((firstWin->generic.height + firstSplitDiff) < 3)
+ while ((first_win->generic.height + first_split_diff) < 3)
{
- firstSplitDiff++;
- secondSplitDiff--;
+ first_split_diff++;
+ second_split_diff--;
}
- while ((secondWin->generic.height + secondSplitDiff) < 3)
+ while ((second_win->generic.height + second_split_diff) < 3)
{
- secondSplitDiff++;
- firstSplitDiff--;
+ second_split_diff++;
+ first_split_diff--;
}
- _makeInvisibleAndSetNewHeight (
- firstWin,
- firstWin->generic.height + firstSplitDiff);
- secondWin->generic.origin.y = firstWin->generic.height - 1;
- _makeInvisibleAndSetNewHeight (
- secondWin, secondWin->generic.height + secondSplitDiff);
- cmdWin->generic.origin.y = locator->origin.y + 1;
- _makeInvisibleAndSetNewHeight (cmdWin, newHeight);
+ make_invisible_and_set_new_height (
+ first_win,
+ first_win->generic.height + first_split_diff);
+ second_win->generic.origin.y = first_win->generic.height - 1;
+ make_invisible_and_set_new_height (
+ second_win, second_win->generic.height + second_split_diff);
+ TUI_CMD_WIN->generic.origin.y = locator->origin.y + 1;
+ make_invisible_and_set_new_height (TUI_CMD_WIN, new_height);
}
else
{
- if ((cmdWin->generic.height + diff) < 1)
+ if ((TUI_CMD_WIN->generic.height + diff) < 1)
{ /*
** If there is no way to increase the command window
** take real estate from the 1st or 2nd window.
*/
- if ((cmdWin->generic.height + diff) < 1)
+ if ((TUI_CMD_WIN->generic.height + diff) < 1)
{
int i;
- for (i = cmdWin->generic.height + diff;
+ for (i = TUI_CMD_WIN->generic.height + diff;
(i < 1); i++)
- if (primaryWinInfo == firstWin)
- secondWin->generic.height--;
+ if (primary_win_info == first_win)
+ second_win->generic.height--;
else
- firstWin->generic.height--;
+ first_win->generic.height--;
}
}
- if (primaryWinInfo == firstWin)
- _makeInvisibleAndSetNewHeight (firstWin, newHeight);
+ if (primary_win_info == first_win)
+ make_invisible_and_set_new_height (first_win, new_height);
else
- _makeInvisibleAndSetNewHeight (
- firstWin,
- firstWin->generic.height);
- secondWin->generic.origin.y = firstWin->generic.height - 1;
- if (primaryWinInfo == secondWin)
- _makeInvisibleAndSetNewHeight (secondWin, newHeight);
+ make_invisible_and_set_new_height (
+ first_win,
+ first_win->generic.height);
+ second_win->generic.origin.y = first_win->generic.height - 1;
+ if (primary_win_info == second_win)
+ make_invisible_and_set_new_height (second_win, new_height);
else
- _makeInvisibleAndSetNewHeight (
- secondWin, secondWin->generic.height);
- cmdWin->generic.origin.y = locator->origin.y + 1;
- if ((cmdWin->generic.height + diff) < 1)
- _makeInvisibleAndSetNewHeight (cmdWin, 1);
+ make_invisible_and_set_new_height (
+ second_win, second_win->generic.height);
+ TUI_CMD_WIN->generic.origin.y = locator->origin.y + 1;
+ if ((TUI_CMD_WIN->generic.height + diff) < 1)
+ make_invisible_and_set_new_height (TUI_CMD_WIN, 1);
else
- _makeInvisibleAndSetNewHeight (
- cmdWin, cmdWin->generic.height + diff);
+ make_invisible_and_set_new_height (
+ TUI_CMD_WIN, TUI_CMD_WIN->generic.height + diff);
}
- _makeVisibleWithNewHeight (cmdWin);
- _makeVisibleWithNewHeight (secondWin);
- _makeVisibleWithNewHeight (firstWin);
- if (firstWin->generic.contentSize <= 0)
- tuiEraseSourceContent (firstWin, EMPTY_SOURCE_PROMPT);
- if (secondWin->generic.contentSize <= 0)
- tuiEraseSourceContent (secondWin, EMPTY_SOURCE_PROMPT);
+ make_visible_with_new_height (TUI_CMD_WIN);
+ make_visible_with_new_height (second_win);
+ make_visible_with_new_height (first_win);
+ if (first_win->generic.content_size <= 0)
+ tui_erase_source_content (first_win, EMPTY_SOURCE_PROMPT);
+ if (second_win->generic.content_size <= 0)
+ tui_erase_source_content (second_win, EMPTY_SOURCE_PROMPT);
}
}
}
return status;
-} /* _tuiAdjustWinHeights */
+}
-/*
- ** _makeInvisibleAndSetNewHeight().
- ** Function make the target window (and auxillary windows associated
- ** with the targer) invisible, and set the new height and location.
- */
+/* Function make the target window (and auxillary windows associated
+ with the targer) invisible, and set the new height and location. */
static void
-_makeInvisibleAndSetNewHeight (TuiWinInfoPtr winInfo, int height)
+make_invisible_and_set_new_height (struct tui_win_info * win_info, int height)
{
int i;
- TuiGenWinInfoPtr genWinInfo;
-
+ struct tui_gen_win_info * gen_win_info;
- m_beInvisible (&winInfo->generic);
- winInfo->generic.height = height;
+ tui_make_invisible (&win_info->generic);
+ win_info->generic.height = height;
if (height > 1)
- winInfo->generic.viewportHeight = height - 1;
+ win_info->generic.viewport_height = height - 1;
else
- winInfo->generic.viewportHeight = height;
- if (winInfo != cmdWin)
- winInfo->generic.viewportHeight--;
+ win_info->generic.viewport_height = height;
+ if (win_info != TUI_CMD_WIN)
+ win_info->generic.viewport_height--;
- /* Now deal with the auxillary windows associated with winInfo */
- switch (winInfo->generic.type)
+ /* Now deal with the auxillary windows associated with win_info */
+ switch (win_info->generic.type)
{
case SRC_WIN:
case DISASSEM_WIN:
- genWinInfo = winInfo->detail.sourceInfo.executionInfo;
- m_beInvisible (genWinInfo);
- genWinInfo->height = height;
- genWinInfo->origin.y = winInfo->generic.origin.y;
+ gen_win_info = win_info->detail.source_info.execution_info;
+ tui_make_invisible (gen_win_info);
+ gen_win_info->height = height;
+ gen_win_info->origin.y = win_info->generic.origin.y;
if (height > 1)
- genWinInfo->viewportHeight = height - 1;
+ gen_win_info->viewport_height = height - 1;
else
- genWinInfo->viewportHeight = height;
- if (winInfo != cmdWin)
- genWinInfo->viewportHeight--;
+ gen_win_info->viewport_height = height;
+ if (win_info != TUI_CMD_WIN)
+ gen_win_info->viewport_height--;
- if (m_hasLocator (winInfo))
+ if (tui_win_has_locator (win_info))
{
- genWinInfo = locatorWinInfoPtr ();
- m_beInvisible (genWinInfo);
- genWinInfo->origin.y = winInfo->generic.origin.y + height;
+ gen_win_info = tui_locator_win_info_ptr ();
+ tui_make_invisible (gen_win_info);
+ gen_win_info->origin.y = win_info->generic.origin.y + height;
}
break;
case DATA_WIN:
/* delete all data item windows */
- for (i = 0; i < winInfo->generic.contentSize; i++)
+ for (i = 0; i < win_info->generic.content_size; i++)
{
- genWinInfo = (TuiGenWinInfoPtr) & ((TuiWinElementPtr)
- winInfo->generic.content[i])->whichElement.dataWindow;
- tuiDelwin (genWinInfo->handle);
- genWinInfo->handle = (WINDOW *) NULL;
+ gen_win_info = (struct tui_gen_win_info *) & ((struct tui_win_element *)
+ win_info->generic.content[i])->which_element.data_window;
+ tui_delete_win (gen_win_info->handle);
+ gen_win_info->handle = (WINDOW *) NULL;
}
break;
default:
@@ -1357,125 +1256,120 @@ _makeInvisibleAndSetNewHeight (TuiWinInfoPtr winInfo, int height)
}
-/*
- ** _makeVisibleWithNewHeight().
- ** Function to make the windows with new heights visible.
- ** This means re-creating the windows' content since the window
- ** had to be destroyed to be made invisible.
- */
+/* Function to make the windows with new heights visible. This means
+ re-creating the windows' content since the window had to be
+ destroyed to be made invisible. */
static void
-_makeVisibleWithNewHeight (TuiWinInfoPtr winInfo)
+make_visible_with_new_height (struct tui_win_info * win_info)
{
struct symtab *s;
- m_beVisible (&winInfo->generic);
- checkAndDisplayHighlightIfNeeded (winInfo);
- switch (winInfo->generic.type)
+ tui_make_visible (&win_info->generic);
+ tui_check_and_display_highlight_if_needed (win_info);
+ switch (win_info->generic.type)
{
case SRC_WIN:
case DISASSEM_WIN:
- freeWinContent (winInfo->detail.sourceInfo.executionInfo);
- m_beVisible (winInfo->detail.sourceInfo.executionInfo);
- if (winInfo->generic.content != (OpaquePtr) NULL)
+ tui_free_win_content (win_info->detail.source_info.execution_info);
+ tui_make_visible (win_info->detail.source_info.execution_info);
+ if (win_info->generic.content != NULL)
{
- TuiLineOrAddress lineOrAddr;
+ union tui_line_or_address line_or_addr;
struct symtab_and_line cursal
= get_current_source_symtab_and_line ();
- if (winInfo->generic.type == SRC_WIN)
- lineOrAddr.lineNo =
- winInfo->detail.sourceInfo.startLineOrAddr.lineNo;
+ if (win_info->generic.type == SRC_WIN)
+ line_or_addr.line_no =
+ win_info->detail.source_info.start_line_or_addr.line_no;
else
- lineOrAddr.addr =
- winInfo->detail.sourceInfo.startLineOrAddr.addr;
- freeWinContent (&winInfo->generic);
- tuiUpdateSourceWindow (winInfo,
- cursal.symtab, lineOrAddr, TRUE);
+ line_or_addr.addr =
+ win_info->detail.source_info.start_line_or_addr.addr;
+ tui_free_win_content (&win_info->generic);
+ tui_update_source_window (win_info, cursal.symtab, line_or_addr, TRUE);
}
else if (deprecated_selected_frame != (struct frame_info *) NULL)
{
- TuiLineOrAddress line;
+ union tui_line_or_address line;
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
s = find_pc_symtab (get_frame_pc (deprecated_selected_frame));
- if (winInfo->generic.type == SRC_WIN)
- line.lineNo = cursal.line;
+ if (win_info->generic.type == SRC_WIN)
+ line.line_no = cursal.line;
else
{
find_line_pc (s, cursal.line, &line.addr);
}
- tuiUpdateSourceWindow (winInfo, s, line, TRUE);
+ tui_update_source_window (win_info, s, line, TRUE);
}
- if (m_hasLocator (winInfo))
+ if (tui_win_has_locator (win_info))
{
- m_beVisible (locatorWinInfoPtr ());
- tuiShowLocatorContent ();
+ tui_make_visible (tui_locator_win_info_ptr ());
+ tui_show_locator_content ();
}
break;
case DATA_WIN:
- tuiDisplayAllData ();
+ tui_display_all_data ();
break;
case CMD_WIN:
- winInfo->detail.commandInfo.curLine = 0;
- winInfo->detail.commandInfo.curch = 0;
- wmove (winInfo->generic.handle,
- winInfo->detail.commandInfo.curLine,
- winInfo->detail.commandInfo.curch);
+ win_info->detail.command_info.cur_line = 0;
+ win_info->detail.command_info.curch = 0;
+ wmove (win_info->generic.handle,
+ win_info->detail.command_info.cur_line,
+ win_info->detail.command_info.curch);
break;
default:
break;
}
-
- return;
-} /* _makeVisibleWithNewHeight */
+}
static int
-_newHeightOk (TuiWinInfoPtr primaryWinInfo, int newHeight)
+new_height_ok (struct tui_win_info * primary_win_info, int new_height)
{
- int ok = (newHeight < termHeight ());
+ int ok = (new_height < tui_term_height ());
if (ok)
{
int diff;
- TuiLayoutType curLayout = currentLayout ();
+ enum tui_layout_type cur_layout = tui_current_layout ();
- diff = (newHeight - primaryWinInfo->generic.height) * (-1);
- if (curLayout == SRC_COMMAND || curLayout == DISASSEM_COMMAND)
+ diff = (new_height - primary_win_info->generic.height) * (-1);
+ if (cur_layout == SRC_COMMAND || cur_layout == DISASSEM_COMMAND)
{
- ok = ((primaryWinInfo->generic.type == CMD_WIN &&
- newHeight <= (termHeight () - 4) &&
- newHeight >= MIN_CMD_WIN_HEIGHT) ||
- (primaryWinInfo->generic.type != CMD_WIN &&
- newHeight <= (termHeight () - 2) &&
- newHeight >= MIN_WIN_HEIGHT));
+ ok = ((primary_win_info->generic.type == CMD_WIN &&
+ new_height <= (tui_term_height () - 4) &&
+ new_height >= MIN_CMD_WIN_HEIGHT) ||
+ (primary_win_info->generic.type != CMD_WIN &&
+ new_height <= (tui_term_height () - 2) &&
+ new_height >= MIN_WIN_HEIGHT));
if (ok)
{ /* check the total height */
- TuiWinInfoPtr winInfo;
+ struct tui_win_info * win_info;
- if (primaryWinInfo == cmdWin)
- winInfo = (TuiWinInfoPtr) (sourceWindows ())->list[0];
+ if (primary_win_info == TUI_CMD_WIN)
+ win_info = (struct tui_win_info *) (tui_source_windows ())->list[0];
else
- winInfo = cmdWin;
- ok = ((newHeight +
- (winInfo->generic.height + diff)) <= termHeight ());
+ win_info = TUI_CMD_WIN;
+ ok = ((new_height +
+ (win_info->generic.height + diff)) <= tui_term_height ());
}
}
else
{
- int curTotalHeight, totalHeight, minHeight = 0;
- TuiWinInfoPtr firstWin, secondWin;
+ int cur_total_height, total_height, min_height = 0;
+ struct tui_win_info *first_win;
+ struct tui_win_info *second_win;
- if (curLayout == SRC_DISASSEM_COMMAND)
+ if (cur_layout == SRC_DISASSEM_COMMAND)
{
- firstWin = srcWin;
- secondWin = disassemWin;
+ first_win = TUI_SRC_WIN;
+ second_win = TUI_DISASM_WIN;
}
else
{
- firstWin = dataWin;
- secondWin = (TuiWinInfoPtr) (sourceWindows ())->list[0];
+ first_win = TUI_DATA_WIN;
+ second_win = (struct tui_win_info *) (tui_source_windows ())->list[0];
}
/*
** We could simply add all the heights to obtain the same result
@@ -1483,52 +1377,52 @@ _newHeightOk (TuiWinInfoPtr primaryWinInfo, int newHeight)
** line that the first and second windows share, and add one
** for the locator.
*/
- totalHeight = curTotalHeight =
- (firstWin->generic.height + secondWin->generic.height - 1)
- + cmdWin->generic.height + 1 /*locator */ ;
- if (primaryWinInfo == cmdWin)
+ total_height = cur_total_height =
+ (first_win->generic.height + second_win->generic.height - 1)
+ + TUI_CMD_WIN->generic.height + 1 /*locator */ ;
+ if (primary_win_info == TUI_CMD_WIN)
{
/* locator included since first & second win share a line */
- ok = ((firstWin->generic.height +
- secondWin->generic.height + diff) >=
+ ok = ((first_win->generic.height +
+ second_win->generic.height + diff) >=
(MIN_WIN_HEIGHT * 2) &&
- newHeight >= MIN_CMD_WIN_HEIGHT);
+ new_height >= MIN_CMD_WIN_HEIGHT);
if (ok)
{
- totalHeight = newHeight + (firstWin->generic.height +
- secondWin->generic.height + diff);
- minHeight = MIN_CMD_WIN_HEIGHT;
+ total_height = new_height + (first_win->generic.height +
+ second_win->generic.height + diff);
+ min_height = MIN_CMD_WIN_HEIGHT;
}
}
else
{
- minHeight = MIN_WIN_HEIGHT;
+ min_height = MIN_WIN_HEIGHT;
/*
** First see if we can increase/decrease the command
** window. And make sure that the command window is
** at least 1 line
*/
- ok = ((cmdWin->generic.height + diff) > 0);
+ ok = ((TUI_CMD_WIN->generic.height + diff) > 0);
if (!ok)
{ /*
** Looks like we have to increase/decrease one of
** the other windows
*/
- if (primaryWinInfo == firstWin)
- ok = (secondWin->generic.height + diff) >= minHeight;
+ if (primary_win_info == first_win)
+ ok = (second_win->generic.height + diff) >= min_height;
else
- ok = (firstWin->generic.height + diff) >= minHeight;
+ ok = (first_win->generic.height + diff) >= min_height;
}
if (ok)
{
- if (primaryWinInfo == firstWin)
- totalHeight = newHeight +
- secondWin->generic.height +
- cmdWin->generic.height + diff;
+ if (primary_win_info == first_win)
+ total_height = new_height +
+ second_win->generic.height +
+ TUI_CMD_WIN->generic.height + diff;
else
- totalHeight = newHeight +
- firstWin->generic.height +
- cmdWin->generic.height + diff;
+ total_height = new_height +
+ first_win->generic.height +
+ TUI_CMD_WIN->generic.height + diff;
}
}
/*
@@ -1536,23 +1430,21 @@ _newHeightOk (TuiWinInfoPtr primaryWinInfo, int newHeight)
** the old total height.
*/
if (ok)
- ok = (newHeight >= minHeight && totalHeight <= curTotalHeight);
+ ok = (new_height >= min_height && total_height <= cur_total_height);
}
}
return ok;
-} /* _newHeightOk */
+}
-/*
- ** _parseScrollingArgs().
- */
static void
-_parseScrollingArgs (char *arg, TuiWinInfoPtr * winToScroll, int *numToScroll)
+parse_scrolling_args (char *arg, struct tui_win_info * * win_to_scroll,
+ int *num_to_scroll)
{
- if (numToScroll)
- *numToScroll = 0;
- *winToScroll = tuiWinWithFocus ();
+ if (num_to_scroll)
+ *num_to_scroll = 0;
+ *win_to_scroll = tui_win_with_focus ();
/*
** First set up the default window to scroll, in case there is no
@@ -1560,56 +1452,54 @@ _parseScrollingArgs (char *arg, TuiWinInfoPtr * winToScroll, int *numToScroll)
*/
if (arg != (char *) NULL)
{
- char *buf, *bufPtr;
+ char *buf, *buf_ptr;
/* process the number of lines to scroll */
- buf = bufPtr = xstrdup (arg);
- if (isdigit (*bufPtr))
+ buf = buf_ptr = xstrdup (arg);
+ if (isdigit (*buf_ptr))
{
- char *numStr;
+ char *num_str;
- numStr = bufPtr;
- bufPtr = strchr (bufPtr, ' ');
- if (bufPtr != (char *) NULL)
+ num_str = buf_ptr;
+ buf_ptr = strchr (buf_ptr, ' ');
+ if (buf_ptr != (char *) NULL)
{
- *bufPtr = (char) 0;
- if (numToScroll)
- *numToScroll = atoi (numStr);
- bufPtr++;
+ *buf_ptr = (char) 0;
+ if (num_to_scroll)
+ *num_to_scroll = atoi (num_str);
+ buf_ptr++;
}
- else if (numToScroll)
- *numToScroll = atoi (numStr);
+ else if (num_to_scroll)
+ *num_to_scroll = atoi (num_str);
}
/* process the window name if one is specified */
- if (bufPtr != (char *) NULL)
+ if (buf_ptr != (char *) NULL)
{
char *wname;
int i;
- if (*bufPtr == ' ')
- while (*(++bufPtr) == ' ')
+ if (*buf_ptr == ' ')
+ while (*(++buf_ptr) == ' ')
;
- if (*bufPtr != (char) 0)
- wname = bufPtr;
+ if (*buf_ptr != (char) 0)
+ wname = buf_ptr;
else
wname = "?";
/* Validate the window name */
for (i = 0; i < strlen (wname); i++)
wname[i] = toupper (wname[i]);
- *winToScroll = partialWinByName (wname);
+ *win_to_scroll = tui_partial_win_by_name (wname);
- if (*winToScroll == (TuiWinInfoPtr) NULL ||
- !(*winToScroll)->generic.isVisible)
+ if (*win_to_scroll == (struct tui_win_info *) NULL ||
+ !(*win_to_scroll)->generic.is_visible)
warning ("Invalid window specified. \n\
The window name specified must be valid and visible.\n");
- else if (*winToScroll == cmdWin)
- *winToScroll = (TuiWinInfoPtr) (sourceWindows ())->list[0];
+ else if (*win_to_scroll == TUI_CMD_WIN)
+ *win_to_scroll = (struct tui_win_info *) (tui_source_windows ())->list[0];
}
- tuiFree (buf);
+ xfree (buf);
}
-
- return;
-} /* _parseScrollingArgs */
+}
diff --git a/gdb/tui/tui-win.h b/gdb/tui/tui-win.h
index bc26080..b76998c 100644
--- a/gdb/tui/tui-win.h
+++ b/gdb/tui/tui-win.h
@@ -1,5 +1,8 @@
/* TUI window generic functions.
- Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+
+ Copyright 1998, 1999, 2000, 2001, 2002, 2004 Free Software
+ Foundation, Inc.
+
Contributed by Hewlett-Packard Company.
This file is part of GDB.
@@ -19,27 +22,22 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#ifndef _TUI_WIN_H
-#define _TUI_WIN_H
-
-/*****************************************
-** TYPE DEFINITIONS **
-******************************************/
+#ifndef TUI_WIN_H
+#define TUI_WIN_H
+#include "tui/tui-data.h"
+struct tui_win_info;
-/*****************************************
-** PUBLIC FUNCTION EXTERNAL DECLS **
-******************************************/
-extern void tuiScrollForward (TuiWinInfoPtr, int);
-extern void tuiScrollBackward (TuiWinInfoPtr, int);
-extern void tuiScrollLeft (TuiWinInfoPtr, int);
-extern void tuiScrollRight (TuiWinInfoPtr, int);
-extern void tui_scroll (TuiScrollDirection, TuiWinInfoPtr, int);
-extern void tuiSetWinFocusTo (TuiWinInfoPtr);
-extern void tuiResizeAll (void);
-extern void tuiRefreshAll (void);
-extern void tuiSigwinchHandler (int);
+extern void tui_scroll_forward (struct tui_win_info *, int);
+extern void tui_scroll_backward (struct tui_win_info *, int);
+extern void tui_scroll_left (struct tui_win_info *, int);
+extern void tui_scroll_right (struct tui_win_info *, int);
+extern void tui_scroll (enum tui_scroll_direction, struct tui_win_info *, int);
+extern void tui_set_win_focus_to (struct tui_win_info *);
+extern void tui_resize_all (void);
+extern void tui_refresh_all_win (void);
+extern void tui_sigwinch_handler (int);
extern chtype tui_border_ulcorner;
extern chtype tui_border_urcorner;
@@ -50,10 +48,9 @@ extern chtype tui_border_hline;
extern int tui_border_attrs;
extern int tui_active_border_attrs;
-extern int tui_update_variables ();
+extern int tui_update_variables (void);
/* Update gdb's knowledge of the terminal size. */
extern void tui_update_gdb_sizes (void);
#endif
-/*_TUI_WIN_H*/
diff --git a/gdb/tui/tui-windata.c b/gdb/tui/tui-windata.c
index f504f7f..a69fb03 100644
--- a/gdb/tui/tui-windata.c
+++ b/gdb/tui/tui-windata.c
@@ -28,13 +28,7 @@
#include "tui/tui-wingeneral.h"
#include "tui/tui-regs.h"
-#ifdef HAVE_NCURSES_H
-#include <ncurses.h>
-#else
-#ifdef HAVE_CURSES_H
-#include <curses.h>
-#endif
-#endif
+#include "gdb_curses.h"
/*****************************************
@@ -48,300 +42,260 @@
******************************************/
-/*
- ** tuiFirstDataItemDisplayed()
- ** Answer the index first element displayed.
- ** If none are displayed, then return (-1).
- */
+/* Answer the index first element displayed. If none are displayed,
+ then return (-1). */
int
-tuiFirstDataItemDisplayed (void)
+tui_first_data_item_displayed (void)
{
- int elementNo = (-1);
+ int element_no = (-1);
int i;
- for (i = 0; (i < dataWin->generic.contentSize && elementNo < 0); i++)
+ for (i = 0; (i < TUI_DATA_WIN->generic.content_size && element_no < 0); i++)
{
- TuiGenWinInfoPtr dataItemWin;
+ struct tui_gen_win_info * data_item_win;
- dataItemWin = &((TuiWinContent)
- dataWin->generic.content)[i]->whichElement.dataWindow;
- if (dataItemWin->handle != (WINDOW *) NULL && dataItemWin->isVisible)
- elementNo = i;
+ data_item_win = &((tui_win_content)
+ TUI_DATA_WIN->generic.content)[i]->which_element.data_window;
+ if (data_item_win->handle != (WINDOW *) NULL && data_item_win->is_visible)
+ element_no = i;
}
- return elementNo;
-} /* tuiFirstDataItemDisplayed */
+ return element_no;
+}
-/*
- ** tuiFirstDataElementNoInLine()
- ** Answer the index of the first element in lineNo. If lineNo is
- ** past the data area (-1) is returned.
- */
+/* Answer the index of the first element in line_no. If line_no is
+ past the data area (-1) is returned. */
int
-tuiFirstDataElementNoInLine (int lineNo)
+tui_first_data_element_no_in_line (int line_no)
{
- int firstElementNo = (-1);
+ int first_element_no = (-1);
/*
- ** First see if there is a register on lineNo, and if so, set the
+ ** First see if there is a register on line_no, and if so, set the
** first element number
*/
- if ((firstElementNo = tui_first_reg_element_no_inline (lineNo)) == -1)
+ if ((first_element_no = tui_first_reg_element_no_inline (line_no)) == -1)
{ /*
- ** Looking at the general data, the 1st element on lineNo
+ ** Looking at the general data, the 1st element on line_no
*/
}
- return firstElementNo;
-} /* tuiFirstDataElementNoInLine */
+ return first_element_no;
+}
-/*
- ** tuiDeleteDataContentWindows()
- ** Function to delete all the item windows in the data window.
- ** This is usually done when the data window is scrolled.
- */
+/* Function to delete all the item windows in the data window. This
+ is usually done when the data window is scrolled. */
void
-tuiDeleteDataContentWindows (void)
+tui_delete_data_content_windows (void)
{
int i;
- TuiGenWinInfoPtr dataItemWinPtr;
+ struct tui_gen_win_info * data_item_win_ptr;
- for (i = 0; (i < dataWin->generic.contentSize); i++)
+ for (i = 0; (i < TUI_DATA_WIN->generic.content_size); i++)
{
- dataItemWinPtr = &((TuiWinContent)
- dataWin->generic.content)[i]->whichElement.dataWindow;
- tuiDelwin (dataItemWinPtr->handle);
- dataItemWinPtr->handle = (WINDOW *) NULL;
- dataItemWinPtr->isVisible = FALSE;
+ data_item_win_ptr = &((tui_win_content)
+ TUI_DATA_WIN->generic.content)[i]->which_element.data_window;
+ tui_delete_win (data_item_win_ptr->handle);
+ data_item_win_ptr->handle = (WINDOW *) NULL;
+ data_item_win_ptr->is_visible = FALSE;
}
-
- return;
-} /* tuiDeleteDataContentWindows */
+}
void
-tuiEraseDataContent (char *prompt)
+tui_erase_data_content (char *prompt)
{
- werase (dataWin->generic.handle);
- checkAndDisplayHighlightIfNeeded (dataWin);
+ werase (TUI_DATA_WIN->generic.handle);
+ tui_check_and_display_highlight_if_needed (TUI_DATA_WIN);
if (prompt != (char *) NULL)
{
- int halfWidth = (dataWin->generic.width - 2) / 2;
- int xPos;
+ int half_width = (TUI_DATA_WIN->generic.width - 2) / 2;
+ int x_pos;
- if (strlen (prompt) >= halfWidth)
- xPos = 1;
+ if (strlen (prompt) >= half_width)
+ x_pos = 1;
else
- xPos = halfWidth - strlen (prompt);
- mvwaddstr (dataWin->generic.handle,
- (dataWin->generic.height / 2),
- xPos,
+ x_pos = half_width - strlen (prompt);
+ mvwaddstr (TUI_DATA_WIN->generic.handle,
+ (TUI_DATA_WIN->generic.height / 2),
+ x_pos,
prompt);
}
- wrefresh (dataWin->generic.handle);
-
- return;
-} /* tuiEraseDataContent */
+ wrefresh (TUI_DATA_WIN->generic.handle);
+}
-/*
- ** tuiDisplayAllData().
- ** This function displays the data that is in the data window's
- ** content. It does not set the content.
- */
+/* This function displays the data that is in the data window's
+ content. It does not set the content. */
void
-tuiDisplayAllData (void)
+tui_display_all_data (void)
{
- if (dataWin->generic.contentSize <= 0)
- tuiEraseDataContent (NO_DATA_STRING);
+ if (TUI_DATA_WIN->generic.content_size <= 0)
+ tui_erase_data_content (NO_DATA_STRING);
else
{
- tuiEraseDataContent ((char *) NULL);
- tuiDeleteDataContentWindows ();
- checkAndDisplayHighlightIfNeeded (dataWin);
+ tui_erase_data_content ((char *) NULL);
+ tui_delete_data_content_windows ();
+ tui_check_and_display_highlight_if_needed (TUI_DATA_WIN);
tui_display_registers_from (0);
/*
** Then display the other data
*/
- if (dataWin->detail.dataDisplayInfo.dataContent !=
- (TuiWinContent) NULL &&
- dataWin->detail.dataDisplayInfo.dataContentCount > 0)
+ if (TUI_DATA_WIN->detail.data_display_info.data_content !=
+ (tui_win_content) NULL &&
+ TUI_DATA_WIN->detail.data_display_info.data_content_count > 0)
{
}
}
- return;
-} /* tuiDisplayAllData */
+}
-/*
- ** tuiDisplayDataFromLine()
- ** Function to display the data starting at line, lineNo, in the
- ** data window.
- */
+/* Function to display the data starting at line, line_no, in the data
+ window. */
void
-tuiDisplayDataFromLine (int lineNo)
+tui_display_data_from_line (int line_no)
{
- int _lineNo = lineNo;
+ int _line_no = line_no;
- if (lineNo < 0)
- _lineNo = 0;
+ if (line_no < 0)
+ _line_no = 0;
- checkAndDisplayHighlightIfNeeded (dataWin);
+ tui_check_and_display_highlight_if_needed (TUI_DATA_WIN);
/* there is no general data, force regs to display (if there are any) */
- if (dataWin->detail.dataDisplayInfo.dataContentCount <= 0)
- tui_display_registers_from_line (_lineNo, TRUE);
+ if (TUI_DATA_WIN->detail.data_display_info.data_content_count <= 0)
+ tui_display_registers_from_line (_line_no, TRUE);
else
{
- int elementNo, startLineNo;
- int regsLastLine = tui_last_regs_line_no ();
+ int element_no, start_line_no;
+ int regs_last_line = tui_last_regs_line_no ();
/* display regs if we can */
- if (tui_display_registers_from_line (_lineNo, FALSE) < 0)
+ if (tui_display_registers_from_line (_line_no, FALSE) < 0)
{ /*
- ** _lineNo is past the regs display, so calc where the
+ ** _line_no is past the regs display, so calc where the
** start data element is
*/
- if (regsLastLine < _lineNo)
+ if (regs_last_line < _line_no)
{ /* figure out how many lines each element is to obtain
- the start elementNo */
+ the start element_no */
}
}
else
{ /*
** calculate the starting element of the data display, given
- ** regsLastLine and how many lines each element is, up to
- ** _lineNo
+ ** regs_last_line and how many lines each element is, up to
+ ** _line_no
*/
}
- /* Now display the data , starting at elementNo */
+ /* Now display the data , starting at element_no */
}
+}
- return;
-} /* tuiDisplayDataFromLine */
-
-/*
- ** tuiDisplayDataFrom()
- ** Display data starting at element elementNo
- */
+/* Display data starting at element element_no. */
void
-tuiDisplayDataFrom (int elementNo, int reuseWindows)
+tui_display_data_from (int element_no, int reuse_windows)
{
- int firstLine = (-1);
+ int first_line = (-1);
- if (elementNo < dataWin->detail.dataDisplayInfo.regsContentCount)
- firstLine = tui_line_from_reg_element_no (elementNo);
+ if (element_no < TUI_DATA_WIN->detail.data_display_info.regs_content_count)
+ first_line = tui_line_from_reg_element_no (element_no);
else
- { /* calculate the firstLine from the element number */
+ { /* calculate the first_line from the element number */
}
- if (firstLine >= 0)
+ if (first_line >= 0)
{
- tuiEraseDataContent ((char *) NULL);
- if (!reuseWindows)
- tuiDeleteDataContentWindows ();
- tuiDisplayDataFromLine (firstLine);
+ tui_erase_data_content ((char *) NULL);
+ if (!reuse_windows)
+ tui_delete_data_content_windows ();
+ tui_display_data_from_line (first_line);
}
-
- return;
-} /* tuiDisplayDataFrom */
+}
-/*
- ** tuiRefreshDataWin()
- ** Function to redisplay the contents of the data window.
- */
+/* Function to redisplay the contents of the data window. */
void
-tuiRefreshDataWin (void)
+tui_refresh_data_win (void)
{
- tuiEraseDataContent ((char *) NULL);
- if (dataWin->generic.contentSize > 0)
+ tui_erase_data_content ((char *) NULL);
+ if (TUI_DATA_WIN->generic.content_size > 0)
{
- int firstElement = tuiFirstDataItemDisplayed ();
+ int first_element = tui_first_data_item_displayed ();
- if (firstElement >= 0) /* re-use existing windows */
- tuiDisplayDataFrom (firstElement, TRUE);
+ if (first_element >= 0) /* re-use existing windows */
+ tui_display_data_from (first_element, TRUE);
}
+}
- return;
-} /* tuiRefreshDataWin */
-
-/*
- ** tuiCheckDataValues().
- ** Function to check the data values and hilite any that have changed
- */
+/* Function to check the data values and hilite any that have changed. */
void
-tuiCheckDataValues (struct frame_info *frame)
+tui_check_data_values (struct frame_info *frame)
{
tui_check_register_values (frame);
/* Now check any other data values that there are */
- if (m_winPtrNotNull (dataWin) && dataWin->generic.isVisible)
+ if (TUI_DATA_WIN != NULL && TUI_DATA_WIN->generic.is_visible)
{
int i;
- for (i = 0; dataWin->detail.dataDisplayInfo.dataContentCount; i++)
+ for (i = 0; TUI_DATA_WIN->detail.data_display_info.data_content_count; i++)
{
#ifdef LATER
- TuiDataElementPtr dataElementPtr;
- TuiGenWinInfoPtr dataItemWinPtr;
- Opaque newValue;
-
- dataItemPtr = &dataWin->detail.dataDisplayInfo.
- dataContent[i]->whichElement.dataWindow;
- dataElementPtr = &((TuiWinContent)
- dataItemWinPtr->content)[0]->whichElement.data;
+ tui_data_element_ptr data_element_ptr;
+ struct tui_gen_win_info * data_item_win_ptr;
+ Opaque new_value;
+
+ data_item_ptr = &TUI_DATA_WIN->detail.data_display_info.
+ data_content[i]->which_element.data_window;
+ data_element_ptr = &((tui_win_content)
+ data_item_win_ptr->content)[0]->which_element.data;
if value
- has changed (dataElementPtr, frame, &newValue)
+ has changed (data_element_ptr, frame, &new_value)
{
- dataElementPtr->value = newValue;
+ data_element_ptr->value = new_value;
update the display with the new value, hiliting it.
}
#endif
}
}
-} /* tuiCheckDataValues */
+}
-/*
- ** tuiVerticalDataScroll()
- ** Scroll the data window vertically forward or backward.
- */
+/* Scroll the data window vertically forward or backward. */
void
-tuiVerticalDataScroll (TuiScrollDirection scrollDirection, int numToScroll)
+tui_vertical_data_scroll (enum tui_scroll_direction scroll_direction, int num_to_scroll)
{
- int firstElementNo;
- int firstLine = (-1);
+ int first_element_no;
+ int first_line = (-1);
- firstElementNo = tuiFirstDataItemDisplayed ();
- if (firstElementNo < dataWin->detail.dataDisplayInfo.regsContentCount)
- firstLine = tui_line_from_reg_element_no (firstElementNo);
+ first_element_no = tui_first_data_item_displayed ();
+ if (first_element_no < TUI_DATA_WIN->detail.data_display_info.regs_content_count)
+ first_line = tui_line_from_reg_element_no (first_element_no);
else
{ /* calculate the first line from the element number which is in
** the general data content
*/
}
- if (firstLine >= 0)
+ if (first_line >= 0)
{
- int lastElementNo, lastLine;
+ int last_element_no, last_line;
- if (scrollDirection == FORWARD_SCROLL)
- firstLine += numToScroll;
+ if (scroll_direction == FORWARD_SCROLL)
+ first_line += num_to_scroll;
else
- firstLine -= numToScroll;
- tuiEraseDataContent ((char *) NULL);
- tuiDeleteDataContentWindows ();
- tuiDisplayDataFromLine (firstLine);
+ first_line -= num_to_scroll;
+ tui_erase_data_content ((char *) NULL);
+ tui_delete_data_content_windows ();
+ tui_display_data_from_line (first_line);
}
-
- return;
-} /* tuiVerticalDataScroll */
+}
/*****************************************
diff --git a/gdb/tui/tui-windata.h b/gdb/tui/tui-windata.h
index 0b1e700..10123a3 100644
--- a/gdb/tui/tui-windata.h
+++ b/gdb/tui/tui-windata.h
@@ -1,5 +1,8 @@
/* Data/register window display.
- Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+
+ Copyright 1998, 1999, 2000, 2001, 2004 Free Software Foundation,
+ Inc.
+
Contributed by Hewlett-Packard Company.
This file is part of GDB.
@@ -19,29 +22,20 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#ifndef _TUI_DATAWIN_H
-#define _TUI_DATAWIN_H
-
-
-/*****************************************
-** TYPE DEFINITIONS **
-******************************************/
-
+#ifndef TUI_WINDATA_H
+#define TUI_WINDATA_H
+#include "tui/tui-data.h"
-/*****************************************
-** PUBLIC FUNCTION EXTERNAL DECLS **
-******************************************/
-extern void tuiEraseDataContent (char *);
-extern void tuiDisplayAllData (void);
-extern void tuiCheckDataValues (struct frame_info *);
-extern void tuiDisplayDataFromLine (int);
-extern int tuiFirstDataItemDisplayed (void);
-extern int tuiFirstDataElementNoInLine (int);
-extern void tuiDeleteDataContentWindows (void);
-extern void tuiRefreshDataWin (void);
-extern void tuiDisplayDataFrom (int, int);
-extern void tuiVerticalDataScroll (TuiScrollDirection, int);
+extern void tui_erase_data_content (char *);
+extern void tui_display_all_data (void);
+extern void tui_check_data_values (struct frame_info *);
+extern void tui_display_data_from_line (int);
+extern int tui_first_data_item_displayed (void);
+extern int tui_first_data_element_no_in_line (int);
+extern void tui_delete_data_content_windows (void);
+extern void tui_refresh_data_win (void);
+extern void tui_display_data_from (int, int);
+extern void tui_vertical_data_scroll (enum tui_scroll_direction, int);
#endif
-/*_TUI_DATAWIN_H*/
diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c
index 2f32f64..3dc62d5 100644
--- a/gdb/tui/tui-wingeneral.c
+++ b/gdb/tui/tui-wingeneral.c
@@ -28,78 +28,67 @@
#include "tui/tui-wingeneral.h"
#include "tui/tui-win.h"
-#ifdef HAVE_NCURSES_H
-#include <ncurses.h>
-#else
-#ifdef HAVE_CURSES_H
-#include <curses.h>
-#endif
-#endif
+#include "gdb_curses.h"
/***********************
** PUBLIC FUNCTIONS
***********************/
-/*
- ** tuiRefreshWin()
- ** Refresh the window
- */
+
+/* Refresh the window. */
void
-tuiRefreshWin (TuiGenWinInfoPtr winInfo)
+tui_refresh_win (struct tui_gen_win_info * win_info)
{
- if (winInfo->type == DATA_WIN && winInfo->contentSize > 0)
+ if (win_info->type == DATA_WIN && win_info->content_size > 0)
{
int i;
- for (i = 0; (i < winInfo->contentSize); i++)
+ for (i = 0; (i < win_info->content_size); i++)
{
- TuiGenWinInfoPtr dataItemWinPtr;
+ struct tui_gen_win_info * data_item_win_ptr;
- dataItemWinPtr = &((TuiWinContent)
- winInfo->content)[i]->whichElement.dataWindow;
- if (m_genWinPtrNotNull (dataItemWinPtr) &&
- dataItemWinPtr->handle != (WINDOW *) NULL)
- wrefresh (dataItemWinPtr->handle);
+ data_item_win_ptr = &((tui_win_content)
+ win_info->content)[i]->which_element.data_window;
+ if (data_item_win_ptr != NULL
+ && data_item_win_ptr->handle != (WINDOW *) NULL)
+ wrefresh (data_item_win_ptr->handle);
}
}
- else if (winInfo->type == CMD_WIN)
+ else if (win_info->type == CMD_WIN)
{
/* Do nothing */
}
else
{
- if (winInfo->handle != (WINDOW *) NULL)
- wrefresh (winInfo->handle);
+ if (win_info->handle != (WINDOW *) NULL)
+ wrefresh (win_info->handle);
}
return;
-} /* tuiRefreshWin */
+}
-/*
- ** tuiDelwin()
- ** Function to delete the curses window, checking for null
- */
+/* Function to delete the curses window, checking for NULL. */
void
-tuiDelwin (WINDOW * window)
+tui_delete_win (WINDOW * window)
{
if (window != (WINDOW *) NULL)
delwin (window);
return;
-} /* tuiDelwin */
+}
/* Draw a border arround the window. */
void
-boxWin (TuiGenWinInfoPtr winInfo, int highlightFlag)
+box_win (struct tui_gen_win_info * win_info, int highlight_flag)
{
- if (winInfo && winInfo->handle)
+ if (win_info && win_info->handle)
{
WINDOW *win;
int attrs;
- win = winInfo->handle;
- if (highlightFlag == HILITE)
+ win = win_info->handle;
+ if (highlight_flag == HILITE)
attrs = tui_active_border_attrs;
else
attrs = tui_border_attrs;
@@ -109,175 +98,177 @@ boxWin (TuiGenWinInfoPtr winInfo, int highlightFlag)
tui_border_hline, tui_border_hline,
tui_border_ulcorner, tui_border_urcorner,
tui_border_llcorner, tui_border_lrcorner);
- if (winInfo->title)
- mvwaddstr (win, 0, 3, winInfo->title);
+ if (win_info->title)
+ mvwaddstr (win, 0, 3, win_info->title);
wattroff (win, attrs);
}
}
-/*
- ** unhighlightWin().
- */
void
-unhighlightWin (TuiWinInfoPtr winInfo)
+tui_unhighlight_win (struct tui_win_info * win_info)
{
- if (m_winPtrNotNull (winInfo) && winInfo->generic.handle != (WINDOW *) NULL)
+ if (win_info != NULL && win_info->generic.handle != (WINDOW *) NULL)
{
- boxWin ((TuiGenWinInfoPtr) winInfo, NO_HILITE);
- wrefresh (winInfo->generic.handle);
- m_setWinHighlightOff (winInfo);
+ box_win ((struct tui_gen_win_info *) win_info, NO_HILITE);
+ wrefresh (win_info->generic.handle);
+ tui_set_win_highlight (win_info, 0);
}
-} /* unhighlightWin */
+}
-/*
- ** highlightWin().
- */
void
-highlightWin (TuiWinInfoPtr winInfo)
+tui_highlight_win (struct tui_win_info * win_info)
{
- if (m_winPtrNotNull (winInfo) &&
- winInfo->canHighlight && winInfo->generic.handle != (WINDOW *) NULL)
+ if (win_info != NULL
+ && win_info->can_highlight
+ && win_info->generic.handle != (WINDOW *) NULL)
{
- boxWin ((TuiGenWinInfoPtr) winInfo, HILITE);
- wrefresh (winInfo->generic.handle);
- m_setWinHighlightOn (winInfo);
+ box_win ((struct tui_gen_win_info *) win_info, HILITE);
+ wrefresh (win_info->generic.handle);
+ tui_set_win_highlight (win_info, 1);
}
-} /* highlightWin */
-
+}
-/*
- ** checkAndDisplayHighlightIfNecessay
- */
void
-checkAndDisplayHighlightIfNeeded (TuiWinInfoPtr winInfo)
+tui_check_and_display_highlight_if_needed (struct tui_win_info * win_info)
{
- if (m_winPtrNotNull (winInfo) && winInfo->generic.type != CMD_WIN)
+ if (win_info != NULL && win_info->generic.type != CMD_WIN)
{
- if (winInfo->isHighlighted)
- highlightWin (winInfo);
+ if (win_info->is_highlighted)
+ tui_highlight_win (win_info);
else
- unhighlightWin (winInfo);
+ tui_unhighlight_win (win_info);
}
return;
-} /* checkAndDisplayHighlightIfNeeded */
+}
-/*
- ** makeWindow().
- */
void
-makeWindow (TuiGenWinInfoPtr winInfo, int boxIt)
+tui_make_window (struct tui_gen_win_info * win_info, int box_it)
{
WINDOW *handle;
- handle = newwin (winInfo->height,
- winInfo->width,
- winInfo->origin.y,
- winInfo->origin.x);
- winInfo->handle = handle;
+ handle = newwin (win_info->height,
+ win_info->width,
+ win_info->origin.y,
+ win_info->origin.x);
+ win_info->handle = handle;
if (handle != (WINDOW *) NULL)
{
- if (boxIt == BOX_WINDOW)
- boxWin (winInfo, NO_HILITE);
- winInfo->isVisible = TRUE;
+ if (box_it == BOX_WINDOW)
+ box_win (win_info, NO_HILITE);
+ win_info->is_visible = TRUE;
scrollok (handle, TRUE);
}
}
-/*
- ** makeVisible().
- ** We can't really make windows visible, or invisible. So we
- ** have to delete the entire window when making it visible,
- ** and create it again when making it visible.
- */
-void
-makeVisible (TuiGenWinInfoPtr winInfo, int visible)
+/* We can't really make windows visible, or invisible. So we have to
+ delete the entire window when making it visible, and create it
+ again when making it visible. */
+static void
+make_visible (struct tui_gen_win_info *win_info, int visible)
{
/* Don't tear down/recreate command window */
- if (winInfo->type == CMD_WIN)
+ if (win_info->type == CMD_WIN)
return;
if (visible)
{
- if (!winInfo->isVisible)
+ if (!win_info->is_visible)
{
- makeWindow (
- winInfo,
- (winInfo->type != CMD_WIN && !m_winIsAuxillary (winInfo->type)));
- winInfo->isVisible = TRUE;
+ tui_make_window (win_info,
+ (win_info->type != CMD_WIN
+ && !tui_win_is_auxillary (win_info->type)));
+ win_info->is_visible = TRUE;
}
}
else if (!visible &&
- winInfo->isVisible && winInfo->handle != (WINDOW *) NULL)
+ win_info->is_visible && win_info->handle != (WINDOW *) NULL)
{
- winInfo->isVisible = FALSE;
- tuiDelwin (winInfo->handle);
- winInfo->handle = (WINDOW *) NULL;
+ win_info->is_visible = FALSE;
+ tui_delete_win (win_info->handle);
+ win_info->handle = (WINDOW *) NULL;
}
return;
-} /* makeVisible */
+}
+void
+tui_make_visible (struct tui_gen_win_info *win_info)
+{
+ make_visible (win_info, 1);
+}
-/*
- ** makeAllVisible().
- ** Makes all windows invisible (except the command and locator windows)
- */
void
-makeAllVisible (int visible)
+tui_make_invisible (struct tui_gen_win_info *win_info)
+{
+ make_visible (win_info, 0);
+}
+
+
+/* Makes all windows invisible (except the command and locator windows). */
+static void
+make_all_visible (int visible)
{
int i;
for (i = 0; i < MAX_MAJOR_WINDOWS; i++)
{
- if (m_winPtrNotNull (winList[i]) &&
- ((winList[i])->generic.type) != CMD_WIN)
+ if (tui_win_list[i] != NULL
+ && ((tui_win_list[i])->generic.type) != CMD_WIN)
{
- if (m_winIsSourceType ((winList[i])->generic.type))
- makeVisible ((winList[i])->detail.sourceInfo.executionInfo,
- visible);
- makeVisible ((TuiGenWinInfoPtr) winList[i], visible);
+ if (tui_win_is_source_type ((tui_win_list[i])->generic.type))
+ make_visible ((tui_win_list[i])->detail.source_info.execution_info,
+ visible);
+ make_visible ((struct tui_gen_win_info *) tui_win_list[i], visible);
}
}
return;
-} /* makeAllVisible */
+}
+
+void
+tui_make_all_visible (void)
+{
+ make_all_visible (1);
+}
+
+void
+tui_make_all_invisible (void)
+{
+ make_all_visible (0);
+}
+
+/* Function to refresh all the windows currently displayed. */
-/*
- ** refreshAll().
- ** Function to refresh all the windows currently displayed
- */
void
-refreshAll (TuiWinInfoPtr * list)
+tui_refresh_all (struct tui_win_info * * list)
{
- TuiWinType type;
- TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
+ enum tui_win_type type;
+ struct tui_gen_win_info * locator = tui_locator_win_info_ptr ();
for (type = SRC_WIN; (type < MAX_MAJOR_WINDOWS); type++)
{
- if (list[type] && list[type]->generic.isVisible)
+ if (list[type] && list[type]->generic.is_visible)
{
if (type == SRC_WIN || type == DISASSEM_WIN)
{
- touchwin (list[type]->detail.sourceInfo.executionInfo->handle);
- tuiRefreshWin (list[type]->detail.sourceInfo.executionInfo);
+ touchwin (list[type]->detail.source_info.execution_info->handle);
+ tui_refresh_win (list[type]->detail.source_info.execution_info);
}
touchwin (list[type]->generic.handle);
- tuiRefreshWin (&list[type]->generic);
+ tui_refresh_win (&list[type]->generic);
}
}
- if (locator->isVisible)
+ if (locator->is_visible)
{
touchwin (locator->handle);
- tuiRefreshWin (locator);
+ tui_refresh_win (locator);
}
-
- return;
-} /* refreshAll */
+}
/*********************************
diff --git a/gdb/tui/tui-wingeneral.h b/gdb/tui/tui-wingeneral.h
index 42d1ce4..306d794 100644
--- a/gdb/tui/tui-wingeneral.h
+++ b/gdb/tui/tui-wingeneral.h
@@ -1,5 +1,8 @@
/* General window behavior.
- Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+
+ Copyright 1998, 1999, 2000, 2001, 2002, 2004 Free Software
+ Foundation, Inc.
+
Contributed by Hewlett-Packard Company.
This file is part of GDB.
@@ -19,31 +22,24 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#ifndef TUI_GENERAL_WIN_H
-#define TUI_GENERAL_WIN_H
-
-/*
- ** Functions
- */
-extern void unhighlightWin (TuiWinInfoPtr);
-extern void makeVisible (TuiGenWinInfoPtr, int);
-extern void makeAllVisible (int);
-extern void makeWindow (TuiGenWinInfoPtr, int);
-extern TuiWinInfoPtr copyWin (TuiWinInfoPtr);
-extern void boxWin (TuiGenWinInfoPtr, int);
-extern void highlightWin (TuiWinInfoPtr);
-extern void checkAndDisplayHighlightIfNeeded (TuiWinInfoPtr);
-extern void refreshAll (TuiWinInfoPtr *);
-extern void tuiDelwin (WINDOW * window);
-extern void tuiRefreshWin (TuiGenWinInfoPtr);
-
-/*
- ** Macros
- */
-#define m_beVisible(winInfo) makeVisible((TuiGenWinInfoPtr)(winInfo), TRUE)
-#define m_beInvisible(winInfo) \
- makeVisible((TuiGenWinInfoPtr)(winInfo), FALSE)
-#define m_allBeVisible() makeAllVisible(TRUE)
-#define m_allBeInvisible() makeAllVisible(FALSE)
-
-#endif /*TUI_GENERAL_WIN_H */
+#ifndef TUI_WINGENERAL_H
+#define TUI_WINGENERAL_H
+
+struct tui_win_info;
+struct tui_gen_win_info;
+
+extern void tui_unhighlight_win (struct tui_win_info *);
+extern void tui_make_visible (struct tui_gen_win_info *);
+extern void tui_make_invisible (struct tui_gen_win_info *);
+extern void tui_make_all_visible (void);
+extern void tui_make_all_invisible (void);
+extern void tui_make_window (struct tui_gen_win_info *, int);
+extern struct tui_win_info *tui_copy_win (struct tui_win_info *);
+extern void tui_box_win (struct tui_gen_win_info *, int);
+extern void tui_highlight_win (struct tui_win_info *);
+extern void tui_check_and_display_highlight_if_needed (struct tui_win_info *);
+extern void tui_refresh_all (struct tui_win_info **);
+extern void tui_delete_win (WINDOW * window);
+extern void tui_refresh_win (struct tui_gen_win_info *);
+
+#endif
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index 87609b4..6a2b9cf 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -39,19 +39,13 @@
#include "tui/tui-source.h"
#include "tui/tui-disasm.h"
-#ifdef HAVE_NCURSES_H
-#include <ncurses.h>
-#else
-#ifdef HAVE_CURSES_H
-#include <curses.h>
-#endif
-#endif
+#include "gdb_curses.h"
/* Function to display the "main" routine. */
void
tui_display_main (void)
{
- if ((sourceWindows ())->count > 0)
+ if ((tui_source_windows ())->count > 0)
{
CORE_ADDR addr;
@@ -60,97 +54,88 @@ tui_display_main (void)
{
struct symtab_and_line sal;
- tuiUpdateSourceWindowsWithAddr (addr);
+ tui_update_source_windows_with_addr (addr);
sal = find_pc_line (addr, 0);
if (sal.symtab)
- tuiUpdateLocatorFilename (sal.symtab->filename);
+ tui_update_locator_filename (sal.symtab->filename);
else
- tuiUpdateLocatorFilename ("??");
+ tui_update_locator_filename ("??");
}
}
}
-/*
- ** tuiUpdateSourceWindow().
- ** Function to display source in the source window. This function
- ** initializes the horizontal scroll to 0.
- */
+/* Function to display source in the source window. This function
+ initializes the horizontal scroll to 0. */
void
-tuiUpdateSourceWindow (TuiWinInfoPtr winInfo, struct symtab *s,
- TuiLineOrAddress lineOrAddr, int noerror)
+tui_update_source_window (struct tui_win_info * win_info, struct symtab *s,
+ union tui_line_or_address line_or_addr, int noerror)
{
- winInfo->detail.sourceInfo.horizontalOffset = 0;
- tuiUpdateSourceWindowAsIs (winInfo, s, lineOrAddr, noerror);
+ win_info->detail.source_info.horizontal_offset = 0;
+ tui_update_source_window_as_is (win_info, s, line_or_addr, noerror);
return;
-} /* tuiUpdateSourceWindow */
+}
-/*
- ** tuiUpdateSourceWindowAsIs().
- ** Function to display source in the source/asm window. This
- ** function shows the source as specified by the horizontal offset.
- */
+/* Function to display source in the source/asm window. This function
+ shows the source as specified by the horizontal offset. */
void
-tuiUpdateSourceWindowAsIs (TuiWinInfoPtr winInfo, struct symtab *s,
- TuiLineOrAddress lineOrAddr, int noerror)
+tui_update_source_window_as_is (struct tui_win_info * win_info, struct symtab *s,
+ union tui_line_or_address line_or_addr, int noerror)
{
- TuiStatus ret;
+ enum tui_status ret;
- if (winInfo->generic.type == SRC_WIN)
- ret = tuiSetSourceContent (s, lineOrAddr.lineNo, noerror);
+ if (win_info->generic.type == SRC_WIN)
+ ret = tui_set_source_content (s, line_or_addr.line_no, noerror);
else
- ret = tui_set_disassem_content (lineOrAddr.addr);
+ ret = tui_set_disassem_content (line_or_addr.addr);
if (ret == TUI_FAILURE)
{
- tuiClearSourceContent (winInfo, EMPTY_SOURCE_PROMPT);
- tuiClearExecInfoContent (winInfo);
+ tui_clear_source_content (win_info, EMPTY_SOURCE_PROMPT);
+ tui_clear_exec_info_content (win_info);
}
else
{
- tui_update_breakpoint_info (winInfo, 0);
- tuiShowSourceContent (winInfo);
- tuiUpdateExecInfo (winInfo);
- if (winInfo->generic.type == SRC_WIN)
+ tui_update_breakpoint_info (win_info, 0);
+ tui_show_source_content (win_info);
+ tui_update_exec_info (win_info);
+ if (win_info->generic.type == SRC_WIN)
{
struct symtab_and_line sal;
- sal.line = lineOrAddr.lineNo +
- (winInfo->generic.contentSize - 2);
+ sal.line = line_or_addr.line_no +
+ (win_info->generic.content_size - 2);
sal.symtab = s;
set_current_source_symtab_and_line (&sal);
/*
** If the focus was in the asm win, put it in the src
** win if we don't have a split layout
*/
- if (tuiWinWithFocus () == disassemWin &&
- currentLayout () != SRC_DISASSEM_COMMAND)
- tuiSetWinFocusTo (srcWin);
+ if (tui_win_with_focus () == TUI_DISASM_WIN &&
+ tui_current_layout () != SRC_DISASSEM_COMMAND)
+ tui_set_win_focus_to (TUI_SRC_WIN);
}
}
return;
-} /* tuiUpdateSourceWindowAsIs */
+}
-/*
- ** tuiUpdateSourceWindowsWithAddr().
- ** Function to ensure that the source and/or disassemly windows
- ** reflect the input address.
- */
+/* Function to ensure that the source and/or disassemly windows
+ reflect the input address. */
void
-tuiUpdateSourceWindowsWithAddr (CORE_ADDR addr)
+tui_update_source_windows_with_addr (CORE_ADDR addr)
{
if (addr != 0)
{
struct symtab_and_line sal;
- TuiLineOrAddress l;
+ union tui_line_or_address l;
- switch (currentLayout ())
+ switch (tui_current_layout ())
{
case DISASSEM_COMMAND:
case DISASSEM_DATA_COMMAND:
@@ -161,8 +146,8 @@ tuiUpdateSourceWindowsWithAddr (CORE_ADDR addr)
break;
default:
sal = find_pc_line (addr, 0);
- l.lineNo = sal.line;
- tuiShowSource (sal.symtab, l, FALSE);
+ l.line_no = sal.line;
+ tui_show_symtab_source (sal.symtab, l, FALSE);
break;
}
}
@@ -170,40 +155,35 @@ tuiUpdateSourceWindowsWithAddr (CORE_ADDR addr)
{
int i;
- for (i = 0; i < (sourceWindows ())->count; i++)
+ for (i = 0; i < (tui_source_windows ())->count; i++)
{
- TuiWinInfoPtr winInfo = (TuiWinInfoPtr) (sourceWindows ())->list[i];
+ struct tui_win_info * win_info = (struct tui_win_info *) (tui_source_windows ())->list[i];
- tuiClearSourceContent (winInfo, EMPTY_SOURCE_PROMPT);
- tuiClearExecInfoContent (winInfo);
+ tui_clear_source_content (win_info, EMPTY_SOURCE_PROMPT);
+ tui_clear_exec_info_content (win_info);
}
}
+}
- return;
-} /* tuiUpdateSourceWindowsWithAddr */
-
-/*
- ** tuiUpdateSourceWindowsWithLine().
- ** Function to ensure that the source and/or disassemly windows
- ** reflect the input address.
- */
+/* Function to ensure that the source and/or disassemly windows
+ reflect the input address. */
void
-tuiUpdateSourceWindowsWithLine (struct symtab *s, int line)
+tui_update_source_windows_with_line (struct symtab *s, int line)
{
CORE_ADDR pc;
- TuiLineOrAddress l;
+ union tui_line_or_address l;
- switch (currentLayout ())
+ switch (tui_current_layout ())
{
case DISASSEM_COMMAND:
case DISASSEM_DATA_COMMAND:
find_line_pc (s, line, &pc);
- tuiUpdateSourceWindowsWithAddr (pc);
+ tui_update_source_windows_with_addr (pc);
break;
default:
- l.lineNo = line;
- tuiShowSource (s, l, FALSE);
- if (currentLayout () == SRC_DISASSEM_COMMAND)
+ l.line_no = line;
+ tui_show_symtab_source (s, l, FALSE);
+ if (tui_current_layout () == SRC_DISASSEM_COMMAND)
{
find_line_pc (s, line, &pc);
tui_show_disassem (pc);
@@ -212,133 +192,118 @@ tuiUpdateSourceWindowsWithLine (struct symtab *s, int line)
}
return;
-} /* tuiUpdateSourceWindowsWithLine */
+}
-/*
- ** tuiClearSourceContent().
- */
void
-tuiClearSourceContent (TuiWinInfoPtr winInfo, int displayPrompt)
+tui_clear_source_content (struct tui_win_info * win_info, int display_prompt)
{
- if (m_winPtrNotNull (winInfo))
+ if (win_info != NULL)
{
- register int i;
+ int i;
- winInfo->generic.contentInUse = FALSE;
- tuiEraseSourceContent (winInfo, displayPrompt);
- for (i = 0; i < winInfo->generic.contentSize; i++)
+ win_info->generic.content_in_use = FALSE;
+ tui_erase_source_content (win_info, display_prompt);
+ for (i = 0; i < win_info->generic.content_size; i++)
{
- TuiWinElementPtr element =
- (TuiWinElementPtr) winInfo->generic.content[i];
- element->whichElement.source.hasBreak = FALSE;
- element->whichElement.source.isExecPoint = FALSE;
+ struct tui_win_element * element =
+ (struct tui_win_element *) win_info->generic.content[i];
+ element->which_element.source.has_break = FALSE;
+ element->which_element.source.is_exec_point = FALSE;
}
}
-
- return;
-} /* tuiClearSourceContent */
+}
-/*
- ** tuiEraseSourceContent().
- */
void
-tuiEraseSourceContent (TuiWinInfoPtr winInfo, int displayPrompt)
+tui_erase_source_content (struct tui_win_info * win_info, int display_prompt)
{
- int xPos;
- int halfWidth = (winInfo->generic.width - 2) / 2;
+ int x_pos;
+ int half_width = (win_info->generic.width - 2) / 2;
- if (winInfo->generic.handle != (WINDOW *) NULL)
+ if (win_info->generic.handle != (WINDOW *) NULL)
{
- werase (winInfo->generic.handle);
- checkAndDisplayHighlightIfNeeded (winInfo);
- if (displayPrompt == EMPTY_SOURCE_PROMPT)
+ werase (win_info->generic.handle);
+ tui_check_and_display_highlight_if_needed (win_info);
+ if (display_prompt == EMPTY_SOURCE_PROMPT)
{
- char *noSrcStr;
+ char *no_src_str;
- if (winInfo->generic.type == SRC_WIN)
- noSrcStr = NO_SRC_STRING;
+ if (win_info->generic.type == SRC_WIN)
+ no_src_str = NO_SRC_STRING;
else
- noSrcStr = NO_DISASSEM_STRING;
- if (strlen (noSrcStr) >= halfWidth)
- xPos = 1;
+ no_src_str = NO_DISASSEM_STRING;
+ if (strlen (no_src_str) >= half_width)
+ x_pos = 1;
else
- xPos = halfWidth - strlen (noSrcStr);
- mvwaddstr (winInfo->generic.handle,
- (winInfo->generic.height / 2),
- xPos,
- noSrcStr);
+ x_pos = half_width - strlen (no_src_str);
+ mvwaddstr (win_info->generic.handle,
+ (win_info->generic.height / 2),
+ x_pos,
+ no_src_str);
/* elz: added this function call to set the real contents of
the window to what is on the screen, so that later calls
to refresh, do display
the correct stuff, and not the old image */
- tuiSetSourceContentNil (winInfo, noSrcStr);
+ tui_set_source_content_nil (win_info, no_src_str);
}
- tuiRefreshWin (&winInfo->generic);
+ tui_refresh_win (&win_info->generic);
}
- return;
-} /* tuiEraseSourceContent */
+}
/* Redraw the complete line of a source or disassembly window. */
static void
-tui_show_source_line (TuiWinInfoPtr winInfo, int lineno)
+tui_show_source_line (struct tui_win_info * win_info, int lineno)
{
- TuiWinElementPtr line;
+ struct tui_win_element * line;
int x, y;
- line = (TuiWinElementPtr) winInfo->generic.content[lineno - 1];
- if (line->whichElement.source.isExecPoint)
- wattron (winInfo->generic.handle, A_STANDOUT);
+ line = (struct tui_win_element *) win_info->generic.content[lineno - 1];
+ if (line->which_element.source.is_exec_point)
+ wattron (win_info->generic.handle, A_STANDOUT);
- mvwaddstr (winInfo->generic.handle, lineno, 1,
- line->whichElement.source.line);
- if (line->whichElement.source.isExecPoint)
- wattroff (winInfo->generic.handle, A_STANDOUT);
+ mvwaddstr (win_info->generic.handle, lineno, 1,
+ line->which_element.source.line);
+ if (line->which_element.source.is_exec_point)
+ wattroff (win_info->generic.handle, A_STANDOUT);
/* Clear to end of line but stop before the border. */
- getyx (winInfo->generic.handle, y, x);
- while (x + 1 < winInfo->generic.width)
+ getyx (win_info->generic.handle, y, x);
+ while (x + 1 < win_info->generic.width)
{
- waddch (winInfo->generic.handle, ' ');
- getyx (winInfo->generic.handle, y, x);
+ waddch (win_info->generic.handle, ' ');
+ getyx (win_info->generic.handle, y, x);
}
}
-/*
- ** tuiShowSourceContent().
- */
void
-tuiShowSourceContent (TuiWinInfoPtr winInfo)
+tui_show_source_content (struct tui_win_info * win_info)
{
- if (winInfo->generic.contentSize > 0)
+ if (win_info->generic.content_size > 0)
{
int lineno;
- for (lineno = 1; lineno <= winInfo->generic.contentSize; lineno++)
- tui_show_source_line (winInfo, lineno);
+ for (lineno = 1; lineno <= win_info->generic.content_size; lineno++)
+ tui_show_source_line (win_info, lineno);
}
else
- tuiEraseSourceContent (winInfo, TRUE);
+ tui_erase_source_content (win_info, TRUE);
- checkAndDisplayHighlightIfNeeded (winInfo);
- tuiRefreshWin (&winInfo->generic);
- winInfo->generic.contentInUse = TRUE;
+ tui_check_and_display_highlight_if_needed (win_info);
+ tui_refresh_win (&win_info->generic);
+ win_info->generic.content_in_use = TRUE;
}
-/*
- ** tuiHorizontalSourceScroll().
- ** Scroll the source forward or backward horizontally
- */
+/* Scroll the source forward or backward horizontally. */
void
-tuiHorizontalSourceScroll (TuiWinInfoPtr winInfo,
- TuiScrollDirection direction,
- int numToScroll)
+tui_horizontal_source_scroll (struct tui_win_info * win_info,
+ enum tui_scroll_direction direction,
+ int num_to_scroll)
{
- if (winInfo->generic.content != (OpaquePtr) NULL)
+ if (win_info->generic.content != NULL)
{
int offset;
struct symtab *s;
@@ -350,96 +315,94 @@ tuiHorizontalSourceScroll (TuiWinInfoPtr winInfo,
s = cursal.symtab;
if (direction == LEFT_SCROLL)
- offset = winInfo->detail.sourceInfo.horizontalOffset + numToScroll;
+ offset = win_info->detail.source_info.horizontal_offset + num_to_scroll;
else
{
if ((offset =
- winInfo->detail.sourceInfo.horizontalOffset - numToScroll) < 0)
+ win_info->detail.source_info.horizontal_offset - num_to_scroll) < 0)
offset = 0;
}
- winInfo->detail.sourceInfo.horizontalOffset = offset;
- tuiUpdateSourceWindowAsIs (
- winInfo,
- s,
- ((TuiWinElementPtr)
- winInfo->generic.content[0])->whichElement.source.lineOrAddr,
- FALSE);
+ win_info->detail.source_info.horizontal_offset = offset;
+ tui_update_source_window_as_is (win_info, s,
+ ((struct tui_win_element *)
+ win_info->generic.content[0])->which_element.source.line_or_addr,
+ FALSE);
}
return;
-} /* tuiHorizontalSourceScroll */
+}
-/* Set or clear the hasBreak flag in the line whose line is lineNo. */
+/* Set or clear the has_break flag in the line whose line is line_no. */
void
-tuiSetIsExecPointAt (TuiLineOrAddress l, TuiWinInfoPtr winInfo)
+tui_set_is_exec_point_at (union tui_line_or_address l, struct tui_win_info * win_info)
{
int changed = 0;
int i;
- TuiWinContent content = (TuiWinContent) winInfo->generic.content;
+ tui_win_content content = (tui_win_content) win_info->generic.content;
i = 0;
- while (i < winInfo->generic.contentSize)
+ while (i < win_info->generic.content_size)
{
- int newState;
+ int new_state;
- if (content[i]->whichElement.source.lineOrAddr.addr == l.addr)
- newState = TRUE;
+ if (content[i]->which_element.source.line_or_addr.addr == l.addr)
+ new_state = TRUE;
else
- newState = FALSE;
- if (newState != content[i]->whichElement.source.isExecPoint)
+ new_state = FALSE;
+ if (new_state != content[i]->which_element.source.is_exec_point)
{
changed++;
- content[i]->whichElement.source.isExecPoint = newState;
- tui_show_source_line (winInfo, i + 1);
+ content[i]->which_element.source.is_exec_point = new_state;
+ tui_show_source_line (win_info, i + 1);
}
i++;
}
if (changed)
- tuiRefreshWin (&winInfo->generic);
+ tui_refresh_win (&win_info->generic);
}
/* Update the execution windows to show the active breakpoints.
This is called whenever a breakpoint is inserted, removed or
has its state changed. */
void
-tui_update_all_breakpoint_info ()
+tui_update_all_breakpoint_info (void)
{
- TuiList* list = sourceWindows ();
+ struct tui_list *list = tui_source_windows ();
int i;
for (i = 0; i < list->count; i++)
{
- TuiWinInfoPtr win = (TuiWinInfoPtr) list->list[i];
+ struct tui_win_info * win = (struct tui_win_info *) list->list[i];
if (tui_update_breakpoint_info (win, FALSE))
{
- tuiUpdateExecInfo (win);
+ tui_update_exec_info (win);
}
}
}
/* Scan the source window and the breakpoints to update the
- hasBreak information for each line.
+ has_break information for each line.
Returns 1 if something changed and the execution window
must be refreshed. */
int
-tui_update_breakpoint_info (TuiWinInfoPtr win, int current_only)
+tui_update_breakpoint_info (struct tui_win_info * win, int current_only)
{
int i;
int need_refresh = 0;
- TuiSourceInfoPtr src = &win->detail.sourceInfo;
+ struct tui_source_info * src = &win->detail.source_info;
- for (i = 0; i < win->generic.contentSize; i++)
+ for (i = 0; i < win->generic.content_size; i++)
{
struct breakpoint *bp;
extern struct breakpoint *breakpoint_chain;
int mode;
- TuiSourceElement* line;
+ struct tui_source_element* line;
- line = &((TuiWinElementPtr) win->generic.content[i])->whichElement.source;
- if (current_only && !line->isExecPoint)
+ line = &((struct tui_win_element *) win->generic.content[i])->which_element.source;
+ if (current_only && !line->is_exec_point)
continue;
/* Scan each breakpoint to see if the current line has something to
@@ -450,12 +413,12 @@ tui_update_breakpoint_info (TuiWinInfoPtr win, int current_only)
bp != (struct breakpoint *) NULL;
bp = bp->next)
{
- if ((win == srcWin
+ if ((win == TUI_SRC_WIN
&& bp->source_file
&& (strcmp (src->filename, bp->source_file) == 0)
- && bp->line_number == line->lineOrAddr.lineNo)
- || (win == disassemWin
- && bp->loc->address == line->lineOrAddr.addr))
+ && bp->line_number == line->line_or_addr.line_no)
+ || (win == TUI_DISASM_WIN
+ && bp->loc->address == line->line_or_addr.addr))
{
if (bp->enable_state == bp_disabled)
mode |= TUI_BP_DISABLED;
@@ -469,9 +432,9 @@ tui_update_breakpoint_info (TuiWinInfoPtr win, int current_only)
mode |= TUI_BP_HARDWARE;
}
}
- if (line->hasBreak != mode)
+ if (line->has_break != mode)
{
- line->hasBreak = mode;
+ line->has_break = mode;
need_refresh = 1;
}
}
@@ -479,62 +442,59 @@ tui_update_breakpoint_info (TuiWinInfoPtr win, int current_only)
}
-/*
- ** tuiSetExecInfoContent().
- ** Function to initialize the content of the execution info window,
- ** based upon the input window which is either the source or
- ** disassembly window.
- */
-TuiStatus
-tuiSetExecInfoContent (TuiWinInfoPtr winInfo)
+/* Function to initialize the content of the execution info window,
+ based upon the input window which is either the source or
+ disassembly window. */
+enum tui_status
+tui_set_exec_info_content (struct tui_win_info * win_info)
{
- TuiStatus ret = TUI_SUCCESS;
+ enum tui_status ret = TUI_SUCCESS;
- if (winInfo->detail.sourceInfo.executionInfo != (TuiGenWinInfoPtr) NULL)
+ if (win_info->detail.source_info.execution_info != (struct tui_gen_win_info *) NULL)
{
- TuiGenWinInfoPtr execInfoPtr = winInfo->detail.sourceInfo.executionInfo;
+ struct tui_gen_win_info * exec_info_ptr = win_info->detail.source_info.execution_info;
- if (execInfoPtr->content == (OpaquePtr) NULL)
- execInfoPtr->content =
- (OpaquePtr) allocContent (winInfo->generic.height,
- execInfoPtr->type);
- if (execInfoPtr->content != (OpaquePtr) NULL)
+ if (exec_info_ptr->content == NULL)
+ exec_info_ptr->content =
+ (void **) tui_alloc_content (win_info->generic.height,
+ exec_info_ptr->type);
+ if (exec_info_ptr->content != NULL)
{
int i;
- tui_update_breakpoint_info (winInfo, 1);
- for (i = 0; i < winInfo->generic.contentSize; i++)
+ tui_update_breakpoint_info (win_info, 1);
+ for (i = 0; i < win_info->generic.content_size; i++)
{
- TuiWinElementPtr element;
- TuiWinElementPtr srcElement;
+ struct tui_win_element * element;
+ struct tui_win_element * src_element;
int mode;
- element = (TuiWinElementPtr) execInfoPtr->content[i];
- srcElement = (TuiWinElementPtr) winInfo->generic.content[i];
+ element = (struct tui_win_element *) exec_info_ptr->content[i];
+ src_element = (struct tui_win_element *) win_info->generic.content[i];
- memset(element->whichElement.simpleString, ' ',
- sizeof(element->whichElement.simpleString));
- element->whichElement.simpleString[TUI_EXECINFO_SIZE - 1] = 0;
+ memset(element->which_element.simple_string, ' ',
+ sizeof(element->which_element.simple_string));
+ element->which_element.simple_string[TUI_EXECINFO_SIZE - 1] = 0;
/* Now update the exec info content based upon the state
of each line as indicated by the source content. */
- mode = srcElement->whichElement.source.hasBreak;
+ mode = src_element->which_element.source.has_break;
if (mode & TUI_BP_HIT)
- element->whichElement.simpleString[TUI_BP_HIT_POS] =
+ element->which_element.simple_string[TUI_BP_HIT_POS] =
(mode & TUI_BP_HARDWARE) ? 'H' : 'B';
else if (mode & (TUI_BP_ENABLED | TUI_BP_DISABLED))
- element->whichElement.simpleString[TUI_BP_HIT_POS] =
+ element->which_element.simple_string[TUI_BP_HIT_POS] =
(mode & TUI_BP_HARDWARE) ? 'h' : 'b';
if (mode & TUI_BP_ENABLED)
- element->whichElement.simpleString[TUI_BP_BREAK_POS] = '+';
+ element->which_element.simple_string[TUI_BP_BREAK_POS] = '+';
else if (mode & TUI_BP_DISABLED)
- element->whichElement.simpleString[TUI_BP_BREAK_POS] = '-';
+ element->which_element.simple_string[TUI_BP_BREAK_POS] = '-';
- if (srcElement->whichElement.source.isExecPoint)
- element->whichElement.simpleString[TUI_EXEC_POS] = '>';
+ if (src_element->which_element.source.is_exec_point)
+ element->which_element.simple_string[TUI_EXEC_POS] = '>';
}
- execInfoPtr->contentSize = winInfo->generic.contentSize;
+ exec_info_ptr->content_size = win_info->generic.content_size;
}
else
ret = TUI_FAILURE;
@@ -544,169 +504,147 @@ tuiSetExecInfoContent (TuiWinInfoPtr winInfo)
}
-/*
- ** tuiShowExecInfoContent().
- */
void
-tuiShowExecInfoContent (TuiWinInfoPtr winInfo)
+tui_show_exec_info_content (struct tui_win_info * win_info)
{
- TuiGenWinInfoPtr execInfo = winInfo->detail.sourceInfo.executionInfo;
- int curLine;
-
- werase (execInfo->handle);
- tuiRefreshWin (execInfo);
- for (curLine = 1; (curLine <= execInfo->contentSize); curLine++)
- mvwaddstr (execInfo->handle,
- curLine,
+ struct tui_gen_win_info * exec_info = win_info->detail.source_info.execution_info;
+ int cur_line;
+
+ werase (exec_info->handle);
+ tui_refresh_win (exec_info);
+ for (cur_line = 1; (cur_line <= exec_info->content_size); cur_line++)
+ mvwaddstr (exec_info->handle,
+ cur_line,
0,
- ((TuiWinElementPtr)
- execInfo->content[curLine - 1])->whichElement.simpleString);
- tuiRefreshWin (execInfo);
- execInfo->contentInUse = TRUE;
-
- return;
-} /* tuiShowExecInfoContent */
+ ((struct tui_win_element *)
+ exec_info->content[cur_line - 1])->which_element.simple_string);
+ tui_refresh_win (exec_info);
+ exec_info->content_in_use = TRUE;
+}
-/*
- ** tuiEraseExecInfoContent().
- */
void
-tuiEraseExecInfoContent (TuiWinInfoPtr winInfo)
+tui_erase_exec_info_content (struct tui_win_info * win_info)
{
- TuiGenWinInfoPtr execInfo = winInfo->detail.sourceInfo.executionInfo;
-
- werase (execInfo->handle);
- tuiRefreshWin (execInfo);
+ struct tui_gen_win_info * exec_info = win_info->detail.source_info.execution_info;
- return;
-} /* tuiEraseExecInfoContent */
+ werase (exec_info->handle);
+ tui_refresh_win (exec_info);
+}
-/*
- ** tuiClearExecInfoContent().
- */
void
-tuiClearExecInfoContent (TuiWinInfoPtr winInfo)
+tui_clear_exec_info_content (struct tui_win_info * win_info)
{
- winInfo->detail.sourceInfo.executionInfo->contentInUse = FALSE;
- tuiEraseExecInfoContent (winInfo);
+ win_info->detail.source_info.execution_info->content_in_use = FALSE;
+ tui_erase_exec_info_content (win_info);
return;
-} /* tuiClearExecInfoContent */
+}
-/*
- ** tuiUpdateExecInfo().
- ** Function to update the execution info window
- */
+/* Function to update the execution info window. */
void
-tuiUpdateExecInfo (TuiWinInfoPtr winInfo)
+tui_update_exec_info (struct tui_win_info * win_info)
{
- tuiSetExecInfoContent (winInfo);
- tuiShowExecInfoContent (winInfo);
-} /* tuiUpdateExecInfo */
+ tui_set_exec_info_content (win_info);
+ tui_show_exec_info_content (win_info);
+}
-TuiStatus
-tuiAllocSourceBuffer (TuiWinInfoPtr winInfo)
+enum tui_status
+tui_alloc_source_buffer (struct tui_win_info *win_info)
{
- register char *srcLineBuf;
- register int i, lineWidth, maxLines;
- TuiStatus ret = TUI_FAILURE;
+ char *src_line_buf;
+ int i, line_width, max_lines;
+ enum tui_status ret = TUI_FAILURE;
- maxLines = winInfo->generic.height; /* less the highlight box */
- lineWidth = winInfo->generic.width - 1;
+ max_lines = win_info->generic.height; /* less the highlight box */
+ line_width = win_info->generic.width - 1;
/*
** Allocate the buffer for the source lines. Do this only once since they
** will be re-used for all source displays. The only other time this will
** be done is when a window's size changes.
*/
- if (winInfo->generic.content == (OpaquePtr) NULL)
+ if (win_info->generic.content == NULL)
{
- srcLineBuf = (char *) xmalloc ((maxLines * lineWidth) * sizeof (char));
- if (srcLineBuf == (char *) NULL)
+ src_line_buf = (char *) xmalloc ((max_lines * line_width) * sizeof (char));
+ if (src_line_buf == (char *) NULL)
fputs_unfiltered (
"Unable to Allocate Memory for Source or Disassembly Display.\n",
gdb_stderr);
else
{
/* allocate the content list */
- if ((winInfo->generic.content =
- (OpaquePtr) allocContent (maxLines, SRC_WIN)) == (OpaquePtr) NULL)
+ if ((win_info->generic.content =
+ (void **) tui_alloc_content (max_lines, SRC_WIN)) == NULL)
{
- tuiFree (srcLineBuf);
- srcLineBuf = (char *) NULL;
+ xfree (src_line_buf);
+ src_line_buf = (char *) NULL;
fputs_unfiltered (
"Unable to Allocate Memory for Source or Disassembly Display.\n",
gdb_stderr);
}
}
- for (i = 0; i < maxLines; i++)
- ((TuiWinElementPtr)
- winInfo->generic.content[i])->whichElement.source.line =
- srcLineBuf + (lineWidth * i);
+ for (i = 0; i < max_lines; i++)
+ ((struct tui_win_element *)
+ win_info->generic.content[i])->which_element.source.line =
+ src_line_buf + (line_width * i);
ret = TUI_SUCCESS;
}
else
ret = TUI_SUCCESS;
return ret;
-} /* tuiAllocSourceBuffer */
+}
-/*
- ** tuiLineIsDisplayed().
- ** Answer whether the a particular line number or address is displayed
- ** in the current source window.
- */
+/* Answer whether the a particular line number or address is displayed
+ in the current source window. */
int
-tuiLineIsDisplayed (int line, TuiWinInfoPtr winInfo,
- int checkThreshold)
+tui_line_is_displayed (int line, struct tui_win_info * win_info,
+ int check_threshold)
{
- int isDisplayed = FALSE;
+ int is_displayed = FALSE;
int i, threshold;
- if (checkThreshold)
+ if (check_threshold)
threshold = SCROLL_THRESHOLD;
else
threshold = 0;
i = 0;
- while (i < winInfo->generic.contentSize - threshold && !isDisplayed)
+ while (i < win_info->generic.content_size - threshold && !is_displayed)
{
- isDisplayed = (((TuiWinElementPtr)
- winInfo->generic.content[i])->whichElement.source.lineOrAddr.lineNo
+ is_displayed = (((struct tui_win_element *)
+ win_info->generic.content[i])->which_element.source.line_or_addr.line_no
== (int) line);
i++;
}
- return isDisplayed;
-} /* tuiLineIsDisplayed */
+ return is_displayed;
+}
-/*
- ** tuiLineIsDisplayed().
- ** Answer whether the a particular line number or address is displayed
- ** in the current source window.
- */
+/* Answer whether the a particular line number or address is displayed
+ in the current source window. */
int
-tuiAddrIsDisplayed (CORE_ADDR addr, TuiWinInfoPtr winInfo,
- int checkThreshold)
+tui_addr_is_displayed (CORE_ADDR addr, struct tui_win_info * win_info,
+ int check_threshold)
{
- int isDisplayed = FALSE;
+ int is_displayed = FALSE;
int i, threshold;
- if (checkThreshold)
+ if (check_threshold)
threshold = SCROLL_THRESHOLD;
else
threshold = 0;
i = 0;
- while (i < winInfo->generic.contentSize - threshold && !isDisplayed)
+ while (i < win_info->generic.content_size - threshold && !is_displayed)
{
- isDisplayed = (((TuiWinElementPtr)
- winInfo->generic.content[i])->whichElement.source.lineOrAddr.addr
+ is_displayed = (((struct tui_win_element *)
+ win_info->generic.content[i])->which_element.source.line_or_addr.addr
== addr);
i++;
}
- return isDisplayed;
+ return is_displayed;
}
diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h
index cb00449..e64589b 100644
--- a/gdb/tui/tui-winsource.h
+++ b/gdb/tui/tui-winsource.h
@@ -1,5 +1,8 @@
/* TUI display source/assembly window.
- Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+
+ Copyright 1998, 1999, 2000, 2001, 2002, 2004 Free Software
+ Foundation, Inc.
+
Contributed by Hewlett-Packard Company.
This file is part of GDB.
@@ -19,50 +22,52 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#ifndef _TUI_SOURCEWIN_H
-#define _TUI_SOURCEWIN_H
+#ifndef TUI_SOURCEWIN_H
+#define TUI_SOURCEWIN_H
+
+#include "tui/tui-data.h"
+
+struct tui_win_info;
-/* Update the execution windows to show the active breakpoints.
- This is called whenever a breakpoint is inserted, removed or
- has its state changed. */
+/* Update the execution windows to show the active breakpoints. This
+ is called whenever a breakpoint is inserted, removed or has its
+ state changed. */
extern void tui_update_all_breakpoint_info (void);
-/* Scan the source window and the breakpoints to update the
- hasBreak information for each line.
- Returns 1 if something changed and the execution window
- must be refreshed. */
-extern int tui_update_breakpoint_info (TuiWinInfoPtr win, int current_only);
+/* Scan the source window and the breakpoints to update the hasBreak
+ information for each line. Returns 1 if something changed and the
+ execution window must be refreshed. */
+extern int tui_update_breakpoint_info (struct tui_win_info * win,
+ int current_only);
/* Function to display the "main" routine. */
extern void tui_display_main (void);
-extern void tuiUpdateSourceWindow (TuiWinInfoPtr, struct symtab *, TuiLineOrAddress,
- int);
-extern void tuiUpdateSourceWindowAsIs (TuiWinInfoPtr, struct symtab *, TuiLineOrAddress,
- int);
-extern void tuiUpdateSourceWindowsWithAddr (CORE_ADDR);
-extern void tuiUpdateSourceWindowsWithLine (struct symtab *, int);
-extern void tuiClearSourceContent (TuiWinInfoPtr, int);
-extern void tuiEraseSourceContent (TuiWinInfoPtr, int);
-extern void tuiSetSourceContentNil (TuiWinInfoPtr, char *);
-extern void tuiShowSourceContent (TuiWinInfoPtr);
-extern void tuiHorizontalSourceScroll (TuiWinInfoPtr, TuiScrollDirection,
- int);
-extern TuiStatus tuiSetExecInfoContent (TuiWinInfoPtr);
-extern void tuiShowExecInfoContent (TuiWinInfoPtr);
-extern void tuiEraseExecInfoContent (TuiWinInfoPtr);
-extern void tuiClearExecInfoContent (TuiWinInfoPtr);
-extern void tuiUpdateExecInfo (TuiWinInfoPtr);
-
-extern void tuiSetIsExecPointAt (TuiLineOrAddress, TuiWinInfoPtr);
-extern TuiStatus tuiAllocSourceBuffer (TuiWinInfoPtr);
-extern int tuiLineIsDisplayed (int, TuiWinInfoPtr, int);
-extern int tuiAddrIsDisplayed (CORE_ADDR, TuiWinInfoPtr, int);
-
-
-/*
- ** Constant definitions
- */
+extern void tui_update_source_window (struct tui_win_info *, struct symtab *,
+ union tui_line_or_address, int);
+extern void tui_update_source_window_as_is (struct tui_win_info *,
+ struct symtab *,
+ union tui_line_or_address, int);
+extern void tui_update_source_windows_with_addr (CORE_ADDR);
+extern void tui_update_source_windows_with_line (struct symtab *, int);
+extern void tui_clear_source_content (struct tui_win_info *, int);
+extern void tui_erase_source_content (struct tui_win_info *, int);
+extern void tui_show_source_content (struct tui_win_info *);
+extern void tui_horizontal_source_scroll (struct tui_win_info *,
+ enum tui_scroll_direction, int);
+extern enum tui_status tui_set_exec_info_content (struct tui_win_info *);
+extern void tui_show_exec_info_content (struct tui_win_info *);
+extern void tui_erase_exec_info_content (struct tui_win_info *);
+extern void tui_clear_exec_info_content (struct tui_win_info *);
+extern void tui_update_exec_info (struct tui_win_info *);
+
+extern void tui_set_is_exec_point_at (union tui_line_or_address,
+ struct tui_win_info *);
+extern enum tui_status tui_alloc_source_buffer (struct tui_win_info *);
+extern int tui_line_is_displayed (int, struct tui_win_info *, int);
+extern int tui_addr_is_displayed (CORE_ADDR, struct tui_win_info *, int);
+
+
+/* Constant definitions. */
#define SCROLL_THRESHOLD 2 /* threshold for lazy scroll */
#endif
-/*_TUI_SOURCEWIN_H */
diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c
index 5b9cff0..2da728f 100644
--- a/gdb/tui/tui.c
+++ b/gdb/tui/tui.c
@@ -1,7 +1,7 @@
/* General functions for the WDB TUI.
- Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation,
- Inc.
+ Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
+ Foundation, Inc.
Contributed by Hewlett-Packard Company.
@@ -38,6 +38,7 @@
#include "defs.h"
#include "gdbcmd.h"
#include "tui/tui.h"
+#include "tui/tui-hooks.h"
#include "tui/tui-data.h"
#include "tui/tui-layout.h"
#include "tui/tui-io.h"
@@ -54,19 +55,13 @@
#include "symtab.h"
#include "source.h"
-#ifdef HAVE_NCURSES_H
-#include <ncurses.h>
-#else
-#ifdef HAVE_CURSES_H
-#include <curses.h>
-#endif
-#endif
+#include "gdb_curses.h"
/* Tells whether the TUI is active or not. */
int tui_active = 0;
static int tui_finish_init = 1;
-enum tui_key_mode tui_current_key_mode = tui_command_mode;
+enum tui_key_mode tui_current_key_mode = TUI_COMMAND_MODE;
struct tui_char_command
{
@@ -137,10 +132,10 @@ tui_rl_change_windows (int notused1, int notused2)
if (tui_active)
{
- TuiLayoutType new_layout;
- TuiRegisterDisplayType regs_type = TUI_UNDEFINED_REGS;
+ enum tui_layout_type new_layout;
+ enum tui_register_display_type regs_type = TUI_UNDEFINED_REGS;
- new_layout = currentLayout ();
+ new_layout = tui_current_layout ();
/* Select a new layout to have a rolling layout behavior
with always two windows (except when undefined). */
@@ -170,7 +165,7 @@ tui_rl_change_windows (int notused1, int notused2)
new_layout = SRC_COMMAND;
break;
}
- tuiSetLayout (new_layout, regs_type);
+ tui_set_layout (new_layout, regs_type);
}
return 0;
}
@@ -185,10 +180,10 @@ tui_rl_delete_other_windows (int notused1, int notused2)
if (tui_active)
{
- TuiLayoutType new_layout;
- TuiRegisterDisplayType regs_type = TUI_UNDEFINED_REGS;
+ enum tui_layout_type new_layout;
+ enum tui_register_display_type regs_type = TUI_UNDEFINED_REGS;
- new_layout = currentLayout ();
+ new_layout = tui_current_layout ();
/* Kill one window. */
switch (new_layout)
@@ -205,7 +200,7 @@ tui_rl_delete_other_windows (int notused1, int notused2)
new_layout = DISASSEM_COMMAND;
break;
}
- tuiSetLayout (new_layout, regs_type);
+ tui_set_layout (new_layout, regs_type);
}
return 0;
}
@@ -215,18 +210,18 @@ tui_rl_delete_other_windows (int notused1, int notused2)
static int
tui_rl_other_window (int count, int key)
{
- TuiWinInfoPtr winInfo;
+ struct tui_win_info * win_info;
if (!tui_active)
tui_rl_switch_mode (0/*notused*/, 0/*notused*/);
- winInfo = tuiNextWin (tuiWinWithFocus ());
- if (winInfo)
+ win_info = tui_next_win (tui_win_with_focus ());
+ if (win_info)
{
- tuiSetWinFocusTo (winInfo);
- if (dataWin && dataWin->generic.isVisible)
- tuiRefreshDataWin ();
- keypad (cmdWin->generic.handle, (winInfo != cmdWin));
+ tui_set_win_focus_to (win_info);
+ if (TUI_DATA_WIN && TUI_DATA_WIN->generic.is_visible)
+ tui_refresh_data_win ();
+ keypad (TUI_CMD_WIN->generic.handle, (win_info != TUI_CMD_WIN));
}
return 0;
}
@@ -261,7 +256,7 @@ tui_rl_command_key (int count, int key)
static int
tui_rl_command_mode (int count, int key)
{
- tui_set_key_mode (tui_one_command_mode);
+ tui_set_key_mode (TUI_ONE_COMMAND_MODE);
return rl_insert (count, key);
}
@@ -273,8 +268,8 @@ tui_rl_next_keymap (int notused1, int notused2)
if (!tui_active)
tui_rl_switch_mode (0/*notused*/, 0/*notused*/);
- tui_set_key_mode (tui_current_key_mode == tui_command_mode
- ? tui_single_key_mode : tui_command_mode);
+ tui_set_key_mode (tui_current_key_mode == TUI_COMMAND_MODE
+ ? TUI_SINGLE_KEY_MODE : TUI_COMMAND_MODE);
return 0;
}
@@ -283,11 +278,11 @@ tui_rl_next_keymap (int notused1, int notused2)
the command window is cleaner. It will be displayed if
we temporarily leave the SingleKey mode. */
static int
-tui_rl_startup_hook ()
+tui_rl_startup_hook (void)
{
rl_already_prompted = 1;
- if (tui_current_key_mode != tui_command_mode)
- tui_set_key_mode (tui_single_key_mode);
+ if (tui_current_key_mode != TUI_COMMAND_MODE)
+ tui_set_key_mode (TUI_SINGLE_KEY_MODE);
tui_redisplay_readline ();
return 0;
}
@@ -297,15 +292,15 @@ void
tui_set_key_mode (enum tui_key_mode mode)
{
tui_current_key_mode = mode;
- rl_set_keymap (mode == tui_single_key_mode
+ rl_set_keymap (mode == TUI_SINGLE_KEY_MODE
? tui_keymap : tui_readline_standard_keymap);
- tuiShowLocatorContent ();
+ tui_show_locator_content ();
}
/* Initialize readline and configure the keymap for the switching
key shortcut. */
void
-tui_initialize_readline ()
+tui_initialize_readline (void)
{
int i;
Keymap tui_ctlx_keymap;
@@ -384,15 +379,15 @@ tui_enable (void)
nl();
keypad (w, TRUE);
rl_initialize ();
- setTermHeightTo (LINES);
- setTermWidthTo (COLS);
+ tui_set_term_height_to (LINES);
+ tui_set_term_width_to (COLS);
def_prog_mode ();
- tuiShowFrameInfo (0);
- tuiSetLayout (SRC_COMMAND, TUI_UNDEFINED_REGS);
- tuiSetWinFocusTo (srcWin);
- keypad (cmdWin->generic.handle, TRUE);
- wrefresh (cmdWin->generic.handle);
+ tui_show_frame_info (0);
+ tui_set_layout (SRC_COMMAND, TUI_UNDEFINED_REGS);
+ tui_set_win_focus_to (TUI_SRC_WIN);
+ keypad (TUI_CMD_WIN->generic.handle, TRUE);
+ wrefresh (TUI_CMD_WIN->generic.handle);
tui_finish_init = 0;
}
else
@@ -413,11 +408,11 @@ tui_enable (void)
tui_active = 1;
if (deprecated_selected_frame)
- tuiShowFrameInfo (deprecated_selected_frame);
+ tui_show_frame_info (deprecated_selected_frame);
/* Restore TUI keymap. */
tui_set_key_mode (tui_current_key_mode);
- tuiRefreshAll ();
+ tui_refresh_all_win ();
/* Update gdb's knowledge of its terminal. */
target_terminal_save_ours ();
@@ -456,26 +451,15 @@ tui_disable (void)
tui_update_gdb_sizes ();
}
-/* Wrapper on top of free() to ensure that input address
- is greater than 0x0. */
void
-tuiFree (char *ptr)
+strcat_to_buf (char *buf, int buflen, const char *item_to_add)
{
- if (ptr != (char *) NULL)
+ if (item_to_add != (char *) NULL && buf != (char *) NULL)
{
- xfree (ptr);
- }
-}
-
-void
-strcat_to_buf (char *buf, int buflen, const char *itemToAdd)
-{
- if (itemToAdd != (char *) NULL && buf != (char *) NULL)
- {
- if ((strlen (buf) + strlen (itemToAdd)) <= buflen)
- strcat (buf, itemToAdd);
+ if ((strlen (buf) + strlen (item_to_add)) <= buflen)
+ strcat (buf, item_to_add);
else
- strncat (buf, itemToAdd, (buflen - strlen (buf)));
+ strncat (buf, item_to_add, (buflen - strlen (buf)));
}
}
@@ -489,7 +473,7 @@ strcat_to_buf (char *buf, int buflen, const char *itemToAdd)
#define CHK(val, dft) (val<=0 ? dft : val)
static void
-_tuiReset (void)
+tui_reset (void)
{
struct termio mode;
@@ -555,7 +539,7 @@ _tuiReset (void)
#endif /* USG */
return;
-} /* _tuiReset */
+}
#endif
void
@@ -563,40 +547,40 @@ tui_show_source (const char *file, int line)
{
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
/* make sure that the source window is displayed */
- tuiAddWinToLayout (SRC_WIN);
+ tui_add_win_to_layout (SRC_WIN);
- tuiUpdateSourceWindowsWithLine (cursal.symtab, line);
- tuiUpdateLocatorFilename (file);
+ tui_update_source_windows_with_line (cursal.symtab, line);
+ tui_update_locator_filename (file);
}
void
tui_show_assembly (CORE_ADDR addr)
{
- tuiAddWinToLayout (DISASSEM_WIN);
- tuiUpdateSourceWindowsWithAddr (addr);
+ tui_add_win_to_layout (DISASSEM_WIN);
+ tui_update_source_windows_with_addr (addr);
}
int
-tui_is_window_visible (TuiWinType type)
+tui_is_window_visible (enum tui_win_type type)
{
if (tui_active == 0)
return 0;
- if (winList[type] == 0)
+ if (tui_win_list[type] == 0)
return 0;
- return winList[type]->generic.isVisible;
+ return tui_win_list[type]->generic.is_visible;
}
int
tui_get_command_dimension (int *width, int *height)
{
- if (!tui_active || !m_winPtrNotNull (cmdWin))
+ if (!tui_active || (TUI_CMD_WIN == NULL))
{
return 0;
}
- *width = cmdWin->generic.width;
- *height = cmdWin->generic.height;
+ *width = TUI_CMD_WIN->generic.width;
+ *height = TUI_CMD_WIN->generic.height;
return 1;
}
diff --git a/gdb/tui/tui.h b/gdb/tui/tui.h
index 03d036d..d7b741c 100644
--- a/gdb/tui/tui.h
+++ b/gdb/tui/tui.h
@@ -25,76 +25,40 @@
#ifndef TUI_H
#define TUI_H
-#include <stdarg.h>
-#include <string.h>
-#include "ansidecl.h"
-
-#if defined(reg)
-#undef reg
-#endif
-#if defined(chtype)
-#undef chtype
-#endif
-
struct ui_file;
-/* Opaque data type */
-typedef char *Opaque;
-typedef
-Opaque (*OpaqueFuncPtr) (va_list);
- typedef char **OpaqueList;
- typedef OpaqueList OpaquePtr;
-
-/* Generic function pointer */
- typedef void (*TuiVoidFuncPtr) (va_list);
- typedef int (*TuiIntFuncPtr) (va_list);
-/*
- typedef Opaque (*TuiOpaqueFuncPtr) (va_list);
- */
- typedef OpaqueFuncPtr TuiOpaqueFuncPtr;
-
extern void strcat_to_buf (char *, int, const char *);
-/* Types of error returns */
- typedef enum tui_status
- {
- TUI_SUCCESS,
- TUI_FAILURE
- }
-TuiStatus, *TuiStatusPtr;
+/* Types of error returns. */
+enum tui_status
+{
+ TUI_SUCCESS,
+ TUI_FAILURE
+};
/* Types of windows */
- typedef enum
- {
- SRC_WIN = 0,
- DISASSEM_WIN,
- DATA_WIN,
- CMD_WIN,
- /* This must ALWAYS be AFTER the major windows last */
- MAX_MAJOR_WINDOWS,
- /* auxillary windows */
- LOCATOR_WIN,
- EXEC_INFO_WIN,
- DATA_ITEM_WIN,
- /* This must ALWAYS be next to last */
- MAX_WINDOWS,
- UNDEFINED_WIN /* LAST */
- }
-TuiWinType, *TuiWinTypePtr;
-
-/* This is a point definition */
- typedef struct _TuiPoint
- {
- int x, y;
- }
-TuiPoint, *TuiPointPtr;
+enum tui_win_type
+{
+ SRC_WIN = 0,
+ DISASSEM_WIN,
+ DATA_WIN,
+ CMD_WIN,
+ /* This must ALWAYS be AFTER the major windows last. */
+ MAX_MAJOR_WINDOWS,
+ /* Auxillary windows. */
+ LOCATOR_WIN,
+ EXEC_INFO_WIN,
+ DATA_ITEM_WIN,
+ /* This must ALWAYS be next to last. */
+ MAX_WINDOWS,
+ UNDEFINED_WIN /* LAST */
+};
/* GENERAL TUI FUNCTIONS */
/* tui.c */
-extern void tuiFree (char *);
-extern CORE_ADDR tuiGetLowDisassemblyAddress (CORE_ADDR, CORE_ADDR);
+extern CORE_ADDR tui_get_low_disassembly_address (CORE_ADDR, CORE_ADDR);
extern void tui_show_assembly (CORE_ADDR addr);
-extern int tui_is_window_visible (TuiWinType type);
+extern int tui_is_window_visible (enum tui_win_type type);
extern int tui_get_command_dimension (int *width, int *height);
/* Initialize readline and configure the keymap for the switching
@@ -110,13 +74,13 @@ extern void tui_disable (void);
enum tui_key_mode
{
/* Plain command mode to enter gdb commands. */
- tui_command_mode,
+ TUI_COMMAND_MODE,
/* SingleKey mode with some keys bound to gdb commands. */
- tui_single_key_mode,
+ TUI_SINGLE_KEY_MODE,
/* Read/edit one command and return to SingleKey after it's processed. */
- tui_one_command_mode
+ TUI_ONE_COMMAND_MODE
};
extern enum tui_key_mode tui_current_key_mode;
@@ -124,23 +88,13 @@ extern enum tui_key_mode tui_current_key_mode;
/* Change the TUI key mode by installing the appropriate readline keymap. */
extern void tui_set_key_mode (enum tui_key_mode mode);
-extern void tui_initialize_io (void);
-
-extern void tui_initialize_readline (void);
-
extern int tui_active;
-extern void tui_install_hooks (void);
-extern void tui_remove_hooks (void);
-
extern void tui_show_source (const char *file, int line);
extern struct ui_out *tui_out_new (struct ui_file *stream);
-/* tuiLayout.c */
-extern TuiStatus tui_set_layout (const char *);
-
-/* tuiSourceWin.c */
-extern void tuiUpdateAllExecInfos (void);
+/* tui-layout.c */
+extern enum tui_status tui_set_layout_for_display_command (const char *name);
-#endif /* TUI_H */
+#endif