Top Prev Next Up Down TEST
ExOmikron
Example of usage of UrvPack.add, UrvPack.sub, UrvPack.slice and
UrvPack.compress
001| with
Ada.Text_IO;
002| with Ada.Containers.Ordered_Sets;
003| with Y2018.Text.Core; use
Y2018.Text.Core;
004| with Y2018.Text.Core.Str; use
Y2018.Text.Core.Str;
005| with Y2018.Text.Jets; use
Y2018.Text.Jets;
006| with Y2018.Text.Util; use
Y2018.Text.Util;
007| with Y2018.Text.Util.UrvPack;
008| with Y2018.Text.TestQ; use
Y2018.Text.TestQ;
009| with
Y2018.Text.Jets.RangeVectorPack;
010| with Y2018.Text.Util.UrvPack;
011| --with DSECT;
012| procedure ExOmikron is
013|
__alfaSet:RangeVectorPack.Set_TY.Set:=UrvPack.make_Set("A"c);
014|
__betaSet:RangeVectorPack.Set_TY.Set:=UrvPack.make_Set("A"c);
015|
__gammaSet:RangeVectorPack.Set_TY.Set:=UrvPack.make_Set("0123456789"c);
016| __v:RangeVectorPack.Velem;
017| begin
018| __UrvPack.list_Set(alfaSet,"--Alfa:Initial--"c);
019| __v.f:=Codepoint'Pos('1'c);
v.l:=Codepoint'Pos('3'c);
020| __alfaSet:=UrvPack.add(alfaSet,v);
021| __v.f:=Codepoint'Pos('5'c);
v.l:=Codepoint'Pos('7'c);
022| __alfaSet:=UrvPack.add(alfaSet,v);
023| __UrvPack.list_Set(alfaSet,"--Alfa:One--"c);
024|
__alfaSet:=UrvPack.sub(alfaSet,betaSet);
025| __UrvPack.list_Set(alfaSet,"--Alfa:Two--"c);
026| __UrvPack.list_Set(gammaSet,"--Gamma:Initial--"c);
027| __UrvPack.list_Set(UrvPack.slice(gammaSet,alfaSet),"--Gamma:Slice
alfa--"c);
028| __UrvPack.list_Set(UrvPack.sub(gammaSet,alfaSet),"--Gamma:Sub
alfa--"c);
029| __UrvPack.list_Set(UrvPack.sub(gammaSet,betaSet),"--Gamma:Sub
beta--"c);
030| __v.f:=Codepoint'Pos('C'c);
v.l:=Codepoint'Pos('D'c);
031| __betaSet:=UrvPack.add(betaSet,v);
032| __v.f:=Codepoint'Pos('B'c);
v.l:=Codepoint'Pos('B'c);
033| __betaSet:=UrvPack.add(betaSet,v);
034| __v.f:=Codepoint'Pos('E'c);
v.l:=Codepoint'Pos('F'c);
035| __betaSet:=UrvPack.add(betaSet,v);
036| __UrvPack.list_Set(betaSet,"--Beta:Extended--"c);
037| __UrvPack.list_Set(UrvPack.compress(betaSet),"--Beta:Compress--"c);
038| __Ada.Text_IO.Put_Line ("*** End
of ExOmikron ***");
039| end ExOmikron;
Result
Running export LD_LIBRARY_PATH=lib;bin/exomikron in TEST
directory.
Published on STDOUT:
001| --Alfa:Initial--
002| >______41 .. ______41
003| --Alfa:One--
004| >______31 .. ______33
005| >______35 .. ______37
006| >______41 .. ______41
007| --Alfa:Two--
008| >______31 .. ______33
009| >______35 .. ______37
010| --Gamma:Initial--
011| >______30 .. ______39
012| --Gamma:Slice alfa--
013| >______31 .. ______33
014| >______35 .. ______37
015| --Gamma:Sub alfa--
016| >______30 .. ______30
017| >______34 .. ______34
018| >______38 .. ______39
019| --Gamma:Sub beta--
020| >______30 .. ______39
021| --Beta:Extended--
022| >______41 .. ______41
023| >______42 .. ______42
024| >______43 .. ______44
025| >______45 .. ______46
026| --Beta:Compress--
027| >______41 .. ______46
028| *** End of ExOmikron ***
Note: the line
029| __UrvPack.list_Set(UrvPack.sub(gammaSet,betaSet),"--Gamma:Sub
beta--"c);
is a 'nop', because betaSet values do not appear in gammaSet.