cgi-flags.ads


------------------------------------------------------------------------------
--
--  package CGI.Flags (spec)
--
--  This package interprets the HTML client information, and the CGI arguments
--  lang, html, tables and frames, to decide how to render a document.
--
--  Arguments:    Possible values:
--    lang          en da fo es fr ... (any ISO two-letter language code)
--    html          2 3.2 3
--    tables        yes no dl pre (no is equivalent to pre)
--    frames        yes no
--    images        yes no
--
------------------------------------------------------------------------------
--  Update information:
--
--  1996.05.15 (Jacob Sparre Andersen)
--    Written.
--    Child of David A. Wheeler's CGI package.
--
--  1996.07.07 (Jacob Sparre Andersen)
--    Added handling of acceptable languages to Language_Priority_List.
--
--  1996.07.08 (Jacob Sparre Andersen)
--    Changed Version_Type to HTML_Version_Type, and made it into an
--      enumerated type.
--    Added Images_Arg and Use_Images.
--
--  (Insert additional update information above this line.)
------------------------------------------------------------------------------

package CGI.Flags is

   ---------------------------------------------------------------------------
   --  Arguments:

   Language_Arg     : constant String := "lang";
   HTML_Version_Arg : constant String := "html";
   Tables_Arg       : constant String := "tables";
   Frames_Arg       : constant String := "frames";
   Images_Arg       : constant String := "images";

   ---------------------------------------------------------------------------
   --  Exceptions:

   ---------------------------------------------------------------------
   --  Bad_Language_Format:

   --  The language code should be two basic latin characters
   --  ('a' .. 'z'), optionally followed by a dot ('.') and two
   --  addtional basic latin characters.

   Bad_Language_Format : exception;

   ---------------------------------------------------------------------
   --  Invalid_HTML_Version_Argument:

   --  Currently are the only valid values for for the argument html 2
   --  and 3.

   Invalid_HTML_Version_Argument : exception;

   ---------------------------------------------------------------------
   --  Invalid_Table_Rendering_Argument:

   --  The only valid table rendering mode values are yes, no, pre and
   --  dl.

   Invalid_Table_Rendering_Argument : exception;

   ---------------------------------------------------------------------
   --  Invalid_Frame_Mode_Argument:

   --  The only valid frame mode values are yes and no.

   Invalid_Frame_Mode_Argument : exception;

   ---------------------------------------------------------------------------
   --  Languages:

   subtype Basic_Latin_Character is Character range 'a' .. 'z';

   type Language_Type is
     array (Integer range 1 .. 2) of Basic_Latin_Character;
   type Language_List_Type is array (Integer range <>) of Language_Type;

   English : constant Language_Type := "en";

   ---------------------------------------------------------------------------
   --  type HTML_Version_Type:

   type HTML_Version_Type is (HTML_2, Netscape, HTML_3_2, HTML_3);

   ---------------------------------------------------------------------------
   --  Tables:

   type Table_Rendering_Type is (As_Table, As_Definition_List,
                                 As_Preformatted_Text);

   ---------------------------------------------------------------------------
   --  Language_Priority_List:

   function Language_Priority_List return Language_List_Type;

   function Language_Priority_List
     (Accepted_Languages : in Language_List_Type) return Language_List_Type;

   ---------------------------------------------------------------------------
   --  HTML_Version:

   function HTML_Version return HTML_Version_Type;

   ---------------------------------------------------------------------------
   --  Table_Rendering_Mode:

   function Table_Rendering_Mode return Table_Rendering_Type;

   ---------------------------------------------------------------------------
   --  Use_Frames:

   function Use_Frames return Boolean;

   ---------------------------------------------------------------------------
   --  function Use_Images:

   function Use_Images return Boolean;

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

end CGI.Flags;

Typeset with Ada_To_HTML (Jacob and Jesper)