comp.lang.ada
 help / color / mirror / Atom feed
From: Darren New <dnew@san.rr.com>
Subject: Re: Ada and Internet stuff
Date: Wed, 29 Aug 2001 16:28:13 GMT
Date: 2001-08-29T16:28:13+00:00	[thread overview]
Message-ID: <3B8D181E.8C9523D@san.rr.com> (raw)
In-Reply-To: Bq%i7.25469$sa.13118104@news1.rdc1.sfba.home.com

>   David has posted base64 encode/decode source code at
> www.adapower.com/alg/base64.html
> (That was pretty fast, eh? :)

Cool! I definitely want to read this a few times and learn more Ada. :-)
Thanks!  (My primary goal in writing the base64 stuff was practicing
simple Ada stuff.)

I'm wondering something. 

Do people generally treat Ada.Streams.Stream_Element_Array as the
equivalent of an array of octets without further checking? 

Also, what's the mechanism for dealing with things like UTF-8? I.e., I'm
assuming that Wide_String is a string of UTF or other non-ASCII
characters. Does one simply read a file with the wide character reading
routines and assume that the runtime will do the right translations?
E.g., how would one properly read an XML (default of UTF-8 encoding)
file?

As for the base64 stuff, I'd suggest the following additions:

  -- Target'length must be at least:
  -- Output_Quad_Count: constant := (Source'length + 2) / 3;
  -- Output_Byte_Count: constant := 4 * Output_Quad_Count;
  -- Target'length = Output_Byte_Count + 2 * (Output_Byte_Count / 76)

This should be a function. :-) Probably, it would be best to have a
function that takes an input length and returns the output length in
both directions, so you can allocate your buffers properly before
calling the functions.

Also, a function where you can say "tell me how many characters of
base64 text I should pass in to get as close to N octets back" and "how
many octets will give me just under N characters back" would be useful.
I.e., if I have a file that I'm outputting the big base64-encoded file
out to, how much text do I read and pass to the decoder in one chunk,
and in the other direction, if I have String(1..100_000) to encode into,
how many bytes of raw data is that?

I'd be happy to tackle this. :-)


-- 
Darren New 
San Diego, CA, USA (PST). Cryptokeys on demand.



  reply	other threads:[~2001-08-29 16:28 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-24 19:22 Ada and Internet stuff Darren New
2001-08-24 19:39 ` Ted Dennison
2001-08-24 20:30   ` Pascal Obry
2001-08-24 22:03     ` Ehud Lamm
2001-08-26 15:52       ` David Botton
2001-08-26 20:32         ` Pascal Obry
2001-08-27  1:40           ` David Botton
2001-08-27  6:31             ` Ehud Lamm
2001-08-24 20:32 ` Pascal Obry
2001-08-24 23:36   ` Darren New
2001-08-24 20:39 ` Larry Kilgallen
2001-08-24 22:08 ` Marc A. Criley
2001-08-25  7:07   ` Pascal Obry
2001-08-27  1:49 ` tmoran
2001-08-27 11:04   ` Tarjei T. Jensen
2001-08-27 11:28     ` Ehud Lamm
2001-08-27 20:09       ` Pascal Obry
2001-08-27 23:10   ` David Botton
2001-08-29  5:52     ` tmoran
2001-08-29 16:28       ` Darren New [this message]
2001-08-29 17:12         ` David Botton
2001-08-29 17:32         ` Ted Dennison
2001-08-29 18:51         ` tmoran
2001-08-29 19:00           ` Darren New
2001-08-29 19:53             ` tmoran
2001-08-29 20:03               ` Darren New
2001-08-29 20:08           ` Ted Dennison
2001-08-30  7:08             ` tmoran
2001-08-31  2:39               ` tmoran
2001-08-31 13:34                 ` Ted Dennison
2001-08-31 13:46                   ` Marin David Condic
2001-08-31 17:37                     ` tmoran
2001-08-31 17:59                       ` Marin David Condic
2001-09-01 17:56                         ` tmoran
2001-08-31 13:34                 ` Marin David Condic
2001-08-31 17:52                   ` Ted Dennison
2001-08-31 18:09                     ` Marin David Condic
2001-08-31  2:53               ` compile time Least Common Multiple, was " tmoran
2001-08-31 13:43                 ` Ted Dennison
2001-08-31 17:37                   ` tmoran
2001-08-31 18:08                     ` Ted Dennison
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox