From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6595 invoked by alias); 9 Oct 2008 16:13:50 -0000 Received: (qmail 6555 invoked by uid 22791); 9 Oct 2008 16:13:50 -0000 X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 09 Oct 2008 16:12:59 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id m99GCu46013802; Thu, 9 Oct 2008 12:12:56 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m99GCtbB028879; Thu, 9 Oct 2008 12:12:55 -0400 Received: from opsy.redhat.com (vpn-12-5.rdu.redhat.com [10.11.12.5]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id m99GCsOO030890; Thu, 9 Oct 2008 12:12:54 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 7ECC9888286; Thu, 9 Oct 2008 10:10:52 -0600 (MDT) To: Joel Brobecker Cc: gdb-patches@sourceware.org Subject: Re: [RFC/RFA] add struct parse_context to all command functions References: <20081009140424.GD5372@adacore.com> From: Tom Tromey Reply-To: tromey@redhat.com X-Attribution: Tom Date: Thu, 09 Oct 2008 16:13:00 -0000 In-Reply-To: <20081009140424.GD5372@adacore.com> (Joel Brobecker's message of "Thu\, 9 Oct 2008 10\:04\:24 -0400") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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 X-SW-Source: 2008-10/txt/msg00289.txt.bz2 >>>>> "Joel" == Joel Brobecker writes: Joel> I'd like to start working on adding a struct parse_context again. Joel> The ultimate goal is to pass this structure as an argument to all Joel> the "parse..." routines, rather than rely on the current_language Joel> and input_radix globals. In addition to being cleaner, it will also Joel> help fix a bug where the current_language is switched under us while Joel> trying to do parse an expression. I looked for the previous thread, and found this: http://sourceware.org/ml/gdb-patches/2007-12/msg00255.html ... but I didn't see an explanation of the problem. Would you mind repeating it? Joel> The next step for this task is to add a struct parse_context parameter Joel> to the "command" functions (the functions being called when the user Joel> calls a function in the UI). When the user enters a command, we know Joel> that we can use the current language and input radix to parse the Joel> arguments. I'm all in favor of this kind of cleanup. struct cmd_list_element already has some support for multiple styles of callback. It seems to me that you could limit your change to a subset of all the commands by adding a new field to the 'function' union. (That would mean more add_* functions, though.) Joel> 1. The prototypes for the various add_* functions are duplicated. Joel> There is a copy in command.h, and another in cli/cli-decode.h. Joel> Is there a specific reason why we can't keep only one copy? Joel> For instance, only keep the copy in cli/cli-decode.h? [ and 2 and 3] I have wondered about these myself. Tom