![]() Position : in out Cursor ) procedure Splice (Container : in out List Source : in out List ) procedure Splice (Target : in out List J : in Cursor ) procedure Splice (Target : in out List J : in Cursor ) procedure Swap_Links (Container : in out List Source : in out List ) procedure Insert (Container : in out List Ĭount : in Count_Type := 1 ) procedure Insert (Container : in out List Ĭount : in Count_Type := 1 ) procedure Prepend (Container : in out List Ĭount : in Count_Type := 1 ) procedure Append (Container : in out List Ĭount : in Count_Type := 1 ) procedure Delete (Container : in out List Ĭount : in Count_Type := 1 ) procedure Delete_First (Container : in out List Ĭount : in Count_Type := 1 ) procedure Delete_Last (Container : in out List Ĭount : in Count_Type := 1 ) procedure Reverse_Elements (Container : in out List ) procedure Swap (Container : in out List Process : not null access procedure (Element : in out Element_Type ) ) procedure Move (Target : in out List Process : not null access procedure (Element : in Element_Type ) ) procedure Update_Element New_Item : in Element_Type ) procedure Query_Element Right : in List ) return Boolean function Length (Container : in List ) return Count_Type function Is_Empty (Container : in List ) return Boolean procedure Clear (Container : in out List ) function Element (Position : in Cursor ) return Element_Type procedure Replace_Element (Container : in out List No_Element : constant Cursor function " =" (Left : in List Doubly_Linked_Lists is pragma Preelaborate (Doubly_Linked_Lists ) type List is tagged private pragma Preelaborable_Initialization (List ) type Cursor is private pragma Preelaborable_Initialization (Cursor ) Right : in Element_Type ) return Boolean is package Ada. ![]() SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual - generic type Element_Type is private with function " =" (Left : in Element_Type Specification - Standard Ada library specification - Copyright (c) 2003-2018 Maxim Reznik - Copyright (c) 2004-2016 AXE Consultants - Copyright (c) 2004, 2005, 2006 Ada-Europe - Copyright (c) 2000 The MITRE Corporation, Inc. The worm body is now represented by a doubly linked list, meaning we can loop through each element in either direction, by using the Next and Previous functions.įor those interested, the game can be found at GitHub. This type represents a tile type in a 2-dimensional array. Lvl : in Level_Access ) procedure Turn_Left (Worm : in Worm_Type_Access ) procedure Turn_Right (Worm : in Worm_Type_Access ) procedure Kill (Worm : in Worm_Type_Access ) end Worm Īs you can see, _Linked_Lists is instantiated with a type called “Position”. Doubly_Linked_Lists (Position ) use Worm_Position_Container type Worm_State is (Alive ,Dead ,Observing ) type Worm_Type is recordįull : Boolean := False end record type Worm_Type_Access is access Worm_Type procedure Update_Worm (Worm : in Worm_Type_Access Doubly_Linked_Lists with Wormlevel, Protocol -, Handlers package Worm is use Wormlevel, Protocol -, Handlers package Worm_Position_Container is new Ada. This file represents the specification of a worm. This is example usage is from an existing project. For more information, see doubly linked list. Doubly_Linked_Lists library works.Ī doubly linked list is merely a linked list where each element is not only linked to the next, but also the previous. This library enables the Ada developer to manipulate data structures such as doubly linked lists, maps, sets and vectors. One of the major additions to Ada 2005 is the container library. You can improve the Ada Programming wikibook by reading the contributing guidelines and expanding it. I think you can probably fix it from there.This page is a stub. but that fails on both compilers with list.adb:2:33: expected type "Standard.Integer" Or in your case Head : Node_Ptr := new Node'(null, null) ![]() Pointing at the opening paren of (null, null) it has seen the Node_Ptr’ and parsed the (null, null) sufficiently to see that it’s a composite type and can’t possibly be a value compatible with Node_Ptr.Īs has already been said, the correct way of allocating a value is FP : Foo_Ptr := new In contrast, GCC 4.9.1 says list.adb:2:35: expected type "Node_Ptr" defined at list.ads:3 ![]() Which is pointing at the ’ after the last character of Node_Ptr the compiler has seen Head : Node_Ptr := new and is expecting the type Node. List.adb:2:34: found type "Node_Ptr" defined at list.ads:3 The error message that GNAT GPL 2014 gives is list.adb:2:34: expected type "Node" defined at list.ads:5 The line with the error is Head: Node_Ptr := new Node_Ptr'(null, null)
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |