From b9748cbe0e8343a327e4155262fa3db8f312db53 Mon Sep 17 00:00:00 2001 From: Peter De Wachter Date: Sat, 23 Jan 2016 19:16:21 +0100 Subject: [PATCH] Use the right member of union arguments so that everything typechecks --- builtInFunctions.c | 4 ++-- debugPrintSD_6502.c | 24 ++++++++++++------------ encode.c | 8 ++++---- operandStuffSD_6502.c | 20 ++++++++++---------- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/builtInFunctions.c b/builtInFunctions.c index bc24f92..da15088 100644 --- a/builtInFunctions.c +++ b/builtInFunctions.c @@ -948,9 +948,9 @@ symbolDefineBIF(parameterList, kindOfFixup) return(makeFailureValue()); } else { syntheticDefineStatement = buildDefineStatement(stringValue-> - value, parameterList->theOperand); + value, parameterList->theOperand.expressionUnion); } - assembleDefineStatement(syntheticDefineStatement->statementBody); + assembleDefineStatement(syntheticDefineStatement->statementBody.defineUnion); freeStatement(syntheticDefineStatement); return(makeBooleanValue(TRUE)); } diff --git a/debugPrintSD_6502.c b/debugPrintSD_6502.c index c4da64d..d6b8cd1 100644 --- a/debugPrintSD_6502.c +++ b/debugPrintSD_6502.c @@ -204,15 +204,15 @@ printOperand(operand) switch (operand->kindOfOperand) { case EXPRESSION_OPND: - printExpression(operand->theOperand); + printExpression(operand->theOperand.expressionUnion); break; case IMMEDIATE_OPND: - printExpression(operand->theOperand); + printExpression(operand->theOperand.immediateUnion); break; case INDIRECT_OPND: - printExpression(operand->theOperand); + printExpression(operand->theOperand.indirectUnion); break; case A_REGISTER_OPND: @@ -225,39 +225,39 @@ printOperand(operand) break; case POST_INDEXED_Y_OPND: - printExpression(operand->theOperand); + printExpression(operand->theOperand.postIndexedYUnion); break; case PRE_INDEXED_X_OPND: - printExpression(operand->theOperand); + printExpression(operand->theOperand.preIndexedXUnion); break; case X_INDEXED_OPND: - printExpression(operand->theOperand); + printExpression(operand->theOperand.xIndexedUnion); break; case Y_INDEXED_OPND: - printExpression(operand->theOperand); + printExpression(operand->theOperand.yIndexedUnion); break; case X_SELECTED_OPND: - printIdentifierList(operand->theOperand); + printIdentifierList(operand->theOperand.xSelectedUnion); break; case Y_SELECTED_OPND: - printIdentifierList(operand->theOperand); + printIdentifierList(operand->theOperand.ySelectedUnion); break; case PRE_SELECTED_X_OPND: - printIdentifierList(operand->theOperand); + printIdentifierList(operand->theOperand.preSelectedUnion); break; case STRING_OPND: - tab(); printf("(string: \"%s\")\n", operand->theOperand); + tab(); printf("(string: \"%s\")\n", operand->theOperand.stringUnion); break; case BLOCK_OPND: - printBlock(operand->theOperand); + printBlock(operand->theOperand.blockUnion); break; default: diff --git a/encode.c b/encode.c index 6776dbe..06df4cf 100644 --- a/encode.c +++ b/encode.c @@ -279,7 +279,7 @@ encodeOperand(operand) case PRE_INDEXED_X_OPND: case X_INDEXED_OPND: case Y_INDEXED_OPND: - return(encodeExpression(operand->theOperand)); + return(encodeExpression(operand->theOperand.expressionUnion)); case A_REGISTER_OPND: case X_REGISTER_OPND: @@ -294,7 +294,7 @@ encodeOperand(operand) return(FALSE); case STRING_OPND: - return(encodeString(operand->theOperand)); + return(encodeString(operand->theOperand.stringUnion)); case BLOCK_OPND: error(BLOCK_OPERAND_IN_OBJECT_EXPRESSION_ERROR); @@ -534,7 +534,7 @@ encodeMifStatement(mifStatement) encodeByte(MIF_TAG) && encodeExpression(mifStatement->mifCondition) && encodeBlock(mifStatement->mifConsequence) && - encodeBlock(mifStatement->mifContinuation) + encodeBlock(mifStatement->mifContinuation.mifBlockUnion) ); } @@ -637,7 +637,7 @@ encodeStatement(statement) return(encodeFreturnStatement(statement->statementBody.freturnUnion)); case GROUP_STATEMENT: - return(encodeBlock(statement->statementBody)); + return(encodeBlock(statement->statementBody.groupUnion)); case MDEFINE_STATEMENT: return(encodeMdefineStatement(statement->statementBody.defineUnion)); diff --git a/operandStuffSD_6502.c b/operandStuffSD_6502.c index 13c8815..8f204dc 100644 --- a/operandStuffSD_6502.c +++ b/operandStuffSD_6502.c @@ -151,14 +151,14 @@ duplicateOperandForFixup(operand, isSpecialFunctionOperand) case X_INDEXED_OPND: case Y_INDEXED_OPND: result->theOperand.expressionUnion = - duplicateExpressionForFixup(operand->theOperand, + duplicateExpressionForFixup(operand->theOperand.expressionUnion, FALSE, isSpecialFunctionOperand); break; case X_SELECTED_OPND: case Y_SELECTED_OPND: case PRE_SELECTED_X_OPND: result->theOperand.expressionUnion = - duplicateExpressionForFixup(operand->theOperand, + duplicateExpressionForFixup(operand->theOperand.xSelectedUnion, FALSE, isSpecialFunctionOperand); break; case A_REGISTER_OPND: @@ -195,7 +195,7 @@ freeOperand(operand) case PRE_INDEXED_X_OPND: case X_INDEXED_OPND: case Y_INDEXED_OPND: - freeExpression(operand->theOperand); + freeExpression(operand->theOperand.expressionUnion); break; case A_REGISTER_OPND: @@ -206,15 +206,15 @@ freeOperand(operand) case X_SELECTED_OPND: case Y_SELECTED_OPND: case PRE_SELECTED_X_OPND: - freeSelectionList(operand->theOperand); + freeSelectionList(operand->theOperand.xSelectedUnion); break; case STRING_OPND: - freeString(operand->theOperand); + freeString(operand->theOperand.stringUnion); break; case BLOCK_OPND: - freeBlock(operand->theOperand); + freeBlock(operand->theOperand.blockUnion); break; default: @@ -302,7 +302,7 @@ evaluateOperand(operand) case PRE_INDEXED_X_OPND: case X_INDEXED_OPND: case Y_INDEXED_OPND: - result = evaluateExpression(operand->theOperand, + result = evaluateExpression(operand->theOperand.expressionUnion, performingFixups ? NO_FIXUP : OPERAND_FIXUP); if (operand->kindOfOperand != EXPRESSION_OPND) { if (result->addressMode != EXPRESSION_OPND) { @@ -324,7 +324,7 @@ evaluateOperand(operand) case X_SELECTED_OPND: case Y_SELECTED_OPND: case PRE_SELECTED_X_OPND: - result = evaluateSelectionList(operand->theOperand); + result = evaluateSelectionList(operand->theOperand.xSelectedUnion); if (result->addressMode != EXPRESSION_OPND) { error(BAD_ADDRESS_MODE_ERROR); result->kindOfValue = FAIL; @@ -334,7 +334,7 @@ evaluateOperand(operand) break; case STRING_OPND: - result = newValue(STRING_VALUE, operand->theOperand, + result = newValue(STRING_VALUE, operand->theOperand.stringUnion, STRING_OPND); break; @@ -342,7 +342,7 @@ evaluateOperand(operand) if (standaloneExpansionFlag) forceExpansion(); sideEffectFlag = TRUE; - assembleBlock(operand->theOperand); + assembleBlock(operand->theOperand.blockUnion); expansionOn(); result = newValue(FAIL, 0, BLOCK_OPND); break;