From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7610 invoked by alias); 27 Jul 2007 12:26:43 -0000 Received: (qmail 7602 invoked by uid 22791); 27 Jul 2007 12:26:42 -0000 X-Spam-Check-By: sourceware.org Received: from jess.glam.ac.uk (HELO jess.glam.ac.uk) (193.63.147.97) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 27 Jul 2007 12:26:40 +0000 Received: from j228-gm.comp.glam.ac.uk ([193.63.148.84]) by jess.glam.ac.uk with esmtp (Exim 3.35 #1) id 1IEOtQ-00058N-00; Fri, 27 Jul 2007 13:26:04 +0100 Received: from gaius by j228-gm.comp.glam.ac.uk with local (Exim 4.63) (envelope-from ) id 1IEOoP-0007Lf-34; Fri, 27 Jul 2007 13:20:53 +0100 From: Gaius Mulley To: "Pierre Muller" Cc: Subject: Re: [PATCH] Unbounded array support implemented (for Modula-2) References: <874pjs57zg.fsf@j228-gm.comp.glam.ac.uk> <002a01c7cf57$b881b0c0$29851240$@u-strasbg.fr> Date: Fri, 27 Jul 2007 13:17:00 -0000 In-Reply-To: <002a01c7cf57$b881b0c0$29851240$@u-strasbg.fr> (Pierre Muller's message of "Thu, 26 Jul 2007 09:36:46 +0200") Message-ID: <87ejiu6nru.fsf@j228-gm.comp.glam.ac.uk> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes 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: 2007-07/txt/msg00290.txt.bz2 Hi Pierre, "Pierre Muller" writes: > Could you explain why you need to add > TSIZE as a synonym of SIZE? > Is it just a matter of parser shift/reduce conflicts? > Is TSIZE a modula-2 function? yes a Modula-2 function in PIM-2 it was later replaced by SIZE in PIM-4. But GNU Modula-2 supports, PIM-[234] and users might expect TSIZE to exist in the debugger. > Is your change in gdb.texinfo in a modula-2 specific > area? yes - in the Modula-2 example session. > Modula-2 is not the only language supporting unbounded arrays, I > would be interested in using the same kind of code for pascal > language support. sure, I'm all for refactoring code.. > Maybe a more general approach would be useful? maybe - although I suspect the devil is in the detail. Basically Modula-2 assumes that all unbounded arrays start at index 0 and the caller can be legally access all indices 0..HIGH(a). GNU Modula-2 implements unbounded arrays by creating a structure whose first field is a pointer to type, and the second structure is the HIGH value (unsigned int). So the patches basically detect if the array declaration matches a GNU Modula-2 unbounded structure (testing field names and types and language). If so then it maps any reference to a[i] onto a->_m2_contents[i] and HIGH(a) onto a->_m2_high. How does GNU Pascal implement unbounded arrays? > One more remark: in m2_unbounded_array function, it would probably > be better to honor the value of the show argument, and to only > output something if show is non-zero. many thanks for the spotting this - it is now implemented this in the latest patch. regards, Gaius