More indentation, spacing, and style fixes in sc1.c.

This commit is contained in:
David Anderson 2014-07-20 11:50:57 -07:00
parent 16177e9ecc
commit 8aa28e2c8d

View File

@ -2922,9 +2922,7 @@ static void declstruct(void)
/* get the explicit tag (required!) */ /* get the explicit tag (required!) */
tok = lex(&val,&str); tok = lex(&val,&str);
if (tok != tSYMBOL) if (tok != tSYMBOL)
{
error(93); error(93);
}
check_struct_name(str); check_struct_name(str);
@ -2936,52 +2934,41 @@ static void declstruct(void)
pc_addtag_flags(pstruct->name, flags); pc_addtag_flags(pstruct->name, flags);
needtoken('{'); needtoken('{');
do do {
{
structarg_t arg; structarg_t arg;
if (matchtoken('}')) if (matchtoken('}')) {
{
/* Quick exit */ /* Quick exit */
lexpush(); lexpush();
break; break;
} }
memset(&arg, 0, sizeof(structarg_t)); memset(&arg, 0, sizeof(structarg_t));
tok = lex(&val,&str); tok = lex(&val,&str);
if (tok == tCONST) if (tok == tCONST) {
{
arg.fconst = 1; arg.fconst = 1;
tok = lex(&val,&str); tok = lex(&val,&str);
} }
arg.ident = 0; arg.ident = 0;
if (tok == '&') if (tok == '&') {
{
arg.ident = iREFERENCE; arg.ident = iREFERENCE;
tok = lex(&val,&str); tok = lex(&val,&str);
} }
if (tok == tLABEL) if (tok == tLABEL) {
{
arg.tag = pc_addtag(str); arg.tag = pc_addtag(str);
tok = lex(&val,&str); tok = lex(&val,&str);
} }
if (tok != tSYMBOL) if (tok != tSYMBOL) {
{
error(1, "-identifier-", str); error(1, "-identifier-", str);
continue; continue;
} }
strcpy(arg.name, str); strcpy(arg.name, str);
if (matchtoken('[')) if (matchtoken('[')) {
{
if (arg.ident == iREFERENCE) if (arg.ident == iREFERENCE)
{
error(67, arg.name); error(67, arg.name);
}
arg.ident = iARRAY; arg.ident = iARRAY;
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;
} }
@ -2990,20 +2977,14 @@ static void declstruct(void)
} while (matchtoken('[')); } while (matchtoken('['));
/* Handle strings */ /* Handle strings */
if (arg.tag == pc_tag_string && arg.dims[arg.dimcount-1]) if (arg.tag == pc_tag_string && arg.dims[arg.dimcount-1])
{
arg.dims[arg.dimcount-1] = (size + sizeof(cell)-1) / sizeof(cell); arg.dims[arg.dimcount-1] = (size + sizeof(cell)-1) / sizeof(cell);
}
if (arg.dimcount == 1 && !arg.dims[arg.dimcount-1]) if (arg.dimcount == 1 && !arg.dims[arg.dimcount-1])
{
arg.ident = iREFARRAY; arg.ident = iREFARRAY;
}
} else if (!arg.ident) { } else if (!arg.ident) {
arg.ident = iVARIABLE; arg.ident = iVARIABLE;
} }
if (pstructs_addarg(pstruct, &arg) == NULL) if (pstructs_addarg(pstruct, &arg) == NULL)
{
error(103, arg.name, layout_spec_name(Layout_PawnStruct)); error(103, arg.name, layout_spec_name(Layout_PawnStruct));
}
} while (matchtoken(',')); } while (matchtoken(','));
needtoken('}'); needtoken('}');
matchtoken(';'); /* eat up optional semicolon */ matchtoken(';'); /* eat up optional semicolon */