Top Prev Next Up Down
UrvPack utilities
URV's for Patter call. URV's can be stored in external files and
loaded from external files.
This is the structure of an element
type (Y2018.Text.Jets.RangeVectorPack.)Velem
is
record
f: Integer; -- first character value of this range
l: Integer; -- last character value of this range
end record;
This is the structure refered as a URV_Set.
An URV_Set can be stored or loaded from an external file
package (Y2018.Text.Jets.RangeVectorPack.)Set_TY
is new Ada.Containers.Ordered_Sets(
Element_type => (Y2018.Text.Jets.RangeVectorPack.)Velem,
"<" => less,
"=" => equal
);
This is the structure for the Pattern call.
A 'library' of URV_Sets.
package (Y2018.Text.Jets.RangeVectorPack.)UserRangeVectorMap_TY
is new Ada.Containers.Ordered_Maps(
Key_Type=> Unbounded_Wide_Wide_String, -- the name or
identifier of an URV_Set
Element_Type=> (Y2018.Text.Jets.RangeVectorPack.)Set_TY.Set,
"<"=> lessUR,
"="=> equalUR
);
The MapPool is a private type of Y2018.Text.Util.UrvPack
and contains a map of type UserRangeVectorMap_TY.
Copy the urv for a pattern call:
function copy_Map(mp:in out MapPool) return Jets.RangeVectorPack.UserRangeVectorMap_TY.Map
MapPool utilties
A new URV_Set must be created (and named) with the 'insert'
function. You cannot create a new URV_Set with 'put_Set'. The
URV_Set is 'the library' of elements (Jets.RangeVectorPack.Set_TY.Set).
MapPool is the private type of UrvPack, and in the same MapPool it
is possible to store many named RangeVectorPack.Sets.
function copy_Map(mp:in out MapPool) return
Jets.RangeVectorPack.Map_TY.Map; -- (ExXsi
line 025)
procedure list_Map(mp:in out MapPool;path:String:="";topTitle:String:="--
Top --";BottomTitle:String:="--
Bottom --";prefix:String:=TAB);
-- (ExXsi line 074)
function map_Names(mp:in out MapPool) return MapName.Set;
function Is_Empty(mp:in out MapPool) return Boolean;
function Contains(mp:in out MapPool;key:CVar) return Boolean;
function Length(mp:in out MapPool) return Integer;
procedure delete(mp:in out MapPool;key:CVar);
procedure insert(mp:in out MapPool;key:CVar); -- (ExXsi line 041)
procedure load(mp:in out
MapPool;path:String;overwrite:TRINITY:=TRI_TRUE);
-- read from external file (ExXsi line 059)
procedure store(mp:in out MapPool;path:String); -- write to
external file (ExXsi line 038)
procedure clear(mp:in out MapPool);
Set utlities
Retreive a named set, key-value, from the pool
function get_Set(mp:in out MapPool;key:CVar) return Jets.RangeVectorPack.Set_TY.Set;
-- example at line 007 in Classlist.
Write a set into the pool and in that named set which is the 'key'
(of element in the pool)
procedure put_Set(mp:in out MapPool;key:CVar;value:Jets.RangeVectorPack.Set_TY.Set);
-- (ExXsi line 024)
A quick way to generate a set and populate it with values. The CFix
array is considered to have distinct codepoint values for the set.
function make_Set(s:CFix) return Jets.RangeVectorPack.Set_TY.Set;
-- (ExXsi line 013)
List an element to STDOUT or to an external file
procedure list_Set(elementSet:Jets.RangeVectorPack.Set_TY.Set;title:CFix;path:String:="";lse:LSE_TY:=LSENONE);
-- example at line 008 in Classlist
LSENONE
LSESIZE - number of characters in range
LSECOMP - range first .. last value
Element utlities
An element (Jets.RangeVectorPack.Set_TY.Set)
contains a list of character value ranges.
- add - add one element to another
- sub - remove character ranges which exists in the second
element from the first
- slice - remove character ranges from the first which donnot
exists in the second
- compress - pack the character ranges in the element
Example ExOmikron
function compress(inSet:Jets.RangeVectorPack.Set_TY.Set)
return Jets.RangeVectorPack.Set_TY.Set;
in the example ExOmikron result from code line 037
026| --Beta:Compress--
027| >______41 .. ______46
function add(alfaSet:Jets.RangeVectorPack.Set_TY.Set;betaSet:Jets.RangeVectorPack.Set_TY.Set)
return Jets.RangeVectorPack.Set_TY.Set;
function add(alfaSet:Jets.RangeVectorPack.Set_TY.Set;peta:Jets.RangeVectorPack.Velem) return
Jets.RangeVectorPack.Set_TY.Set;
in the example ExOmikron result from code lines 020 and 022
003| --Alfa:One--
004| >______31 .. ______33
005| >______35 .. ______37
006| >______41 .. ______41
function sub(alfaSet:Jets.RangeVectorPack.Set_TY.Set;betaSet:Jets.RangeVectorPack.Set_TY.Set)
return Jets.RangeVectorPack.Set_TY.Set;
in the example ExOmikron result from code line 028
015| --Gamma:Sub alfa--
016| >______30 .. ______30
017| >______34 .. ______34
018| >______38 .. ______39
(Note the difference between sub and slice applied to the same
gammaSet)
function sub(alfaSet:Jets.RangeVectorPack.Set_TY.Set;beta:Jets.RangeVectorPack.Velem) return
Jets.RangeVectorPack.Set_TY.Set;
function slice(alfaSet:Jets.RangeVectorPack.Set_TY.Set;betaSet:Jets.RangeVectorPack.Set_TY.Set)
return Jets.RangeVectorPack.Set_TY.Set;
in the example ExOmikron result from code line 027
012| --Gamma:Slice alfa--
013| >______31 .. ______33
014| >______35 .. ______37
(Note the difference between sub and slice applied to the same
gammaSet)
function slice(alfaSet:Jets.RangeVectorPack.Set_TY.Set;beta:Jets.RangeVectorPack.Velem) return
Jets.RangeVectorPack.Set_TY.Set;
Scanning unicodedata.txt for elements
The UCD-directory will contain a file named "UnicodeData.txt",
this is the input for this utility. All parameters except the first
are considered to be regular expressions for fields in the
unicodedata.txt (field separator is ';'). Default value is null_CFix
which stands for do not consider this field. If the field in
unicodedata.txt is a match of the regular expression then this
character value is added to the element. Note you should compress
the element before use.
function UnicodeData(filename:String; --
UnicodeData.txt
Character_name:CFix:=null_CFix; -- regular expression or null_CFix
General_Category:CFix:=null_CFix; -- regular expression or null_CFix
Canonical_Combining:CFix:=null_CFix; -- regular expression or null_CFix
Bidirectional_Category:CFix:=null_CFix; -- regular expression or null_CFix
Character_Decomposition:CFix:=null_CFix; -- regular expression or null_CFix
Decimal_digit:CFix:=null_CFix; -- regular expression or null_CFix
Digit_value:CFix:=null_CFix; -- regular expression or null_CFix
Numeric_value:CFix:=null_CFix; -- regular expression or null_CFix
Mirrored:CFix:=null_CFix; --
regular expression or null_CFix
Old_name:CFix:=null_CFix; --
regular expression or null_CFix
Comment:CFix:=null_CFix; --
regular expression or null_CFix
Uppercase:CFix:=null_CFix; --
regular expression or null_CFix
Lowercase:CFix:=null_CFix; --
regular expression or null_CFix
Titlecase:CFix:=null_CFix; --
regular expression or null_CFix
ShowLineCount:Integer:=0 --
show line counter at X number of lines read or for value zero, no
line counter
) return Jets.RangeVectorPack.Set_TY.Set;
Scanning block.txt for elements
The UCD-directory will contain a file named "Block.txt", this
is the input for this utility. All parameters except the first are
considered to be regular expressions for fields in the Block.txt
(field separator is ';'). Default value is null_CFix which stands
for do not consider this field. If the field in block.txt is a match
of the regular expression then this character value is added to the
element. Note you should compress the element before use.
function Block(filename:String; --
Block.txt
Block_name:CFix:=null_CFix; --
regular expression (or null_CFix ?)
ShowLineCount:Integer:=0 --
show line counter at X number of lines read or for value zero, no
line counter
) return Jets.RangeVectorPack.Set_TY.Set;
Mappool utlity verifyDatFileContents
Verify that a given file has the content of a mappool
storage:
function verifyDatFileContents(path:String) return TRINITY;
The function reads the beginning of the file and searches for
"JetsData_". The file is a binary file but it starts with these
nine bytes with these ASCII values. The ending '.dat' is very
commonly used and a check of the content is needed.
- TRI_TRUE - file is found and "JetsData_" is found
- TRI_FALSE - file exists but no "JetsData_"
- TRI_UNDEF - file cannot be found
.