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 on 2016-09-30 20:26:37 |
Other Links: | manifest | tags |
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
Modified src/natools-smaz.adb from [e861783700] to [85362c90bf].
︙ | ︙ | |||
14 15 16 17 18 19 20 | -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ package body Natools.Smaz is use type Ada.Streams.Stream_Element_Offset; | < < < < < < | 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; procedure Find_Entry (Dict : in Dictionary; Template : in String; Index : out Ada.Streams.Stream_Element; Length : out Natural); -- Try to find the longest entry in Dict that is a prefix of Template, |
︙ | ︙ | |||
42 43 44 45 46 47 48 | -- Return the number of bytes needed by the verbatim encoding -- of Original_Size bytes. ------------------------------ -- Local Helper Subprograms -- ------------------------------ | < < < < < < < < < < < < < < < < | 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 -- ------------------------------ procedure Find_Entry (Dict : in Dictionary; Template : in String; Index : out Ada.Streams.Stream_Element; Length : out Natural) is |
︙ | ︙ | |||
145 146 147 148 149 150 151 152 153 154 155 156 157 158 | end Verbatim_Size; ---------------------- -- Public Interface -- ---------------------- function Compressed_Upper_Bound (Dict : in Dictionary; Input : in String) return Ada.Streams.Stream_Element_Count is begin return Verbatim_Size (Dict, Input'Length); | > > > > > > > > > > > > > > > > | 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); |
︙ | ︙ |
Modified src/natools-smaz.ads from [083f639e5f] to [ac35abfb23].
︙ | ︙ | |||
68 69 70 71 72 73 74 75 76 77 78 79 80 81 | => 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 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 | > > > > > > > | 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 |
︙ | ︙ |