link #7
@@ -13,6 +13,7 @@
#define OBJ_NOTSUPPORT(opt) (wchar_t *) L"object does not support " L###opt L" operation"
#define RETURN_ERROR(func, type) (wchar_t *) L###func L" func should return " L###type L" type data"
#define KEY_INTERRUPT (wchar_t *) L"keyInterrupt"
+#define NOT_ENOUGH_LEN(for) L"not enough length for" L###for
#define GET_RESULT(val, res) do {(val) = (res)->value; (res)->value=NULL; freeResult(res);} while(0)
#define GET_RESULTONLY(val, res) do {(val) = (res)->value; (res)->value=NULL;} while(0)
@@ -61,6 +61,12 @@ static ResultType dou_init(O_FUNC){
case V_ell:
base->value->data.dou.num = 0;
break;
+ case V_struct:
+ if (ap[1].value->value->data.struct_.len * sizeof(int8_t) >= sizeof(vdou))
+ base->value->data.dou.num = *(vdou *)ap[1].value->value->data.struct_.data; // 转换为 vdou
+ else
+ setResultError(E_ValueException, NOT_ENOUGH_LEN(dou), LINEFILE, true, CNEXT_NT); // 出现错误
+ break;
default:
setResultError(E_TypeException, ERROR_INIT(num), LINEFILE, true, CNEXT_NT);
return result->type;
@@ -61,6 +61,12 @@ static ResultType int_init(O_FUNC){
base->value->data.int_.num = 0;
+ if (ap[1].value->value->data.struct_.len * sizeof(int8_t) >= sizeof(vint))
+ base->value->data.int_.num = *(vint *)ap[1].value->value->data.struct_.data; // 转换为 vint
+ setResultError(E_ValueException, NOT_ENOUGH_LEN(int), LINEFILE, true, CNEXT_NT); // 出现错误
@@ -41,6 +41,12 @@ static ResultType pointer_init(O_FUNC){
base->value->data.pointer.pointer = NULL;
+ base->value->data.pointer.pointer = &ap[1].value->value->data.struct_.data; // 获取指向结构体指针的指针
+ case V_pointer:
+ base->value->data.pointer.pointer = ap[1].value->value->data.pointer.pointer;