Fix style atrocities in sc1.c.

This commit is contained in:
David Anderson 2014-08-03 18:53:58 -07:00
parent 836cde4e21
commit 09edda93ad

View File

@ -4237,15 +4237,11 @@ static void dofuncenum(int listmode)
/* This tag can't already exist! */ /* This tag can't already exist! */
cur=tagname_tab.next; cur=tagname_tab.next;
while (cur) while (cur) {
{ if (strcmp(cur->name, str) == 0) {
if (strcmp(cur->name, str) == 0)
{
/* Another bad one... */ /* Another bad one... */
if (!(cur->value & FUNCTAG)) if (!(cur->value & FUNCTAG))
{
error(94); error(94);
}
break; break;
} }
cur = cur->next; cur = cur->next;
@ -4255,21 +4251,16 @@ static void dofuncenum(int listmode)
fenum = funcenums_add(tagname); fenum = funcenums_add(tagname);
if (listmode) if (listmode)
{
needtoken('{'); needtoken('{');
} do {
do
{
functag_t func; functag_t func;
if (listmode && matchtoken('}')) if (listmode && matchtoken('}')) {
{
/* Quick exit */ /* Quick exit */
lexpush(); lexpush();
break; break;
} }
memset(&func, 0, sizeof(func)); memset(&func, 0, sizeof(func));
if (!isNewStyle) if (!isNewStyle) {
{
func.ret_tag = pc_addtag(NULL); /* Get the return tag */ func.ret_tag = pc_addtag(NULL); /* Get the return tag */
l = lex(&val, &str); l = lex(&val, &str);
/* :TODO: /* :TODO:
@ -4289,83 +4280,47 @@ static void dofuncenum(int listmode)
} else { } else {
error(1, "-public-", str); error(1, "-public-", str);
} }
} } else {
else
{
func.ret_tag = newStyleTag; func.ret_tag = newStyleTag;
func.type = uPUBLIC; func.type = uPUBLIC;
} }
needtoken('('); needtoken('(');
do do {
{
funcarg_t *arg = &(func.args[func.argcount]); funcarg_t *arg = &(func.args[func.argcount]);
/* Quick exit */ /* Quick exit */
if (matchtoken(')')) if (matchtoken(')')) {
{
lexpush(); lexpush();
break; break;
} }
l = lex(&val, &str); l = lex(&val, &str);
if (l == '&') if (l == '&') {
{
if ((arg->ident != iVARIABLE && arg->ident != 0) || arg->tagcount > 0) if ((arg->ident != iVARIABLE && arg->ident != 0) || arg->tagcount > 0)
{
error(1, "-identifier-", "&"); error(1, "-identifier-", "&");
}
arg->ident = iREFERENCE; arg->ident = iREFERENCE;
} else if (l == tCONST) { } else if (l == tCONST) {
if ((arg->ident != iVARIABLE && arg->ident != 0) || arg->tagcount > 0) if ((arg->ident != iVARIABLE && arg->ident != 0) || arg->tagcount > 0)
{
error(1, "-identifier-", "const"); error(1, "-identifier-", "const");
}
arg->fconst=TRUE; arg->fconst=TRUE;
} else if (l == tLABEL) { } else if (l == tLABEL) {
if (arg->tagcount > 0) if (arg->tagcount > 0)
{
error(1, "-identifier-", "-tagname-"); error(1, "-identifier-", "-tagname-");
}
arg->tags[arg->tagcount++] = pc_addtag(str); arg->tags[arg->tagcount++] = pc_addtag(str);
#if 0
while (arg->tagcount < sTAGS_MAX)
{
if (!matchtoken('_') && !needtoken(tSYMBOL))
{
break;
}
tokeninfo(&val, &ptr);
arg->tags[arg->tagcount++] = pc_addtag(ptr);
if (matchtoken('}'))
{
break;
}
needtoken(',');
}
needtoken(':');
#endif
l=tLABEL; l=tLABEL;
} else if (l == tSYMBOL) { } else if (l == tSYMBOL) {
if (func.argcount >= sARGS_MAX) if (func.argcount >= sARGS_MAX)
{
error(45); error(45);
}
if (str[0] == PUBLIC_CHAR) if (str[0] == PUBLIC_CHAR)
{
error(56, str); error(56, str);
}
if (matchtoken('[')) if (matchtoken('['))
{ {
cell size; cell size;
if (arg->ident == iREFERENCE) if (arg->ident == iREFERENCE)
{
error(67, str); error(67, str);
} do {
do
{
constvalue *enumroot; constvalue *enumroot;
int ignore_tag; int ignore_tag;
if (arg->dimcount == sDIMEN_MAX) if (arg->dimcount == sDIMEN_MAX) {
{
error(53); error(53);
break; break;
} }
@ -4384,8 +4339,7 @@ static void dofuncenum(int listmode)
arg->ident = iVARIABLE; arg->ident = iVARIABLE;
} }
if (matchtoken('=')) if (matchtoken('=')) {
{
needtoken('0'); needtoken('0');
arg->ommittable = TRUE; arg->ommittable = TRUE;
func.ommittable = TRUE; func.ommittable = TRUE;
@ -4395,9 +4349,7 @@ static void dofuncenum(int listmode)
func.argcount++; func.argcount++;
} else if (l == tELLIPS) { } else if (l == tELLIPS) {
if (arg->ident == iVARIABLE) if (arg->ident == iVARIABLE)
{
error(10); error(10);
}
arg->ident = iVARARGS; arg->ident = iVARARGS;
func.argcount++; func.argcount++;
} else { } else {
@ -4405,24 +4357,18 @@ static void dofuncenum(int listmode)
} }
} while (l == '&' || l == tLABEL || l == tCONST || (l != tELLIPS && matchtoken(','))); } while (l == '&' || l == tLABEL || l == tCONST || (l != tELLIPS && matchtoken(',')));
needtoken(')'); needtoken(')');
for (i=0; i<func.argcount; i++) for (i=0; i<func.argcount; i++) {
{ if (func.args[i].tagcount == 0) {
if (func.args[i].tagcount == 0)
{
func.args[i].tags[0] = 0; func.args[i].tags[0] = 0;
func.args[i].tagcount = 1; func.args[i].tagcount = 1;
} }
} }
functags_add(fenum, &func); functags_add(fenum, &func);
if (!listmode) if (!listmode)
{
break; break;
}
} while (matchtoken(',')); } while (matchtoken(','));
if (listmode) if (listmode)
{
needtoken('}'); needtoken('}');
}
matchtoken(';'); /* eat an optional semicolon. nom nom nom */ matchtoken(';'); /* eat an optional semicolon. nom nom nom */
errorset(sRESET, 0); errorset(sRESET, 0);
} }