Esempio n. 1
0
static void
identstmt(void)
{
	struct iobuf *ob = NULL;
	struct symtab *sp;
	usch *bp;
	int ch;

	if (ISID0(ch = fastspc())) {
		bp = readid(ch);
		if ((sp = lookup(bp, FIND)))
			ob = kfind(sp);
		if (ob->buf[0] != '\"')
			goto bad;
		if (ob)
			bufree(ob);
	} else if (ch == '\"') {
		bufree(faststr(ch, NULL));
		
	} else
		goto bad;
	chknl(1);
	return;
bad:
	error("bad #ident directive");
}
Esempio n. 2
0
File: token.c Progetto: pauley/pcc
static void
undefstmt(void)
{
	struct symtab *np;

	if (sloscan() != WSPACE || sloscan() != IDENT)
		error("bad undef");
	if (flslvl == 0 && (np = lookup((usch *)yytext, FIND)))
		np->value = 0;
	chknl(0);
}
Esempio n. 3
0
File: token.c Progetto: Sciumo/pcc
static void
undefstmt(void)
{
	struct symtab *np;

	if (flslvl)
		return;
	if (sloscan() != WSPACE || sloscan() != IDENT)
		error("bad #undef");
	if ((np = lookup(yytext, FIND)) != NULL)
		np->value = 0;
	chknl(0);
}
Esempio n. 4
0
File: token.c Progetto: Sciumo/pcc
static void
endifstmt(void)		 
{
	if (flslvl)
		flslvl--;
	else if (trulvl)
		trulvl--;
	else
		error("#endif in non-conditional section");
	if (flslvl == 0)
		elflvl = 0;
	elslvl = 0;
	chknl(1);
}
Esempio n. 5
0
static void
undefstmt(void)
{
	struct symtab *np;
	usch *bp;
	int ch;

	if (!ISID0(ch = fastspc()))
		error("bad #undef");
	bp = readid(ch);
	if ((np = lookup(bp, FIND)) != NULL)
		np->valoff = 0;
	chknl(0);
}
Esempio n. 6
0
static void
ifndefstmt(void)
{
	usch *bp;
	int ch;

	if (!ISID0(ch = fastspc()))
		error("bad #ifndef");
	bp = readid(ch);
	if (lookup(bp, FIND) != NULL)
		flslvl++;
	else
		trulvl++;
	chknl(0);
}
Esempio n. 7
0
File: token.c Progetto: pauley/pcc
static void
endifstmt(void)		 
{
	if (flslvl) {
		flslvl--;
		if (flslvl == 0) {
			putch('\n');
			prtline();
		}
	} else if (trulvl)
		trulvl--;
	else
		error("If-less endif");
	if (flslvl == 0)
		elflvl = 0;
	elslvl = 0;
	chknl(1);
}
Esempio n. 8
0
File: token.c Progetto: Sciumo/pcc
static void
elsestmt(void)
{
	if (flslvl) {
		if (elflvl > trulvl)
			;
		else if (--flslvl!=0)
			flslvl++;
		else
			trulvl++;
	} else if (trulvl) {
		flslvl++;
		trulvl--;
	} else
		error("#else in non-conditional section");
	if (elslvl==trulvl+flslvl)
		error("too many #else");
	elslvl=trulvl+flslvl;
	chknl(1);
}
Esempio n. 9
0
File: token.c Progetto: Sciumo/pcc
static void
ifndefstmt(void)	  
{ 
	int t;

	if (flslvl) {
		flslvl++;
		skpln();
		return;
	}
	do
		t = sloscan();
	while (t == WSPACE);
	if (t != IDENT)
		error("bad #ifndef");
	if (lookup(yytext, FIND) != NULL)
		flslvl++;
	else
		trulvl++;
	chknl(0);
}
Esempio n. 10
0
static void
ifdefstmt(void)
{
	int t;

	if (flslvl) {
		flslvl++;
		while ((t = sloscan()) && t != '\n')
			;
		return;
	}
	while ((t = sloscan()) == WSPACE)
		;
	if (t != IDENT)
		error("bad #ifdef");
	if (lookup(yytext, FIND) == NULL)
		flslvl++;
	else
		trulvl++;
	chknl(0);
}
Esempio n. 11
0
File: token.c Progetto: pauley/pcc
static void
ifndefstmt(void)	  
{ 
	int t;

	if (flslvl) {
		skpln();
		return;
	}
	do
		t = sloscan();
	while (t == WSPACE);
	if (t != IDENT)
		error("bad ifndef");
	if (lookup((usch *)yytext, FIND) != 0) {
		putch('\n');
		flslvl++;
	} else
		trulvl++;
	chknl(0);
}
Esempio n. 12
0
File: token.c Progetto: pauley/pcc
static void
elsestmt(void)
{
	if (flslvl) {
		if (elflvl > trulvl)
			;
		else if (--flslvl!=0) {
			flslvl++;
		} else {
			trulvl++;
			prtline();
		}
	} else if (trulvl) {
		flslvl++;
		trulvl--;
	} else
		error("If-less else");
	if (elslvl==trulvl+flslvl)
		error("Too many else");
	elslvl=trulvl+flslvl;
	chknl(1);
}