2007-08-14 Michael Snyder <msnyder@access-company.com>
+ * tui-command.c, tui-data.c, tui-data.h, tui-disasm.c, tui-file.c,
+ tui-hooks.c, tui-interp.c, tui-io.c, tui-layout.c, tui-out.c,
+ tui-regs.c, tui-regs.h, tui-source.c, tui-stack.c, tui-win.c,
+ tui-windata.c, tui-wingeneral.c, tui-winsource.c, tui-winsource.h,
+ tui.c, tui.h: Comment reformatting to coding standard (capitals,
+ spaces after periods, etc).
+
* tui-data.c, tui-data.h, tui-disasm.c, tui-hooks.c, tui-layout.c,
tui-regs.c, tui-source.c, tui-stack.c, tui-win.c, tui-windata.c,
tui-wingeneral.c, tui-wingeneral.h, tui-winsource.c, tui.c,
** PUBLIC FUNCTIONS **
******************************************/
-/* Dispatch the correct tui function based upon the control character. */
+/* Dispatch the correct tui function based upon the control
+ character. */
unsigned int
tui_dispatch_ctrl_char (unsigned int ch)
{
tui_refresh_all_win ();
/* 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. */
+ assume it is the command window; in this case, pass the character
+ on through and do nothing here. */
if (win_info == NULL || win_info == TUI_CMD_WIN)
return ch;
else
** ACCESSORS & MUTATORS FOR PRIVATE DATA
******************************************/
-/* Answer a whether the terminal window has been resized or not. */
+/* Answer a whether the terminal window has been resized or not. */
int
tui_win_resized (void)
{
}
-/* Set a whether the terminal window has been resized or not. */
+/* Set a whether the terminal window has been resized or not. */
void
tui_set_win_resized_to (int resized)
{
}
-/* Answer a pointer to the current layout definition. */
+/* Answer a pointer to the current layout definition. */
struct tui_layout_def *
tui_layout_def (void)
{
}
-/* Answer the window with the logical focus. */
+/* Answer the window with the logical focus. */
struct tui_win_info *
tui_win_with_focus (void)
{
}
-/* Set the window that has the logical focus. */
+/* Set the window that has the logical focus. */
void
tui_set_win_with_focus (struct tui_win_info *win_info)
{
}
-/* Answer the length in chars, of tabs. */
+/* Answer the length in chars, of tabs. */
int
tui_default_tab_len (void)
{
}
-/* Set the length in chars, of tabs. */
+/* Set the length in chars, of tabs. */
void
tui_set_default_tab_len (int len)
{
}
-/* Clear the pertinant detail in the source windows. */
+/* Clear the pertinant detail in the source windows. */
void
tui_clear_source_windows_detail (void)
{
}
-/* Clear the pertinant detail in the windows. */
+/* Clear the pertinant detail in the windows. */
void
tui_clear_win_detail (struct tui_win_info *win_info)
{
}
-/* Mutator for the term height. */
+/* Mutator for the term height. */
void
tui_set_term_height_to (int h)
{
}
-/* Accessor for the term_width. */
+/* Accessor for the term_width. */
int
tui_term_width (void)
{
}
-/* Accessor for the current layout. */
+/* Accessor for the current layout. */
enum tui_layout_type
tui_current_layout (void)
{
}
-/* Answer the window represented by name. */
+/* Answer the window represented by name. */
struct tui_win_info *
tui_partial_win_by_name (char *name)
{
init_content_element (element_ptr, win_info->type);
win_info->content_size++;
}
- else /* Things must be really hosed now! We ran out of memory!? */
+ else /* Things must be really hosed now! We ran out of
+ memory!? */
return (-1);
}
}
}
-/* Delete all curses windows associated with win_info, leaving everything
- else intact. */
+/* Delete all curses windows associated with win_info, leaving
+ everything else intact. */
void
tui_del_window (struct tui_win_info *win_info)
{
int i;
/*
- ** Remember that data window content elements are of type struct tui_gen_win_info *,
- ** each of which whose single element is a data element.
+ ** 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 < content_size; i++)
{
int i;
/*
- ** Remember that data window content elements are of type struct tui_gen_win_info *,
- ** each of which whose single element is a data element.
+ ** 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 < content_size; i++)
{
if (type == SRC_WIN || type == DISASSEM_WIN)
{
- /* free whole source block */
+ /* Free whole source block. */
xfree (content[0]->which_element.source.line);
}
else
case DATA_ITEM_WIN:
/*
** Note that data elements are not allocated
- ** in a single block, but individually, as needed.
+ ** in a single block, but individually, as
+ ** needed.
*/
if (element->which_element.data.type != TUI_REGISTER)
xfree ((void *)element->which_element.data.name);
}
}
if (type != DATA_WIN && type != DATA_ITEM_WIN)
- xfree (content[0]); /* free the element block */
+ xfree (content[0]); /* Free the element block. */
}
}
int x, y;
};
-/* Generic window information */
+/* Generic window information. */
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. */
+ 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 */
+/* Constant definitions. */
#define DEFAULT_TAB_LEN 8
#define NO_SRC_STRING "[ No Source Available ]"
#define NO_DISASSEM_STRING "[ No Assembly Available ]"
#define PC_PREFIX "PC: "
#define SINGLE_KEY "(SingleKey)"
-/* Minimum/Maximum length of some fields displayed in the TUI status line. */
-#define MIN_LINE_WIDTH 4 /* Use at least 4 digits for line numbers. */
+/* Minimum/Maximum length of some fields displayed in the TUI status
+ line. */
+#define MIN_LINE_WIDTH 4 /* Use at least 4 digits for line
+ numbers. */
#define MIN_PROC_WIDTH 12
#define MAX_TARGET_WIDTH 10
#define MAX_PID_WIDTH 14
};
-/* The kinds of layouts available */
+/* The kinds of layouts available. */
enum tui_layout_type
{
SRC_COMMAND,
UNDEFINED_LAYOUT
};
-/* Basic data types that can be displayed in the data window. */
+/* Basic data types that can be displayed in the data window. */
enum tui_data_type
{
TUI_REGISTER,
TUI_STRUCT
};
-/* Types of register displays */
+/* Types of register displays. */
enum tui_register_display_type
{
TUI_UNDEFINED_REGS,
TUI_GENERAL_AND_SPECIAL_REGS
};
-/* Structure describing source line or line address */
+/* Structure describing source line or line address. */
struct tui_line_or_address
{
enum { LOA_LINE, LOA_ADDRESS } loa;
} u;
};
-/* Current Layout definition */
+/* Current Layout definition. */
struct tui_layout_def
{
enum tui_win_type display_mode;
enum tui_register_display_type float_regs_display_type;
};
-/* Elements in the Source/Disassembly Window */
+/* Elements in the Source/Disassembly Window. */
struct tui_source_element
{
char *line;
};
-/* Elements in the data display window content */
+/* Elements in the data display window content. */
struct tui_data_element
{
const char *name;
- int item_no; /* the register number, or data display number */
+ 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 */
+/* Elements in the command window content. */
struct tui_command_element
{
char *line;
#define MAX_LOCATOR_ELEMENT_LEN 100
-/* Elements in the locator window content */
+/* Elements in the locator window content. */
struct tui_locator_element
{
char file_name[MAX_LOCATOR_ELEMENT_LEN];
typedef char tui_exec_info_content[TUI_EXECINFO_SIZE];
-/* An content element in a window */
+/* An content element in a window. */
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_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
};
-/* This describes the content of the window. */
+/* This describes the content of the window. */
typedef struct tui_win_element **tui_win_content;
-/* This struct defines the specific information about a data display window */
+/* This struct defines the specific information about a data display
+ window. */
struct tui_data_info
{
- tui_win_content data_content; /* start of data display content */
+ tui_win_content data_content; /* Start of data display content. */
int data_content_count;
- tui_win_content regs_content; /* start of regs display content */
+ 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? */
+ int display_regs; /* Should regs be displayed at all? */
struct reggroup *current_group;
};
struct tui_source_info
{
- int has_locator; /* Does locator belongs to this window? */
+ 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 */
+ int horizontal_offset; /* Used for horizontal scroll. */
struct 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 cur_line; /* The current line position. */
+ int curch; /* The current cursor position. */
int start_line;
};
-/* This defines information about each logical window */
+/* This defines information about each logical window. */
struct tui_win_info
{
- struct tui_gen_win_info generic; /* general window information */
+ struct tui_gen_win_info generic; /* General window information. */
union
{
struct tui_source_info source_info;
void *opaque;
}
detail;
- int can_highlight; /* Can this window ever be highlighted? */
- int is_highlighted; /* Is this window highlighted? */
+ 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);
int highlight);
-/* Global Data */
+/* Global Data. */
extern struct tui_win_info *(tui_win_list[MAX_MAJOR_WINDOWS]);
-#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]
+#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 */
+/* Data Manipulation Functions. */
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);
{
struct ui_file *gdb_dis_out;
- /* now init the ui_file structure */
+ /* Now init the ui_file structure. */
gdb_dis_out = tui_sfileopen (256);
- /* Now construct each line */
+ /* Now construct each line. */
for (; count > 0; count--, asm_lines++)
{
if (asm_lines->addr_string)
asm_lines->insn = xstrdup (tui_file_get_strbuf (gdb_dis_out));
- /* reset the buffer to empty */
+ /* Reset the buffer to empty. */
ui_file_rewind (gdb_dis_out);
}
ui_file_delete (gdb_dis_out);
return pc;
}
-/* Find the disassembly address that corresponds to FROM lines
- above or below the PC. Variable sized instructions are taken
- into account by the algorithm. */
+/* Find the disassembly address that corresponds to FROM lines above
+ or below the PC. Variable sized instructions are taken into
+ account by the algorithm. */
static CORE_ADDR
tui_find_disassembly_address (CORE_ADDR pc, int from)
{
int pos;
struct minimal_symbol *msymbol;
- /* Find backward an address which is a symbol
- and for which disassembling from that address will fill
- completely the window. */
+ /* Find backward an address which is a symbol and for which
+ disassembling from that address will fill completely the
+ window. */
pos = max_lines - 1;
do {
new_low -= 1 * max_lines;
last_addr = asm_lines[pos].addr;
} while (last_addr > pc && msymbol);
- /* Scan forward disassembling one instruction at a time
- until the last visible instruction of the window
- matches the pc. We keep the disassembled instructions
- in the 'lines' window and shift it downward (increasing
- its addresses). */
+ /* Scan forward disassembling one instruction at a time until
+ the last visible instruction of the window matches the pc.
+ We keep the disassembled instructions in the 'lines' window
+ and shift it downward (increasing its addresses). */
if (last_addr < pc)
do
{
cur_pc = (CORE_ADDR)
(((struct tui_win_element *) locator->content[0])->which_element.locator.addr);
- max_lines = TUI_DISASM_WIN->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). */
asm_lines = (struct tui_asm_line*) alloca (sizeof (struct tui_asm_line)
line = (char*) alloca (max_size);
insn_pos = (1 + (addr_size / tab_len)) * tab_len;
- /* Now construct each line */
+ /* Now construct each line. */
for (i = 0; i < max_lines; i++)
{
struct tui_win_element *element;
strcpy (line, asm_lines[i].addr_string);
cur_len = strlen (line);
- /* Add spaces to make the instructions start on the same column */
+ /* Add spaces to make the instructions start on the same
+ column. */
while (cur_len < insn_pos)
{
strcat (line, " ");
strcat (line, asm_lines[i].insn);
- /* Now copy the line taking the offset into account */
+ /* Now copy the line taking the offset into account. */
if (strlen (line) > offset)
strcpy (src->line, &line[offset]);
else
}
-/* Function to display the disassembly window with disassembled code. */
+/* Function to display the disassembly window with disassembled code. */
void
tui_show_disassem (CORE_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 the focus was in the src win, put it in the asm win, if
+ ** the source view isn't split.
*/
if (tui_current_layout () != SRC_DISASSEM_COMMAND && win_with_focus == TUI_SRC_WIN)
tui_set_win_focus_to (TUI_DISASM_WIN);
}
-/* Function to display the disassembly window. */
+/* Function to display the disassembly window. */
void
tui_show_disassem_and_update_source (CORE_ADDR start_addr)
{
/*
** 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
+ ** note that it follows what is in the disassembly window and
+ ** visa-versa.
*/
sal = find_pc_line (start_addr, 0);
val.loa = LOA_LINE;
else
addr = 0;
}
- else /* the target is executing */
+ else /* The target is executing. */
addr = element->addr;
return addr;
}
/* Determine what the low address will be to display in the TUI's
- disassembly window. This may or may not be the same as the
- low address input. */
+ disassembly window. This may or may not be the same as the low
+ address input. */
CORE_ADDR
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. */
+ /* Determine where to start the disassembly so that the pc is about
+ in the middle of the viewport. */
pos = tui_default_win_viewport_height (DISASSEM_WIN, DISASSEM_COMMAND) / 2;
pc = tui_find_disassembly_address (pc, -pos);
else
s = cursal.symtab;
- /* account for hilite */
+ /* Account for hilite. */
max_lines = TUI_DISASM_WIN->generic.height - 2;
pc = content[0]->which_element.source.line_or_addr.u.addr;
dir = (scroll_direction == FORWARD_SCROLL) ? max_lines : - max_lines;
#include "gdb_string.h"
/* A ``struct ui_file'' that is compatible with all the legacy
- code. */
+ code. */
/* new */
enum streamtype
tmpstream->ts_strbuf[0] = '\0';
}
else
- /* Do not allocate the buffer now. The first time something is printed
- one will be allocated by tui_file_adjust_strbuf() */
+ /* Do not allocate the buffer now. The first time something is
+ printed one will be allocated by tui_file_adjust_strbuf(). */
tmpstream->ts_strbuf = NULL;
tmpstream->ts_buflen = n;
return file;
gdb_stderr are sent to the hook. Everything else is sent on to
fputs to allow file I/O to be handled appropriately. */
-/* FIXME: Should be broken up and moved to a TUI specific file. */
+/* FIXME: Should be broken up and moved to a TUI specific file. */
void
tui_file_fputs (const char *linebuffer, struct ui_file *file)
return (stream->ts_strbuf);
}
-/* adjust the length of the buffer by the amount necessary
- to accomodate appending a string of length N to the buffer contents */
+/* Adjust the length of the buffer by the amount necessary to
+ accomodate appending a string of length N to the buffer
+ contents. */
void
tui_file_adjust_strbuf (int n, struct ui_file *file)
{
if (stream->ts_strbuf)
{
- /* There is already a buffer allocated */
+ /* There is already a buffer allocated. */
non_null_chars = strlen (stream->ts_strbuf);
if (n > (stream->ts_buflen - non_null_chars - 1))
}
}
else
- /* No buffer yet, so allocate one of the desired size */
+ /* No buffer yet, so allocate one of the desired size. */
stream->ts_strbuf = xmalloc ((n + 1) * sizeof (char));
}
echo ();
while (1)
{
- wrap_here (""); /* Flush any buffered output */
+ wrap_here (""); /* Flush any buffered output. */
gdb_flush (gdb_stdout);
vfprintf_filtered (gdb_stdout, msg, argp);
retval = 1;
break;
}
- /* Eat rest of input line, to EOF or newline */
+ /* Eat rest of input line, to EOF or newline. */
if (answer != '\n')
do
{
}
/* The selected frame has changed. This is happens after a target
- stop or when the user explicitly changes the frame (up/down/thread/...). */
+ stop or when the user explicitly changes the frame
+ (up/down/thread/...). */
static void
tui_selected_frame_level_changed_hook (int level)
{
return;
fi = get_selected_frame (NULL);
- /* Ensure that symbols for this frame are read in. Also, determine the
- source language of this frame, and switch to it if desired. */
+ /* Ensure that symbols for this frame are read in. Also, determine
+ the source language of this frame, and switch to it if
+ desired. */
if (fi)
{
struct symtab *s;
s = find_pc_symtab (get_frame_pc (fi));
- /* elz: this if here fixes the problem with the pc not being displayed
- in the tui asm layout, with no debug symbols. The value of s
- would be 0 here, and select_source_symtab would abort the
- command by calling the 'error' function */
+ /* elz: This if here fixes the problem with the pc not being
+ displayed in the tui asm layout, with no debug symbols. The
+ value of s would be 0 here, and select_source_symtab would
+ abort the command by calling the 'error' function. */
if (s)
select_source_symtab (s);
#include "tui/tui-io.h"
#include "exceptions.h"
-/* Set to 1 when the TUI mode must be activated when we first start gdb. */
+/* Set to 1 when the TUI mode must be activated when we first start
+ gdb. */
static int tui_start_enabled = 0;
/* Cleanup the tui before exiting. */
static void
tui_exit (void)
{
- /* Disable the tui. Curses mode is left leaving the screen
- in a clean state (see endwin()). */
+ /* Disable the tui. Curses mode is left leaving the screen in a
+ clean state (see endwin()). */
tui_disable ();
}
{
struct ui_file *stream;
- /* gdb_setup_readline will change gdb_stdout. If the TUI was previously
- writing to gdb_stdout, then set it to the new gdb_stdout afterwards. */
+ /* gdb_setup_readline will change gdb_stdout. If the TUI was
+ previously writing to gdb_stdout, then set it to the new
+ gdb_stdout afterwards. */
stream = cli_out_set_stream (tui_old_uiout, gdb_stdout);
if (stream != gdb_stdout)
};
struct interp *tui_interp;
- /* Create a default uiout builder for the TUI. */
+ /* Create a default uiout builder for the TUI. */
tui_out = tui_out_new (gdb_stdout);
interp_add (interp_new (INTERP_TUI, NULL, tui_out, &procs));
if (interpreter_p && strcmp (interpreter_p, INTERP_TUI) == 0)
When the TUI is enabled, gdb has two modes a curses and a standard
mode.
- In curses mode, the gdb outputs are made in a curses command window.
- For this, the gdb_stdout and gdb_stderr are redirected to the specific
- ui_file implemented by TUI. The output is handled by tui_puts().
- The input is also controlled by curses with tui_getc(). The readline
- library uses this function to get its input. Several readline hooks
- are installed to redirect readline output to the TUI (see also the
- note below).
+ In curses mode, the gdb outputs are made in a curses command
+ window. For this, the gdb_stdout and gdb_stderr are redirected to
+ the specific ui_file implemented by TUI. The output is handled by
+ tui_puts(). The input is also controlled by curses with
+ tui_getc(). The readline library uses this function to get its
+ input. Several readline hooks are installed to redirect readline
+ output to the TUI (see also the note below).
In normal mode, the gdb outputs are restored to their origin, that
is as if TUI is not used. Readline also uses its original getc()
function with stdin.
- Note SCz/2001-07-21: the current readline is not clean in its management of
- the output. Even if we install a redisplay handler, it sometimes writes on
- a stdout file. It is important to redirect every output produced by
- readline, otherwise the curses window will be garbled. This is implemented
- with a pipe that TUI reads and readline writes to. A gdb input handler
- is created so that reading the pipe is handled automatically.
- This will probably not work on non-Unix platforms. The best fix is
- to make readline clean enougth so that is never write on stdout.
-
- Note SCz/2002-09-01: we now use more readline hooks and it seems that
- with them we don't need the pipe anymore (verified by creating the pipe
- and closing its end so that write causes a SIGPIPE). The old pipe code
- is still there and can be conditionally removed by
+ Note SCz/2001-07-21: the current readline is not clean in its
+ management of the output. Even if we install a redisplay handler,
+ it sometimes writes on a stdout file. It is important to redirect
+ every output produced by readline, otherwise the curses window will
+ be garbled. This is implemented with a pipe that TUI reads and
+ readline writes to. A gdb input handler is created so that reading
+ the pipe is handled automatically. This will probably not work on
+ non-Unix platforms. The best fix is to make readline clean enougth
+ so that is never write on stdout.
+
+ Note SCz/2002-09-01: we now use more readline hooks and it seems
+ that with them we don't need the pipe anymore (verified by creating
+ the pipe and closing its end so that write causes a SIGPIPE). The
+ old pipe code is still there and can be conditionally removed by
#undef TUI_USE_PIPE_FOR_READLINE. */
/* For gdb 5.3, prefer to continue the pipe hack as a backup wheel. */
#define TUI_USE_PIPE_FOR_READLINE
-/*#undef TUI_USE_PIPE_FOR_READLINE*/
+/* #undef TUI_USE_PIPE_FOR_READLINE */
/* TUI output files. */
static struct ui_file *tui_stdout;
int start_line;
/* Detect when we temporarily left SingleKey and now the readline
- edit buffer is empty, automatically restore the SingleKey mode. */
+ 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);
fflush(stdout);
}
-/* Readline callback to prepare the terminal. It is called once
- each time we enter readline. Terminal is already setup in curses mode. */
+/* Readline callback to prepare the terminal. It is called once each
+ time we enter readline. Terminal is already setup in curses
+ mode. */
static void
tui_prep_terminal (int notused1)
{
tui_rl_saved_prompt = xstrdup (rl_prompt);
}
-/* Readline callback to restore the terminal. It is called once
- each time we leave readline. There is nothing to do in curses mode. */
+/* Readline callback to restore the terminal. It is called once each
+ time we leave readline. There is nothing to do in curses mode. */
static void
tui_deprep_terminal (void)
{
are only interested in the basename, the portion following the
final slash. Otherwise, we return what we were passed.
- Comes from readline/complete.c */
+ Comes from readline/complete.c. */
static char *
printable_part (char *pathname)
{
return (temp ? ++temp : pathname);
}
-/* Output TO_PRINT to rl_outstream. If VISIBLE_STATS is defined and we
- are using it, check for and output a single character for `special'
- filenames. Return the number of characters we output. */
+/* Output TO_PRINT to rl_outstream. If VISIBLE_STATS is defined and
+ we are using it, check for and output a single character for
+ `special' filenames. Return the number of characters we
+ output. */
#define PUTX(c) \
do { \
}
/* The user must press "y" or "n". Non-zero return means "y" pressed.
- Comes from readline/complete.c */
+ Comes from readline/complete.c. */
static int
get_y_or_n (void)
{
int screenwidth = TUI_CMD_WIN->generic.width;
/* If there are many items, then ask the user if she really wants to
- see them all. */
+ see them all. */
if (len >= rl_completion_query_items)
{
char msg[256];
}
}
- /* How many items of MAX length can we fit in the screen window? */
+ /* How many items of MAX length can we fit in the screen window? */
max += 2;
limit = screenwidth / max;
if (limit != 1 && (limit * max == screenwidth))
limit--;
- /* Avoid a possible floating exception. If max > screenwidth,
- limit will be 0 and a divide-by-zero fault will result. */
+ /* Avoid a possible floating exception. If max > screenwidth, limit
+ will be 0 and a divide-by-zero fault will result. */
if (limit == 0)
limit = 1;
- /* How many iterations of the printing loop? */
+ /* How many iterations of the printing loop? */
count = (len + (limit - 1)) / limit;
/* Watch out for special case. If LEN is less than LIMIT, then
just do the inner printing loop.
- 0 < len <= limit implies count = 1. */
+ 0 < len <= limit implies count = 1. */
- /* Sort the items if they are not already sorted. */
+ /* Sort the items if they are not already sorted. */
if (rl_ignore_completion_duplicates == 0)
qsort (matches + 1, len, sizeof (char *),
(QSFUNC *)_rl_qsort_string_compare);
if (_rl_print_completions_horizontally == 0)
{
- /* Print the sorted items, up-and-down alphabetically, like ls. */
+ /* Print the sorted items, up-and-down alphabetically, like ls. */
for (i = 1; i <= count; i++)
{
for (j = 0, l = i; j < limit; j++)
}
else
{
- /* Print the sorted items, across alphabetically, like ls -x. */
+ /* Print the sorted items, across alphabetically, like ls -x. */
for (i = 1; matches[i]; i++)
{
temp = printable_part (matches[i]);
printed_len = print_filename (temp, matches[i]);
- /* Have we reached the end of this line? */
+ /* Have we reached the end of this line? */
if (matches[i+1])
{
if (i && (limit > 1) && (i % limit) == 0)
tui_old_uiout = uiout = cli_out_new (gdb_stdout);
#ifdef TUI_USE_PIPE_FOR_READLINE
- /* Temporary solution for readline writing to stdout:
- redirect readline output in a pipe, read that pipe and
- output the content in the curses command window. */
+ /* Temporary solution for readline writing to stdout: redirect
+ readline output in a pipe, read that pipe and output the content
+ in the curses command window. */
if (pipe (tui_readline_pipe) != 0)
{
fprintf_unfiltered (gdb_stderr, "Cannot create pipe for readline");
#endif
}
-/* Get a character from the command window. This is called from the readline
- package. */
+/* Get a character from the command window. This is called from the
+ readline package. */
int
tui_getc (FILE *fp)
{
ch = wgetch (w);
ch = tui_handle_resize_during_io (ch);
- /* The \n must be echoed because it will not be printed by readline. */
+ /* The \n must be echoed because it will not be printed by
+ readline. */
if (ch == '\n')
{
/* When hitting return with an empty input, gdb executes the last
}
if (key_is_command_char (ch))
- { /* Handle prev/next/up/down here */
+ { /* Handle prev/next/up/down here. */
ch = tui_dispatch_ctrl_char (ch);
}
/*
** Since the new layout may cause changes in window size, we
** should free the content and reallocate on next display of
- ** source/asm
+ ** source/asm.
*/
tui_free_all_source_wins_content ();
tui_clear_source_windows ();
}
else
{
- /* First make the current layout be invisible */
+ /* First make the current layout be invisible. */
tui_make_all_invisible ();
tui_make_invisible (tui_locator_win_info_ptr ());
switch (layout)
{
- /* Now show the new layout */
+ /* Now show the new layout. */
case SRC_COMMAND:
show_source_command ();
tui_add_to_source_windows (TUI_SRC_WIN);
{
show_layout (new_layout);
/*
- ** Now determine where focus should be
+ ** Now determine where focus should be.
*/
if (win_with_focus != TUI_CMD_WIN)
{
layout_def->split = FALSE;
break;
case DISASSEM_COMMAND:
- /* the previous layout was not showing
+ /* The previous layout was not showing
** code. this can happen if there is no
** source available:
** 1. if the source file is in another dir OR
layout_def->split = FALSE;
break;
case SRC_DISASSEM_COMMAND:
- /* the previous layout was not showing
+ /* The previous layout was not showing
** code. this can happen if there is no
** source available:
** 1. if the source file is in another dir OR
layout_def->split = FALSE;
break;
case DISASSEM_DATA_COMMAND:
- /* the previous layout was not showing
+ /* The previous layout was not showing
** code. this can happen if there is no
** source available:
** 1. if the source file is in another dir OR
for (i = 0; (i < strlen (layout_name)); i++)
buf_ptr[i] = toupper (buf_ptr[i]);
- /* First check for ambiguous input */
+ /* First check for ambiguous input. */
if (strlen (buf_ptr) <= 1 && (*buf_ptr == 'S' || *buf_ptr == '$'))
{
warning (_("Ambiguous command input."));
else
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
- */
+ /* 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 (buf_ptr, TUI_FLOAT_REGS_NAME))
{
if (TUI_DATA_WIN->detail.data_display_info.regs_display_type !=
dpy_type = TUI_GENERAL_REGS;
}
-/* end of potential ifdef
- */
+ /* End of potential ifdef.
+ */
-/* if ifdefed out code above, then assume that the user wishes to display the
- general purpose registers
- */
+ /* If ifdefed out code above, then assume that the user
+ wishes to display the general purpose registers .
+ */
-/* dpy_type = TUI_GENERAL_REGS;
- */
+ /* dpy_type = TUI_GENERAL_REGS; */
}
else if (subset_compare (buf_ptr, "NEXT"))
new_layout = next_layout ();
}
-/* Show the Source/Command or the Disassem layout. */
+/* Show the Source/Command or the Disassem layout. */
static void
show_source_or_disasm_and_command (enum tui_layout_type layout_type)
{
};
typedef struct ui_out_data tui_out_data;
-/* These are the CLI output functions */
+/* These are the CLI output functions. */
static void tui_table_begin (struct ui_out *uiout, int nbrofcols,
int nr_rows, const char *tblid);
static void tui_wrap_hint (struct ui_out *uiout, char *identstring);
static void tui_flush (struct ui_out *uiout);
-/* This is the CLI ui-out implementation functions vector */
+/* This is the CLI ui-out implementation functions vector. */
/* FIXME: This can be initialized dynamically after default is set to
- handle initial output in main.c */
+ handle initial output in main.c. */
static struct ui_out_impl tui_ui_out_impl =
{
0, /* Does not need MI hacks (i.e. needs CLI hacks). */
};
-/* Prototypes for local functions */
+/* Prototypes for local functions. */
extern void _initialize_tui_out (void);
/* (none yet) */
-/* Mark beginning of a table */
+/* Mark beginning of a table. */
void
tui_table_begin (struct ui_out *uiout, int nbrofcols,
data->suppress_output = 1;
else
/* Only the table suppresses the output and, fortunately, a table
- is not a recursive data structure. */
+ is not a recursive data structure. */
gdb_assert (data->suppress_output == 0);
}
-/* Mark beginning of a table body */
+/* Mark beginning of a table body. */
void
tui_table_body (struct ui_out *uiout)
tui_out_data *data = ui_out_data (uiout);
if (data->suppress_output)
return;
- /* first, close the table header line */
+ /* First, close the table header line. */
tui_text (uiout, "\n");
}
-/* Mark end of a table */
+/* Mark end of a table. */
void
tui_table_end (struct ui_out *uiout)
data->suppress_output = 0;
}
-/* Specify table header */
+/* Specify table header. */
void
tui_table_header (struct ui_out *uiout, int width, enum ui_align alignment,
tui_field_string (uiout, 0, width, alignment, 0, colhdr);
}
-/* Mark beginning of a list */
+/* Mark beginning of a list. */
void
tui_begin (struct ui_out *uiout,
return;
}
-/* Mark end of a list */
+/* Mark end of a list. */
void
tui_end (struct ui_out *uiout,
return;
}
-/* output an int field */
+/* Output an int field. */
void
tui_field_int (struct ui_out *uiout, int fldno, int width,
enum ui_align alignment,
const char *fldname, int value)
{
- char buffer[20]; /* FIXME: how many chars long a %d can become? */
+ char buffer[20]; /* FIXME: how many chars long a %d can become? */
tui_out_data *data = ui_out_data (uiout);
if (data->suppress_output)
tui_field_string (uiout, fldno, width, alignment, fldname, buffer);
}
-/* used to ommit a field */
+/* Used to ommit a field. */
void
tui_field_skip (struct ui_out *uiout, int fldno, int width,
tui_field_string (uiout, fldno, width, alignment, fldname, "");
}
-/* other specific tui_field_* end up here so alignment and field
- separators are both handled by tui_field_string */
+/* Other specific tui_field_* end up here so alignment and field
+ separators are both handled by tui_field_string. */
void
tui_field_string (struct ui_out *uiout,
field_separator ();
}
-/* This is the only field function that does not align */
+/* This is the only field function that does not align. */
void
tui_field_fmt (struct ui_out *uiout, int fldno,
gdb_flush (data->stream);
}
-/* local functions */
+/* Local functions. */
-/* Like tui_field_fmt, but takes a variable number of args
- and makes a va_list and does not insert a separator */
+/* Like tui_field_fmt, but takes a variable number of args and makes a
+ va_list and does not insert a separator. */
/* VARARGS */
static void
va_end (args);
}
-/* access to ui_out format private members */
+/* Access to ui_out format private members. */
static void
field_separator (void)
fputc_filtered (' ', data->stream);
}
-/* initalize private members at startup */
+/* Initalize private members at startup. */
struct ui_out *
tui_out_new (struct ui_file *stream)
return ui_out_new (&tui_ui_out_impl, data, flags);
}
-/* standard gdb initialization hook */
+/* Standard gdb initialization hook. */
void
_initialize_tui_out (void)
{
- /* nothing needs to be done */
+ /* Nothing needs to be done. */
}
}
-/* Answer the index of the first element in line_no. If line_no is past
- the register area (-1) is returned. */
+/* 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 line_no)
{
if (group == 0)
group = general_reggroup;
- /* Say that registers should be displayed, even if there is a problem. */
+ /* Say that registers should be displayed, even if there is a
+ problem. */
display_info->display_regs = TRUE;
if (target_has_registers && target_has_stack && target_has_memory)
{
int i;
- /* Clear all notation of changed values */
+ /* Clear all notation of changed values. */
for (i = 0; i < display_info->regs_content_count; i++)
{
struct tui_gen_win_info *data_item_win;
/* Set the data window to display the registers of the register group
- using the given frame. Values are refreshed only when refresh_values_only
- is TRUE. */
+ using the given frame. Values are refreshed only when
+ refresh_values_only is TRUE. */
static enum tui_status
tui_show_register_group (struct gdbarch *gdbarch, struct reggroup *group,
display_info->regs_content_count = nr_regs;
}
- /* Now set the register names and values */
+ /* Now set the register names and values. */
pos = 0;
for (regnum = 0;
regnum < gdbarch_num_regs (current_gdbarch)
(TUI_DATA_WIN->generic.width - 2) / display_info->regs_column_count;
/*
- ** Now create each data "sub" window, and write the display into it.
+ ** Now create each data "sub" window, and write the display
+ ** into it.
*/
cur_y = 1;
while (i < display_info->regs_content_count &&
struct tui_gen_win_info *data_item_win;
struct tui_data_element *data_element_ptr;
- /* create the window if necessary */
+ /* Create the window if necessary. */
data_item_win = &display_info->regs_content[i]
->which_element.data_window;
data_element_ptr = &((struct tui_win_element *)
/* Get the printable representation of the register
and display it. */
tui_display_register (data_element_ptr, data_item_win);
- i++; /* next register */
+ i++; /* Next register. */
}
- cur_y++; /* next row; */
+ cur_y++; /* Next row. */
}
}
}
first_line_on_last_page = 0;
/*
** If there is no other data displayed except registers,
- ** and the element_no causes us to scroll past the end of the
- ** registers, adjust what element to really start the display at.
+ ** and the element_no causes us to scroll past the end of
+ ** the registers, adjust what element to really start the
+ ** display at.
*/
if (TUI_DATA_WIN->detail.data_display_info.data_content_count <= 0 &&
start_line_no > first_line_on_last_page)
if (line_no < 0)
line = 0;
else if (force_display)
- { /*
- ** If we must display regs (force_display is true), then make
- ** sure that we don't display off the end of the registers.
- */
+ { /*
+ ** If we must display regs (force_display is true), then make
+ ** sure that we don't display off the end of the registers.
+ */
if (line_no >= tui_last_regs_line_no ())
{
if ((line = tui_line_from_reg_element_no (
return line;
}
- return (-1); /* nothing was displayed */
+ return (-1); /* Nothing was displayed. */
}
}
}
-/* Display a register in a window. If hilite is TRUE,
- then the value will be displayed in reverse video */
+/* Display a register in a window. If hilite is TRUE, then the value
+ will be displayed in reverse video. */
static void
tui_display_register (struct tui_data_element *data,
struct tui_gen_win_info *win_info)
do_cleanups (cleanups);
}
-/* Get the register value from the given frame and format it for
- the display. When changep is set, check if the new register value
- has changed with respect to the previous call. */
+/* Get the register value from the given frame and format it for the
+ display. When changep is set, check if the new register value has
+ changed with respect to the previous call. */
static enum tui_status
tui_get_register (struct gdbarch *gdbarch, struct frame_info *frame,
struct tui_data_element *data, int regnum, int *changedp)
#ifndef TUI_REGS_H
#define TUI_REGS_H
-#include "tui/tui-data.h" /* For struct tui_register_display_type. */
+#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 (struct reggroup *group);
if ((ret = tui_alloc_source_buffer (TUI_SRC_WIN)) == TUI_SUCCESS)
{
line_width = TUI_SRC_WIN->generic.width - 1;
- /* Take hilite (window border) into account, when calculating
- the number of lines */
+ /* Take hilite (window border) into account, when
+ calculating the number of lines. */
nlines = (line_no + (TUI_SRC_WIN->generic.height - 2)) - line_no;
desc = open_source_file (s);
if (desc < 0)
xfree (src->filename);
src->filename = xstrdup (s->filename);
- /* Determine the threshold for the length of the line
- and the offset to start the display. */
+ /* Determine the threshold for the length of the
+ line and the offset to start the display. */
offset = src->horizontal_offset;
threshold = (line_width - 1) + offset;
stream = fdopen (desc, FOPEN_RT);
struct tui_win_element *element = (struct tui_win_element *)
TUI_SRC_WIN->generic.content[cur_line];
- /* get the first character in the line */
+ /* Get the first character in the line. */
c = fgetc (stream);
if (offset == 0)
src_line = ((struct tui_win_element *)
TUI_SRC_WIN->generic.content[
cur_line])->which_element.source.line;
- /* Init the line with the line number */
+ /* Init the line with the line number. */
sprintf (src_line, "%-6d", cur_line_no);
cur_len = strlen (src_line);
i = cur_len -
}
src_line[cur_len] = (char) 0;
- /* Set whether element is the execution point and
- whether there is a break point on it. */
+ /* Set whether element is the execution point
+ and whether there is a break point on it. */
element->which_element.source.line_or_addr.loa =
LOA_LINE;
element->which_element.source.line_or_addr.u.line_no =
src_line[i] = '?';
}
else
- { /* Store the charcter in the line
- buffer. If it is a tab, then
- translate to the correct number of
- chars so we don't overwrite our
- buffer. */
+ { /* Store the charcter in the
+ line buffer. If it is a tab,
+ then translate to the correct
+ number of chars so we don't
+ overwrite our buffer. */
if (c == '\t')
{
int j, max_tab_len = tui_default_tab_len ();
src_line[i + 1] = 0;
}
else
- { /* If we have not reached EOL, then eat
- chars until we do */
+ { /* If we have not reached EOL, then
+ eat chars until we do. */
while (c != EOF && c != '\n' && c != '\r')
c = fgetc (stream);
/* Handle non-'\n' end-of-line. */
while (c != EOF && c != '\n' && c != '\r' &&
i < threshold && (c = fgetc (stream)));
}
- /* Now copy the line taking the offset into account */
+ /* Now copy the line taking the offset into
+ account. */
if (strlen (src_line) > offset)
strcpy (((struct tui_win_element *) TUI_SRC_WIN->generic.content[
cur_line])->which_element.source.line,
}
-/* elz: this function sets the contents of the source window to empty
+/* 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
+ source not being available. This function is called by
tui_erase_source_contents(), which in turn is invoked when the
source files cannot be accessed. */
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 */
+ /* Set to empty each line in the window, except for the one which
+ contains the message. */
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 */
+ /* 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. */
struct tui_win_element *element =
(struct tui_win_element *) win_info->generic.content[curr_line];
element->which_element.source.is_exec_point = FALSE;
element->which_element.source.has_break = FALSE;
- /* set the contents of the line to blank */
+ /* Set the contents of the line to blank. */
element->which_element.source.line[0] = (char) 0;
- /* if the current line is in the middle of the screen, then we
+ /* 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. */
+ 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 == (n_lines / 2 + 1))
{
l.u.line_no = content[0]->which_element.source.line_or_addr.u.line_no
+ num_to_scroll;
if (l.u.line_no > s->nlines)
- /*line = s->nlines - win_info->generic.content_size + 1; */
- /*elz: fix for dts 23398 */
+ /* line = s->nlines - win_info->generic.content_size + 1; */
+ /* elz: fix for dts 23398. */
l.u.line_no = content[0]->which_element.source.line_or_addr.u.line_no;
}
else
static void tui_update_command (char *, int);
\f
-/* Create the status line to display as much information as we
- can on this single line: target name, process number, current
- function, current line, current PC, SingleKey mode. */
+/* Create the status line to display as much information as we can on
+ this single line: target name, process number, current function,
+ current line, current PC, SingleKey mode. */
static char*
tui_make_status_line (struct tui_locator_element *loc)
{
}
}
- /* Now convert elements to string form */
+ /* Now convert elements to string form. */
pname = loc->proc_name;
- /* Now create the locator line from the string version
- of the elements. We could use sprintf() here but
- that wouldn't ensure that we don't overrun the size
- of the allocated buffer. strcat_to_buf() will. */
+ /* Now create the locator line from the string version of the
+ elements. We could use sprintf() here but that wouldn't ensure
+ that we don't overrun the size of the allocated buffer.
+ strcat_to_buf() will. */
*string = (char) 0;
if (target_width > 0)
strcat_to_buf (string, status_size, " ");
}
- /* procedure/class name */
+ /* Procedure/class name. */
if (proc_width > 0)
{
if (strlen (pname) > proc_width)
return string;
}
-/* Get a printable name for the function at the address.
- The symbol name is demangled if demangling is turned on.
- Returns a pointer to a static area holding the result. */
+/* Get a printable name for the function at the address. The symbol
+ name is demangled if demangling is turned on. Returns a pointer to
+ a static area holding the result. */
static char*
tui_get_function_from_frame (struct frame_info *fi)
{
print_address_symbolic (get_frame_pc (fi), stream, demangle, "");
p = tui_file_get_strbuf (stream);
- /* Use simple heuristics to isolate the function name. The symbol can
- be demangled and we can have function parameters. Remove them because
- the status line is too short to display them. */
+ /* Use simple heuristics to isolate the function name. The symbol
+ can be demangled and we can have function parameters. Remove
+ them because the status line is too short to display them. */
if (*p == '<')
p++;
strncpy (name, p, sizeof (name));
}
-/* Tui internal configuration variables. These variables are
- updated by tui_update_variables to reflect the tui configuration
+/* Tui internal configuration variables. These variables are updated
+ by tui_update_variables to reflect the tui configuration
variables. */
chtype tui_border_vline;
chtype tui_border_hline;
add_prefix_cmd ("tui", class_tui, set_tui_cmd,
_("TUI configuration variables"),
&tui_setlist, "set tui ",
- 0/*allow-unknown*/, &setlist);
+ 0 /* allow-unknown */, &setlist);
add_prefix_cmd ("tui", class_tui, show_tui_cmd,
_("TUI configuration variables"),
&tui_showlist, "show tui ",
- 0/*allow-unknown*/, &showlist);
+ 0 /* allow-unknown */, &showlist);
add_com ("refresh", class_tui, tui_refresh_all_command,
_("Refresh the terminal display.\n"));
}
-/* Set the logical focus to win_info. */
+/* Set the logical focus to win_info. */
void
tui_set_win_focus_to (struct tui_win_info *win_info)
{
}
-/* Scroll a window. Arguments are passed through a va_list. */
+/* Scroll a window. Arguments are passed through a va_list. */
void
tui_scroll (enum tui_scroll_direction direction,
struct tui_win_info *win_to_scroll,
#ifdef HAVE_RESIZE_TERM
resize_term (screenheight, screenwidth);
#endif
- /* turn keypad off while we resize */
+ /* Turn keypad off while we resize. */
if (win_with_focus != TUI_CMD_WIN)
keypad (TUI_CMD_WIN->generic.handle, FALSE);
tui_update_gdb_sizes ();
else
cmd_split_diff++;
}
- /* now adjust each window */
+ /* Now adjust each window. */
clear ();
refresh ();
switch (cur_layout)
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 */
+ /* Check for invalid heights. */
if (height_diff == 0)
new_height = first_win->generic.height;
else if ((first_win->generic.height + split_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 */
+ /* Change the first window's height/width. */
+ /* Check for invalid heights. */
if (height_diff == 0)
new_height = first_win->generic.height;
else if ((first_win->generic.height +
locator->width += width_diff;
- /* Change the second window's height/width */
- /* check for invalid heights */
+ /* Change the second window's height/width. */
+ /* Check for invalid heights. */
if (height_diff == 0)
new_height = second_win->generic.height;
else if ((first_win->generic.height +
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 */
+ /* Change the command window's height/width. */
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);
break;
}
/*
- ** Now remove all invisible windows, and their content so that they get
- ** created again when called for with the new size
+ ** Now remove all invisible windows, and their content so that
+ ** they get created again when called for with the new size.
*/
for (win_type = SRC_WIN; (win_type < MAX_MAJOR_WINDOWS); win_type++)
{
}
}
tui_set_win_resized_to (TRUE);
- /* turn keypad back on, unless focus is in the command window */
+ /* Turn keypad back on, unless focus is in the command
+ window. */
if (win_with_focus != TUI_CMD_WIN)
keypad (TUI_CMD_WIN->generic.handle, TRUE);
}
}
-/* Set the height of the specified window. */
+/* Set the height of the specified window. */
static void
tui_set_tab_width_command (char *arg, int from_tty)
{
}
-/* Set the height of the specified window. */
+/* Set the height of the specified window. */
static void
tui_set_win_height (char *arg, int from_tty)
{
*buf_ptr = (char) 0;
/*
- ** Validate the window name
+ ** Validate the window name.
*/
for (i = 0; i < strlen (wname); i++)
wname[i] = toupper (wname[i]);
The window name specified must be valid and visible.\n"));
else
{
- /* Process the size */
+ /* Process the size. */
while (*(++buf_ptr) == ' ')
;
new_height = win_info->generic.height + input_no;
/*
** Now change the window's height, and adjust all
- ** other windows around it
+ ** other windows around it.
*/
if (tui_adjust_win_heights (win_info,
new_height) == TUI_FAILURE)
printf_filtered (WIN_HEIGHT_USAGE);
}
-/* Set the height of the specified window, with va_list. */
+/* Set the height of the specified window, with va_list. */
static void
tui_set_win_height_command (char *arg, int from_tty)
{
/* XDB Compatibility command for setting the window height. This will
- increase or decrease the command window by the specified amount. */
+ increase or decrease the command window by the specified
+ amount. */
static void
tui_xdb_set_win_height (char *arg, int from_tty)
{
int input_no = atoi (arg);
if (input_no > 0)
- { /* Add 1 for the locator */
+ { /* Add 1 for the locator. */
int new_height = tui_term_height () - (input_no + 1);
if (!new_height_ok (tui_win_list[CMD_WIN], new_height) ||
second_win = (tui_source_windows ())->list[0];
}
if (primary_win_info == TUI_CMD_WIN)
- { /*
- ** Split the change in height accross the 1st & 2nd windows
- ** adjusting them as well.
- */
- int first_split_diff = diff / 2; /* subtract the locator */
+ { /*
+ ** Split the change in height accross the 1st & 2nd
+ ** windows, adjusting them as well.
+ */
+ int first_split_diff = diff / 2; /* Subtract the locator. */
int second_split_diff = first_split_diff;
if (diff % 2)
second_split_diff++;
}
}
- /* make sure that the minimum hieghts are honored */
+ /* Make sure that the minimum hieghts are
+ honored. */
while ((first_win->generic.height + first_split_diff) < 3)
{
first_split_diff++;
else
{
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 there is no way to increase the command window
+ ** take real estate from the 1st or 2nd window.
+ */
if ((TUI_CMD_WIN->generic.height + diff) < 1)
{
int i;
/* Function make the target window (and auxillary windows associated
- with the targer) invisible, and set the new height and location. */
+ with the targer) invisible, and set the new height and
+ location. */
static void
make_invisible_and_set_new_height (struct tui_win_info *win_info, int height)
{
if (win_info != TUI_CMD_WIN)
win_info->generic.viewport_height--;
- /* Now deal with the auxillary windows associated with win_info */
+ /* Now deal with the auxillary windows associated with win_info. */
switch (win_info->generic.type)
{
case SRC_WIN:
}
break;
case DATA_WIN:
- /* delete all data item windows */
+ /* Delete all data item windows. */
for (i = 0; i < win_info->generic.content_size; i++)
{
gen_win_info = (struct tui_gen_win_info *) & ((struct tui_win_element *)
new_height <= (tui_term_height () - 2) &&
new_height >= MIN_WIN_HEIGHT));
if (ok)
- { /* check the total height */
+ { /* Check the total height. */
struct tui_win_info *win_info;
if (primary_win_info == TUI_CMD_WIN)
*/
total_height = cur_total_height =
(first_win->generic.height + second_win->generic.height - 1)
- + TUI_CMD_WIN->generic.height + 1 /*locator */ ;
+ + TUI_CMD_WIN->generic.height + 1; /* Locator. */
if (primary_win_info == TUI_CMD_WIN)
{
- /* locator included since first & second win share a line */
+ /* Locator included since first & second win share a line. */
ok = ((first_win->generic.height +
second_win->generic.height + diff) >=
(MIN_WIN_HEIGHT * 2) &&
/*
** First see if we can increase/decrease the command
** window. And make sure that the command window is
- ** at least 1 line
+ ** at least 1 line.
*/
ok = ((TUI_CMD_WIN->generic.height + diff) > 0);
if (!ok)
- { /*
- ** Looks like we have to increase/decrease one of
- ** the other windows
- */
+ { /*
+ ** Looks like we have to increase/decrease one of
+ ** the other windows.
+ */
if (primary_win_info == first_win)
ok = (second_win->generic.height + diff) >= min_height;
else
/*
** First set up the default window to scroll, in case there is no
- ** window name arg
+ ** window name arg.
*/
if (arg != (char *) NULL)
{
char *buf, *buf_ptr;
- /* process the number of lines to scroll */
+ /* Process the number of lines to scroll. */
buf = buf_ptr = xstrdup (arg);
if (isdigit (*buf_ptr))
{
*num_to_scroll = atoi (num_str);
}
- /* process the window name if one is specified */
+ /* Process the window name if one is specified. */
if (buf_ptr != (char *) NULL)
{
char *wname;
else
wname = "?";
- /* Validate the window name */
+ /* Validate the window name. */
for (i = 0; i < strlen (wname); i++)
wname[i] = toupper (wname[i]);
*win_to_scroll = tui_partial_win_by_name (wname);
/*
** First see if there is a register on line_no, and if so, set the
- ** first element number
+ ** first element number.
*/
if ((first_element_no = tui_first_reg_element_no_inline (line_no)) == -1)
- { /*
- ** Looking at the general data, the 1st element on line_no
- */
+ { /*
+ ** Looking at the general data, the 1st element on line_no.
+ */
}
return first_element_no;
tui_check_and_display_highlight_if_needed (TUI_DATA_WIN);
tui_display_registers_from (0);
/*
- ** Then display the other data
+ ** Then display the other data.
*/
if (TUI_DATA_WIN->detail.data_display_info.data_content !=
(tui_win_content) NULL &&
tui_check_and_display_highlight_if_needed (TUI_DATA_WIN);
- /* there is no general data, force regs to display (if there are any) */
+ /* There is no general data, force regs to display (if there are
+ any). */
if (TUI_DATA_WIN->detail.data_display_info.data_content_count <= 0)
tui_display_registers_from_line (_line_no, TRUE);
else
int regs_last_line = tui_last_regs_line_no ();
- /* display regs if we can */
+ /* Display regs if we can. */
if (tui_display_registers_from_line (_line_no, FALSE) < 0)
- { /*
- ** _line_no is past the regs display, so calc where the
- ** start data element is
- */
+ { /*
+ ** _line_no is past the regs display, so calc where the
+ ** start data element is.
+ */
if (regs_last_line < _line_no)
- { /* figure out how many lines each element is to obtain
- the start element_no */
+ { /* Figure out how many lines each element is to obtain
+ the start element_no. */
}
}
else
- { /*
- ** calculate the starting element of the data display, given
- ** regs_last_line and how many lines each element is, up to
- ** _line_no
- */
+ { /*
+ ** Calculate the starting element of the data display,
+ ** given regs_last_line and how many lines each element
+ ** is, up to _line_no.
+ */
}
- /* Now display the data , starting at element_no */
+ /* Now display the data , starting at element_no. */
}
}
-/* Display data starting at element element_no. */
+/* Display data starting at element element_no. */
void
tui_display_data_from (int element_no, int reuse_windows)
{
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 first_line from the element number */
+ { /* Calculate the first_line from the element number. */
}
if (first_line >= 0)
{
int first_element = tui_first_data_item_displayed ();
- if (first_element >= 0) /* re-use existing windows */
+ if (first_element >= 0) /* Re-use existing windows. */
tui_display_data_from (first_element, TRUE);
}
}
-/* 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
tui_check_data_values (struct frame_info *frame)
{
tui_check_register_values (frame);
- /* Now check any other data values that there are */
+ /* Now check any other data values that there are. */
if (TUI_DATA_WIN != NULL && TUI_DATA_WIN->generic.is_visible)
{
int i;
}
-/* Scroll the data window vertically forward or backward. */
+/* Scroll the data window vertically forward or backward. */
void
tui_vertical_data_scroll (enum tui_scroll_direction scroll_direction, int num_to_scroll)
{
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
- */
+ { /* Calculate the first line from the element number which is in
+ the general data content. */
}
if (first_line >= 0)
** PUBLIC FUNCTIONS
***********************/
-/* Refresh the window. */
+/* Refresh the window. */
void
tui_refresh_win (struct tui_gen_win_info *win_info)
{
}
else if (win_info->type == CMD_WIN)
{
- /* Do nothing */
+ /* Do nothing. */
}
else
{
}
-/* Function to delete the curses window, checking for NULL. */
+/* Function to delete the curses window, checking for NULL. */
void
tui_delete_win (WINDOW *window)
{
static void
make_visible (struct tui_gen_win_info *win_info, int visible)
{
- /* Don't tear down/recreate command window */
+ /* Don't tear down/recreate command window. */
if (win_info->type == CMD_WIN)
return;
}
-/* Makes all windows invisible (except the command and locator windows). */
+/* Makes all windows invisible (except the command and locator
+ windows). */
static void
make_all_visible (int visible)
{
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
+ ** win if we don't have a split layout.
*/
if (tui_win_with_focus () == TUI_DISASM_WIN &&
tui_current_layout () != SRC_DISASSEM_COMMAND)
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 */
+ /* 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. */
tui_set_source_content_nil (win_info, no_src_str);
}
}
-/* Set or clear the has_break flag in the line whose line is line_no. */
+/* Set or clear the has_break flag in the line whose line is
+ line_no. */
+
void
tui_set_is_exec_point_at (struct tui_line_or_address l, struct tui_win_info *win_info)
{
}
-/* Scan the source window and the breakpoints to update the
- has_break information for each line.
- Returns 1 if something changed and the execution window
- must be refreshed. */
+/* Scan the source window and the breakpoints to update the has_break
+ information for each line.
+
+ Returns 1 if something changed and the execution window must be
+ refreshed. */
+
int
tui_update_breakpoint_info (struct tui_win_info *win, int current_only)
{
char *src_line_buf;
int i, line_width, max_lines;
- max_lines = win_info->generic.height; /* less the highlight box */
+ 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
gdb_stderr);
return TUI_FAILURE;
}
- /* allocate the content list */
+ /* Allocate the content list. */
if ((win_info->generic.content =
(void **) tui_alloc_content (max_lines, SRC_WIN)) == NULL)
{
/* Constant definitions. */
-#define SCROLL_THRESHOLD 2 /* threshold for lazy scroll */
+#define SCROLL_THRESHOLD 2 /* Threshold for lazy scroll. */
#endif
const char *cmd;
};
-/* Key mapping to gdb commands when the TUI is using the single key mode. */
+/* Key mapping to gdb commands when the TUI is using the single key
+ mode. */
static const struct tui_char_command tui_commands[] = {
{ 'c', "continue" },
{ 'd', "down" },
tui_enable ();
}
- /* Clear the readline in case switching occurred in middle of something. */
+ /* Clear the readline in case switching occurred in middle of
+ something. */
if (rl_end)
rl_kill_text (0, rl_end);
/* Since we left the curses mode, the terminal mode is restored to
some previous state. That state may not be suitable for readline
to work correctly (it may be restored in line mode). We force an
- exit of the current readline so that readline is re-entered and it
- will be able to setup the terminal for its needs. By re-entering
- in readline, we also redisplay its prompt in the non-curses mode. */
+ exit of the current readline so that readline is re-entered and
+ it will be able to setup the terminal for its needs. By
+ re-entering in readline, we also redisplay its prompt in the
+ non-curses mode. */
rl_newline (1, '\n');
- /* Make sure the \n we are returning does not repeat the last command. */
+ /* Make sure the \n we are returning does not repeat the last
+ command. */
dont_repeat ();
return 0;
}
/* TUI readline command.
Change the TUI layout to show a next layout.
This function is bound to CTRL-X 2. It is intended to provide
- a functionality close to the Emacs split-window command. We always
- show two windows (src+asm), (src+regs) or (asm+regs). */
+ a functionality close to the Emacs split-window command. We
+ always show two windows (src+asm), (src+regs) or (asm+regs). */
static int
tui_rl_change_windows (int notused1, int notused2)
{
if (!tui_active)
- tui_rl_switch_mode (0/*notused*/, 0/*notused*/);
+ tui_rl_switch_mode (0 /* notused */, 0 /* notused */);
if (tui_active)
{
new_layout = tui_current_layout ();
- /* Select a new layout to have a rolling layout behavior
- with always two windows (except when undefined). */
+ /* Select a new layout to have a rolling layout behavior with
+ always two windows (except when undefined). */
switch (new_layout)
{
case SRC_COMMAND:
tui_rl_delete_other_windows (int notused1, int notused2)
{
if (!tui_active)
- tui_rl_switch_mode (0/*notused*/, 0/*notused*/);
+ tui_rl_switch_mode (0 /* notused */, 0 /* notused */);
if (tui_active)
{
struct tui_win_info *win_info;
if (!tui_active)
- tui_rl_switch_mode (0/*notused*/, 0/*notused*/);
+ tui_rl_switch_mode (0 /* notused */, 0 /* notused */);
win_info = tui_next_win (tui_win_with_focus ());
if (win_info)
{
if (tui_commands[i].key == key)
{
- /* Must save the command because it can be modified
- by execute_command. */
+ /* Must save the command because it can be modified by
+ execute_command. */
char *cmd = alloca (strlen (tui_commands[i].cmd) + 1);
strcpy (cmd, tui_commands[i].cmd);
execute_command (cmd, TRUE);
tui_rl_next_keymap (int notused1, int notused2)
{
if (!tui_active)
- tui_rl_switch_mode (0/*notused*/, 0/*notused*/);
+ 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);
return 0;
}
-/* Change the TUI key mode by installing the appropriate readline keymap. */
+/* Change the TUI key mode by installing the appropriate readline
+ keymap. */
void
tui_set_key_mode (enum tui_key_mode mode)
{
cbreak ();
noecho ();
- /*timeout (1);*/
+ /* timeout (1); */
nodelay(w, FALSE);
nl();
keypad (w, TRUE);
}
#if 0
-/* Solaris <sys/termios.h> defines CTRL. */
+/* Solaris <sys/termios.h> defines CTRL. */
#ifndef CTRL
#define CTRL(x) (x & ~0140)
#endif
struct termio mode;
/*
- ** reset the teletype mode bits to a sensible state.
+ ** Reset the teletype mode bits to a sensible state.
** Copied tset.c
*/
#if defined (TIOCGETC)
tbuf.t_startc = CHK (tbuf.t_startc, CTRL ('Q'));
tbuf.t_stopc = CHK (tbuf.t_stopc, CTRL ('S'));
tbuf.t_eofc = CHK (tbuf.t_eofc, CTRL ('D'));
- /* brkc is left alone */
+ /* brkc is left alone. */
ioctl (FILEDES, TIOCSETC, &tbuf);
#endif /* TIOCGETC */
mode.sg_flags &= ~(RAW
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 */
+ /* Make sure that the source window is displayed. */
tui_add_win_to_layout (SRC_WIN);
tui_update_source_windows_with_line (cursal.symtab, line);
TUI_FAILURE
};
-/* Types of windows */
+/* Types of windows. */
enum tui_win_type
{
SRC_WIN = 0,
/* SingleKey mode with some keys bound to gdb commands. */
TUI_SINGLE_KEY_MODE,
- /* Read/edit one command and return to SingleKey after it's processed. */
+ /* Read/edit one command and return to SingleKey after it's
+ processed. */
TUI_ONE_COMMAND_MODE
};
extern enum tui_key_mode tui_current_key_mode;
-/* Change the TUI key mode by installing the appropriate readline keymap. */
+/* Change the TUI key mode by installing the appropriate readline
+ keymap. */
extern void tui_set_key_mode (enum tui_key_mode mode);
extern int tui_active;