Braille.Ascii (braille-ascii.ads):


--  © Copyright 2000 by John Halleck, All Rights Reserved
--  These are the definitions for the processing the usual Braille ASCII
--  encoding as used by most Braille Printers (Embossers).

package Braille.ASCII is
   pragma Pure (Braille.ASCII);

   --  The table below  is the conversion for almost all Braille Printers in
   --  the world.  It is used to store the six dots of the Braille cell as an
   --  ASCII character.  It is *** NOT *** the correct Braille translation of
   --  the corresponding ASCII character (Although it often is.)
   --  Braille is NOT a one to one translation.

   --  One would normally expect a Braille ASCII file to have the extension
   --      .brf

   --  Implementation note:
   --    Note that the UPPER case characters are defined, but the lower case
   --    characters are not.
   --    Computer Science types would probably be more comfortable with some
   --    form of bitwise "or" (Particularly since the language supports it).
   --    Braille users say Dot 1 and Dot 2, but this is clearly not the CS
   --    use of "and".
   --    I've compromised by using "+", which can be read to CS sorts or to
   --    the blind and have both hear the same meaning.

   Cell_From_Braille_ASCII : constant array (Character) of Cell := (

      'A' => A,   'B' => B,   'C' => C,   'D' => D,   'E' => E,   'F' => F,
      'G' => G,   'H' => H,   'I' => I,   'J' => J,   'K' => K,   'L' => L,
      'M' => M,   'N' => N,   'O' => O,   'P' => P,   'Q' => Q,   'R' => R,
      'S' => S,   'T' => T,   'U' => U,   'V' => V,   'W' => W,   'X' => X,
      'Y' => Y,   'Z' => Z,

      '&' => F_And,    '=' => F_For,   '(' => F_Of,
      '!' => F_The,    ')' => F_With,

      '*' => C_Ch,   '<' => C_Gh,   '%' => C_Sh,   '?' => C_Th,   ':' => C_Wh,
      '$' => C_Ed,   ']' => C_Er,   '\' => C_Ou,   '[' => C_Ow,   '5' => C_En,
      '9' => C_In,   '/' => C_St,   '>' => C_Ar,   '+' => C_Ing,

      '#' => Number,       '4' => Period,     '8' => Question,
      '6' => Exclamation,  '1' => Comma,      '2' => Semicolon,
      '3' => Colon,        ',' => Apostrophe, '0' => Double_Quote,
      '7' => Parenthesis,  '-' => Dash,       ''' => Capital,
      '.' => Italic,       '@' => Accent,     ';' => Letter,

      '"' => Contraction_5,
      '^' => Contraction_45,
      '_' => Contraction_456,

      ' ' => Empty,

      others => Empty
   );

   ---------------------------------------------------------------------------

   --  And, of course, we need the inverse mapping.

   Braille_ASCII_From_Cell : constant array (Cell) of Character := (

      A => 'A',   B => 'B',   C => 'C',   D => 'D',   E => 'E',   F => 'F',
      G => 'G',   H => 'H',   I => 'I',   J => 'J',   K => 'K',   L => 'L',
      M => 'M',   N => 'N',   O => 'O',   P => 'P',   Q => 'Q',   R => 'R',
      S => 'S',   T => 'T',   U => 'U',   V => 'V',   W => 'W',   X => 'X',
      Y => 'Y',   Z => 'Z',

      F_And => '&',   F_For => '=',   F_Of => '(',
      F_The => '!',   F_With => ')',

      C_Ch => '*',   C_Gh => '<',   C_Sh => '%',   C_Th => '?',   C_Wh => ':',
      C_Ed => '$',   C_Er => ']',   C_Ou => '\',   C_Ow => '[',   C_En => '5',
      C_In => '9',   C_St => '/',   C_Ar => '>',   C_Ing => '+',

      Number      => '#', Period     => '4', Question     => '8',
      Exclamation => '6', Comma      => '1', Semicolon    => '2',
      Colon       => '3', Apostrophe => ',', Double_Quote => '0',
      Parenthesis => '7', Dash       => '-', Capital      => ''',
      Italic      => '.', Accent     => '@', Letter       => ';',

      Contraction_5   => '"',
      Contraction_45  => '^',
      Contraction_456 => '_',

      Empty => ' '
   );

end Braille.ASCII;

Go to ...


This page is http://www.cc.utah.edu/~nahaj/ada/braille/braille-ascii.ads.html
© Copyright 2000 by John Halleck, All Rights Reserved.
This snapshot was last modified on August 24th, 2000