From patchwork Sun Jun 23 22:43:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 33318 Received: (qmail 57479 invoked by alias); 23 Jun 2019 23:25:56 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 57227 invoked by uid 89); 23 Jun 2019 23:25:54 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=drawn, Available, 457, 458 X-HELO: gateway20.websitewelcome.com Received: from gateway20.websitewelcome.com (HELO gateway20.websitewelcome.com) (192.185.46.107) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 23 Jun 2019 23:25:52 +0000 Received: from cm12.websitewelcome.com (cm12.websitewelcome.com [100.42.49.8]) by gateway20.websitewelcome.com (Postfix) with ESMTP id 31610400D075B for ; Sun, 23 Jun 2019 17:24:13 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id fBrrh9WzFiQerfBrrhfND2; Sun, 23 Jun 2019 18:25:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=HmdOTwgGPQb6DyT4klmOwihiJWn35p/5RkMp/fFqngM=; b=IBhcoiJ2AD7FnFfeEKKZhifZCi YMAaWc6s5Laai6itMaFDq5ApjvwqHX7L8sGrbheggBY66W6dZcu5sRcwOcnIvxF28tH0OWn9UjSzA z/K4QRET+sdHfD2f96cudiK0e; Received: from 75-166-12-78.hlrn.qwest.net ([75.166.12.78]:54396 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1hfBDC-000vDQ-5l; Sun, 23 Jun 2019 17:43:50 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 44/66] Introduce enum tui_box Date: Sun, 23 Jun 2019 16:43:07 -0600 Message-Id: <20190623224329.16060-45-tom@tromey.com> In-Reply-To: <20190623224329.16060-1-tom@tromey.com> References: <20190623224329.16060-1-tom@tromey.com> This adds a new enum to the TUI, replacing two #define constants, providing better type safety. 2019-06-23 Tom Tromey * tui/tui-wingeneral.h (tui_make_window): Change type of "box_it" parameter. * tui/tui-wingeneral.c (tui_make_window): Change type of "box_it" parameter. (tui_gen_win_info::make_visible): Update. * tui/tui-layout.c (init_and_make_win): Change type of "box_it" parameter. * tui/tui-data.h (enum tui_box): New enum. (BOX_WINDOW, DONT_BOX_WINDOW): Remove defines. --- gdb/ChangeLog | 12 ++++++++++++ gdb/tui/tui-data.h | 9 +++++++-- gdb/tui/tui-layout.c | 5 +++-- gdb/tui/tui-wingeneral.c | 5 +++-- gdb/tui/tui-wingeneral.h | 2 +- 5 files changed, 26 insertions(+), 7 deletions(-) diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h index a79331144dd..caf3bb4f408 100644 --- a/gdb/tui/tui-data.h +++ b/gdb/tui/tui-data.h @@ -91,6 +91,13 @@ struct tui_gen_win_info char *title = nullptr; }; +/* Whether or not a window should be drawn with a box. */ +enum tui_box +{ + DONT_BOX_WINDOW = 0, + BOX_WINDOW +}; + /* Constant definitions. */ #define DEFAULT_TAB_LEN 8 #define NO_SRC_STRING "[ No Source Available ]" @@ -104,8 +111,6 @@ struct tui_gen_win_info #define DISASSEM_NAME "asm" #define TUI_NULL_STR "" #define DEFAULT_HISTORY_COUNT 25 -#define BOX_WINDOW TRUE -#define DONT_BOX_WINDOW FALSE #define HILITE TRUE #define NO_HILITE FALSE #define WITH_LOCATOR TRUE diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c index 695fa3560b2..6507b06dd39 100644 --- a/gdb/tui/tui-layout.c +++ b/gdb/tui/tui-layout.c @@ -45,7 +45,8 @@ static void show_layout (enum tui_layout_type); static tui_gen_win_info *init_and_make_win (tui_gen_win_info *, enum tui_win_type, - int, int, int, int, int); + int, int, int, int, + enum tui_box); static void show_source_or_disasm_and_command (enum tui_layout_type); static struct tui_win_info *make_source_or_disasm_window (enum tui_win_type, int, int); @@ -793,7 +794,7 @@ init_and_make_win (tui_gen_win_info *win_info, enum tui_win_type win_type, int height, int width, int origin_x, int origin_y, - int box_it) + enum tui_box box_it) { if (win_info == NULL) { diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c index acb8a26765b..cfa4a08701c 100644 --- a/gdb/tui/tui-wingeneral.c +++ b/gdb/tui/tui-wingeneral.c @@ -146,7 +146,7 @@ tui_check_and_display_highlight_if_needed (struct tui_win_info *win_info) void -tui_make_window (struct tui_gen_win_info *win_info, int box_it) +tui_make_window (struct tui_gen_win_info *win_info, enum tui_box box_it) { WINDOW *handle; @@ -175,7 +175,8 @@ tui_gen_win_info::make_visible (bool visible) { if (!is_visible) { - tui_make_window (this, !tui_win_is_auxillary (type)); + tui_make_window (this, (tui_win_is_auxillary (type) + ? DONT_BOX_WINDOW : BOX_WINDOW)); is_visible = true; } } diff --git a/gdb/tui/tui-wingeneral.h b/gdb/tui/tui-wingeneral.h index 15e61c94166..e925606229c 100644 --- a/gdb/tui/tui-wingeneral.h +++ b/gdb/tui/tui-wingeneral.h @@ -32,7 +32,7 @@ extern void tui_make_visible (struct tui_gen_win_info *); extern void tui_make_invisible (struct tui_gen_win_info *); extern void tui_make_all_visible (void); extern void tui_make_all_invisible (void); -extern void tui_make_window (struct tui_gen_win_info *, int); +extern void tui_make_window (struct tui_gen_win_info *, enum tui_box); extern struct tui_win_info *tui_copy_win (struct tui_win_info *); extern void tui_box_win (struct tui_gen_win_info *, int); extern void tui_highlight_win (struct tui_win_info *);