Subversion Repositories wimsdev

Rev

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

Rev 10 Rev 3808
Line 95... Line 95...
95
int mt_this(struct block *blk, char *start, int level)
95
int mt_this(struct block *blk, char *start, int level)
96
{
96
{
97
    int r;
97
    int r;
98
    if(level > MAX_LEVELS) error("level_overflow %.20s",start);
98
    if(level > MAX_LEVELS) error("level_overflow %.20s",start);
99
    start=find_word_start(start);
99
    start=find_word_start(start);
100
    if(debug>=2) fprintf(stderr,"lvl=%d. Checking against block %d for %.10s.\n",level,blk-blockbuf,start);
100
    if(debug>=2) fprintf(stderr,"lvl=%d. Checking against block %ld for %.10s.\n",level,blk-blockbuf,start);
101
    r = blk->fn(blk,start,level);
101
    r = blk->fn(blk,start,level);
102
    if(debug) fprintf(stderr,"lvl=%d. Tested %d block %d for %.10s.\n",level,r,blk-blockbuf,start);
102
    if(debug) fprintf(stderr,"lvl=%d. Tested %d block %ld for %.10s.\n",level,r,blk-blockbuf,start);
103
    return r;
103
    return r;
104
}
104
}
105
 
105
 
106
int mt_next(struct block *blk, char *start, int level)
106
int mt_next(struct block *blk, char *start, int level)
107
{
107
{
Line 112... Line 112...
112
        do {
112
        do {
113
            next=npool[currnpool].nextblock; currnpool=npool[currnpool].last;
113
            next=npool[currnpool].nextblock; currnpool=npool[currnpool].last;
114
        }
114
        }
115
        while (next==-2 && currnpool>0);
115
        while (next==-2 && currnpool>0);
116
        if(next==-2) error("internal_error npool disorder");
116
        if(next==-2) error("internal_error npool disorder");
117
        if(debug>=3) fprintf(stderr,"Calling macro %d: next=%d.\n",
117
        if(debug>=3) fprintf(stderr,"Calling macro %ld: next=%d.\n",
118
                             blk-blockbuf,next);
118
                             blk-blockbuf,next);
119
    }
119
    }
120
    if(next<0) {
120
    if(next<0) {
121
        if(*start) return 0; else return 1;
121
        if(*start) return 0; else return 1;
122
    }
122
    }
Line 147... Line 147...
147
   
147
   
148
    i=blk->lind1;
148
    i=blk->lind1;
149
    t=search_dic(entry+dic[i].start,dic[i].len,sizeof(entry[0]),start);
149
    t=search_dic(entry+dic[i].start,dic[i].len,sizeof(entry[0]),start);
150
    if(t>=0) {
150
    if(t>=0) {
151
        et=entry+(dic[i].start+t);
151
        et=entry+(dic[i].start+t);
152
        if(itemchr(et->replace,blk->string)==NULL) return 0;
152
        if(itemchr((char*)et->replace,blk->string)==NULL) return 0;
153
        p=start+et->olen;
153
        p=start+et->olen;
154
        return mt_next(blk,p,level+1);
154
        return mt_next(blk,p,level+1);
155
    }
155
    }
156
    switch(dic[i].unknown_type) {
156
    switch(dic[i].unknown_type) {
157
        case unk_leave: {
157
        case unk_leave: {