Subversion Repositories wimsdev

Rev

Rev 8161 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8161 Rev 8195
Line 75... Line 75...
75
 
75
 
76
struct poolstruct *getpool(struct block *blk)
76
struct poolstruct *getpool(struct block *blk)
77
{
77
{
78
    struct poolstruct *pl;
78
    struct poolstruct *pl;
79
 
79
 
80
    if(nextpool>=MAX_POOLS) error("pool_overflow");
80
    if(nextpool>=MAX_POOLS) sym_error("pool_overflow");
81
    pl=poolbuf+nextpool;
81
    pl=poolbuf+nextpool;
82
    pl->lastpool=blk->pool;
82
    pl->lastpool=blk->pool;
83
    blk->pool=nextpool; nextpool++;
83
    blk->pool=nextpool; nextpool++;
84
    pl->block=blk-blockbuf;
84
    pl->block=blk-blockbuf;
85
    pl->string=NULL;
85
    pl->string=NULL;
Line 88... Line 88...
88
}
88
}
89
 
89
 
90
void putpool(struct poolstruct *pl)
90
void putpool(struct poolstruct *pl)
91
{
91
{
92
    nextpool--;
92
    nextpool--;
93
    if(nextpool!=pl-poolbuf) error("internal_error pool leaking");
93
    if(nextpool!=pl-poolbuf) sym_error("internal_error pool leaking");
94
    blockbuf[pl->block].pool=pl->lastpool;
94
    blockbuf[pl->block].pool=pl->lastpool;
95
}
95
}
96
 
96
 
97
int mt_this(struct block *blk, char *start, int level)
97
int mt_this(struct block *blk, char *start, int level)
98
{
98
{
99
    int r;
99
    int r;
100
    if(level > MAX_LEVELS) error("level_overflow %.20s",start);
100
    if(level > MAX_LEVELS) sym_error("level_overflow %.20s",start);
101
    start=find_word_start(start);
101
    start=find_word_start(start);
102
    if(debug>=2) fprintf(stderr,"lvl=%d. Checking against block %d for %.10s.\n",level,(int)(blk-blockbuf),start);
102
    if(debug>=2) fprintf(stderr,"lvl=%d. Checking against block %d for %.10s.\n",level,(int)(blk-blockbuf),start);
103
    r = blk->fn(blk,start,level);
103
    r = blk->fn(blk,start,level);
104
    if(debug) fprintf(stderr,"lvl=%d. Tested %d block %d for %.10s.\n",level,r,(int)(blk-blockbuf),start);
104
    if(debug) fprintf(stderr,"lvl=%d. Tested %d block %d for %.10s.\n",level,r,(int)(blk-blockbuf),start);
105
    return r;
105
    return r;
Line 113... Line 113...
113
    if(next==-2) {
113
    if(next==-2) {
114
      do {
114
      do {
115
          next=npool[currnpool].nextblock; currnpool=npool[currnpool].last;
115
          next=npool[currnpool].nextblock; currnpool=npool[currnpool].last;
116
      }
116
      }
117
      while (next==-2 && currnpool>0);
117
      while (next==-2 && currnpool>0);
118
      if(next==-2) error("internal_error npool disorder");
118
      if(next==-2) sym_error("internal_error npool disorder");
119
      if(debug>=3) fprintf(stderr,"Calling macro %d: next=%d.\n",
119
      if(debug>=3) fprintf(stderr,"Calling macro %d: next=%d.\n",
120
                       (int)(blk-blockbuf),next);
120
                       (int)(blk-blockbuf),next);
121
    }
121
    }
122
    if(next<0) {
122
    if(next<0) {
123
      if(*start) return 0; else return 1;
123
      if(*start) return 0; else return 1;
Line 302... Line 302...
302
    newpool=n=0;
302
    newpool=n=0;
303
    pl=poolbuf+blk->pool;
303
    pl=poolbuf+blk->pool;
304
    if(pl==poolbuf || pl->dirty>0) {
304
    if(pl==poolbuf || pl->dirty>0) {
305
      pl=getpool(blk); newpool=1;
305
      pl=getpool(blk); newpool=1;
306
      n=pl->len=blk->len;
306
      n=pl->len=blk->len;
307
      if(nexttag + n >= MAX_BLOCKS) error("tag_overflow");
307
      if(nexttag + n >= MAX_BLOCKS) sym_error("tag_overflow");
308
      pl->tag=tagbuf+nexttag; nexttag+=n;
308
      pl->tag=tagbuf+nexttag; nexttag+=n;
309
    }
309
    }
310
    if(pl->ind1==0 && pl->ind2==0) {
310
    if(pl->ind1==0 && pl->ind2==0) {
311
      for(r=0;pl->ind1<blk->lcnt;pl->ind1++,pl->ind2=0){
311
      for(r=0;pl->ind1<blk->lcnt;pl->ind1++,pl->ind2=0){
312
          r=_permpick1(blk,start,level);
312
          r=_permpick1(blk,start,level);
Line 348... Line 348...
348
    return 0;
348
    return 0;
349
}
349
}
350
 
350
 
351
void getnpool(int b)
351
void getnpool(int b)
352
{
352
{
353
    if(nextnpool>=MAX_POOLS) error("npool_overflow");
353
    if(nextnpool>=MAX_POOLS) sym_error("npool_overflow");
354
    npool[nextnpool].nextblock=b;
354
    npool[nextnpool].nextblock=b;
355
    npool[nextnpool].last=currnpool;
355
    npool[nextnpool].last=currnpool;
356
    currnpool=nextnpool;
356
    currnpool=nextnpool;
357
    nextnpool++;
357
    nextnpool++;
358
}
358
}
359
 
359
 
360
void putnpool(void)
360
void putnpool(void)
361
{
361
{
362
    if(nextnpool<=0) error("npool_underflow");
362
    if(nextnpool<=0) sym_error("npool_underflow");
363
    nextnpool--;
363
    nextnpool--;
364
}
364
}
365
 
365
 
366
int mt_m(struct block *blk, char *start, int level)
366
int mt_m(struct block *blk, char *start, int level)
367
{
367
{