From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id ZItQI8+d5GaBGyoAWB0awg (envelope-from ) for ; Fri, 13 Sep 2024 16:17:19 -0400 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=Zr4uVUvT; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 767CA1E353; Fri, 13 Sep 2024 16:17:19 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-11.5 required=5.0 tests=ARC_SIGNED,ARC_VALID, BAYES_00,DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, URIBL_BLOCKED,URIBL_DBL_BLOCKED_OPENDNS autolearn=ham autolearn_force=no version=4.0.0 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id DA8151E08F for ; Fri, 13 Sep 2024 16:17:17 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4FF2C3858430 for ; Fri, 13 Sep 2024 20:17:17 +0000 (GMT) Received: from omta036.useast.a.cloudfilter.net (omta036.useast.a.cloudfilter.net [44.202.169.35]) by sourceware.org (Postfix) with ESMTPS id B26FD3858D26 for ; Fri, 13 Sep 2024 20:16:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B26FD3858D26 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B26FD3858D26 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.35 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1726258609; cv=none; b=wAyY1vx0PLRnnVf2I4vc7NhdSF7trwy98FfTaU+b+snHE3c6ucLh5Isco+5UZi7/VWwVGZ17QIHy+ZQC7aUe6I4CjumAE/YyHbePhdUG5pmWf/4//VSt38ZCAG8ldC1Iau4BvRXeAWp5P99iSAvuzsrgceeYtVYX4SWC9uUyi7g= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1726258609; c=relaxed/simple; bh=Uy96tz9YyrvT/kJzjRDjOemYlssxURNfScj/heX8CBE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=HuQDCNR0LbdhP34d25dTZEiU3KD3ZWb7C1Uem83gCx1an2UEkvnITplXZw/QEiEdxGbnGL21LckthKS5pv5vVwSb4ud1XJ96+9ewC2lUO6BFBSf1dVUpmBngeWwoaiTlly1o6qaEl1ZGtUTA2SA9+fPOOrZlzJyiYnmJIfK8mLo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6006a.ext.cloudfilter.net ([10.0.30.182]) by cmsmtp with ESMTPS id pCSZs2dCiiA19pCiksfzWk; Fri, 13 Sep 2024 20:16:46 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id pCijsUCx6i3RgpCijsbUig; Fri, 13 Sep 2024 20:16:45 +0000 X-Authority-Analysis: v=2.4 cv=WootM8fv c=1 sm=1 tr=0 ts=66e49dad a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=EaEq8P2WXUwA:10 a=ItBw4LHWJt0A:10 a=GUtPqjwAFyY0piIJP4UA:9 a=6Ogn3jAGHLSNbaov7Orx:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To :Subject:Cc:To:From:Sender:Reply-To: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=SH2dbRvmLRC1LN1+jk1zRnHbPA0kVQmB8Etf4dFEXns=; b=Zr4uVUvTvjs0VUbHDMeqSEPQjS Glzm3s3mN4CW/COgLLyqxfd9XsbM9h3W5YToyPyDQov9fIK9LHuPdjLueuxgzxM4UWU28dsj8e48X EGAddY1wzjDQX2lWfffMEIi2O; Received: from 97-118-34-56.hlrn.qwest.net ([97.118.34.56]:56256 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1spCij-003TuX-0F; Fri, 13 Sep 2024 14:16:45 -0600 From: Tom Tromey To: Andrei Pikas Cc: gdb-patches@sourceware.org Subject: Re: [PATCH v6] Add an option with a color type. In-Reply-To: <20221016162809.32801-1-gdb@mail.api.win> (Andrei Pikas's message of "Sun, 16 Oct 2022 19:28:09 +0300") References: <83edv74u1v.fsf@gnu.org> <20221016162809.32801-1-gdb@mail.api.win> X-Attribution: Tom Date: Fri, 13 Sep 2024 14:16:44 -0600 Message-ID: <87mskb1f83.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.118.34.56 X-Source-L: No X-Exim-ID: 1spCij-003TuX-0F X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-118-34-56.hlrn.qwest.net (murgatroyd) [97.118.34.56]:56256 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfAj1ApiX8VTBVj4VOP0NZrtB5eJZ1Kdq+AhmQcMwcX9yy7uq68Wyg2+XfxdW5SOhbHYeTis7dqxLGxO27Nc46NbJU62kfuyU7ZOc09Wgamgi9EnSzaPA UCwEOnz8YtUGgqL+7QIUB/mcxxxzxLPAOI6ChXaOLRuWNn4zw+jzbNV1gVjMUTHZ3sbofoa3A5m2V7TZUgVKVXX3Axn2M26NsMI= X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org >>>>> Andrei Pikas writes: Hello. Thanks for the patch and for getting a copyright assignment. I'm sorry it's taken so long to get back to this. It's a large & ambitious patch. I read through it once and sent some notes. I assume I'll have more next time through as well. > Colors can be specified as "none" for terminal's default color, as a name of > one of the eight standard colors of ISO/IEC 6429 "black", "red", "green", etc., > as an RGB hexadecimal tripplet #RRGGBB for 24-bit TrueColor, or as an > integer from 0 to 255. Integers 0 to 7 are the synonyms for the standard > colors. Integers 8-15 are used for the so-called bright colors from the > aixterm extended 16-color palette. Integers 16-255 are the indexes into xterm > extended 256-color palette (usually 6x6x6 cube plus gray ramp). In > general, 256-color palette is terminal dependent and sometimes can be > changed with OSC 4 sequences, e.g. "\033]4;1;rgb:00/FF/00\033\\". > It is the responsibility of the user to verify that the terminal supports > the specified colors. I often fantasize of getting rid of curses and just assuming an ANSI terminal. > +++ b/gdb/guile/scm-color.c > @@ -0,0 +1,445 @@ ... > +#include "defs.h" Since you wrote this, this area changed and defs.h doesn't have to be manually included any more. > diff --git a/gdb/python/py-color.c b/gdb/python/py-color.c > new file mode 100644 > index 00000000000..fb816a06328 > --- /dev/null > +++ b/gdb/python/py-color.c > +extern PyTypeObject colorpy_object_type > + CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("parmpy_object"); You can just remove the CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF thing. AFAIK nobody has tried the checker in years and IIRC it doesn't work on C++ anyway. > + if (color_obj == NULL) > + return NULL; Prefer nullptr in new code. > + if (! PyUnicode_CompareWithASCIIString (attr_name, "is_none")) > + return color.is_none () ? Py_True : Py_False; In the Python C API, the True and False singletons still need to be reference counted. A simple way to do this is: return PyBool_FromLong (color.is_none ()); This affects a few spots. > + if (color.is_direct () > + && ! PyUnicode_CompareWithASCIIString (attr_name, "components")) TIL. > + PyObject *comp = PyTuple_New (3); > + if (!comp) We started preferring 'comp == nullptr' for this kind of thing. > + int colors = tgetnum ((char *)"Co"); I wonder if that cast is really needed any longer. Tom