From: Jeffrey Carter <spam@spam.com>
Subject: Re: Hex ouput
Date: Fri, 24 Oct 2003 01:09:35 GMT
Date: 2003-10-24T01:09:35+00:00 [thread overview]
Message-ID: <jZ_lb.3540$wc3.2288@newsread3.news.pas.earthlink.net> (raw)
In-Reply-To: <3F97F61A.13088097@raytheon.com>
Jerry Petrey wrote:
> Also if you want to output hex numbers without the 16#xxxx# format, here is a
> short routine to do that:
[code deleted]
Hi, Jerry. Every Mon I still see the same bunch of vapor jobs with
Raytheon on the net.
Your version is too limited for my tastes. Why limit yourself to base
16, and to blank-padded images? I've recently developed and am using
this (lines may wrap):
with Ada.Text_IO;
package Images is
subtype Field is Ada.Text_IO.Field;
subtype Number_Base is Ada.Text_IO.Number_Base;
generic -- Signed_Image
type Number is range <>;
function Signed_Image (Value : Number; Width : Field := 0;
Zero_Filled : Boolean := False; Base : Number_Base := 10)
return String;
-- Returns an image of Value, at least Width characters wide, in
base Base, padded with blanks or zeroes,
-- according to Zero_Filled
generic -- Modular_Image
type Number is mod <>;
function Modular_Image (Value : Number; Width : Field := 0;
Zero_Filled : Boolean := False; Base : Number_Base := 10)
return String;
-- Returns an image of Value, at least Width characters wide, in
base Base, padded with blanks or zeroes,
-- according to Zero_Filled
end Images;
(Body available on request.) Perhaps I should add to the comments some
indication that the images do not include the B#...# for bases other
than 10. When I feel confident with it, it will probably be added to the
PragmAda Reusable Components.
--
Jeff Carter
"C++ is like jamming a helicopter inside a Miata
and expecting some sort of improvement."
Drew Olbrich
51
next prev parent reply other threads:[~2003-10-24 1:09 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-22 16:56 Hex ouput Xenos
2003-10-22 17:19 ` Ed Falis
2003-10-23 13:34 ` Xenos
2003-10-23 14:14 ` Hard copy of Ada RM (was: Hex ouput) Ed Falis
2003-10-23 14:57 ` Xenos
2003-10-24 6:24 ` Dirk Craeynest
2003-10-23 15:39 ` Hex ouput Jerry Petrey
2003-10-23 19:51 ` Xenos
2003-10-23 21:18 ` Stephen Leake
2003-10-24 7:36 ` Dmitry A. Kazakov
2003-10-24 1:09 ` Jeffrey Carter [this message]
2003-10-24 15:08 ` Robert Spooner
2003-10-25 0:39 ` Jeffrey Carter
2003-10-26 1:16 ` Jeffrey Carter
2003-10-23 23:49 ` Randy Brukardt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox