Natools

Check-in [7ae85f4e93]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:smaz_generic: remove the too-costly dynamic predicate
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 7ae85f4e930b8ea8780c92d7d42bb1eea10b36cc
User & Date: nat 2016-12-13 22:09:00
Context
2016-12-14
20:01
smaz_generic: brind the predicate back as a separate function

Since Smaz dictionaries are meant to be global hard-coded constant objects, it makes sense to check the precondition only once, e.g. in a test suite, and not for each and every subprogram call. check-in: ec19d3153c user: nat tags: trunk

2016-12-13
22:09
smaz_generic: remove the too-costly dynamic predicate check-in: 7ae85f4e93 user: nat tags: trunk
2016-12-12
22:18
tools/smaz: fix the validation of retired dictionaries check-in: c291af061e user: nat tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/natools-smaz_generic.ads.

66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
   is record
      Variable_Length_Verbatim : Boolean;
      Max_Word_Length : Positive;
      Offsets : Offset_Array
        (Dictionary_Code'Succ (Dictionary_Code'First) .. Last_Code);
      Values : String (1 .. Values_Last);
      Hash : not null access function (Value : String) return Natural;
   end record
     with Dynamic_Predicate =>
           (for all Code in Dictionary.Offsets'Range
            => Dictionary.Offsets (Code) in Dictionary.Values'Range)
        and then (for all Code in Dictionary_Code'First .. Dictionary.Last_Code
            => Code_Last (Dictionary.Offsets, Code, Dictionary.Values'Last) + 1
               - Code_First (Dictionary.Offsets, Code, Dictionary.Values'First)
               in 1 .. Dictionary.Max_Word_Length);


   function Code_First
     (Offsets : in Offset_Array;
      Code : in Dictionary_Code;
      Fallback : in Positive)
     return Positive







|
<
<
<
<
<
<
<







66
67
68
69
70
71
72
73







74
75
76
77
78
79
80
   is record
      Variable_Length_Verbatim : Boolean;
      Max_Word_Length : Positive;
      Offsets : Offset_Array
        (Dictionary_Code'Succ (Dictionary_Code'First) .. Last_Code);
      Values : String (1 .. Values_Last);
      Hash : not null access function (Value : String) return Natural;
   end record;









   function Code_First
     (Offsets : in Offset_Array;
      Code : in Dictionary_Code;
      Fallback : in Positive)
     return Positive