9. Exec

<<funcdefs>>=
int bitlang_exec(bitlang *vm, bitlang_state *st);
<<funcs>>=
int bitlang_exec(bitlang *vm, bitlang_state *st)
{
    int pos;
    int sz;
    char *bytes;
    int rc;

    pos = 0;
    rc = 0;

    sz = st->sz;
    bytes = st->bytes;

    while (pos < sz) {
        char c;

        c = bytes[pos];

        if (c & 0x80) {
            rc = bitlang_push(vm, c & 0x7f);
            if (rc) return rc;
            pos++;
            continue;
        }

        switch(c) {
<<ops>>
            default:
                pos++;
                break;
        }
    }
    return 0;
}



prev | home | next