mirror of
https://github.com/Museum-of-Art-and-Digital-Entertainment/macross.git
synced 2024-11-25 14:34:53 +00:00
Fixed macross and slinky to compile with clang 3.3 for i386 Mac OS X
This commit is contained in:
parent
b259671c6d
commit
41abf82cae
28
Makefile
28
Makefile
@ -23,17 +23,19 @@ conditionDefs_$(PROC).h driver.c slinkyExpressions.h
|
||||
|
||||
HEADERS = macrossTypes.h macrossGlobals.h
|
||||
|
||||
CFLAGS=-m32 # macross is not 64 bit clean
|
||||
|
||||
.c.o:
|
||||
cc -c -g -DTARGET_CPU=CPU_$(PROC) $*.c
|
||||
cc $(CFLAGS) -c -g -DTARGET_CPU=CPU_$(PROC) $*.c
|
||||
|
||||
.c.run:
|
||||
cc -o $* $*.c
|
||||
cc $(CFLAGS) -o $* $*.c
|
||||
|
||||
macross: $(OBJECTS)
|
||||
cc -g -o macross $(OBJECTS)
|
||||
cc $(CFLAGS) -g -o macross $(OBJECTS)
|
||||
|
||||
driver: driver.c
|
||||
cc -o driver driver.c
|
||||
cc $(CFLAGS) -o driver driver.c
|
||||
|
||||
update: .mark
|
||||
kessel "(cd /u0/chip/macross; make macross >&errorfyle)" &
|
||||
@ -75,7 +77,7 @@ macrossTypes.h: macrossTypes.h operandDefs_$(PROC).h operandBody_$(PROC).h\
|
||||
conditionDefs_$(PROC).h
|
||||
|
||||
actions.o: actions_$(PROC).c $(HEADERS)
|
||||
cc -c -g -DTARGET_CPU=CPU_$(PROC) actions_$(PROC).c
|
||||
cc $(CFLAGS) -c -g -DTARGET_CPU=CPU_$(PROC) actions_$(PROC).c
|
||||
mv actions_$(PROC).o actions.o
|
||||
|
||||
buildStuff1.o: buildStuff1.c $(HEADERS)
|
||||
@ -87,21 +89,21 @@ buildStuff3.o: buildStuff3.c $(HEADERS)
|
||||
builtInFunctions.o: builtInFunctions.c $(HEADERS)
|
||||
|
||||
builtInFunsSD.o: builtInFunsSD_$(PROC).c $(HEADERS)
|
||||
cc -c -g -DTARGET_CPU=CPU_$(PROC) builtInFunsSD_$(PROC).c
|
||||
cc $(CFLAGS) -c -g -DTARGET_CPU=CPU_$(PROC) builtInFunsSD_$(PROC).c
|
||||
mv builtInFunsSD_$(PROC).o builtInFunsSD.o
|
||||
|
||||
debugPrint.o: debugPrint.c y.tab.h $(HEADERS)
|
||||
|
||||
debugPrintSD.o: debugPrintSD_$(PROC).c y.tab.h $(HEADERS)
|
||||
cc -c -g -DTARGET_CPU=CPU_$(PROC) debugPrintSD_$(PROC).c
|
||||
cc $(CFLAGS) -c -g -DTARGET_CPU=CPU_$(PROC) debugPrintSD_$(PROC).c
|
||||
mv debugPrintSD_$(PROC).o debugPrintSD.o
|
||||
|
||||
emitBranch.o: emitBranch_$(PROC).c $(HEADERS)
|
||||
cc -c -g -DTARGET_CPU=CPU_$(PROC) emitBranch_$(PROC).c
|
||||
cc $(CFLAGS) -c -g -DTARGET_CPU=CPU_$(PROC) emitBranch_$(PROC).c
|
||||
mv emitBranch_$(PROC).o emitBranch.o
|
||||
|
||||
emitStuff.o: emitStuff.c $(HEADERS)
|
||||
cc -c -g -DBYTESWAPPED -DTARGET_CPU=CPU_$(PROC) emitStuff.c
|
||||
cc $(CFLAGS) -c -g -DBYTESWAPPED -DTARGET_CPU=CPU_$(PROC) emitStuff.c
|
||||
|
||||
encode.o: encode.c $(HEADERS)
|
||||
|
||||
@ -122,7 +124,7 @@ listing.o: listing.c $(HEADERS)
|
||||
lookups.o: lookups.c $(HEADERS)
|
||||
|
||||
macrossTables.o: macrossTables_$(PROC).c y.tab.h macrossTypes.h
|
||||
cc -c -g -DTARGET_CPU=CPU_$(PROC) macrossTables_$(PROC).c
|
||||
cc $(CFLAGS) -c -g -DTARGET_CPU=CPU_$(PROC) macrossTables_$(PROC).c
|
||||
mv macrossTables_$(PROC).o macrossTables.o
|
||||
|
||||
malloc.o: malloc.c
|
||||
@ -132,7 +134,7 @@ main.o: main.c $(HEADERS)
|
||||
object.o: object.c $(HEADERS)
|
||||
|
||||
operandStuffSD.o: operandStuffSD_$(PROC).c $(HEADERS)
|
||||
cc -c -g -DTARGET_CPU=CPU_$(PROC) operandStuffSD_$(PROC).c
|
||||
cc $(CFLAGS) -c -g -DTARGET_CPU=CPU_$(PROC) operandStuffSD_$(PROC).c
|
||||
mv operandStuffSD_$(PROC).o operandStuffSD.o
|
||||
|
||||
parserMisc.o: parserMisc.c y.tab.h $(HEADERS)
|
||||
@ -144,11 +146,11 @@ statementSemantics.o: statementSemantics.c $(HEADERS)
|
||||
structSemantics.o: structSemantics.c $(HEADERS)
|
||||
|
||||
tokenStrings.o: tokenStrings_$(PROC).c $(HEADERS)
|
||||
cc -c -g -DTARGET_CPU=CPU_$(PROC) tokenStrings_$(PROC).c
|
||||
cc $(CFLAGS) -c -g -DTARGET_CPU=CPU_$(PROC) tokenStrings_$(PROC).c
|
||||
mv tokenStrings_$(PROC).o tokenStrings.o
|
||||
|
||||
y.tab.o: y.tab.c $(HEADERS)
|
||||
cc -c -g -DYYDEBUG -DTARGET_CPU=CPU_$(PROC) y.tab.c
|
||||
cc $(CFLAGS) -c -g -DYYDEBUG -DTARGET_CPU=CPU_$(PROC) y.tab.c
|
||||
|
||||
y.tab.c y.tab.h: macross_$(PROC).y
|
||||
yacc -d macross_$(PROC).y
|
||||
|
@ -45,7 +45,7 @@ buildAlignStatement(expression)
|
||||
expressionType *expression;
|
||||
{
|
||||
return(newStatement(ALIGN_STATEMENT,
|
||||
(alignStatementBodyType *) expression));
|
||||
(statementBodyType) expression));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -59,7 +59,7 @@ buildAssertStatement(condition, message)
|
||||
|
||||
result->condition = condition;
|
||||
result->message = message;
|
||||
return(newStatement(ASSERT_STATEMENT, result));
|
||||
return(newStatement(ASSERT_STATEMENT, (statementBodyType) result));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -67,7 +67,7 @@ buildBlockStatement(expressionList)
|
||||
expressionListType *expressionList;
|
||||
{
|
||||
return(newStatement(BLOCK_STATEMENT,
|
||||
(blockStatementBodyType *) expressionList));
|
||||
(statementBodyType) expressionList));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -75,7 +75,7 @@ buildByteStatement(expressionList)
|
||||
expressionListType *expressionList;
|
||||
{
|
||||
return(newStatement(BYTE_STATEMENT,
|
||||
(byteStatementBodyType *) expressionList));
|
||||
(statementBodyType) expressionList));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -89,7 +89,7 @@ buildConstrainStatement(expression, block)
|
||||
|
||||
result->constraint = expression;
|
||||
result->constrainedBlock = block;
|
||||
return(newStatement(CONSTRAIN_STATEMENT, result));
|
||||
return(newStatement(CONSTRAIN_STATEMENT, (statementBodyType) result));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -97,7 +97,7 @@ buildDbyteStatement(expressionList)
|
||||
expressionListType *expressionList;
|
||||
{
|
||||
return(newStatement(DBYTE_STATEMENT,
|
||||
(dbyteStatementBodyType *) expressionList));
|
||||
(statementBodyType) expressionList));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -110,7 +110,7 @@ buildDefineStatement(name, value)
|
||||
result = typeAlloc(defineStatementBodyType);
|
||||
result->theSymbol = lookupOrEnterSymbol(name, UNKNOWN_SYMBOL);
|
||||
result->theValue = value;
|
||||
return(newStatement(DEFINE_STATEMENT, result));
|
||||
return(newStatement(DEFINE_STATEMENT, (statementBodyType) result));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -123,7 +123,7 @@ buildDoUntilStatement(body, condition)
|
||||
result = typeAlloc(doUntilStatementBodyType);
|
||||
result->doUntilCondition = condition;
|
||||
result->doUntilLoop = body;
|
||||
return(newStatement(DO_UNTIL_STATEMENT,result));
|
||||
return(newStatement(DO_UNTIL_STATEMENT, (statementBodyType) result));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -136,7 +136,7 @@ buildDoWhileStatement(body, condition)
|
||||
result = typeAlloc(doWhileStatementBodyType);
|
||||
result->doWhileCondition = condition;
|
||||
result->doWhileLoop = body;
|
||||
return(newStatement(DO_WHILE_STATEMENT, result));
|
||||
return(newStatement(DO_WHILE_STATEMENT, (statementBodyType) result));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -161,7 +161,7 @@ buildExternStatement(identifierList)
|
||||
identifierListType *identifierList;
|
||||
{
|
||||
return(newStatement(EXTERN_STATEMENT,
|
||||
(externStatementBodyType *) identifierList));
|
||||
(statementBodyType) identifierList));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -169,7 +169,7 @@ buildFreturnStatement(expression)
|
||||
expressionType *expression;
|
||||
{
|
||||
return(newStatement(FRETURN_STATEMENT,
|
||||
(freturnStatementBodyType *) expression));
|
||||
(statementBodyType) expression));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -191,7 +191,7 @@ buildFunctionStatement(name, arguments, body)
|
||||
result->functionName = saveString(name);
|
||||
result->theArguments = arguments;
|
||||
result->theBlock = body;
|
||||
return(newStatement(FUNCTION_STATEMENT, result));
|
||||
return(newStatement(FUNCTION_STATEMENT, (statementBodyType) result));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -199,7 +199,7 @@ buildGroupStatement(block)
|
||||
blockType *block;
|
||||
{
|
||||
return(newStatement(GROUP_STATEMENT,
|
||||
(groupStatementBodyType *) block));
|
||||
(statementBodyType) block));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -230,7 +230,7 @@ buildIfStatement(head, continuation, continuationKind)
|
||||
else
|
||||
botch("bad continuation kind: %d\n", continuationKind);
|
||||
qfree(head);
|
||||
return(newStatement(IF_STATEMENT, result));
|
||||
return(newStatement(IF_STATEMENT, (statementBodyType) result));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -238,7 +238,7 @@ buildIncludeStatement(filename)
|
||||
expressionType *filename;
|
||||
{
|
||||
return(newStatement(INCLUDE_STATEMENT,
|
||||
(includeStatementBodyType *) filename));
|
||||
(statementBodyType) filename));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -252,7 +252,7 @@ buildInstructionStatement(opcode, operands)
|
||||
result->kindOfInstruction = OPCODE_INSTRUCTION;
|
||||
result->theInstruction.opcodeUnion = opcode;
|
||||
result->theOperands = operands;
|
||||
return(newStatement(INSTRUCTION_STATEMENT, result));
|
||||
return(newStatement(INSTRUCTION_STATEMENT, (statementBodyType) result));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -260,7 +260,7 @@ buildLongStatement(expressionList)
|
||||
expressionListType *expressionList;
|
||||
{
|
||||
return(newStatement(LONG_STATEMENT,
|
||||
(longStatementBodyType *) expressionList));
|
||||
(statementBodyType) expressionList));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -275,7 +275,7 @@ buildMacroStatement(macro, arguments, body)
|
||||
result->theMacro = macro;
|
||||
result->theArguments = arguments;
|
||||
result->theBlock = body;
|
||||
return(newStatement(MACRO_STATEMENT, result));
|
||||
return(newStatement(MACRO_STATEMENT, (statementBodyType) result));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -289,7 +289,7 @@ buildMacroInstructionStatement(macro, operands)
|
||||
result->kindOfInstruction = MACRO_INSTRUCTION;
|
||||
result->theInstruction.macroUnion = macro;
|
||||
result->theOperands = operands;
|
||||
return(newStatement(INSTRUCTION_STATEMENT, result));
|
||||
return(newStatement(INSTRUCTION_STATEMENT, (statementBodyType) result));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -302,7 +302,7 @@ buildMdefineStatement(name, value)
|
||||
result = typeAlloc(mdefineStatementBodyType);
|
||||
result->theSymbol = lookupOrEnterSymbol(name, DEAD_SYMBOL);
|
||||
result->theValue = value;
|
||||
return(newStatement(MDEFINE_STATEMENT, result));
|
||||
return(newStatement(MDEFINE_STATEMENT, (statementBodyType) result));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -315,7 +315,7 @@ buildMdoUntilStatement(body, condition)
|
||||
result = typeAlloc(mdoUntilStatementBodyType);
|
||||
result->mdoUntilCondition = condition;
|
||||
result->mdoUntilLoop = body;
|
||||
return(newStatement(MDO_UNTIL_STATEMENT,result));
|
||||
return(newStatement(MDO_UNTIL_STATEMENT, (statementBodyType) result));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -328,7 +328,7 @@ buildMdoWhileStatement(body, condition)
|
||||
result = typeAlloc(mdoWhileStatementBodyType);
|
||||
result->mdoWhileCondition = condition;
|
||||
result->mdoWhileLoop = body;
|
||||
return(newStatement(MDO_WHILE_STATEMENT, result));
|
||||
return(newStatement(MDO_WHILE_STATEMENT, (statementBodyType) result));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -361,7 +361,7 @@ buildMforStatement(forExpressions, body)
|
||||
result->incrExpression = forExpressions->incrExpression;
|
||||
result->forLoop = body;
|
||||
qfree(forExpressions);
|
||||
return(newStatement(MFOR_STATEMENT, result));
|
||||
return(newStatement(MFOR_STATEMENT, (statementBodyType) result));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -392,7 +392,7 @@ buildMifStatement(head, continuation, continuationKind)
|
||||
else
|
||||
botch("bad mif continuation kind: %d\n", continuationKind);
|
||||
qfree(head);
|
||||
return(newStatement(MIF_STATEMENT, result));
|
||||
return(newStatement(MIF_STATEMENT, (statementBodyType) result));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -405,7 +405,7 @@ buildMswitchStatement(switchExpression, cases)
|
||||
result = typeAlloc(mswitchStatementBodyType);
|
||||
result->switchExpression = switchExpression;
|
||||
result->cases = cases;
|
||||
return(newStatement(MSWITCH_STATEMENT, result));
|
||||
return(newStatement(MSWITCH_STATEMENT, (statementBodyType) result));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -420,7 +420,7 @@ buildMvariableStatement(name, value, dimension)
|
||||
result->theSymbol = lookupOrEnterSymbol(name, DEAD_SYMBOL);
|
||||
result->theValue = value;
|
||||
result->theDimension = dimension;
|
||||
return(newStatement(MVARIABLE_STATEMENT, result));
|
||||
return(newStatement(MVARIABLE_STATEMENT, (statementBodyType) result));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -433,13 +433,13 @@ buildMwhileStatement(condition, body)
|
||||
result = typeAlloc(mwhileStatementBodyType);
|
||||
result->mwhileCondition = condition;
|
||||
result->mwhileLoop = body;
|
||||
return(newStatement(MWHILE_STATEMENT, result));
|
||||
return(newStatement(MWHILE_STATEMENT, (statementBodyType) result));
|
||||
}
|
||||
|
||||
statementType *
|
||||
buildNullStatement()
|
||||
{
|
||||
return(newStatement(NULL_STATEMENT, NULL));
|
||||
return(newStatement(NULL_STATEMENT, (statementBodyType){ .ifUnion = NULL }));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -447,7 +447,7 @@ buildOrgStatement(expression)
|
||||
expressionType *expression;
|
||||
{
|
||||
return(newStatement(ORG_STATEMENT,
|
||||
(orgStatementBodyType *) expression));
|
||||
(statementBodyType) expression));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -455,13 +455,13 @@ buildPerformStatement(expression)
|
||||
expressionType *expression;
|
||||
{
|
||||
return(newStatement(PERFORM_STATEMENT,
|
||||
(performStatementBodyType *) expression));
|
||||
(statementBodyType) expression));
|
||||
}
|
||||
|
||||
statementType *
|
||||
buildRelStatement()
|
||||
{
|
||||
return(newStatement(REL_STATEMENT, NULL));
|
||||
return(newStatement(REL_STATEMENT, (statementBodyType){ .ifUnion = NULL }));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -469,7 +469,7 @@ buildStartStatement(expression)
|
||||
expressionType *expression;
|
||||
{
|
||||
return(newStatement(START_STATEMENT,
|
||||
(startStatementBodyType *) expression));
|
||||
(statementBodyType) expression));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -477,7 +477,7 @@ buildStringStatement(expressionList)
|
||||
expressionListType *expressionList;
|
||||
{
|
||||
return(newStatement(STRING_STATEMENT,
|
||||
(stringStatementBodyType *) expressionList));
|
||||
(statementBodyType) expressionList));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -490,7 +490,7 @@ buildStructStatement(name, body)
|
||||
result = typeAlloc(structStatementBodyType);
|
||||
result->structBody = body;
|
||||
result->structName = name;
|
||||
return(newStatement(STRUCT_STATEMENT, result));
|
||||
return(newStatement(STRUCT_STATEMENT, (statementBodyType) result));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -498,7 +498,7 @@ buildTargetStatement(expression)
|
||||
expressionType *expression;
|
||||
{
|
||||
return(newStatement(TARGET_STATEMENT,
|
||||
(targetStatementBodyType *) expression));
|
||||
(statementBodyType) expression));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -506,7 +506,7 @@ buildUndefineStatement(identifierList)
|
||||
identifierListType *identifierList;
|
||||
{
|
||||
return(newStatement(UNDEFINE_STATEMENT,
|
||||
(undefineStatementBodyType *) identifierList));
|
||||
(statementBodyType) identifierList));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -521,7 +521,7 @@ buildVariableStatement(name, value, dimension)
|
||||
result->theSymbol = lookupOrEnterSymbol(name, VARIABLE_SYMBOL);
|
||||
result->theValue = value;
|
||||
result->theDimension = dimension;
|
||||
return(newStatement(VARIABLE_STATEMENT, result));
|
||||
return(newStatement(VARIABLE_STATEMENT, (statementBodyType) result));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -534,7 +534,7 @@ buildWhileStatement(condition, body)
|
||||
result = typeAlloc(whileStatementBodyType);
|
||||
result->whileCondition = condition;
|
||||
result->whileLoop = body;
|
||||
return(newStatement(WHILE_STATEMENT, result));
|
||||
return(newStatement(WHILE_STATEMENT, (statementBodyType) result));
|
||||
}
|
||||
|
||||
statementType *
|
||||
@ -542,6 +542,6 @@ buildWordStatement(expressionList)
|
||||
expressionListType *expressionList;
|
||||
{
|
||||
return(newStatement(WORD_STATEMENT,
|
||||
(wordStatementBodyType *) expressionList));
|
||||
(statementBodyType) expressionList));
|
||||
}
|
||||
|
||||
|
104
debugPrint.c
104
debugPrint.c
@ -394,15 +394,15 @@ printExpression(expression)
|
||||
switch (expression->kindOfTerm) {
|
||||
|
||||
case ARRAY_EXPR:
|
||||
printArrayTerm(expression->expressionTerm);
|
||||
printArrayTerm(expression->expressionTerm.arrayUnion);
|
||||
break;
|
||||
|
||||
case ASSIGN_EXPR:
|
||||
printAssignmentTerm(expression->expressionTerm);
|
||||
printAssignmentTerm(expression->expressionTerm.binopUnion);
|
||||
break;
|
||||
|
||||
case BINOP_EXPR:
|
||||
printBinopTerm(expression->expressionTerm);
|
||||
printBinopTerm(expression->expressionTerm.binopUnion);
|
||||
break;
|
||||
|
||||
case CONDITION_CODE_EXPR:
|
||||
@ -410,7 +410,7 @@ printExpression(expression)
|
||||
break;
|
||||
|
||||
case FUNCTION_CALL_EXPR:
|
||||
printFunctionCall(expression->expressionTerm);
|
||||
printFunctionCall(expression->expressionTerm.functionCallUnion);
|
||||
break;
|
||||
|
||||
case HERE_EXPR:
|
||||
@ -418,19 +418,19 @@ printExpression(expression)
|
||||
break;
|
||||
|
||||
case IDENTIFIER_EXPR:
|
||||
printIdentifier(expression->expressionTerm);
|
||||
printIdentifier(expression->expressionTerm.symbolTableUnion);
|
||||
break;
|
||||
|
||||
case NUMBER_EXPR:
|
||||
printNumber(expression->expressionTerm);
|
||||
printNumber(expression->expressionTerm.numberUnion);
|
||||
break;
|
||||
|
||||
case POSTOP_EXPR:
|
||||
printPostopTerm(expression->expressionTerm);
|
||||
printPostopTerm(expression->expressionTerm.postOpUnion);
|
||||
break;
|
||||
|
||||
case PREOP_EXPR:
|
||||
printPreopTerm(expression->expressionTerm);
|
||||
printPreopTerm(expression->expressionTerm.preOpUnion);
|
||||
break;
|
||||
|
||||
case STRING_EXPR:
|
||||
@ -438,15 +438,15 @@ printExpression(expression)
|
||||
break;
|
||||
|
||||
case SUBEXPRESSION_EXPR:
|
||||
printExpression(expression->expressionTerm);
|
||||
printExpression(expression->expressionTerm.expressionUnion);
|
||||
break;
|
||||
|
||||
case UNOP_EXPR:
|
||||
printUnopTerm(expression->expressionTerm);
|
||||
printUnopTerm(expression->expressionTerm.unopUnion);
|
||||
break;
|
||||
|
||||
case VALUE_EXPR:
|
||||
printValue(expression->expressionTerm);
|
||||
printValue(expression->expressionTerm.valueUnion);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -659,7 +659,7 @@ printIfStatement(ifStatement)
|
||||
printBlock(ifStatement->consequence);
|
||||
tab(); printf("(else:\n");
|
||||
tablevel++;
|
||||
printIfStatement(ifStatement->continuation);
|
||||
printIfStatement(ifStatement->continuation.blockUnion);
|
||||
tablevel--;
|
||||
tab(); printf(")\n");
|
||||
}
|
||||
@ -679,11 +679,11 @@ printInstructionStatement(instructionStatement)
|
||||
nullPrint(instructionStatement);
|
||||
switch(instructionStatement->kindOfInstruction) {
|
||||
case OPCODE_INSTRUCTION:
|
||||
printOpcode(instructionStatement->theInstruction);
|
||||
printOpcode(instructionStatement->theInstruction.opcodeUnion);
|
||||
break;
|
||||
|
||||
case MACRO_INSTRUCTION:
|
||||
printMacro(instructionStatement->theInstruction);
|
||||
printMacro(instructionStatement->theInstruction.macroUnion);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -759,7 +759,7 @@ printMifStatement(mifStatement)
|
||||
printBlock(mifStatement->mifConsequence);
|
||||
tab(); printf("(melse:\n");
|
||||
tablevel++;
|
||||
printMifStatement(mifStatement->mifContinuation);
|
||||
printMifStatement(mifStatement->mifContinuation.mifContinuationBodyUnion);
|
||||
tablevel--;
|
||||
tab(); printf(")\n");
|
||||
}
|
||||
@ -906,107 +906,107 @@ printStatementBody(kind, body)
|
||||
switch (kind) {
|
||||
|
||||
case ALIGN_STATEMENT:
|
||||
printAlignStatement(body);
|
||||
printAlignStatement(body.alignUnion);
|
||||
break;
|
||||
|
||||
case ASSERT_STATEMENT:
|
||||
printAssertStatement(body);
|
||||
printAssertStatement(body.assertUnion);
|
||||
break;
|
||||
|
||||
case BLOCK_STATEMENT:
|
||||
printBlockStatement(body);
|
||||
printBlockStatement(body.blockUnion);
|
||||
break;
|
||||
|
||||
case BYTE_STATEMENT:
|
||||
printByteStatement(body);
|
||||
printByteStatement(body.byteUnion);
|
||||
break;
|
||||
|
||||
case CONSTRAIN_STATEMENT:
|
||||
printConstrainStatement(body);
|
||||
printConstrainStatement(body.constrainUnion);
|
||||
break;
|
||||
|
||||
case DBYTE_STATEMENT:
|
||||
printDbyteStatement(body);
|
||||
printDbyteStatement(body.dbyteUnion);
|
||||
break;
|
||||
|
||||
case DEFINE_STATEMENT:
|
||||
printDefineStatement(body);
|
||||
printDefineStatement(body.defineUnion);
|
||||
break;
|
||||
|
||||
case DO_UNTIL_STATEMENT:
|
||||
printDoUntilStatement(body);
|
||||
printDoUntilStatement(body.doUntilUnion);
|
||||
break;
|
||||
|
||||
case DO_WHILE_STATEMENT:
|
||||
printDoWhileStatement(body);
|
||||
printDoWhileStatement(body.doWhileUnion);
|
||||
break;
|
||||
|
||||
case EXTERN_STATEMENT:
|
||||
printExternStatement(body);
|
||||
printExternStatement(body.externUnion);
|
||||
break;
|
||||
|
||||
case FRETURN_STATEMENT:
|
||||
printFreturnStatement(body);
|
||||
printFreturnStatement(body.freturnUnion);
|
||||
break;
|
||||
|
||||
case FUNCTION_STATEMENT:
|
||||
printFunctionStatement(body);
|
||||
printFunctionStatement(body.functionUnion);
|
||||
break;
|
||||
|
||||
case GROUP_STATEMENT:
|
||||
printBlock(body);
|
||||
printBlock(body.groupUnion);
|
||||
break;
|
||||
|
||||
case IF_STATEMENT:
|
||||
printIfStatement(body);
|
||||
printIfStatement(body.ifUnion);
|
||||
break;
|
||||
|
||||
case INCLUDE_STATEMENT:
|
||||
printIncludeStatement(body);
|
||||
printIncludeStatement(body.includeUnion);
|
||||
break;
|
||||
|
||||
case INSTRUCTION_STATEMENT:
|
||||
printInstructionStatement(body);
|
||||
printInstructionStatement(body.instructionUnion);
|
||||
break;
|
||||
|
||||
case LONG_STATEMENT:
|
||||
printLongStatement(body);
|
||||
printLongStatement(body.longUnion);
|
||||
break;
|
||||
|
||||
case MACRO_STATEMENT:
|
||||
printMacroStatement(body);
|
||||
printMacroStatement(body.macroUnion);
|
||||
break;
|
||||
|
||||
case MDEFINE_STATEMENT:
|
||||
printMdefineStatement(body);
|
||||
printMdefineStatement(body.defineUnion);
|
||||
break;
|
||||
|
||||
case MDO_UNTIL_STATEMENT:
|
||||
printMdoUntilStatement(body);
|
||||
printMdoUntilStatement(body.mdoUntilUnion);
|
||||
break;
|
||||
|
||||
case MDO_WHILE_STATEMENT:
|
||||
printMdoWhileStatement(body);
|
||||
printMdoWhileStatement(body.mdoWhileUnion);
|
||||
break;
|
||||
|
||||
case MFOR_STATEMENT:
|
||||
printMforStatement(body);
|
||||
printMforStatement(body.mforUnion);
|
||||
break;
|
||||
|
||||
case MIF_STATEMENT:
|
||||
printMifStatement(body);
|
||||
printMifStatement(body.mifUnion);
|
||||
break;
|
||||
|
||||
case MSWITCH_STATEMENT:
|
||||
printMswitchStatement(body);
|
||||
printMswitchStatement(body.mswitchUnion);
|
||||
break;
|
||||
|
||||
case MVARIABLE_STATEMENT:
|
||||
printMvariableStatement(body);
|
||||
printMvariableStatement(body.mvariableUnion);
|
||||
break;
|
||||
|
||||
case MWHILE_STATEMENT:
|
||||
printMwhileStatement(body);
|
||||
printMwhileStatement(body.mwhileUnion);
|
||||
break;
|
||||
|
||||
case NULL_STATEMENT:
|
||||
@ -1014,47 +1014,47 @@ printStatementBody(kind, body)
|
||||
break;
|
||||
|
||||
case ORG_STATEMENT:
|
||||
printOrgStatement(body);
|
||||
printOrgStatement(body.orgUnion);
|
||||
break;
|
||||
|
||||
case PERFORM_STATEMENT:
|
||||
printPerformStatement(body);
|
||||
printPerformStatement(body.performUnion);
|
||||
break;
|
||||
|
||||
case REL_STATEMENT:
|
||||
printRelStatement(body);
|
||||
printRelStatement(body.relUnion);
|
||||
break;
|
||||
|
||||
case START_STATEMENT:
|
||||
printStartStatement(body);
|
||||
printStartStatement(body.startUnion);
|
||||
break;
|
||||
|
||||
case STRING_STATEMENT:
|
||||
printStringStatement(body);
|
||||
printStringStatement(body.stringUnion);
|
||||
break;
|
||||
|
||||
case STRUCT_STATEMENT:
|
||||
printStructStatement(body);
|
||||
printStructStatement(body.structUnion);
|
||||
break;
|
||||
|
||||
case TARGET_STATEMENT:
|
||||
printTargetStatement(body);
|
||||
printTargetStatement(body.targetUnion);
|
||||
break;
|
||||
|
||||
case UNDEFINE_STATEMENT:
|
||||
printUndefineStatement(body);
|
||||
printUndefineStatement(body.undefineUnion);
|
||||
break;
|
||||
|
||||
case VARIABLE_STATEMENT:
|
||||
printVariableStatement(body);
|
||||
printVariableStatement(body.variableUnion);
|
||||
break;
|
||||
|
||||
case WHILE_STATEMENT:
|
||||
printWhileStatement(body);
|
||||
printWhileStatement(body.whileUnion);
|
||||
break;
|
||||
|
||||
case WORD_STATEMENT:
|
||||
printWordStatement(body);
|
||||
printWordStatement(body.wordUnion);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -175,7 +175,7 @@ emitWord(wordValue)
|
||||
convert.bytePart[loByte]);
|
||||
putByte(currentLocationCounter.value++,
|
||||
convert.bytePart[hiByte]);
|
||||
#else if TARGET_CPU == CPU_68000
|
||||
#elif TARGET_CPU == CPU_68000
|
||||
putByte(currentLocationCounter.value++,
|
||||
convert.bytePart[hiByte]);
|
||||
putByte(currentLocationCounter.value++,
|
||||
@ -185,7 +185,7 @@ emitWord(wordValue)
|
||||
#if TARGET_CPU == CPU_6502
|
||||
mapByte(currentFieldOffset++, convert.bytePart[loByte]);
|
||||
mapByte(currentFieldOffset++, convert.bytePart[hiByte]);
|
||||
#else if TARGET_CPU == CPU_68000
|
||||
#elif TARGET_CPU == CPU_68000
|
||||
mapByte(currentFieldOffset++, convert.bytePart[hiByte]);
|
||||
mapByte(currentFieldOffset++, convert.bytePart[loByte]);
|
||||
#endif
|
||||
@ -236,7 +236,7 @@ emitLong(longValue)
|
||||
convert.bytePart[thirdByte]);
|
||||
putByte(currentLocationCounter.value++,
|
||||
convert.bytePart[hiByte]);
|
||||
#else if TARGET_CPU == CPU_68000
|
||||
#elif TARGET_CPU == CPU_68000
|
||||
putByte(currentLocationCounter.value++,
|
||||
convert.bytePart[hiByte]);
|
||||
putByte(currentLocationCounter.value++,
|
||||
@ -252,7 +252,7 @@ emitLong(longValue)
|
||||
mapByte(currentFieldOffset++, convert.bytePart[secondByte]);
|
||||
mapByte(currentFieldOffset++, convert.bytePart[thirdByte]);
|
||||
mapByte(currentFieldOffset++, convert.bytePart[hiByte]);
|
||||
#else if TARGET_CPU == CPU_68000
|
||||
#elif TARGET_CPU == CPU_68000
|
||||
mapByte(currentFieldOffset++, convert.bytePart[hiByte]);
|
||||
mapByte(currentFieldOffset++, convert.bytePart[thirdByte]);
|
||||
mapByte(currentFieldOffset++, convert.bytePart[secondByte]);
|
||||
|
53
encode.c
53
encode.c
@ -44,9 +44,8 @@ encodeBigword(bigword)
|
||||
}
|
||||
|
||||
bool
|
||||
encodeAssignmentTerm(assignmentTerm, kindOfFixup)
|
||||
encodeAssignmentTerm(assignmentTerm)
|
||||
binopTermType *assignmentTerm;
|
||||
fixupKindType kindOfFixup;
|
||||
{
|
||||
nullEncode(assignmentTerm);
|
||||
if ((assignmentKindType)assignmentTerm->binop != ASSIGN_ASSIGN) {
|
||||
@ -62,10 +61,8 @@ encodeAssignmentTerm(assignmentTerm, kindOfFixup)
|
||||
}
|
||||
|
||||
bool
|
||||
encodeBinopTerm(binopTerm, isTopLevel, kindOfFixup)
|
||||
encodeBinopTerm(binopTerm)
|
||||
binopTermType *binopTerm;
|
||||
bool isTopLevel;
|
||||
fixupKindType kindOfFixup;
|
||||
{
|
||||
bool encodeExpression();
|
||||
|
||||
@ -384,19 +381,19 @@ encodeExpression(expression)
|
||||
break;
|
||||
|
||||
case ASSIGN_EXPR:
|
||||
return(encodeAssignmentTerm(expression->expressionTerm));
|
||||
return(encodeAssignmentTerm(expression->expressionTerm.binopUnion));
|
||||
break;
|
||||
|
||||
case BINOP_EXPR:
|
||||
return(encodeBinopTerm(expression->expressionTerm));
|
||||
return(encodeBinopTerm(expression->expressionTerm.binopUnion));
|
||||
break;
|
||||
|
||||
case CONDITION_CODE_EXPR:
|
||||
return(encodeCondition(expression->expressionTerm));
|
||||
return(encodeCondition(expression->expressionTerm.conditionTypeUnion));
|
||||
break;
|
||||
|
||||
case FUNCTION_CALL_EXPR:
|
||||
return(encodeFunctionCall(expression->expressionTerm));
|
||||
return(encodeFunctionCall(expression->expressionTerm.functionCallUnion));
|
||||
break;
|
||||
|
||||
case HERE_EXPR:
|
||||
@ -404,35 +401,35 @@ encodeExpression(expression)
|
||||
break;
|
||||
|
||||
case IDENTIFIER_EXPR:
|
||||
return(encodeIdentifier(expression->expressionTerm));
|
||||
return(encodeIdentifier(expression->expressionTerm.identifierUnion));
|
||||
break;
|
||||
|
||||
case NUMBER_EXPR:
|
||||
return(encodeNumber(expression->expressionTerm));
|
||||
return(encodeNumber(expression->expressionTerm.numberUnion));
|
||||
break;
|
||||
|
||||
case POSTOP_EXPR:
|
||||
return(encodePostopTerm(expression->expressionTerm));
|
||||
return(encodePostopTerm(expression->expressionTerm.postOpUnion));
|
||||
break;
|
||||
|
||||
case PREOP_EXPR:
|
||||
return(encodePreopTerm(expression->expressionTerm));
|
||||
return(encodePreopTerm(expression->expressionTerm.preOpUnion));
|
||||
break;
|
||||
|
||||
case SUBEXPRESSION_EXPR:
|
||||
encodeExpression(expression->expressionTerm);
|
||||
encodeExpression(expression->expressionTerm.expressionUnion);
|
||||
break;
|
||||
|
||||
case STRING_EXPR:
|
||||
return(encodeString(expression->expressionTerm));
|
||||
return(encodeString(expression->expressionTerm.stringUnion));
|
||||
break;
|
||||
|
||||
case UNOP_EXPR:
|
||||
return(encodeUnopTerm(expression->expressionTerm));
|
||||
return(encodeUnopTerm(expression->expressionTerm.unopUnion));
|
||||
break;
|
||||
|
||||
case VALUE_EXPR:
|
||||
return(encodeValue(expression->expressionTerm));
|
||||
return(encodeValue(expression->expressionTerm.valueUnion));
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -614,43 +611,43 @@ encodeStatement(statement)
|
||||
return(FALSE);
|
||||
|
||||
case ASSERT_STATEMENT:
|
||||
return(encodeAssertStatement(statement->statementBody));
|
||||
return(encodeAssertStatement(statement->statementBody.assertUnion));
|
||||
|
||||
case FRETURN_STATEMENT:
|
||||
return(encodeFreturnStatement(statement->statementBody));
|
||||
return(encodeFreturnStatement(statement->statementBody.freturnUnion));
|
||||
|
||||
case GROUP_STATEMENT:
|
||||
return(encodeBlock(statement->statementBody));
|
||||
|
||||
case MDEFINE_STATEMENT:
|
||||
return(encodeMdefineStatement(statement->statementBody));
|
||||
return(encodeMdefineStatement(statement->statementBody.defineUnion));
|
||||
|
||||
case MDO_UNTIL_STATEMENT:
|
||||
return(encodeMdoUntilStatement(statement->statementBody));
|
||||
return(encodeMdoUntilStatement(statement->statementBody.mdoUntilUnion));
|
||||
|
||||
case MDO_WHILE_STATEMENT:
|
||||
return(encodeMdoWhileStatement(statement->statementBody));
|
||||
return(encodeMdoWhileStatement(statement->statementBody.mdoWhileUnion));
|
||||
|
||||
case MFOR_STATEMENT:
|
||||
return(encodeMforStatement(statement->statementBody));
|
||||
return(encodeMforStatement(statement->statementBody.mforUnion));
|
||||
|
||||
case MIF_STATEMENT:
|
||||
return(encodeMifStatement(statement->statementBody));
|
||||
return(encodeMifStatement(statement->statementBody.mifUnion));
|
||||
|
||||
case MSWITCH_STATEMENT:
|
||||
return(encodeMswitchStatement(statement->statementBody));
|
||||
return(encodeMswitchStatement(statement->statementBody.mswitchUnion));
|
||||
|
||||
case MVARIABLE_STATEMENT:
|
||||
return(encodeMvariableStatement(statement->statementBody));
|
||||
return(encodeMvariableStatement(statement->statementBody.mvariableUnion));
|
||||
|
||||
case MWHILE_STATEMENT:
|
||||
return(encodeMwhileStatement(statement->statementBody));
|
||||
return(encodeMwhileStatement(statement->statementBody.mwhileUnion));
|
||||
|
||||
case NULL_STATEMENT:
|
||||
return(TRUE);
|
||||
|
||||
case PERFORM_STATEMENT:
|
||||
return(encodeExpression(statement->statementBody));
|
||||
return(encodeExpression(statement->statementBody.expressionUnion));
|
||||
|
||||
default:
|
||||
botch("encodeStatementBody doesn't know kind %d\n",
|
||||
|
@ -1063,25 +1063,25 @@ evaluateExpressionInternally(expression, isTopLevel, kindOfFixup,isStandalone)
|
||||
switch (expression->kindOfTerm) {
|
||||
|
||||
case ARRAY_EXPR:
|
||||
return(evaluateArrayTerm(expression->expressionTerm));
|
||||
return(evaluateArrayTerm(expression->expressionTerm.arrayUnion));
|
||||
break;
|
||||
|
||||
case ASSIGN_EXPR:
|
||||
return(evaluateAssignmentTerm(expression->expressionTerm,
|
||||
return(evaluateAssignmentTerm(expression->expressionTerm.binopUnion,
|
||||
kindOfFixup));
|
||||
break;
|
||||
|
||||
case BINOP_EXPR:
|
||||
return(evaluateBinopTerm(expression->expressionTerm,
|
||||
return(evaluateBinopTerm(expression->expressionTerm.binopUnion,
|
||||
isTopLevel, kindOfFixup));
|
||||
break;
|
||||
|
||||
case CONDITION_CODE_EXPR:
|
||||
return(evaluateCondition(expression->expressionTerm));
|
||||
return(evaluateCondition(expression->expressionTerm.conditionTypeUnion));
|
||||
break;
|
||||
|
||||
case FUNCTION_CALL_EXPR:
|
||||
return(evaluateFunctionCall(expression->expressionTerm,
|
||||
return(evaluateFunctionCall(expression->expressionTerm.functionCallUnion,
|
||||
kindOfFixup, isStandalone));
|
||||
break;
|
||||
|
||||
@ -1090,37 +1090,37 @@ evaluateExpressionInternally(expression, isTopLevel, kindOfFixup,isStandalone)
|
||||
break;
|
||||
|
||||
case IDENTIFIER_EXPR:
|
||||
result = evaluateIdentifier(expression->expressionTerm,
|
||||
result = evaluateIdentifier(expression->expressionTerm.symbolTableUnion,
|
||||
isTopLevel, kindOfFixup);
|
||||
return(result);
|
||||
break;
|
||||
|
||||
case NUMBER_EXPR:
|
||||
return(evaluateNumber(expression->expressionTerm));
|
||||
return(evaluateNumber(expression->expressionTerm.numberUnion));
|
||||
break;
|
||||
|
||||
case POSTOP_EXPR:
|
||||
return(evaluatePostopTerm(expression->expressionTerm));
|
||||
return(evaluatePostopTerm(expression->expressionTerm.postOpUnion));
|
||||
break;
|
||||
|
||||
case PREOP_EXPR:
|
||||
return(evaluatePreopTerm(expression->expressionTerm));
|
||||
return(evaluatePreopTerm(expression->expressionTerm.preOpUnion));
|
||||
break;
|
||||
|
||||
case SUBEXPRESSION_EXPR:
|
||||
expand(moreExpression("("));
|
||||
result = evaluateExpressionInternally(expression->
|
||||
expressionTerm, isTopLevel, kindOfFixup, FALSE);
|
||||
expressionTerm.expressionUnion, isTopLevel, kindOfFixup, FALSE);
|
||||
expand(moreExpression(")"));
|
||||
return(result);
|
||||
break;
|
||||
|
||||
case STRING_EXPR:
|
||||
return(evaluateString(expression->expressionTerm));
|
||||
return(evaluateString(expression->expressionTerm.stringUnion));
|
||||
break;
|
||||
|
||||
case UNOP_EXPR:
|
||||
return(evaluateUnopTerm(expression->expressionTerm,
|
||||
return(evaluateUnopTerm(expression->expressionTerm.unopUnion,
|
||||
kindOfFixup));
|
||||
break;
|
||||
|
||||
|
94
garbage.c
94
garbage.c
@ -110,35 +110,35 @@ freeExpression(expression)
|
||||
break;
|
||||
|
||||
case ARRAY_EXPR:
|
||||
freeArrayTerm(expression->expressionTerm);
|
||||
freeArrayTerm(expression->expressionTerm.arrayUnion);
|
||||
break;
|
||||
|
||||
case ASSIGN_EXPR:
|
||||
freeAssignmentTerm(expression->expressionTerm);
|
||||
freeAssignmentTerm(expression->expressionTerm.binopUnion);
|
||||
break;
|
||||
|
||||
case BINOP_EXPR:
|
||||
freeBinopTerm(expression->expressionTerm);
|
||||
freeBinopTerm(expression->expressionTerm.binopUnion);
|
||||
break;
|
||||
|
||||
case FUNCTION_CALL_EXPR:
|
||||
freeFunctionCall(expression->expressionTerm);
|
||||
freeFunctionCall(expression->expressionTerm.functionCallUnion);
|
||||
break;
|
||||
|
||||
case POSTOP_EXPR:
|
||||
freePostopTerm(expression->expressionTerm);
|
||||
freePostopTerm(expression->expressionTerm.postOpUnion);
|
||||
break;
|
||||
|
||||
case PREOP_EXPR:
|
||||
freePreopTerm(expression->expressionTerm);
|
||||
freePreopTerm(expression->expressionTerm.preOpUnion);
|
||||
break;
|
||||
|
||||
case SUBEXPRESSION_EXPR:
|
||||
freeExpression(expression->expressionTerm);
|
||||
freeExpression(expression->expressionTerm.expressionUnion);
|
||||
break;
|
||||
|
||||
case UNOP_EXPR:
|
||||
freeUnopTerm(expression->expressionTerm);
|
||||
freeUnopTerm(expression->expressionTerm.unopUnion);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -362,7 +362,7 @@ freeIfStatement(ifStatement)
|
||||
if (ifStatement->consequence != NULL)
|
||||
freeBlock(ifStatement->consequence);
|
||||
if (ifStatement->continuation.continuationBodyUnion != NULL) {
|
||||
freeIfStatement(ifStatement->continuation);
|
||||
freeIfStatement((void *)ifStatement->continuation.blockUnion);
|
||||
}
|
||||
free(ifStatement);
|
||||
}
|
||||
@ -422,7 +422,7 @@ freeMacroStatement(macroStatement)
|
||||
|
||||
void
|
||||
freeMdefineStatement(mdefineStatement)
|
||||
defineStatementBodyType *mdefineStatement;
|
||||
defineStatementBodyType *mdefineStatement; // MIST: shouldn't this be "mdefineStatementBodyType"?
|
||||
{
|
||||
valueType *freeDefineExpression();
|
||||
|
||||
@ -616,107 +616,107 @@ freeStatementBody(kind, body)
|
||||
switch (kind) {
|
||||
|
||||
case ALIGN_STATEMENT:
|
||||
freeAlignStatement(body);
|
||||
freeAlignStatement(body.alignUnion);
|
||||
break;
|
||||
|
||||
case ASSERT_STATEMENT:
|
||||
freeAssertStatement(body);
|
||||
freeAssertStatement(body.assertUnion);
|
||||
break;
|
||||
|
||||
case BLOCK_STATEMENT:
|
||||
freeBlockStatement(body);
|
||||
freeBlockStatement(body.blockUnion);
|
||||
break;
|
||||
|
||||
case BYTE_STATEMENT:
|
||||
freeByteStatement(body);
|
||||
freeByteStatement(body.byteUnion);
|
||||
break;
|
||||
|
||||
case CONSTRAIN_STATEMENT:
|
||||
freeConstrainStatement(body);
|
||||
freeConstrainStatement(body.constrainUnion);
|
||||
break;
|
||||
|
||||
case DBYTE_STATEMENT:
|
||||
freeDbyteStatement(body);
|
||||
freeDbyteStatement(body.dbyteUnion);
|
||||
break;
|
||||
|
||||
case DEFINE_STATEMENT:
|
||||
freeDefineStatement(body);
|
||||
freeDefineStatement(body.defineUnion);
|
||||
break;
|
||||
|
||||
case DO_UNTIL_STATEMENT:
|
||||
freeDoUntilStatement(body);
|
||||
freeDoUntilStatement(body.doUntilUnion);
|
||||
break;
|
||||
|
||||
case DO_WHILE_STATEMENT:
|
||||
freeDoWhileStatement(body);
|
||||
freeDoWhileStatement(body.doWhileUnion);
|
||||
break;
|
||||
|
||||
case EXTERN_STATEMENT:
|
||||
freeExternStatement(body);
|
||||
freeExternStatement(body.externUnion);
|
||||
break;
|
||||
|
||||
case FRETURN_STATEMENT:
|
||||
freeFreturnStatement(body);
|
||||
freeFreturnStatement(body.freturnUnion);
|
||||
break;
|
||||
|
||||
case FUNCTION_STATEMENT:
|
||||
freeFunctionStatement(body);
|
||||
freeFunctionStatement(body.functionUnion);
|
||||
break;
|
||||
|
||||
case GROUP_STATEMENT:
|
||||
freeBlock(body);
|
||||
freeBlock(body.groupUnion);
|
||||
break;
|
||||
|
||||
case IF_STATEMENT:
|
||||
freeIfStatement(body);
|
||||
freeIfStatement(body.ifUnion);
|
||||
break;
|
||||
|
||||
case INCLUDE_STATEMENT:
|
||||
freeIncludeStatement(body);
|
||||
freeIncludeStatement(body.includeUnion);
|
||||
break;
|
||||
|
||||
case INSTRUCTION_STATEMENT:
|
||||
freeInstructionStatement(body);
|
||||
freeInstructionStatement(body.instructionUnion);
|
||||
break;
|
||||
|
||||
case LONG_STATEMENT:
|
||||
freeLongStatement(body);
|
||||
freeLongStatement(body.longUnion);
|
||||
break;
|
||||
|
||||
case MACRO_STATEMENT:
|
||||
freeMacroStatement(body);
|
||||
freeMacroStatement(body.macroUnion);
|
||||
break;
|
||||
|
||||
case MDEFINE_STATEMENT:
|
||||
freeMdefineStatement(body);
|
||||
freeMdefineStatement(body.defineUnion);
|
||||
break;
|
||||
|
||||
case MDO_UNTIL_STATEMENT:
|
||||
freeMdoUntilStatement(body);
|
||||
freeMdoUntilStatement(body.mdoUntilUnion);
|
||||
break;
|
||||
|
||||
case MDO_WHILE_STATEMENT:
|
||||
freeMdoWhileStatement(body);
|
||||
freeMdoWhileStatement(body.mdoWhileUnion);
|
||||
break;
|
||||
|
||||
case MIF_STATEMENT:
|
||||
freeMifStatement(body);
|
||||
freeMifStatement(body.mifUnion);
|
||||
break;
|
||||
|
||||
case MSWITCH_STATEMENT:
|
||||
freeMswitchStatement(body);
|
||||
freeMswitchStatement(body.mswitchUnion);
|
||||
break;
|
||||
|
||||
case MFOR_STATEMENT:
|
||||
freeMforStatement(body);
|
||||
freeMforStatement(body.mforUnion);
|
||||
break;
|
||||
|
||||
case MVARIABLE_STATEMENT:
|
||||
freeMvariableStatement(body);
|
||||
freeMvariableStatement(body.mvariableUnion);
|
||||
break;
|
||||
|
||||
case MWHILE_STATEMENT:
|
||||
freeMwhileStatement(body);
|
||||
freeMwhileStatement(body.mwhileUnion);
|
||||
break;
|
||||
|
||||
case NULL_STATEMENT:
|
||||
@ -724,47 +724,47 @@ freeStatementBody(kind, body)
|
||||
break;
|
||||
|
||||
case ORG_STATEMENT:
|
||||
freeOrgStatement(body);
|
||||
freeOrgStatement(body.orgUnion);
|
||||
break;
|
||||
|
||||
case PERFORM_STATEMENT:
|
||||
freePerformStatement(body);
|
||||
freePerformStatement(body.performUnion);
|
||||
break;
|
||||
|
||||
case REL_STATEMENT:
|
||||
freeRelStatement(body);
|
||||
freeRelStatement(body.relUnion);
|
||||
break;
|
||||
|
||||
case START_STATEMENT:
|
||||
freeStartStatement(body);
|
||||
freeStartStatement(body.startUnion);
|
||||
break;
|
||||
|
||||
case STRING_STATEMENT:
|
||||
freeStringStatement(body);
|
||||
freeStringStatement(body.stringUnion);
|
||||
break;
|
||||
|
||||
case STRUCT_STATEMENT:
|
||||
freeStructStatement(body);
|
||||
freeStructStatement(body.structUnion);
|
||||
break;
|
||||
|
||||
case TARGET_STATEMENT:
|
||||
freeTargetStatement(body);
|
||||
freeTargetStatement(body.targetUnion);
|
||||
break;
|
||||
|
||||
case UNDEFINE_STATEMENT:
|
||||
freeUndefineStatement(body);
|
||||
freeUndefineStatement(body.undefineUnion);
|
||||
break;
|
||||
|
||||
case VARIABLE_STATEMENT:
|
||||
freeVariableStatement(body);
|
||||
freeVariableStatement(body.variableUnion);
|
||||
break;
|
||||
|
||||
case WHILE_STATEMENT:
|
||||
freeWhileStatement(body);
|
||||
freeWhileStatement(body.whileUnion);
|
||||
break;
|
||||
|
||||
case WORD_STATEMENT:
|
||||
freeWordStatement(body);
|
||||
freeWordStatement(body.wordUnion);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
static char lineBuffer1[LINE_BUFFER_SIZE];
|
||||
static char lineBuffer2[LINE_BUFFER_SIZE];
|
||||
static int cumulativeLineNumber = 0;
|
||||
int cumulativeLineNumber = 0;
|
||||
static char macroLineBuffer[LINE_BUFFER_SIZE];
|
||||
static char nextMacroLineBuffer[LINE_BUFFER_SIZE];
|
||||
static int macroAddress;
|
||||
@ -351,7 +351,7 @@ printListingLine(numberOfBytes, byteAddress, text, kind)
|
||||
else
|
||||
#if TARGET_CPU == CPU_6502
|
||||
fprintf(listFileOutput, "%04x ", byteAddress);
|
||||
#else if TARGET_CPU == CPU_68000
|
||||
#elif TARGET_CPU == CPU_68000
|
||||
fprintf(listFileOutput, "%06x ", byteAddress);
|
||||
#endif
|
||||
|
||||
@ -364,7 +364,7 @@ printListingLine(numberOfBytes, byteAddress, text, kind)
|
||||
fprintf(listFileOutput, " ");
|
||||
} else {
|
||||
fprintf(listFileOutput, " ");
|
||||
#else if TARGET_CPU == CPU_68000
|
||||
#elif TARGET_CPU == CPU_68000
|
||||
for (i=0; i<numberOfBytes; i++) {
|
||||
fprintf(listFileOutput, "%02x",
|
||||
getByte(byteAddress++));
|
||||
|
@ -25,7 +25,7 @@
|
||||
#define CONDITION_DEFS "conditionDefs_6502.h"
|
||||
#define TARGET_CPU_STRING "6502"
|
||||
|
||||
#else if TARGET_CPU == CPU_68000
|
||||
#elif TARGET_CPU == CPU_68000
|
||||
#define OPERAND_DEFS "operandDefs_68000.h"
|
||||
#define OPERAND_BODY "operandBody_68000.h"
|
||||
#define CONDITION_DEFS "conditionDefs_68000.h"
|
||||
@ -417,6 +417,9 @@ typedef union expressionTermBodyUnion {
|
||||
stringTermType *stringUnion;
|
||||
arrayTermType *arrayUnion;
|
||||
valueType *valueUnion;
|
||||
symbolTableEntryType *symbolTableUnion;
|
||||
conditionType conditionTypeUnion;
|
||||
void *expressionUnion; // this should be expressionTermType, but there's a cycle
|
||||
} expressionTermBodyType;
|
||||
|
||||
typedef struct expressionTermStruct {
|
||||
@ -763,6 +766,7 @@ typedef union {
|
||||
assertStatementBodyType *assertUnion;
|
||||
mswitchStatementBodyType *mswitchUnion;
|
||||
longStatementBodyType *longUnion;
|
||||
expressionType *expressionUnion;
|
||||
} statementBodyType;
|
||||
|
||||
typedef enum {
|
||||
@ -848,7 +852,7 @@ typedef struct {
|
||||
#if TARGET_CPU == CPU_6502
|
||||
#define CODE_BUFFERS_IN_ADDRESS_SPACE 64
|
||||
|
||||
#else if TARGET_CPU == CPU_68000
|
||||
#elif TARGET_CPU == CPU_68000
|
||||
#define CODE_BUFFERS_IN_ADDRESS_SPACE 256
|
||||
|
||||
#endif
|
||||
|
4
main.c
4
main.c
@ -13,7 +13,11 @@ main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
char end = get_end();
|
||||
#else
|
||||
extern char end;
|
||||
#endif
|
||||
char *sbrk();
|
||||
|
||||
fflush(stdout);
|
||||
|
6
malloc.c
6
malloc.c
@ -84,6 +84,9 @@ botch(s)
|
||||
#define ASSERT(p)
|
||||
#endif
|
||||
|
||||
static void morecore(int);
|
||||
static int findbucket(union overhead *, int);
|
||||
|
||||
char *
|
||||
malloc(nbytes)
|
||||
register unsigned nbytes;
|
||||
@ -135,7 +138,7 @@ malloc(nbytes)
|
||||
/*
|
||||
* Allocate more memory to the indicated bucket.
|
||||
*/
|
||||
static
|
||||
static void
|
||||
morecore(bucket)
|
||||
register bucket;
|
||||
{
|
||||
@ -184,6 +187,7 @@ morecore(bucket)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
free(cp)
|
||||
char *cp;
|
||||
{
|
||||
|
@ -8,14 +8,16 @@ SOURCES = builtins.c debugPrint.c errorStuff.c expr.c initialize.c\
|
||||
instantiate.c link.c main.c map.c poke.c read.c relocate.c slinkyTables.c\
|
||||
write.c slinkyExpressions.h slinkyGlobals.h slinkyTypes.h y.tab.h
|
||||
|
||||
CFLAGS=-m32 # slinky is not 64 bit clean
|
||||
|
||||
.c.o:
|
||||
cc -c -g $*.c
|
||||
cc $(CFLAGS) -c -g $*.c
|
||||
|
||||
.c.run:
|
||||
cc -o $* $*.c
|
||||
cc $(CFLAGS) -o $* $*.c
|
||||
|
||||
slinky: $(OBJECTS)
|
||||
cc -g -o slinky $(OBJECTS)
|
||||
cc $(CFLAGS) -g -o slinky $(OBJECTS)
|
||||
|
||||
update: .mark
|
||||
kessel "(cd /u0/chip/macross/slinky; make slinky >&errorfyle)" &
|
||||
|
@ -19,6 +19,7 @@ static bool insideConstraintBlock = FALSE;
|
||||
bool nullStatementFlag = FALSE;
|
||||
|
||||
#define nullAssemble(thing) if (thing==NULL) return;
|
||||
#define nullAssembleNULL(thing) if (thing==NULL) return NULL;
|
||||
#define sideEffectBomb() if (beneathFunction) {\
|
||||
error(SIDE_EFFECT_ERROR, currentFunctionName);\
|
||||
break; }
|
||||
@ -43,7 +44,7 @@ assembleBlockInsideIf(block, ongoingFixupList)
|
||||
{
|
||||
simpleFixupListType *assembleStatement();
|
||||
|
||||
nullAssemble(block);
|
||||
nullAssembleNULL(block);
|
||||
return(assembleStatement(block, TRUE, ongoingFixupList));
|
||||
}
|
||||
|
||||
@ -581,7 +582,7 @@ assembleIfStatement(ifStatement, terminalIf, ongoingFixupList)
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
nullAssemble(ifStatement);
|
||||
nullAssembleNULL(ifStatement);
|
||||
fixupLocation2 = ongoingFixupList;
|
||||
if (ifStatement->ifCondition != ALWAYS_COND && ifStatement->
|
||||
ifCondition != NEVER_COND) {
|
||||
@ -608,7 +609,7 @@ assembleIfStatement(ifStatement, terminalIf, ongoingFixupList)
|
||||
ifStatement->ifCondition != ALWAYS_COND) {
|
||||
expand((tabIndent(), moreText("} else ")));
|
||||
fixupLocation2 = assembleIfStatement(ifStatement->
|
||||
continuation, terminalIf, fixupLocation2);
|
||||
continuation.continuationBodyUnion, terminalIf, fixupLocation2);
|
||||
} else {
|
||||
expand((tabIndent(), moreText("}"), endLine()));
|
||||
}
|
||||
@ -647,7 +648,7 @@ assembleIfStatementOldStyle(ifStatement)
|
||||
fixupBranch(fixupLocation1, currentLocationCounter);
|
||||
if (ifStatement->continuation.continuationBodyUnion != NULL) {
|
||||
expand((tabIndent(), moreText("} else ")));
|
||||
assembleIfStatementOldStyle(ifStatement->continuation);
|
||||
assembleIfStatementOldStyle(ifStatement->continuation.continuationBodyUnion);
|
||||
} else {
|
||||
expand((tabIndent(), moreText("}"), endLine()));
|
||||
}
|
||||
@ -692,14 +693,14 @@ assembleInstructionStatement(instructionStatement, cumulativeLineNumber)
|
||||
cumulativeLineNumber);
|
||||
expand((startLine(), expandLabel(), tabIndent()));
|
||||
assembleMachineInstruction(instructionStatement->
|
||||
theInstruction, instructionStatement->theOperands);
|
||||
theInstruction.opcodeUnion, instructionStatement->theOperands);
|
||||
break;
|
||||
|
||||
case MACRO_INSTRUCTION:
|
||||
if (amListing() && !amExpanding())
|
||||
saveIndexForListing(INSTRUCTION_STATEMENT,
|
||||
cumulativeLineNumber);
|
||||
assembleMacro(instructionStatement->theInstruction,
|
||||
assembleMacro(instructionStatement->theInstruction.macroUnion,
|
||||
instructionStatement->theOperands);
|
||||
break;
|
||||
|
||||
@ -1256,128 +1257,128 @@ assembleStatementBody(kind, body, cumulativeLineNumber, worryAboutIf,
|
||||
|
||||
case ALIGN_STATEMENT:
|
||||
sideEffectBomb();
|
||||
assembleAlignStatement(body);
|
||||
assembleAlignStatement(body.alignUnion);
|
||||
if (amListing())
|
||||
saveIndexForListing(ALIGN_STATEMENT,
|
||||
cumulativeLineNumber);
|
||||
break;
|
||||
|
||||
case ASSERT_STATEMENT:
|
||||
assembleAssertStatement(body);
|
||||
assembleAssertStatement(body.assertUnion);
|
||||
break;
|
||||
|
||||
case BLOCK_STATEMENT:
|
||||
sideEffectBomb();
|
||||
assembleBlockStatement(body);
|
||||
assembleBlockStatement(body.blockUnion);
|
||||
break;
|
||||
|
||||
case BYTE_STATEMENT:
|
||||
sideEffectBomb();
|
||||
assembleByteStatement(body);
|
||||
assembleByteStatement(body.byteUnion);
|
||||
break;
|
||||
|
||||
case CONSTRAIN_STATEMENT:
|
||||
sideEffectBomb();
|
||||
assembleConstrainStatement(body);
|
||||
assembleConstrainStatement(body.constrainUnion);
|
||||
break;
|
||||
|
||||
case DBYTE_STATEMENT:
|
||||
sideEffectBomb();
|
||||
assembleDbyteStatement(body);
|
||||
assembleDbyteStatement(body.dbyteUnion);
|
||||
break;
|
||||
|
||||
case DEFINE_STATEMENT:
|
||||
sideEffectBomb();
|
||||
assembleDefineStatement(body);
|
||||
assembleDefineStatement(body.defineUnion);
|
||||
break;
|
||||
|
||||
case DO_UNTIL_STATEMENT:
|
||||
sideEffectBomb();
|
||||
assembleDoUntilStatement(body);
|
||||
assembleDoUntilStatement(body.doUntilUnion);
|
||||
break;
|
||||
|
||||
case DO_WHILE_STATEMENT:
|
||||
sideEffectBomb();
|
||||
assembleDoWhileStatement(body);
|
||||
assembleDoWhileStatement(body.doWhileUnion);
|
||||
break;
|
||||
|
||||
case EXTERN_STATEMENT:
|
||||
sideEffectBomb();
|
||||
assembleExternStatement(body);
|
||||
assembleExternStatement(body.externUnion);
|
||||
break;
|
||||
|
||||
case FRETURN_STATEMENT:
|
||||
assembleFreturnStatement(body);
|
||||
assembleFreturnStatement(body.freturnUnion);
|
||||
/* result = FALSE;*/
|
||||
break;
|
||||
|
||||
case FUNCTION_STATEMENT:
|
||||
assembleFunctionStatement(body);
|
||||
assembleFunctionStatement(body.functionUnion);
|
||||
break;
|
||||
|
||||
case GROUP_STATEMENT:
|
||||
assembleGroupStatement(body);
|
||||
assembleGroupStatement(body.groupUnion);
|
||||
break;
|
||||
|
||||
case IF_STATEMENT:
|
||||
sideEffectBomb();
|
||||
if (worryAboutIf) {
|
||||
*ifFixupList = assembleIfStatement(body, worryAboutIf,
|
||||
*ifFixupList = assembleIfStatement(body.ifUnion, worryAboutIf,
|
||||
*ifFixupList);
|
||||
} else {
|
||||
assembleIfStatement(body, worryAboutIf, NULL);
|
||||
assembleIfStatement(body.ifUnion, worryAboutIf, NULL);
|
||||
}
|
||||
break;
|
||||
|
||||
case INCLUDE_STATEMENT:
|
||||
sideEffectBomb();
|
||||
assembleIncludeStatement(body);
|
||||
assembleIncludeStatement(body.includeUnion);
|
||||
break;
|
||||
|
||||
case INSTRUCTION_STATEMENT:
|
||||
sideEffectBomb();
|
||||
assembleInstructionStatement(body, cumulativeLineNumber);
|
||||
assembleInstructionStatement(body.instructionUnion, cumulativeLineNumber);
|
||||
break;
|
||||
|
||||
case LONG_STATEMENT:
|
||||
sideEffectBomb();
|
||||
assembleLongStatement(body);
|
||||
assembleLongStatement(body.longUnion);
|
||||
break;
|
||||
|
||||
case MACRO_STATEMENT:
|
||||
assembleMacroStatement(body);
|
||||
assembleMacroStatement(body.macroUnion);
|
||||
break;
|
||||
|
||||
case MDEFINE_STATEMENT:
|
||||
assembleMdefineStatement(body);
|
||||
assembleMdefineStatement(body.defineUnion);
|
||||
break;
|
||||
|
||||
case MDO_UNTIL_STATEMENT:
|
||||
assembleMdoUntilStatement(body);
|
||||
assembleMdoUntilStatement(body.mdoUntilUnion);
|
||||
break;
|
||||
|
||||
case MDO_WHILE_STATEMENT:
|
||||
assembleMdoWhileStatement(body);
|
||||
assembleMdoWhileStatement(body.mdoWhileUnion);
|
||||
break;
|
||||
|
||||
case MFOR_STATEMENT:
|
||||
assembleMforStatement(body);
|
||||
assembleMforStatement(body.mforUnion);
|
||||
break;
|
||||
|
||||
case MIF_STATEMENT:
|
||||
assembleMifStatement(body, cumulativeLineNumber);
|
||||
assembleMifStatement(body.mifUnion, cumulativeLineNumber);
|
||||
break;
|
||||
|
||||
case MSWITCH_STATEMENT:
|
||||
assembleMswitchStatement(body);
|
||||
assembleMswitchStatement(body.mswitchUnion);
|
||||
break;
|
||||
|
||||
case MVARIABLE_STATEMENT:
|
||||
assembleMvariableStatement(body);
|
||||
assembleMvariableStatement(body.mvariableUnion);
|
||||
break;
|
||||
|
||||
case MWHILE_STATEMENT:
|
||||
assembleMwhileStatement(body);
|
||||
assembleMwhileStatement(body.mwhileUnion);
|
||||
break;
|
||||
|
||||
case NULL_STATEMENT:
|
||||
@ -1388,61 +1389,61 @@ assembleStatementBody(kind, body, cumulativeLineNumber, worryAboutIf,
|
||||
|
||||
case ORG_STATEMENT:
|
||||
sideEffectBomb();
|
||||
assembleOrgStatement(body);
|
||||
assembleOrgStatement(body.orgUnion);
|
||||
if (amListing())
|
||||
saveIndexForListing(ORG_STATEMENT,
|
||||
cumulativeLineNumber);
|
||||
break;
|
||||
|
||||
case PERFORM_STATEMENT:
|
||||
assemblePerformStatement(body);
|
||||
assemblePerformStatement(body.performUnion);
|
||||
break;
|
||||
|
||||
case REL_STATEMENT:
|
||||
sideEffectBomb();
|
||||
assembleRelStatement(body);
|
||||
assembleRelStatement(body.relUnion);
|
||||
if (amListing())
|
||||
saveIndexForListing(REL_STATEMENT,
|
||||
cumulativeLineNumber);
|
||||
break;
|
||||
|
||||
case START_STATEMENT:
|
||||
assembleStartStatement(body);
|
||||
assembleStartStatement(body.startUnion);
|
||||
break;
|
||||
|
||||
case STRING_STATEMENT:
|
||||
sideEffectBomb();
|
||||
assembleStringStatement(body);
|
||||
assembleStringStatement(body.stringUnion);
|
||||
break;
|
||||
|
||||
case STRUCT_STATEMENT:
|
||||
sideEffectBomb();
|
||||
assembleStructStatement(body);
|
||||
assembleStructStatement(body.structUnion);
|
||||
break;
|
||||
|
||||
case TARGET_STATEMENT:
|
||||
sideEffectBomb();
|
||||
assembleTargetStatement(body);
|
||||
assembleTargetStatement(body.targetUnion);
|
||||
break;
|
||||
|
||||
case UNDEFINE_STATEMENT:
|
||||
sideEffectBomb();
|
||||
assembleUndefineStatement(body);
|
||||
assembleUndefineStatement(body.undefineUnion);
|
||||
break;
|
||||
|
||||
case VARIABLE_STATEMENT:
|
||||
sideEffectBomb();
|
||||
assembleVariableStatement(body);
|
||||
assembleVariableStatement(body.variableUnion);
|
||||
break;
|
||||
|
||||
case WHILE_STATEMENT:
|
||||
sideEffectBomb();
|
||||
assembleWhileStatement(body);
|
||||
assembleWhileStatement(body.whileUnion);
|
||||
break;
|
||||
|
||||
case WORD_STATEMENT:
|
||||
sideEffectBomb();
|
||||
assembleWordStatement(body);
|
||||
assembleWordStatement(body.wordUnion);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user