Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | smaz: make Dict_Entry accessor publicly visible |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
48bf48d1c0ac3a1b82d4bb3a472e3bc3 |
| User & Date: | nat 2016-09-30 20:26:37.876 |
Context
|
2016-10-01
| ||
| 15:25 | tools/smaz: add a command-line option to output current dictionary check-in: 1516f5a576 user: nat tags: trunk | |
|
2016-09-30
| ||
| 20:26 | smaz: make Dict_Entry accessor publicly visible check-in: 48bf48d1c0 user: nat tags: trunk | |
|
2016-09-29
| ||
| 21:58 | tools/smaz: add support for dictionary generation from a word list check-in: 88e525eaf4 user: nat tags: trunk | |
Changes
Changes to src/natools-smaz.adb.
| ︙ | |||
14 15 16 17 18 19 20 | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | - - - - - - | -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ package body Natools.Smaz is use type Ada.Streams.Stream_Element_Offset; |
| ︙ | |||
42 43 44 45 46 47 48 | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | - - - - - - - - - - - - - - - - |
-- Return the number of bytes needed by the verbatim encoding
-- of Original_Size bytes.
------------------------------
-- Local Helper Subprograms --
------------------------------
|
| ︙ | |||
145 146 147 148 149 150 151 152 153 154 155 156 157 158 | 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | + + + + + + + + + + + + + + + + |
end Verbatim_Size;
----------------------
-- Public Interface --
----------------------
function Dict_Entry
(Dict : in Dictionary;
Index : in Ada.Streams.Stream_Element)
return String
is
First : constant Positive := Dict.Offsets (Index);
Last : Natural := Dict.Values'Last;
begin
if Index + 1 in Dict.Offsets'Range then
Last := Dict.Offsets (Index + 1) - 1;
end if;
return Dict.Values (First .. Last);
end Dict_Entry;
function Compressed_Upper_Bound
(Dict : in Dictionary;
Input : in String)
return Ada.Streams.Stream_Element_Count is
begin
return Verbatim_Size (Dict, Input'Length);
|
| ︙ |
Changes to src/natools-smaz.ads.
| ︙ | |||
68 69 70 71 72 73 74 75 76 77 78 79 80 81 | 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | + + + + + + + |
=> Dictionary.Offsets (I) in Dictionary.Values'Range
and then ((if I = Dictionary.Offsets'Last
then Dictionary.Values'Last + 1
else Dictionary.Offsets (I + 1))
- Dictionary.Offsets (I)
in 1 .. Dictionary.Max_Word_Length));
function Dict_Entry
(Dict : in Dictionary;
Index : in Ada.Streams.Stream_Element)
return String
with Pre => Index <= Dict.Dict_Last;
-- Return the string for at the given Index in Dict
function Compressed_Upper_Bound
(Dict : in Dictionary;
Input : in String)
return Ada.Streams.Stream_Element_Count;
-- Return the maximum number of bytes needed to encode Input
|
| ︙ |