Natools

Diff
Login

Differences From Artifact [da8efb0480]:

To Artifact [30d6233919]:


153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
           := Value;

         Current_Index := Current_Index + 1;
         Current_Offset := Current_Offset + Value'Length;
      end Push_Value;
   begin
      return Dict : Natools.Smaz_4096.Dictionary
        := (Last_Code => 4059,
            Values_Last => 8864,
            Variable_Length_Verbatim => Variable_Length_Verbatim,
            Max_Word_Length => 3,
            Offsets => <>,
            Values => <>,
            Hash => Dictionary_4096_Hash'Access)
      do
         --  0 .. 255: ASCII table
         for C in Character loop
            Push_Value (Dict, (1 => C));
         end loop;

         --  256 .. 355: two-digit numbers
         for U in Digit_Rank loop
            for V in Digit_Rank loop
               Push_Value (Dict, (1 => Image (U), 2 => Image (V)));
            end loop;
         end loop;

         --  356 .. 1355: three-digit numbers
         for U in Digit_Rank loop
            for V in Digit_Rank loop
               for W in Digit_Rank loop
                  Push_Value
                    (Dict, (1 => Image (U), 2 => Image (V), 3 => Image (W)));
               end loop;
            end loop;
         end loop;

         --  1356 .. 2031: two lower-case letters
         for M in Letter_Rank loop
            for N in Letter_Rank loop
               Push_Value (Dict, (1 => Lower (M), 2 => Lower (N)));
            end loop;
         end loop;

         --  2032 .. 2707: lower-case then upper-case letter
         for M in Letter_Rank loop
            for N in Letter_Rank loop
               Push_Value (Dict, (1 => Lower (M), 2 => Upper (N)));
            end loop;
         end loop;

         --  2708 .. 3383: upper-case then lower-case letter
         for M in Letter_Rank loop
            for N in Letter_Rank loop
               Push_Value (Dict, (1 => Upper (M), 2 => Lower (N)));
            end loop;
         end loop;

         --  3384 .. 4059: two upper-case letters
         for M in Letter_Rank loop
            for N in Letter_Rank loop
               Push_Value (Dict, (1 => Upper (M), 2 => Upper (N)));
            end loop;
         end loop;

         pragma Assert (Current_Index = Dict.Last_Code + 1);







|
|






<
<
<
<
<
|






|









|






|






|






|







153
154
155
156
157
158
159
160
161
162
163
164
165
166
167





168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
           := Value;

         Current_Index := Current_Index + 1;
         Current_Offset := Current_Offset + Value'Length;
      end Push_Value;
   begin
      return Dict : Natools.Smaz_4096.Dictionary
        := (Last_Code => 3803,
            Values_Last => 8608,
            Variable_Length_Verbatim => Variable_Length_Verbatim,
            Max_Word_Length => 3,
            Offsets => <>,
            Values => <>,
            Hash => Dictionary_4096_Hash'Access)
      do





         --  0 .. 99: two-digit numbers
         for U in Digit_Rank loop
            for V in Digit_Rank loop
               Push_Value (Dict, (1 => Image (U), 2 => Image (V)));
            end loop;
         end loop;

         --  100 .. 1099: three-digit numbers
         for U in Digit_Rank loop
            for V in Digit_Rank loop
               for W in Digit_Rank loop
                  Push_Value
                    (Dict, (1 => Image (U), 2 => Image (V), 3 => Image (W)));
               end loop;
            end loop;
         end loop;

         --  1100 .. 1775: two lower-case letters
         for M in Letter_Rank loop
            for N in Letter_Rank loop
               Push_Value (Dict, (1 => Lower (M), 2 => Lower (N)));
            end loop;
         end loop;

         --  1776 .. 2451: lower-case then upper-case letter
         for M in Letter_Rank loop
            for N in Letter_Rank loop
               Push_Value (Dict, (1 => Lower (M), 2 => Upper (N)));
            end loop;
         end loop;

         --  2452 .. 3127: upper-case then lower-case letter
         for M in Letter_Rank loop
            for N in Letter_Rank loop
               Push_Value (Dict, (1 => Upper (M), 2 => Lower (N)));
            end loop;
         end loop;

         --  3128 .. 3803: two upper-case letters
         for M in Letter_Rank loop
            for N in Letter_Rank loop
               Push_Value (Dict, (1 => Upper (M), 2 => Upper (N)));
            end loop;
         end loop;

         pragma Assert (Current_Index = Dict.Last_Code + 1);
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
        is (case C is
            when '0' .. '9' => Character'Pos (C) - Character'Pos ('0'),
            when 'a' .. 'z' => Character'Pos (C) - Character'Pos ('a'),
            when 'A' .. 'Z' => Character'Pos (C) - Character'Pos ('A'),
            when others => raise Program_Error);
   begin
      case S'Length is
         when 1 =>
            return Character'Pos (S (S'First));

         when 2 =>
            declare
               U : constant Character := S (S'First);
               V : constant Character := S (S'Last);
            begin
               if U in '0' .. '9' and then V in '0' .. '9' then
                  return 256 + Rank (U) * 10 + Rank (V);
               elsif U in 'a' .. 'z' and then V in 'a' .. 'z' then
                  return 1356 + Rank (U) * 26 + Rank (V);
               elsif U in 'a' .. 'z' and then V in 'A' .. 'Z' then
                  return 2032 + Rank (U) * 26 + Rank (V);
               elsif U in 'A' .. 'Z' and then V in 'a' .. 'z' then
                  return 2708 + Rank (U) * 26 + Rank (V);
               elsif U in 'A' .. 'Z' and then V in 'A' .. 'Z' then
                  return 3384 + Rank (U) * 26 + Rank (V);
               else
                  return 4096;
               end if;
            end;

         when 3 =>
            declare
               U : constant Character := S (S'First);
               V : constant Character := S (S'First + 1);
               W : constant Character := S (S'First + 2);
            begin
               if U in '0' .. '9'
                 and then V in '0' .. '9'
                 and then W in '0' .. '9'
               then
                  return 356 + Rank (U) * 100 + Rank (V) * 10 + Rank (W);
               else
                  return 4096;
               end if;
            end;
         when others =>
            return 4096;
      end case;







<
<
<






|

|

|

|

|















|







221
222
223
224
225
226
227



228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
        is (case C is
            when '0' .. '9' => Character'Pos (C) - Character'Pos ('0'),
            when 'a' .. 'z' => Character'Pos (C) - Character'Pos ('a'),
            when 'A' .. 'Z' => Character'Pos (C) - Character'Pos ('A'),
            when others => raise Program_Error);
   begin
      case S'Length is



         when 2 =>
            declare
               U : constant Character := S (S'First);
               V : constant Character := S (S'Last);
            begin
               if U in '0' .. '9' and then V in '0' .. '9' then
                  return 0 + Rank (U) * 10 + Rank (V);
               elsif U in 'a' .. 'z' and then V in 'a' .. 'z' then
                  return 1100 + Rank (U) * 26 + Rank (V);
               elsif U in 'a' .. 'z' and then V in 'A' .. 'Z' then
                  return 1776 + Rank (U) * 26 + Rank (V);
               elsif U in 'A' .. 'Z' and then V in 'a' .. 'z' then
                  return 2452 + Rank (U) * 26 + Rank (V);
               elsif U in 'A' .. 'Z' and then V in 'A' .. 'Z' then
                  return 3128 + Rank (U) * 26 + Rank (V);
               else
                  return 4096;
               end if;
            end;

         when 3 =>
            declare
               U : constant Character := S (S'First);
               V : constant Character := S (S'First + 1);
               W : constant Character := S (S'First + 2);
            begin
               if U in '0' .. '9'
                 and then V in '0' .. '9'
                 and then W in '0' .. '9'
               then
                  return 100 + Rank (U) * 100 + Rank (V) * 10 + Rank (W);
               else
                  return 4096;
               end if;
            end;
         when others =>
            return 4096;
      end case;