1
2
3
4
5
6
7
8
9
|
------------------------------------------------------------------------------
-- Copyright (c) 2013-2014, Natacha Porté --
-- --
-- Permission to use, copy, modify, and distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF --
|
|
|
1
2
3
4
5
6
7
8
9
|
------------------------------------------------------------------------------
-- Copyright (c) 2013-2019, Natacha Porté --
-- --
-- Permission to use, copy, modify, and distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF --
|
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
-- Create a new Cursor pointing at the beginning of Cache
function Move (Source : in out S_Expressions.Descriptor'Class) return Cursor
is (Move (Source).First);
-- Return a cursor holding a copy of Original (which is
-- destructively read)
private
type Atom_Access is access Atom;
for Atom_Access'Storage_Pool use Atom_Pool;
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(Atom, Atom_Access);
|
>
>
>
>
>
>
>
|
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
-- Create a new Cursor pointing at the beginning of Cache
function Move (Source : in out S_Expressions.Descriptor'Class) return Cursor
is (Move (Source).First);
-- Return a cursor holding a copy of Original (which is
-- destructively read)
function Conditional_Move
(Source : in out S_Expressions.Descriptor'Class)
return Cursor
is (if Source in Cursor then Cursor (Source) else Move (Source).First);
-- Return a copy of Source, with cheap copy if possible,
-- otherwise with destructive Move
private
type Atom_Access is access Atom;
for Atom_Access'Storage_Pool use Atom_Pool;
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(Atom, Atom_Access);
|