Subversion Repositories wimsdev

Rev

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

Rev 3247 Rev 3718
Line 23... Line 23...
23
#define entrylim 32768
23
#define entrylim 32768
24
        /* limit of dictionary length */
24
        /* limit of dictionary length */
25
#define diclim  1024*1024
25
#define diclim  1024*1024
26
 
26
 
27
/***************** Nothing should need change hereafter *****************/
27
/***************** Nothing should need change hereafter *****************/
-
 
28
 
-
 
29
#include "../Lib/basicstr.c"
-
 
30
 
28
 
31
 
29
char inpbuf[MAX_LINELEN+1], outbuf[2*MAX_LINELEN+2];
32
char inpbuf[MAX_LINELEN+1], outbuf[2*MAX_LINELEN+2];
30
char *dicbuf;
33
char *dicbuf;
31
struct entry {
34
struct entry {
32
    unsigned char *original, *replace;
35
    unsigned char *original, *replace;
Line 88... Line 91...
88
{
91
{
89
    char *pp, *p2;
92
    char *pp, *p2;
90
    for(pp=p;*pp;pp++) {
93
    for(pp=p;*pp;pp++) {
91
        if(!isspace(*pp)) continue;
94
        if(!isspace(*pp)) continue;
92
        if(leaveline) {
95
        if(leaveline) {
93
            if(*pp==13) strcpy(pp,pp+1);
96
            if(*pp==13) ovlstrcpy(pp,pp+1);
94
            if(*pp=='\n') {
97
            if(*pp=='\n') {
95
                pp++;
98
                pp++;
96
                gopt: for(p2=pp; isspace(*p2) && *p2!='\n'; p2++);
99
                gopt: for(p2=pp; isspace(*p2) && *p2!='\n'; p2++);
97
                if(p2>pp) strcpy(pp,p2); pp--;
100
                if(p2>pp) ovlstrcpy(pp,p2); pp--;
98
            }
101
            }
99
            else {
102
            else {
100
                pp++; if(!isspace(*pp) || *pp=='\n') continue;
103
                pp++; if(!isspace(*pp) || *pp=='\n') continue;
101
                goto gopt;
104
                goto gopt;
102
            }
105
            }
103
        }
106
        }
104
        else {
107
        else {
105
            if(*pp!=' ') *pp=' ';
108
            if(*pp!=' ') *pp=' ';
106
            if(!isspace(*(pp+1))) continue;
109
            if(!isspace(*(pp+1))) continue;
107
            for(pp++,p2=pp;isspace(*p2);p2++);
110
            for(pp++,p2=pp;isspace(*p2);p2++);
108
            strcpy(pp,p2); pp--;
111
            ovlstrcpy(pp,p2); pp--;
109
        }
112
        }
110
    }
113
    }
111
}
114
}
112
 
115
 
113
#include "suffix.c"
116
#include "suffix.c"
Line 180... Line 183...
180
        t=search_list(entry,entrycount,sizeof(entry[0]),p1);
183
        t=search_list(entry,entrycount,sizeof(entry[0]),p1);
181
        if(t<0) {
184
        if(t<0) {
182
            switch(unknown_type) {
185
            switch(unknown_type) {
183
                case unk_leave: break;
186
                case unk_leave: break;
184
                case unk_delete: {
187
                case unk_delete: {
185
                    strcpy(p1,find_word_start(pp)); p2=p1;
188
                    ovlstrcpy(p1,find_word_start(pp)); p2=p1;
186
                    break;
189
                    break;
187
                }
190
                }
188
                case unk_replace: {
191
                case unk_replace: {
189
                    string_modify(outbuf,p1,pp,unkbuf);
192
                    string_modify(outbuf,p1,pp,unkbuf);
190
                    p2=find_word_start(p1+strlen(unkbuf));
193
                    p2=find_word_start(p1+strlen(unkbuf));