From Alain.LeGuennec@enst-bretagne.fr Tue Mar 18 09:07:28 1997 Return-Path: Received: from ida.org by cronus.csed.ida.org (SMI-8.6/SMI-SVR4) id JAA13465; Tue, 18 Mar 1997 09:07:28 -0500 Received: from sw-eng.falls-church.va.us (ns1.sw-eng.falls-church.va.us) by ida.org (4.1/SMI-4.1) id AA05340; Tue, 18 Mar 97 09:07:55 EST Received: from wormhole.mtc.iitri.com by sw-eng.falls-church.va.us (8.7.1/) id OAA10990; Tue, 18 Mar 1997 14:01:33 GMT Received: from audrey.enst-bretagne.fr by mtc.iitri.com (4.1/3.1.090690-IITRI-MTC) id AA24188; Tue, 18 Mar 97 04:07:05 EST Received: from huygens.enst-bretagne.fr (huygens.enst-bretagne.fr [192.44.75.121]) by audrey.enst-bretagne.fr (8.8.5/8.8.5) with SMTP id KAA25542 for ; Tue, 18 Mar 1997 10:03:38 +0100 Received: by huygens.enst-bretagne.fr (SMI-8.6/SMI-SVR4) id KAA06168; Tue, 18 Mar 1997 10:03:37 +0100 Date: Tue, 18 Mar 1997 10:03:37 +0100 Message-Id: <199703180903.KAA06168@huygens.enst-bretagne.fr> From: Alain Le Guennec To: ASIS-Comment@sw-eng.falls-church.va.us Subject: Statements'Labels and pragmas : an ambiguity. Content-Length: 1875 Status: OR !topic How to deal with pragmas between two labels attached to the same statement ? !from Alain Le Guennec !keywords label pragma Corresponding_Destination_Statement !discussion Hello, Please consider the following example : with Ada.Text_IO; use Ada.Text_IO; procedure Sample17 is begin <> pragma Annotate (Label1); pragma Debug (Put_Line ("A label pragma.")); <> Put_Line ("The statement itself."); delay 2.0; -- goto Label1; goto Label2; end Sample17; If my understanding of the RM is correct, then Label1 and Label2 are _both_ attached to the same statement. In that case, the two pragmas I inserted inbetween can't be considered as statements, since it changes the result of the query Asis.Statements.Corresponding_Destination_Statement when applied to 'goto Label1' or 'goto Label2' (the result should be the same in both cases, shouldn't it ?). Note however that when compiled with 'gnatmake -cargs -gnata', the program seems to work _as if_ the pragmas were considered as statements, since the statement inside the Debug prama is re-executed only if the goto label is Label1, not for Label2. If ASIS wants to deal with such pragmas as if they were statements, then I think this particular case should be documented somewhere, and Corresponding_Destination_Statement result profile should be changed from Asis.Statement to Asis.Element to allow for A_Pragma as a possible result type for this query. An other alternative is to allow pragmas to be returned by Asis.Statements.Label_Names. Regards, Alain. -- Alain Le Guennec, 3rd year student at ENST de Bretagne (Telecom Bretagne). ENST de Bretagne (France) : Uppsala University (SWEDEN) : mailto:Alain.LeGuennec@enst-bretagne.fr mailto:alainlg@Kay.docs.uu.se http://www-eleves.enst-bretagne.fr/~leguenne http://www.docs.uu.se/~alainlg From Alain.LeGuennec@enst-bretagne.fr Tue Mar 18 10:12:36 1997 Return-Path: Received: from ida.org by cronus.csed.ida.org (SMI-8.6/SMI-SVR4) id KAA13535; Tue, 18 Mar 1997 10:12:35 -0500 Received: from sw-eng.falls-church.va.us (ns1.sw-eng.falls-church.va.us) by ida.org (4.1/SMI-4.1) id AA06736; Tue, 18 Mar 97 10:13:01 EST Received: from wormhole.mtc.iitri.com by sw-eng.falls-church.va.us (8.7.1/) id PAA15578; Tue, 18 Mar 1997 15:06:33 GMT Received: from audrey.enst-bretagne.fr by mtc.iitri.com (4.1/3.1.090690-IITRI-MTC) id AA22028; Mon, 17 Mar 97 16:24:04 EST Received: from huygens.enst-bretagne.fr (huygens.enst-bretagne.fr [192.44.75.121]) by audrey.enst-bretagne.fr (8.8.5/8.8.5) with SMTP id WAA16151; Mon, 17 Mar 1997 22:20:32 +0100 Received: by huygens.enst-bretagne.fr (SMI-8.6/SMI-SVR4) id WAA04409; Mon, 17 Mar 1997 22:20:30 +0100 Date: Mon, 17 Mar 1997 22:20:30 +0100 Message-Id: <199703172120.WAA04409@huygens.enst-bretagne.fr> From: Alain Le Guennec To: sblake@alsys.com Cc: ASIS-Comment@sw-eng.falls-church.va.us In-Reply-To: <199703161615.IAA09118@puumba.telesoft> (sblake@alsys.com) Subject: Re: Asis and statements' labels : a proposal to make things clearer Content-Length: 1355 Status: OR : The A_Defining_Identifier returned from Label_Names can be used as an : argument to the Asis.Text queries to get what you want here. : Asis.Text.Element_Image gives the string of the label including embedded ^^^^^^^^^ : comments. Asis.Text.Lines gives a list of lines that can be queried by : Asis.Text.Comment_Image. Please take a look and see if these would provide : the functionality you are looking for. There is one point that is not crystal-clear : Should Asis.Text.Element_Image return "<< label >>" or "label" for such A_Defining_Identifier ? -your explanation above seems to imply that the result be "<< label >>". But it would mean that Asis.Text.Element_Image (without considering padding) and Asis.Declarations.Defining_Name_Image disagree in the particular case of A_Defining_Identifier as returned by Asis.Statements.Label_Names (and only those identifiers ?), which doesn't seem very consistent to me. -If it is "label", then to get the "whole label", you have to retrieve the lines for the whole statement, remove comments with Non_Comment_Image, and then finally search for "<<" and ">>" around the statement_identifier. A tool that would need the whole "<< label >>" would have to do that processing (which is admittedly not that difficult to do). Regards, Alain. From sblake@alsys.com Tue Mar 18 10:33:25 1997 Return-Path: Received: from ida.org by cronus.csed.ida.org (SMI-8.6/SMI-SVR4) id KAA13633; Tue, 18 Mar 1997 10:33:24 -0500 Received: from sw-eng.falls-church.va.us (ns1.sw-eng.falls-church.va.us) by ida.org (4.1/SMI-4.1) id AA07400; Tue, 18 Mar 97 10:33:51 EST Received: from gw.alsys.com by sw-eng.falls-church.va.us (8.7.1/) id PAA18725; Tue, 18 Mar 1997 15:27:30 GMT Received: from rasht.alsys.com (mailhub.alsys.com) by gw.alsys.com (4.1/SMI-4.1.1) id AA00453; Tue, 18 Mar 97 07:30:39 PST Received: from puumba.telesoft by rasht.alsys.com (4.1/TS-1.2c) id AA01651; Tue, 18 Mar 97 07:29:43 PST Received: by puumba.telesoft (SMI-8.6/SMI-SVR4) id HAA17428; Tue, 18 Mar 1997 07:29:41 -0800 Date: Tue, 18 Mar 1997 07:29:41 -0800 From: sblake@alsys.com (Steve Blake @pulsar) Message-Id: <199703181529.HAA17428@puumba.telesoft> To: ASIS-Comment@sw-eng.falls-church.va.us, Alain.LeGuennec@enst-bretagne.fr Subject: Re: Statements'Labels and pragmas : an ambiguity. Content-Length: 2587 Status: OR Well Alain, I was about to offer you a job until I saw what kind of code you write;^) I would suggest that ASIS not treat pragmas a statements, and that the result of the Corresponding_Destination_Statement be the real put_line statement. I'm guessing that pragma Debug is an implementation defined pragma, and that means its semantics can't be defined by ASIS. A tool however, could apply those semantics in some way by using existing queries to determine the location of the labels and pragmas. Steve Blake -------------------------------- >From Alain.LeGuennec@enst-bretagne.fr Tue Mar 18 06:21:18 1997 To: ASIS-Comment@sw-eng.falls-church.va.us Subject: Statements'Labels and pragmas : an ambiguity. !topic How to deal with pragmas between two labels attached to the same statement ? !from Alain Le Guennec !keywords label pragma Corresponding_Destination_Statement !discussion Hello, Please consider the following example : with Ada.Text_IO; use Ada.Text_IO; procedure Sample17 is begin <> pragma Annotate (Label1); pragma Debug (Put_Line ("A label pragma.")); <> Put_Line ("The statement itself."); delay 2.0; -- goto Label1; goto Label2; end Sample17; If my understanding of the RM is correct, then Label1 and Label2 are _both_ attached to the same statement. In that case, the two pragmas I inserted inbetween can't be considered as statements, since it changes the result of the query Asis.Statements.Corresponding_Destination_Statement when applied to 'goto Label1' or 'goto Label2' (the result should be the same in both cases, shouldn't it ?). Note however that when compiled with 'gnatmake -cargs -gnata', the program seems to work _as if_ the pragmas were considered as statements, since the statement inside the Debug prama is re-executed only if the goto label is Label1, not for Label2. If ASIS wants to deal with such pragmas as if they were statements, then I think this particular case should be documented somewhere, and Corresponding_Destination_Statement result profile should be changed from Asis.Statement to Asis.Element to allow for A_Pragma as a possible result type for this query. An other alternative is to allow pragmas to be returned by Asis.Statements.Label_Names. Regards, Alain. -- Alain Le Guennec, 3rd year student at ENST de Bretagne (Telecom Bretagne). ENST de Bretagne (France) : Uppsala University (SWEDEN) : mailto:Alain.LeGuennec@enst-bretagne.fr mailto:alainlg@Kay.docs.uu.se http://www-eleves.enst-bretagne.fr/~leguenne http://www.docs.uu.se/~alainlg From Alain.LeGuennec@enst-bretagne.fr Tue Mar 18 11:49:09 1997 Return-Path: Received: from ida.org by cronus.csed.ida.org (SMI-8.6/SMI-SVR4) id LAA13910; Tue, 18 Mar 1997 11:49:09 -0500 Received: from sw-eng.falls-church.va.us (ns1.sw-eng.falls-church.va.us) by ida.org (4.1/SMI-4.1) id AA09049; Tue, 18 Mar 97 11:49:32 EST Received: from melimelo.enst-bretagne.fr by sw-eng.falls-church.va.us (8.7.1/) id QAA24264; Tue, 18 Mar 1997 16:42:54 GMT Received: from huygens.enst-bretagne.fr (huygens.enst-bretagne.fr [192.44.75.121]) by melimelo.enst-bretagne.fr (8.8.5/8.8.5) with SMTP id RAA23874; Tue, 18 Mar 1997 17:44:38 +0100 Received: by huygens.enst-bretagne.fr (SMI-8.6/SMI-SVR4) id RAA11658; Tue, 18 Mar 1997 17:44:37 +0100 Date: Tue, 18 Mar 1997 17:44:37 +0100 Message-Id: <199703181644.RAA11658@huygens.enst-bretagne.fr> From: Alain Le Guennec To: sblake@alsys.com Cc: ASIS-Comment@sw-eng.falls-church.va.us In-Reply-To: <199703181529.HAA17428@puumba.telesoft> (sblake@alsys.com) Subject: Re: Statements'Labels and pragmas : an ambiguity. Content-Length: 1208 Status: OR : Well Alain, I was about to offer you a job until I saw what kind of code : you write;^) Hopefully, my code doesn't look like those pathological examples :-) : I would suggest that ASIS not treat pragmas a statements, and that the : result of the Corresponding_Destination_Statement be the real put_line : statement. I also prefer this choice. But I don't see any way in the current draft to retrieve pragmas that are between 2 labels attached to the same statement (even if there are rather unlikely to be encountered in real programs) without changing Asis.Statements.Label_Names into: Asis.Statements.Label_Names (Statement : in Asis.Statement; Include_Pragmas : in Boolean := False) return Asis.Defining_Name_List; : I'm guessing that pragma Debug is an implementation defined pragma, and that : means its semantics can't be defined by ASIS. A tool however, could apply : those semantics in some way by using existing queries to determine the : location of the labels and pragmas. Yes, this is indeed a GNAT defined pragma, and there is certainly no point in putting such a pragma at that place in a real-world program. /Alain. From sblake@alsys.com Fri Mar 21 12:34:52 1997 Return-Path: Received: from ida.org by cronus.csed.ida.org (SMI-8.6/SMI-SVR4) id MAA23148; Fri, 21 Mar 1997 12:34:51 -0500 Received: from sw-eng.falls-church.va.us (ns1.sw-eng.falls-church.va.us) by ida.org (4.1/SMI-4.1) id AA05121; Fri, 21 Mar 97 12:35:17 EST Received: from gw.alsys.com by sw-eng.falls-church.va.us (8.7.1/) id RAA08421; Fri, 21 Mar 1997 17:28:46 GMT Received: from rasht.alsys.com (mailhub.alsys.com) by gw.alsys.com (4.1/SMI-4.1.1) id AA07780; Fri, 21 Mar 97 09:31:52 PST Received: from puumba.telesoft by rasht.alsys.com (4.1/TS-1.2c) id AA27843; Fri, 21 Mar 97 09:30:54 PST Received: by puumba.telesoft (SMI-8.6/SMI-SVR4) id JAA08135; Fri, 21 Mar 1997 09:30:53 -0800 Date: Fri, 21 Mar 1997 09:30:53 -0800 From: sblake@alsys.com (Steve Blake @pulsar) Message-Id: <199703211730.JAA08135@puumba.telesoft> To: Alain.LeGuennec@enst-bretagne.fr, sblake@alsys.com Subject: Re: Asis and statements' labels : a proposal to make things clearer Cc: ASIS-Comment@sw-eng.falls-church.va.us Content-Length: 1233 Status: OR >There is one point that is not crystal-clear : >Should Asis.Text.Element_Image return "<< label >>" or "label" for such >A_Defining_Identifier ? > >-your explanation above seems to imply that the result be "<< label >>". >But it would mean that Asis.Text.Element_Image (without considering padding) >and Asis.Declarations.Defining_Name_Image disagree in the particular case >of A_Defining_Identifier as returned by Asis.Statements.Label_Names >(and only those identifiers ?), which doesn't seem very consistent to me. This is the intended result. The results are permitted to differ regarding the case of characters as well. The Text.Element_Image should be the real thing, as it appears in the program source. The Defining_Name_Image is subject to a variety of permissive transformations by the underlying compilation or Ada environment. >-If it is "label", then to get the "whole label", you have to retrieve >the lines for the whole statement, remove comments with Non_Comment_Image, >and then finally search for "<<" and ">>" around the statement_identifier. >A tool that would need the whole "<< label >>" would have to do that >processing (which is admittedly not that difficult to do). > > >Regards, > >Alain. From Alain.LeGuennec@enst-bretagne.fr Fri Mar 21 13:57:04 1997 Return-Path: Received: from ida.org by cronus.csed.ida.org (SMI-8.6/SMI-SVR4) id NAA23523; Fri, 21 Mar 1997 13:57:04 -0500 Received: from sw-eng.falls-church.va.us (ns1.sw-eng.falls-church.va.us) by ida.org (4.1/SMI-4.1) id AA06609; Fri, 21 Mar 97 13:50:48 EST Received: from melimelo.enst-bretagne.fr by sw-eng.falls-church.va.us (8.7.1/) id SAA09845; Fri, 21 Mar 1997 18:23:32 GMT Received: from fresnel.enst-bretagne.fr (fresnel.enst-bretagne.fr [192.44.75.88]) by melimelo.enst-bretagne.fr (8.8.5/8.8.5) with SMTP id TAA18553; Fri, 21 Mar 1997 19:25:50 +0100 Received: by fresnel.enst-bretagne.fr (SMI-8.6/SMI-SVR4) id TAA19577; Fri, 21 Mar 1997 19:25:48 +0100 Date: Fri, 21 Mar 1997 19:25:48 +0100 Message-Id: <199703211825.TAA19577@fresnel.enst-bretagne.fr> From: Alain Le Guennec To: sblake@alsys.com Cc: ASIS-Comment@sw-eng.falls-church.va.us In-Reply-To: <199703211730.JAA08135@puumba.telesoft> (sblake@alsys.com) Subject: Re: Asis and statements' labels : a proposal to make things clearer Content-Length: 263 Status: OR Now I think you're right (after all, since the A_Defining_Identifier elements are returned where I would have expected a A_Label, it makes sense that the corresponding Element_Image covers the whole label.) Thank you very much for your clarifications. Alain.