Full header information extracted from gcc -aux-info

This commit is contained in:
Michael Martin 2016-01-23 18:38:39 -08:00
parent 7e126cbfe6
commit a98186c8f5
20 changed files with 482 additions and 88 deletions

29
actions.h Normal file
View File

@ -0,0 +1,29 @@
#ifndef ACTIONS_H_
#define ACTIONS_H_
#include "macrossTypes.h"
void actionsDir1(opcodeTableEntryType *opcode, int numberOfOperands, valueType **evaluatedOperands);
void actionsDir2(opcodeTableEntryType *opcode, int numberOfOperands, valueType **evaluatedOperands);
void actionsDirIndir(opcodeTableEntryType *opcode, int numberOfOperands, valueType **evaluatedOperands);
void actionsDirX1(opcodeTableEntryType *opcode, int numberOfOperands, valueType **evaluatedOperands);
void actionsDirX2(opcodeTableEntryType *opcode, int numberOfOperands, valueType **evaluatedOperands);
void actionsDirX3(opcodeTableEntryType *opcode, int numberOfOperands, valueType **evaluatedOperands);
void actionsDirY(opcodeTableEntryType *opcode, int numberOfOperands, valueType **evaluatedOperands);
void actionsImmDir(opcodeTableEntryType *opcode, int numberOfOperands, valueType **evaluatedOperands);
void actionsImmDirX(opcodeTableEntryType *opcode, int numberOfOperands, valueType **evaluatedOperands);
void actionsImmDirY(opcodeTableEntryType *opcode, int numberOfOperands, valueType **evaluatedOperands);
void actionsImmIndex(opcodeTableEntryType *opcode, int numberOfOperands, valueType **evaluatedOperands);
void actionsIndex(opcodeTableEntryType *opcode, int numberOfOperands, valueType **evaluatedOperands);
void actionsNone(opcodeTableEntryType *opcode, int numberOfOperands, valueType **evaluatedOperands);
void actionsRelative(opcodeTableEntryType *opcode, int numberOfOperands, valueType **evaluatedOperands);
bool isByte(int value);
bool isByteOffset(int value);
bool isWordOffset(int value);
bool isByteAddress(valueType *value);
bool isWord(int value);
bool byteCheck(int value);
bool wordCheck(int value);
bool isDefined(valueType *value);
#endif

63
builtInFunctions.h Normal file
View File

@ -0,0 +1,63 @@
#ifndef BUILT_IN_FUNCTIONS_H_
#define BUILT_IN_FUNCTIONS_H_
#include "macrossTypes.h"
/* Platform-independent */
valueType *makeBooleanValue(int test);
valueType *makeFailureValue(void);
valueType *makeIntegerValue(int integer);
valueType *makeOperandValue(operandType *operand);
valueType *makeStringValue(stringType *string);
valueType *makeUndefinedValue(void);
valueType *addressModeBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *applyBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *arrayLengthBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *atasciiBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *atasciiColorBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *debugModeOffBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *debugModeOnBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *emitModeOffBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *emitModeOnBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *isAbsoluteValueBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *isBlockBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *isBuiltInFunctionBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *isConditionCodeBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *isDefinedBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *isExternalBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *isFieldBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *isFunctionBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *isRelocatableValueBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *isStringBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *isStructBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *isSymbolBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *listingOffBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *listingOnBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *makeArrayBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *nthCharBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *printfBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *strcatBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *strcmpBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *strcmplcBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *strlenBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *substrBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *symbolLookupBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *symbolDefineBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *symbolNameBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *symbolUsageBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *valueTypeBIF(operandListType *parameterList, fixupKindType kindOfFixup);
/* 6502-specific */
valueType *isARegisterBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *isDirectModeBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *isImmediateModeBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *isIndexedModeBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *isIndirectModeBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *isPostIndexedModeBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *isPreIndexedModeBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *isXIndexedModeBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *isXRegisterBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *isYIndexedModeBIF(operandListType *parameterList, fixupKindType kindOfFixup);
valueType *isYRegisterBIF(operandListType *parameterList, fixupKindType kindOfFixup);
#endif

86
debugPrint.h Normal file
View File

@ -0,0 +1,86 @@
#ifndef DEBUG_PRINT_H_
#define DEBUG_PRINT_H_
#include "macrossTypes.h"
/* Platform-independent */
void tab(void);
void printAssignmentKind(assignmentKindType assignmentKind);
void printExpressionKind(expressionTermKindType kind);
stringType *statementKindString(statementKindType kind);
void printStatementKind(statementKindType kind);
void printValue(valueType *value);
void printSymbol(symbolTableEntryType *symbol);
void printArgumentDefinitionList(argumentDefinitionListType *list);
void printBlock(blockType *block);
void printArrayTerm(arrayTermType *arrayTerm);
void printAssignmentTerm(binopTermType *assignmentTerm);
void printBinopTerm(binopTermType *binopTerm);
void printFunctionCall(functionCallTermType *functionCall);
void printHere(void);
void printIdentifier(symbolTableEntryType *identifier);
void printNumber(numberTermType number);
void printPostopTerm(postOpTermType *postopTerm);
void printPreopTerm(preOpTermType *preopTerm);
void printUnopTerm(unopTermType *unopTerm);
void printExpression(expressionType *expression);
void printExpressionList(expressionListType *expressionList);
void printIdentifierList(identifierListType *identifierList);
void printCase(caseType *aCase);
void printCaseList(caseListType *caseList);
void printMacro(macroTableEntryType *macroInstruction);
void printOpcode(opcodeTableEntryType *opcode);
void printOperandList(operandListType *operandList);
void printAlignStatement(alignStatementBodyType *alignStatement);
void printAssertStatement(assertStatementBodyType *assertStatement);
void printBlockStatement(blockStatementBodyType *blockStatement);
void printByteStatement(byteStatementBodyType *byteStatement);
void printConstrainStatement(constrainStatementBodyType *constrainStatement);
void printDbyteStatement(dbyteStatementBodyType *dbyteStatement);
void printDefineStatement(defineStatementBodyType *defineStatement);
void printDoUntilStatement(doUntilStatementBodyType *doUntilStatement);
void printDoWhileStatement(doWhileStatementBodyType *doWhileStatement);
void printExternStatement(externStatementBodyType *externStatement);
void printFreturnStatement(freturnStatementBodyType *freturnStatement);
void printFunctionStatement(functionStatementBodyType *functionStatement);
void printIfStatement(ifStatementBodyType *ifStatement);
void printIncludeStatement(includeStatementBodyType *includeStatement);
void printInstructionStatement(instructionStatementBodyType *instructionStatement);
void printLongStatement(longStatementBodyType *longStatement);
void printMacroStatement(macroStatementBodyType *macroStatement);
void printMdefineStatement(defineStatementBodyType *mdefineStatement);
void printMdoUntilStatement(mdoUntilStatementBodyType *mdoUntilStatement);
void printMdoWhileStatement(mdoWhileStatementBodyType *mdoWhileStatement);
void printMforStatement(mforStatementBodyType *mforStatement);
void printMifStatement(mifStatementBodyType *mifStatement);
void printMswitchStatement(mswitchStatementBodyType *mswitchStatement);
void printMvariableStatement(mvariableStatementBodyType *mvariableStatement);
void printMwhileStatement(mwhileStatementBodyType *mwhileStatement);
void printOrgStatement(orgStatementBodyType *orgStatement);
void printPerformStatement(performStatementBodyType *performStatement);
void printRelStatement(relStatementBodyType *relStatement);
void printStartStatement(startStatementBodyType *startStatement);
void printStringStatement(stringStatementBodyType *stringStatement);
void printStructStatement(structStatementBodyType *structStatement);
void printTargetStatement(targetStatementBodyType *targetStatement);
void printUndefineStatement(undefineStatementBodyType *undefineStatement);
void printVariableStatement(variableStatementBodyType *variableStatement);
void printWhileStatement(whileStatementBodyType *whileStatement);
void printWordStatement(wordStatementBodyType *wordStatement);
void printLabelList(labelListType *labelList);
void printStatementBody(statementKindType kind, statementBodyType body);
void printStatement(statementType *statement);
void printPendingFixupList(fixupListType *fixupList);
void printCreateFixup(expressionType *expression, addressType location, fixupKindType kindOfFixup);
void printExpressionBuffer(void);
void printOneCodeBuffer(codeSegmentType *codeSegment, int bufferNum);
void printCodeBufferSection(codeRegionType *codeBufferSection);
void printCodeBuffers(void);
/* Platform-specific */
void printCondition(conditionType condition);
void printOperandKind(operandKindType kind);
void printToken(int token);
void printOperand(operandType *operand);
#endif

View File

@ -3,14 +3,7 @@
#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

27
emitStuff.h Normal file
View File

@ -0,0 +1,27 @@
#ifndef EMIT_STUFF_H_
#define EMIT_STUFF_H_
#include "macrossTypes.h"
void incarnateCodeBuffer(int bufferNum, codeBufferKindType bufferKind);
void putByte(addressType address, byte byteValue);
void mapByte(int address, byte byteValue);
void emitByte(byte byteValue);
void emitWord(wordType wordValue);
void emitLong(longType longValue);
void emitByteValue(valueType *byteValue);
void emitString(stringType *string);
void emitWordValue(valueType *wordValue);
void emitLongValue(valueType *longValue);
void pokeByteValue(addressType location, valueType *value);
void pokeWordValue(addressType location, valueType *value);
void pokeLongValue(addressType location, valueType *value);
void pokeRelativeByteValue(addressType location, valueType *value);
void pokeRelativeWordValue(addressType location, valueType *value);
byte getByte(addressType address);
void emitRelativeByteOffset(valueType *target);
void emitRelativeWordOffset(valueType *target);
void fixupBranch(valueType *location, valueType target);
void fixupJump(simpleFixupListType *locations, valueType target);
#endif

37
encode.h Normal file
View File

@ -0,0 +1,37 @@
#ifndef ENCODE_H_
#define ENCODE_H_
#include "macrossTypes.h"
bool encodeByte(byte aByte);
bool encodeBigword(int bigword);
bool encodeAssignmentTerm(binopTermType *assignmentTerm);
bool encodeBinopTerm(binopTermType *binopTerm);
bool encodeCondition(conditionType condition);
int functionNumber(functionDefinitionType *function);
bool encodeFunctionCall(functionCallTermType *functionCall);
bool encodeHere(void);
bool encodeIdentifier(symbolTableEntryType *identifier);
bool encodeNumber(numberTermType number);
bool encodeRelocatableNumber(numberTermType number);
bool encodeOperand(operandType *operand);
bool encodePostopTerm(postOpTermType *postopTerm);
bool encodePreopTerm(preOpTermType *preopTerm);
bool encodeString(stringType *string);
bool encodeUnopTerm(unopTermType *unopTerm);
bool encodeValue(valueType *value);
bool encodeExpression(expressionType *expression);
bool encodeAssertStatement(assertStatementBodyType *assertStatement);
bool encodeFreturnStatement(freturnStatementBodyType *freturnStatement);
bool encodeMdefineStatement(defineStatementBodyType *mdefineStatement);
bool encodeMdoUntilStatement(mdoUntilStatementBodyType *mdoUntilStatement);
bool encodeMdoWhileStatement(mdoWhileStatementBodyType *mdoWhileStatement);
bool encodeMforStatement(mforStatementBodyType *mforStatement);
bool encodeMifStatement(mifStatementBodyType *mifStatement);
bool encodeMswitchStatement(mswitchStatementBodyType *mswitchStatement);
bool encodeMvariableStatement(mvariableStatementBodyType *mvariableStatement);
bool encodeMwhileStatement(mwhileStatementBodyType *mwhileStatement);
bool encodeStatement(statementType *statement);
bool encodeBlock(blockType *block);
#endif

View File

@ -1,16 +1,18 @@
#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);
#include "macrossTypes.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

View File

@ -1,11 +1,12 @@
#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 *evaluateBinopTerm(binopTermType *binopTerm, bool isTopLevel, fixupKindType kindOfFixup);
valueType *evaluateCondition(conditionType condition);
valueType *evaluateBuiltInFunctionCall(symbolInContextType *workingContext, operandListType *parameters, fixupKindType kindOfFixup);
valueType *evaluateFunctionCall(functionCallTermType *functionCall, fixupKindType kindOfFixup, bool isStandalone);
@ -15,8 +16,8 @@ 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 *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);

11
fixups.h Normal file
View File

@ -0,0 +1,11 @@
#ifndef FIXUPS_H_
#define FIXUPS_H_
#include "macrossTypes.h"
expressionType *generateFixupExpression(expressionType *expression);
expressionType *duplicateExpressionForFixup(expressionType *expression, bool isTopLevel, bool isSpecialFunctionOperand);
functionCallTermType *duplicateFunctionCall(functionCallTermType *functionCall);
expressionType *duplicateArrayReference(arrayTermType *arrayTerm);
#endif

66
garbage.h Normal file
View File

@ -0,0 +1,66 @@
#ifndef GARBAGE_H_
#define GARBAGE_H_
#include "macrossTypes.h"
void freeArrayTerm(arrayTermType *arrayTerm);
void freeAssignmentTerm(binopTermType *assignmentTerm);
void freeBinopTerm(binopTermType *binopTerm);
void freeFunctionCall(functionCallTermType *functionCall);
void freePostopTerm(postOpTermType *postopTerm);
void freePreopTerm(preOpTermType *preopTerm);
void freeString(stringType *string);
void freeUnopTerm(unopTermType *unopTerm);
void freeExpression(expressionType *expression);
void freeExpressionList(expressionListType *expressionList);
void freeIdentifierList(identifierListType *identifierList);
void freeSelectionList(selectionListType *selectionList);
void freeBlock(blockType *block);
void freeCase(caseType *aCase);
void freeCaseList(caseListType *caseList);
void freeOperandList(operandListType *operandList);
void freeMacro(operandListType *operands);
void freeMachineInstruction(operandListType *operands);
void freeAlignStatement(alignStatementBodyType *alignStatement);
void freeAssertStatement(assertStatementBodyType *assertStatement);
void freeBlockStatement(blockStatementBodyType *blockStatement);
void freeByteStatement(byteStatementBodyType *byteStatement);
void freeConstrainStatement(constrainStatementBodyType *constrainStatement);
void freeDbyteStatement(dbyteStatementBodyType *dbyteStatement);
void freeDefineStatement(defineStatementBodyType *defineStatement);
void freeDoUntilStatement(doUntilStatementBodyType *doUntilStatement);
void freeDoWhileStatement(doWhileStatementBodyType *doWhileStatement);
void freeExternStatement(externStatementBodyType *externStatement);
void freeFreturnStatement(freturnStatementBodyType *freturnStatement);
void freeFunctionStatement(functionStatementBodyType *functionStatement);
void freeIfStatement(ifStatementBodyType *ifStatement);
void freeIncludeStatement(includeStatementBodyType *includeStatement);
void freeInstructionStatement(instructionStatementBodyType *instructionStatement);
void freeLongStatement(longStatementBodyType *longStatement);
void freeMacroStatement(macroStatementBodyType *macroStatement);
void freeMdefineStatement(defineStatementBodyType *mdefineStatement);
void freeMdoUntilStatement(mdoUntilStatementBodyType *mdoUntilStatement);
void freeMdoWhileStatement(mdoWhileStatementBodyType *mdoWhileStatement);
void freeMifStatement(mifStatementBodyType *mifStatement);
void freeMswitchStatement(mswitchStatementBodyType *mswitchStatement);
void freeMforStatement(mforStatementBodyType *mforStatement);
void freeMvariableStatement(mvariableStatementBodyType *mvariableStatement);
void freeMwhileStatement(mwhileStatementBodyType *mwhileStatement);
void freeOrgStatement(orgStatementBodyType *orgStatement);
void freePerformStatement(performStatementBodyType *performStatement);
void freeRelStatement(relStatementBodyType *relStatement);
void freeStartStatement(startStatementBodyType *startStatement);
void freeStringStatement(stringStatementBodyType *stringStatement);
void freeStructStatement(structStatementBodyType *structStatement);
void freeTargetStatement(targetStatementBodyType *targetStatement);
void freeUndefineStatement(undefineStatementBodyType *undefineStatement);
void freeVariableStatement(variableStatementBodyType *variableStatement);
void freeWhileStatement(whileStatementBodyType *whileStatement);
void freeWordStatement(wordStatementBodyType *wordStatement);
void freeStatementBody(statementKindType kind, statementBodyType body);
void freeLabelList(labelListType *labelList);
void freeStatement(statementType *statement);
void freeArray(arrayType *array);
void freeValue(valueType *value);
#endif

21
initialize.h Normal file
View File

@ -0,0 +1,21 @@
#ifndef INITIALIZE_H_
#define INITIALIZE_H_
#include "macrossTypes.h"
void chokePukeAndDie(void);
void initializeStuff(int argc, char **argv);
void installBuiltInFunctions(void);
void installPredefinedSymbols(void);
void installCommandLineDefineSymbols(void);
void createHashTables(void);
void queueInputFile(char *name);
void openFirstInputFile(void);
bool isDotMName(stringType *fileName);
bool parseCommandLineDefine(char *arg, char **name, int *value);
void noteCommandLineDefine(char *arg);
/* Actually defined in main.c */
void printVersion(void);
#endif

56
lexer.h
View File

@ -1,32 +1,34 @@
#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);
#include "macrossTypes.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

View File

@ -1,24 +1,22 @@
#ifndef LISTING_H_
#define LISTING_H_
/* TODO: Functions here that have "format" arguments should actually
* be varargs. In 1984 it probably wasn't standardized, but here in
* Glorious Future Year 1989 the vprintf function does almost exactly
* what we want. */
#include "macrossTypes.h"
void outputListing(void);
void terminateListingFiles(void);
void generateListing(void);
int printMacroLine(int numberOfBytes, int byteAddress, statementKindType kind);
void readSourceFileLine(int *sourceAddressPtr, int *sourceDepthPtr, char lineBuffer[], FILE *file);
void readSourceFileLine(int *sourceAddressPtr, int *sourceDepthPtr, char *lineBuffer, FILE *file);
void readIndexFileLine(statementKindType *statementKindPtr, int *indexAddressPtr, int *indexLineNumberPtr);
int printListingLine(int numberOfBytes, int byteAddress, char *text, statementKindType kind);
bool isBlockOpener(statementKindType statementKind);
bool isBlankStatment(statementKindType statementKind);
bool isBlankStatement(statementKindType statementKind);
void tabPrint(stringType *text);
void printNTimes (char aChar, int times);
void printNTimes(char aChar, int times);
void tabIndent(void);
bool labeledLine(void);
void vaddText(char *buffer, char **bufferPtr, char *format, va_list ap);
void addText(char *buffer, char **bufferPtr, char *format, ...);
void moreTextOptional(char *buffer, char **bufferPtr, char *format, ...);
void moreText(char *format, ...);
@ -36,6 +34,3 @@ void startLineMarked(void);
bool notListable(statementKindType statementKind);
#endif

View File

@ -1,27 +1,29 @@
#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);
#include "macrossTypes.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

37
object.h Normal file
View File

@ -0,0 +1,37 @@
#ifndef OBJECT_H_
#define OBJECT_H_
#include "macrossTypes.h"
void outputObjectFile(void);
void outputWord(int aWord);
void outputPartition(void);
void outputBigword(long unsigned int bigword);
void outputByte(byte aByte);
void outputString(stringType *string);
void outputStartAddress(addressType startAddress);
void outputRelocatableCode(void);
void outputBreak(codeBreakType *codeBreak);
void outputAbsoluteCode(void);
void outputOneCodeBuffer(codeSegmentType *segment);
void outputPseudoSegment(addressType codeStartAddress, addressType codeEndAddress);
bool isObjectSymbol(symbolTableEntryType *symbol);
void enumerateAndCountSymbols(void);
int enumerateAndCountReferences(void);
void outputReference(expressionReferenceType *reference);
void outputReferenceInfo(void);
void outputOneSymbol(symbolTableEntryType *symbol);
void outputSymbolTableInfo(void);
int symbolCompare(symbolTableEntryType **symbol1, symbolTableEntryType **symbol2);
bool shouldDumpSymbol(symbolTableEntryType *symbol);
void dumpSymbolTable(void);
bool hackableSymbol(symbolTableEntryType *symbol);
void printValueTersely(valueType *value);
void outputReservations(void);
void outputExpressionBuffer(void);
void outputOneExpression(expressionType *expression);
void outputExpressions(void);
void outputOneFunction(functionDefinitionType *function);
void outputFunctions(void);
#endif

View File

@ -12,10 +12,10 @@ operandType *buildOperand(operandKindType kindOfOperand, int arg1, int arg2, int
#endif
operandListType *duplicateOperandForFixup(operandListType *operand, bool isSpecialFunctionOperand);
void expandOperand(operandKindType addressMode, char *buffer);
void freeOperand(operandType *operand);
void expandOperand(operandKindType addressMode, char *buffer);
valueType *evaluateOperand(operandType *operand);
conditionType invertConditionCode(conditionType conditionCode);
bool shouldParethesize(operandType *operand);
bool shouldParenthesize(operandType *operand);
#endif

View File

@ -1,11 +1,12 @@
#ifndef PARSER_MISC_H_
#define PARSER_MISC_H_
#include "macrossTypes.h"
statementType *addLabelToStatement(labelListType *labelList, statementType *statement);
void botch(char *message, ...);
void checkDefineAssignmentOperator(assignmentKindType assignmentOperator);
void convertDefineToMDefine(statementType *defineStatement);
statementType *convertDefineToMdefine(statementType *defineStatement);
ifStatementBodyType *extractIfBody(statementType *ifStatement);
mifStatementBodyType *extractMifBody(statementType *mifStatement);
stringType *extractString(operandType *textExpression);

View File

@ -5,26 +5,26 @@
void assembleBlock(blockType *block);
simpleFixupListType *assembleBlockInsideIf(blockType *block, simpleFixupListType *ongoingFixupList);
bool operandCheck(opcodeTableEntryType *opcode, int numberOfOperands, valueType *evaluatedOperands[]);
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 assembleByteStatement(byteStatementBodyType *byteStatement);
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 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 assembleInstructionStatement(instructionStatementBodyType *instructionStatement, int cumulativeLineNumber);
void assembleLongStatement(longStatementBodyType *longStatement);
void assembleMacroStatement(macroStatementBodyType *macroStatement);
void assembleMdefineStatement(defineStatementBodyType *mdefineStatement);
@ -46,9 +46,9 @@ 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);
bool assembleStatementBody(statementKindType kind, statementBodyType body, int cumulativeLineNumber, bool worryAboutIf, simpleFixupListType **ifFixupList);
void eatStatement(statementType *statement);
#endif

12
structSemantics.h Normal file
View File

@ -0,0 +1,12 @@
#ifndef STRUCT_SEMANTICS_H_
#define STRUCT_SEMANTICS_H_
#include "macrossTypes.h"
void putStructFixups(int base, fixupListType *fixups);
void putStructReferences(int base, expressionReferenceListType *references);
void instantiateStruct(structStatementBodyType *structStatement);
structInstanceType *assembleStructDefinitionBody(structBodyType *structBody);
void assembleStructDefinition(structStatementBodyType *structStatement);
#endif

9
tokenStrings.h Normal file
View File

@ -0,0 +1,9 @@
#ifndef TOKEN_STRINGS_6502_H_
#define TOKEN_STRINGS_6502_H_
#include "macrossTypes.h"
char *conditionString(conditionType condition);
char *tokenString(int token);
#endif