mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-29 17:22:56 +08:00
add pikaStdData
This commit is contained in:
parent
043d49a9c4
commit
d08b124785
0
port/linux/api-make-linux.sh
Normal file → Executable file
0
port/linux/api-make-linux.sh
Normal file → Executable file
0
port/linux/api-make-win10.sh
Normal file → Executable file
0
port/linux/api-make-win10.sh
Normal file → Executable file
0
port/linux/api-make.sh
Normal file → Executable file
0
port/linux/api-make.sh
Normal file → Executable file
0
port/linux/gtest.sh
Normal file → Executable file
0
port/linux/gtest.sh
Normal file → Executable file
0
port/linux/init.sh
Normal file → Executable file
0
port/linux/init.sh
Normal file → Executable file
0
port/linux/make.sh
Normal file → Executable file
0
port/linux/make.sh
Normal file → Executable file
@ -32,18 +32,3 @@ class SysObj(BaseObj):
|
|||||||
pass
|
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
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import PikaStdLib
|
import PikaStdLib
|
||||||
import PikaStdDevice
|
import PikaStdDevice
|
||||||
|
import PikaStdData
|
||||||
import PikaMath
|
import PikaMath
|
||||||
from PikaObj import *
|
from PikaObj import *
|
||||||
|
|
||||||
|
@ -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
|
@ -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");
|
int top = obj_getInt(self, "top");
|
||||||
char buff[11];
|
char buff[11];
|
||||||
char* topStr = fast_itoa(buff, top);
|
char* topStr = fast_itoa(buff, top);
|
||||||
@ -9,21 +9,21 @@ void PikaStdLib_List_append(PikaObj* self, Arg* arg) {
|
|||||||
obj_setInt(self, "top", top + 1);
|
obj_setInt(self, "top", top + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int PikaStdLib_List_len(PikaObj* self) {
|
int PikaStdData_List_len(PikaObj* self) {
|
||||||
return obj_getInt(self, "top");
|
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 buff[11];
|
||||||
char* index = fast_itoa(buff, i);
|
char* index = fast_itoa(buff, i);
|
||||||
return arg_copy(obj_getArg(self, index));
|
return arg_copy(obj_getArg(self, index));
|
||||||
}
|
}
|
||||||
void PikaStdLib_List_init(PikaObj* self) {
|
void PikaStdData_List_init(PikaObj* self) {
|
||||||
/* set top index for append */
|
/* set top index for append */
|
||||||
obj_setInt(self, "top", 0);
|
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 buff[11];
|
||||||
char* i_str = fast_itoa(buff, i);
|
char* i_str = fast_itoa(buff, i);
|
||||||
int top = obj_getInt(self, "top");
|
int top = obj_getInt(self, "top");
|
@ -32,18 +32,3 @@ class SysObj(BaseObj):
|
|||||||
pass
|
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
0
port/linux/package/pikascript/rust-msc-latest-linux
Normal file → Executable file
0
port/linux/pull-core.sh
Normal file → Executable file
0
port/linux/pull-core.sh
Normal file → Executable file
0
port/linux/push-core.sh
Normal file → Executable file
0
port/linux/push-core.sh
Normal file → Executable file
0
port/linux/test-banchmark.sh
Normal file → Executable file
0
port/linux/test-banchmark.sh
Normal file → Executable file
@ -37,7 +37,7 @@ TEST(pikaMain, list_new) {
|
|||||||
/* run */
|
/* run */
|
||||||
Parameters* globals =
|
Parameters* globals =
|
||||||
obj_runDirect(pikaMain, (char*)
|
obj_runDirect(pikaMain, (char*)
|
||||||
"list = PikaStdLib.List()\n"
|
"list = PikaStdData.List()\n"
|
||||||
"list.init()\n"
|
"list.init()\n"
|
||||||
"list.append(7)\n"
|
"list.append(7)\n"
|
||||||
"list.append('eee')\n"
|
"list.append('eee')\n"
|
||||||
|
0
port/linux/update-compiler.sh
Normal file → Executable file
0
port/linux/update-compiler.sh
Normal file → Executable file
Loading…
x
Reference in New Issue
Block a user