From owner-sigada-asis-tech@ACM.ORG Thu Sep 24 10:29:00 1998 Return-Path: Received: from cs.ida.org by cronus.csed.ida.org (8.8.8+Sun/SMI-SVR4) id KAA11630; Thu, 24 Sep 1998 10:28:59 -0400 (EDT) Received: from mail.acm.org (mail.acm.org [199.222.69.4]) by cs.ida.org (8.8.7/8.8.7) with ESMTP id KAA12521 for ; Thu, 24 Sep 1998 10:28:58 -0400 (EDT) Received: from mail (mail.acm.org [199.222.69.4]) by mail.acm.org (8.8.5/8.7.5) with ESMTP id KAA62322; Thu, 24 Sep 1998 10:16:41 -0400 Received: from ACM.ORG by ACM.ORG (LISTSERV-TCP/IP release 1.8c) with spool id 1282709 for SIGADA-ASIS-TECH@ACM.ORG; Thu, 24 Sep 1998 10:16:40 -0400 Received: from logger.gamma.ru (logger.gamma.ru [194.186.254.23]) by mail.acm.org (8.8.5/8.7.5) with ESMTP id KAA25110 for ; Thu, 24 Sep 1998 10:06:33 -0400 Received: from srcc.UUCP (uucp@localhost) by logger.gamma.ru (8.8.8/8.8.8) with UUCP id SAA08840 for SIGAda-ASIS-Tech@ACM.Org; Thu, 24 Sep 1998 18:16:41 +0400 (MSD) (envelope-from possum!possum.srcc.msu.su!rybin@gamma.srcc.msu.su) Received: by gamma.srcc.msu.su; Thu, 24 Sep 1998 18:15:24 +0400 Received: by possum.srcc.msu.su (UUPC/@ v5.09gamma, 14Mar93); Thu, 24 Sep 1998 18:16:47 +0400 X-Mailer: BML [MS/DOS Beauty Mail v.1.36] Lines: 25 Message-ID: Date: Thu, 24 Sep 1998 18:16:47 +0400 Reply-To: "Sergey I. Rybin" Sender: ACM SIGADA ASIS Technical Discussion Group From: "Sergey I. Rybin" Organization: Information Systems, SRCC, MSU Subject: pragma Import as a completion of a subprogram To: SIGADA-ASIS-TECH@ACM.ORG Content-Length: 844 Status: OR Where is a hole - in ASIS or in my knowlege how to use it? The problem is that ASIS does not give any means to get to know if a subprogram declaration is completed by Import pragma. Suppuse we have something like this: function Strlen (A : System.Address) return Natural; pragma Import (C, Strlen); Corresponding_Body will get Nil_Element for the declaration of Strlen. Corresponding_Representation_Clauses will return the list which will not contain the pragma Import (because Import is not a representation pragma). So, there is no means in ASIS to get to know if Strlen has a completion (and it has in this case!), and there is no means to get Import pragma which works as a completion for the declaration of Strlen. Have I missed something important (and obvious)? If I have not, this looks like a serious hole in ASIS Sergey From owner-sigada-asis-tech@ACM.ORG Thu Sep 24 11:10:11 1998 Return-Path: Received: from cs.ida.org by cronus.csed.ida.org (8.8.8+Sun/SMI-SVR4) id LAA11734; Thu, 24 Sep 1998 11:10:10 -0400 (EDT) Received: from mail.acm.org (mail.acm.org [199.222.69.4]) by cs.ida.org (8.8.7/8.8.7) with ESMTP id LAA13741 for ; Thu, 24 Sep 1998 11:10:09 -0400 (EDT) Received: from mail (mail.acm.org [199.222.69.4]) by mail.acm.org (8.8.5/8.7.5) with ESMTP id KAA25140; Thu, 24 Sep 1998 10:59:07 -0400 Received: from ACM.ORG by ACM.ORG (LISTSERV-TCP/IP release 1.8c) with spool id 1282834 for SIGADA-ASIS-TECH@ACM.ORG; Thu, 24 Sep 1998 10:59:06 -0400 Received: from garbo.DK.net (garbo.DK.net [193.88.44.23]) by mail.acm.org (8.8.5/8.7.5) with ESMTP id KAA61104 for ; Thu, 24 Sep 1998 10:49:01 -0400 Received: (from uucp@localhost) by garbo.DK.net (8.8.8/8.8.8) id QAA24413; Thu, 24 Sep 1998 16:59:12 +0200 (MET DST) >Received: from sparc8.ddci.dk by ddci.dk (4.1/j1.1.2) id AA19611; Thu, 24 Sep 98 16:59:28 +0200 Received: from sparc8.ddci.dk by ddci.dk (4.1/j1.1.2) id AA19611; Thu, 24 Sep 98 16:59:28 +0200 Received: by sparc8.ddci.dk (SMI-8.6/SMI-4.1) id QAA09509; Thu, 24 Sep 1998 16:57:01 +0200 Content-Type: text Message-ID: <199809241457.QAA09509@sparc8.ddci.dk> Date: Thu, 24 Sep 1998 16:57:01 +0200 Reply-To: Jesper Joergensen Sender: ACM SIGADA ASIS Technical Discussion Group From: Jesper Joergensen Subject: Re: pragma Import as a completion of a subprogram Comments: To: rybin@ACM.ORG To: SIGADA-ASIS-TECH@ACM.ORG In-Reply-To: (rybin@POSSUM.SRCC.MSU.SU) Content-Length: 963 Status: OR > > Where is a hole - in ASIS or in my knowlege how to use it? > > The problem is that ASIS does not give any means to get > to know if a subprogram declaration is completed by Import pragma. > > Suppuse we have something like this: > > function Strlen (A : System.Address) return Natural; > pragma Import (C, Strlen); > > Corresponding_Body will get Nil_Element for the declaration of > Strlen. I would assume that Corresponding_Body returned the pragma. > Corresponding_Representation_Clauses will return > the list which will not contain the pragma Import (because > Import is not a representation pragma). > > So, there is no means in ASIS to get to know if Strlen has > a completion (and it has in this case!), and there is no > means to get Import pragma which works as a completion > for the declaration of Strlen. > > Have I missed something important (and obvious)? > > If I have not, this looks like a serious hole in ASIS > > Sergey > /Jesper From owner-sigada-asis-tech@ACM.ORG Thu Sep 24 11:55:35 1998 Return-Path: Received: from cs.ida.org by cronus.csed.ida.org (8.8.8+Sun/SMI-SVR4) id LAA11984; Thu, 24 Sep 1998 11:55:35 -0400 (EDT) Received: from mail.acm.org (mail.acm.org [199.222.69.4]) by cs.ida.org (8.8.7/8.8.7) with ESMTP id LAA14828 for ; Thu, 24 Sep 1998 11:55:34 -0400 (EDT) Received: from mail (mail.acm.org [199.222.69.4]) by mail.acm.org (8.8.5/8.7.5) with ESMTP id LAA31392; Thu, 24 Sep 1998 11:44:26 -0400 Received: from ACM.ORG by ACM.ORG (LISTSERV-TCP/IP release 1.8c) with spool id 1282961 for SIGADA-ASIS-TECH@ACM.ORG; Thu, 24 Sep 1998 11:44:25 -0400 Received: from nile.gnat.com (NILE.GNAT.COM [205.232.38.5]) by mail.acm.org (8.8.5/8.7.5) with SMTP id LAA50716 for ; Thu, 24 Sep 1998 11:34:22 -0400 Received: by nile.gnat.com (5.0/1.20) id AA07436; Thu, 24 Sep 98 11:37:57 EDT Message-ID: <9809241537.AA07436@nile.gnat.com> Date: Thu, 24 Sep 1998 11:37:57 EDT Reply-To: Robert Dewar Sender: ACM SIGADA ASIS Technical Discussion Group From: Robert Dewar Subject: Re: pragma Import as a completion of a subprogram Comments: To: jj@ACM.ORG To: SIGADA-ASIS-TECH@ACM.ORG Content-Length: 430 Status: OR <> If so, it is badly named, a pragma is never a body, it is a completion, and in some semantic places stands for the body, but it most definition is NOT a body. The name of the operation should be Corresponding_Completion if you really intend it to return the pragma in such a case. No one knowing Ada terminology would expect Corresponding_Body to return a pragma! From owner-sigada-asis-tech@ACM.ORG Thu Sep 24 12:06:21 1998 Return-Path: Received: from cs.ida.org by cronus.csed.ida.org (8.8.8+Sun/SMI-SVR4) id MAA12002; Thu, 24 Sep 1998 12:06:21 -0400 (EDT) Received: from mail.acm.org (mail.acm.org [199.222.69.4]) by cs.ida.org (8.8.7/8.8.7) with ESMTP id MAA15090 for ; Thu, 24 Sep 1998 12:06:20 -0400 (EDT) Received: from mail (mail.acm.org [199.222.69.4]) by mail.acm.org (8.8.5/8.7.5) with ESMTP id LAA52086; Thu, 24 Sep 1998 11:54:55 -0400 Received: from ACM.ORG by ACM.ORG (LISTSERV-TCP/IP release 1.8c) with spool id 1283002 for SIGADA-ASIS-TECH@ACM.ORG; Thu, 24 Sep 1998 11:54:54 -0400 Received: from logger.gamma.ru (logger.gamma.ru [194.186.254.23]) by mail.acm.org (8.8.5/8.7.5) with ESMTP id LAA63054 for ; Thu, 24 Sep 1998 11:44:50 -0400 Received: from srcc.UUCP (uucp@localhost) by logger.gamma.ru (8.8.8/8.8.8) with UUCP id TAA10067; Thu, 24 Sep 1998 19:54:37 +0400 (MSD) (envelope-from possum!possum.srcc.msu.su!rybin@gamma.srcc.msu.su) Received: by gamma.srcc.msu.su; Thu, 24 Sep 1998 19:52:58 +0400 Received: by possum.srcc.msu.su (UUPC/@ v5.09gamma, 14Mar93); Thu, 24 Sep 1998 19:54:17 +0400 References: <199809241457.QAA09509@sparc8.ddci.dk> X-Mailer: BML [MS/DOS Beauty Mail v.1.36] Lines: 141 Message-ID: Date: Thu, 24 Sep 1998 19:54:17 +0400 Reply-To: "Sergey I. Rybin" Sender: ACM SIGADA ASIS Technical Discussion Group From: "Sergey I. Rybin" Organization: Information Systems, SRCC, MSU Subject: Re: pragma Import as a completion of a subprogram Comments: To: jj@ACM.ORG Comments: cc: Alain.Le_Guennec@ACM.ORG To: SIGADA-ASIS-TECH@ACM.ORG Content-Length: 5609 Status: OR > > > > Where is a hole - in ASIS or in my knowlege how to use it? > > > > The problem is that ASIS does not give any means to get > > to know if a subprogram declaration is completed by Import pragma. > > > > Suppuse we have something like this: > > > > function Strlen (A : System.Address) return Natural; > > pragma Import (C, Strlen); > > > > Corresponding_Body will get Nil_Element for the declaration of > > Strlen. > > I would assume that Corresponding_Body returned the pragma. I agree, this would be the most reasonable solution. But it is NOT the case in the current ASIS definition: just have a look at the definition of Corresponding_Body: there is nothing about a pragma Import there, moreover, a list of returned kinds contains only declarations. That's why in my first message I spoke about a HOLE in the ASIS definition. (A special question to Alain Le Guennec: if Corresponding_Body would return a pragma Import as its result, how would it affect gnatelim?) --------------------------------------------------------------------------------------- -- 15.27 function Corresponding_Body --------------------------------------------------------------------------------------- function Corresponding_Body (Declaration : in Asis.Declaration) return Asis.Declaration; function Corresponding_Body (Declaration : in Asis.Declaration; The_Context : in Asis.Context) return Asis.Declaration; --------------------------------------------------------------------------------------- -- Declaration - Specifies the specification to query -- The_Context - Specifies a Context to use -- -- Returns the corresponding body for a given subprogram, package, or task -- specification declaration. Returns the expanded generic body template for -- generic instantiations. The argument can be a Unit_Declaration from a -- Compilation_Unit, or, it can be any appropriate specification declaration -- from any declarative context. -- -- These two function calls will always produce identical results: -- -- Decl2 := Corresponding_Body (Decl1); -- Decl2 := Corresponding_Body -- (Decl1, -- Enclosing_Context ( Enclosing_Compilation_Unit( Decl1 ))); -- -- If a body declaration is given, the same element is returned. -- -- Returns a Nil_Element if no body exists in The_Context. -- -- The parameter The_Context is used to locate the corresponding specification -- within a particular Context. The_Context need not be the Enclosing_Context -- of the Declaration. Any non-Nil result will always have The_Context -- as its Enclosing_Context. This implies that while a non-Nil result may be -- Is_Equal with the argument, it will only be Is_Identical if the -- Enclosing_Context of the Declaration is the same as the parameter -- The_Context. -- -- Implicit predefined operations (e.g., "+", "=", etc.) will not typically -- have unit bodies. (Corresponding_Body returns a Nil_Element.) -- User-defined overloads of the predefined operations will have -- Corresponding_Body values once the bodies have inserted into the -- environment. The Corresponding_Body of an inherited subprogram is that -- of the original user-defined subprogram. -- -- If a generic instantiation is given, the body representing the expanded -- generic body template is returned. (i.e., an argument that is -- A_Package_Instantiation, results in a value that is -- A_Package_Body_Declaration that can be analyzed with all appropriate ASIS -- queries). -- -- Returns a Nil_Element if the body of the generic has not yet been compiled -- or inserted into the Ada Environment Context. -- -- The Enclosing_Element of the expanded body is the generic instantiation. -- The Enclosing_Compilation_Unit of the expanded template is that of the -- instantiation. -- -- Appropriate Declaration_Kinds returning a body: -- A_Function_Declaration -- A_Function_Instantiation -- A_Generic_Package_Declaration -- A_Generic_Procedure_Declaration -- A_Generic_Function_Declaration -- A_Package_Declaration -- A_Package_Instantiation -- A_Procedure_Declaration -- A_Procedure_Instantiation -- A_Single_Task_Declaration -- A_Task_Type_Declaration -- A_Protected_Type_Declaration -- A_Single_Protected_Declaration -- A_Formal_Package_Declaration -- A_Formal_Package_Declaration_With_Box -- -- Appropriate Declaration_Kinds returning the argument Declaration: -- A_Function_Body_Declaration -- A_Function_Body_Stub -- A_Function_Renaming_Declaration -- A_Package_Body_Declaration -- A_Package_Body_Stub -- A_Package_Renaming_Declaration -- A_Procedure_Body_Declaration -- A_Procedure_Renaming_Declaration -- A_Procedure_Body_Stub -- A_Task_Body_Declaration -- A_Task_Body_Stub -- A_Protected_Body_Declaration -- A_Protected_Body_Stub -- A_Generic_Package_Renaming_Declaration -- A_Generic_Procedure_Renaming_Declaration -- A_Generic_Function_Renaming_Declaration -- -- Returns Declaration_Kinds: -- Not_A_Declaration -- A_Function_Body_Declaration -- A_Function_Body_Stub -- A_Function_Renaming_Declaration -- A_Package_Body_Declaration -- A_Package_Body_Stub -- A_Procedure_Body_Declaration -- A_Procedure_Renaming_Declaration -- A_Procedure_Body_Stub -- A_Task_Body_Declaration -- A_Task_Body_Stub -- A_Protected_Body_Declaration -- A_Protected_Body_Stub -- From owner-sigada-asis-tech@ACM.ORG Thu Sep 24 12:11:56 1998 Return-Path: Received: from cs.ida.org by cronus.csed.ida.org (8.8.8+Sun/SMI-SVR4) id MAA12012; Thu, 24 Sep 1998 12:11:55 -0400 (EDT) Received: from mail.acm.org (mail.acm.org [199.222.69.4]) by cs.ida.org (8.8.7/8.8.7) with ESMTP id MAA15215 for ; Thu, 24 Sep 1998 12:11:55 -0400 (EDT) Received: from mail (mail.acm.org [199.222.69.4]) by mail.acm.org (8.8.5/8.7.5) with ESMTP id MAA31250; Thu, 24 Sep 1998 12:00:42 -0400 Received: from ACM.ORG by ACM.ORG (LISTSERV-TCP/IP release 1.8c) with spool id 1283020 for SIGADA-ASIS-TECH@ACM.ORG; Thu, 24 Sep 1998 12:00:41 -0400 Received: from ulla.irisa.fr (ulla.irisa.fr [131.254.43.50]) by mail.acm.org (8.8.5/8.7.5) with ESMTP id LAA83456 for ; Thu, 24 Sep 1998 11:50:37 -0400 Received: from myrtille.irisa.fr (myrtille.irisa.fr [131.254.43.44]) by ulla.irisa.fr (8.9.1a/8.9.1) with ESMTP id SAA02476; Thu, 24 Sep 1998 18:00:49 +0200 (MET DST) References: <199809241457.QAA09509@sparc8.ddci.dk> Lines: 39 X-Mailer: Gnus v5.3/Emacs 19.34 Message-ID: Date: Thu, 24 Sep 1998 18:00:48 +0200 Reply-To: Alain.Le_Guennec@IRISA.FR Sender: ACM SIGADA ASIS Technical Discussion Group From: Alain Le Guennec Subject: Re: pragma Import as a completion of a subprogram Comments: To: Jesper Joergensen To: SIGADA-ASIS-TECH@ACM.ORG In-Reply-To: Jesper Joergensen's message of Thu, 24 Sep 1998 16:57:01 +0200 Content-Length: 1254 Status: OR Jesper Joergensen writes: > > Where is a hole - in ASIS or in my knowlege how to use it? > > > > The problem is that ASIS does not give any means to get > > to know if a subprogram declaration is completed by Import pragma. > > > > Suppuse we have something like this: > > > > function Strlen (A : System.Address) return Natural; > > pragma Import (C, Strlen); > > > > Corresponding_Body will get Nil_Element for the declaration of > > Strlen. > > I would assume that Corresponding_Body returned the pragma. This seems quite reasonable, but then the list of Returns Declaration_Kinds needs to be adjusted. > > Corresponding_Representation_Clauses will return > > the list which will not contain the pragma Import (because > > Import is not a representation pragma). > > > > So, there is no means in ASIS to get to know if Strlen has > > a completion (and it has in this case!), and there is no > > means to get Import pragma which works as a completion > > for the declaration of Strlen. Yes, there is a way: the Corresponding_Pragmas function, defined in section 13.38 > > Have I missed something important (and obvious)? > > > > If I have not, this looks like a serious hole in ASIS /Alain Le Guennec, not speaking for IRISA. From owner-sigada-asis-tech@ACM.ORG Thu Sep 24 12:30:53 1998 Return-Path: Received: from cs.ida.org by cronus.csed.ida.org (8.8.8+Sun/SMI-SVR4) id MAA12084; Thu, 24 Sep 1998 12:30:52 -0400 (EDT) Received: from mail.acm.org (mail.acm.org [199.222.69.4]) by cs.ida.org (8.8.7/8.8.7) with ESMTP id MAA15589 for ; Thu, 24 Sep 1998 12:30:49 -0400 (EDT) Received: from mail (mail.acm.org [199.222.69.4]) by mail.acm.org (8.8.5/8.7.5) with ESMTP id MAA26868; Thu, 24 Sep 1998 12:19:33 -0400 Received: from ACM.ORG by ACM.ORG (LISTSERV-TCP/IP release 1.8c) with spool id 1283136 for SIGADA-ASIS-TECH@ACM.ORG; Thu, 24 Sep 1998 12:19:32 -0400 Received: from gw.sd.aonix.com (gw.alsys.com [136.175.17.2]) by mail.acm.org (8.8.5/8.7.5) with ESMTP id MAA69064 for ; Thu, 24 Sep 1998 12:09:30 -0400 Received: from rasht.sd.aonix.com (mailhub.sd.aonix.com [136.175.1.80]) by gw.sd.aonix.com (8.9.1a/8.9.1) with SMTP id JAA22382; Thu, 24 Sep 1998 09:18:54 -0700 (PDT) Received: from puumba.telesoft by rasht.sd.aonix.com (4.1/TS-1.2c) id AA03203; Thu, 24 Sep 98 09:18:10 PDT Received: by puumba.telesoft (SMI-8.6/SMI-SVR4) id JAA14093; Thu, 24 Sep 1998 09:18:29 -0700 Message-ID: <199809241618.JAA14093@puumba.telesoft> Date: Thu, 24 Sep 1998 09:18:29 -0700 Reply-To: "Steve Blake @pulsar" Sender: ACM SIGADA ASIS Technical Discussion Group From: "Steve Blake @pulsar" Subject: Re: pragma Import as a completion of a subprogram Comments: To: rybin@ACM.ORG To: SIGADA-ASIS-TECH@ACM.ORG Content-Length: 2503 Status: OR >Where is a hole - in ASIS or in my knowlege how to use it? > >The problem is that ASIS does not give any means to get >to know if a subprogram declaration is completed by Import pragma. > >Suppuse we have something like this: > > function Strlen (A : System.Address) return Natural; > pragma Import (C, Strlen); > >Corresponding_Body will get Nil_Element for the declaration of >Strlen. Corresponding_Representation_Clauses will return >the list which will not contain the pragma Import (because >Import is not a representation pragma). > >So, there is no means in ASIS to get to know if Strlen has >a completion (and it has in this case!), and there is no >means to get Import pragma which works as a completion >for the declaration of Strlen. > >Have I missed something important (and obvious)? > >If I have not, this looks like a serious hole in ASIS > >Sergey The function Corresponding_Pragmas given the function declaration of Strlen will return the pragma Import that is associated with it. Analysis of the pragma will reveal that it is an import pragma and the argument name Strlen will match the function it completes. Primitive, yes, but simple secondary queries such as Corresponding_Completion or Is_Completed_By_Import may be useful. Here is the spec: -- 13.38 function Corresponding_Pragmas -------------------------------------------------------------------------------- function Corresponding_Pragmas (Element : in Asis.Element) return Asis.Pragma_Element_List; -------------------------------------------------------------------------------- -- Element - Specifies the element to query -- -- Returns the list of pragmas semantically associated with the given element, -- in their order of appearance, or, in any order that does not affect their -- relative interpretations. These are pragmas that directly affect the -- given element. For example, a pragma Pack affects the type it names. -- -- Returns a Nil_Element_List if there are no semantically associated pragmas. -- --|AN Application Note: --|AN --|AN If the argument is a inherited entry declaration from a derived task --|AN type, all pragmas returned are elements taken from the original task --|AN type's declarative item list. Their Enclosing_Element is the original --|AN type definition and not the derived type definition. --|AN -- Appropriate Element_Kinds: -- A_Declaration -- A_Statement -- -- Returns Element_Kinds: -- A_Pragma Steve