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, T_FILL_THIS_FORM_SHORT autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,680defdd64d3300 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!proxad.net!newsfeed1.ip.tiscali.net!tiscali!transit1.news.tiscali.nl!dreader2.news.tiscali.nl!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Help on Package_Name References: From: Ludovic Brenta Date: Sun, 21 Nov 2004 18:33:57 +0100 Message-ID: <87653z5coq.fsf@insalien.org> User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) Cancel-Lock: sha1:GiiuNZZO7Ipa9p1sALgyVmtBoZM= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Organization: Tiscali bv NNTP-Posting-Date: 21 Nov 2004 18:35:37 CET NNTP-Posting-Host: 83.134.239.200 X-Trace: 1101058537 dreader2.news.tiscali.nl 44081 83.134.239.200:58364 X-Complaints-To: abuse@tiscali.nl Xref: g2news1.google.com comp.lang.ada:6309 Date: 2004-11-21T18:35:37+01:00 List-Id: 19owls writes: > Hi. It's my first day with Ada. heard many wonderful things about > it. i'm not studying programming, but i've done basic C before. > obviously i've read and managed to compile the infamous Hello World! Welcome to Ada! > i have a beginners book on Ada, it keeps referring to student_io > package name for the exercises and examples which is not known to > gnat. i need to know what package name to use whilst handling text, > calculations,strings and so on beyond text_io (which handles strings > only i suppose). For most purposes, Ada.Text_IO is sufficient if you combine it with the attributes 'Image and 'Value. These are attributes of all scalar types (numbers and enumerations). They allow you to convert back and forth between the scalar type and a string. For example: with Ada.Text_IO; procedure Hello_Numeric is Age : Integer; A_String : String (1 .. 20); Last : Natural; begin -- From Integer to String: Ada.Text_IO.Put_Line ("The Answer is " & Integer'Image (42)); Ada.Text_IO.Put ("What is you age? "); Ada.Text_IO.Get_Line (A_String, Last); -- from String to Integer: Age := Integer'Value (A_String (1 .. Last)); end Hello_Numeric; There is also a package named Ada.Integer_Text_IO for Integers. amongst other things, this package allows you to read Integers from the command line, e.g. with Ada.Text_IO; with Ada.Integer_Text_IO; procedure Hello_Numeric is Age : Integer; begin Ada.Text_IO.Put_Line ("The Answer is " & Integer'Image (42)); Ada.Text_IO.Put ("What is you age? "); Ada.Integer_Text_IO.Get (Age); end Hello_Numeric; Once you learn about generics, you will also learn how to create new packages for your own types, e.g. enumerations. But I suggest you stick with Ada.Text_IO and Ada.Integer_Text_IO until you reach that chapter. > in future how do i know of the list of package names to use and what > it is for? thanks. Good question. The definitive source is the Ada Reference Manual: http://www.adaic.org/standards/ada95.html Annex A "Predefined Environment" of the ARM has a list of all predefined packages, as well as the complete specification of their contents. Ada.Text_IO and Ada.Integer_Text_IO are defined there. Student_IO is obviously not part of the predefined environment; it seems to have been written by a teacher for the purposes of his or her course. Perhaps the full contents of Student_IO are in an appendix in your book? If so, you can type it into student_io.ads (specification) and student_io.adb (body) so that GNAT knows about it. If you do not have the full source to Student_IO, I suggest you try another book. There are several beginners' books about Ada on the Ada Information Clearinghouse; they either do not depend on nonstandard packages, or provide the full sources: http://www.adaic.org/learn/textbook.html For beginners, I recommend "Ada 95: The Craft of Object-Oriented Programming" by John English. HTH -- Ludovic Brenta.