Subversion Repositories wimsdev

Rev

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

Rev 10 Rev 3247
Line 44... Line 44...
44
char *unknown, unkbuf[1024];
44
char *unknown, unkbuf[1024];
45
 
45
 
46
int compare(int i1, const char *s2)
46
int compare(int i1, const char *s2)
47
{
47
{
48
    int k;
48
    int k;
49
    if(nocase) k=strncasecmp(entry[i1].original,s2,entry[i1].olen);
49
    if(nocase) k=strncasecmp((char*)entry[i1].original,s2,entry[i1].olen);
50
    else k=strncmp(entry[i1].original,s2,entry[i1].olen);
50
    else k=strncmp((char*)entry[i1].original,s2,entry[i1].olen);
51
    if(k==0 && (isalnum(*(s2+entry[i1].olen)) || (*(s2+entry[i1].olen)&128)!=0)) return -1;
51
    if(k==0 && (isalnum(*(s2+entry[i1].olen)) || (*(s2+entry[i1].olen)&128)!=0)) return -1;
52
    else return k;
52
    else return k;
53
}
53
}
54
 
54
 
55
        /* searches a list. Returns index if found, -1 if nomatch.
55
        /* searches a list. Returns index if found, -1 if nomatch.
Line 139... Line 139...
139
        if(has_digits==0) {
139
        if(has_digits==0) {
140
            char *p;
140
            char *p;
141
            for(p=p1;*p!=0 && p<pp && !isdigit(*p);p++);
141
            for(p=p1;*p!=0 && p<pp && !isdigit(*p);p++);
142
            if(isdigit(*p)) has_digits=1;
142
            if(isdigit(*p)) has_digits=1;
143
        }
143
        }
144
        entry[i].original=p1; entry[i].replace=pp;
144
        entry[i].original=(unsigned char*)p1;
-
 
145
        entry[i].replace=(unsigned char*)pp;
145
        entry[i].olen=l=strlen(p1); entry[i].earlier=-1;
146
        entry[i].olen=l=strlen(p1); entry[i].earlier=-1;
146
        if(i>0) {
147
        if(i>0) {
147
            int l1,l2;
148
            int l1,l2;
148
            l1=entry[i-1].earlier; if(l1>=0) l2=entry[l1].olen;
149
            l1=entry[i-1].earlier; if(l1>=0) l2=entry[l1].olen;
149
            else {l2=entry[i-1].olen;l1=i-1;}
150
            else {l2=entry[i-1].olen;l1=i-1;}
150
            if(l>l2 && isspace(p1[l2])
151
            if(l>l2 && isspace(p1[l2])
151
               && strncmp(entry[l1].original,p1,l2)==0)
152
               && strncmp((char*)entry[l1].original,p1,l2)==0)
152
              entry[i].earlier=entry[i-1].earlier=l1;
153
              entry[i].earlier=entry[i-1].earlier=l1;
153
        }
154
        }
154
        i++;
155
        i++;
155
    }
156
    }
156
    entrycount=i;
157
    entrycount=i;
Line 189... Line 190...
189
                    p2=find_word_start(p1+strlen(unkbuf));
190
                    p2=find_word_start(p1+strlen(unkbuf));
190
                }
191
                }
191
            }
192
            }
192
            continue;
193
            continue;
193
        }
194
        }
194
        string_modify(outbuf,p1,p1+strlen(entry[t].original),
195
        string_modify(outbuf,p1,p1+strlen((char*)entry[t].original),
195
                      entry[t].replace);
196
                      (char*)entry[t].replace);
196
        p2=find_word_start(p1+strlen(entry[t].replace));
197
        p2=find_word_start(p1+strlen((char*)entry[t].replace));
197
    }
198
    }
198
    snprintf(p,MAX_LINELEN,"%s",outbuf);
199
    snprintf(p,MAX_LINELEN,"%s",outbuf);
199
}
200
}
200
 
201