zhash.c
changeset 13 f71e89074c62
parent 11 68ea18fe402c
child 16 b4e251400e36
equal deleted inserted replaced
12:c755c945a96a 13:f71e89074c62
    98     } else
    98     } else
    99     {
    99     {
   100         /* Look for the same word */
   100         /* Look for the same word */
   101         for(tmp = pos->unflexed; tmp != 0; tmp = tmp->next)
   101         for(tmp = pos->unflexed; tmp != 0; tmp = tmp->next)
   102         {
   102         {
   103             if (strcmp(word, pos->str) == 0)
   103             if (strcmp(word, tmp->str) == 0)
   104                 break;
   104                 break;
   105         }
   105         }
       
   106         /* If not found... */
   106         if (tmp == 0)
   107         if (tmp == 0)
   107         {
   108         {
   108             tmp = new_BareWord();
   109             tmp = new_BareWord();
   109         } else
   110             tmp->str = strdup(word);
   110         {
   111             tmp->next = pos->unflexed;
   111             struct BareWord *new;
   112             pos->unflexed = tmp;
   112             new = new_BareWord();
       
   113         }
   113         }
   114     }
   114     }
   115 }
   115 }
   116 
   116 
   117 void set_accented(struct WordEntry *pos, const char *word)
   117 void set_accented(struct WordEntry *pos, const char *word)
   141     /* Where to insert */
   141     /* Where to insert */
   142     found = does_word_exist(hash_num, word_no_accent);
   142     found = does_word_exist(hash_num, word_no_accent);
   143     if (found)
   143     if (found)
   144     {
   144     {
   145         set_accented(found, word);
   145         set_accented(found, word);
   146         /* TODO process word_no_accent */
   146         add_to_unflexed(found, unflexed);
   147     } else /* Does not exist */
   147     } else /* Does not exist */
   148     {
   148     {
   149         /* new word */
   149         /* new word */
   150         struct WordEntry *new;
   150         struct WordEntry *new;
   151 
   151 
   161     }
   161     }
   162 }
   162 }
   163 
   163 
   164 static void dump_word(struct WordEntry *word)
   164 static void dump_word(struct WordEntry *word)
   165 {
   165 {
   166     printf("%s:%s\n", word->str, word->accented->str);
   166     struct BareWord *tmp;
       
   167     printf(":%s:%s", word->str, word->accented->str);
       
   168 
       
   169     for(tmp = word->unflexed; tmp != 0; tmp = tmp->next)
       
   170     {
       
   171         printf(" %s", tmp->str);
       
   172     }
       
   173     printf("\n");
   167 }
   174 }
   168 
   175 
   169 void dump_wordlist()
   176 void dump_wordlist()
   170 {
   177 {
   171     int i;
   178     int i;