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