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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC,WEIRD_PORT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3c51e088ba4e71cc,start X-Google-Attributes: gid103376,public From: draig@ix.netcom.com (Foucault) Subject: Novice child package question Date: 1997/04/18 Message-ID: <3357ac7d.5108745@netnews.worldnet.att.net>#1/1 X-Deja-AN: 235777845 Organization: AT&T WorldNet Services Reply-To: draig@ix.netcom.com Newsgroups: comp.lang.ada Date: 1997-04-18T00:00:00+00:00 List-Id: 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;