Subversion Repositories wimsdev

Rev

Rev 11132 | Rev 13634 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 11132 Rev 12248
Line 156... Line 156...
156
}
156
}
157
 
157
 
158
/* now make the translation. */
158
/* now make the translation. */
159
void translate(char *p)
159
void translate(char *p)
160
{
160
{
161
    char *p1, *p2, *pp;
161
  char *p1, *p2, *pp;
162
    int t;
162
  int t;
163
 
163
 
164
    if(entrycount<=0 && suffixcnt<=0) return;
164
  if(entrycount<=0 && suffixcnt<=0) return;
165
    snprintf(outbuf,sizeof(outbuf),"%s",p);
165
  snprintf(outbuf,sizeof(outbuf),"%s",p);
166
    for(p1=find_word_start(outbuf);
166
  for(p1=find_word_start(outbuf);
167
      p1!=NULL && p1-outbuf<MAX_LINELEN && *p1!=0;
167
        p1!=NULL && p1-outbuf<MAX_LINELEN && *p1!=0;
168
      p1=p2) {
168
        p1=p2) {
169
      p2=find_word_end(p1);
169
    p2=find_word_end(p1);
170
      for(pp=p1;pp<p2 &&
170
    for(pp=p1;pp<p2 &&
171
          ((!has_digits && isalpha(*pp)) ||
171
      ((!has_digits && isalpha(*pp)) ||
172
           (has_digits && isalnum(*pp)) || (*pp&128)!=0 ||
172
       (has_digits && isalnum(*pp)) || (*pp&128)!=0 ||
173
           strchr("_",*pp)!=NULL);pp++);
173
      strchr("_",*pp)!=NULL);pp++);
174
      p2=find_word_start(p2);
174
    p2=find_word_start(p2);
175
      if(pp==p1 ||
175
    if(pp==p1 ||
176
         (has_digits==0 && isdigit(*pp)) ||
176
      (has_digits==0 && isdigit(*pp)) ||
177
         (*pp!=0 && !isspace(*pp) && strchr(",.?!/;",*pp)==NULL)) continue;
177
      (*pp!=0 && !isspace(*pp) && strchr(",.?!/;",*pp)==NULL)) continue;
178
      t=search_list2(entry,entrycount,sizeof(entry[0]),p1);
178
    t=search_list2(entry,entrycount,sizeof(entry[0]),p1);
179
      if(t<0) {
179
    if(t<0) {
180
          switch(unknown_type) {
180
      switch(unknown_type) {
181
            case unk_leave: break;
181
        case unk_leave: break;
182
            case unk_delete: {
182
        case unk_delete: {
183
                ovlstrcpy(p1,find_word_start(pp)); p2=p1;
183
          ovlstrcpy(p1,find_word_start(pp)); p2=p1;
184
                break;
184
          break;
185
            }
185
        }
186
            case unk_replace: {
186
        case unk_replace: {
187
                string_modify3(outbuf,p1,pp,unkbuf);
187
          string_modify3(outbuf,p1,pp,unkbuf);
188
                p2=find_word_start(p1+strlen(unkbuf));
188
          p2=find_word_start(p1+strlen(unkbuf));
189
            }
-
 
190
          }
189
        }
191
          continue;
-
 
192
      }
190
      }
-
 
191
      continue;
-
 
192
    }
193
      string_modify3(outbuf,p1,p1+strlen((char*)entry[t].original),
193
    string_modify3(outbuf,p1,p1+strlen((char*)entry[t].original),
194
                  (char*)entry[t].replace);
194
                  (char*)entry[t].replace);
195
      p2=find_word_start(p1+strlen((char*)entry[t].replace));
195
    p2=find_word_start(p1+strlen((char*)entry[t].replace));
196
    }
196
  }
197
    snprintf(p,MAX_LINELEN,"%s",outbuf);
197
  snprintf(p,MAX_LINELEN,"%s",outbuf);
198
}
198
}
199
 
-