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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,18f7cf743c6dec5,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2000-12-21 09:45:24 PST Path: supernews.google.com!sn-xit-02!supernews.com!isdnet!howland.erols.net!newsfeed.skycache.com!Cidera!cyclone1.ba-dsg.net!typhoon2.ba-dsg.net.POSTED!not-for-mail Message-ID: <3A42418F.ACCD532A@vdu.org> From: Jef Kelmo X-Mailer: Mozilla 4.75 (Macintosh; U; PPC) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Strings Content-Type: text/plain; charset=us-ascii; x-mac-type="54455854"; x-mac-creator="4D4F5353" Content-Transfer-Encoding: 7bit Date: Thu, 21 Dec 2000 17:45:22 GMT NNTP-Posting-Host: 151.199.126.148 X-Complaints-To: newsadmin@bellatlantic.net X-Trace: typhoon2.ba-dsg.net 977420722 151.199.126.148 (Thu, 21 Dec 2000 12:45:22 EST) NNTP-Posting-Date: Thu, 21 Dec 2000 12:45:22 EST Xref: supernews.google.com comp.lang.ada:3323 Date: 2000-12-21T17:45:22+00:00 List-Id: Hello, This is not a homework question. In 5 months, I will begin work that uses Ada and am trying to become familiar with it now. But I am having a problem with how to use strings; a problem that seems common across a number of languages, including C++ and Java. I entered the following... ---------------------------------------------------------------------------------------------------------- with Ada.Text_IO; with Ada.Strings.Bounded; procedure My_Strings is type Bounded_80 is new Ada.Strings.Bounded.Generic_Bounded_Length(80); a1 : Bounded_80.Bounded_String := Bounded_80.To_Bounded_String("Some Text"); begin Ada.Text_IO.Put(Bounded_80.To_String(a1)); Ada.Text_IO.New_Line; end My_Strings; ---------------------------------------------------------------------------------------------------------- ...and when I compile, I get the following... gcc -c my_strings.adb my_strings.adb:5:47: subtype mark required in this context my_strings.adb:5:70: incorrect constraint for this kind of type my_strings.adb:7:10: invalid prefix in selected component "Bounded_80" my_strings.adb:7:39: invalid prefix in selected component "Bounded_80" my_strings.adb:12:21: invalid prefix in selected component "Bounded_80" gnatmake: "my_strings.adb" compilation error So my first guess is to change... type Bounded_80 is new Ada.Strings.Bounded.Generic_Bounded_Length(80); ...to... subtype Bounded_80 is new Ada.Strings.Bounded.Generic_Bounded_Length(80); ...in which case I get... gcc -c my_strings.adb my_strings.adb:5:27: "new" ignored (only allowed in type declaration) gnatmake: "my_strings.adb" compilation error ...so I remove the "new" and get... gcc -c my_strings.adb my_strings.adb:5:46: subtype mark required in this context my_strings.adb:5:69: incorrect constraint for this kind of type my_strings.adb:7:10: invalid prefix in selected component "Bounded_80" my_strings.adb:7:39: invalid prefix in selected component "Bounded_80" my_strings.adb:12:21: invalid prefix in selected component "Bounded_80" gnatmake: "my_strings.adb" compilation error Is it obvious by now that I don't know what I am doing? I have a copy of Ada as a 2d Language and I looked up the Ada Reference on adapower.com, but everything is too vague and anything I try does not work. I just want a usable string. How would I change the above code to do this? And could someone please point me to a site that gives actual, concrete examples of simple string use? Thanks. James