Index: class.doc ================================================================== --- class.doc +++ class.doc @@ -1268,10 +1268,13 @@ ArrayCell ( array row column -- array ) Make a reference to a single cell of an array. The new reference is treated as a reference to a 1x1 array, which aliases the original array. Coordinates are zero-based. +,ArrayCell ( array row column -- array ) + Same as ArrayCell but using 1-based coordinates instead. + ArraySlice ( array start count -- array ) Make a slice of an array. The new reference aliases the original array. Coordinates are zero-based. Assassinate ( -- ) ** @@ -1532,10 +1535,13 @@ Test if first input is greater or equal to second input (signed). GetArray ( array row column -- value ) Read a value from an array. Coordinates are zero-based. +,GetArray ( array row column -- value ) + Same as GetArray but using 1-based coordinates instead. + GetInventory ( class image -- value true | false ) Read from the inventory, with true if it exists or false if not. gt ( in1 in2 -- bool ) Test if first input is greater than second input (unsigned). @@ -1918,10 +1924,13 @@ Send a message to the specified object. SetArray ( array row column value -- ) ** Write a value to an array. Coordinates are zero-based. +,SetArray ( array row column value -- ) ** + Same as SetArray but using 1-based coordinates instead. + SetInventory ( class image value -- ) ** Sets an inventory item with the specified class and image number to the specified value (which must be a number). If there is no inventory item with that exact class and image, an inventory item will be added, otherwise the existing one is updated to the new value. Inventory values Index: exec.c ================================================================== --- exec.c +++ exec.c @@ -2855,10 +2855,11 @@ case OP_ARG2: StackReq(0,1); Push(msgvars.arg2); break; case OP_ARG2_E: StackReq(1,0); msgvars.arg2=Pop(); break; case OP_ARG3: StackReq(0,1); Push(msgvars.arg3); break; case OP_ARG3_E: StackReq(1,0); msgvars.arg3=Pop(); break; case OP_ARRAYCELL: StackReq(3,1); t3=Pop(); Numeric(t3); t2=Pop(); Numeric(t2); t1=Pop(); Push(v_array_cell(t1,t2.u,t3.u)); break; + case OP_ARRAYCELL_C: StackReq(3,1); t3=Pop(); Numeric(t3); t2=Pop(); Numeric(t2); t1=Pop(); Push(v_array_cell(t1,t2.u-1,t3.u-1)); break; case OP_ARRAYSLICE: StackReq(3,1); t3=Pop(); Numeric(t3); t2=Pop(); Numeric(t2); t1=Pop(); Push(v_array_slice(t1,t2.u,t3.u)); break; case OP_ARRIVALS: StackReq(0,1); Push(NVALUE(o->arrivals&0x1FFFFFF)); break; case OP_ARRIVALS_C: StackReq(1,1); Push(GetVariableOrAttributeOf(arrivals&0x1FFFFFF,NVALUE)); break; case OP_ARRIVALS_E: NoIgnore(); StackReq(1,0); t1=Pop(); Numeric(t1); o->arrivals=t1.u; break; case OP_ARRIVALS_EC: NoIgnore(); StackReq(2,0); t1=Pop(); Numeric(t1); i=v_object(Pop()); if(i!=VOIDLINK) objects[i]->arrivals=t1.u; break; @@ -2985,10 +2986,11 @@ case OP_FROM: StackReq(0,1); Push(OVALUE(msgvars.from)); break; case OP_FUNCTION: execute_program(classes[0]->codes,functions[code[ptr++]],obj); break; case OP_GE: StackReq(2,1); t2=Pop(); t1=Pop(); Push(NVALUE(v_unsigned_greater(t2,t1)?0:1)); break; case OP_GE_C: StackReq(2,1); t2=Pop(); t1=Pop(); Push(NVALUE(v_signed_greater(t2,t1)?0:1)); break; case OP_GETARRAY: StackReq(3,1); t3=Pop(); Numeric(t3); t2=Pop(); Numeric(t2); t1=Pop(); Push(v_get_array(t1,t2.u,t3.u)); break; + case OP_GETARRAY_C: StackReq(3,1); t3=Pop(); Numeric(t3); t2=Pop(); Numeric(t2); t1=Pop(); Push(v_get_array(t1,t2.u-1,t3.u-1)); break; case OP_GETINVENTORY: StackReq(2,2); t2=Pop(); t1=Pop(); v_get_inventory(t1,t2); break; case OP_GOTO: ptr=code[ptr]; break; case OP_GT: StackReq(2,1); t2=Pop(); t1=Pop(); Push(NVALUE(v_unsigned_greater(t1,t2)?1:0)); break; case OP_GT_C: StackReq(2,1); t2=Pop(); t1=Pop(); Push(NVALUE(v_signed_greater(t1,t2)?1:0)); break; case OP_HARD: StackReq(1,1); j=v_sh_dir(Pop()); Push(NVALUE(o->hard[j])); break; @@ -3156,10 +3158,11 @@ case OP_SENDEX: StackReq(4,1); t5=Pop(); t4=Pop(); t3=Pop(); t2=Pop(); Push(v_send_self(obj,t2,t3,t4,t5)); break; case OP_SENDEX_C: StackReq(5,1); t5=Pop(); t4=Pop(); t3=Pop(); t2=Pop(); t1=Pop(); Push(v_send_message(obj,t1,t2,t3,t4,t5)); break; case OP_SENDEX_D: StackReq(4,0); t5=Pop(); t4=Pop(); t3=Pop(); t2=Pop(); v_send_self(obj,t2,t3,t4,t5); break; case OP_SENDEX_CD: StackReq(5,0); t5=Pop(); t4=Pop(); t3=Pop(); t2=Pop(); t1=Pop(); v_send_message(obj,t1,t2,t3,t4,t5); break; case OP_SETARRAY: NoIgnore(); StackReq(4,0); t4=Pop(); t3=Pop(); Numeric(t3); t2=Pop(); Numeric(t2); t1=Pop(); v_set_array(t1,t2.u,t3.u,t4); break; + case OP_SETARRAY_C: NoIgnore(); StackReq(4,0); t4=Pop(); t3=Pop(); Numeric(t3); t2=Pop(); Numeric(t2); t1=Pop(); v_set_array(t1,t2.u-1,t3.u-1,t4); break; case OP_SETINVENTORY: StackReq(3,0); t3=Pop(); t2=Pop(); t1=Pop(); v_set_inventory(t1,t2,t3); break; case OP_SHAPE: StackReq(0,1); Push(NVALUE(o->shape)); break; case OP_SHAPE_C: StackReq(1,1); Push(GetVariableOrAttributeOf(shape,NVALUE)); break; case OP_SHAPE_E: NoIgnore(); StackReq(1,0); t1=Pop(); Numeric(t1); o->shape=t1.u; break; case OP_SHAPE_EC: NoIgnore(); StackReq(2,0); t1=Pop(); Numeric(t1); i=v_object(Pop()); if(i!=VOIDLINK) objects[i]->shape=t1.u; break; Index: instruc ================================================================== --- instruc +++ instruc @@ -308,14 +308,14 @@ clear uniq ; Arrays -Array -GetArray +,GetArray InitArray -SetArray -ArrayCell +,SetArray +,ArrayCell ArraySlice CopyArray DotProduct ; Pattern matching Index: instruc.h ================================================================== --- instruc.h +++ instruc.h @@ -452,13 +452,16 @@ #define OP_COUNT 32999 #define OP_CLEAR 33000 #define OP_UNIQ 33001 #define OP_ARRAY 33002 #define OP_GETARRAY 33003 +#define OP_GETARRAY_C 35051 #define OP_INITARRAY 33004 #define OP_SETARRAY 33005 +#define OP_SETARRAY_C 35053 #define OP_ARRAYCELL 33006 +#define OP_ARRAYCELL_C 35054 #define OP_ARRAYSLICE 33007 #define OP_COPYARRAY 33008 #define OP_DOTPRODUCT 33009 #define OP_PATTERN 33010 #define OP_PATTERN_C 35058 @@ -507,11 +510,11 @@ {"AnimateDead",8552597}, {"Arg1",8552576}, {"Arg2",8552577}, {"Arg3",8552578}, {"Array",8683754}, -{"ArrayCell",8421614}, +{"ArrayCell",8487150}, {"ArraySlice",8421615}, {"Arrivals",8618092}, {"Arrived",8618090}, {"Assassinate",8487062}, {"B",9437196}, @@ -596,11 +599,11 @@ {"FlushClass",8421547}, {"FlushObj",8487084}, {"From",8421503}, {"GLASS",8389379}, {"GLISSANT",8389419}, -{"GetArray",8421611}, +{"GetArray",8487147}, {"GetInventory",8421549}, {"HAWK",8389425}, {"HEARTBEAT",8389407}, {"HIT",8389134}, {"HITBY",8389135}, @@ -707,11 +710,11 @@ {"SW",9437189}, {"Seek",8487116}, {"Self",8421501}, {"Send",10584269}, {"SendEx",10584270}, -{"SetArray",8421613}, +{"SetArray",8487149}, {"SetInventory",8421583}, {"Shape",8618051}, {"ShapeDir",8618074}, {"Sharp",8618073}, {"Shovable",8618075},