public
anonymous / gist:4070079
Created

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
 
 
with Ada.text_io; use Ada.Text_io;
 
procedure test is
 
-- type declarations needed to define type Lstring -- don't worry about limited private at this stage
 
function toLstring (Str : in String) -- full declaration of the function body
 
function toString (Lstr : Lstring) -- full declaration of the function body
 
lstr1 : Lstring;
 
-- a small procedure to display the contents of an Lstring -- it assumes the type declarations shown above procedure show (lstr : Lstring) is str : str_link; begin if lstr = null then return; end if;
 
str := lstr.list; while str /= null loop Put(str.data); str := str.next; end loop; new_line; end show;
 
begin
 
lstr1 := toLstring("This is a test string"); show(lstr1); put_line("'" & toString(lstr1) & "'");
 
end test;

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.