Top Prev Next Up Down TEST

ExSigma

Building a RangeVector


001| with Ada.Text_IO; use Ada.Text_IO;
002| with Y2018.Text.Core; use Y2018.Text.Core;
003| --with Y2018.Text.Core.UTF;
004| with Y2018.Text.Core.Str; use Y2018.Text.Core.Str;
005| with Y2018.Text.jets.RangeVectorPack; use Y2018.Text.jets.RangeVectorPack;
006| with Y2018.Text.Jets.JetsTool; use Y2018.Text.Jets.JetsTool;
007| with Y2018.Text.Core.CVarPack; use Y2018.Text.Core.CVarPack;
008| with Y2018.Text.Jets.MatchPack;
009| with Y2018.Text.Jets.PatternPack;
010| --with DSECT;
011| procedure ExSigma is
012| __Cmap:CList.map;
013| __rv:RangeVector;
014| __this:Clist.Cursor;
015| __val:Celem;
016| begin
017| __putC(rv,'A'c,'C'c);
018| __putC(rv,'E'c,'G'c);
019| __putC(rv,'I'c,'K'c);
020| __putC(rv,'M'c,'O'c);
021| __putC(rv,'Q'c,'S'c);
022| __putC(rv,'U'c,'W'c);
023| __To_CList(Cmap,rv);
024| __this:=CList.First(Cmap);
025| __while Clist.Has_Element(this) loop
026| _____val:=CList.Element(this);
027| _____Ada.Text_IO.Put_Line (To_String(val.s));
028| _____Clist.Next(this);
029| __end loop;
030| __if exists(rv,'F'c) then
031| _____Ada.Text_IO.Put_Line ("F CodePoint'Val(16#46#) exists");
032| __else
033| _____Ada.Text_IO.Put_Line ("F CodePoint'Val(16#46#) donnot exists");
034| __end if;
035| __if exists(rv,'N'c) then
036| _____Ada.Text_IO.Put_Line ("N CodePoint'Val(16#48#) exists");
037| __else
038| _____Ada.Text_IO.Put_Line ("N CodePoint'Val(16#48#) donnot exists");
039| __end if;
040| __CList.Clear(Cmap);
041| __Clear(rv);
042| __putGC(rv,'C'c); -- 16#43# = C
043| __To_CList(Cmap,rv,"Control category",cntMax=>10);
044| __this:=CList.First(Cmap);
045| __while Clist.Has_Element(this) loop
046| _____val:=CList.Element(this);
047| _____Ada.Text_IO.Put_Line (To_String(val.s));
048| _____Clist.Next(this);
049| __end loop;
050| __Ada.Text_IO.Put_Line ("length of" & Integer'Image(length(rv)) & " Cmap");
051| __Ada.Text_IO.Put_Line ("*** End of ExSigma ***");
052| end ExSigma;

after precompilation

Values or Codepoints are inserted in the rv Rangevector at lines 017..022 and General Category 'C' is inserted at line 042.

001| with Ada.Text_IO; use Ada.Text_IO;
002| with Y2018.Text.Core; use Y2018.Text.Core;
003| --with Y2018.Text.Core.UTF;
004| with Y2018.Text.Core.Str; use Y2018.Text.Core.Str;
005| with Y2018.Text.jets.RangeVectorPack; use Y2018.Text.jets.RangeVectorPack;
006| with Y2018.Text.Jets.JetsTool; use Y2018.Text.Jets.JetsTool;
007| with Y2018.Text.Core.CVarPack; use Y2018.Text.Core.CVarPack;
008| with Y2018.Text.Jets.MatchPack;
009| with Y2018.Text.Jets.PatternPack;
010| --with DSECT;
011| procedure ExSigma is
012| __Cmap:CList.map;
013| __rv:RangeVector;
014| __this:Clist.Cursor;
015| __val:Celem;
016| begin
017| __putC(rv,CodePoint'Val(16#41#),CodePoint'Val(16#43#));
018| __putC(rv,CodePoint'Val(16#45#),CodePoint'Val(16#47#));
019| __putC(rv,CodePoint'Val(16#49#),CodePoint'Val(16#4B#));
020| __putC(rv,CodePoint'Val(16#4D#),CodePoint'Val(16#4F#));
021| __putC(rv,CodePoint'Val(16#51#),CodePoint'Val(16#53#));
022| __putC(rv,CodePoint'Val(16#55#),CodePoint'Val(16#57#));
023| __To_CList(Cmap,rv);
024| __this:=CList.First(Cmap);
025| __while Clist.Has_Element(this) loop
026| _____val:=CList.Element(this);
027| _____Ada.Text_IO.Put_Line (To_String(val.s));
028| _____Clist.Next(this);
029| __end loop;
030| __if exists(rv,CodePoint'Val(16#46#)) then
031| _____Ada.Text_IO.Put_Line ("F CodePoint'Val(16#46#) exists");
032| __else
033| _____Ada.Text_IO.Put_Line ("F CodePoint'Val(16#46#) donnot exists");
034| __end if;
035| __if exists(rv,CodePoint'Val(16#4E#)) then
036| _____Ada.Text_IO.Put_Line ("N CodePoint'Val(16#48#) exists");
037| __else
038| _____Ada.Text_IO.Put_Line ("N CodePoint'Val(16#48#) donnot exists");
039| __end if;
040| __CList.Clear(Cmap);
041| __Clear(rv);
042| __putGC(rv,CodePoint'Val(16#43#)); -- 16#43# = C
043| __To_CList(Cmap,rv,"Control category",cntMax=>10);
044| __this:=CList.First(Cmap);
045| __while Clist.Has_Element(this) loop
046| _____val:=CList.Element(this);
047| _____Ada.Text_IO.Put_Line (To_String(val.s));
048| _____Clist.Next(this);
049| __end loop;
050| __Ada.Text_IO.Put_Line ("length of" & Integer'Image(length(rv)) & " Cmap");
051| __Ada.Text_IO.Put_Line ("*** End of ExSigma ***");
052| end ExSigma;

Result

Running export LD_LIBRARY_PATH=lib;bin/exsigma in TEST directory.


001| ______41 .. ______43
002| ______45 .. ______47
003| ______49 .. ______4B
004| ______4D .. ______4F
005| ______51 .. ______53
006| ______55 .. ______57
007| CodePoint'Val(16#46#) exists
008| CodePoint'Val(16#48#) donnot exists
009| Control category
010| _______0 .. ______1F
011| ______7F .. ______9F
012| ______AD .. ______AD
013| _____600 .. _____605
014| _____61C .. _____61C
015| _____6DD .. _____6DD
016| _____70F .. _____70F
017| _____8E2 .. _____8E2
018| ____180E .. ____180E
019| ____200B .. ____200F
020| length of 26 Cmap
021| *** End of ExSigma ***

The result is listing everything only as hexadecimal values ranges but by viewing to precompilation result it should be obvious.
Note that a row defines a number of CodePoint characters, 41 .. 43 is a notation of 16#41#, 16#42# ,16#43# or as characters ‘A’, ‘B’, ‘C’. “length of 26” stands for 26 rows where first row is 16#0# to 16#1F# or ‘NUL’ to ‘US’.