comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@bix.com
Subject: Re: Newbie question : types , representation
Date: 1999/08/24
Date: 1999-08-24T00:00:00+00:00	[thread overview]
Message-ID: <4Oyw3.549$W5.69009@typhoon-sf.snfc21.pbi.net> (raw)
In-Reply-To: 37C1AA76.14D14819@tu-cottbus.de

From an old base64 decoder, slightly modified from Ada 83 to Ada 95:

  type bytes is mod 256;
  for bytes'size use 8;
  package out_io is new sequential_io(bytes);

  subtype base64s is integer range 0 .. 63;
  a_byte:bytes:=0;
  next_byte:bytes:=0;
  type slots is mod 4;
  pack_di:slots:=0;

  procedure put(n:in base64s) is
  begin
    case pack_di is
      when 0 => a_byte:=bytes(n)*4;
      when 1 => out_io.write(f_output, a_byte+bytes(n/16));
                a_byte:=bytes((n mod 16)*16);
      when 2 => out_io.write(f_output, a_byte+bytes(n/4));
                a_byte:=bytes(n mod 4)*64;
      when 3 => out_io.write(f_output, a_byte+bytes(n));
    end case;
    pack_di:=pack_di+1;
  end put;




  reply	other threads:[~1999-08-24  0:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-08-22  0:00 Newbie question : types , representation Jos De Laender
1999-08-22  0:00 ` Martin Dowie
1999-08-22  0:00 ` Robert Dewar
1999-08-23  0:00   ` Wolfgang Jeltsch
1999-08-24  0:00     ` tmoran [this message]
1999-08-24  0:00   ` jdla
1999-08-24  0:00     ` Matthew Heaney
1999-08-24  0:00       ` Jos De Laender
1999-08-24  0:00         ` Brian Rogoff
1999-08-25  0:00           ` Jos De Laender
1999-08-22  0:00 ` Wilhelm Spickermann
1999-08-23  0:00   ` Simon Wright
1999-08-23  0:00   ` Martin C. Carlisle
     [not found] ` <37C621F3.C6C0DC3A@acenet.com.au>
1999-08-27  0:00   ` David C. Hoos, Sr.
1999-08-27  0:00   ` tmoran
1999-08-27  0:00     ` Florian Weimer
replies disabled

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