use if else
This commit is contained in:
122
pike.c
122
pike.c
@@ -473,19 +473,20 @@ plist[plistidx++] = npc; \
|
|||||||
|
|
||||||
#define onclist(nn) \
|
#define onclist(nn) \
|
||||||
|
|
||||||
#define endnlist() if (*npc == MATCH) nmatch = sp; \
|
#define endnlist() if (spc == MATCH) nmatch = sp; \
|
||||||
|
|
||||||
#define endclist() \
|
#define endclist() \
|
||||||
|
|
||||||
#define fastrec(nn, list, listidx) \
|
#define fastrec(nn, list, listidx) \
|
||||||
nsub->ref++; \
|
nsub->ref++; \
|
||||||
if (*npc < WBEG) { \
|
spc = *npc; \
|
||||||
|
if (spc < WBEG) { \
|
||||||
list[listidx].sub = nsub; \
|
list[listidx].sub = nsub; \
|
||||||
list[listidx++].pc = npc; \
|
list[listidx++].pc = npc; \
|
||||||
npc = pcs[i]; \
|
npc = pcs[si]; \
|
||||||
goto rec##nn; \
|
goto rec##nn; \
|
||||||
} \
|
} \
|
||||||
subs[i++] = nsub; \
|
subs[si++] = nsub; \
|
||||||
goto next##nn; \
|
goto next##nn; \
|
||||||
|
|
||||||
#define saveclist() \
|
#define saveclist() \
|
||||||
@@ -497,81 +498,80 @@ newsub(/*nop*/, /*nop*/) \
|
|||||||
memcpy(s1->sub, nsub->sub, osubp); \
|
memcpy(s1->sub, nsub->sub, osubp); \
|
||||||
|
|
||||||
#define instclist(nn) \
|
#define instclist(nn) \
|
||||||
case BOL: \
|
else if (spc == BOL) { \
|
||||||
if (_sp != s) { \
|
if (_sp != s) { \
|
||||||
if (!i && !clistidx) \
|
if (!si && !clistidx) \
|
||||||
return 0; \
|
return 0; \
|
||||||
deccheck(nn) \
|
deccheck(nn) \
|
||||||
} \
|
} \
|
||||||
npc++; goto rec##nn; \
|
npc++; goto rec##nn; \
|
||||||
|
} \
|
||||||
|
|
||||||
#define instnlist(nn) \
|
#define instnlist(nn) \
|
||||||
case JMP: \
|
else if (spc == JMP) { \
|
||||||
npc += 2 + npc[1]; \
|
npc += 2 + npc[1]; \
|
||||||
goto rec##nn; \
|
goto rec##nn; \
|
||||||
|
} \
|
||||||
|
|
||||||
#define addthread(nn, list, listidx) \
|
#define addthread(nn, list, listidx) \
|
||||||
{ \
|
si = 0; \
|
||||||
int i = 0; \
|
rec##nn: \
|
||||||
rec##nn: \
|
spc = *npc; \
|
||||||
if (*npc < WBEG) { \
|
if (spc < WBEG) { \
|
||||||
list[listidx].sub = nsub; \
|
list[listidx].sub = nsub; \
|
||||||
list[listidx++].pc = npc; \
|
list[listidx++].pc = npc; \
|
||||||
rec_check##nn: \
|
rec_check##nn: \
|
||||||
if (i) { \
|
if (si) { \
|
||||||
npc = pcs[--i]; \
|
npc = pcs[--si]; \
|
||||||
nsub = subs[i]; \
|
nsub = subs[si]; \
|
||||||
goto rec##nn; \
|
|
||||||
} \
|
|
||||||
end##list() \
|
|
||||||
continue; \
|
|
||||||
} \
|
|
||||||
next##nn: \
|
|
||||||
switch(*npc) { \
|
|
||||||
case SPLIT: \
|
|
||||||
on##list(nn) \
|
|
||||||
npc += 2; \
|
|
||||||
pcs[i] = npc + npc[-1]; \
|
|
||||||
fastrec(nn, list, listidx) \
|
|
||||||
case RSPLIT: \
|
|
||||||
on##list(nn) \
|
|
||||||
npc += 2; \
|
|
||||||
pcs[i] = npc; \
|
|
||||||
npc += npc[-1]; \
|
|
||||||
fastrec(nn, list, listidx) \
|
|
||||||
case SAVE: \
|
|
||||||
if (nsub->ref > 1) { \
|
|
||||||
nsub->ref--; \
|
|
||||||
save##list() \
|
|
||||||
nsub = s1; \
|
|
||||||
nsub->ref = 1; \
|
|
||||||
} \
|
|
||||||
nsub->sub[npc[1]] = _sp; \
|
|
||||||
npc += 2; \
|
|
||||||
goto rec##nn; \
|
goto rec##nn; \
|
||||||
case WBEG: \
|
|
||||||
if (((sp != s || sp != _sp) && isword(sp)) \
|
|
||||||
|| !isword(_sp)) \
|
|
||||||
deccheck(nn) \
|
|
||||||
npc++; goto rec##nn; \
|
|
||||||
case WEND: \
|
|
||||||
if (isword(_sp)) \
|
|
||||||
deccheck(nn) \
|
|
||||||
npc++; goto rec##nn; \
|
|
||||||
case EOL: \
|
|
||||||
if (*_sp) \
|
|
||||||
deccheck(nn) \
|
|
||||||
npc++; goto rec##nn; \
|
|
||||||
inst##list(nn) \
|
|
||||||
} \
|
} \
|
||||||
deccheck(nn) \
|
end##list() \
|
||||||
|
continue; \
|
||||||
} \
|
} \
|
||||||
|
next##nn: \
|
||||||
|
if (spc == SPLIT) { \
|
||||||
|
on##list(nn) \
|
||||||
|
npc += 2; \
|
||||||
|
pcs[si] = npc + npc[-1]; \
|
||||||
|
fastrec(nn, list, listidx) \
|
||||||
|
} else if (spc == SAVE) { \
|
||||||
|
if (nsub->ref > 1) { \
|
||||||
|
nsub->ref--; \
|
||||||
|
save##list() \
|
||||||
|
nsub = s1; \
|
||||||
|
nsub->ref = 1; \
|
||||||
|
} \
|
||||||
|
nsub->sub[npc[1]] = _sp; \
|
||||||
|
npc += 2; \
|
||||||
|
goto rec##nn; \
|
||||||
|
} else if (spc == WBEG) { \
|
||||||
|
if (((sp != s || sp != _sp) && isword(sp)) \
|
||||||
|
|| !isword(_sp)) \
|
||||||
|
deccheck(nn) \
|
||||||
|
npc++; goto rec##nn; \
|
||||||
|
} else if (spc == RSPLIT) { \
|
||||||
|
on##list(nn) \
|
||||||
|
npc += 2; \
|
||||||
|
pcs[si] = npc; \
|
||||||
|
npc += npc[-1]; \
|
||||||
|
fastrec(nn, list, listidx) \
|
||||||
|
} else if (spc == WEND) { \
|
||||||
|
if (isword(_sp)) \
|
||||||
|
deccheck(nn) \
|
||||||
|
npc++; goto rec##nn; \
|
||||||
|
} else if (spc == EOL) { \
|
||||||
|
if (*_sp) \
|
||||||
|
deccheck(nn) \
|
||||||
|
npc++; goto rec##nn; \
|
||||||
|
} inst##list(nn) \
|
||||||
|
deccheck(nn) \
|
||||||
|
|
||||||
int re_pikevm(rcode *prog, const char *s, const char **subp, int nsubp)
|
int re_pikevm(rcode *prog, const char *s, const char **subp, int nsubp)
|
||||||
{
|
{
|
||||||
int rsubsize = sizeof(rsub)+(sizeof(char*)*nsubp);
|
int rsubsize = sizeof(rsub)+(sizeof(char*)*nsubp);
|
||||||
int i, j, c, suboff = rsubsize, *npc, osubp = nsubp * sizeof(char*);
|
int si, i, j, c, suboff = rsubsize, *npc, osubp = nsubp * sizeof(char*);
|
||||||
int clistidx = 0, nlistidx, plistidx;
|
int clistidx = 0, nlistidx, plistidx, spc;
|
||||||
const char *sp = s, *_sp = s, *nmatch = NULL;
|
const char *sp = s, *_sp = s, *nmatch = NULL;
|
||||||
int *insts = prog->insts;
|
int *insts = prog->insts;
|
||||||
int *pcs[prog->splits], *plist[prog->splits];
|
int *pcs[prog->splits], *plist[prog->splits];
|
||||||
|
|||||||
Reference in New Issue
Block a user