Browse Source

refactor: 去除冗余函数, 修改resultType

去除了部分冗余的函数
修改了resultType枚举体内成员的名字
SongZihuan 4 năm trước cách đây
mục cha
commit
80cc0fa4da

+ 2 - 2
VirtulMathCore/include/__macro.h

@@ -5,8 +5,8 @@
 // PASS语句的定义
 #define PASS
 
-#define RUN_TYPE(type) (type == not_return || type == operation_return)
-#define CHECK_RESULT(result) (result->type == not_return || result->type == operation_return)
+#define RUN_TYPE(type) (type == R_not || type == R_opt)
+#define CHECK_RESULT(result) (result->type == R_not || result->type == R_opt)
 
 #define FREE_BASE(element, return_) do{if(element == NULL)goto return_;}while(0)
 

+ 12 - 12
VirtulMathCore/include/value.h

@@ -135,16 +135,16 @@ struct LinkValue {
 
 struct Result {
     enum ResultType {
-        not_return = 1,  // 无返回值
-        function_return=2,  // 函数返回值
-        operation_return=3,  // 表达式返回值
-        error_return=4,  // 错误
-        break_return=5,
-        continue_return=6,
-        rego_return=7,
-        restart_return=8,
-        goto_return=9,
-        yield_return=10,
+        R_not = 1,  // 无返回值
+        R_func=2,  // 函数返回值
+        R_opt=3,  // 表达式返回值
+        R_error=4,  // 错误
+        R_break=5,
+        R_continue=6,
+        R_rego=7,
+        R_restart=8,
+        R_goto=9,
+        R_yield=10,
     } type;
     wchar_t *label;
     struct LinkValue *value;
@@ -154,7 +154,7 @@ struct Result {
 };
 
 struct Error {
-    char *type;
+    char *type;  // TODO-szh 此处使用message
     char *messgae;
     char *file;
     fline line;
@@ -213,7 +213,7 @@ Value *makeListValue(Argument *arg, fline line, char *file, enum ListType type,
 Value *makeDictValue(Argument *arg, bool new_hash, fline line, char *file, INTER_FUNCTIONSIG_NOT_ST);
 
 void setResultCore(Result *ru);
-void setResult(Result *ru, Inter *inter, LinkValue *belong);
+void setResult(Result *ru, Inter *inter);
 void setResultBase(Result *ru, Inter *inter);
 void setResultErrorSt(BaseErrorType type, char *error_message, bool new, INTER_FUNCTIONSIG);
 void setResultError(BaseErrorType type, char *error_message, fline line, char *file, bool new, INTER_FUNCTIONSIG_NOT_ST);

+ 1 - 4
VirtulMathCore/ofunc/include/__ofunc.h

@@ -12,10 +12,7 @@ bool iterClassFunc(NameFunc *list, INTER_FUNCTIONSIG_NOT_ST);
 
 void iterBaseNameFunc(NameFunc *list, struct LinkValue *father, INTER_FUNCTIONSIG_CORE);
 void iterBaseClassFunc(NameFunc *list, LinkValue *father, INTER_FUNCTIONSIG_CORE);
-Value *makeBaseChildClass(Value *inherit, Inter *inter);  // TODO-szh 去除该函数
-Value *makeBaseChildClass2(LinkValue *inherit, Inter *inter);
-LinkValue *makeBaseChildClass3(Value *inherit, Inter *inter);
-LinkValue *makeBaseChildClass4(LinkValue *inherit, Inter *inter);
+LinkValue *makeBaseChildClass(LinkValue *inherit, Inter *inter);
 
 bool checkIndex(vnum *index, const vnum *size, INTER_FUNCTIONSIG_NOT_ST);
 bool checkSlice(vnum *first, vnum *second, const vnum *stride, vnum size, INTER_FUNCTIONSIG_NOT_ST);

+ 1 - 45
VirtulMathCore/ofunc/src/__ofunc.c

@@ -67,51 +67,7 @@ void iterBaseClassFunc(NameFunc *list, LinkValue *father, INTER_FUNCTIONSIG_CORE
     freeResult(&result);
 }
 
-Value *makeBaseChildClass(Value *inherit, Inter *inter) {
-    Inherit *father_value = NULL;
-    Value *new = NULL;
-    {
-        LinkValue *father_ = makeLinkValue(inherit, inter->base_belong, inter);
-        Argument *arg = makeValueArgument(father_);
-        gc_addTmpLink(&father_->gc_status);
-        father_value = setFather(arg);
-        freeArgument(arg, true);
-        gc_freeTmpLink(&father_->gc_status);
-    }
-    new = makeClassValue(inter->var_list, inter, father_value);
-    return new;
-}
-
-Value *makeBaseChildClass2(LinkValue *inherit, Inter *inter) {
-    Inherit *father_value = NULL;
-    Value *new = NULL;
-    {
-        Argument *arg = makeValueArgument(inherit);
-        gc_addTmpLink(&inherit->gc_status);
-        father_value = setFather(arg);
-        freeArgument(arg, true);
-        gc_freeTmpLink(&inherit->gc_status);
-    }
-    new = makeClassValue(inter->var_list, inter, father_value);
-    return new;
-}
-
-LinkValue *makeBaseChildClass3(Value *inherit, Inter *inter) {
-    Inherit *father_value = NULL;
-    Value *new = NULL;
-    {
-        LinkValue *father_ = makeLinkValue(inherit, inter->base_belong, inter);
-        Argument *arg = makeValueArgument(father_);
-        gc_addTmpLink(&father_->gc_status);
-        father_value = setFather(arg);
-        freeArgument(arg, true);
-        gc_freeTmpLink(&father_->gc_status);
-    }
-    new = makeClassValue(inter->var_list, inter, father_value);
-    return makeLinkValue(new, inter->base_belong, inter);
-}
-
-LinkValue *makeBaseChildClass4(LinkValue *inherit, Inter *inter) {  // TODO-szh 最终函数
+LinkValue *makeBaseChildClass(LinkValue *inherit, Inter *inter) {
     Inherit *father_value = NULL;
     Value *new = NULL;
     {

+ 2 - 2
VirtulMathCore/ofunc/src/bool.c

@@ -8,7 +8,7 @@ ResultType bool_new(OFFICAL_FUNCTIONSIG){
     arg = parserValueArgument(ap, arg, &status, NULL);
     if (status != 1){
         setResultError(E_ArgumentException, FEW_ARG, 0, "bool.new", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
 
     setResultCore(result);
@@ -62,7 +62,7 @@ void registeredBool(REGISTERED_FUNCTIONSIG){
 }
 
 void makeBaseBool(Inter *inter){
-    LinkValue *bool_ = makeBaseChildClass4(inter->data.vobject, inter);
+    LinkValue *bool_ = makeBaseChildClass(inter->data.vobject, inter);
     gc_addStatementLink(&bool_->gc_status);
     inter->data.bool_ = bool_;
 }

+ 10 - 10
VirtulMathCore/ofunc/src/dict.c

@@ -9,12 +9,12 @@ ResultType dict_new(OFFICAL_FUNCTIONSIG){
     arg = parserValueArgument(ap, arg, &status, NULL);
     if (status != 1){
         setResultError(E_ArgumentException, FEW_ARG, 0, "bool.new", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
 
     if (arg != NULL && arg->type == value_arg) {
         setResultError(E_ArgumentException, "Too many argument", 0, "dict.new", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
 
     value = make_new(inter, belong, ap[0].value);
@@ -54,7 +54,7 @@ ResultType dict_down(OFFICAL_FUNCTIONSIG){
 
     if (ap[0].value->value->type != dict){
         setResultError(E_TypeException, INSTANCE_ERROR(dict), 0, "dict", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
     {
         LinkValue *element = NULL;
@@ -84,14 +84,14 @@ ResultType dict_down_del(OFFICAL_FUNCTIONSIG){
 
     if (ap[0].value->value->type != dict){
         setResultError(E_TypeException, INSTANCE_ERROR(dict), 0, "dict", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
     {
         LinkValue *element = NULL;
         wchar_t *name = getNameFromValue(ap[1].value->value, inter);
         element = findVar(name, del_var, inter, ap[0].value->value->data.dict.dict);
         if (element != NULL)
-            setResult(result, inter, belong);
+            setResult(result, inter);
         else{
             char *message = memStrcat("Cannot delete non-existent keys: ", wcsToStr(name, false), false, true);
             setResultError(E_KeyException, message, 0, "dict", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
@@ -116,7 +116,7 @@ ResultType dict_down_assignment(OFFICAL_FUNCTIONSIG){
 
     if (ap[0].value->value->type != dict){
         setResultError(E_TypeException, INSTANCE_ERROR(dict), 0, "dict", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
 
     name = getNameFromValue(ap[2].value->value, inter);
@@ -136,7 +136,7 @@ ResultType dict_keys(OFFICAL_FUNCTIONSIG){
     freeResult(result);
     if (ap[0].value->value->type != dict){
         setResultError(E_TypeException, INSTANCE_ERROR(dict), 0, "dict", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
     for (int index=0; index < MAX_SIZE; index++){
         Var *tmp = ap[0].value->value->data.dict.dict->hashtable[index];
@@ -159,7 +159,7 @@ ResultType dict_iter(OFFICAL_FUNCTIONSIG){
 
     if (ap[0].value->value->type != dict){
         setResultError(E_TypeException, INSTANCE_ERROR(dict), 0, "dict", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
     {
         Argument *dict_iter_arg = makeValueArgument(ap[0].value);
@@ -185,7 +185,7 @@ ResultType dictRepoStrCore(OFFICAL_FUNCTIONSIG, bool is_repo){
 
     if (value->type != dict){
         setResultError(E_TypeException, INSTANCE_ERROR(dict), 0, "dict", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
     again = findAttributes(is_repo ? L"repo_again" : L"str_again", false, ap[0].value, inter);
     if (again != NULL){
@@ -267,7 +267,7 @@ void registeredDict(REGISTERED_FUNCTIONSIG){
 }
 
 void makeBaseDict(Inter *inter){
-    LinkValue *dict = makeBaseChildClass4(inter->data.vobject, inter);
+    LinkValue *dict = makeBaseChildClass(inter->data.vobject, inter);
     gc_addStatementLink(&dict->gc_status);
     inter->data.dict = dict;
 }

+ 9 - 9
VirtulMathCore/ofunc/src/dictiter.c

@@ -13,7 +13,7 @@ ResultType dictiter_init(OFFICAL_FUNCTIONSIG){
     freeResult(result);
     if (ap[1].value->value->type != dict){
         setResultError(E_TypeException, ONLY_ACC(dictiter, dict), 0, "dictiter", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
     {
         LinkValue *keys = findAttributes(L"keys", false, ap[1].value, inter);
@@ -22,7 +22,7 @@ ResultType dictiter_init(OFFICAL_FUNCTIONSIG){
 
         if (keys == NULL){
             setResultError(E_TypeException, "Object non-key-value pairs (there is no keys method)", 0, "dictiter", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-            return error_return;
+            return R_error;
         }
 
         gc_addTmpLink(&keys->gc_status);
@@ -30,7 +30,7 @@ ResultType dictiter_init(OFFICAL_FUNCTIONSIG){
         callBackCore(keys, NULL, 0, "dictiter", 0, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
         gc_freeTmpLink(&keys->gc_status);
         if (!CHECK_RESULT(result)) {
-            return error_return;
+            return R_error;
         }
         list = result->value;
         result->value = NULL;
@@ -47,7 +47,7 @@ ResultType dictiter_init(OFFICAL_FUNCTIONSIG){
         if (!CHECK_RESULT(result)) {
             gc_freeTmpLink(&listiter_class->gc_status);
             gc_freeTmpLink(&list->gc_status);
-            return error_return;
+            return R_error;
         }
 
         list_iter = result->value;
@@ -62,7 +62,7 @@ ResultType dictiter_init(OFFICAL_FUNCTIONSIG){
         addAttributes(L"__dict", false, ap[1].value, 0, "dictiter.init", ap[0].value, result, inter, var_list);
     }
     gc_freeTmpLink(&list_iter->gc_status);
-    setResult(result, inter, belong);
+    setResult(result, inter);
     return result->type;
 }
 
@@ -78,13 +78,13 @@ ResultType dictiter_next(OFFICAL_FUNCTIONSIG){
     list_ = findAttributes(L"__list", false, ap[0].value, inter);
     if (list_ == NULL){
         setResultError(E_TypeException, VALUE_ERROR(__list, listiter), 0, "dictiter", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
 
     list_next = findAttributes(inter->data.object_next, false, list_, inter);
     if (list_next == NULL){
         setResultError(E_TypeException, "Object is not iterable", 0, "dictiter", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
 
     callBackCore(list_next, NULL, 0, "sys", 0, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
@@ -103,7 +103,7 @@ ResultType dictiter_down(OFFICAL_FUNCTIONSIG){
     dict_ = findAttributes(L"__dict", false, ap[0].value, inter);
     if (dict_ == NULL || dict_->value->type != dict){
         setResultError(E_TypeException, VALUE_ERROR(__dict, dict), 0, "dictiter", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
 
     freeResult(result);
@@ -124,7 +124,7 @@ void registeredDictIter(REGISTERED_FUNCTIONSIG){
 }
 
 void makeBaseDictIter(Inter *inter){
-    LinkValue *dict_iter = makeBaseChildClass4(inter->data.vobject, inter);
+    LinkValue *dict_iter = makeBaseChildClass(inter->data.vobject, inter);
     gc_addStatementLink(&dict_iter->gc_status);
     inter->data.dict_iter = dict_iter;
 }

+ 2 - 2
VirtulMathCore/ofunc/src/error_.c

@@ -2,7 +2,7 @@
 
 
 static LinkValue *makeException(LinkValue *father, Inter *inter){
-    LinkValue *exc = makeBaseChildClass4(father, inter);
+    LinkValue *exc = makeBaseChildClass(father, inter);
     gc_addStatementLink(&exc->gc_status);
     return exc;
 }
@@ -18,7 +18,7 @@ ResultType base_exception_init(OFFICAL_FUNCTIONSIG){
     freeResult(result);
     if (addAttributes(inter->data.object_message, false, ap[1].value, 0, "BaseException.init", ap[0].value, result,
                       inter, var_list))
-        setResult(result, inter, belong);
+        setResult(result, inter);
     return result->type;
 }
 

+ 4 - 4
VirtulMathCore/ofunc/src/function.c

@@ -14,7 +14,7 @@ ResultType function_new(OFFICAL_FUNCTIONSIG){
     arg = parserValueArgument(ap, arg, &status, NULL);
     if (status != 1){
         setResultError(E_ArgumentException, FEW_ARG, 0, "function.new", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
 
     {
@@ -55,7 +55,7 @@ ResultType function_init(OFFICAL_FUNCTIONSIG){
     if ((func = ap[0].value)->value->type != function) {
         setResultError(E_TypeException, INSTANCE_ERROR(function), 0, "function", true,
                        CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
 
     if (ap[1].value != NULL) {
@@ -65,7 +65,7 @@ ResultType function_init(OFFICAL_FUNCTIONSIG){
         func->value->data.function.type = vm_function;
     }
 
-    setResult(result, inter, belong);
+    setResult(result, inter);
     return result->type;
 }
 
@@ -79,7 +79,7 @@ void registeredFunction(REGISTERED_FUNCTIONSIG){
 }
 
 void makeBaseFunction(Inter *inter){
-    LinkValue *function = makeBaseChildClass4(inter->data.vobject, inter);
+    LinkValue *function = makeBaseChildClass(inter->data.vobject, inter);
     gc_addStatementLink(&function->gc_status);
     inter->data.function = function;
 }

+ 1 - 1
VirtulMathCore/ofunc/src/io.c

@@ -26,7 +26,7 @@ ResultType vm_print(OFFICAL_FUNCTIONSIG){
     else
         fprintf(inter->data.inter_stdout, "\n");
 
-    setResult(result, inter, belong);
+    setResult(result, inter);
     return result->type;
 }
 

+ 19 - 19
VirtulMathCore/ofunc/src/list.c

@@ -60,7 +60,7 @@ ResultType list_slice(OFFICAL_FUNCTIONSIG){
 
     if (ap[0].value->value->type != list) {
         setResultError(E_TypeException, INSTANCE_ERROR(list), 0, "list", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
     size = ap[0].value->value->data.list.size;
 
@@ -72,7 +72,7 @@ ResultType list_slice(OFFICAL_FUNCTIONSIG){
             *(list[i]) = ap[i + 1].value->value->data.num.num;
         else if (ap[i + 1].value != NULL && ap[i + 1].value->value->type != none) {
             setResultError(E_TypeException, ONLY_ACC(first/second/stride, number or none), 0, "list", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-            return error_return;
+            return R_error;
         }
     }
 
@@ -111,7 +111,7 @@ ResultType list_slice_assignment(OFFICAL_FUNCTIONSIG){
 
     if (ap[0].value->value->type != list) {
         setResultError(E_TypeException, INSTANCE_ERROR(list), 0, "sys", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
     size = ap[0].value->value->data.list.size;
     getIter(ap[1].value, 1, 0, "list", CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
@@ -156,7 +156,7 @@ ResultType list_slice_assignment(OFFICAL_FUNCTIONSIG){
         } else if (!is_iterStop(result->value, inter))
             goto return_;
     }
-    setResult(result, inter, belong);
+    setResult(result, inter);
     return_:
     gc_freeTmpLink(&iter_obj->gc_status);
     return result->type;
@@ -180,7 +180,7 @@ ResultType list_slice_del(OFFICAL_FUNCTIONSIG){
 
     if (ap[0].value->value->type != list) {
         setResultError(E_TypeException, INSTANCE_ERROR(list), 0, "list", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
     size = ap[0].value->value->data.list.size;
 
@@ -192,7 +192,7 @@ ResultType list_slice_del(OFFICAL_FUNCTIONSIG){
             *(list[i]) = ap[i + 1].value->value->data.num.num;
         else if (ap[i + 1].value != NULL && ap[i + 1].value->value->type != none) {
             setResultError(E_TypeException, ONLY_ACC(first/second/stride, num or null), 0, "list", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-            return error_return;
+            return R_error;
         }
     }
 
@@ -235,11 +235,11 @@ ResultType list_down_assignment(OFFICAL_FUNCTIONSIG){
 
     if (ap[0].value->value->type != list){
         setResultError(E_TypeException, INSTANCE_ERROR(list), 0, "list", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
     if (ap[2].value->value->type != number){
         setResultError(E_TypeException, ONLY_ACC(list index, number), 0, "list", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
 
     size = ap[0].value->value->data.list.size;
@@ -248,10 +248,10 @@ ResultType list_down_assignment(OFFICAL_FUNCTIONSIG){
         index = size + index;
     if (index >= size){
         setResultError(E_IndexException, "Index too max", 0, "list", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     } else if (index < 0){
         setResultError(E_IndexException, "Index less than 0", 0, "list", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
     ap[0].value->value->data.list.list[index] = ap[1].value;
     setResultOperationBase(result, ap[1].value);
@@ -272,11 +272,11 @@ ResultType list_down_del(OFFICAL_FUNCTIONSIG){
 
     if (ap[0].value->value->type != list){
         setResultError(E_TypeException, INSTANCE_ERROR(list), 0, "list", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
     if (ap[1].value->value->type != number){
         setResultError(E_TypeException, ONLY_ACC(list index, number), 0, "list", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
 
     size = ap[0].value->value->data.list.size;
@@ -292,7 +292,7 @@ ResultType list_down_del(OFFICAL_FUNCTIONSIG){
         ap[0].value->value->data.list.list = new;
         ap[0].value->value->data.list.size --;
     }
-    setResult(result, inter, belong);
+    setResult(result, inter);
     return result->type;
 }
 
@@ -311,11 +311,11 @@ ResultType list_down(OFFICAL_FUNCTIONSIG){
 
     if (ap[0].value->value->type != list){
         setResultError(E_TypeException, INSTANCE_ERROR(list), 0, "list", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
     if (ap[1].value->value->type != number){
         setResultError(E_TypeException, ONLY_ACC(list index, number), 0, "list", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
 
     size = ap[0].value->value->data.list.size;
@@ -338,7 +338,7 @@ ResultType list_iter(OFFICAL_FUNCTIONSIG){
 
     if (ap[0].value->value->type != list){
         setResultError(E_TypeException, INSTANCE_ERROR(list), 0, "list", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
     {
         Argument *list_iter_arg = makeValueArgument(ap[0].value);
@@ -365,7 +365,7 @@ ResultType listRepoStrCore(OFFICAL_FUNCTIONSIG, bool is_repo){
 
     if (value->type != list){
         setResultError(E_TypeException, INSTANCE_ERROR(list), 0, "sys", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
     lt = value->data.list.type;
     again = findAttributes(is_repo ? L"repo_again" : L"str_again", false, ap[0].value, inter);
@@ -456,8 +456,8 @@ void registeredList(REGISTERED_FUNCTIONSIG){
 }
 
 void makeBaseList(Inter *inter){
-    LinkValue *tuple = makeBaseChildClass4(inter->data.vobject, inter);
-    LinkValue *list = makeBaseChildClass4(tuple, inter);
+    LinkValue *tuple = makeBaseChildClass(inter->data.vobject, inter);
+    LinkValue *list = makeBaseChildClass(tuple, inter);
     gc_addStatementLink(&tuple->gc_status);
     gc_addStatementLink(&list->gc_status);
     inter->data.tuple = tuple;

+ 5 - 5
VirtulMathCore/ofunc/src/listiter.c

@@ -12,7 +12,7 @@ ResultType listiter_init(OFFICAL_FUNCTIONSIG){
     freeResult(result);
     if (ap[1].value->value->type != list){
         setResultError(E_TypeException, ONLY_ACC(listiter, list), 0, "listiter", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
 
     index = makeLinkValue(makeNumberValue(0, 0, "sys", CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong)), ap[0].value, inter);
@@ -25,7 +25,7 @@ ResultType listiter_init(OFFICAL_FUNCTIONSIG){
         addAttributes(L"__index", false, index, 0, "listiter.init", ap[0].value, result, inter, var_list);
     }
 
-    setResult(result, inter, belong);
+    setResult(result, inter);
     return result->type;
 }
 
@@ -43,11 +43,11 @@ ResultType listiter_next(OFFICAL_FUNCTIONSIG){
 
     if (list_->value->type != list){
         setResultError(E_TypeException, VALUE_ERROR(listiter.__list, list), 0, "listiter", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
     if (index->value->type != number){
         setResultError(E_TypeException, VALUE_ERROR(listiter.__index, number), 0, "listiter", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
 
 
@@ -84,7 +84,7 @@ void registeredListIter(REGISTERED_FUNCTIONSIG){
 }
 
 void makeBaseListIter(Inter *inter){
-    LinkValue *list_iter = makeBaseChildClass4(inter->data.vobject, inter);
+    LinkValue *list_iter = makeBaseChildClass(inter->data.vobject, inter);
     gc_addStatementLink(&list_iter->gc_status);
     inter->data.list_iter = list_iter;
 }

+ 2 - 2
VirtulMathCore/ofunc/src/num.c

@@ -8,7 +8,7 @@ ResultType num_new(OFFICAL_FUNCTIONSIG){
     arg = parserValueArgument(ap, arg, &status, NULL);
     if (status != 1){
         setResultError(E_ArgumentException, FEW_ARG, 0, "num", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
 
     setResultCore(result);
@@ -76,7 +76,7 @@ void registeredNum(REGISTERED_FUNCTIONSIG){
 }
 
 void makeBaseNum(Inter *inter){
-    LinkValue *num = makeBaseChildClass4(inter->data.vobject, inter);
+    LinkValue *num = makeBaseChildClass(inter->data.vobject, inter);
     gc_addStatementLink(&num->gc_status);
     inter->data.num = num;
 }

+ 1 - 1
VirtulMathCore/ofunc/src/object.c

@@ -9,7 +9,7 @@ ResultType object_new(OFFICAL_FUNCTIONSIG){
     arg = parserValueArgument(ap, arg, &status, NULL);
     if (status != 1){
         setResultError(E_ArgumentException, FEW_ARG, 0, "object.new", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
 
     value = make_new(inter, belong, ap[0].value);

+ 2 - 2
VirtulMathCore/ofunc/src/pass.c

@@ -9,7 +9,7 @@ ResultType pass_new(OFFICAL_FUNCTIONSIG){
     arg = parserValueArgument(ap, arg, &status, NULL);
     if (status != 1){
         setResultError(E_ArgumentException, FEW_ARG, 0, "pass.new", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
     value = make_new(inter, belong, ap[0].value);
     value->value->type = pass_;
@@ -35,7 +35,7 @@ void registeredEllipisis(REGISTERED_FUNCTIONSIG){
 }
 
 void makeBaseEllipisis(Inter *inter){
-    LinkValue *pass_ = makeBaseChildClass4(inter->data.vobject, inter);
+    LinkValue *pass_ = makeBaseChildClass(inter->data.vobject, inter);
     gc_addStatementLink(&pass_->gc_status);
     inter->data.pass_ = pass_;
 }

+ 8 - 8
VirtulMathCore/ofunc/src/str.c

@@ -8,7 +8,7 @@ ResultType str_new(OFFICAL_FUNCTIONSIG){
     arg = parserValueArgument(ap, arg, &status, NULL);
     if (status != 1){
         setResultError(E_ArgumentException, FEW_ARG, 0, "str.new", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
     setResultCore(result);
     value = make_new(inter, belong, ap[0].value);
@@ -67,7 +67,7 @@ ResultType str_slice(OFFICAL_FUNCTIONSIG){
 
     if (ap[0].value->value->type != string) {
         setResultError(E_TypeException, INSTANCE_ERROR(str), 0, "str", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
     size = memWidelen(ap[0].value->value->data.str.str);
 
@@ -79,7 +79,7 @@ ResultType str_slice(OFFICAL_FUNCTIONSIG){
             *(list[i]) = ap[i + 1].value->value->data.num.num;
         else if (ap[i + 1].value != NULL && ap[i + 1].value->value->type != none) {
             setResultError(E_TypeException, VALUE_ERROR(first/second/stride, num or null), 0, "str", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-            return error_return;
+            return R_error;
         }
     }
 
@@ -111,11 +111,11 @@ ResultType str_down(OFFICAL_FUNCTIONSIG){
 
     if (ap[0].value->value->type != string){
         setResultError(E_TypeException, INSTANCE_ERROR(str), 0, "str", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
     if (ap[1].value->value->type != number){
         setResultError(E_TypeException, ONLY_ACC(str index, number), 0, "str", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
 
     size = memWidelen(ap[0].value->value->data.str.str);
@@ -139,7 +139,7 @@ ResultType str_to_list(OFFICAL_FUNCTIONSIG){
 
     if (ap[0].value->value->type != string){
         setResultError(E_TypeException, INSTANCE_ERROR(str), 0, "str", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
     size = memWidelen(ap[0].value->value->data.str.str);
 
@@ -170,7 +170,7 @@ ResultType str_iter(OFFICAL_FUNCTIONSIG){
     to_list = findAttributes(L"to_list", false, ap[0].value, inter);
     if (to_list == NULL){
         setResultError(E_TypeException, "String cannot be converted to list", 0, "str", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
     gc_addTmpLink(&to_list->gc_status);
     callBackCore(to_list, NULL, 0, "str", 0, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
@@ -267,7 +267,7 @@ void strFunctionPresetting(LinkValue *func, LinkValue *func_new, LinkValue *func
 }
 
 void makeBaseStr(Inter *inter){
-    LinkValue *str = makeBaseChildClass4(inter->data.vobject, inter);
+    LinkValue *str = makeBaseChildClass(inter->data.vobject, inter);
     gc_addStatementLink(&str->gc_status);
     inter->data.str = str;
 }

+ 5 - 5
VirtulMathCore/ofunc/src/sys.c

@@ -18,7 +18,7 @@ ResultType vm_super(OFFICAL_FUNCTIONSIG){
     if (arg_child == arg_father) {
         if (arg_child->object.inherit != NULL){
             result->value = copyLinkValue(arg_child->object.inherit->value, inter);
-            result->type = operation_return;
+            result->type = R_opt;
             gc_addTmpLink(&result->value->gc_status);
         } else
             setResultError(E_SuperException, "Object has no next father", 0, "super", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
@@ -35,7 +35,7 @@ ResultType vm_super(OFFICAL_FUNCTIONSIG){
 
     if (next_father != NULL){
         result->value = next_father;
-        result->type = operation_return;
+        result->type = R_opt;
         gc_addTmpLink(&result->value->gc_status);
     }
     else
@@ -58,8 +58,8 @@ ResultType vm_setMethodCore(OFFICAL_FUNCTIONSIG, enum FunctionPtType type){
     function_value->value->data.function.function_data.pt_type = type;
     result->value = function_value;
     gc_addTmpLink(&result->value->gc_status);
-    result->type = operation_return;
-    return operation_return;
+    result->type = R_opt;
+    return R_opt;
 }
 
 ResultType vm_clsfreemethod(OFFICAL_FUNCTIONSIG){
@@ -107,7 +107,7 @@ ResultType vm_quit(OFFICAL_FUNCTIONSIG){
         setResultError(E_ArgumentException, MANY_ARG, 0, "sys", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
     else
         setResultError(E_QuitException, "VirtualMath Quit", 0, "sys", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-    return error_return;
+    return R_error;
 }
 
 void registeredSysFunction(REGISTERED_FUNCTIONSIG){

+ 3 - 3
VirtulMathCore/ofunc/src/vobject.c

@@ -124,7 +124,7 @@ ResultType vobject_bool(OFFICAL_FUNCTIONSIG){
             break;
         default:
             setResultError(E_TypeException, CUL_ERROR(bool), 0, "vobject", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-            return error_return;
+            return R_error;
     }
     makeBoolValue(result_, 0, "vobject.bool", CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
     return result->type;
@@ -175,7 +175,7 @@ ResultType vobject_repo(OFFICAL_FUNCTIONSIG){
             break;
         default:
             setResultError(E_TypeException, CUL_ERROR(repo/str), 0, "vobject", true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-            return error_return;
+            return R_error;
     }
     makeStringValue(repo, 0, "vobject.repo", CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
     memFree(repo);
@@ -199,7 +199,7 @@ void registeredVObject(REGISTERED_FUNCTIONSIG){
 }
 
 void makeBaseVObject(Inter *inter){
-    LinkValue *vobject = makeBaseChildClass4(inter->data.object, inter);
+    LinkValue *vobject = makeBaseChildClass(inter->data.object, inter);
     gc_addStatementLink(&vobject->gc_status);
     inter->data.vobject = vobject;
 }

+ 6 - 6
VirtulMathCore/src/__run.c

@@ -42,7 +42,7 @@ ResultType getBaseSVarInfo(wchar_t **name, int *times, INTER_FUNCTIONSIG){
         return result->type;
 
     *name = getNameFromValue(result->value->value, inter);
-    result->type = operation_return;  // 执行 operationSafeInterStatement 的时候已经初始化 result
+    result->type = R_opt;  // 执行 operationSafeInterStatement 的时候已经初始化 result
 
     return result->type;
 }
@@ -74,7 +74,7 @@ wchar_t *setNumVarName(vnum num, struct Inter *inter) {
 wchar_t *getNameFromValue(Value *value, struct Inter *inter) {
     switch (value->type){
         case string:
-            return setStrVarName(value->data.str.str, true, inter);  // TODO-szh VAR使用宽字符
+            return setStrVarName(value->data.str.str, true, inter);
         case number:
             return setNumVarName(value->data.num.num, inter);
         case bool_:
@@ -158,7 +158,7 @@ ResultType setFunctionArgument(Argument **arg, Argument **base, LinkValue *_func
             } else {
                 error_:
                 setResultError(E_ArgumentException, FEW_ARG, line, file, true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-                return error_return;
+                return R_error;
             }
             break;
         }
@@ -175,12 +175,12 @@ ResultType setFunctionArgument(Argument **arg, Argument **base, LinkValue *_func
         }
         default:
             setResultError(E_ArgumentException, MANY_ARG, line, file, true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-            return error_return;
+            return R_error;
     }
 
     if (pt_type != free_ && self == NULL) {
         setResultError(E_ArgumentException, "Function does not belong to anything(not self)", line, file, true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
 
     switch (pt_type) {
@@ -294,7 +294,7 @@ void addStrVarCore(int setting, wchar_t *var_name, LinkValue *name_, LinkValue *
     if (setting)
         newObjectSetting(name_, line, file, value, result, inter, out_var);
     else
-        setResult(result, inter, belong);
+        setResult(result, inter);
 }
 
 void addStrVar(wchar_t *name, bool free_old, bool setting, LinkValue *value, fline line, char *file, INTER_FUNCTIONSIG_NOT_ST) {

+ 9 - 9
VirtulMathCore/src/parameter.c

@@ -208,7 +208,7 @@ Argument *listToArgument(LinkValue *list_value, long line, char *file, INTER_FUN
         }
         at = connectValueArgument(result->value, at);
     }
-    setResult(result, inter, belong);
+    setResult(result, inter);
     return_:
     gc_freeTmpLink(&iter->gc_status);
     return at;
@@ -254,7 +254,7 @@ Argument *dictToArgument(LinkValue *dict_value, long line, char *file, INTER_FUN
         gc_freeTmpLink(&name_->gc_status);
         memFree(name);
     }
-    setResult(result, inter, belong);
+    setResult(result, inter);
     return_:
     gc_freeTmpLink(&iter->gc_status);
     return at;
@@ -287,7 +287,7 @@ ResultType defaultParameter(Parameter **function_ad, vnum *num, INTER_FUNCTIONSI
             goto return_;
         freeResult(result);
     }
-    setResult(result, inter, belong);
+    setResult(result, inter);
 
     return_:
     *function_ad = function;
@@ -316,7 +316,7 @@ ResultType argumentToVar(Argument **call_ad, vnum *num, INTER_FUNCTIONSIG_NOT_ST
         if (!CHECK_RESULT(result))
             goto return_;
     }
-    setResult(result, inter, belong);
+    setResult(result, inter);
 
     return_:
     *call_ad = call;
@@ -398,7 +398,7 @@ ResultType parameterFromVar(Parameter **function_ad, VarList *function_var, vnum
             (*num)++;
     }
 
-    setResult(result, inter, belong);
+    setResult(result, inter);
     return_:
     *function_ad = function;
     return result->type;
@@ -426,7 +426,7 @@ ResultType argumentToParameter(Argument **call_ad, Parameter **function_ad, VarL
         freeResult(result);
     }
 
-    setResult(result, inter, belong);
+    setResult(result, inter);
     return_:
     *call_ad = call;
     *function_ad = function;
@@ -492,7 +492,7 @@ ResultType iterParameter(Parameter *call, Argument **base_ad, bool is_dict, INTE
         }
         freeResult(result);
     }
-    setResult(result, inter, belong);
+    setResult(result, inter);
 
     return_:
     *base_ad = base;
@@ -668,7 +668,7 @@ ResultType setParameterCore(fline line, char *file, Argument *call, Parameter *f
         }
     }
     break_:
-    setResult(result, inter, belong);
+    setResult(result, inter);
 
     return_:
     gc_freeze(inter, function_var, NULL, false);
@@ -794,7 +794,7 @@ int parserNameArgument(ArgumentParser ap[], Argument *arg, ArgumentParser **bak,
         return_ = -1;
         goto return_;
     }
-    setResult(result, inter, belong);
+    setResult(result, inter);
 
     for (PASS; ap->must != -1 && (ap->type == only_name || ap->type == name_value); ap++) {
         int status = parserArgumentVar(ap, inter, tmp);

+ 25 - 25
VirtulMathCore/src/run.c

@@ -9,7 +9,7 @@
  */
 ResultType runStatement(INTER_FUNCTIONSIG) {
     setResultCore(result);
-    ResultType type = not_return;
+    ResultType type = R_not;
     switch (st->type) {
         case base_value:
             type = getBaseValue(CALL_INTER_FUNCTIONSIG(st, var_list, result, belong));
@@ -102,7 +102,7 @@ ResultType runStatement(INTER_FUNCTIONSIG) {
             type = delOperation(CALL_INTER_FUNCTIONSIG(st, var_list, result, belong));
             break;
         default:
-            setResult(result, inter, belong);
+            setResult(result, inter);
             break;
     }
 
@@ -119,7 +119,7 @@ bool checkSignal(ResultType *type, fline line, char *file, INTER_FUNCTIONSIG_NOT
     if (is_KeyInterrupt == signal_appear){
         is_KeyInterrupt = signal_reset;
         if (type != NULL)
-            *type = error_return;
+            *type = R_error;
         setResultError(E_KeyInterrupt, KEY_INTERRUPT, line, file, true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
         return true;
     }
@@ -140,7 +140,7 @@ ResultType iterStatement(INTER_FUNCTIONSIG) {
 
     setResultCore(result);
     if (st == NULL){
-        setResult(result, inter, belong);
+        setResult(result, inter);
         return result->type;
     }
 
@@ -155,11 +155,11 @@ ResultType iterStatement(INTER_FUNCTIONSIG) {
             type = runStatement(CALL_INTER_FUNCTIONSIG(base, var_list, result, belong));
             if (checkSignal(&type, base->line, base->code_file, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong)))
                 break;
-            if (type == goto_return && result->times == 0){
+            if (type == R_goto && result->times == 0){
                 Statement *label_st = checkLabel(st, result->label);
                 if (label_st == NULL){
                     setResultErrorSt(E_GotoException, "Don't find label", true, st, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-                    type = error_return;
+                    type = R_error;
                     break;
                 }
                 type = runLabel(CALL_INTER_FUNCTIONSIG(label_st, var_list, result, belong));
@@ -172,9 +172,9 @@ ResultType iterStatement(INTER_FUNCTIONSIG) {
             else
                 base = base->next;
         }
-    } while (type == restart_return && result->times == 0);
+    } while (type == R_restart && result->times == 0);
 
-    if (type == not_return || type == restart_return)
+    if (type == R_not || type == R_restart)
         setResultOperationNone(result, inter, belong);
     result->node = base;
 
@@ -198,7 +198,7 @@ ResultType globalIterStatement(Result *result, Inter *inter, Statement *st) {
     void *bak = NULL;
 
     if (st == NULL){
-        setResult(result, inter, belong);
+        setResult(result, inter);
         return result->type;
     }
 
@@ -215,11 +215,11 @@ ResultType globalIterStatement(Result *result, Inter *inter, Statement *st) {
             type = runStatement(CALL_INTER_FUNCTIONSIG(base, var_list, result, belong));
             if (checkSignal(&type, base->line, base->code_file, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong)))
                 break;
-            if (type == goto_return){
+            if (type == R_goto){
                 Statement *label_st = checkLabel(st, result->label);
                 if (label_st == NULL){
                     setResultErrorSt(E_GotoException, "Don't find label", true, st, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-                    type = error_return;
+                    type = R_error;
                     break;
                 }
                 type = runLabel(CALL_INTER_FUNCTIONSIG(label_st, var_list, result, belong));
@@ -232,9 +232,9 @@ ResultType globalIterStatement(Result *result, Inter *inter, Statement *st) {
             else
                 base = base->next;
         }
-    } while (type == restart_return && result->times == 0);
+    } while (type == R_restart && result->times == 0);
 
-    if (type != error_return && type != function_return)
+    if (type != R_error && type != R_func)
         setResultOperationNone(result, inter, belong);
     result->node = base;
 
@@ -253,7 +253,7 @@ bool operationSafeInterStatement(INTER_FUNCTIONSIG){
     type = iterStatement(CALL_INTER_FUNCTIONSIG(st, var_list, result, belong));
     if (RUN_TYPE(type))
         return false;
-    else if (type != return_code && type != error_return)
+    else if (type != return_code && type != R_error)
         setResultErrorSt(E_ResultException, "Operation get not support result type", true, st, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
     return true;
 }
@@ -263,12 +263,12 @@ bool ifBranchSafeInterStatement(INTER_FUNCTIONSIG){
     type = iterStatement(CALL_INTER_FUNCTIONSIG(st, var_list, result, belong));
     if (RUN_TYPE(type))
         return false;
-    if (type == rego_return){
+    if (type == R_rego){
         result->times--;
         if (result->times < 0)
             return false;
     }
-    if (type == restart_return || type == goto_return)
+    if (type == R_restart || type == R_goto)
         result->times--;
     return true;
 }
@@ -278,12 +278,12 @@ bool cycleBranchSafeInterStatement(INTER_FUNCTIONSIG){
     type = iterStatement(CALL_INTER_FUNCTIONSIG(st, var_list, result, belong));
     if (RUN_TYPE(type))
         return false;
-    if (type == break_return || type == continue_return){
+    if (type == R_break || type == R_continue){
         result->times--;
         if (result->times < 0)
             return false;
     }
-    if (type == restart_return || type == goto_return)
+    if (type == R_restart || type == R_goto)
         result->times--;
     return true;
 }
@@ -293,7 +293,7 @@ bool tryBranchSafeInterStatement(INTER_FUNCTIONSIG){
     type = iterStatement(CALL_INTER_FUNCTIONSIG(st, var_list, result, belong));
     if (RUN_TYPE(type))
         return false;
-    if (type == restart_return || type == goto_return)
+    if (type == R_restart || type == R_goto)
         result->times--;
     return true;
 }
@@ -301,21 +301,21 @@ bool tryBranchSafeInterStatement(INTER_FUNCTIONSIG){
 bool functionSafeInterStatement(INTER_FUNCTIONSIG){
     ResultType type;
     type = iterStatement(CALL_INTER_FUNCTIONSIG(st, var_list, result, belong));
-    if (type == error_return || result->type == yield_return)
+    if (type == R_error || result->type == R_yield)
         return true;
-    else if (type == function_return)
-        result->type = operation_return;
+    else if (type == R_func)
+        result->type = R_opt;
     else
-        result->type = not_return;
+        result->type = R_not;
     return false;
 }
 
 bool blockSafeInterStatement(INTER_FUNCTIONSIG){
     ResultType type;
     type = iterStatement(CALL_INTER_FUNCTIONSIG(st, var_list, result, belong));
-    if (type == error_return || type == yield_return)
+    if (type == R_error || type == R_yield)
         return true;
-    result->type = operation_return;
+    result->type = R_opt;
     return false;
 }
 

+ 46 - 47
VirtulMathCore/src/runbranch.c

@@ -78,7 +78,7 @@ ResultType ifBranch(INTER_FUNCTIONSIG) {
                 set_result = false;
                 goto not_else;
             }
-            if (result->type == rego_return)
+            if (result->type == R_rego)
                 is_rego = true;
             freeResult(result);
             info_vl = NULL;
@@ -116,7 +116,7 @@ ResultType ifBranch(INTER_FUNCTIONSIG) {
                     set_result = false;
                     goto not_else;
                 }
-                if (result->type == rego_return)
+                if (result->type == R_rego)
                     is_rego = true;
                 else {
                     freeResult(result);
@@ -130,7 +130,7 @@ ResultType ifBranch(INTER_FUNCTIONSIG) {
                 set_result = false;
                 goto not_else;
             }
-            if (result->type == rego_return)
+            if (result->type == R_rego)
                 is_rego = true;
             freeResult(result);
         }
@@ -154,17 +154,17 @@ ResultType ifBranch(INTER_FUNCTIONSIG) {
         freeResult(&finally_tmp);
 
     if (yield_run)
-        if (result->type == yield_return)
+        if (result->type == R_yield)
             updateBranchYield(st, result->node, if_list, result_from);
         else
             freeRunInfo(st);
     else
-        if (result->type == yield_return)
+        if (result->type == R_yield)
             newBranchYield(st, result->node, if_list, var_list, result_from, inter);
         else
             var_list = popVarList(var_list);
     if (set_result)
-        setResult(result, inter, belong);
+        setResult(result, inter);
     return result->type;
 }
 
@@ -248,7 +248,6 @@ ResultType whileBranch(INTER_FUNCTIONSIG) {
             freeResult(result);  // 赋值的返回值被丢弃
         }
 
-        condition = do_while;
         if (!(condition = do_while)){
             condition = checkBool(condition_value, st->line, st->code_file, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
             if (!CHECK_RESULT(result)){
@@ -265,7 +264,7 @@ ResultType whileBranch(INTER_FUNCTIONSIG) {
                 set_result = false;
                 goto not_else;
             }
-            else if (result->type == break_return)
+            else if (result->type == R_break)
                 is_break = true;
             freeResult(result);
         }
@@ -280,7 +279,7 @@ ResultType whileBranch(INTER_FUNCTIONSIG) {
             set_result = false;
             goto not_else;
         }
-        else if (result->type == break_return) {
+        else if (result->type == R_break) {
             freeResult(result);
             goto not_else;
         }
@@ -308,20 +307,22 @@ ResultType whileBranch(INTER_FUNCTIONSIG) {
         freeResult(&finally_tmp);
 
     if (yield_run)
-        if (result->type == yield_return)
+        if (result->type == R_yield)
             updateBranchYield(st, result->node, while_list, result_from);
         else
             freeRunInfo(st);
     else
-        if (result->type == yield_return)
+        if (result->type == R_yield)
             newBranchYield(st, result->node, while_list, var_list, result_from, inter);
         else
             var_list = popVarList(var_list);
     if (set_result)
-        setResult(result, inter, belong);
+        setResult(result, inter);
     return result->type;
 }
 
+// TODO-szh 简化函数
+// TODO-szh for循环支持迭代器
 ResultType forBranch(INTER_FUNCTIONSIG) {
     StatementList *for_list = st->u.for_branch.for_list;
     Statement *first = st->u.for_branch.first_do;
@@ -333,7 +334,6 @@ ResultType forBranch(INTER_FUNCTIONSIG) {
     Statement *after_vl = NULL;
     bool set_result = true;
     bool is_break = false;
-    bool do_while = st->u.while_branch.type == do_while_;
     int yield_run = false;
     enum StatementInfoStatus result_from = info_vl_branch;
 
@@ -373,7 +373,7 @@ ResultType forBranch(INTER_FUNCTIONSIG) {
         freeResult(result);
 
     {
-        LinkValue *tmp = NULL;  // TODD-szh 要释放
+        LinkValue *tmp = NULL;
         if (operationSafeInterStatement(CALL_INTER_FUNCTIONSIG(for_list->condition, var_list, result, belong))){
             set_result = false;
             goto not_else;
@@ -438,7 +438,7 @@ ResultType forBranch(INTER_FUNCTIONSIG) {
             set_result = false;
             goto not_else;
         }
-        else if (result->type == break_return)
+        else if (result->type == R_break)
             is_break = true;
 
         freeResult(result);
@@ -450,7 +450,7 @@ ResultType forBranch(INTER_FUNCTIONSIG) {
             set_result = false;
             goto not_else;
         }
-        else if (result->type == break_return) {
+        else if (result->type == R_break) {
             freeResult(result);
             goto not_else;
         }
@@ -477,7 +477,7 @@ ResultType forBranch(INTER_FUNCTIONSIG) {
         freeResult(&finally_tmp);
 
     if (yield_run) {
-        if (result->type == yield_return)
+        if (result->type == R_yield)
             if (result_from == info_finally_branch) {
                 freeRunInfo(st);
                 newBranchYield(st, result->node, for_list, var_list, result_from, inter);
@@ -487,7 +487,7 @@ ResultType forBranch(INTER_FUNCTIONSIG) {
             freeRunInfo(st);
         iter = NULL;
     } else {
-        if (result->type == yield_return)
+        if (result->type == R_yield)
             if (result_from == info_finally_branch)
                 newBranchYield(st, result->node, for_list, var_list, result_from, inter);
             else {
@@ -501,7 +501,7 @@ ResultType forBranch(INTER_FUNCTIONSIG) {
     if (iter != NULL)
         gc_freeTmpLink(&iter->gc_status);
     if (set_result)
-        setResult(result, inter, belong);
+        setResult(result, inter);
     return result->type;
 }
 
@@ -608,7 +608,7 @@ ResultType withBranch(INTER_FUNCTIONSIG) {
         vl_info = with_list->code;
     if (tryBranchSafeInterStatement(CALL_INTER_FUNCTIONSIG(vl_info, new, result, with_belong))) {
         set_result = false;
-        if (result->type == yield_return)
+        if (result->type == R_yield)
             goto run_finally;
     }
     else
@@ -621,7 +621,7 @@ ResultType withBranch(INTER_FUNCTIONSIG) {
         set_result = false;
         *result = else_tmp;
         result_from = info_else_branch;
-        if (result->type == yield_return)
+        if (result->type == R_yield)
             goto run_finally;
     }
     else
@@ -658,7 +658,7 @@ ResultType withBranch(INTER_FUNCTIONSIG) {
 
     gc_freeze(inter, new, var_list, false);
     if (yield_run)
-        if (result->type == yield_return)
+        if (result->type == R_yield)
             if (result_from == info_finally_branch) {
                 freeRunInfo(st);
                 newBranchYield(st, result->node, with_list, NULL, result_from, inter);
@@ -668,7 +668,7 @@ ResultType withBranch(INTER_FUNCTIONSIG) {
         else
             freeRunInfo(st);
     else {
-        if (result->type == yield_return)
+        if (result->type == R_yield)
             if (result_from == info_finally_branch) {
                 if (value != NULL) {
                     gc_freeTmpLink(&value->gc_status);
@@ -685,7 +685,7 @@ ResultType withBranch(INTER_FUNCTIONSIG) {
     }
 
     if (set_result)
-        setResult(result, inter, belong);
+        setResult(result, inter);
     return result->type;
 }
 
@@ -725,7 +725,7 @@ ResultType tryBranch(INTER_FUNCTIONSIG) {
     }
 
     if (try != NULL && !tryBranchSafeInterStatement(CALL_INTER_FUNCTIONSIG(try, var_list, result, belong))){
-        if (result->type == yield_return) {
+        if (result->type == R_yield) {
             result_from = info_first_do;
             goto run_finally;
         }
@@ -748,7 +748,6 @@ ResultType tryBranch(INTER_FUNCTIONSIG) {
         error_value = result->value;
         result->value = NULL;
         for (PASS; except_list != NULL; except_list = except_list->next) {
-            LinkValue *tmp = NULL;
             if (except_list->condition == NULL)
                 break;
             freeResult(result);
@@ -796,18 +795,18 @@ ResultType tryBranch(INTER_FUNCTIONSIG) {
         freeResult(&finally_tmp);
 
     if (yield_run)
-        if (result->type == yield_return)
+        if (result->type == R_yield)
             updateBranchYield(st, result->node, except_list, result_from);
         else
             freeRunInfo(st);
     else
-        if (result->type == yield_return)
+        if (result->type == R_yield)
             newBranchYield(st, result->node, except_list, var_list, result_from, inter);
         else
             var_list = popVarList(var_list);
 
     if (set_result)
-        setResult(result, inter, belong);
+        setResult(result, inter);
     return result->type;
 }
 
@@ -826,9 +825,9 @@ ResultType breakCycle(INTER_FUNCTIONSIG){
     freeResult(result);
 
     not_times:
-    setResult(result, inter, belong);
+    setResult(result, inter);
     if (times_int >= 0) {
-        result->type = break_return;
+        result->type = R_break;
         result->times = times_int;
     }
     return result->type;
@@ -848,9 +847,9 @@ ResultType continueCycle(INTER_FUNCTIONSIG){
     freeResult(result);
 
     not_times:
-    setResult(result, inter, belong);
+    setResult(result, inter);
     if (times_int >= 0) {
-        result->type = continue_return;
+        result->type = R_continue;
         result->times = times_int;
     }
     return result->type;
@@ -870,9 +869,9 @@ ResultType regoIf(INTER_FUNCTIONSIG){
     freeResult(result);
 
     not_times:
-    setResult(result, inter, belong);
+    setResult(result, inter);
     if (times_int >= 0) {
-        result->type = rego_return;
+        result->type = R_rego;
         result->times = times_int;
     }
     return result->type;
@@ -892,9 +891,9 @@ ResultType restartCode(INTER_FUNCTIONSIG){
     freeResult(result);
 
     not_times:
-    setResult(result, inter, belong);
+    setResult(result, inter);
     if (times_int >= 0) {
-        result->type = restart_return;
+        result->type = R_restart;
         result->times = times_int;
     }
     return result->type;
@@ -903,7 +902,7 @@ ResultType restartCode(INTER_FUNCTIONSIG){
 ResultType returnCode(INTER_FUNCTIONSIG){
     setResultCore(result);
     if (st->u.return_code.value == NULL) {
-        setResult(result, inter, belong);
+        setResult(result, inter);
         goto set_result;
     }
 
@@ -911,14 +910,14 @@ ResultType returnCode(INTER_FUNCTIONSIG){
         return result->type;
 
     set_result:
-    result->type = function_return;
+    result->type = R_func;
     return result->type;
 }
 
 ResultType yieldCode(INTER_FUNCTIONSIG){
     setResultCore(result);
     if (st->u.yield_code.value == NULL) {
-        setResult(result, inter, belong);
+        setResult(result, inter);
         goto set_result;
     }
 
@@ -926,14 +925,14 @@ ResultType yieldCode(INTER_FUNCTIONSIG){
         return result->type;
 
     set_result:
-    result->type = yield_return;
+    result->type = R_yield;
     return result->type;
 }
 
 ResultType raiseCode(INTER_FUNCTIONSIG){
     setResultCore(result);
     if (st->u.raise_code.value == NULL) {
-        setResult(result, inter, belong);
+        setResult(result, inter);
         goto set_result;
     }
 
@@ -941,7 +940,7 @@ ResultType raiseCode(INTER_FUNCTIONSIG){
         return result->type;
 
     set_result:
-    result->type = error_return;
+    result->type = R_error;
     result->error = connectError(makeError("RaiseException", "Exception was raise by user", st->line, st->code_file), result->error);
     return result->type;
 }
@@ -956,7 +955,7 @@ ResultType assertCode(INTER_FUNCTIONSIG){
     if (!CHECK_RESULT(result))
         return result->type;
     else if (result_)
-        setResult(result, inter, belong);
+        setResult(result, inter);
     else
         setResultErrorSt(E_AssertException, "Assertion check error", true, st, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
     return result->type;
@@ -990,14 +989,14 @@ ResultType gotoLabel(INTER_FUNCTIONSIG){
     freeResult(result);
     not_times:
     if (st->u.goto_.return_ == NULL)
-        setResult(result, inter, belong);
+        setResult(result, inter);
     else if (operationSafeInterStatement(CALL_INTER_FUNCTIONSIG(st->u.goto_.return_, var_list, result, belong))) {
         memFree(label);
         return result->type;
     }
 
     result->times = times_int;
-    result->type = goto_return;
+    result->type = R_goto;
     result->label = label;
     return result->type;
 }
@@ -1018,7 +1017,7 @@ ResultType runLabel(INTER_FUNCTIONSIG) {
     if (st->u.label_.command != NULL)
         operationSafeInterStatement(CALL_INTER_FUNCTIONSIG(st->u.label_.command, var_list, result, belong));
     else
-        setResult(result, inter, belong);
+        setResult(result, inter);
 
     return_:
     popVarList(var_list);

+ 14 - 14
VirtulMathCore/src/runcall.c

@@ -30,7 +30,7 @@ ResultType setClass(INTER_FUNCTIONSIG) {
         tmp->value->object.var->next = var_backup;
         inter->data.default_pt_type = pt_type_bak;
 
-        if (result->type != yield_return && !CHECK_RESULT(result))
+        if (result->type != R_yield && !CHECK_RESULT(result))
             goto error_;
         freeResult(result);
     }
@@ -46,7 +46,7 @@ ResultType setClass(INTER_FUNCTIONSIG) {
 
     assCore(st->u.set_class.name, tmp, false, true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
     if (CHECK_RESULT(result))
-        setResult(result, inter, belong);
+        setResult(result, inter);
 
     gc_freeTmpLink(&tmp->gc_status);
     return result->type;
@@ -76,7 +76,7 @@ ResultType setFunction(INTER_FUNCTIONSIG) {
         functionSafeInterStatement(CALL_INTER_FUNCTIONSIG(st->u.set_function.first_do, func->value->object.var, result, func));
         func->value->object.var->next = var_backup;
         inter->data.default_pt_type = pt_type_bak;
-        if (result->type != yield_return && !CHECK_RESULT(result))
+        if (result->type != R_yield && !CHECK_RESULT(result))
             goto error_;
         freeResult(result);
     }
@@ -92,7 +92,7 @@ ResultType setFunction(INTER_FUNCTIONSIG) {
     }
     assCore(st->u.set_function.name, func, false, true, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
     if (CHECK_RESULT(result))
-        setResult(result, inter, belong);
+        setResult(result, inter);
 
     error_:
     gc_freeTmpLink(&func->gc_status);
@@ -221,10 +221,10 @@ static ResultType callCFunction(LinkValue *function_value, Argument *arg, long i
 
     freeResult(result);
     of(CALL_OFFICAL_FUNCTION(arg, function_var, result, function_value->belong));
-    if (result->type == function_return)
-        result->type = operation_return;
-    else if (result->type != operation_return && result->type != error_return)
-        setResult(result, inter, function_value->belong);
+    if (result->type == R_func)
+        result->type = R_opt;
+    else if (result->type != R_opt && result->type != R_error)
+        setResult(result, inter);
 
     gc_freeze(inter, var_list, function_var, false);
     popVarList(function_var);
@@ -244,7 +244,7 @@ static ResultType callVMFunction(LinkValue *function_value, Argument *arg, long
     st_func = function_value->value->data.function.function;
 
     if (st_func == NULL) {
-        setResult(result, inter, belong);
+        setResult(result, inter);
         return result->type;
     }
 
@@ -276,18 +276,18 @@ static ResultType callVMFunction(LinkValue *function_value, Argument *arg, long
     functionSafeInterStatement(CALL_INTER_FUNCTIONSIG(st_func, var_func, result, function_value->belong));
     gc_freeze(inter, var_list, var_func, false);
 
-    st_func = function_value->value->data.function.function;  // TODO-szh 提取函数
+    st_func = function_value->value->data.function.function;  // TODO-szh yield 提取函数
     if (yield_run)
-        if (result->type == yield_return){
+        if (result->type == R_yield){
             updateFunctionYield(st_func, result->node);
-            result->type = operation_return;
+            result->type = R_opt;
         }
         else
             freeRunInfo(st_func);
     else
-        if (result->type == yield_return){
+        if (result->type == R_yield){
             newFunctionYield(st_func, result->node, var_func, inter);
-            result->type = operation_return;
+            result->type = R_opt;
         }
         else
             popVarList(var_func);

+ 6 - 6
VirtulMathCore/src/runfile.c

@@ -142,8 +142,8 @@ ResultType includeFile(INTER_FUNCTIONSIG) {
         goto return_;
 
     functionSafeInterStatement(CALL_INTER_FUNCTIONSIG(new_st, var_list, result, belong));
-    if (result->type == yield_return)
-        setResult(result, inter, belong);
+    if (result->type == R_yield)
+        setResult(result, inter);
     else if (!CHECK_RESULT(result))
         setResultErrorSt(E_BaseException, NULL, false, st, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
 
@@ -169,7 +169,7 @@ ResultType importVMFileCore(Inter *import_inter, char *path, fline line, char *c
     if (!CHECK_RESULT(result))
         setResultError(E_BaseException, NULL, line, code_file, false, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
     else
-        setResult(result, inter, belong);
+        setResult(result, inter);
 
     return_:
     freeStatement(run_st);
@@ -185,7 +185,7 @@ ResultType importFileCore(char **path, char **split, int *status, INTER_FUNCTION
 
     if (!isType(result->value->value, string)) {
         setResultErrorSt(E_ImportException, ONLY_ACC(include file dir, string), true, st, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
-        return error_return;
+        return R_error;
     }
 
     *path = wcsToStr(result->value->value->data.str.str, false);
@@ -262,7 +262,7 @@ ResultType importFile(INTER_FUNCTIONSIG) {
         assCore(st->u.import_file.as, imp_value, false, is_new, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
 
     if (CHECK_RESULT(result))
-        setResult(result, inter, belong);
+        setResult(result, inter);
     gc_freeTmpLink(&imp_value->gc_status);
 
     return_:
@@ -338,7 +338,7 @@ ResultType fromImportFile(INTER_FUNCTIONSIG) {
     }
     else
         updateHashTable(var_list->hashtable, imp_var->hashtable, inter);
-    setResult(result, inter, belong);
+    setResult(result, inter);
     gc_freeTmpLink(&imp_value->gc_status);
 
     return_:

+ 9 - 9
VirtulMathCore/src/runoperation.c

@@ -39,7 +39,7 @@ ResultType operationStatement(INTER_FUNCTIONSIG) {
             blockOperation(CALL_INTER_FUNCTIONSIG(st, var_list, result, belong));
             break;
         default:
-            setResult(result, inter, belong);
+            setResult(result, inter);
             break;
     }
     return result->type;
@@ -51,20 +51,20 @@ ResultType blockOperation(INTER_FUNCTIONSIG) {
     if ((yield_run = popStatementVarList(st, &var_list, var_list, inter)))
         info_st = st->info.node;
     blockSafeInterStatement(CALL_INTER_FUNCTIONSIG(info_st, var_list, result, belong));
-    if (result->type == error_return)
+    if (result->type == R_error)
         return result->type;
     else if (yield_run) {
-        if (result->type == yield_return){
+        if (result->type == R_yield){
             updateFunctionYield(st, result->node);
-            result->type = operation_return;
+            result->type = R_opt;
         }
         else
             freeRunInfo(st);
     }
     else {
-        if (result->type == yield_return){
+        if (result->type == R_yield){
             newFunctionYield(st, result->node, var_list, inter);
-            result->type = operation_return;
+            result->type = R_opt;
         }
         else
             popVarList(var_list);
@@ -155,7 +155,7 @@ ResultType varDel(Statement *name, bool check_aut, INTER_FUNCTIONSIG_NOT_ST) {
         }
     }
     findFromVarList(str_name, int_times, del_var, CALL_INTER_FUNCTIONSIG_CORE(var_list));
-    setResult(result, inter, belong);
+    setResult(result, inter);
     return_:
     memFree(str_name);
     return result->type;
@@ -305,7 +305,7 @@ ResultType varAss(Statement *name, LinkValue *value, bool check_aut, bool settin
     }
 
     freeResult(result);
-    result->type = operation_return;
+    result->type = R_opt;
     result->value = value;
     gc_addTmpLink(&result->value->gc_status);
 
@@ -433,7 +433,7 @@ ResultType getBaseValue(INTER_FUNCTIONSIG) {
     setResultCore(result);
     if (st->u.base_value.type == link_value) {
         result->value = st->u.base_value.value;
-        result->type = operation_return;
+        result->type = R_opt;
         gc_addTmpLink(&result->value->gc_status);
     }
     else

+ 1 - 1
VirtulMathCore/src/statement.c

@@ -79,7 +79,7 @@ Statement *makeBaseStrValueStatement(wchar_t *value, enum BaseValueType type, fl
     tmp->type = base_value;
     tmp->u.base_value.type = type;
     tmp->u.base_value.value = NULL;
-    tmp->u.base_value.str = memWidecpy(value);  // TODO-szh 需要修改运行BaseValue的函数
+    tmp->u.base_value.str = memWidecpy(value);
     return tmp;
 }
 

+ 11 - 11
VirtulMathCore/src/value.c

@@ -33,7 +33,7 @@ Value *useNoneValue(Inter *inter, Result *result) {
     LinkValue *tmp = inter->data.none;
     if (result != NULL) {
         setResultCore(result);
-        result->type = operation_return;
+        result->type = R_opt;
         result->value = tmp;
         gc_addTmpLink(&result->value->gc_status);
     }
@@ -51,7 +51,7 @@ Value *makeBoolValue(bool bool_num, fline line, char *file, INTER_FUNCTIONSIG_NO
     return tmp;
 }
 
-Value *makePassValue(fline line, char *file, INTER_FUNCTIONSIG_NOT_ST){  // TODO-szh 让切片支持该语法
+Value *makePassValue(fline line, char *file, INTER_FUNCTIONSIG_NOT_ST){  // TODO-szh 让切片支持该语法 检查语法解析器支持 a[::]的语法
     Value *tmp = NULL;
     setResultCore(result);
     callBackCore(inter->data.pass_, NULL, line, file, 0, CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
@@ -84,7 +84,7 @@ Value *makeStringValue(wchar_t *str, fline line, char *file, INTER_FUNCTIONSIG_N
     return tmp;
 }
 
-Value *makeVMFunctionValue(Statement *st, Parameter *pt, INTER_FUNCTIONSIG_NOT_ST) {  // TODO-szh 设置无var_list的函数 (允许使用装饰器装饰,该功能未测试)
+Value *makeVMFunctionValue(Statement *st, Parameter *pt, INTER_FUNCTIONSIG_NOT_ST) {
     Value *tmp = NULL;
     callBackCore(inter->data.function, NULL, st->line, st->code_file, 0,
                  CALL_INTER_FUNCTIONSIG_NOT_ST(var_list, result, belong));
@@ -269,7 +269,7 @@ LinkValue *copyLinkValue(LinkValue *value, Inter *inter) {
 }
 
 void setResultCore(Result *ru) {
-    ru->type = not_return;
+    ru->type = R_not;
     ru->times = 0;
     ru->error = NULL;
     ru->value = NULL;
@@ -277,7 +277,7 @@ void setResultCore(Result *ru) {
     ru->node = NULL;
 }
 
-void setResult(Result *ru, Inter *inter, LinkValue *belong) {
+void setResult(Result *ru, Inter *inter) {
     freeResult(ru);
     setResultBase(ru, inter);
 }
@@ -340,7 +340,7 @@ char *getErrorInfo(LinkValue *exc, int type, Inter *inter){
     wchar_t *str_name = type == 1 ? inter->data.object_name : inter->data.object_message;
     LinkValue *_info_ = findAttributes(str_name, false, exc, inter);
     if (_info_ != NULL && _info_->value->type == string)
-        return wcsToStr(_info_->value->data.str.str, false);  // TODO-szh var使用宽字符
+        return wcsToStr(_info_->value->data.str.str, false);
     else
         return type == 1 ? memStrcpy("Error Type: Unknown") : memStrcpy("Error Message: Unknown");
 }
@@ -374,7 +374,7 @@ void callException(LinkValue *exc, char *message, fline line, char *file, INTER_
         gc_addTmpLink(&result->value->gc_status);
     }
 
-    result->type = error_return;
+    result->type = R_error;
     result->error = connectError(makeError(type, error_message, line, file), result->error);
     memFree(type);
     memFree(error_message);
@@ -382,7 +382,7 @@ void callException(LinkValue *exc, char *message, fline line, char *file, INTER_
 }
 
 void setResultError(BaseErrorType type, char *error_message, fline line, char *file, bool new, INTER_FUNCTIONSIG_NOT_ST) {
-    if (!new && result->type != error_return)
+    if (!new && result->type != R_error)
         return;
     if (new) {
         LinkValue *exc = findBaseError(type, inter);
@@ -396,8 +396,8 @@ void setResultError(BaseErrorType type, char *error_message, fline line, char *f
 }
 
 void setResultOperationNone(Result *ru, Inter *inter, LinkValue *belong) {
-    setResult(ru, inter, belong);
-    ru->type = operation_return;
+    setResult(ru, inter);
+    ru->type = R_opt;
 }
 
 void setResultOperation(Result *ru, LinkValue *value) {
@@ -410,7 +410,7 @@ void setResultOperationBase(Result *ru, LinkValue *value) {
     ru->value = value;
     if (value != NULL)
         gc_addTmpLink(&ru->value->gc_status);
-    ru->type = operation_return;
+    ru->type = R_opt;
 }
 
 void freeResult(Result *ru){

+ 2 - 2
src/virtualmath.c

@@ -20,7 +20,7 @@ void runCodeFile(Inter *inter, char *file[]) {
         }
         if (runParser(*file, inter, false, &pst)) {
             globalIterStatement(&result, inter, pst);
-            if (result.type == error_return) {
+            if (result.type == R_error) {
                 printError(&result, inter, true);
                 should_break = true;
             }
@@ -43,7 +43,7 @@ void runCodeStdin(Inter *inter, char *hello_string) {
         fprintf(stdout, ">>> ");
         if (runParser(NULL, inter, true, &pst)) {
             globalIterStatement(&result, inter, pst);
-            if (result.type == error_return && !(should_break = is_quitExc(result.value, inter)))
+            if (result.type == R_error && !(should_break = is_quitExc(result.value, inter)))
                 printError(&result, inter, true);
             freeStatement(pst);
             freeResult(&result);