* [OB] tui, coding standard
@ 2007-08-15 0:19 msnyder
2007-08-15 6:52 ` Mark Kettenis
0 siblings, 1 reply; 4+ messages in thread
From: msnyder @ 2007-08-15 0:19 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 22 bytes --]
&& and || operators.
[-- Attachment #2: bool1.txt --]
[-- Type: text/plain, Size: 40422 bytes --]
2007-08-14 Michael Snyder <msnyder@access-company.com>
* tui-command.c, tui-data.c, tui-disasm.c, tui-file.c, tui-io.c,
tui-layout.c, tui-regs.c, tui-source.c, tui-win.c, tui-windata.c,
tui-wingeneral.c, tui-winsource.c: Coding standard, && and ||
go at beginning of new line.
Index: tui/tui-command.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tui-command.c,v
retrieving revision 1.17
diff -p -r1.17 tui-command.c
*** tui/tui-command.c 14 Aug 2007 21:39:22 -0000 1.17
--- tui/tui-command.c 15 Aug 2007 00:16:04 -0000
*************** tui_dispatch_ctrl_char (unsigned int ch)
*** 73,79 ****
{
for (i = 0; term[i]; i++)
term[i] = toupper (term[i]);
! if ((strcmp (term, "XTERM") == 0) && key_is_start_sequence (ch))
{
unsigned int page_ch = 0;
unsigned int tmp_char;
--- 73,80 ----
{
for (i = 0; term[i]; i++)
term[i] = toupper (term[i]);
! if ((strcmp (term, "XTERM") == 0)
! && key_is_start_sequence (ch))
{
unsigned int page_ch = 0;
unsigned int tmp_char;
Index: tui/tui-data.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tui-data.c,v
retrieving revision 1.20
diff -p -r1.20 tui-data.c
*** tui/tui-data.c 14 Aug 2007 23:50:39 -0000 1.20
--- tui/tui-data.c 15 Aug 2007 00:16:04 -0000
*************** tui_next_win (struct tui_win_info *cur_w
*** 342,348 ****
type = cur_win->generic.type + 1;
while (type != cur_win->generic.type && (next_win == NULL))
{
! if (tui_win_list[type] && tui_win_list[type]->generic.is_visible)
next_win = tui_win_list[type];
else
{
--- 342,349 ----
type = cur_win->generic.type + 1;
while (type != cur_win->generic.type && (next_win == NULL))
{
! if (tui_win_list[type]
! && tui_win_list[type]->generic.is_visible)
next_win = tui_win_list[type];
else
{
*************** tui_partial_win_by_name (char *name)
*** 401,408 ****
if (tui_win_list[i] != 0)
{
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++;
--- 402,409 ----
if (tui_win_list[i] != 0)
{
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++;
Index: tui/tui-disasm.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tui-disasm.c,v
retrieving revision 1.23
diff -p -r1.23 tui-disasm.c
*** tui/tui-disasm.c 14 Aug 2007 23:50:39 -0000 1.23
--- tui/tui-disasm.c 15 Aug 2007 00:16:04 -0000
*************** tui_show_disassem (CORE_ADDR start_addr)
*** 283,289 ****
/* 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);
return;
--- 283,290 ----
/* 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);
return;
Index: tui/tui-file.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tui-file.c,v
retrieving revision 1.16
diff -p -r1.16 tui-file.c
*** tui/tui-file.c 14 Aug 2007 21:20:09 -0000 1.16
--- tui/tui-file.c 15 Aug 2007 00:16:04 -0000
*************** tui_file_delete (struct ui_file *file)
*** 78,85 ****
if (tmpstream->ts_magic != &tui_file_magic)
internal_error (__FILE__, __LINE__,
_("tui_file_delete: bad magic number"));
! if ((tmpstream->ts_streamtype == astring) &&
! (tmpstream->ts_strbuf != NULL))
{
xfree (tmpstream->ts_strbuf);
}
--- 78,85 ----
if (tmpstream->ts_magic != &tui_file_magic)
internal_error (__FILE__, __LINE__,
_("tui_file_delete: bad magic number"));
! if ((tmpstream->ts_streamtype == astring)
! && (tmpstream->ts_strbuf != NULL))
{
xfree (tmpstream->ts_strbuf);
}
Index: tui/tui-io.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tui-io.c,v
retrieving revision 1.16
diff -p -r1.16 tui-io.c
*** tui/tui-io.c 14 Aug 2007 23:50:39 -0000 1.16
--- tui/tui-io.c 15 Aug 2007 00:16:04 -0000
*************** key_is_command_char (int ch)
*** 73,79 ****
|| (ch == KEY_LEFT) || (ch == KEY_RIGHT)
|| (ch == KEY_UP) || (ch == KEY_DOWN)
|| (ch == KEY_SF) || (ch == KEY_SR)
! || (ch == (int)'\f') || key_is_start_sequence (ch));
}
/* Use definition from readline 4.3. */
--- 73,80 ----
|| (ch == KEY_LEFT) || (ch == KEY_RIGHT)
|| (ch == KEY_UP) || (ch == KEY_DOWN)
|| (ch == KEY_SF) || (ch == KEY_SR)
! || (ch == (int)'\f')
! || key_is_start_sequence (ch));
}
/* Use definition from readline 4.3. */
*************** printable_part (char *pathname)
*** 329,335 ****
temp = rl_filename_completion_desired ? strrchr (pathname, '/') : (char *)NULL;
#if defined (__MSDOS__)
! if (rl_filename_completion_desired && temp == 0 && isalpha (pathname[0]) && pathname[1] == ':')
temp = pathname + 1;
#endif
return (temp ? ++temp : pathname);
--- 330,338 ----
temp = rl_filename_completion_desired ? strrchr (pathname, '/') : (char *)NULL;
#if defined (__MSDOS__)
! if (rl_filename_completion_desired
! && temp == 0 && isalpha (pathname[0])
! && pathname[1] == ':')
temp = pathname + 1;
#endif
return (temp ? ++temp : pathname);
Index: tui/tui-layout.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tui-layout.c,v
retrieving revision 1.29
diff -p -r1.29 tui-layout.c
*** tui/tui-layout.c 14 Aug 2007 23:50:39 -0000 1.29
--- tui/tui-layout.c 15 Aug 2007 00:16:04 -0000
*************** show_layout (enum tui_layout_type layout
*** 91,97 ****
source/asm. */
tui_free_all_source_wins_content ();
tui_clear_source_windows ();
! if (layout == SRC_DATA_COMMAND || layout == DISASSEM_DATA_COMMAND)
{
show_data (layout);
tui_refresh_all (tui_win_list);
--- 91,98 ----
source/asm. */
tui_free_all_source_wins_content ();
tui_clear_source_windows ();
! if (layout == SRC_DATA_COMMAND
! || layout == DISASSEM_DATA_COMMAND)
{
show_data (layout);
tui_refresh_all (tui_win_list);
*************** tui_set_layout (enum tui_layout_type lay
*** 137,169 ****
{
enum tui_status status = TUI_SUCCESS;
! if (layout_type != UNDEFINED_LAYOUT || regs_display_type != TUI_UNDEFINED_REGS)
{
! 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 *win_with_focus = tui_win_with_focus ();
struct tui_layout_def *layout_def = tui_layout_def ();
! if (layout_type == UNDEFINED_LAYOUT &&
! regs_display_type != TUI_UNDEFINED_REGS)
{
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
new_layout = layout_type;
! 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 (new_layout != cur_layout)
{
--- 138,174 ----
{
enum tui_status status = TUI_SUCCESS;
! if (layout_type != UNDEFINED_LAYOUT
! || regs_display_type != TUI_UNDEFINED_REGS)
{
! 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 *win_with_focus = tui_win_with_focus ();
struct tui_layout_def *layout_def = tui_layout_def ();
! if (layout_type == UNDEFINED_LAYOUT
! && regs_display_type != TUI_UNDEFINED_REGS)
{
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
new_layout = layout_type;
! 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 (new_layout != cur_layout)
{
*************** tui_set_layout (enum tui_layout_type lay
*** 241,249 ****
/*
* Now update the window content.
*/
! if (!regs_populate &&
! (new_layout == SRC_DATA_COMMAND ||
! new_layout == DISASSEM_DATA_COMMAND))
tui_display_all_data ();
tui_update_source_windows_with_addr (addr);
--- 246,254 ----
/*
* Now update the window content.
*/
! if (!regs_populate
! && (new_layout == SRC_DATA_COMMAND
! || new_layout == DISASSEM_DATA_COMMAND))
tui_display_all_data ();
tui_update_source_windows_with_addr (addr);
*************** tui_add_win_to_layout (enum tui_win_type
*** 271,279 ****
switch (type)
{
case SRC_WIN:
! if (cur_layout != SRC_COMMAND &&
! cur_layout != SRC_DISASSEM_COMMAND &&
! cur_layout != SRC_DATA_COMMAND)
{
tui_clear_source_windows_detail ();
if (cur_layout == DISASSEM_DATA_COMMAND)
--- 276,284 ----
switch (type)
{
case SRC_WIN:
! if (cur_layout != SRC_COMMAND
! && cur_layout != SRC_DISASSEM_COMMAND
! && cur_layout != SRC_DATA_COMMAND)
{
tui_clear_source_windows_detail ();
if (cur_layout == DISASSEM_DATA_COMMAND)
*************** tui_add_win_to_layout (enum tui_win_type
*** 283,291 ****
}
break;
case DISASSEM_WIN:
! if (cur_layout != DISASSEM_COMMAND &&
! cur_layout != SRC_DISASSEM_COMMAND &&
! cur_layout != DISASSEM_DATA_COMMAND)
{
tui_clear_source_windows_detail ();
if (cur_layout == SRC_DATA_COMMAND)
--- 288,296 ----
}
break;
case DISASSEM_WIN:
! if (cur_layout != DISASSEM_COMMAND
! && cur_layout != SRC_DISASSEM_COMMAND
! && cur_layout != DISASSEM_DATA_COMMAND)
{
tui_clear_source_windows_detail ();
if (cur_layout == SRC_DATA_COMMAND)
*************** tui_add_win_to_layout (enum tui_win_type
*** 295,302 ****
}
break;
case DATA_WIN:
! if (cur_layout != SRC_DATA_COMMAND &&
! cur_layout != DISASSEM_DATA_COMMAND)
{
if (cur_layout == DISASSEM_COMMAND)
show_layout (DISASSEM_DATA_COMMAND);
--- 300,307 ----
}
break;
case DATA_WIN:
! if (cur_layout != SRC_DATA_COMMAND
! && cur_layout != DISASSEM_DATA_COMMAND)
{
if (cur_layout == DISASSEM_COMMAND)
show_layout (DISASSEM_DATA_COMMAND);
*************** tui_set_layout_for_display_command (cons
*** 424,430 ****
buf_ptr[i] = toupper (buf_ptr[i]);
/* First check for ambiguous input. */
! if (strlen (buf_ptr) <= 1 && (*buf_ptr == 'S' || *buf_ptr == '$'))
{
warning (_("Ambiguous command input."));
status = TUI_FAILURE;
--- 429,436 ----
buf_ptr[i] = toupper (buf_ptr[i]);
/* First check for ambiguous input. */
! if (strlen (buf_ptr) <= 1
! && (*buf_ptr == 'S' || *buf_ptr == '$'))
{
warning (_("Ambiguous command input."));
status = TUI_FAILURE;
*************** tui_set_layout_for_display_command (cons
*** 437,449 ****
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 (cur_layout == SRC_COMMAND || cur_layout == SRC_DATA_COMMAND)
new_layout = SRC_DATA_COMMAND;
else
new_layout = DISASSEM_DATA_COMMAND;
--- 443,456 ----
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 (cur_layout == SRC_COMMAND
! || cur_layout == SRC_DATA_COMMAND)
new_layout = SRC_DATA_COMMAND;
else
new_layout = DISASSEM_DATA_COMMAND;
*************** tui_set_layout_for_display_command (cons
*** 455,464 ****
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 !=
! TUI_SFLOAT_REGS &&
! TUI_DATA_WIN->detail.data_display_info.regs_display_type !=
! TUI_DFLOAT_REGS)
dpy_type = TUI_SFLOAT_REGS;
else
dpy_type =
--- 462,469 ----
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 != TUI_SFLOAT_REGS
! && TUI_DATA_WIN->detail.data_display_info.regs_display_type != TUI_DFLOAT_REGS)
dpy_type = TUI_SFLOAT_REGS;
else
dpy_type =
Index: tui/tui-regs.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tui-regs.c,v
retrieving revision 1.27
diff -p -r1.27 tui-regs.c
*** tui/tui-regs.c 14 Aug 2007 23:50:39 -0000 1.27
--- tui/tui-regs.c 15 Aug 2007 00:16:04 -0000
*************** tui_display_registers_from (int start_el
*** 321,328 ****
{
struct tui_data_info *display_info = &TUI_DATA_WIN->detail.data_display_info;
! if (display_info->regs_content != (tui_win_content) NULL &&
! display_info->regs_content_count > 0)
{
int i = start_element_no;
int j, value_chars_wide, item_win_width, cur_y;
--- 321,328 ----
{
struct tui_data_info *display_info = &TUI_DATA_WIN->detail.data_display_info;
! if (display_info->regs_content != (tui_win_content) NULL
! && display_info->regs_content_count > 0)
{
int i = start_element_no;
int j, value_chars_wide, item_win_width, cur_y;
*************** tui_display_registers_from (int start_el
*** 365,376 ****
/* Now create each data "sub" window, and write the display into
it. */
cur_y = 1;
! while (i < display_info->regs_content_count &&
! cur_y <= TUI_DATA_WIN->generic.viewport_height)
{
for (j = 0;
! (j < display_info->regs_column_count &&
! i < display_info->regs_content_count); j++)
{
struct tui_gen_win_info *data_item_win;
struct tui_data_element *data_element_ptr;
--- 365,377 ----
/* Now create each data "sub" window, and write the display into
it. */
cur_y = 1;
! while (i < display_info->regs_content_count
! && cur_y <= TUI_DATA_WIN->generic.viewport_height)
{
for (j = 0;
! j < display_info->regs_column_count
! && i < display_info->regs_content_count;
! j++)
{
struct tui_gen_win_info *data_item_win;
struct tui_data_element *data_element_ptr;
*************** void
*** 420,427 ****
tui_display_reg_element_at_line (int start_element_no,
int start_line_no)
{
! 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)
{
int element_no = start_element_no;
--- 421,428 ----
tui_display_reg_element_at_line (int start_element_no,
int start_line_no)
{
! 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)
{
int element_no = start_element_no;
*************** tui_display_reg_element_at_line (int sta
*** 438,445 ****
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)
element_no = tui_first_reg_element_no_inline (first_line_on_last_page);
}
tui_display_registers_from (element_no);
--- 439,446 ----
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)
element_no = tui_first_reg_element_no_inline (first_line_on_last_page);
}
tui_display_registers_from (element_no);
*************** tui_display_registers_from_line (int lin
*** 496,507 ****
void
tui_check_register_values (struct frame_info *frame)
{
! if (TUI_DATA_WIN != NULL && TUI_DATA_WIN->generic.is_visible)
{
struct tui_data_info *display_info
= &TUI_DATA_WIN->detail.data_display_info;
! if (display_info->regs_content_count <= 0 && display_info->display_regs)
tui_show_registers (display_info->current_group);
else
{
--- 497,510 ----
void
tui_check_register_values (struct frame_info *frame)
{
! if (TUI_DATA_WIN != NULL
! && TUI_DATA_WIN->generic.is_visible)
{
struct tui_data_info *display_info
= &TUI_DATA_WIN->detail.data_display_info;
! if (display_info->regs_content_count <= 0
! && display_info->display_regs)
tui_show_registers (display_info->current_group);
else
{
Index: tui/tui-source.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tui-source.c,v
retrieving revision 1.19
diff -p -r1.19 tui-source.c
*** tui/tui-source.c 14 Aug 2007 23:50:39 -0000 1.19
--- tui/tui-source.c 15 Aug 2007 00:16:04 -0000
*************** tui_set_source_content (struct symtab *s
*** 146,162 ****
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
&& cur_line_no == ((struct tui_win_element *)
! locator->content[0])->which_element.locator.line_no);
if (c != EOF)
{
i = strlen (src_line) - 1;
do
{
! if ((c != '\n') &&
! (c != '\r') && (++i < threshold))
{
if (c < 040 && c != '\t')
{
--- 146,162 ----
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
&& cur_line_no == ((struct tui_win_element *)
! locator->content[0])->which_element.locator.line_no);
if (c != EOF)
{
i = strlen (src_line) - 1;
do
{
! if ((c != '\n') && (c != '\r')
! && (++i < threshold))
{
if (c < 040 && c != '\t')
{
*************** tui_set_source_content (struct symtab *s
*** 178,187 ****
{
int j, max_tab_len = tui_default_tab_len ();
! for (j = i - (
! (i / max_tab_len) * max_tab_len);
! ((j < max_tab_len) &&
! i < threshold);
i++, j++)
src_line[i] = ' ';
i--;
--- 178,186 ----
{
int j, max_tab_len = tui_default_tab_len ();
! for (j = i - ((i / max_tab_len) * max_tab_len);
! j < max_tab_len
! && i < threshold;
i++, j++)
src_line[i] = ' ';
i--;
*************** tui_set_source_content (struct symtab *s
*** 197,204 ****
while (c != EOF && c != '\n' && c != '\r')
c = fgetc (stream);
/* Handle non-'\n' end-of-line. */
! if (c == '\r' &&
! (c = fgetc (stream)) != '\n' && c != EOF)
{
ungetc (c, stream);
c = '\r';
--- 196,204 ----
while (c != EOF && c != '\n' && c != '\r')
c = fgetc (stream);
/* Handle non-'\n' end-of-line. */
! if (c == '\r'
! && (c = fgetc (stream)) != '\n'
! && c != EOF)
{
ungetc (c, stream);
c = '\r';
*************** tui_set_source_content (struct symtab *s
*** 206,213 ****
}
}
! while (c != EOF && c != '\n' && c != '\r' &&
! i < threshold && (c = fgetc (stream)));
}
/* Now copy the line taking the offset into
account. */
--- 206,214 ----
}
}
! while (c != EOF && c != '\n' && c != '\r'
! && i < threshold
! && (c = fgetc (stream)));
}
/* Now copy the line taking the offset into
account. */
*************** tui_show_symtab_source (struct symtab *s
*** 326,334 ****
int
tui_source_is_displayed (char *fname)
{
! 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));
}
--- 327,335 ----
int
tui_source_is_displayed (char *fname)
{
! 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));
}
Index: tui/tui-win.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tui-win.c,v
retrieving revision 1.37
diff -p -r1.37 tui-win.c
*** tui/tui-win.c 14 Aug 2007 23:50:39 -0000 1.37
--- tui/tui-win.c 15 Aug 2007 00:16:04 -0000
*************** tui_scroll_left (struct tui_win_info *wi
*** 556,562 ****
"psuedo" scroll since not all of the source is in memory,
only what is in the viewport. If win_to_scroll is the command
window do nothing since the term should handle it. */
! 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);
}
}
--- 556,563 ----
"psuedo" scroll since not all of the source is in memory,
only what is in the viewport. If win_to_scroll is the command
window do nothing since the term should handle it. */
! 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);
}
}
*************** tui_scroll_right (struct tui_win_info *w
*** 577,583 ****
"psuedo" scroll since not all of the source is in memory,
only what is in the viewport. If win_to_scroll is the command
window do nothing since the term should handle it. */
! 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);
}
}
--- 578,585 ----
"psuedo" scroll since not all of the source is in memory,
only what is in the viewport. If win_to_scroll is the command
window do nothing since the term should handle it. */
! 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);
}
}
*************** tui_refresh_all_win (void)
*** 618,624 ****
tui_refresh_all (tui_win_list);
for (type = SRC_WIN; type < MAX_MAJOR_WINDOWS; type++)
{
! if (tui_win_list[type] && tui_win_list[type]->generic.is_visible)
{
switch (type)
{
--- 620,627 ----
tui_refresh_all (tui_win_list);
for (type = SRC_WIN; type < MAX_MAJOR_WINDOWS; type++)
{
! if (tui_win_list[type]
! && tui_win_list[type]->generic.is_visible)
{
switch (type)
{
*************** tui_resize_all (void)
*** 671,678 ****
tui_update_gdb_sizes ();
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;
--- 674,682 ----
tui_update_gdb_sizes ();
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;
*************** tui_resize_all (void)
*** 783,789 ****
they get created again when called for with the new size. */
for (win_type = SRC_WIN; (win_type < MAX_MAJOR_WINDOWS); win_type++)
{
! if (win_type != CMD_WIN && (tui_win_list[win_type] != NULL)
&& !tui_win_list[win_type]->generic.is_visible)
{
tui_free_window (tui_win_list[win_type]);
--- 787,794 ----
they get created again when called for with the new size. */
for (win_type = SRC_WIN; (win_type < MAX_MAJOR_WINDOWS); win_type++)
{
! if (win_type != CMD_WIN
! && (tui_win_list[win_type] != NULL)
&& !tui_win_list[win_type]->generic.is_visible)
{
tui_free_window (tui_win_list[win_type]);
*************** tui_set_focus (char *arg, int from_tty)
*** 895,901 ****
else
win_info = tui_partial_win_by_name (buf_ptr);
! 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
--- 900,907 ----
else
win_info = tui_partial_win_by_name (buf_ptr);
! 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
*************** tui_all_windows_info (char *arg, int fro
*** 930,936 ****
struct tui_win_info *win_with_focus = tui_win_with_focus ();
for (type = SRC_WIN; (type < MAX_MAJOR_WINDOWS); type++)
! if (tui_win_list[type] && tui_win_list[type]->generic.is_visible)
{
if (win_with_focus == tui_win_list[type])
printf_filtered (" %s\t(%d lines) <has focus>\n",
--- 936,943 ----
struct tui_win_info *win_with_focus = tui_win_with_focus ();
for (type = SRC_WIN; (type < MAX_MAJOR_WINDOWS); type++)
! if (tui_win_list[type]
! && tui_win_list[type]->generic.is_visible)
{
if (win_with_focus == tui_win_list[type])
printf_filtered (" %s\t(%d lines) <has focus>\n",
*************** tui_set_win_height (char *arg, int from_
*** 998,1004 ****
wname[i] = toupper (wname[i]);
win_info = tui_partial_win_by_name (wname);
! 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
--- 1005,1012 ----
wname[i] = toupper (wname[i]);
win_info = tui_partial_win_by_name (wname);
! 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
*************** tui_xdb_set_win_height (char *arg, int f
*** 1081,1089 ****
{ /* 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) ||
! tui_adjust_win_heights (tui_win_list[CMD_WIN],
! new_height) == TUI_FAILURE)
warning (_("Invalid window height specified.\n%s"),
XDBWIN_HEIGHT_USAGE);
}
--- 1089,1097 ----
{ /* 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)
! || tui_adjust_win_heights (tui_win_list[CMD_WIN],
! new_height) == TUI_FAILURE)
warning (_("Invalid window height specified.\n%s"),
XDBWIN_HEIGHT_USAGE);
}
*************** tui_adjust_win_heights (struct tui_win_i
*** 1121,1127 ****
enum tui_layout_type cur_layout = tui_current_layout ();
diff = (new_height - primary_win_info->generic.height) * (-1);
! if (cur_layout == SRC_COMMAND || cur_layout == DISASSEM_COMMAND)
{
struct tui_win_info *src_win_info;
--- 1129,1136 ----
enum tui_layout_type cur_layout = tui_current_layout ();
diff = (new_height - primary_win_info->generic.height) * (-1);
! if (cur_layout == SRC_COMMAND
! || cur_layout == DISASSEM_COMMAND)
{
struct tui_win_info *src_win_info;
*************** new_height_ok (struct tui_win_info *prim
*** 1393,1404 ****
diff = (new_height - primary_win_info->generic.height) * (-1);
if (cur_layout == SRC_COMMAND || cur_layout == DISASSEM_COMMAND)
{
! 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. */
struct tui_win_info *win_info;
--- 1402,1413 ----
diff = (new_height - primary_win_info->generic.height) * (-1);
if (cur_layout == SRC_COMMAND || cur_layout == DISASSEM_COMMAND)
{
! 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. */
struct tui_win_info *win_info;
*************** new_height_ok (struct tui_win_info *prim
*** 1439,1450 ****
/* Locator included since first & second win share a line. */
ok = ((first_win->generic.height +
second_win->generic.height + diff) >=
! (MIN_WIN_HEIGHT * 2) &&
! new_height >= MIN_CMD_WIN_HEIGHT);
if (ok)
{
! total_height = new_height + (first_win->generic.height +
! second_win->generic.height + diff);
min_height = MIN_CMD_WIN_HEIGHT;
}
}
--- 1448,1460 ----
/* Locator included since first & second win share a line. */
ok = ((first_win->generic.height +
second_win->generic.height + diff) >=
! (MIN_WIN_HEIGHT * 2)
! && new_height >= MIN_CMD_WIN_HEIGHT);
if (ok)
{
! total_height = new_height +
! (first_win->generic.height +
! second_win->generic.height + diff);
min_height = MIN_CMD_WIN_HEIGHT;
}
}
*************** new_height_ok (struct tui_win_info *prim
*** 1479,1485 ****
/* Now make sure that the proposed total height doesn't
exceed the old total height. */
if (ok)
! ok = (new_height >= min_height && total_height <= cur_total_height);
}
}
--- 1489,1496 ----
/* Now make sure that the proposed total height doesn't
exceed the old total height. */
if (ok)
! ok = (new_height >= min_height
! && total_height <= cur_total_height);
}
}
*************** parse_scrolling_args (char *arg,
*** 1541,1548 ****
wname[i] = toupper (wname[i]);
*win_to_scroll = tui_partial_win_by_name (wname);
! if (*win_to_scroll == (struct tui_win_info *) NULL ||
! !(*win_to_scroll)->generic.is_visible)
error (_("Invalid window specified. \n\
The window name specified must be valid and visible.\n"));
else if (*win_to_scroll == TUI_CMD_WIN)
--- 1552,1559 ----
wname[i] = toupper (wname[i]);
*win_to_scroll = tui_partial_win_by_name (wname);
! if (*win_to_scroll == (struct tui_win_info *) NULL
! || !(*win_to_scroll)->generic.is_visible)
error (_("Invalid window specified. \n\
The window name specified must be valid and visible.\n"));
else if (*win_to_scroll == TUI_CMD_WIN)
Index: tui/tui-windata.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tui-windata.c,v
retrieving revision 1.15
diff -p -r1.15 tui-windata.c
*** tui/tui-windata.c 14 Aug 2007 23:50:39 -0000 1.15
--- tui/tui-windata.c 15 Aug 2007 00:16:04 -0000
*************** tui_first_data_item_displayed (void)
*** 51,63 ****
int element_no = (-1);
int i;
! for (i = 0; (i < TUI_DATA_WIN->generic.content_size && element_no < 0); i++)
{
struct tui_gen_win_info *data_item_win;
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;
}
--- 51,66 ----
int element_no = (-1);
int i;
! for (i = 0;
! i < TUI_DATA_WIN->generic.content_size && element_no < 0;
! i++)
{
struct tui_gen_win_info *data_item_win;
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;
}
*************** tui_display_all_data (void)
*** 140,147 ****
/* Then display the other data. */
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)
{
}
}
--- 143,150 ----
/* Then display the other data. */
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)
{
}
}
*************** tui_check_data_values (struct frame_info
*** 238,244 ****
{
int i;
! for (i = 0; TUI_DATA_WIN->detail.data_display_info.data_content_count; i++)
{
#ifdef LATER
tui_data_element_ptr data_element_ptr;
--- 241,249 ----
{
int i;
! for (i = 0;
! TUI_DATA_WIN->detail.data_display_info.data_content_count;
! i++)
{
#ifdef LATER
tui_data_element_ptr data_element_ptr;
Index: tui/tui-wingeneral.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tui-wingeneral.c,v
retrieving revision 1.14
diff -p -r1.14 tui-wingeneral.c
*** tui/tui-wingeneral.c 14 Aug 2007 23:50:39 -0000 1.14
--- tui/tui-wingeneral.c 15 Aug 2007 00:16:04 -0000
*************** box_win (struct tui_gen_win_info *win_in
*** 113,119 ****
void
tui_unhighlight_win (struct tui_win_info *win_info)
{
! if (win_info != NULL && win_info->generic.handle != (WINDOW *) NULL)
{
box_win ((struct tui_gen_win_info *) win_info, NO_HILITE);
wrefresh (win_info->generic.handle);
--- 113,120 ----
void
tui_unhighlight_win (struct tui_win_info *win_info)
{
! if (win_info != NULL
! && win_info->generic.handle != (WINDOW *) NULL)
{
box_win ((struct tui_gen_win_info *) win_info, NO_HILITE);
wrefresh (win_info->generic.handle);
*************** make_visible (struct tui_gen_win_info *w
*** 190,197 ****
win_info->is_visible = TRUE;
}
}
! else if (!visible &&
! win_info->is_visible && win_info->handle != (WINDOW *) NULL)
{
win_info->is_visible = FALSE;
tui_delete_win (win_info->handle);
--- 191,199 ----
win_info->is_visible = TRUE;
}
}
! else if (!visible
! && win_info->is_visible
! && win_info->handle != (WINDOW *) NULL)
{
win_info->is_visible = FALSE;
tui_delete_win (win_info->handle);
Index: tui/tui-winsource.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tui-winsource.c,v
retrieving revision 1.26
diff -p -r1.26 tui-winsource.c
*** tui/tui-winsource.c 14 Aug 2007 23:50:39 -0000 1.26
--- tui/tui-winsource.c 15 Aug 2007 00:16:04 -0000
*************** tui_update_source_window_as_is (struct t
*** 118,125 ****
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 (tui_win_with_focus () == TUI_DISASM_WIN &&
! tui_current_layout () != SRC_DISASSEM_COMMAND)
tui_set_win_focus_to (TUI_SRC_WIN);
}
}
--- 118,125 ----
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 (tui_win_with_focus () == TUI_DISASM_WIN
! && tui_current_layout () != SRC_DISASSEM_COMMAND)
tui_set_win_focus_to (TUI_SRC_WIN);
}
}
*************** tui_line_is_displayed (int line,
*** 631,644 ****
else
threshold = 0;
i = 0;
! while (i < win_info->generic.content_size - threshold && !is_displayed)
{
is_displayed = (((struct tui_win_element *)
! win_info->generic.content[i])->which_element.source.line_or_addr.loa
== LOA_LINE)
! && (((struct tui_win_element *)
! win_info->generic.content[i])->which_element.source.line_or_addr.u.line_no
! == (int) line);
i++;
}
--- 631,645 ----
else
threshold = 0;
i = 0;
! while (i < win_info->generic.content_size - threshold
! && !is_displayed)
{
is_displayed = (((struct tui_win_element *)
! win_info->generic.content[i])->which_element.source.line_or_addr.loa
== LOA_LINE)
! && (((struct tui_win_element *)
! win_info->generic.content[i])->which_element.source.line_or_addr.u.line_no
! == (int) line);
i++;
}
*************** tui_addr_is_displayed (CORE_ADDR addr,
*** 661,674 ****
else
threshold = 0;
i = 0;
! while (i < win_info->generic.content_size - threshold && !is_displayed)
{
is_displayed = (((struct tui_win_element *)
! win_info->generic.content[i])->which_element.source.line_or_addr.loa
== LOA_ADDRESS)
! && (((struct tui_win_element *)
! win_info->generic.content[i])->which_element.source.line_or_addr.u.addr
! == addr);
i++;
}
--- 662,676 ----
else
threshold = 0;
i = 0;
! while (i < win_info->generic.content_size - threshold
! && !is_displayed)
{
is_displayed = (((struct tui_win_element *)
! win_info->generic.content[i])->which_element.source.line_or_addr.loa
== LOA_ADDRESS)
! && (((struct tui_win_element *)
! win_info->generic.content[i])->which_element.source.line_or_addr.u.addr
! == addr);
i++;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [OB] tui, coding standard
2007-08-15 0:19 [OB] tui, coding standard msnyder
@ 2007-08-15 6:52 ` Mark Kettenis
2007-08-15 20:52 ` msnyder
0 siblings, 1 reply; 4+ messages in thread
From: Mark Kettenis @ 2007-08-15 6:52 UTC (permalink / raw)
To: msnyder; +Cc: gdb-patches
> Date: Tue, 14 Aug 2007 17:18:45 -0700 (PDT)
> From: msnyder@sonic.net
>
> && and || operators.
This diff wraps some lines that fit perfectly well on a single line; I
think you shouldn't do that. Otherwise, this looks ok.
> 2007-08-14 Michael Snyder <msnyder@access-company.com>
>
> * tui-command.c, tui-data.c, tui-disasm.c, tui-file.c, tui-io.c,
> tui-layout.c, tui-regs.c, tui-source.c, tui-win.c, tui-windata.c,
> tui-wingeneral.c, tui-winsource.c: Coding standard, && and ||
> go at beginning of new line.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [OB] tui, coding standard
2007-08-15 6:52 ` Mark Kettenis
@ 2007-08-15 20:52 ` msnyder
2007-08-15 21:47 ` Jim Blandy
0 siblings, 1 reply; 4+ messages in thread
From: msnyder @ 2007-08-15 20:52 UTC (permalink / raw)
To: Mark Kettenis; +Cc: msnyder, gdb-patches
>> Date: Tue, 14 Aug 2007 17:18:45 -0700 (PDT)
>> From: msnyder@sonic.net
>>
>> && and || operators.
>
> This diff wraps some lines that fit perfectly well on a single line; I
> think you shouldn't do that. Otherwise, this looks ok.
OK, maybe I was a little gung ho. Do you have an idea,
for yourself, of what constitutes a line that is too long?
Michael
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [OB] tui, coding standard
2007-08-15 20:52 ` msnyder
@ 2007-08-15 21:47 ` Jim Blandy
0 siblings, 0 replies; 4+ messages in thread
From: Jim Blandy @ 2007-08-15 21:47 UTC (permalink / raw)
To: msnyder; +Cc: Mark Kettenis, gdb-patches
msnyder@sonic.net writes:
>>> Date: Tue, 14 Aug 2007 17:18:45 -0700 (PDT)
>>> From: msnyder@sonic.net
>>>
>>> && and || operators.
>>
>> This diff wraps some lines that fit perfectly well on a single line; I
>> think you shouldn't do that. Otherwise, this looks ok.
>
> OK, maybe I was a little gung ho. Do you have an idea,
> for yourself, of what constitutes a line that is too long?
You didn't ask me, :) but my rule is that a &&-chain or a ||-chain
should either fit entirely on one line, or have one condition per
line. Either horizontal or vertical, but not a mix.
I sure wouldn't want to require every && or || to be on its own line,
but I don't like to read mixes, ergo...
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-08-15 21:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-15 0:19 [OB] tui, coding standard msnyder
2007-08-15 6:52 ` Mark Kettenis
2007-08-15 20:52 ` msnyder
2007-08-15 21:47 ` Jim Blandy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox