mirror of
https://github.com/Museum-of-Art-and-Digital-Entertainment/macross.git
synced 2024-12-26 08:29:27 +00:00
Remove all warnings that aren't int- or pointer-conversion
This commit is contained in:
parent
3e49dc61f0
commit
77e0ca2578
80
buildStuff.h
Normal file
80
buildStuff.h
Normal file
@ -0,0 +1,80 @@
|
||||
#ifndef BUILD_STUFF_H_
|
||||
#define BUILD_STUFF_H_
|
||||
|
||||
#include "macrossTypes.h"
|
||||
|
||||
/* buildStuff1.c */
|
||||
statementType *newStatement (statementKindType kind, statementBodyType body);
|
||||
statementType *buildAlignStatement (expressionType *expression);
|
||||
statementType *buildAssertStatement (expressionType *condition, expressionType *message);
|
||||
statementType *buildBlockStatement (expressionListType *expressionList);
|
||||
statementType *buildByteStatement (expressionListType *expressionList);
|
||||
statementType *buildConstrainStatement (expressionType *expression, blockType *block);
|
||||
statementType *buildDbyteStatement (expressionListType *expressionList);
|
||||
statementType *buildDefineStatement (stringType *name, expressionType *value);
|
||||
statementType *buildDoUntilStatement (blockType *body, conditionType condition);
|
||||
statementType *buildDoWhileStatement (blockType *body, conditionType condition);
|
||||
statementType *buildDoStatement (blockType *body, doEndType *end);
|
||||
statementType *buildExternStatement (identifierListType *identifierList);
|
||||
statementType *buildFreturnStatement (expressionType *expression);
|
||||
statementType *buildFunctionStatement (stringType *name, argumentDefinitionListType *arguments, blockType *body);
|
||||
statementType *buildGroupStatement (blockType *block);
|
||||
statementType *buildIfStatement (ifHeadType *head, ifContinuationType continuation, ifContinuationKindType continuationKind);
|
||||
statementType *buildIncludeStatement (expressionType *filename);
|
||||
statementType *buildInstructionStatement (opcodeTableEntryType *opcode, operandListType *operands);
|
||||
statementType *buildLongStatement (expressionListType *expressionList);
|
||||
statementType *buildMacroStatement (macroTableEntryType *macro, argumentDefinitionListType *arguments, blockType *body);
|
||||
statementType *buildMacroInstructionStatement (macroTableEntryType *macro, operandListType *operands);
|
||||
statementType *buildMdefineStatement (stringType *name, expressionType *value);
|
||||
statementType *buildMdoUntilStatement (blockType *body, struct expressionTermStruct *condition);
|
||||
statementType *buildMdoWhileStatement (blockType *body, expressionType *condition);
|
||||
statementType *buildMdoStatement (blockType *body, mdoEndType *end);
|
||||
statementType *buildMforStatement (forExpressionsType *forExpressions, blockType *body);
|
||||
statementType *buildMifStatement (mifHeadType *head, mifContinuationType continuation, ifContinuationKindType continuationKind);
|
||||
statementType *buildMswitchStatement (expressionType *switchExpression, caseListType *cases);
|
||||
statementType *buildMvariableStatement (stringType *name, expressionListType *value, expressionType *dimension);
|
||||
statementType *buildMwhileStatement (expressionType *condition, blockType *body);
|
||||
statementType *buildNullStatement (void);
|
||||
statementType *buildOrgStatement (expressionType *expression);
|
||||
statementType *buildPerformStatement (expressionType *expression);
|
||||
statementType *buildRelStatement (void);
|
||||
statementType *buildStartStatement (expressionType *expression);
|
||||
statementType *buildStringStatement (expressionListType *expressionList);
|
||||
statementType *buildStructStatement (symbolTableEntryType *name, blockType *body);
|
||||
statementType *buildTargetStatement (expressionType *expression);
|
||||
statementType *buildUndefineStatement (identifierListType *identifierList);
|
||||
statementType *buildVariableStatement (stringType *name, expressionListType *value, expressionType *dimension);
|
||||
statementType *buildWhileStatement (conditionType condition, blockType *body);
|
||||
statementType *buildWordStatement (expressionListType *expressionList);
|
||||
|
||||
/* buildStuff2.c */
|
||||
caseType *buildCase (expressionListType *caseTags, blockType *caseBody);
|
||||
doEndType *buildDoEnd (conditionType condition, doEndKindType kindOfDoEnd);
|
||||
forExpressionsType *buildForExpressions (expressionType *initExpression, expressionType *testExpression, expressionType *incrExpression);
|
||||
ifHeadType *buildIfHead (conditionType condition, blockType *block);
|
||||
mdoEndType *buildMdoEnd (expressionType *condition, doEndKindType kindOfMdoEnd);
|
||||
mifHeadType *buildMifHead (expressionType *condition, blockType *block);
|
||||
arrayTermType *buildArrayTerm (expressionType *array, expressionType *index);
|
||||
binopTermType *buildBinopTerm (binopKindType binop, expressionType *leftArgument, expressionType *rightArgument);
|
||||
functionCallTermType *buildFunctionCall (stringType *functionName, operandListType *arguments);
|
||||
postOpTermType *buildPostOpTerm (postOpKindType postOp, expressionType *postOpArgument);
|
||||
preOpTermType *buildPreOpTerm (preOpKindType preOp, expressionType *preOpArgument);
|
||||
unopTermType *buildUnopTerm (unopKindType unop, expressionType *unopArgument);
|
||||
expressionTermType *buildExpressionTerm (expressionTermKindType kindOfExpressionTerm, anyOldThing *arg1, anyOldThing *arg2, anyOldThing *arg3);
|
||||
macroTableEntryType *buildMacroTableEntry (stringType *name);
|
||||
symbolTableEntryType *buildSymbolTableEntry (stringType *name, symbolUsageKindType usage);
|
||||
codeBreakType *buildCodeBreak (codeBreakKindType kind, addressType address, int data);
|
||||
reservationListType *buildReservation (addressType startAddress, int blockSize, reservationListType *nextReservation);
|
||||
simpleFixupListType *buildSimpleFixupList (valueType locationToFixup, simpleFixupListType *previousList);
|
||||
|
||||
/* buildStuff3.c */
|
||||
argumentListHeadType *buildArgumentList (stringType *new, argumentListHeadType *rest, bool arrayTag);
|
||||
caseListHeadType *buildCaseList (caseType *new, caseListHeadType *rest);
|
||||
expressionListHeadType *buildExpressionList (expressionType *new, expressionListHeadType *rest);
|
||||
identifierListHeadType *buildIdentifierList (stringType *new, identifierListHeadType *rest, symbolUsageKindType usage);
|
||||
labelListHeadType *buildLabelList (symbolTableEntryType *new, labelListHeadType *rest);
|
||||
operandListHeadType *buildOperandList (operandType *new, operandListHeadType *rest);
|
||||
selectionListHeadType *buildSelectionList (selectionListType *new, selectionListHeadType *rest);
|
||||
statementListHeadType *buildStatementList (statementType *new, statementListHeadType *rest);
|
||||
|
||||
#endif
|
16
errorStuff.h
Normal file
16
errorStuff.h
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef ERROR_STUFF_H_
|
||||
#define ERROR_STUFF_H_
|
||||
|
||||
void puntOnError (errorType theError, ...);
|
||||
void printErrorMessage (errorType theError, va_list ap);
|
||||
void error (errorType theError, ...);
|
||||
void verror (errorType theError, va_list ap);
|
||||
void warning (errorType theError, ...);
|
||||
void fatalError (errorType theError, ...);
|
||||
void fatalSystemError (errorType theError, ...);
|
||||
void yyerror (char *s);
|
||||
char *usageString (symbolUsageKindType usageKind);
|
||||
char *valueKindString (valueKindType valueKind);
|
||||
char *assignmentString (assignmentKindType assignment);
|
||||
|
||||
#endif
|
32
lexer.h
Normal file
32
lexer.h
Normal file
@ -0,0 +1,32 @@
|
||||
#ifndef LEXER_H_
|
||||
#define LEXER_H_
|
||||
|
||||
int yylex (void);
|
||||
int lexer (void);
|
||||
void initializeLexDispatchTable (void);
|
||||
bool isMacrossLiteralCharacter (char c);
|
||||
void snarfAlphanumericString (char c, char *buffer);
|
||||
int lexIdentifier (char c);
|
||||
int lexNumber (char c);
|
||||
int fancyAtoI (char *buffer, int base);
|
||||
int digitValue (char c);
|
||||
int lexLiteral (char c);
|
||||
int lexCharacterConstant (void);
|
||||
int getStringCharacter (FILE *input);
|
||||
int lexStringConstant (void);
|
||||
int lexOperator (char firstC);
|
||||
char controlCharacter (char c);
|
||||
char skipWhitespaceAndComments (void);
|
||||
int popInputFileStack (void);
|
||||
void pushInputFileStack (stringType *fileName);
|
||||
void resynchronizeInput (void);
|
||||
void saveLineForListing (stringType *line);
|
||||
void saveEOLForListing (void);
|
||||
void saveIndexForListing (statementKindType kindOfStatement, int cumulativeLineNumber);
|
||||
void saveEndMifForListing (int cumulativeLineNumber);
|
||||
void saveListingOff (void);
|
||||
void saveListingOn (void);
|
||||
char *myfgets (char *buffer, int length, FILE *stream);
|
||||
int readAnotherLine (void);
|
||||
|
||||
#endif
|
27
lookups.h
Normal file
27
lookups.h
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef LOOKUPS_H_
|
||||
#define LOOKUPS_H_
|
||||
|
||||
conditionType lookupConditionCode (char *s, int hashValue);
|
||||
int lookupKeyword (char *s, int hashValue);
|
||||
macroTableEntryType *lookupMacroName (char *s, int hashValue);
|
||||
opcodeTableEntryType *lookupOpcode (char *s, int hashValue);
|
||||
symbolTableEntryType *lookupOrEnterSymbol (stringType *s, symbolUsageKindType kind);
|
||||
void pushSymbol (symbolTableEntryType *symbol);
|
||||
void popSymbol (symbolTableEntryType *symbol);
|
||||
macroTableEntryType *createMacro (stringType *macroName);
|
||||
genericTableEntryType *prehashedStringLookup (char *s, genericTableEntryType **table, int hashValue);
|
||||
genericTableEntryType *hashStringLookup (char *s, genericTableEntryType **table);
|
||||
genericTableEntryType *hashStringEnter (genericTableEntryType *entry, genericTableEntryType **table);
|
||||
int hashString (char *s);
|
||||
bool strcmplc (char *s1, char *s2);
|
||||
bool strcmplct (char *s1, char *s2);
|
||||
void purgeSymbol (symbolTableEntryType *symbol);
|
||||
void reincarnateSymbol (symbolInContextType *context, symbolUsageKindType newUsage);
|
||||
void pushBinding (symbolTableEntryType *symbol, valueType *newBinding, symbolUsageKindType newUsage);
|
||||
void popBinding (symbolTableEntryType *symbol);
|
||||
int bindMacroArguments (argumentDefinitionListType *argumentList, operandListType *parameterList, stringType *macroName);
|
||||
int bindFunctionArguments (argumentDefinitionListType *argumentList, operandListType *parameterList, stringType *functionName);
|
||||
void unbindArguments (argumentDefinitionListType *argumentList, int numberToUnbind);
|
||||
void unbindLocalVariables (identifierListType *identifierList);
|
||||
|
||||
#endif
|
100
macross_6502.y
100
macross_6502.y
@ -31,6 +31,14 @@
|
||||
|
||||
#include "macrossTypes.h"
|
||||
#include "macrossGlobals.h"
|
||||
#include "buildStuff.h"
|
||||
#include "errorStuff.h"
|
||||
#include "lexer.h"
|
||||
#include "lookups.h"
|
||||
#include "operandStuff.h"
|
||||
#include "parserMisc.h"
|
||||
#include "semanticMisc.h"
|
||||
#include "statementSemantics.h"
|
||||
|
||||
%}
|
||||
|
||||
@ -119,7 +127,8 @@ eolList: EOL
|
||||
statementList: statement
|
||||
{
|
||||
if (statementListNestingDepth == 0) {
|
||||
$$ = eatStatement($1);
|
||||
eatStatement($1);
|
||||
$$ = NULL;
|
||||
} else {
|
||||
$$ = buildStatementList($1, NULL);
|
||||
}
|
||||
@ -127,7 +136,8 @@ statementList: statement
|
||||
| statementList EOL statement
|
||||
{
|
||||
if (statementListNestingDepth == 0) {
|
||||
$$ = eatStatement($3);
|
||||
eatStatement($3);
|
||||
$$ = NULL;
|
||||
} else {
|
||||
$$ = buildStatementList($3, $1);
|
||||
}
|
||||
@ -223,15 +233,21 @@ labelableStatement:
|
||||
|
||||
ifStatement: IF _ ifHead
|
||||
{
|
||||
$$ = buildIfStatement($3, NULL, NO_CONTINUATION);
|
||||
ifContinuationType noCont;
|
||||
noCont.blockUnion=NULL;
|
||||
$$ = buildIfStatement($3, noCont, NO_CONTINUATION);
|
||||
}
|
||||
| IF _ ifHead elsePart
|
||||
{
|
||||
$$ = buildIfStatement($3, $4, ELSE_CONTINUATION);
|
||||
ifContinuationType cont;
|
||||
cont.blockUnion=$4;
|
||||
$$ = buildIfStatement($3, cont, ELSE_CONTINUATION);
|
||||
}
|
||||
| IF _ ifHead elseIf
|
||||
{
|
||||
$$ = buildIfStatement($3, $4, ELSEIF_CONTINUATION);
|
||||
ifContinuationType cont;
|
||||
cont.blockUnion=$4;
|
||||
$$ = buildIfStatement($3, cont, ELSEIF_CONTINUATION);
|
||||
}
|
||||
;
|
||||
|
||||
@ -271,15 +287,21 @@ elseIf: ELSE _ ifStatement
|
||||
}
|
||||
| ELSEIF _ ifHead
|
||||
{
|
||||
$$ = extractIfBody(buildIfStatement($3, NULL, NO_CONTINUATION));
|
||||
ifContinuationType noCont;
|
||||
noCont.blockUnion = NULL;
|
||||
$$ = extractIfBody(buildIfStatement($3, noCont, NO_CONTINUATION));
|
||||
}
|
||||
| ELSEIF _ ifHead elsePart
|
||||
{
|
||||
$$ = extractIfBody(buildIfStatement($3, $4, ELSE_CONTINUATION));
|
||||
ifContinuationType cont;
|
||||
cont.blockUnion = $4;
|
||||
$$ = extractIfBody(buildIfStatement($3, cont, ELSE_CONTINUATION));
|
||||
}
|
||||
| ELSEIF _ ifHead elseIf
|
||||
{
|
||||
$$ = extractIfBody(buildIfStatement($3, $4, ELSEIF_CONTINUATION));
|
||||
ifContinuationType cont;
|
||||
cont.blockUnion = $4;
|
||||
$$ = extractIfBody(buildIfStatement($3, cont, ELSEIF_CONTINUATION));
|
||||
}
|
||||
;
|
||||
|
||||
@ -657,15 +679,21 @@ macroDefineStatement:
|
||||
macroIfStatement:
|
||||
MIF _ mIfHead
|
||||
{
|
||||
$$ = buildMifStatement($3, NULL, NO_CONTINUATION);
|
||||
mifContinuationType noCont;
|
||||
noCont.mifBlockUnion = NULL;
|
||||
$$ = buildMifStatement($3, noCont, NO_CONTINUATION);
|
||||
}
|
||||
| MIF _ mIfHead mElsePart
|
||||
{
|
||||
$$ = buildMifStatement($3, $4, ELSE_CONTINUATION);
|
||||
mifContinuationType cont;
|
||||
cont.mifBlockUnion = $4;
|
||||
$$ = buildMifStatement($3, cont, ELSE_CONTINUATION);
|
||||
}
|
||||
| MIF _ mIfHead mElseIf
|
||||
{
|
||||
$$ = buildMifStatement($3, $4, ELSEIF_CONTINUATION);
|
||||
mifContinuationType cont;
|
||||
cont.mifBlockUnion = $4;
|
||||
$$ = buildMifStatement($3, cont, ELSEIF_CONTINUATION);
|
||||
}
|
||||
;
|
||||
|
||||
@ -693,15 +721,21 @@ mElseIf: MELSE _ macroIfStatement
|
||||
}
|
||||
| MELSEIF _ mIfHead
|
||||
{
|
||||
$$ = extractMifBody(buildMifStatement($3, NULL, NO_CONTINUATION));
|
||||
mifContinuationType noCont;
|
||||
noCont.mifBlockUnion = NULL;
|
||||
$$ = extractMifBody(buildMifStatement($3, noCont, NO_CONTINUATION));
|
||||
}
|
||||
| MELSEIF _ mIfHead mElsePart
|
||||
{
|
||||
$$ = extractMifBody(buildMifStatement($3, $4, ELSE_CONTINUATION));
|
||||
mifContinuationType cont;
|
||||
cont.mifBlockUnion = $4;
|
||||
$$ = extractMifBody(buildMifStatement($3, cont, ELSE_CONTINUATION));
|
||||
}
|
||||
| MELSEIF _ mIfHead mElseIf
|
||||
{
|
||||
$$ = extractMifBody(buildMifStatement($3, $4, ELSEIF_CONTINUATION));
|
||||
mifContinuationType cont;
|
||||
cont.mifBlockUnion = $4;
|
||||
$$ = extractMifBody(buildMifStatement($3, cont, ELSEIF_CONTINUATION));
|
||||
}
|
||||
;
|
||||
|
||||
@ -943,18 +977,18 @@ selectionList: SELECT _ Identifier
|
||||
|
||||
array: variable '[' _ expression _ ']'
|
||||
{
|
||||
$$ = buildExpressionTerm(ARRAY_EXPR, $1, $4);
|
||||
$$ = buildExpressionTerm(ARRAY_EXPR, $1, $4, NULL);
|
||||
}
|
||||
| array '[' _ expression _ ']'
|
||||
{
|
||||
$$ = buildExpressionTerm(ARRAY_EXPR, $1, $4);
|
||||
$$ = buildExpressionTerm(ARRAY_EXPR, $1, $4, NULL);
|
||||
}
|
||||
;
|
||||
|
||||
variable: Identifier
|
||||
{
|
||||
$$ = buildExpressionTerm(IDENTIFIER_EXPR, lookupOrEnterSymbol($1,
|
||||
unknownSymbolTag));
|
||||
unknownSymbolTag), NULL, NULL);
|
||||
}
|
||||
;
|
||||
|
||||
@ -968,47 +1002,47 @@ expression: lvalue
|
||||
}
|
||||
| functionCall
|
||||
{
|
||||
$$ = buildExpressionTerm(FUNCTION_CALL_EXPR, $1);
|
||||
$$ = buildExpressionTerm(FUNCTION_CALL_EXPR, $1, NULL, NULL);
|
||||
}
|
||||
| Number
|
||||
{
|
||||
$$ = buildExpressionTerm(NUMBER_EXPR, $1);
|
||||
$$ = buildExpressionTerm(NUMBER_EXPR, $1, NULL, NULL);
|
||||
}
|
||||
| ConditionCode
|
||||
{
|
||||
$$ = buildExpressionTerm(CONDITION_CODE_EXPR, $1);
|
||||
$$ = buildExpressionTerm(CONDITION_CODE_EXPR, $1, NULL, NULL);
|
||||
}
|
||||
| HERE
|
||||
{
|
||||
$$ = buildExpressionTerm(HERE_EXPR);
|
||||
$$ = buildExpressionTerm(HERE_EXPR, NULL, NULL, NULL);
|
||||
}
|
||||
| TextString
|
||||
{
|
||||
$$ = buildExpressionTerm(STRING_EXPR, $1);
|
||||
$$ = buildExpressionTerm(STRING_EXPR, $1, NULL, NULL);
|
||||
}
|
||||
| '(' _ expression _ ')'
|
||||
{
|
||||
$$ = buildExpressionTerm(SUBEXPRESSION_EXPR, $3);
|
||||
$$ = buildExpressionTerm(SUBEXPRESSION_EXPR, $3, NULL, NULL);
|
||||
}
|
||||
| SUB _ expression %prec UNARY_MINUS
|
||||
{
|
||||
$$ = buildExpressionTerm(UNOP_EXPR, UNARY_MINUS, $3);
|
||||
$$ = buildExpressionTerm(UNOP_EXPR, UNARY_MINUS, $3, NULL);
|
||||
}
|
||||
| LOGICAL_NOT _ expression
|
||||
{
|
||||
$$ = buildExpressionTerm(UNOP_EXPR, LOGICAL_NOT, $3);
|
||||
$$ = buildExpressionTerm(UNOP_EXPR, LOGICAL_NOT, $3, NULL);
|
||||
}
|
||||
| BITWISE_NOT _ expression
|
||||
{
|
||||
$$ = buildExpressionTerm(UNOP_EXPR, BITWISE_NOT, $3);
|
||||
$$ = buildExpressionTerm(UNOP_EXPR, BITWISE_NOT, $3, NULL);
|
||||
}
|
||||
| DIV _ expression %prec LO_BYTE
|
||||
{
|
||||
$$ = buildExpressionTerm(UNOP_EXPR, LO_BYTE, $3);
|
||||
$$ = buildExpressionTerm(UNOP_EXPR, LO_BYTE, $3, NULL);
|
||||
}
|
||||
| HI_BYTE _ expression
|
||||
{
|
||||
$$ = buildExpressionTerm(UNOP_EXPR, HI_BYTE, $3);
|
||||
$$ = buildExpressionTerm(UNOP_EXPR, HI_BYTE, $3, NULL);
|
||||
}
|
||||
| expression MUL _ expression
|
||||
{
|
||||
@ -1052,7 +1086,7 @@ expression: lvalue
|
||||
}
|
||||
| expression GREATER_THAN_OR_EQUAL_TO _ expression
|
||||
{
|
||||
$$ = buildExpressionTerm(BINOP_EXPR, GREATER_THAN_OR_EQUAL_TO, $1,$4);
|
||||
$$ = buildExpressionTerm(BINOP_EXPR, GREATER_THAN_OR_EQUAL_TO, $1, $4);
|
||||
}
|
||||
| expression EQUAL_TO _ expression
|
||||
{
|
||||
@ -1097,19 +1131,19 @@ expression: lvalue
|
||||
}
|
||||
| lvalue INCREMENT
|
||||
{
|
||||
$$ = buildExpressionTerm(POSTOP_EXPR, INCREMENT, $1);
|
||||
$$ = buildExpressionTerm(POSTOP_EXPR, INCREMENT, $1, NULL);
|
||||
}
|
||||
| lvalue DECREMENT
|
||||
{
|
||||
$$ = buildExpressionTerm(POSTOP_EXPR, DECREMENT, $1);
|
||||
$$ = buildExpressionTerm(POSTOP_EXPR, DECREMENT, $1, NULL);
|
||||
}
|
||||
| INCREMENT _ lvalue
|
||||
{
|
||||
$$ = buildExpressionTerm(PREOP_EXPR, INCREMENT, $3);
|
||||
$$ = buildExpressionTerm(PREOP_EXPR, INCREMENT, $3, NULL);
|
||||
}
|
||||
| DECREMENT _ lvalue
|
||||
{
|
||||
$$ = buildExpressionTerm(PREOP_EXPR, DECREMENT, $3);
|
||||
$$ = buildExpressionTerm(PREOP_EXPR, DECREMENT, $3, NULL);
|
||||
}
|
||||
;
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define PARSER_MISC_H_
|
||||
#include "macrossTypes.h"
|
||||
|
||||
statementType *addLabelToSatement(labelListType *labelList, statementType *statement);
|
||||
statementType *addLabelToStatement(labelListType *labelList, statementType *statement);
|
||||
void botch(char *message, ...);
|
||||
void checkDefineAssignmentOperator(assignmentKindType assignmentOperator);
|
||||
void convertDefineToMDefine(statementType *defineStatement);
|
||||
|
Loading…
Reference in New Issue
Block a user