comp.lang.ada
 help / color / mirror / Atom feed
From: draig@ix.netcom.com (Foucault)
Subject: Novice child package question
Date: 1997/04/18
Date: 1997-04-18T00:00:00+00:00	[thread overview]
Message-ID: <3357ac7d.5108745@netnews.worldnet.att.net> (raw)


Ok I'm pretty new to Ada and I'm trying to access the
functions within the package Ada.Strings.Bounded to use on a
string with a bounded length of 80.  I'm using GNAT3.09 on a intel
system,  when I try to compile this code I get the following errors:

gcc -c -IF:\MYDOCU~1\ADAASS~1\ -I- -x ada
F:\MYDOCU~1\ADAASS~1\STRING.ADB
STRING.ADB:14:11: warning: file name does not match unit name, should
be "usestring.adb"
STRING.ADB:24:04: "Replace_Slice" is not visible
STRING.ADB:24:04: non-visible declaration at a-strbou.ads:283
STRING.ADB:24:04: non-visible declaration at a-strbou.ads:275
STRING.ADB:26:25: "length" is not visible
STRING.ADB:26:25: non-visible declaration at a-strbou.ads:38
gnatmake: "F:\MYDOCU~1\ADAASS~1\STRING.ADB" compilation error

I'm assuming that I need to access the generic  package
ada.strings.bounded_length in order to use the replace_slice procedure
but I have no clue as to how to declare it.

in Cohen's Ada book he gives the following instantiation :
	with Ada.Strings.Bounded;
	package Bounded_80 is
		new Ada.Strings.Bounded.Generic_Bounded_length(80);
But when I put this into my code I get a variety of errors such as
STRING.ADB:15:01: end of file expected, file can have only one
compilation unit

Is there a relatively simple solution to what must be a rather basic
question?
Thanks for any enlightenment bestowed upon me,
	Gregor
My source follows:
____________________________________

WITH Ada.Text_IO;
USE Ada.Text_IO;

WITH Ada.Integer_Text_IO;
USE Ada.Integer_Text_IO;

WITH Ada.Strings;
USE  Ada.Strings;

WITH Ada.Strings.Bounded;
USE  Ada.Strings.Bounded;


Procedure UseString is 
   
   sentence :string(1..80);
   senlength:integer;

Begin
   put_line("Enter a text string:");
   get_line(sentence, senlength);
   put_line(sentence(1..senlength));

   Replace_Slice
        (Sentence, 8,11,"AdA!");
   put_line(sentence(1..senlength));
end UseString;




             reply	other threads:[~1997-04-18  0:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-04-18  0:00 Foucault [this message]
1997-04-18  0:00 ` Novice child package question Jon S Anthony
replies disabled

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