|
@@ -178,16 +178,6 @@ static bool sCheckAddress(Script* sc, int address, int length) {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-static void sLoad(Script* sc, int length) {
|
|
|
- int address = -1;
|
|
|
- if(sReadInt(sc, &address)) {
|
|
|
- address += sc->stackVarIndex;
|
|
|
- if(sCheckAddress(sc, address, length)) {
|
|
|
- sPush(sc, sc->stack + address, length);
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
static void sStore(Script* sc, int length) {
|
|
|
int address = -1;
|
|
|
int index = sc->stackIndex - sizeof(int) - length;
|
|
@@ -202,13 +192,6 @@ static void sStore(Script* sc, int length) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-static void sStoreRef(Script* sc, int length) {
|
|
|
- int address = -1;
|
|
|
- if(sPopInt(sc, &address) && sCheckAddress(sc, address, length)) {
|
|
|
- sPop(sc, sc->stack + address, length);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
static void sNot(Script* sc) {
|
|
|
bool value = false;
|
|
|
if(sPopBool(sc, &value)) {
|
|
@@ -325,14 +308,12 @@ static void sRefLoad(Script* sc) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-#define LOAD_REF(type, Type) \
|
|
|
- { \
|
|
|
- int address = 0; \
|
|
|
- if(sPopInt(sc, &address) && \
|
|
|
- sCheckAddress(sc, address, sizeof(type))) { \
|
|
|
- sPush(sc, sc->stack + address, sizeof(type)); \
|
|
|
- } \
|
|
|
+static void sLoad(Script* sc, int length) {
|
|
|
+ int address = 0;
|
|
|
+ if(sPopInt(sc, &address) && sCheckAddress(sc, address, length)) {
|
|
|
+ sPush(sc, sc->stack + address, length);
|
|
|
}
|
|
|
+}
|
|
|
|
|
|
#define CASE_NUMBER_OP(name, op) \
|
|
|
case OP_##name##_INT: NUMBER_OP(int, Int, op); break; \
|
|
@@ -345,13 +326,11 @@ static void sRefLoad(Script* sc) {
|
|
|
BOOL_OP(float, Float, op); \
|
|
|
break;
|
|
|
#define CASE_TYPE(TYPE, Type, type) \
|
|
|
- case OP_LOAD_##TYPE: sLoad(sc, sizeof(type)); break; \
|
|
|
case OP_STORE_##TYPE: sStore(sc, sizeof(type)); break; \
|
|
|
case OP_RETURN_##TYPE: RETURN(type, Type); break; \
|
|
|
case OP_PRINT_##TYPE: PRINT(type, Type, type##Printer); break; \
|
|
|
case OP_EQUAL_##TYPE: BOOL_OP(type, Type, ==); break; \
|
|
|
- case OP_REF_STORE_##TYPE: sStoreRef(sc, sizeof(type)); break; \
|
|
|
- case OP_REF_LOAD_##TYPE: LOAD_REF(type, Type); break;
|
|
|
+ case OP_LOAD_##TYPE: sLoad(sc, sizeof(type)); break;
|
|
|
|
|
|
static void sConsumeInstruction(Script* sc) {
|
|
|
switch(sReadOperation(sc)) {
|
|
@@ -393,7 +372,7 @@ static void sConsumeInstruction(Script* sc) {
|
|
|
case OP_DEREFERENCE_VAR: sVarRef(sc); break;
|
|
|
case OP_REFERENCE: sReference(sc); break;
|
|
|
case OP_DUPLICATE_REFERENCE: sDuplicateReference(sc); break;
|
|
|
- case OP_REF_LOAD: sRefLoad(sc); break;
|
|
|
+ case OP_LOAD: sRefLoad(sc); break;
|
|
|
case OP_INT_ARRAY: sIntArray(sc); break;
|
|
|
case OP_STORE_ARRAY: sStore(sc, sizeof(int)); break;
|
|
|
}
|