mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-17 22:50:51 +00:00
Added support for execution stacks, misc. cleanups.
This commit is contained in:
parent
439f9838d3
commit
4e85063b52
2 changed files with 29 additions and 2 deletions
|
@ -73,7 +73,7 @@ cbuf_t * Cbuf_New (
|
|||
void (*construct) (struct cbuf_s *cbuf),
|
||||
void (*destruct) (struct cbuf_s *cbuf)
|
||||
);
|
||||
void CBuf_Delete (cbuf_t *cbuf);
|
||||
void Cbuf_Delete (cbuf_t *cbuf);
|
||||
void Cbuf_AddText (cbuf_t *cbuf, const char *text);
|
||||
void Cbuf_InsertText (cbuf_t *cbuf, const char *text);
|
||||
void Cbuf_Execute (cbuf_t *cbuf);
|
||||
|
|
|
@ -111,7 +111,7 @@ Cbuf_New (
|
|||
}
|
||||
|
||||
void
|
||||
CBuf_Delete (cbuf_t *cbuf)
|
||||
Cbuf_Delete (cbuf_t *cbuf)
|
||||
{
|
||||
if (!cbuf)
|
||||
return;
|
||||
|
@ -142,6 +142,7 @@ Cbuf_Execute (cbuf_t *cbuf)
|
|||
cbuf_args_t *args = cbuf->args;
|
||||
|
||||
cbuf_active = cbuf;
|
||||
cbuf->state = CBUF_STATE_NORMAL;
|
||||
while (cbuf->buf->str[0]) {
|
||||
cbuf->extract_line (cbuf);
|
||||
if (cbuf->state)
|
||||
|
@ -157,6 +158,32 @@ Cbuf_Execute (cbuf_t *cbuf)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
Cbuf_Execute_Stack (cbuf_t *cbuf)
|
||||
{
|
||||
cbuf_t *sp;
|
||||
|
||||
for (sp = cbuf; sp->down; sp = sp->down);
|
||||
while (sp) {
|
||||
Cbuf_Execute (sp);
|
||||
if (sp->state) {
|
||||
if (sp->state == CBUF_STATE_STACK) {
|
||||
sp = sp->down;
|
||||
continue;
|
||||
} else if (sp->state == CBUF_STATE_ERROR)
|
||||
break;
|
||||
else
|
||||
return;
|
||||
}
|
||||
sp = sp->up;
|
||||
}
|
||||
dstring_clearstr (cbuf->buf);
|
||||
for (cbuf = cbuf->down; cbuf; cbuf = sp) { // Reduce, reuse, recycle
|
||||
sp = cbuf->down;
|
||||
Cbuf_Delete (cbuf);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Cbuf_Execute_Sets (cbuf_t *cbuf)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue