-- (C) Copyright 2000 by John Halleck, All Rights Reserved -- These are some definitions for processing Braille. -- This is part of a project documented at -- http://www.cc.utah.edu/~nahaj/ada/braille/ package Braille is pragma Pure (Braille); -- A Braille cell consists of six dots traditionally arranged and named -- as follows two columns of three rows -- * * -- * * -- * * -- and traditionally named as follows: -- Dot_1 Dot_4 -- Dot_2 Dot_5 -- Dot_3 Dot_6 type Cell is mod 2 ** 6; -- One bit per position. -- The usual names given to the cell's dots. Dot_1 : constant Cell := 2 ** 5; Dot_2 : constant Cell := 2 ** 4; Dot_3 : constant Cell := 2 ** 3; Dot_4 : constant Cell := 2 ** 2; Dot_5 : constant Cell := 2 ** 1; Dot_6 : constant Cell := 2 ** 0; -- The reverse order here is so the the value reflects a more -- reasonable left to right layout in Hex. -- We'll need the equivalent of Braille Strings. type Braille_String is array (Positive range <>) of Cell; -- And we'll need constants that make it easier to deal with. -- ALL of the possible values of a Braille cell are given names. Empty : constant Cell := 0; Space : Cell renames Empty; A : constant Cell := Dot_1; B : constant Cell := Dot_1 + Dot_2; C : constant Cell := Dot_1 + Dot_4; D : constant Cell := Dot_1 + Dot_4 + Dot_5; E : constant Cell := Dot_1 + Dot_5; F : constant Cell := Dot_1 + Dot_2 + Dot_4; G : constant Cell := Dot_1 + Dot_2 + Dot_4 + Dot_5; H : constant Cell := Dot_1 + Dot_2 + Dot_5; I : constant Cell := Dot_2 + Dot_4; J : constant Cell := Dot_2 + Dot_4 + Dot_5; K : constant Cell := Dot_3 + A; L : constant Cell := Dot_3 + B; M : constant Cell := Dot_3 + C; N : constant Cell := Dot_3 + D; O : constant Cell := Dot_3 + E; P : constant Cell := Dot_3 + F; Q : constant Cell := Dot_3 + G; R : constant Cell := Dot_3 + H; S : constant Cell := Dot_3 + I; T : constant Cell := Dot_3 + J; U : constant Cell := Dot_6 + K; V : constant Cell := Dot_6 + L; X : constant Cell := Dot_6 + M; Y : constant Cell := Dot_6 + N; Z : constant Cell := Dot_6 + O; W : constant Cell := Dot_2 + Dot_4 + Dot_5 + Dot_6; -- Yes, W is strange. -- Full word contractions. (The names are reserved words in Ada, so we -- give them a prefix.) F_And : constant Cell := Dot_1 + Dot_2 + Dot_3 + Dot_4 + Dot_6; F_For : constant Cell := Dot_1 + Dot_2 + Dot_3 + Dot_4 + Dot_5 + Dot_6; F_Of : constant Cell := Dot_1 + Dot_2 + Dot_3 + Dot_5 + Dot_6; F_The : constant Cell := Dot_2 + Dot_3 + Dot_4 + Dot_6; F_With : constant Cell := Dot_2 + Dot_3 + Dot_4 + Dot_5 + Dot_6; -- Letter combinations. (Since some of these are also Ada reserved words -- we give them a prefix.) C_Ch : constant Cell := Dot_1 + Dot_6; C_Gh : constant Cell := Dot_1 + Dot_2 + Dot_6; C_Sh : constant Cell := Dot_1 + Dot_4 + Dot_6; C_Th : constant Cell := Dot_1 + Dot_4 + Dot_5 + Dot_6; C_Wh : constant Cell := Dot_1 + Dot_5 + Dot_6; C_Ed : constant Cell := Dot_1 + Dot_2 + Dot_4 + Dot_6; C_Er : constant Cell := Dot_1 + Dot_2 + Dot_4 + Dot_5 + Dot_6; C_Ou : constant Cell := Dot_1 + Dot_2 + Dot_5 + Dot_6; C_Ow : constant Cell := Dot_2 + Dot_4 + Dot_6; C_En : constant Cell := Dot_2 + Dot_6; C_In : constant Cell := Dot_3 + Dot_5; C_St : constant Cell := Dot_3 + Dot_4; C_Ar : constant Cell := Dot_3 + Dot_4 + Dot_5; C_Ing : constant Cell := Dot_3 + Dot_4 + Dot_6; -- Various misc. symbols. Number : constant Cell := Dot_3 + Dot_4 + Dot_5 + Dot_6; Letter : constant Cell := Dot_5 + Dot_6; Period : constant Cell := Dot_2 + Dot_5 + Dot_6; Question : constant Cell := Dot_2 + Dot_3 + Dot_6; Exclamation : constant Cell := Dot_2 + Dot_3 + Dot_5; Comma : constant Cell := Dot_2; Semicolon : constant Cell := Dot_2 + Dot_3; Colon : constant Cell := Dot_2 + Dot_5; Apostrophe : constant Cell := Dot_3; Double_Quote : constant Cell := Dot_3 + Dot_5 + Dot_6; Parenthesis : constant Cell := Dot_2 + Dot_3 + Dot_5 + Dot_6; Dash : constant Cell := Dot_3 + Dot_6; Capital : constant Cell := Dot_6; Accent : constant Cell := Dot_4; Asterisk : Cell renames C_In; Italic : constant Cell := Dot_4 + Dot_6; Decimal : Cell renames Italic; Contraction_5 : constant Cell := Dot_5; Contraction_45 : constant Cell := Dot_4 + Dot_5; Contraction_456 : constant Cell := Dot_4 + Dot_5 + Dot_6; ---------------------------------------------------------------------------- -- Thanks to the Library of Congress, there is a standard default page size Line_Length : constant := 40; Page_Length : constant := 25; ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- -- -- ** Braille conventions are not always the standard print conventions ** -- *** Braille and print translations are *NOT* one to one either way **** -- -- I highly recommend anybody maintaining this package either know Braille, -- or have the "Instruction Manual for Braille Transcribing" available. -- (Catalog Number 759890, American Printing House for the Blind) end Braille;