comp.lang.ada
 help / color / mirror / Atom feed
* (GNADE) Access attribute not allowed in generic body
@ 2013-08-15  7:27 Dwiki
  2013-08-15  7:37 ` Dwiki
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Dwiki @ 2013-08-15  7:27 UTC (permalink / raw)


hello again,
im trying to compile app using gnade (1.5.3a) in windows, but it show error message 

gnu-db-sqlcli-dispatch-a_string.adb:62:40: 'Access attribute not allowed in gene
ric body
gnu-db-sqlcli-dispatch-a_string.adb:62:40: because access type "Attr_Get_Func" i
s declared outside generic unit (RM 3.10.2(32))
gnu-db-sqlcli-dispatch-a_string.adb:62:40: move 'Access to private part, or (Ada
 2005) use anonymous access type instead of "Attr_Get_Func"
gnu-db-sqlcli-dispatch-a_string.adb:63:40: 'Access attribute not allowed in gene
ric body
gnu-db-sqlcli-dispatch-a_string.adb:63:40: because access type "Attr_Set_Proc" i
s declared outside generic unit (RM 3.10.2(32))
gnu-db-sqlcli-dispatch-a_string.adb:63:40: move 'Access to private part, or (Ada
 2005) use anonymous access type instead of "Attr_Set_Proc"
completed 1 out of 1 (100%)...
gprbuild: *** compilation phase failed

any clue?

thank you....

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: (GNADE) Access attribute not allowed in generic body
  2013-08-15  7:27 (GNADE) Access attribute not allowed in generic body Dwiki
@ 2013-08-15  7:37 ` Dwiki
  2013-08-15  7:53 ` Dmitry A. Kazakov
  2013-08-15 13:42 ` Shark8
  2 siblings, 0 replies; 10+ messages in thread
From: Dwiki @ 2013-08-15  7:37 UTC (permalink / raw)


Pada Kamis, 15 Agustus 2013 14:27:58 UTC+7, Dwiki  menulis:
> hello again,
> 
> im trying to compile app using gnade (1.5.3a) in windows, but it show error message 
> 
> 
> 
> gnu-db-sqlcli-dispatch-a_string.adb:62:40: 'Access attribute not allowed in gene
> 
> ric body
> 
> gnu-db-sqlcli-dispatch-a_string.adb:62:40: because access type "Attr_Get_Func" i
> 
> s declared outside generic unit (RM 3.10.2(32))
> 
> gnu-db-sqlcli-dispatch-a_string.adb:62:40: move 'Access to private part, or (Ada
> 
>  2005) use anonymous access type instead of "Attr_Get_Func"
> 
> gnu-db-sqlcli-dispatch-a_string.adb:63:40: 'Access attribute not allowed in gene
> 
> ric body
> 
> gnu-db-sqlcli-dispatch-a_string.adb:63:40: because access type "Attr_Set_Proc" i
> 
> s declared outside generic unit (RM 3.10.2(32))
> 
> gnu-db-sqlcli-dispatch-a_string.adb:63:40: move 'Access to private part, or (Ada
> 
>  2005) use anonymous access type instead of "Attr_Set_Proc"
> 
> completed 1 out of 1 (100%)...
> 
> gprbuild: *** compilation phase failed
> 
> 
> 
> any clue?
> 
> 
> 
> thank you....

here is the code 

   procedure Register (Index : in Attr.T) is
   begin
      Get_Dispatch_Array (Index) := Get'Access;
      Set_Dispatch_Array (Index) := Set'Access;
   end Register;


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: (GNADE) Access attribute not allowed in generic body
  2013-08-15  7:27 (GNADE) Access attribute not allowed in generic body Dwiki
  2013-08-15  7:37 ` Dwiki
@ 2013-08-15  7:53 ` Dmitry A. Kazakov
  2013-08-15  8:17   ` Dwiki
                     ` (2 more replies)
  2013-08-15 13:42 ` Shark8
  2 siblings, 3 replies; 10+ messages in thread
From: Dmitry A. Kazakov @ 2013-08-15  7:53 UTC (permalink / raw)


On Thu, 15 Aug 2013 00:27:58 -0700 (PDT), Dwiki wrote:

> im trying to compile app using gnade (1.5.3a) in windows, but it show error message 
[...]
> any clue?

Yes, I remember these errors caused by Ada 2005 vs. 95 incompatibilities.

I stopped using GNADE long ago, but I still have the fixes I made in GNADE
2.0. I moved Get and Set to private part of the package and used
'Unrestricted_Access in Register. E.g.:
-----------------------------
with GNU.DB.SQLCLI.Generic_Attr.String_Attribute;
pragma Elaborate_All (GNU.DB.SQLCLI.Generic_Attr.String_Attribute);

generic
package GNU.DB.SQLCLI.Dispatch.A_String is

   package Derived is new Attr.String_Attribute;
   subtype Info is Derived.Attribute_Value_Pair_String;

   procedure Register (Index : in Attr.T);
   pragma Inline_Always (Register);

private
   function Get (Handle    : Ctx;
                 Attribute : Attr.T;
                 MaxLength : SQLSMALLINT := 0;
                 Data      : Attr.Aux;
                 ErrorCode : access SQLRETURN)
                return Attr.Attribute_Value_Pair'Class;
   procedure Set (Handle    : in  Ctx;
                  AV_Pair   : in  Attr.Attribute_Value_Pair'Class;
                  Data      : in  Attr.Aux;
                  ErrorCode : out SQLRETURN);

end GNU.DB.SQLCLI.Dispatch.A_String;
--------------------------------
package body GNU.DB.SQLCLI.Dispatch.A_String is

   function Get (Handle    : Ctx;
                 Attribute : Attr.T;
                 MaxLength : SQLSMALLINT := 0;
                 Data      : Attr.Aux;
                 ErrorCode : access SQLRETURN)
                return Attr.Attribute_Value_Pair'Class is
   begin
      return Info (Derived.GetAttr (Handle,
                                    Attribute,
                                    Data,
                                    MaxLength,
                                    ErrorCode));
   end Get;

   procedure Set (Handle    : in  Ctx;
                  AV_Pair   : in  Attr.Attribute_Value_Pair'Class;
                  Data      : in  Attr.Aux;
                  ErrorCode : out SQLRETURN) is
   begin
      if not (AV_Pair in Info'Class) then
         Raise_SQL_Error
           (ProcedureName => "SetAttr",
            ErrorMessage  => "Attribute value is not a String",
            RC            => SQL_ADA95_TYPE_ERROR);
      end if;
      Derived.SetAttr (Handle, Info (AV_Pair), Data, ErrorCode);
   end Set;

   procedure Register (Index : in Attr.T) is
   begin
      Get_Dispatch_Array (Index) := Get'Unrestricted_Access;
      Set_Dispatch_Array (Index) := Set'Unrestricted_Access;
   end Register;

end GNU.DB.SQLCLI.Dispatch.A_String;
-----------------------------------
I cannot tell if that helps, because, as I said I don't use it anymore.

P.S.

1. GNADE seems to be not maintained.

2. GNADE ODBC bindings will certainly not work on any natively 64-bit
platform because MS changed ODBC API. If you want ODBC bindings you can try
these:

http://www.dmitry-kazakov.de/ada/components.htm#ODBC_Bindings

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: (GNADE) Access attribute not allowed in generic body
  2013-08-15  7:53 ` Dmitry A. Kazakov
@ 2013-08-15  8:17   ` Dwiki
  2013-08-16 16:46     ` Stephen Leake
  2013-08-15  8:37   ` egilhh
  2013-08-16 16:44   ` Stephen Leake
  2 siblings, 1 reply; 10+ messages in thread
From: Dwiki @ 2013-08-15  8:17 UTC (permalink / raw)


Pada Kamis, 15 Agustus 2013 14:53:37 UTC+7, Dmitry A. Kazakov  menulis:
> On Thu, 15 Aug 2013 00:27:58 -0700 (PDT), Dwiki wrote:
> 
> 
> 
> > im trying to compile app using gnade (1.5.3a) in windows, but it show error message 
> 
> [...]
> 
> > any clue?
> 
> 
> 
> Yes, I remember these errors caused by Ada 2005 vs. 95 incompatibilities.
> 
> 
> 
> I stopped using GNADE long ago, but I still have the fixes I made in GNADE
> 
> 2.0. I moved Get and Set to private part of the package and used
> 
> 'Unrestricted_Access in Register. E.g.:
> 
> -----------------------------
> 
> with GNU.DB.SQLCLI.Generic_Attr.String_Attribute;
> 
> pragma Elaborate_All (GNU.DB.SQLCLI.Generic_Attr.String_Attribute);
> 
> 
> 
> generic
> 
> package GNU.DB.SQLCLI.Dispatch.A_String is
> 
> 
> 
>    package Derived is new Attr.String_Attribute;
> 
>    subtype Info is Derived.Attribute_Value_Pair_String;
> 
> 
> 
>    procedure Register (Index : in Attr.T);
> 
>    pragma Inline_Always (Register);
> 
> 
> 
> private
> 
>    function Get (Handle    : Ctx;
> 
>                  Attribute : Attr.T;
> 
>                  MaxLength : SQLSMALLINT := 0;
> 
>                  Data      : Attr.Aux;
> 
>                  ErrorCode : access SQLRETURN)
> 
>                 return Attr.Attribute_Value_Pair'Class;
> 
>    procedure Set (Handle    : in  Ctx;
> 
>                   AV_Pair   : in  Attr.Attribute_Value_Pair'Class;
> 
>                   Data      : in  Attr.Aux;
> 
>                   ErrorCode : out SQLRETURN);
> 
> 
> 
> end GNU.DB.SQLCLI.Dispatch.A_String;
> 
> --------------------------------
> 
> package body GNU.DB.SQLCLI.Dispatch.A_String is
> 
> 
> 
>    function Get (Handle    : Ctx;
> 
>                  Attribute : Attr.T;
> 
>                  MaxLength : SQLSMALLINT := 0;
> 
>                  Data      : Attr.Aux;
> 
>                  ErrorCode : access SQLRETURN)
> 
>                 return Attr.Attribute_Value_Pair'Class is
> 
>    begin
> 
>       return Info (Derived.GetAttr (Handle,
> 
>                                     Attribute,
> 
>                                     Data,
> 
>                                     MaxLength,
> 
>                                     ErrorCode));
> 
>    end Get;
> 
> 
> 
>    procedure Set (Handle    : in  Ctx;
> 
>                   AV_Pair   : in  Attr.Attribute_Value_Pair'Class;
> 
>                   Data      : in  Attr.Aux;
> 
>                   ErrorCode : out SQLRETURN) is
> 
>    begin
> 
>       if not (AV_Pair in Info'Class) then
> 
>          Raise_SQL_Error
> 
>            (ProcedureName => "SetAttr",
> 
>             ErrorMessage  => "Attribute value is not a String",
> 
>             RC            => SQL_ADA95_TYPE_ERROR);
> 
>       end if;
> 
>       Derived.SetAttr (Handle, Info (AV_Pair), Data, ErrorCode);
> 
>    end Set;
> 
> 
> 
>    procedure Register (Index : in Attr.T) is
> 
>    begin
> 
>       Get_Dispatch_Array (Index) := Get'Unrestricted_Access;
> 
>       Set_Dispatch_Array (Index) := Set'Unrestricted_Access;
> 
>    end Register;
> 
> 
> 
> end GNU.DB.SQLCLI.Dispatch.A_String;
> 
> -----------------------------------
> 
> I cannot tell if that helps, because, as I said I don't use it anymore.
> 
> 
> 
> P.S.
> 
> 
> 
> 1. GNADE seems to be not maintained.
> 
> 
> 
> 2. GNADE ODBC bindings will certainly not work on any natively 64-bit
> 
> platform because MS changed ODBC API. If you want ODBC bindings you can try
> 
> these:
> 
> 
> 
> http://www.dmitry-kazakov.de/ada/components.htm#ODBC_Bindings
> 
> 
> 
> -- 
> 
> Regards,
> 
> Dmitry A. Kazakov
> 
> http://www.dmitry-kazakov.de

GOD BLESS YOU Dmitry, big thanks it works now,
im using gnade because there is a minor change in old application that using gnade, one more time u save me and my job :D


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: (GNADE) Access attribute not allowed in generic body
  2013-08-15  7:53 ` Dmitry A. Kazakov
  2013-08-15  8:17   ` Dwiki
@ 2013-08-15  8:37   ` egilhh
  2013-08-16 16:44   ` Stephen Leake
  2 siblings, 0 replies; 10+ messages in thread
From: egilhh @ 2013-08-15  8:37 UTC (permalink / raw)


On Thursday, August 15, 2013 9:53:37 AM UTC+2, Dmitry A. Kazakov wrote:
> 
> 2.0. I moved Get and Set to private part of the package and used
> 
> 'Unrestricted_Access in Register. E.g.:


'Unrestricted_Access is Gnat-specific. A more portable alternative would
be constants in the private part of the spec:


> with GNU.DB.SQLCLI.Generic_Attr.String_Attribute;

[...] 
 
> private
> 
>    function Get (Handle    : Ctx;
> 
>                  Attribute : Attr.T;
> 
>                  MaxLength : SQLSMALLINT := 0;
> 
>                  Data      : Attr.Aux;
> 
>                  ErrorCode : access SQLRETURN)
> 
>                 return Attr.Attribute_Value_Pair'Class;
> 
>    procedure Set (Handle    : in  Ctx;
> 
>                   AV_Pair   : in  Attr.Attribute_Value_Pair'Class;
> 
>                   Data      : in  Attr.Aux;
> 
>                   ErrorCode : out SQLRETURN);

Get_Access : constant Attr_Get_Func := Get'Access;
Set_Access : constant Attr_Set_Proc := Set'Access;

> end GNU.DB.SQLCLI.Dispatch.A_String;
> 
> --------------------------------
> 
> package body GNU.DB.SQLCLI.Dispatch.A_String is

[...]

>    procedure Register (Index : in Attr.T) is
> 
>    begin

Get_Dispatch_Array (Index) := Get_Access;
Set_Dispatch_Array (Index) := Set_Access;
 
>    end Register;
> 
> 
> 
> end GNU.DB.SQLCLI.Dispatch.A_String;
> 
> -----------------------------------


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: (GNADE) Access attribute not allowed in generic body
  2013-08-15  7:27 (GNADE) Access attribute not allowed in generic body Dwiki
  2013-08-15  7:37 ` Dwiki
  2013-08-15  7:53 ` Dmitry A. Kazakov
@ 2013-08-15 13:42 ` Shark8
  2013-08-15 15:10   ` Adam Beneschan
  2 siblings, 1 reply; 10+ messages in thread
From: Shark8 @ 2013-08-15 13:42 UTC (permalink / raw)


On Thursday, August 15, 2013 1:27:58 AM UTC-6, Dwiki wrote:
> hello again,
> 
> im trying to compile app using gnade (1.5.3a) in windows, but it show error message 
> 
> 
> 
> gnu-db-sqlcli-dispatch-a_string.adb:62:40: 'Access attribute not allowed in gene
> 
> ric body
> 
> gnu-db-sqlcli-dispatch-a_string.adb:62:40: because access type "Attr_Get_Func" i
> 
> s declared outside generic unit (RM 3.10.2(32))
> 
> gnu-db-sqlcli-dispatch-a_string.adb:62:40: move 'Access to private part, or (Ada
> 
>  2005) use anonymous access type instead of "Attr_Get_Func"
> 
> gnu-db-sqlcli-dispatch-a_string.adb:63:40: 'Access attribute not allowed in gene
> 
> ric body
> 
> gnu-db-sqlcli-dispatch-a_string.adb:63:40: because access type "Attr_Set_Proc" i
> 
> s declared outside generic unit (RM 3.10.2(32))
> 
> gnu-db-sqlcli-dispatch-a_string.adb:63:40: move 'Access to private part, or (Ada
> 
>  2005) use anonymous access type instead of "Attr_Set_Proc"
> 
> completed 1 out of 1 (100%)...
> 
> gprbuild: *** compilation phase failed
> 
> 
> 
> any clue?
> 
> 
> 
> thank you....

If it's a Ada 2005/2012 incompatibility as Dmitry suggests you can try throwing "pragma Ada_2005;" as the first-line in the body. And, if you're using GNAT, you can use different Ada versions for the spec and body... which means you can add the pre/post condition aspects [and an Ada_2012 pragma] to the spec and keep your working Ada 2005 (or 95, or possibly 83*) and add the appropriate pragma.

* Ada 83 doesn't allow child-packages to be with/used, this can be alleviated by creating a library-level rename and using that.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: (GNADE) Access attribute not allowed in generic body
  2013-08-15 13:42 ` Shark8
@ 2013-08-15 15:10   ` Adam Beneschan
  0 siblings, 0 replies; 10+ messages in thread
From: Adam Beneschan @ 2013-08-15 15:10 UTC (permalink / raw)


On Thursday, August 15, 2013 6:42:12 AM UTC-7, Shark8 wrote:

> If it's a Ada 2005/2012 incompatibility as Dmitry suggests you can try throwing "pragma Ada_2005;" as the first-line in the body.

No, it's an Ada 95/2005 incompatibility (the rules about 'Access on a subprogram in a generic body were changed because the old rules led to problems in some cases).  So I guess you'd need "pragma Ada_95;" or something like that? 

                                -- Adam


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: (GNADE) Access attribute not allowed in generic body
  2013-08-15  7:53 ` Dmitry A. Kazakov
  2013-08-15  8:17   ` Dwiki
  2013-08-15  8:37   ` egilhh
@ 2013-08-16 16:44   ` Stephen Leake
  2 siblings, 0 replies; 10+ messages in thread
From: Stephen Leake @ 2013-08-16 16:44 UTC (permalink / raw)


"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:

> 1. GNADE seems to be not maintained.

Correct. The current recommendation is to use gnatcoll.

When compiling any GNAT tools, and applications based on them, you
should always use a consistent set of binaries and sources from the most
recent GNAT GPL release.

-- 
-- Stephe


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: (GNADE) Access attribute not allowed in generic body
  2013-08-15  8:17   ` Dwiki
@ 2013-08-16 16:46     ` Stephen Leake
  2013-08-18 13:40       ` Dwiki
  0 siblings, 1 reply; 10+ messages in thread
From: Stephen Leake @ 2013-08-16 16:46 UTC (permalink / raw)


Dwiki <dwiki.jtk07@gmail.com> writes:

>> 
>> ...
>> 
>
> 
> im using gnade because there is a minor change in old application that
> using gnade, one more time u save me and my job :D

Please strip parts of the original article that are not relevant to your
reply; it is tedious to have to scroll through lots of quoted text only
to discover it's not relevant.

-- 
-- Stephe

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: (GNADE) Access attribute not allowed in generic body
  2013-08-16 16:46     ` Stephen Leake
@ 2013-08-18 13:40       ` Dwiki
  0 siblings, 0 replies; 10+ messages in thread
From: Dwiki @ 2013-08-18 13:40 UTC (permalink / raw)


> Please strip parts of the original article that are not relevant to your
> 
> reply; it is tedious to have to scroll through lots of quoted text only
> 
> to discover it's not relevant.

ok,thank you for advise, and sorry for inconvenience :)


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-08-18 13:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-15  7:27 (GNADE) Access attribute not allowed in generic body Dwiki
2013-08-15  7:37 ` Dwiki
2013-08-15  7:53 ` Dmitry A. Kazakov
2013-08-15  8:17   ` Dwiki
2013-08-16 16:46     ` Stephen Leake
2013-08-18 13:40       ` Dwiki
2013-08-15  8:37   ` egilhh
2013-08-16 16:44   ` Stephen Leake
2013-08-15 13:42 ` Shark8
2013-08-15 15:10   ` Adam Beneschan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox