add pikaStdData

This commit is contained in:
lyon 2021-12-13 21:24:48 +08:00
parent 043d49a9c4
commit d08b124785
17 changed files with 25 additions and 37 deletions

0
port/linux/api-make-linux.sh Normal file → Executable file
View File

0
port/linux/api-make-win10.sh Normal file → Executable file
View File

0
port/linux/api-make.sh Normal file → Executable file
View File

0
port/linux/gtest.sh Normal file → Executable file
View File

0
port/linux/init.sh Normal file → Executable file
View File

0
port/linux/make.sh Normal file → Executable file
View File

View File

@ -32,18 +32,3 @@ class SysObj(BaseObj):
pass
class List(TinyObj):
def init():
pass
def append(arg: any):
pass
def get(i: int) -> any:
pass
def set(i: int, arg: any):
pass
def len() -> int:
pass

View File

@ -1,5 +1,6 @@
import PikaStdLib
import PikaStdDevice
import PikaStdData
import PikaMath
from PikaObj import *

View File

@ -0,0 +1,17 @@
from PikaObj import *
class List(TinyObj):
def init():
pass
def append(arg: any):
pass
def get(i: int) -> any:
pass
def set(i: int, arg: any):
pass
def len() -> int:
pass

View File

@ -1,6 +1,6 @@
#include "PikaStdLib_List.h"
#include "PikaStdData_List.h"
void PikaStdLib_List_append(PikaObj* self, Arg* arg) {
void PikaStdData_List_append(PikaObj* self, Arg* arg) {
int top = obj_getInt(self, "top");
char buff[11];
char* topStr = fast_itoa(buff, top);
@ -9,21 +9,21 @@ void PikaStdLib_List_append(PikaObj* self, Arg* arg) {
obj_setInt(self, "top", top + 1);
}
int PikaStdLib_List_len(PikaObj* self) {
int PikaStdData_List_len(PikaObj* self) {
return obj_getInt(self, "top");
}
Arg* PikaStdLib_List_get(PikaObj* self, int i) {
Arg* PikaStdData_List_get(PikaObj* self, int i) {
char buff[11];
char* index = fast_itoa(buff, i);
return arg_copy(obj_getArg(self, index));
}
void PikaStdLib_List_init(PikaObj* self) {
void PikaStdData_List_init(PikaObj* self) {
/* set top index for append */
obj_setInt(self, "top", 0);
}
void PikaStdLib_List_set(PikaObj* self, Arg* arg, int i) {
void PikaStdData_List_set(PikaObj* self, Arg* arg, int i) {
char buff[11];
char* i_str = fast_itoa(buff, i);
int top = obj_getInt(self, "top");

View File

@ -32,18 +32,3 @@ class SysObj(BaseObj):
pass
class List(TinyObj):
def init():
pass
def append(arg: any):
pass
def get(i: int) -> any:
pass
def set(i: int, arg: any):
pass
def len() -> int:
pass

0
port/linux/package/pikascript/rust-msc-latest-linux Normal file → Executable file
View File

0
port/linux/pull-core.sh Normal file → Executable file
View File

0
port/linux/push-core.sh Normal file → Executable file
View File

0
port/linux/test-banchmark.sh Normal file → Executable file
View File

View File

@ -37,7 +37,7 @@ TEST(pikaMain, list_new) {
/* run */
Parameters* globals =
obj_runDirect(pikaMain, (char*)
"list = PikaStdLib.List()\n"
"list = PikaStdData.List()\n"
"list.init()\n"
"list.append(7)\n"
"list.append('eee')\n"

0
port/linux/update-compiler.sh Normal file → Executable file
View File