mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-29 17:22:56 +08:00
add enum instruct
This commit is contained in:
parent
43c764c6e0
commit
307f3488e1
23
src/PikaVM.c
23
src/PikaVM.c
@ -15,18 +15,25 @@ static int32_t getLineSize(char* str) {
|
||||
}
|
||||
}
|
||||
|
||||
static char* strs_getLine(Args* buffs, char* code) {
|
||||
int32_t lineSize = getLineSize(code);
|
||||
char* line = args_getBuff(buffs, lineSize + 1);
|
||||
memcpy(line, code, lineSize);
|
||||
line[lineSize + 1] = 0;
|
||||
return line;
|
||||
}
|
||||
|
||||
int32_t pikaVM_run(PikaObj* self, char* pikaAsm, int32_t lineAddr) {
|
||||
Args* buffs = New_strBuff();
|
||||
int32_t nextAddr = lineAddr;
|
||||
char* code = pikaAsm + lineAddr;
|
||||
int32_t lineSize = getLineSize(code);
|
||||
nextAddr = lineAddr + lineSize + 1;
|
||||
char* line = args_getBuff(buffs, lineSize + 1);
|
||||
memcpy(line, code, lineSize);
|
||||
line[lineSize + 1] = 0;
|
||||
char* line = strs_getLine(buffs, code);
|
||||
|
||||
goto exit;
|
||||
exit:
|
||||
char deepth = line[0];
|
||||
enum { NON, REF, RUN, STR, OUT, NUM } instruct = NON;
|
||||
|
||||
goto nextLine;
|
||||
nextLine:
|
||||
args_deinit(buffs);
|
||||
return nextAddr;
|
||||
return lineAddr + strGetSize(line) + 1;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user