/*****************************************************************************/
/* */
-/* config.c */
+/* config.c */
/* */
/* Configuration file parsing for the sim65 6502 simulator */
/* */
/*****************************************************************************/
-/* Code */
+/* Code */
/*****************************************************************************/
*/
{
if (*Flags & Mask) {
- CfgError ("%s is already defined", Name);
+ CfgError ("%s is already defined", Name);
}
*Flags |= Mask;
}
/* Check that a mandatory attribute was given */
{
if ((Attr & Mask) == 0) {
- CfgError ("%s attribute is missing", Name);
+ CfgError ("%s attribute is missing", Name);
}
}
CfgData* D = NewCfgData ();
CfgNextTok ();
- /* An optional assignment follows */
- CfgOptionalAssign ();
+ /* An optional assignment follows */
+ CfgOptionalAssign ();
/* Check and assign the attribute value */
switch (CfgTok) {
/* Add the attribute to the location */
CollAppend (&L->Attributes, D);
- /* Skip the attribute value and an optional comma */
- CfgNextTok ();
- CfgOptionalComma ();
- }
+ /* Skip the attribute value and an optional comma */
+ CfgNextTok ();
+ CfgOptionalComma ();
+ }
- /* Skip the semicolon */
- CfgConsumeSemi ();
+ /* Skip the semicolon */
+ CfgConsumeSemi ();
}
/* Sort all memory locations */
/* Parse the config file */
{
static const IdentTok BlockNames [] = {
- { "ADDRSPACE", CFGTOK_ADDRSPACE },
- { "CPU", CFGTOK_CPU },
+ { "ADDRSPACE", CFGTOK_ADDRSPACE },
+ { "CPU", CFGTOK_CPU },
};
cfgtok_t BlockTok;
do {
- /* Read the block ident */
- CfgSpecialToken (BlockNames, ENTRY_COUNT (BlockNames), "Block identifier");
- BlockTok = CfgTok;
- CfgNextTok ();
+ /* Read the block ident */
+ CfgSpecialToken (BlockNames, ENTRY_COUNT (BlockNames), "Block identifier");
+ BlockTok = CfgTok;
+ CfgNextTok ();
- /* Expected a curly brace */
- CfgConsume (CFGTOK_LCURLY, "`{' expected");
+ /* Expected a curly brace */
+ CfgConsume (CFGTOK_LCURLY, "`{' expected");
- /* Read the block */
- switch (BlockTok) {
+ /* Read the block */
+ switch (BlockTok) {
case CFGTOK_ADDRSPACE:
ParseAddrSpace ();
ParseCPU ();
break;
- default:
- FAIL ("Unexpected block token");
+ default:
+ FAIL ("Unexpected block token");
- }
+ }
- /* Skip closing brace */
- CfgConsumeRCurly ();
+ /* Skip closing brace */
+ CfgConsumeRCurly ();
} while (CfgTok != CFGTOK_EOF);
}