|
@@ -206,77 +206,6 @@ void registeredStr(R_FUNC){
|
|
|
gc_freeTmpLink(&object->gc_status);
|
|
|
}
|
|
|
|
|
|
-LinkValue *callClassOf(LinkValue *obj, Inter *inter, LinkValue *new_func, LinkValue *init_func) {
|
|
|
- Argument *arg;
|
|
|
- Argument *init_arg;
|
|
|
- Result result;
|
|
|
- LinkValue *new_name;
|
|
|
- setResultCore(&result);
|
|
|
-
|
|
|
- arg = makeValueArgument(obj);
|
|
|
- new_func->value->data.function.of(arg, obj, &result, inter, new_func->value->object.out_var);
|
|
|
- new_name = result.value;
|
|
|
- freeResult(&result);
|
|
|
- freeArgument(arg, true);
|
|
|
-
|
|
|
- init_arg = makeValueArgument(new_name);
|
|
|
- init_func->value->data.function.of(init_arg, new_name, &result, inter, init_func->value->object.out_var);
|
|
|
- freeResult(&result);
|
|
|
- freeArgument(init_arg, true);
|
|
|
-
|
|
|
- return new_name;
|
|
|
-}
|
|
|
-
|
|
|
-LinkValue *makeStrFromOf(LinkValue *str, LinkValue *new, LinkValue *init, wchar_t *str_, Inter *inter) {
|
|
|
- LinkValue *return_;
|
|
|
- return_ = callClassOf(str, inter, new, init);
|
|
|
- memFree(return_->value->data.str.str);
|
|
|
- return_->value->data.str.str = memWidecpy(str_);
|
|
|
- return return_;
|
|
|
-}
|
|
|
-
|
|
|
-static LinkValue *makeFunctionFromValue(LinkValue *func, LinkValue *new, LinkValue *init, OfficialFunction of, LinkValue *belong, VarList *var_list, Inter *inter) {
|
|
|
- LinkValue *new_func;
|
|
|
- new_func = callClassOf(func, inter, new, init);
|
|
|
- new_func->value->data.function.type = c_func;
|
|
|
- new_func->value->data.function.of = of;
|
|
|
- new_func->value->data.function.function_data.pt_type = inter->data.default_pt_type;
|
|
|
- for (VarList *vl = new_func->value->object.out_var; vl != NULL; vl = freeVarList(vl))
|
|
|
- PASS;
|
|
|
- new_func->value->object.out_var = copyVarList(var_list, false, inter);
|
|
|
- new_func->belong = belong;
|
|
|
- return new_func;
|
|
|
-}
|
|
|
-
|
|
|
-void strFunctionPresetting(LinkValue *func, LinkValue *func_new, LinkValue *func_init, Inter *inter) {
|
|
|
- LinkValue *obj = inter->data.base_obj[B_STR];
|
|
|
-
|
|
|
- LinkValue *new_func = NULL;
|
|
|
- LinkValue *new_name = NULL;
|
|
|
- wchar_t *new_name_ = setStrVarName(inter->data.mag_func[M_NEW], false, inter);
|
|
|
-
|
|
|
- LinkValue *init_func = NULL;
|
|
|
- LinkValue *init_name = NULL;
|
|
|
- wchar_t *init_name_ = setStrVarName(inter->data.mag_func[M_INIT], false, inter);
|
|
|
-
|
|
|
- new_func = makeFunctionFromValue(func, func_new, func_init, str_new, obj, NULL, inter); // 声明为内联函数
|
|
|
- init_func = makeFunctionFromValue(func, func_new, func_init, str_init, obj, NULL, inter);
|
|
|
- new_func->value->data.function.function_data.pt_type = fp_class;
|
|
|
- init_func->value->data.function.function_data.pt_type = fp_obj;
|
|
|
-
|
|
|
-
|
|
|
- new_name = makeStrFromOf(obj, new_func, init_func, inter->data.mag_func[M_NEW], inter);
|
|
|
- init_name = makeStrFromOf(obj, new_func, init_func, inter->data.mag_func[M_INIT], inter);
|
|
|
-
|
|
|
- addFromVarList(new_name_, new_name, 0, new_func, CFUNC_CORE(obj->value->object.var));
|
|
|
- addFromVarList(init_name_, init_name, 0, init_func, CFUNC_CORE(obj->value->object.var));
|
|
|
-
|
|
|
- newObjectSettingPresetting(new_func, new_name, inter);
|
|
|
- newObjectSettingPresetting(init_func, init_name, inter);
|
|
|
- memFree(new_name_);
|
|
|
- memFree(init_name_);
|
|
|
-}
|
|
|
-
|
|
|
void makeBaseStr(Inter *inter){
|
|
|
LinkValue *str = makeBaseChildClass(inter->data.base_obj[B_VOBJECT], inter);
|
|
|
gc_addStatementLink(&str->gc_status);
|