From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 70140 invoked by alias); 1 Jul 2019 19:32:46 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 70132 invoked by uid 89); 1 Jul 2019 19:32:46 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-7.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.1 spammy=bold, UD:be, arriving X-HELO: mailsec101.isp.belgacom.be Received: from mailsec101.isp.belgacom.be (HELO mailsec101.isp.belgacom.be) (195.238.20.97) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 01 Jul 2019 19:32:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skynet.be; i=@skynet.be; q=dns/txt; s=securemail; t=1562009564; x=1593545564; h=message-id:subject:from:to:cc:date:in-reply-to: references:mime-version:content-transfer-encoding; bh=J/sBn/y/7xahEo/0JRvOH4/7/n4wloWitFYhmNEhM+c=; b=sYnH+7Gtq1qmLSZxWj86SR6l+uux+IS/JKjoSouF3yXpKlUggvcf62FL KcU6AT4uPprJaS1xM8zX4bIGW3zZWg==; Received: from 96.218-128-109.adsl-dyn.isp.belgacom.be (HELO md) ([109.128.218.96]) by relay.skynet.be with ESMTP/TLS/AES256-GCM-SHA384; 01 Jul 2019 21:32:42 +0200 Message-ID: <1562009561.1956.1.camel@skynet.be> Subject: Re: ui_out format strings for fields and styles (Re: [PATCH] Style "pwd" output) From: Philippe Waroquiers To: Tom Tromey , Pedro Alves Cc: gdb-patches@sourceware.org Date: Mon, 01 Jul 2019 19:32:00 -0000 In-Reply-To: <87ef3aq6ux.fsf@tromey.com> References: <20190605020116.1550-1-tom@tromey.com> <1ee4bd6b-4cdf-f3a9-74af-0843bf123a8b@redhat.com> <87lfygi1x0.fsf@tromey.com> <32872d6a-15d6-9718-59ae-957694e114c9@redhat.com> <87imtjhj6b.fsf@tromey.com> <625cd0ba-058d-d4bf-8ba3-8676f335b0f3@redhat.com> <87blzbep47.fsf@tromey.com> <2180f72f-da10-5333-90a1-666ba3bd145e@redhat.com> <87imtjbrmx.fsf@tromey.com> <871s056yjw.fsf@tromey.com> <87ef3aq6ux.fsf@tromey.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2019-07/txt/msg00032.txt.bz2 On Mon, 2019-07-01 at 06:25 -0600, Tom Tromey wrote: > > > > > > "Pedro" == Pedro Alves writes: > > Pedro> Do you still see value in keeping %pN? If we make nullptr mean > Pedro> "keep the default", as you mentioned earlier, then the above can be > Pedro> rewritten as: > > Pedro> fprintf_filtered (stream, " %pS%pS", > Pedro> metadata_style.style ().ptr (), reps, nullptr); > > I was thinking that we'd change the spelling to some form of brackets, > in which case it would be good. So like "%p[%p]". > We discussed this before but I don't recall whether there was some > counter-argument to it. (Arriving late in the discussion ...) If we have some markers/brackets in the format string to apply style, why do we keep the style as an additional parameter of the 'printf' like functions ? E.g. when looking at pango markup, changing the 'style' is done inside the string, such as : "some string with red foreground" So, for GDB, we could have something like: some_output_function ("The filename is %s.", some_filename); where the low level of some_output_function would translate the into the real output of the control characters to do the styling. The advantage of this approach is that the styling can be added for example in the doc strings either statically and/or built dynamically (think for example to the new option framework that builds a part of the doc string: we might e.g. put in bold the part of the option that is 'unique'). Philippe > > If we're just using letters, then there doesn't seem to be a reason to > have two %p suffixes. > > To