From 1f1a9c1f63428eb4500edda1d2c5c77a9e4fe521 Mon Sep 17 00:00:00 2001 From: lyon Date: Tue, 4 Jan 2022 19:11:47 +0800 Subject: [PATCH] update PikaStdLib --- package/PikaStdLib/PikaStdLib_RangeObj.c | 11 +++++------ package/PikaStdLib/PikaStdLib_SysObj.c | 10 ++++++++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/package/PikaStdLib/PikaStdLib_RangeObj.c b/package/PikaStdLib/PikaStdLib_RangeObj.c index 735ef5751..05bdaa4d1 100644 --- a/package/PikaStdLib/PikaStdLib_RangeObj.c +++ b/package/PikaStdLib/PikaStdLib_RangeObj.c @@ -2,12 +2,11 @@ Arg* PikaStdLib_RangeObj___iter__(PikaObj* self) { return arg_setPtr(NULL, "", TYPE_OBJECT, self); - ; } Arg* PikaStdLib_RangeObj___next__(PikaObj* self) { - int a1 = obj_getInt(self, "a1"); - int a2 = obj_getInt(self, "a2"); - int a3 = obj_getInt(self, "a3"); + int a1 = args_getInt(self->list, "a1"); + int a2 = args_getInt(self->list, "a2"); + int a3 = args_getInt(self->list, "a3"); int start = 0; int end = 0; int foot = 1; @@ -17,7 +16,7 @@ Arg* PikaStdLib_RangeObj___next__(PikaObj* self) { end = a2; } /* start */ - int iter_i = obj_getInt(self, "iter_i"); + int iter_i = args_getInt(self->list, "iter_i"); /* iter_i is not inited */ if (-999999999 == iter_i) { iter_i = start; @@ -26,6 +25,6 @@ Arg* PikaStdLib_RangeObj___next__(PikaObj* self) { if (iter_i >= end) { return arg_setNull(NULL); } - obj_setInt(self, "iter_i", iter_i + foot); + args_setInt(self->list, "iter_i", iter_i + foot); return arg_setInt(NULL, "", iter_i); } \ No newline at end of file diff --git a/package/PikaStdLib/PikaStdLib_SysObj.c b/package/PikaStdLib/PikaStdLib_SysObj.c index 490da2a8d..fe049881e 100644 --- a/package/PikaStdLib/PikaStdLib_SysObj.c +++ b/package/PikaStdLib/PikaStdLib_SysObj.c @@ -84,7 +84,10 @@ Arg* PikaStdLib_SysObj_iter(PikaObj* self, Arg* arg) { /* object */ if (TYPE_POINTER == arg_getType(arg)) { PikaObj* arg_obj = arg_getPtr(arg); - obj_run(arg_obj, "__res = __iter__()"); + pikaVM_runAsm(arg_obj, + "B0\n" + "0 RUN __iter__\n" + "0 OUT __res\n"); return arg_copy(args_getArg(arg_obj->list, "__res")); } return arg_setNull(NULL); @@ -92,7 +95,10 @@ Arg* PikaStdLib_SysObj_iter(PikaObj* self, Arg* arg) { Arg* PikaStdLib_SysObj_next(PikaObj* self, Arg* arg) { PikaObj* arg_obj = arg_getPtr(arg); - obj_run(arg_obj, "__res = __next__()"); + pikaVM_runAsm(arg_obj, + "B0\n" + "0 RUN __next__\n" + "0 OUT __res\n"); return arg_copy(args_getArg(arg_obj->list, "__res")); }