Overview
Comment: | Improvements and corrections of pattern matching capability. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
cd1ff3c03458991bd83ffac205d110db |
User & Date: | user on 2022-07-11 23:20:08 |
Other Links: | manifest | tags |
Context
2022-07-12
| ||
00:02 | Improve compilation instructions and script to check for a common mistake. check-in: 60a7806b31 user: user tags: trunk | |
2022-07-11
| ||
23:20 | Improvements and corrections of pattern matching capability. check-in: cd1ff3c034 user: user tags: trunk | |
2022-07-10
| ||
21:51 | Allow the (Order) list to contain class names and message names. check-in: 874c691fca user: user tags: trunk | |
Changes
Modified class.c from [4bcfc3b7e0] to [f32dcb1f64].
︙ | |||
1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 | 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 | + | switch(tokenv) { case OP_ADD: case OP_CLIMB: case OP_HEIGHT: 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 0x0200 ... 0x02FF: // message case 0x4000 ... 0x7FFF: // class case 0xC000 ... 0xFFFF: // message cl->codes[ptr++]=tokenv; break; case OP_BEGIN: case OP_IF: if(depth==31) ParseError("Too much pattern nesting\n"); |
︙ |
Modified class.doc from [e25de02eb2] to [346d117541].
︙ | |||
2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 | 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 | + + + + + + + + + + + + + + + + + + + | (Climb <number>) Fail the match if the height here is greater than this number. cut Discards the most recent choice point. Dir Set the direction to the origin object's direction. ,Dir Set the direction to the matched object's direction. =Dir Change the origin object's direction to the current direction. =,Dir Change the matched object's direction to the current direction. else Delimits alternatives within a block. Height Fail the match if the origin object can climb here. (Height <number>) Fail the match if the height here isn't greater than this number. if Begin a block that can optionally match. Image Match an object with the remembered class and image (if none is remembered, use the origin object's class and image). ,Image Remember the class and image of the currently matched object. next Unconditionally fail the current attempt and try the next choice. ObjAbove Match the object above the currently matched object. ObjBelow |
︙ |
Modified exec.c from [074e5c782f] to [41dc73e188].
︙ | |||
2213 2214 2215 2216 2217 2218 2219 | 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 | - + + + | Uint8 x=objects[obj]->x; Uint8 y=objects[obj]->y; Uint8 d=objects[obj]->dir; Uint32 n=VOIDLINK; Uint32 m; Uint16 g; Value v; |
︙ | |||
2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 | 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 | + + + + + + + + + + + + + + + + + + | cpi++; cp[cpi].x=x; cp[cpi].y=y; cp[cpi].dir=d; cp[cpi].depth=vstackptr; cp[cpi].ptr=code[ptr++]; break; case OP_IMAGE: if(n!=VOIDLINK && ccl==objects[n]->class && cim==objects[n]->image) break; n=playfield[x+y*64-65]; while(n!=VOIDLINK) { if(objects[n]->class==ccl && objects[n]->image==cim && !(objects[n]->oflags&OF_DESTROYED)) break; m=objects[n]->up; } if(n==VOIDLINK) goto fail; break; case OP_IMAGE_C: if(n==VOIDLINK) Throw("No object specified in pattern"); ccl=objects[n]->class; cim=objects[n]->image; break; case OP_LOC: if(vstackptr>=VSTACKSIZE-2) Throw("Stack overflow"); Push(NVALUE(x)); Push(NVALUE(y)); break; case OP_MARK: if(vstackptr>=VSTACKSIZE-1) Throw("Stack overflow"); Push(UVALUE(0,TY_MARK)); break; case OP_MUL: cp[cpi].x=x; cp[cpi].y=y; cp[cpi].dir=d; break; case OP_NEXT: goto fail; case OP_OBJABOVE: if(n==VOIDLINK) Throw("No object specified in pattern"); n=obj_above(n); if(n==VOIDLINK) goto fail; break; case OP_OBJBELOW: if(n==VOIDLINK) Throw("No object specified in pattern"); n=obj_below(n); if(n==VOIDLINK) goto fail; break; case OP_OBJBOTTOMAT: n=obj_bottom_at(x,y); if(n==VOIDLINK) goto fail; break; case OP_OBJTOPAT: n=obj_top_at(x,y); if(n==VOIDLINK) goto fail; break; case OP_QUEEN: if(cpi>=MAXCHOICE-8) Throw("Choice overflow"); d=0; cpi+=7; cp[cpi].x=x; cp[cpi].y=y; |
︙ |