︙ | | | ︙ | |
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
|
} ChoicePoint;
#define MAXCHOICE 80
static Uint32 v_pattern(Uint16*code,int ptr,Uint32 obj,char all) {
Uint8 x=objects[obj]->x;
Uint8 y=objects[obj]->y;
Uint8 d=objects[obj]->dir;
Uint32 n=VOIDLINK;
Uint32 m;
Uint16 g;
Value v;
ChoicePoint cp[MAXCHOICE];
Uint8 cpi=0;
Uint16 ccl=objects[obj]->class;
|
>
|
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
|
} ChoicePoint;
#define MAXCHOICE 80
static Uint32 v_pattern(Uint16*code,int ptr,Uint32 obj,char all) {
Uint8 x=objects[obj]->x;
Uint8 y=objects[obj]->y;
Uint8 d=objects[obj]->dir;
Uint32 un=VOIDLINK;
Uint32 n=VOIDLINK;
Uint32 m;
Uint16 g;
Value v;
ChoicePoint cp[MAXCHOICE];
Uint8 cpi=0;
Uint16 ccl=objects[obj]->class;
|
︙ | | | ︙ | |
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
|
objects[obj]->dir=d;
break;
case OP_DIR_EC:
if(n==VOIDLINK) Throw("No object specified in pattern");
changed=1;
objects[n]->dir=d;
break;
case OP_ELSE:
ptr--;
while(code[ptr]==OP_ELSE) ptr=code[ptr+2];
break;
case OP_FUNCTION:
StackReq(0,2);
Push(OVALUE(n));
|
>
>
>
>
>
>
>
|
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
|
objects[obj]->dir=d;
break;
case OP_DIR_EC:
if(n==VOIDLINK) Throw("No object specified in pattern");
changed=1;
objects[n]->dir=d;
break;
case OP_DIV:
un=(n==VOIDLINK?obj_bottom_at(x,y):n);
if(un==VOIDLINK) un=obj;
break;
case OP_DIV_C:
un=VOIDLINK;
break;
case OP_ELSE:
ptr--;
while(code[ptr]==OP_ELSE) ptr=code[ptr+2];
break;
case OP_FUNCTION:
StackReq(0,2);
Push(OVALUE(n));
|
︙ | | | ︙ | |
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
|
break;
case OP_RET:
if(all) {
if(vstackptr>=VSTACKSIZE-1) Throw("Stack overflow");
if(n==VOIDLINK) n=obj_bottom_at(x,y);
Push(OVALUE(n));
goto fail;
} else {
return n==VOIDLINK?obj_bottom_at(x,y):n;
}
break;
case OP_ROOK:
if(cpi>=MAXCHOICE-4) Throw("Choice overflow");
d=0;
cpi+=3;
cp[cpi].x=x;
|
|
>
>
|
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
|
break;
case OP_RET:
if(all) {
if(vstackptr>=VSTACKSIZE-1) Throw("Stack overflow");
if(n==VOIDLINK) n=obj_bottom_at(x,y);
Push(OVALUE(n));
goto fail;
} else if(un==VOIDLINK) {
return n==VOIDLINK?obj_bottom_at(x,y):n;
} else {
return VOIDLINK;
}
break;
case OP_ROOK:
if(cpi>=MAXCHOICE-4) Throw("Choice overflow");
d=0;
cpi+=3;
cp[cpi].x=x;
|
︙ | | | ︙ | |
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
|
}
goto again;
fail:
if(!all) {
if(vstackptr<cp->depth) Throw("Stack underflow in pattern matching");
vstackptr=cp[cpi].depth;
}
if(!cpi) return VOIDLINK;
x=cp[cpi].x;
y=cp[cpi].y;
d=cp[cpi].dir;
ptr=cp[cpi].ptr;
n=VOIDLINK;
cpi--;
goto again;
|
|
|
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
|
}
goto again;
fail:
if(!all) {
if(vstackptr<cp->depth) Throw("Stack underflow in pattern matching");
vstackptr=cp[cpi].depth;
}
if(!cpi) return un;
x=cp[cpi].x;
y=cp[cpi].y;
d=cp[cpi].dir;
ptr=cp[cpi].ptr;
n=VOIDLINK;
cpi--;
goto again;
|
︙ | | | ︙ | |