From cbad3bfb156e4217968d2ef551f7e78984fb84a2 Mon Sep 17 00:00:00 2001 From: Michael Martin Date: Sat, 23 Jan 2016 03:51:29 -0800 Subject: [PATCH] Move Macross's local extern function references into ANSI C headers full of prototypes --- builtInFunctions.c | 97 +++++++++++++++++-------------------------- debugPrint.c | 7 +--- emitBranch.h | 16 +++++++ encode.c | 3 +- expressionSemantics.c | 52 +---------------------- expressionSemantics.h | 25 +++++++++++ lexer.c | 1 + listing.c | 24 ++++------- listing.h | 41 ++++++++++++++++++ macrossTypes.h | 5 +++ operandStuff.h | 21 ++++++++++ operandStuffSD_6502.c | 3 +- parserMisc.c | 23 ++++++---- parserMisc.h | 16 +++++++ semanticMisc.c | 5 ++- semanticMisc.h | 2 +- statementSemantics.c | 83 ++++-------------------------------- statementSemantics.h | 54 ++++++++++++++++++++++++ 18 files changed, 259 insertions(+), 219 deletions(-) create mode 100644 emitBranch.h create mode 100644 expressionSemantics.h create mode 100644 listing.h create mode 100644 operandStuff.h create mode 100644 parserMisc.h create mode 100644 statementSemantics.h diff --git a/builtInFunctions.c b/builtInFunctions.c index 4fdc6b4..c230cde 100644 --- a/builtInFunctions.c +++ b/builtInFunctions.c @@ -30,8 +30,13 @@ #include "macrossTypes.h" #include "macrossGlobals.h" +#include "expressionSemantics.h" +#include "operandStuff.h" +#include "semanticMisc.h" + #include + /* Helper routines to return values into the Macross expression evaluation environment @@ -41,7 +46,6 @@ makeBooleanValue(test) int test; { - valueType *newValue(); return(newValue(ABSOLUTE_VALUE, test!=0, EXPRESSION_OPND)); } @@ -49,7 +53,6 @@ makeBooleanValue(test) valueType * makeFailureValue() { - valueType *newValue(); return(newValue(FAIL, 0, EXPRESSION_OPND)); } @@ -58,7 +61,6 @@ makeFailureValue() makeIntegerValue(integer) int integer; { - valueType *newValue(); return(newValue(ABSOLUTE_VALUE, integer, EXPRESSION_OPND)); } @@ -67,7 +69,6 @@ makeIntegerValue(integer) makeOperandValue(operand) operandType *operand; { - valueType *newValue(); return(newValue(OPERAND_VALUE, operand, EXPRESSION_OPND)); } @@ -76,7 +77,6 @@ makeOperandValue(operand) makeStringValue(string) stringType *string; { - valueType *newValue(); return(newValue(STRING_VALUE, string, STRING_OPND)); } @@ -84,7 +84,6 @@ makeStringValue(string) valueType * makeUndefinedValue() { - valueType *newValue(); return(newValue(UNDEFINED_VALUE, 0, EXPRESSION_OPND)); } @@ -105,10 +104,9 @@ addressModeBIF(parameterList, kindOfFixup) { valueType *evaluatedParameter; - valueType *evaluateOperand(); if (parameterList != NULL) { - evaluatedParameter = evaluateOperand(parameterList, NO_FIXUP); + evaluatedParameter = evaluateOperand(parameterList); return(makeIntegerValue(evaluatedParameter->addressMode)); } else { return(makeIntegerValue(-1)); @@ -126,13 +124,12 @@ applyBIF(parameterList, kindOfFixup) macroTableEntryType *macroToCall; macroTableEntryType *lookupMacroName(); - valueType *evaluateOperand(); if (parameterList == NULL) { error(NO_ARGUMENTS_TO_BIF_ERROR, "apply"); return(makeFailureValue()); } - stringValue = evaluateOperand(parameterList, NO_FIXUP); + stringValue = evaluateOperand(parameterList); if (stringValue->kindOfValue != STRING_VALUE) { error(BIF_ARGUMENT_IS_NOT_A_STRING_ERROR, "apply"); return(makeFailureValue()); @@ -154,11 +151,10 @@ arrayLengthBIF(parameterList, kindOfFixup) fixupKindType kindOfFixup; { valueType *testObjectValue; - valueType *evaluateOperand(); if (parameterList == NULL) return(makeIntegerValue(0)); - testObjectValue = evaluateOperand(parameterList, NO_FIXUP_OK); + testObjectValue = evaluateOperand(parameterList); if (testObjectValue->kindOfValue == STRING_VALUE) { return(makeIntegerValue(strlen(testObjectValue->value))); } else if (testObjectValue->kindOfValue == ARRAY_VALUE) { @@ -201,11 +197,10 @@ atasciiBIF(parameterList, kindOfFixup) stringType *string; stringType *newString; - valueType *evaluateOperand(); if (parameterList == NULL) return(makeStringValue("")); - stringValue = evaluateOperand(parameterList, NO_FIXUP); + stringValue = evaluateOperand(parameterList); if (stringValue->kindOfValue != STRING_VALUE) { error(BIF_ARGUMENT_IS_NOT_A_STRING_ERROR, "atascii"); return(makeFailureValue()); @@ -232,16 +227,15 @@ atasciiColorBIF(parameterList, kindOfFixup) stringType *newString; byte testChar; - valueType *evaluateOperand(); if (parameterList == NULL) return(makeStringValue("")); - stringValue = evaluateOperand(parameterList, NO_FIXUP); + stringValue = evaluateOperand(parameterList); parameterList = parameterList->nextOperand; if (parameterList == NULL) { color = 0; } else { - colorValue = evaluateOperand(parameterList, NO_FIXUP); + colorValue = evaluateOperand(parameterList); if (colorValue->kindOfValue != ABSOLUTE_VALUE) { error(BAD_COLOR_ARGUMENT_TO_ATASCII_COLOR_ERROR); return(makeFailureValue()); @@ -314,10 +308,9 @@ isAbsoluteValueBIF(parameterList, kindOfFixup) { valueType *evaluatedParameter; - valueType *evaluateOperand(); if (parameterList != NULL) { - evaluatedParameter = evaluateOperand(parameterList, NO_FIXUP); + evaluatedParameter = evaluateOperand(parameterList); return(makeBooleanValue(evaluatedParameter->kindOfValue == ABSOLUTE_VALUE)); } else { @@ -333,10 +326,9 @@ isBlockBIF(parameterList, kindOfFixup) /* questionable */ { valueType *evaluatedParameter; - valueType *evaluateOperand(); if (parameterList != NULL) { - evaluatedParameter = evaluateOperand(parameterList, NO_FIXUP); + evaluatedParameter = evaluateOperand(parameterList); return(makeBooleanValue(evaluatedParameter->kindOfValue == BLOCK_VALUE)); } else { @@ -352,10 +344,9 @@ isBuiltInFunctionBIF(parameterList, kindOfFixup) { valueType *evaluatedParameter; - valueType *evaluateOperand(); if (parameterList != NULL) { - evaluatedParameter = evaluateOperand(parameterList, NO_FIXUP); + evaluatedParameter = evaluateOperand(parameterList); return(makeBooleanValue(evaluatedParameter->kindOfValue == BUILT_IN_FUNCTION_VALUE)); } else { @@ -371,10 +362,9 @@ isConditionCodeBIF(parameterList, kindOfFixup) { valueType *evaluatedParameter; - valueType *evaluateOperand(); if (parameterList != NULL) { - evaluatedParameter = evaluateOperand(parameterList, NO_FIXUP); + evaluatedParameter = evaluateOperand(parameterList); return(makeBooleanValue(evaluatedParameter->kindOfValue == CONDITION_VALUE)); } else { @@ -448,10 +438,9 @@ isFieldBIF(parameterList, kindOfFixup) { valueType *evaluatedParameter; - valueType *evaluateOperand(); if (parameterList != NULL) { - evaluatedParameter = evaluateOperand(parameterList, NO_FIXUP); + evaluatedParameter = evaluateOperand(parameterList); return(makeBooleanValue(evaluatedParameter->kindOfValue == FIELD_VALUE)); } else { @@ -467,10 +456,9 @@ isFunctionBIF(parameterList, kindOfFixup) { valueType *evaluatedParameter; - valueType *evaluateOperand(); if (parameterList != NULL) { - evaluatedParameter = evaluateOperand(parameterList, NO_FIXUP); + evaluatedParameter = evaluateOperand(parameterList); return(makeBooleanValue(evaluatedParameter->kindOfValue == FUNCTION_VALUE)); } else { @@ -486,10 +474,9 @@ isRelocatableValueBIF(parameterList, kindOfFixup) { valueType *evaluatedParameter; - valueType *evaluateOperand(); if (parameterList != NULL) { - evaluatedParameter = evaluateOperand(parameterList, NO_FIXUP); + evaluatedParameter = evaluateOperand(parameterList); return(makeBooleanValue(evaluatedParameter->kindOfValue == RELOCATABLE_VALUE || evaluatedParameter-> kindOfValue == DATA_VALUE)); @@ -506,10 +493,9 @@ isStringBIF(parameterList, kindOfFixup) { valueType *evaluatedParameter; - valueType *evaluateOperand(); if (parameterList != NULL) { - evaluatedParameter = evaluateOperand(parameterList, NO_FIXUP); + evaluatedParameter = evaluateOperand(parameterList); return(makeBooleanValue(evaluatedParameter->kindOfValue == STRING_VALUE)); } else { @@ -525,10 +511,9 @@ isStructBIF(parameterList, kindOfFixup) { valueType *evaluatedParameter; - valueType *evaluateOperand(); if (parameterList != NULL) { - evaluatedParameter = evaluateOperand(parameterList, NO_FIXUP); + evaluatedParameter = evaluateOperand(parameterList); return(makeBooleanValue(evaluatedParameter->kindOfValue == STRUCT_VALUE)); } else { @@ -604,7 +589,7 @@ makeArrayBIF(parameterList, kindOfFixup) error(NO_ARGUMENTS_TO_BIF_ERROR, "makeArray"); return(makeFailureValue()); } - lengthValue = evaluateOperand(parameterList, NO_FIXUP); + lengthValue = evaluateOperand(parameterList); if (lengthValue->kindOfValue != ABSOLUTE_VALUE) { error(BIF_NTH_ARGUMENT_IS_NOT_ABSOLUTE_VALUE_ERROR, "makeArray", 1); @@ -619,8 +604,7 @@ makeArrayBIF(parameterList, kindOfFixup) parameterList = parameterList->nextOperand; for (i=0; inextOperand; } else { arrayContents[i] = NULL; @@ -644,11 +628,10 @@ nthCharBIF(parameterList, kindOfFixup) valueType *stringValue; stringType *string; - valueType *evaluateOperand(); if (parameterList == NULL) return(makeFailureValue()); - stringValue = evaluateOperand(parameterList, NO_FIXUP); + stringValue = evaluateOperand(parameterList); if (stringValue->kindOfValue != STRING_VALUE) { error(BIF_ARGUMENT_IS_NOT_A_STRING_ERROR, "nthChar"); return(makeFailureValue()); @@ -657,7 +640,7 @@ nthCharBIF(parameterList, kindOfFixup) if (parameterList == NULL) { position = 0; } else { - positionValue = evaluateOperand(parameterList, NO_FIXUP); + positionValue = evaluateOperand(parameterList); if (positionValue->kindOfValue != ABSOLUTE_VALUE) { error(BAD_POSITION_ARGUMENT_TO_NTH_CHAR_ERROR); return(makeFailureValue()); @@ -685,11 +668,10 @@ printfBIF(parameterList, kindOfFixup) int argument[20]; valueType *result; - valueType *evaluateOperand(); result = makeFailureValue(); if (parameterList != NULL) { - stringValue = evaluateOperand(parameterList, NO_FIXUP); + stringValue = evaluateOperand(parameterList); if (stringValue->kindOfValue != STRING_VALUE) { error(PRINTF_FORMAT_IS_NOT_A_STRING_ERROR); return(result); @@ -699,7 +681,7 @@ printfBIF(parameterList, kindOfFixup) argumentCount = 0; while (parameterList != NULL && argumentCount < 20) { argument[argumentCount++] = evaluateOperand( - parameterList)->value; + parameterList)->value; parameterList = parameterList->nextOperand; } /* cretinous hack */ @@ -726,7 +708,7 @@ strcatBIF(parameterList, kindOfFixup) if (parameterList == NULL) return(makeStringValue("")); - stringValue = evaluateOperand(parameterList, NO_FIXUP); + stringValue = evaluateOperand(parameterList); if (stringValue->kindOfValue != STRING_VALUE) { error(BIF_NTH_ARGUMENT_IS_NOT_A_STRING_ERROR, "strcat", 1); return(makeFailureValue()); @@ -735,7 +717,7 @@ strcatBIF(parameterList, kindOfFixup) parameterList = parameterList->nextOperand; if (parameterList == NULL) return(makeStringValue(string1)); - stringValue = evaluateOperand(parameterList, NO_FIXUP); + stringValue = evaluateOperand(parameterList); if (stringValue->kindOfValue != STRING_VALUE) { error(BIF_NTH_ARGUMENT_IS_NOT_A_STRING_ERROR, "strcat", 2); return(makeFailureValue()); @@ -762,7 +744,7 @@ strcmpBIF(parameterList, kindOfFixup) error(NO_ARGUMENTS_TO_BIF_ERROR, "strcmp"); return(makeFailureValue()); } - stringValue = evaluateOperand(parameterList, NO_FIXUP); + stringValue = evaluateOperand(parameterList); if (stringValue->kindOfValue != STRING_VALUE) { error(BIF_NTH_ARGUMENT_IS_NOT_A_STRING_ERROR, "strcmp", 1); return(makeFailureValue()); @@ -771,7 +753,7 @@ strcmpBIF(parameterList, kindOfFixup) parameterList = parameterList->nextOperand; if (parameterList == NULL) return(makeStringValue(string1)); - stringValue = evaluateOperand(parameterList, NO_FIXUP); + stringValue = evaluateOperand(parameterList); if (stringValue->kindOfValue != STRING_VALUE) { error(BIF_NTH_ARGUMENT_IS_NOT_A_STRING_ERROR, "strcmp", 2); return(makeFailureValue()); @@ -795,7 +777,7 @@ strcmplcBIF(parameterList, kindOfFixup) error(NO_ARGUMENTS_TO_BIF_ERROR, "strcmplc"); return(makeFailureValue()); } - stringValue = evaluateOperand(parameterList, NO_FIXUP); + stringValue = evaluateOperand(parameterList); if (stringValue->kindOfValue != STRING_VALUE) { error(BIF_NTH_ARGUMENT_IS_NOT_A_STRING_ERROR, "strcmplc", 1); return(makeFailureValue()); @@ -804,7 +786,7 @@ strcmplcBIF(parameterList, kindOfFixup) parameterList = parameterList->nextOperand; if (parameterList == NULL) return(makeStringValue(string1)); - stringValue = evaluateOperand(parameterList, NO_FIXUP); + stringValue = evaluateOperand(parameterList); if (stringValue->kindOfValue != STRING_VALUE) { error(BIF_NTH_ARGUMENT_IS_NOT_A_STRING_ERROR, "strcmplc", 2); return(makeFailureValue()); @@ -823,7 +805,7 @@ strlenBIF(parameterList, kindOfFixup) if (parameterList == NULL) return(makeIntegerValue(-1)); - stringValue = evaluateOperand(parameterList, NO_FIXUP); + stringValue = evaluateOperand(parameterList); if (stringValue->kindOfValue != STRING_VALUE) { error(BIF_ARGUMENT_IS_NOT_A_STRING_ERROR, "strlen"); return(makeFailureValue()); @@ -851,7 +833,7 @@ substrBIF(parameterList, kindOfFixup) error(NO_ARGUMENTS_TO_BIF_ERROR, "substr"); return(makeFailureValue()); } - stringValue = evaluateOperand(parameterList, NO_FIXUP); + stringValue = evaluateOperand(parameterList); if (stringValue->kindOfValue != STRING_VALUE) { error(BIF_ARGUMENT_IS_NOT_A_STRING_ERROR, "substr"); return(makeFailureValue()); @@ -864,7 +846,7 @@ substrBIF(parameterList, kindOfFixup) error(TOO_FEW_ARGUMENTS_TO_BIF_ERROR, "substr"); return(makeFailureValue()); } - startValue = evaluateOperand(parameterList, NO_FIXUP); + startValue = evaluateOperand(parameterList); if (startValue->kindOfValue != ABSOLUTE_VALUE) { error(BIF_NTH_ARGUMENT_IS_NOT_ABSOLUTE_VALUE_ERROR, "substr", 2); @@ -883,7 +865,7 @@ substrBIF(parameterList, kindOfFixup) if (backwards) length = -length; } else { - lengthValue = evaluateOperand(parameterList, NO_FIXUP); + lengthValue = evaluateOperand(parameterList); if (lengthValue->kindOfValue != ABSOLUTE_VALUE) { error(BIF_NTH_ARGUMENT_IS_NOT_ABSOLUTE_VALUE_ERROR, "substr", 3); @@ -928,7 +910,7 @@ symbolLookupBIF(parameterList, kindOfFixup) error(NO_ARGUMENTS_TO_BIF_ERROR, "symbolLookup"); return(makeFailureValue()); } - stringValue = evaluateOperand(parameterList, NO_FIXUP); + stringValue = evaluateOperand(parameterList); if (stringValue->kindOfValue != STRING_VALUE) { error(BIF_ARGUMENT_IS_NOT_A_STRING_ERROR, "symbolLookup"); return(makeFailureValue()); @@ -952,7 +934,7 @@ symbolDefineBIF(parameterList, kindOfFixup) error(NO_ARGUMENTS_TO_BIF_ERROR, "symbolDefine"); return(makeFailureValue()); } - stringValue = evaluateOperand(parameterList, NO_FIXUP); + stringValue = evaluateOperand(parameterList); if (stringValue->kindOfValue != STRING_VALUE) { error(BIF_ARGUMENT_IS_NOT_A_STRING_ERROR, "symbolDefine"); return(makeFailureValue()); @@ -1042,10 +1024,9 @@ valueTypeBIF(parameterList, kindOfFixup) { valueType *evaluatedParameter; - valueType *evaluateOperand(); if (parameterList != NULL) { - evaluatedParameter = evaluateOperand(parameterList, NO_FIXUP); + evaluatedParameter = evaluateOperand(parameterList); return(makeIntegerValue(evaluatedParameter->kindOfValue)); } else { return(makeIntegerValue(-1)); diff --git a/debugPrint.c b/debugPrint.c index f44ce7e..01db367 100644 --- a/debugPrint.c +++ b/debugPrint.c @@ -32,6 +32,8 @@ #include "macrossGlobals.h" #include "y.tab.h" +void printExpression(expressionType *expression); + /* Print out the parse-tree. */ @@ -274,7 +276,6 @@ printArrayTerm(arrayTerm) arrayTermType *arrayTerm; { void printIdentifier(); - void printExpression(); nullPrint(arrayTerm); tab(); printf("(array\n"); @@ -289,7 +290,6 @@ printArrayTerm(arrayTerm) printAssignmentTerm(assignmentTerm) binopTermType *assignmentTerm; { - void printExpression(); nullPrint(assignmentTerm); tab(); printf("(assignment ["); @@ -307,7 +307,6 @@ printBinopTerm(binopTerm) binopTermType *binopTerm; { void printIdentifier(); - void printExpression(); nullPrint(binopTerm); tab(); printf("(binop ["); @@ -391,8 +390,6 @@ printPreopTerm(preopTerm) printUnopTerm(unopTerm) unopTermType *unopTerm; { - void printExpression(); - nullPrint(unopTerm); tab(); printf("(unop ["); printToken(unopTerm->unop); diff --git a/emitBranch.h b/emitBranch.h new file mode 100644 index 0000000..f53d9c0 --- /dev/null +++ b/emitBranch.h @@ -0,0 +1,16 @@ +#ifndef EMIT_BRANCH_H_ +#define EMIT_BRANCH_H_ + +#include "macrossTypes.h" + +#if TARGET_CPU == CPU_6502 +void emitRelativeBranch(conditionType condition, valueType *target, valueType fixupLocation[COMPOUND_BRANCH_MAX]); +#elif TARGET_CPU == CPU_68000 +void emitRelativeBranch(conditionType condition, valueType *target, valueType *fixupLocation); +#else +#error Missing or invalid TARGET_CPU +#endif + +simpleFixupListType *emitJump(valueType *target, simpleFixupListType *previousFixups); + +#endif diff --git a/encode.c b/encode.c index e57a792..6776dbe 100644 --- a/encode.c +++ b/encode.c @@ -31,6 +31,7 @@ #include "macrossTypes.h" #include "macrossGlobals.h" #include "y.tab.h" +#include "semanticMisc.h" #include "slinkyExpressions.h" #define nullEncode(thing) if (thing==NULL) return(TRUE); @@ -133,8 +134,6 @@ encodeFunctionCall(functionCall) symbolInContextType *workingContext; operandListType *parameterList; - symbolInContextType *getWorkingContext(); - nullEncode(functionCall); workingContext = getWorkingContext(functionCall->functionName); if (isFunction(workingContext)) { diff --git a/expressionSemantics.c b/expressionSemantics.c index 7f4bef1..0a640db 100644 --- a/expressionSemantics.c +++ b/expressionSemantics.c @@ -31,6 +31,8 @@ #include "macrossTypes.h" #include "macrossGlobals.h" #include "y.tab.h" +#include "expressionSemantics.h" +#include "semanticMisc.h" operandType *dbOperand; /* safe temps for dbx hacking */ expressionType *dbExpression; @@ -71,8 +73,6 @@ arrayLookup(arrayTerm, kindOfThing) int index; stringType *string; - valueType *evaluateExpression(); - *kindOfThing = FAIL; arrayValue = evaluateExpression(arrayTerm->arrayName, NO_FIXUP); if (arrayValue->kindOfValue == FAIL) @@ -133,9 +133,6 @@ evaluateArrayTerm(arrayTerm) environmentType *saveEnvironment; bool saveExpansion; - valueType *newValue(); - valueType *evaluateOperand(); - expansionOff(); resultThing = arrayLookup(arrayTerm, &kindOfResult); expansionOn(); @@ -187,15 +184,6 @@ evaluateAssignmentTerm(assignmentTerm, kindOfFixup) char *charPtr; char objectChar; - symbolTableEntryType *effectiveSymbol(); - valueType *evaluateExpressionInternally(); - valueKindType addValueKind(); - valueKindType selectValueKind(); - valueKindType subValueKind(); - valueKindType opValueKind(); - valueType *makeUndefinedValue(); - valueType *newValue(); - nullEvaluate(assignmentTerm); sideEffectFlag = TRUE; stringAssign = FALSE; @@ -386,11 +374,6 @@ evaluateBinopTerm(binopTerm, isTopLevel, kindOfFixup) operandKindType resultAddressMode; valueType *result; - symbolInContextType *getWorkingContext(); - valueType *evaluateExpressionInternally(); - valueType *newValue(); - valueType *makeUndefinedValue(); - nullEvaluate(binopTerm); if (binopTerm->binop != SUB && binopTerm->binop != ADD) isTopLevel = FALSE; @@ -598,8 +581,6 @@ evaluateBinopTerm(binopTerm, isTopLevel, kindOfFixup) evaluateCondition(condition) conditionType condition; { - valueType *newValue(); - expand(moreExpression("%s", conditionString(condition))); return(newValue(CONDITION_VALUE, condition, EXPRESSION_OPND)); } @@ -633,10 +614,6 @@ evaluateFunctionCall(functionCall, kindOfFixup, isStandalone) valueType *result; bool saveExpansion; - symbolInContextType *getWorkingContext(); - valueType *evaluateBuiltInFunctionCall(); - valueType *newValue(); - nullEvaluate(functionCall); sideEffectFlag = TRUE; pushEnvironment(newEnvironment); @@ -705,7 +682,6 @@ evaluateFunctionCall(functionCall, kindOfFixup, isStandalone) valueType * evaluateHere() { - valueType *newValue(); valueType *result; expand(moreExpression("here")); @@ -727,11 +703,6 @@ evaluateIdentifier(identifier, isTopLevel, kindOfFixup) environmentType *saveEnvironment; bool saveExpansion; - valueType *newValue(); - valueType *evaluateOperand(); - symbolInContextType *getWorkingContext(); - symbolTableEntryType *generateLocalLabel(); - nullEvaluate(identifier); identifier->referenceCount++; if (symbName(identifier)[0] == '$') @@ -851,8 +822,6 @@ evaluateIdentifier(identifier, isTopLevel, kindOfFixup) evaluateNumber(number) numberTermType number; { - valueType *newValue(); - expand(moreExpression("0x%x", number)); return(newValue(ABSOLUTE_VALUE, number, EXPRESSION_OPND)); } @@ -868,9 +837,6 @@ evaluatePostopTerm(postopTerm) symbolInContextType *workingContext; symbolTableEntryType *targetSymbol; - symbolTableEntryType *effectiveSymbol(); - symbolInContextType *getWorkingContext(); - nullEvaluate(postopTerm); sideEffectFlag = TRUE; if (postopTerm->postOpArgument->kindOfTerm == IDENTIFIER_EXPR) { @@ -939,9 +905,6 @@ evaluatePreopTerm(preopTerm) symbolInContextType *workingContext; symbolTableEntryType *targetSymbol; - symbolTableEntryType *effectiveSymbol(); - symbolInContextType *getWorkingContext(); - nullEvaluate(preopTerm); sideEffectFlag = TRUE; if (preopTerm->preOpArgument->kindOfTerm == IDENTIFIER_EXPR) { @@ -1003,7 +966,6 @@ evaluatePreopTerm(preopTerm) evaluateString(string) stringType *string; { - valueType *newValue(); stringType *newString; expand(moreExpression("\"%s\"", string)); @@ -1023,11 +985,6 @@ evaluateUnopTerm(unopTerm, kindOfFixup) operandKindType resultAddressMode; valueType *result; - valueKindType unopValueKind(); - valueType *newValue(); - valueType *evaluateExpressionInternally(); - valueType *makeUndefinedValue(); - nullEvaluate(unopTerm); expand(moreExpression("%s", tokenString(unopTerm->unop))); theOperand = evaluateExpressionInternally(unopTerm->unopArgument, @@ -1213,10 +1170,6 @@ evaluateExpressionStandalone(expression) evaluateDefineExpression(expression) expressionType *expression; { - valueType *newValue(); - expressionType *generateFixupExpression(); - operandType *buildOperand(); - nullEvaluate(expression); return(newValue(OPERAND_VALUE, buildOperand(EXPRESSION_OPND, generateFixupExpression(expression)), EXPRESSION_OPND)); @@ -1227,7 +1180,6 @@ evaluateSelectionList(selectionList) selectionListType *selectionList; { int offset; - valueType *newValue(); offset = 0; while (selectionList != NULL) { diff --git a/expressionSemantics.h b/expressionSemantics.h new file mode 100644 index 0000000..e6b004f --- /dev/null +++ b/expressionSemantics.h @@ -0,0 +1,25 @@ +#ifndef EXPRESSION_SEMANTICS_H_ +#define EXPRESSION_SEMANTICS_H_ +#include "macrossTypes.h" + +anyOldThing *arrayLookup(arrayTermType *arrayTerm, valueKindType *kindOfThing); +valueType *evaluateArrayTerm(arrayTermType *arrayTerm); +valueType *evaluateAssignmentTerm(binopTermType *assignmentTerm, fixupKindType kindOfFixup); +valueType *evaluateBinopTerm(binopTermType *assignmentTerm, bool isTopLevel, fixupKindType kindOfFixup); +valueType *evaluateCondition(conditionType condition); +valueType *evaluateBuiltInFunctionCall(symbolInContextType *workingContext, operandListType *parameters, fixupKindType kindOfFixup); +valueType *evaluateFunctionCall(functionCallTermType *functionCall, fixupKindType kindOfFixup, bool isStandalone); +valueType *evaluateHere(); +valueType *evaluateIdentifier(symbolTableEntryType *identifier, bool isTopLevel, fixupKindType kindOfFixup); +valueType *evaluateNumber(numberTermType number); +valueType *evaluatePostopTerm(postOpTermType *postopTerm); +valueType *evaluatePreopTerm(preOpTermType *preopTerm); +valueType *evaluateString(stringType *string); +valueType *evaluateUnopTerm(unopTermType* unopTerm, fixupKindType kindOfFixup); +valueType *evaluateExpressionInternally(expressionType *expression, bool isToplevel, fixupKindType kindOfFixup, bool isStandalone); +valueType *evaluateExpression(expressionType *expression, fixupKindType kindOfFixup); +void evaluateExpressionStandalone(expressionType *expression); +valueType *evaluateDefineExpression(expressionType *expression); +valueType *evaluateSelectionList(selectionListType *selectionList); + +#endif diff --git a/lexer.c b/lexer.c index 5fd7807..a49c84d 100644 --- a/lexer.c +++ b/lexer.c @@ -31,6 +31,7 @@ #include "macrossGlobals.h" #include "y.tab.h" #include "lexerTables.h" +#include "parserMisc.h" extern int yylval; extern int yydebug; diff --git a/listing.c b/listing.c index 7050301..548922a 100644 --- a/listing.c +++ b/listing.c @@ -29,6 +29,7 @@ #include "macrossTypes.h" #include "macrossGlobals.h" +#include "listing.h" static char lineBuffer1[LINE_BUFFER_SIZE]; static char lineBuffer2[LINE_BUFFER_SIZE]; @@ -43,8 +44,6 @@ static int nextMacroDepth; void outputListing() { - void generateListing(); - rewind(saveFileForPass2); rewind(indexFileForPass2); rewind(macroFileForPass2); @@ -122,9 +121,6 @@ generateListing() int numberOfBytesListed; char *tempText; - void readIndexFileLine(); - void readSourceFileLine(); - sourceLineNumber = 1; alreadyListingMacroExpansion = FALSE; readSourceFileLine(&sourceAddress, &sourceDepth, sourceText, @@ -362,8 +358,6 @@ printListingLine(numberOfBytes, byteAddress, text, kind) { int i; - void tabPrint(); - if (kind != BLOCK_STATEMENT) numberOfBytes = (numberOfBytes < 4) ? numberOfBytes : 4; @@ -484,10 +478,8 @@ printNTimes(aChar, times) char aChar; int times; { - void moreText(); - while (times-- > 0) - moreText("%c", aChar); + moreText("%c", aChar, 0, 0); } void @@ -595,9 +587,9 @@ expandExpression(toBuffer, toBufferPtr) char **toBufferPtr; { if (toBuffer == NULL) - moreText("%s", expressionString); + moreText("%s", expressionString, 0, 0); else - addText(toBuffer, toBufferPtr, "%s", expressionString); + addText(toBuffer, toBufferPtr, "%s", expressionString, 0, 0); flushExpressionString(); } @@ -607,14 +599,14 @@ expandNum(buffer, bufferPtr, n) char **bufferPtr; int n; { - moreTextOptional(buffer, bufferPtr, "%d", n); + moreTextOptional(buffer, bufferPtr, "%d", n, 0, 0); } void flushOperand(n) int n; { - moreText("%s", operandBuffer[n]); + moreText("%s", operandBuffer[n], 0, 0); operandBuffer[n][0] = '\0'; } @@ -627,7 +619,7 @@ expandOperands(op) if (op > 0) { flushOperand(0); for (i=1; i /* @@ -1093,3 +1096,5 @@ typedef enum {/* horrible kludge due to C compiler bug on Sun */ /* Boy, is this macro useful! */ #define typeAlloc(type) (type *)malloc(sizeof(type)) + +#endif diff --git a/operandStuff.h b/operandStuff.h new file mode 100644 index 0000000..796d565 --- /dev/null +++ b/operandStuff.h @@ -0,0 +1,21 @@ +#ifndef OPERAND_STUFF_H_ +#define OPERAND_STUFF_H_ + +#include "macrossTypes.h" + +#if TARGET_CPU == CPU_6502 +operandType *buildOperand(operandKindType kindOfOperand, anyOldThing *arg); +#elif TARGET_CPU == CPU_68000 +operandType *buildOperand(operandKindType kindOfOperand, int arg1, int arg2, int arg3, int arg4); +#else +#error Unknown or undefined processor type +#endif + +operandListType *duplicateOperandForFixup(operandListType *operand, bool isSpecialFunctionOperand); +void expandOperand(operandKindType addressMode, char *buffer); +void freeOperand(operandType *operand); +valueType *evaluateOperand(operandType *operand); +conditionType invertConditionCode(conditionType conditionCode); +bool shouldParethesize(operandType *operand); + +#endif diff --git a/operandStuffSD_6502.c b/operandStuffSD_6502.c index 5e35713..68b860f 100644 --- a/operandStuffSD_6502.c +++ b/operandStuffSD_6502.c @@ -229,8 +229,9 @@ freeOperand(operand) /* corresponds to routines in listing.c */ void -expandOperand(addressMode) +expandOperand(addressMode, buffer) operandKindType addressMode; + char * buffer; { switch (addressMode) { case IMMEDIATE_OPND: moreText("#"); break; diff --git a/parserMisc.c b/parserMisc.c index b165c0b..5f96c2b 100644 --- a/parserMisc.c +++ b/parserMisc.c @@ -32,6 +32,7 @@ #include "macrossTypes.h" #include "macrossGlobals.h" #include "y.tab.h" +#include "parserMisc.h" statementType * addLabelToStatement(labelList, statement) @@ -46,12 +47,16 @@ addLabelToStatement(labelList, statement) return(statement); } +/* TODO: This should be a varargs function. In 1984 it probably wasn't + * standardized, but here in Glorious Future Year 1989 the vprintf + * function does almost exactly what we want. */ + void botch(message, arg1, arg2, arg3) char *message; - anyOldThing *arg1; - anyOldThing *arg2; - anyOldThing *arg3; + int arg1; + int arg2; + int arg3; { printf("Macross horrible terrible internal botch: "); printf(message, arg1, arg2, arg3); @@ -72,7 +77,7 @@ convertDefineToMdefine(defineStatement) { if (defineStatement->kindOfStatement != DEFINE_STATEMENT) botch("convertDefineToMdefine got statement kind: %d\n", - defineStatement->kindOfStatement); + defineStatement->kindOfStatement, 0, 0); defineStatement->kindOfStatement = MDEFINE_STATEMENT; return(defineStatement); } @@ -85,9 +90,9 @@ extractIfBody(ifStatement) result = ifStatement->statementBody.ifUnion; if (ifStatement->labels != NULL) - botch("extract if body with non-null labels\n"); + botch("extract if body with non-null labels\n", 0, 0, 0); else if (ifStatement->nextStatement != NULL) - botch("extract if body with non-null next\n"); + botch("extract if body with non-null next\n", 0, 0, 0); else qfree(ifStatement); return(result); @@ -101,9 +106,9 @@ extractMifBody(mifStatement) result = mifStatement->statementBody.mifUnion; if (mifStatement->labels != NULL) - botch("extract mif body with non-null labels\n"); + botch("extract mif body with non-null labels\n", 0, 0, 0); else if (mifStatement->nextStatement != NULL) - botch("extract mif body with non-null next\n"); + botch("extract mif body with non-null next\n", 0, 0, 0); else qfree(mifStatement); return(result); @@ -117,7 +122,7 @@ extractString(textExpression) if (textExpression->kindOfOperand != STRING_OPND) botch("extract string got handed an opnd kind: %d\n", - textExpression->kindOfOperand); + textExpression->kindOfOperand, 0, 0); result = textExpression->theOperand.stringUnion; qfree(textExpression); return(result); diff --git a/parserMisc.h b/parserMisc.h new file mode 100644 index 0000000..fc08c53 --- /dev/null +++ b/parserMisc.h @@ -0,0 +1,16 @@ +#ifndef PARSER_MISC_H_ +#define PARSER_MISC_H_ +#include "macrossTypes.h" + +statementType *addLabelToSatement(labelListType *labelList, statementType *statement); +void botch(char *message, int arg1, int arg2, int arg3); +void checkDefineAssignmentOperator(assignmentKindType assignmentOperator); +void convertDefineToMDefine(statementType *defineStatement); +ifStatementBodyType *extractIfBody(statementType *ifStatement); +mifStatementBodyType *extractMifBody(statementType *mifStatement); +stringType *extractString(operandType *textExpression); +void popMacroOrFunctionNestingDepth(); +void pushMacroOrFunctionNestingDepth(); +char *saveString(char *s); + +#endif diff --git a/semanticMisc.c b/semanticMisc.c index 7861d62..a2f0203 100644 --- a/semanticMisc.c +++ b/semanticMisc.c @@ -32,6 +32,9 @@ #include "macrossGlobals.h" #include "y.tab.h" +#include "semanticMisc.h" +#include "expressionSemantics.h" + #define expansionOff() {saveExpansion=expandMacros; expandMacros=FALSE;} #define expansionOn() expandMacros=saveExpansion; @@ -219,7 +222,6 @@ booleanTest(expression) bool result; valueType *expressionResult; bool saveExpansion; - valueType *evaluateExpression(); expansionOff(); expressionResult = evaluateExpression(expression, NO_FIXUP); @@ -1009,7 +1011,6 @@ noteReference(expression, kindOfFixup, location, codeMode) performFixups(fixups) fixupListType *fixups; { - valueType *evaluateExpression(); valueType *valueToPoke; performingFixups = TRUE; diff --git a/semanticMisc.h b/semanticMisc.h index f2d2aec..b40d431 100644 --- a/semanticMisc.h +++ b/semanticMisc.h @@ -13,7 +13,7 @@ bool booleanTest(expressionType *expression); int countArguments(functionDefinitionType *function); int countParameters(operandListType *parameterList); arrayType *allocArray(int size, valueType ***contentsPtr); -valueType *createArray(expresionType *dimension, expressionListType *initializers); +valueType *createArray(expressionType *dimension, expressionListType *initializers); bool decrementable(valueType *value); int expressionListLength(expressionListType *expressionList); int fieldValue(symbolTableEntryType *symbol); diff --git a/statementSemantics.c b/statementSemantics.c index e93cac2..2f6714f 100644 --- a/statementSemantics.c +++ b/statementSemantics.c @@ -30,6 +30,12 @@ #include "macrossTypes.h" #include "macrossGlobals.h" +#include "emitBranch.h" +#include "expressionSemantics.h" +#include "operandStuff.h" +#include "parserMisc.h" +#include "semanticMisc.h" +#include "statementSemantics.h" operandType *dbOperand; /* safe temps for dbx hacking */ expressionType *dbExpression; @@ -52,8 +58,6 @@ bool nullStatementFlag = FALSE; assembleBlock(block) blockType *block; { - simpleFixupListType *assembleStatement(); - nullAssemble(block); assembleStatement(block, FALSE, NULL); } @@ -63,8 +67,6 @@ assembleBlockInsideIf(block, ongoingFixupList) blockType *block; simpleFixupListType *ongoingFixupList; { - simpleFixupListType *assembleStatement(); - nullAssembleNULL(block); return(assembleStatement(block, TRUE, ongoingFixupList)); } @@ -98,9 +100,6 @@ assembleMachineInstruction(opcode, operands) valueType *evaluatedOperands[MAX_NUMBER_OF_OPERANDS]; valueType *value; - valueType *evaluateOperand(); - addressType addressValue(); - nullAssemble(opcode); expand(moreText("%s\t", opcode->mnemonic)); for (op=1; operands!=NULL && op<=opcode->maxNumberOfOperands; @@ -193,9 +192,6 @@ assembleAlignStatement(alignStatement) int alignment; bool saveExpansion; - int intValue(); - valueType *evaluateExpression(); - nullAssemble(alignStatement); expansionOff(); alignment = intValue(evaluateExpression(alignStatement, NO_FIXUP)); @@ -229,8 +225,6 @@ assembleAssertStatement(assertStatement) valueType *message; bool saveExpansion; - valueType *evaluateExpression(); - expansionOff(); test = evaluateExpression(assertStatement->condition, NO_FIXUP); expansionOn(); @@ -261,9 +255,6 @@ assembleBlockStatement(blockStatement) valueType *blockIncrement; int blockSize; - valueType *evaluateExpression(); - int intValue(); - blockSize = 0; nullAssemble(blockStatement); expand(moreText("block\t")); @@ -300,8 +291,6 @@ assembleByteStatement(byteStatement) { valueType *byteValue; - valueType *evaluateExpression(); - nullAssemble(byteStatement); expand(moreText("byte\t")); while (byteStatement != NULL) { @@ -331,8 +320,6 @@ assembleConstrainStatement(constrainStatement) addressType endAddress; bool saveExpansion; - valueType *evaluateExpression(); - expansionOff(); constraintValue = evaluateExpression(constrainStatement->constraint, NO_FIXUP); @@ -373,9 +360,6 @@ assembleDbyteStatement(dbyteStatement) { valueType *wordValue; - valueType *evaluateExpression(); - valueType *swabValue(); - nullAssemble(dbyteStatement); expand(moreText("dbyte\t")); while (dbyteStatement != NULL) { @@ -399,10 +383,6 @@ assembleDefineStatement(defineStatement) symbolInContextType *contextToDefine; bool saveExpansion; - valueType *evaluateDefineExpression(); - valueType *newValue(); - symbolTableEntryType *effectiveSymbol(); - nullAssemble(defineStatement); symbolToDefine = effectiveSymbol(defineStatement->theSymbol, &contextToDefine); @@ -442,8 +422,6 @@ assembleDoUntilStatement(doUntilStatement) { valueType topOfLoop; - simpleFixupListType *emitJump(); - nullAssemble(doUntilStatement); topOfLoop = currentLocationCounter; if (doUntilStatement->doUntilCondition == NEVER_COND) @@ -469,8 +447,6 @@ assembleDoWhileStatement(doWhileStatement) { valueType topOfLoop; - simpleFixupListType *emitJump(); - nullAssemble(doWhileStatement); topOfLoop = currentLocationCounter; if (doWhileStatement->doWhileCondition == ALWAYS_COND) @@ -497,9 +473,6 @@ assembleExternStatement(externStatement) symbolInContextType *context; symbolTableEntryType *theSymbol; - symbolInContextType *getBaseContext(); - symbolTableEntryType *effectiveSymbol(); - expand(moreText("extern\t")); while (externStatement != NULL) { theSymbol = effectiveSymbol(externStatement->theSymbol, @@ -539,10 +512,6 @@ assembleFunctionStatement(functionStatement) functionDefinitionType *newFunction; symbolInContextType *context; - symbolTableEntryType *lookupOrEnterSymbol(); - valueType *newValue(); - symbolInContextType *getBaseContext(); - nullAssemble(functionStatement); if (currentEnvironment != &globalEnvironment) { error(FUNCTION_DEFINITION_INSIDE_FUNCTION_ERROR); @@ -595,9 +564,6 @@ assembleIfStatement(ifStatement, terminalIf, ongoingFixupList) valueType fixupLocation1[COMPOUND_BRANCH_MAX]; simpleFixupListType *fixupLocation2; - simpleFixupListType *emitJump(); - void assembleIfStatementOldStyle(); - if (backwardsCompatibleIfFlag) { assembleIfStatementOldStyle(ifStatement); return(NULL); @@ -649,8 +615,6 @@ assembleIfStatementOldStyle(ifStatement) valueType fixupLocation1[COMPOUND_BRANCH_MAX]; simpleFixupListType *fixupLocation2; - simpleFixupListType *emitJump(); - nullAssemble(ifStatement); if (ifStatement->ifCondition != ALWAYS_COND) { emitRelativeBranch(invertConditionCode(ifStatement-> @@ -684,8 +648,6 @@ assembleIncludeStatement(includeStatement) stringType *fileName; valueType *possibleFileName; bool saveExpansion; - valueType *evaluateExpression(); - stringType *saveString(); expansionOff(); possibleFileName = evaluateExpression(includeStatement, NO_FIXUP); @@ -727,7 +689,7 @@ assembleInstructionStatement(instructionStatement, cumulativeLineNumber) default: botch("bad instruction type=%d\n", instructionStatement-> - kindOfInstruction); + kindOfInstruction, 0, 0); break; } } @@ -738,8 +700,6 @@ assembleLongStatement(longStatement) { valueType *longValue; - valueType *evaluateExpression(); - nullAssemble(longStatement); expand(moreText("long\t")); while (longStatement != NULL) { @@ -761,8 +721,6 @@ assembleMacroStatement(macroStatement) { macroTableEntryType *newMacro; - macroTableEntryType *installMacro(); - nullAssemble(macroStatement); if (currentEnvironment != &globalEnvironment) { error(MACRO_DEFINITION_INSIDE_MACRO_ERROR); @@ -785,7 +743,6 @@ assembleMdefineStatement(mdefineStatement) defineStatementBodyType *mdefineStatement; { bool saveExpansion; - valueType *evaluateDefineExpression(); nullAssemble(mdefineStatement); expansionOff(); @@ -879,7 +836,6 @@ assembleMswitchStatement(mswitchStatement) expressionListType *tagExpressionList; valueType *tagValue; bool saveExpansion; - valueType *evaluateExpression(); expansionOff(); switchValue = evaluateExpression(mswitchStatement->switchExpression, @@ -939,9 +895,6 @@ assembleMvariableStatement(mvariableStatement) int initCount; bool saveExpansion; - valueType *createArray(); - int expressionListLength(); - nullAssemble(mvariableStatement); expansionOff(); if (mvariableStatement->theDimension == NULL) { @@ -990,7 +943,6 @@ assembleOrgStatement(orgStatement) { valueType *orgAddress; bool saveExpansion; - valueType *evaluateExpression(); nullAssemble(orgStatement); targetOffset = 0; @@ -1018,8 +970,6 @@ assembleOrgStatement(orgStatement) assemblePerformStatement(performStatement) performStatementBodyType *performStatement; { - void evaluateExpressionStandalone(); - nullAssemble(performStatement); sideEffectFlag = FALSE; evaluateExpressionStandalone(performStatement); @@ -1045,10 +995,6 @@ assembleRelStatement(relStatement) assembleStartStatement(startStatement) startStatementBodyType *startStatement; { - valueType *evaluateExpression(); - addressType addressValue(); - expressionType *generateFixupExpression(); - nullAssemble(startStatement); expand(moreText("start\t")); if (haveUserStartAddress) { @@ -1079,8 +1025,6 @@ assembleStringStatement(stringStatement) { valueType *byteValue; - valueType *evaluateExpression(); - nullAssemble(stringStatement); expand(moreText("string\t")); while (stringStatement != NULL) { @@ -1118,7 +1062,6 @@ assembleTargetStatement(targetStatement) { valueType *targetAddress; bool saveExpansion; - valueType *evaluateExpression(); nullAssemble(targetStatement); targetOffset = 0; @@ -1141,8 +1084,6 @@ assembleTargetStatement(targetStatement) assembleUndefineStatement(undefineStatement) undefineStatementBodyType *undefineStatement; { - symbolTableEntryType *effectiveSymbol(); - expand(moreText("undefine\t")); while (undefineStatement != NULL) { expand(moreText("%s", symbName(undefineStatement->theSymbol))); @@ -1162,10 +1103,6 @@ assembleVariableStatement(variableStatement) symbolInContextType *contextForVariable; int initCount; - symbolTableEntryType *effectiveSymbol(); - valueType *createArray(); - int expressionListLength(); - nullAssemble(variableStatement); newVariable = effectiveSymbol(variableStatement->theSymbol, &contextForVariable); @@ -1243,8 +1180,6 @@ assembleWordStatement(wordStatement) { valueType *word; - valueType *evaluateExpression(); - nullAssemble(wordStatement); expand(moreText("word\t")); while (wordStatement != NULL) { @@ -1468,7 +1403,7 @@ assembleStatementBody(kind, body, cumulativeLineNumber, worryAboutIf, break; default: - botch("assembleStatementBody doesn't know kind %d\n", kind); + botch("assembleStatementBody doesn't know kind %d\n", kind, 0, 0); break; } /* return(result);*/ @@ -1479,8 +1414,6 @@ assembleStatementBody(kind, body, cumulativeLineNumber, worryAboutIf, assembleLabelList(labelList) labelListType *labelList; { - valueType *newValue(); - while (labelList != NULL) { if (structNestingDepth == 0) valueLabel(labelList->theLabel, diff --git a/statementSemantics.h b/statementSemantics.h new file mode 100644 index 0000000..423c8fd --- /dev/null +++ b/statementSemantics.h @@ -0,0 +1,54 @@ +#ifndef STATEMENT_SEMANTICS_H_ +#define STATEMENT_SEMANTICS_H_ + +#include "macrossTypes.h" + +void assembleBlock(blockType *block); +simpleFixupListType *assembleBlockInsideIf(blockType *block, simpleFixupListType *ongoingFixupList); +bool operandCheck(opcodeTableEntryType *opcode, int numberOfOperands, valueType *evaluatedOperands[]); +void assembleMachineInstruction(opcodeTableEntryType *opcode, operandListType *operands); +void assembleMacro(macroTableEntryType *macroInstruction, operandListType *operands); +void assembleAlignStatement(alignStatementBodyType *alignStatement); +void assembleAssertStatement(assertStatementBodyType *assertStatement); +void assembleBlockStatement(blockStatementBodyType *blockStatement); +void assembleByteStatement(byteStatementBodyType *byeStatement); +void assembleConstrainStatement(constrainStatementBodyType *constrainStatement); +void assembleDbyteStatement(dbyteStatementBodyType *dbyteStatement); +void assembleDefineStatement(defineStatementBodyType *defineStatement); +void assembleDoUntilStatement(doUntilStatementBodyType *doUntilStatement); +void assembleDoWhileStatement(doWhileStatementBodyType *doWhileStatement); +void assembleExternStatement(externStatementBodyType *externStatement); +void assembleFReturnStatement(freturnStatementBodyType *freturnStatement); +void assembleFunctionStatement(functionStatementBodyType *functionStatement); +void assembleGroupStatement(blockType *groupStatement); +simpleFixupListType *assembleIfStatement(ifStatementBodyType *ifStatement, bool terminalIf, simpleFixupListType *ongoingFixupList); +void assembleIfStatementOldStyle(ifStatementBodyType *ifStatement); +void assembleIncludeStatement(includeStatementBodyType *includeStatement); +void assembleInstructionStatement(instructionStatementBodyType *Statement, int cumulativeLineNumber); +void assembleLongStatement(longStatementBodyType *longStatement); +void assembleMacroStatement(macroStatementBodyType *macroStatement); +void assembleMdefineStatement(defineStatementBodyType *mdefineStatement); +void assembleMdoUntilStatement(mdoUntilStatementBodyType *mdoUntilStatement); +void assembleMdoWhileStatement(mdoWhileStatementBodyType *mdoWhileStatement); +void assembleMforStatement(mforStatementBodyType *mforStatement); +void assembleMifStatement(mifStatementBodyType *mifStatement, int cumulativeLineNumber); +void assembleMswitchStatement(mswitchStatementBodyType *mswitchStatement); +void assembleMvariableStatement(mvariableStatementBodyType *mvariableStatement); +void assembleMwhileStatement(mwhileStatementBodyType *mwhileStatement); +void assembleOrgStatement(orgStatementBodyType *orgStatement); +void assemblePerformStatement(performStatementBodyType *performStatement); +void assembleRelStatement(relStatementBodyType *relStatement); +void assembleStartStatement(startStatementBodyType *startStatement); +void assembleStringStatement(stringStatementBodyType *stringStatement); +void assembleStructStatement(structStatementBodyType *structStatement); +void assembleTargetStatement(targetStatementBodyType *targetStatement); +void assembleUndefineStatement(undefineStatementBodyType *undefineStatement); +void assembleVariableStatement(variableStatementBodyType *variableStatement); +void assembleWhileStatement(whileStatementBodyType *whileStatement); +void assembleWordStatement(wordStatementBodyType *wordStatement); +bool assembleStatementBody(statementKindType kind, statementBodyType body, int cumulativeLineNumber, bool worryAboutIf, simpleFixupListType **ifFixupList); +void assembleLabelList(labelListType *labelList); +simpleFixupListType *assembleStatement(statementType *statement, bool insideIf, simpleFixupListType *ongoingFixupList); +void eatStatement(statementType *statement); + +#endif