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