Diff for /parser3/src/main/pa_dictionary.C between versions 1.17.2.6.2.5 and 1.19

version 1.17.2.6.2.5, 2003/03/21 14:49:00 version 1.19, 2003/10/03 09:40:57
Line 20  void pa_dictionary_add_first(Table::elem Line 20  void pa_dictionary_add_first(Table::elem
                         0, //&a,                           0, //&a, 
                         "dictionary table 'from' column elements must not be empty");                          "dictionary table 'from' column elements must not be empty");
         }          }
           const String* b;
           if(row->count()>1) { // are there any b?
                   b=row->get(1);
                   if(b->is_empty())
                           b=0;
           } else
                   b=0;
   
           // record simplier 'a' for quick comparisons in 'starts' extremely-tight-callback
           self->substs+=Dictionary::Subst(a->cstr(), b);
   
         unsigned char c=(unsigned char)a->first_char();          unsigned char c=(unsigned char)a->first_char();
         if(!self->starting_line_of[c])          if(!self->starting_line_of[c])
                 self->starting_line_of[c]=self->constructor_line;                  self->starting_line_of[c]=self->constructor_line;
   
         self->constructor_line++;          self->constructor_line++;
 }  }
 Dictionary::Dictionary(Table& atable): table(atable) {  Dictionary::Dictionary(Table& atable): substs(atable.count()) {
           // clear starting_lines
           memset(starting_line_of, 0, sizeof(starting_line_of));
         // grab first letters of first column of a table          // grab first letters of first column of a table
         constructor_line=1;  table.for_each(pa_dictionary_add_first, this);          constructor_line=1;  atable.for_each(pa_dictionary_add_first, this);
 }  }
   
 #ifndef DOXYGEN  #ifndef DOXYGEN
Line 37  struct First_that_begins_info { Line 50  struct First_that_begins_info {
         const char* str;          const char* str;
 };  };
 #endif  #endif
 static bool starts(Table::element_type row, First_that_begins_info* info) {  static bool starts(Dictionary::Subst subst, First_that_begins_info* info) {
         // skip irrelevant lines          // skip irrelevant lines
         if(info->line>1) {          if(info->line>1) {
                 --info->line;                  --info->line;
                 return 0;                  return 0;
         }          }
   
         return row->get(0)->this_starts(info->str);          return strncmp(subst.from, info->str, subst.from_length)==0;
 }  }
 Table::element_type Dictionary::first_that_begins(const char* str) const {  Dictionary::Subst Dictionary::first_that_begins(const char* str) const {
         First_that_begins_info info;          First_that_begins_info info;
         if(info.line=starting_line_of[(unsigned char)*str]) {          if(info.line=starting_line_of[(unsigned char)*str]) {
                 info.str=str;                  info.str=str;
                 return table.first_that(starts, &info);                  return substs.first_that(starts, &info);
         } else          } else
                 return Table::element_type(0);                  return 0;
 }  }

Removed from v.1.17.2.6.2.5  
changed lines
  Added in v.1.19


E-mail: