From: Tom Tromey <tom@tromey.com>
To: Andrei Pikas <gdb@mail.api.win>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v6] Add an option with a color type.
Date: Fri, 13 Sep 2024 14:16:44 -0600 [thread overview]
Message-ID: <87mskb1f83.fsf@tromey.com> (raw)
In-Reply-To: <20221016162809.32801-1-gdb@mail.api.win> (Andrei Pikas's message of "Sun, 16 Oct 2022 19:28:09 +0300")
>>>>> Andrei Pikas <gdb@mail.api.win> 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
next prev parent reply other threads:[~2024-09-13 20:17 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-16 11:40 [PATCH v4] " Andrei Pikas
2022-10-16 13:45 ` Eli Zaretskii via Gdb-patches
2022-10-16 16:03 ` [PATCH v5] " Andrei Pikas
2022-10-16 16:22 ` Eli Zaretskii via Gdb-patches
2022-10-16 16:28 ` [PATCH v6] " Andrei Pikas
2022-10-16 16:45 ` Eli Zaretskii via Gdb-patches
2024-04-19 19:33 ` Tom Tromey
2024-04-19 19:52 ` Andrei Pikas
2024-04-19 20:19 ` Tom Tromey
2024-04-20 18:24 ` Tom Tromey
2024-04-20 18:32 ` Andrei Pikas
2024-05-11 15:17 ` Andrei Pikas
2024-05-13 19:02 ` Tom Tromey
2024-05-21 9:00 ` Andrei Pikas
2024-09-13 20:16 ` Tom Tromey [this message]
2024-09-14 18:06 ` Andrei Pikas
2024-09-14 19:38 ` Tom Tromey
2024-09-14 19:43 ` Andrei Pikas
2024-09-14 19:04 ` [PATCH v7] " Andrei Pikas
2024-09-15 5:37 ` Eli Zaretskii
2024-10-05 19:11 ` Andrei Pikas
2024-10-05 19:40 ` Eli Zaretskii
2024-10-04 17:55 ` Tom Tromey
2024-10-05 17:55 ` Andrei Pikas
2024-10-05 19:27 ` [PATCH v8] " Andrei Pikas
2024-10-06 5:40 ` Eli Zaretskii
2024-12-13 21:01 ` Tom Tromey
2024-12-13 21:23 ` Andrei Pikas
2024-12-14 7:59 ` Eli Zaretskii
2025-01-12 20:34 ` Tom Tromey
2025-02-03 16:23 ` Tom de Vries
2025-02-04 0:24 ` Tom Tromey
2025-02-04 14:24 ` Tom de Vries
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87mskb1f83.fsf@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
--cc=gdb@mail.api.win \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox