comp.lang.ada
 help / color / mirror / Atom feed
From: "Robert C. Leif" <rleif@rleif.com>
To: <comp.lang.ada@ada-france.org>
Subject: XML Strings in Ada
Date: Wed, 8 Dec 2004 08:46:42 -0800
Date: 2004-12-08T08:46:42-08:00	[thread overview]
Message-ID: <mailman.180.1102524442.10401.comp.lang.ada@ada-france.org> (raw)

   If any one wishes to see and use my code for noncommercial purposes,
please email me.  The packages are not yet ready for publication; however, I
have used them on internal projects.  Since Packages that are part of the
Ada standard are not allowed to have user defined child libraries, I took a
library generic and made a new generic from it.  The Pattern_Pkg Should be a
subset of that in XML with new meaningful abbreviations. 
      Parenthetically, the use of html formatting would assist in formatting
listings for Comp.Lang.Ada.  The sources of my Ada_Utilities will be made
available under one of the new licenses that are derived or in the spirit of
my Software Developers Cooperative License.
      Bob Leif
       
      Briefly the beigining of the package specification contains:
      with Ada.Strings.Bounded;
      with Ada.Strings.Unbounded;
      with Pattern_Pkg; --not yet completed. 
      with Ada.Strings;
      with Character_Sets;
      with Ada.Characters.Latin_1;
      with Strings8_16_32_Pkg;
      generic
         Max_Bd_Length : Positive;
         Min_Bd_Length : Positive:= 1;
         Character_Set:Character_Sets.Character_Set_Type:=
Character_Sets.Latin_1_Char_Set;
         Pattern:Pattern_Pkg.Pattern_Bd_Type := Pattern_Pkg.Null_Pattern_Bd;
         --Had to create to equal Ada.Characters.Latin_1. 
        --This has to be replaced by the proper Unicode names
         --or, at least, the names specified in The Ada95 XML Library 
      --by Emmanuel Briot Unicode child libraries
         --http://libre.act-europe.fr/xmlada/main.html
      package Generic_Bd_W_Char_Sets is
         Pkg_Name : constant String := "Generic_Bd_W_Char_Sets";
         Monitor : Boolean := True;
         --Makes visible to all of the instantiations.
         --***********************Table of
Contents--*************************
         package Unbounded renames Ada.Strings.Unbounded;
         subtype String_Unbd is Ada.Strings.Unbounded.Unbounded_String;
         subtype Truncation is Ada.Strings.Truncation;
         Error : Ada.Strings.Truncation renames Ada.Strings.Error;
         subtype Trim_End is Ada.Strings.Trim_End;
         Left : Trim_End renames Ada.Strings.Left;
         Right : Trim_End renames Ada.Strings.Right;
         Both : Trim_End renames Ada.Strings.Both;
      
         subtype Character_Set_Type is Character_Sets.Character_Set_Type;
      
         subtype Case_Type is Character_Sets.Case_Type;
         Upper_Case : Case_Type renames Character_Sets.Upper_Case;
         Lower_Case : Case_Type renames Character_Sets.Lower_Case;
         Both_Cases : Case_Type renames Character_Sets.Both_Cases;
         Space : Character renames Ada.Characters.Latin_1.Space;
      
         subtype Pattern_Bd_Type is Pattern_Pkg.Pattern_Bd_Type;
         Null_Pattern_Bd: Pattern_Bd_Type renames
Pattern_Pkg.Null_Pattern_Bd;
         Subtype Character16_Set_Type is
Strings8_16_32_Pkg.Character16_Set_Type;
         Latin_1_16_Char_Set:Character16_Set_Type
      renames Strings8_16_32_Pkg.Latin_1_16_Char_Set;
         --**************End Table of Contents--*************************
         package Generic_Bd_Strings is new
            Ada.Strings.Bounded.Generic_Bounded_Length(Max =>
Max_Bd_Length);
         use Generic_Bd_Strings;   
 
----------------------------------------------------------------------
         subtype Generic_Bd_Type is Generic_Bd_Strings.Bounded_String;  --NO
         --DO NOT USE FOR Instatiations!
         Null_Generic_Bd : Generic_Bd_Type :=
Generic_Bd_Strings.Null_Bounded_String; --NO
         --DO NOT USE FOR Instatiations!
         subtype Length_Range_Type is Generic_Bd_Strings.Length_Range;
      
         subtype Non_Member_Sequence_Bd_Type is
Character_Sets.Non_Member_Sequence_Bd_Type;
      
         --********************End Table of
Contents--*************************
         type Generic_Bd_W_Char_Set_Type is tagged private; --record
 
-----------------------------------------------------------------------
         function Null_Generic_Bd_W_Char_Set return
Generic_Bd_W_Char_Set_Type;
         
         ---------------------------------------------------------------
         function Img (
               Generic_Bd_W_Char_Set : Generic_Bd_W_Char_Set_Type )
           return String;
         ---------------------------------------------------------------
         function Img16 (
               Generic_Bd_W_Char_Set :        Generic_Bd_W_Char_Set_Type;
               Not_In_Char           : in     Wide_Character             :=
'?' )
           return Wide_String;
      --Many more functions and procedures
      private
      
         type Generic_Bd_W_Char_Set_Type is tagged
            record
               Generic_Bd_Part    : Generic_Bd_Type    := Null_Generic_Bd;
               Character_Set_Part : Character_Set_Type := Character_Set;
               Min_Bd_Length_Part : Positive           := Min_Bd_Length;
               Pattern_Part       : Pattern_Bd_Type    := Null_Pattern_Bd;
               --This permits the Character_Set to be specified 
      --at instantiation and defaults to Latin_1.
            end record;
      ----------------
      Message: 5
      Date: Tue, 07 Dec 2004 19:41:35 GMT
      From: Bj?rn Persson <spam-away@nowhere.nil>
      Subject: Re: Experiences of XML parser generators for Ada?
      To: comp.lang.ada@ada-france.org
      Message-ID: <PHntd.123697$dP1.439213@newsc.telia.net>
      Content-Type: text/plain; charset=ISO-8859-1; format=flowed
      
      Robert C. Leif wrote:
      
      > I have also created Ada bounded strings that include character sets.
      
      What do you mean with "strings that include character sets"? Do the 
      strings carry information about which character encoding they're
encoded 
      in? In that case I'd be interested in looking at your implementation.
      
      -- 
      Bjvrn Persson                              PGP key A88682FD
                          omb jor ers @sv ge.
                          r o.b n.p son eri nu
      




             reply	other threads:[~2004-12-08 16:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-08 16:46 Robert C. Leif [this message]
2004-12-12  1:15 ` XML Strings in Ada Björn Persson
replies disabled

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