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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,aa7b0448abeecbba X-Google-Attributes: gid103376,public From: Laurent.Guerby@enst-bretagne.fr (Laurent Guerby) Subject: Re: How to print Task_ID type? (GNAT SunOS) Date: 1996/04/05 Message-ID: <4xu3yzpoi7.fsf@leibniz.enst-bretagne.fr>#1/1 X-Deja-AN: 145854315 distribution: world sender: guerby@leibniz.enst-bretagne.fr references: <316308F0.6375@ee.ubc.ca> content-type: text/plain; charset=US-ASCII organization: Telecom Bretagne mime-version: 1.0 newsgroups: comp.lang.ada Date: 1996-04-05T00:00:00+00:00 List-Id: Greg Bond writes : Indeed it is. My oversight. This function does not handle the more : general problem I posed though. Is there a general facility for printing : access types? No, like in C you have to convert them to an integer type before printing them using your favourite output routine (printf or Put ;-). This can be done in "portable" Ada 95 (as far as this kind of game can be tagged as portable ...) : 1. Instanciate System.Address_To_Access_Conversions for your object type, RM95-13.7.2. 2. Use System.Storage_Elements.To_Integer to convert your Address to an implementation defined integer type, System.Storage_Elements. Integer_Address, RM95-13.7.1. 3. Use the Image attribute on this integer type. You can't use Text_IO.Integer_IO because the type can be a signed or modular integer type, RM95-13.7.1(13). 4. Put (The_Resulting_String); -- !! [Note: if you want to do low level manipulation, you've to cope with chapter 13, and with 13.7 "The package System", no other way, I think most books, for many good reasons, don't talk about that.] [Note 2 : I give my vote for chapter 13 as less human-comprehensible part of the RM ;-] [Note 3 : guess where you find the more annotation in the annotated reference manual ;-] Of course, if you're using GNAT (available freely on most platform used by normal human with a keyboard ;-), you can safely use your knowledge of the particular GNAT implementation ("Use the Source", see my signature ;-). And, as documented, all GNAT basic types are the same as their C equivalent ;-). : The GNAT implementation of the Image function above is a : system level (i.e. platform dependent) routine specifically for the : Task_ID type. The only Ada references I've got are Barnes for Ada 95 and : the ALRM, both of which are woefully inadequate on the topic of Ada I/O. I don't share your point of view (both on Barnes and on the RM95 ;-). You can do plenty of things if you take the time to read the Text_IO description in the RM (83 and 95), and incredible things if you take time to read the Stream section of the RM95 ;-). -- -- Laurent Guerby, student at Telecom Bretagne (France), Team Ada -- "Use the Source, Luke. The Source will be with you, always (GPL)" -- http://www-eleves.enst-bretagne.fr/~guerby/ (GATO Project) -- Try GNAT, the GNU Ada 95 compiler (ftp://cs.nyu.edu/pub/gnat)