Index: class.c ================================================================== --- class.c +++ class.c @@ -1350,11 +1350,11 @@ case OP_LOC: case OP_MARK: case OP_SUB: case OP_QUEEN: case OP_ROOK: case OP_BISHOP: case OP_DIR: case OP_DIR_C: case OP_DIR_E: case OP_DIR_EC: case OP_OBJTOPAT: case OP_OBJBOTTOMAT: case OP_CUT: case OP_MUL: case OP_OBJABOVE: case OP_OBJBELOW: case OP_TRACE: case OP_NEXT: - case OP_IMAGE: case OP_IMAGE_C: + case OP_IMAGE: case OP_IMAGE_C: case OP_DIV: case OP_DIV_C: case 0x0200 ... 0x02FF: // message case 0x4000 ... 0x7FFF: // class case 0xC000 ... 0xFFFF: // message cl->codes[ptr++]=tokenv; break; Index: class.doc ================================================================== --- class.doc +++ class.doc @@ -2858,10 +2858,21 @@ Push zero to the stack. * Update the current choice point with the location and direction. +/ + Succeeds only if the pattern prior to this command succeeds but the + pattern after this command (which still has the same state as the + prior pattern) fails. This should not be used inside of loops and + should not be used in a (P*) or (,P*) or (=P*) block. If this command + occurs more than once, then the most recent / that is successfully + matched determines the return value if the final match fails. + +,/ + Undoes the effect of the / command. + _ Push a mark to the stack. again End a block with begin or if, allowing it to occur more than once; it Index: exec.c ================================================================== --- exec.c +++ exec.c @@ -2475,10 +2475,11 @@ #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]; @@ -2599,10 +2600,17 @@ 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: @@ -2710,12 +2718,14 @@ if(all) { if(vstackptr>=VSTACKSIZE-1) Throw("Stack overflow"); if(n==VOIDLINK) n=obj_bottom_at(x,y); Push(OVALUE(n)); goto fail; - } else { + } 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; @@ -2750,11 +2760,11 @@ fail: if(!all) { if(vstackptrdepth) Throw("Stack underflow in pattern matching"); vstackptr=cp[cpi].depth; } - if(!cpi) return VOIDLINK; + if(!cpi) return un; x=cp[cpi].x; y=cp[cpi].y; d=cp[cpi].dir; ptr=cp[cpi].ptr; n=VOIDLINK;