NList* mkNList(uint32_t n, NList *next) { NList *nl; nl = binalloc(&parseBin, sizeof(NList), 0); if(nl == nil) parseErr("out of memory"); nl->n = n; nl->next = next; return nl; }
Fetch * mkFetch(int op, Fetch *next) { Fetch *f; f = binalloc(&parseBin, sizeof(Fetch), 1); if(f == nil) parseErr("out of memory"); f->op = op; f->next = next; return f; }
SList* mkSList(char *s, SList *next) { SList *sl; sl = binalloc(&parseBin, sizeof(SList), 0); if(sl == nil) parseErr("out of memory"); sl->s = s; sl->next = next; return sl; }
Store * mkStore(int sign, int op, int flags) { Store *st; st = binalloc(&parseBin, sizeof(Store), 1); if(st == nil) parseErr("out of memory"); st->sign = sign; st->op = op; st->flags = flags; return st; }
void splitr(char *s, int c, char **left, char **right) { char *d; int n; n = strlen(s); d = binalloc(&parseBin, n + 1, 0); if(d == nil) parseErr("out of memory"); strcpy(d, s); s = strrchr(d, c); if(s != nil){ *left = d; *s++ = '\0'; *right = s; }else{ *right = d; *left = d + n; } }