mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-22 17:12:55 +08:00
40 lines
890 B
C
40 lines
890 B
C
|
#include "dataStrs.h"
|
||
|
#include <stdarg.h>
|
||
|
#include "PikaBlock.h"
|
||
|
#include "TinyObj.h"
|
||
|
#include "PikaIf.h"
|
||
|
|
||
|
void if_setAssert(PikaObj *self, char *line)
|
||
|
{
|
||
|
Args *buffs = New_strBuff();
|
||
|
char *assert = strsRemovePrefix(buffs, line, "if ");
|
||
|
assert = strsGetFirstToken(buffs, assert, ':');
|
||
|
block_setAssert(self, assert);
|
||
|
block_setMode(self, "if");
|
||
|
args_deinit(buffs);
|
||
|
}
|
||
|
|
||
|
void if_pushLine(PikaObj *self, char *line)
|
||
|
{
|
||
|
Args *buffs = New_strBuff();
|
||
|
char *bodyLine = strsRemovePrefix(buffs, line, " ");
|
||
|
block_pushLine(self, bodyLine);
|
||
|
goto exit;
|
||
|
exit:
|
||
|
args_deinit(buffs);
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
void if_run(PikaObj *self)
|
||
|
{
|
||
|
if (block_checkAssert(self))
|
||
|
{
|
||
|
PikaObj *host = obj_getContext(self);
|
||
|
while (0 != block_getLineSize(self))
|
||
|
{
|
||
|
char *line = block_popLine(self);
|
||
|
obj_run(host, line);
|
||
|
}
|
||
|
}
|
||
|
}
|