Exemplo n.º 1
0
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;
}
Exemplo n.º 2
0
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;
}
Exemplo n.º 3
0
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;
}
Exemplo n.º 4
0
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;
}
Exemplo n.º 5
0
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;
	}
}