4. State
<<bitlang_state_struct>>=
struct bitlang_state {
char *bytes;
int sz;
int len;
};
<<funcdefs>>=
void bitlang_state_init(bitlang_state *st, char *b, int sz);
<<funcs>>=
void bitlang_state_init(bitlang_state *st, char *b, int sz)
{
int i;
st->bytes = b;
st->sz = sz;
st->len = 0;
for (i = 0; i < sz; i++) {
st->bytes[i] = 0;
}
}
prev | home | next