From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a0b40cf773574050,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-24 05:13:14 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: gilmour@banda.lv (gilmour) Newsgroups: comp.lang.ada Subject: Error message: expect valid subtype mark to instantiate .... Date: 24 Dec 2003 05:13:13 -0800 Organization: http://groups.google.com Message-ID: <4138e9c3.0312240513.377090e8@posting.google.com> NNTP-Posting-Host: 213.182.215.131 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1072271593 29848 127.0.0.1 (24 Dec 2003 13:13:13 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 24 Dec 2003 13:13:13 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:3778 Date: 2003-12-24T05:13:13-08:00 List-Id: Compiling 'Client_Account_List.ads' following message appears: client_account_list.ads:4:47: expect valid subtype mark to instantiate "T" Somebody please advise, what is wrong ??? These are the code samples: -- Class_List.ads with Ada.Finalization, Unchecked_Deallocation; use Ada.Finalization; generic type T is private; --Any type package Class_List is type List is new Controlled with private; procedure Initialize ( The : in out List ); procedure Initialize ( The : in out List; Data : in T ); procedure Finalize ( The : in out List ); procedure Adjust ( The : in out List ); function "=" ( F : in List; S : in List ) return Boolean; private type Node; --Tentative declaration type P_Node is access all Node; --Pointer to Node type Node is record Prev : P_Node; --Previous Node Item : T; --The physical item Next : P_Node; --Next Node end record; type List is new Controlled with record First_Node : aliased P_Node := null; --First item in list Last_Node : aliased P_Node := null; --First item in list end record; end Class_List; -- Class_List.adb package body Class_List is procedure Dispose_Node is new Unchecked_Deallocation( Node, P_Node ); procedure Release_Storage ( The : in out List ) is Cur : P_Node := The.First_Node; --Pointer to curr node Tmp : P_Node; --Node to dispose begin while Cur /= null loop --For each item in list Tmp := Cur; --Item to dispose Cur := Cur.Next; --Next node Dispose_Node( Tmp ); --Dispose of item end loop; end Release_Storage; procedure Initialize ( The : in out List ) is begin The.First_Node := null; --Empty list The.Last_Node := null; --Empty list end Initialize; procedure Initialize ( The : in out List; Data : in T ) is begin The.First_Node := new Node'(null, Data, null); The.Last_Node := The.First_Node; end Initialize; procedure Finalize ( The : in out List ) is begin if The.First_Node /= null then Release_Storage( The ); The.First_Node := null; end if; end Finalize; procedure Adjust ( The : in out List ) is Cur : P_Node := The.First_Node; --Original list Lst : P_Node := null; --Last created node Prv : P_Node := null; --Previously created node Fst : P_Node := null; --The first node begin while Cur /= null loop Lst := new Node'( Prv, Cur.Item, null ); if Fst = null then Fst := Lst; end if; if Prv /= null then Prv.Next := Lst; end if; Prv := Lst; Cur := Cur.Next; --Next node end loop; The.First_Node := Fst; --Update The.Last_Node := Lst; end Adjust; function "=" ( F : in List; S : in List ) return Boolean is F_Node : P_Node := F.First_Node; --First list S_Node : P_Node := S.First_Node; --Second list begin while F_Node /= null and S_Node /= null loop if F_Node.Item /= S_Node.Item then return False; --Different items end if; F_Node := F_Node.Next; S_Node := S_Node.Next; end loop; return F_Node = S_Node; --Both NULL if equal end "="; end Class_List; -- Class_Client_Acount.ads with Gnat.Sockets; use Gnat.Sockets; package Class_Client_Account is type Client_Account is tagged private; procedure Set_Id(The : in out Client_Account; Id : String); procedure Set_Channel(The : in out Client_Account; Channel : Stream_Access); function Get_Id(The : in Client_Account) return String; function Get_Channel(The : in Client_Account) return Stream_Access; private type Client_Account is tagged record Id : String(1 .. 8); Channel : Stream_Access; end record; end Class_Client_Account; -- Class_Client_Acount.adb package body Class_Client_Account is procedure Set_Id(The : in out Client_Account; Id : String) is begin The.Id:=Id; end; procedure Set_Channel(The : in out Client_Account; Channel : Stream_Access) is begin The.Channel:=Channel; end; function Get_Id(The : in Client_Account) return String is begin return The.Id; end Get_Id; function Get_Channel(The : in Client_Account) return Stream_Access is begin return The.Channel; end Get_Channel; end Class_Client_Account; -- Client_Account_List.ads with Class_List; with Class_Client_Account; pragma Elaborate_All(Class_List); package Client_Account_List is new Class_List(Class_Client_Account);