Subversion Repositories wimsdev

Rev

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

Rev 3247 Rev 3718
Line 27... Line 27...
27
#define sourcelim 16*1024*1024
27
#define sourcelim 16*1024*1024
28
 
28
 
29
/***************** Nothing should need change hereafter *****************/
29
/***************** Nothing should need change hereafter *****************/
30
 
30
 
31
#include "../wims.h"
31
#include "../wims.h"
-
 
32
#include "../Lib/basicstr.c"
32
 
33
 
33
char *inpbuf, outbuf[2*(MAX_LINELEN+1)];
34
char *inpbuf, outbuf[2*(MAX_LINELEN+1)];
34
char *dicbuf;
35
char *dicbuf;
35
struct entry {
36
struct entry {
36
    unsigned char *original, *replace;
37
    unsigned char *original, *replace;
Line 136... Line 137...
136
    va_start(vp,good);
137
    va_start(vp,good);
137
    vsnprintf(buf,sizeof(buf),good,vp); va_end(vp);
138
    vsnprintf(buf,sizeof(buf),good,vp); va_end(vp);
138
    if(strlen(start)-(bad_end-bad_beg)+strlen(buf)>=2*MAX_LINELEN)
139
    if(strlen(start)-(bad_end-bad_beg)+strlen(buf)>=2*MAX_LINELEN)
139
      return;   /* this is an error situation. */
140
      return;   /* this is an error situation. */
140
    strcat(buf,bad_end);
141
    strcat(buf,bad_end);
141
    strcpy(bad_beg,buf);
142
    ovlstrcpy(bad_beg,buf);
142
}
143
}
143
 
144
 
144
        /* change all spaces into ' ', and collapse multiple occurences */
145
        /* change all spaces into ' ', and collapse multiple occurences */
145
void singlespace(char *p)
146
void singlespace(char *p)
146
{
147
{
147
    char *pp, *p2;
148
    char *pp, *p2;
148
    for(pp=p;*pp;pp++) {
149
    for(pp=p;*pp;pp++) {
149
        if(!isspace(*pp)) continue;
150
        if(!isspace(*pp)) continue;
150
        if(leaveline) {
151
        if(leaveline) {
151
            if(*pp==13) strcpy(pp,pp+1);
152
            if(*pp==13) ovlstrcpy(pp,pp+1);
152
            if(*pp=='\n') {
153
            if(*pp=='\n') {
153
                pp++;
154
                pp++;
154
                gopt: for(p2=pp; isspace(*p2) && *p2!='\n'; p2++);
155
                gopt: for(p2=pp; isspace(*p2) && *p2!='\n'; p2++);
155
                if(p2>pp) strcpy(pp,p2); pp--;
156
                if(p2>pp) ovlstrcpy(pp,p2); pp--;
156
            }
157
            }
157
            else {
158
            else {
158
                pp++; if(!isspace(*pp) || *pp=='\n') continue;
159
                pp++; if(!isspace(*pp) || *pp=='\n') continue;
159
                goto gopt;
160
                goto gopt;
160
            }
161
            }
161
        }
162
        }
162
        else {
163
        else {
163
            if(*pp!=' ') *pp=' ';
164
            if(*pp!=' ') *pp=' ';
164
            pp++; if(!isspace(*pp)) continue;
165
            pp++; if(!isspace(*pp)) continue;
165
            for(p2=pp;isspace(*p2);p2++);
166
            for(p2=pp;isspace(*p2);p2++);
166
            strcpy(pp,p2); pp--;
167
            ovlstrcpy(pp,p2); pp--;
167
        }
168
        }
168
    }
169
    }
169
}
170
}
170
 
171
 
171
#include "suffix.c"
172
#include "suffix.c"
Line 248... Line 249...
248
        t=search_list(entry,entrycount,sizeof(entry[0]),p1);
249
        t=search_list(entry,entrycount,sizeof(entry[0]),p1);
249
        if(t<0) {
250
        if(t<0) {
250
            switch(unknown_type) {
251
            switch(unknown_type) {
251
                case unk_leave: break;
252
                case unk_leave: break;
252
                case unk_delete: {
253
                case unk_delete: {
253
                    strcpy(p1,find_word_start(pp)); p2=p1;
254
                    ovlstrcpy(p1,find_word_start(pp)); p2=p1;
254
                    break;
255
                    break;
255
                }
256
                }
256
                case unk_replace: {
257
                case unk_replace: {
257
                    string_modify(outbuf,p1,pp,unkbuf);
258
                    string_modify(outbuf,p1,pp,unkbuf);
258
                    p2=find_word_start(p1+strlen(unkbuf));
259
                    p2=find_word_start(p1+strlen(unkbuf));