Protoize.

This commit is contained in:
Michael Martin 2016-01-23 23:13:44 -08:00
parent fa1c08008e
commit 693c15a2a8
12 changed files with 163 additions and 305 deletions

View File

@ -40,9 +40,7 @@
#define getSymbol() ((symbolType *)getNumber())
void
tooFewArgs(argCount, name)
int argCount;
stringType *name;
tooFewArgs(int argCount, stringType *name)
{
error(TOO_FEW_ARGUMENTS_TO_BIF_ERROR, name);
while (argCount-- > 0)
@ -50,9 +48,7 @@ tooFewArgs(argCount, name)
}
void
tooManyArgs(argCount, name)
int argCount;
stringType *name;
tooManyArgs(int argCount, stringType *name)
{
error(TOO_MANY_ARGUMENTS_TO_BIF_ERROR, name);
while (argCount-- > 0)
@ -89,8 +85,7 @@ static char atasciiTable[] = { /* 0xFFs will become 0x00s on output */
/* Convert a string to ATASCII */
stringType *
atasciiBIF(argCount)
int argCount;
atasciiBIF(int argCount)
{
stringType *string;
stringType *newString;
@ -113,8 +108,7 @@ atasciiBIF(argCount)
/* Convert a string to ATASCII while setting high-order color bits */
stringType *
atasciiColorBIF(argCount)
int argCount;
atasciiColorBIF(int argCount)
{
stringType *string;
stringType *newString;
@ -149,8 +143,7 @@ atasciiColorBIF(argCount)
/* Check if an operand is absolute (as opposed to relocatable) */
bool
isAbsoluteValueBIF(argCount)
int argCount;
isAbsoluteValueBIF(int argCount)
{
if (argCount > 1)
tooManyArgs(argCount, "isAbsoluteValue");
@ -159,8 +152,7 @@ isAbsoluteValueBIF(argCount)
/* Check if operand is a condition code */
bool
isConditionCodeBIF(argCount)
int argCount;
isConditionCodeBIF(int argCount)
{
bool result;
@ -177,8 +169,7 @@ isConditionCodeBIF(argCount)
/* Check if a symbol is defined */
bool
isDefinedBIF(argCount)
int argCount;
isDefinedBIF(int argCount)
{
symbolType *symbol;
@ -199,8 +190,7 @@ isDefinedBIF(argCount)
/* Check if a symbol is externally visible */
bool
isExternalBIF(argCount)
int argCount;
isExternalBIF(int argCount)
{
symbolType *symbol;
@ -221,8 +211,7 @@ isExternalBIF(argCount)
/* Return the Nth character of a string (as an integer) */
int
nthCharBIF(argCount)
int argCount;
nthCharBIF(int argCount)
{
stringType *string;
int position;
@ -245,8 +234,7 @@ nthCharBIF(argCount)
/* Pass stuff through to stdio's 'printf' function */
int
printfBIF(argCount)
int argCount;
printfBIF(int argCount)
{
stringType *formatString;
int argument[20];
@ -274,8 +262,7 @@ printfBIF(argCount)
/* Concatenate two strings */
stringType *
strcatBIF(argCount)
int argCount;
strcatBIF(int argCount)
{
stringType *string1;
stringType *string2;
@ -299,8 +286,7 @@ strcatBIF(argCount)
/* Compare two strings */
int
strcmpBIF(argCount)
int argCount;
strcmpBIF(int argCount)
{
stringType *string1;
stringType *string2;
@ -319,9 +305,7 @@ strcmpBIF(argCount)
/* Compare two strings in a case-independent fashion */
int
strcmplcBIF(argCount)
int argCount;
strcmplcBIF(int argCount)
{
stringType *string1;
stringType *string2;
@ -340,8 +324,7 @@ strcmplcBIF(argCount)
/* Return the length of a string */
int
strlenBIF(argCount)
int argCount;
strlenBIF(int argCount)
{
if (argCount < 1)
return(0);
@ -354,8 +337,7 @@ strlenBIF(argCount)
/* Return a substring of a string */
char *
substrBIF(argCount)
int argCount;
substrBIF(int argCount)
{
stringType *string;
int start;
@ -409,8 +391,7 @@ substrBIF(argCount)
/* Turn a string into a symbol and return its value */
addressType
symbolLookupBIF(argCount)
int argCount;
symbolLookupBIF(int argCount)
{
symbolType *symbol;
stringType *symbolName;
@ -433,8 +414,7 @@ symbolLookupBIF(argCount)
/* Turn a symbol into a string */
stringType *
symbolNameBIF(argCount)
int argCount;
symbolNameBIF(int argCount)
{
symbolType *symbol;

View File

@ -64,18 +64,14 @@ static char *symbolStrings[6] = {
};
void
printCode(startAddress, endAddress, mode)
int startAddress;
int endAddress;
int mode;
printCode(int startAddress, int endAddress, int mode)
{
printf(" Code: 0x%04x:0x%04x %s\n", startAddress, endAddress,
modeStrings[mode]);
}
void
printReference(reference)
expressionReferenceType *reference;
printReference(expressionReferenceType *reference)
{
printf(" Ref : 0x%04x (%s %s %s %s) expression #%d\n", reference->
referenceAddress, modeStrings[reference->referenceMode],
@ -85,8 +81,7 @@ printReference(reference)
}
void
printReferenceFixup(reference)
expressionReferenceType *reference;
printReferenceFixup(expressionReferenceType *reference)
{
printf(" Ref : 0x%04x (%s %s %s %s) expression=0x%x\n",
reference->referenceAddress, modeStrings[reference->
@ -97,9 +92,7 @@ printReferenceFixup(reference)
}
void
printSymbol(symbolTag, symbol)
int symbolTag;
symbolType *symbol;
printSymbol(int symbolTag, symbolType *symbol)
{
printf(" Symb: %3d %s 0x%04x \"%s\"\n", symbolTag, symbolStrings[
symbol->symbolClass], symbol->symbolValue,
@ -107,15 +100,14 @@ printSymbol(symbolTag, symbol)
}
void
printLoadMapSymbol(symbol)
symbolType *symbol;
printLoadMapSymbol(symbolType *symbol)
{
fprintf(mapFileOutput, "%-20s 0x%04x %s ", symbol->symbolName,
symbol->symbolValue, symbolStrings[symbol->symbolClass]);
}
void
printGlobalSymbols()
printGlobalSymbols(void)
{
int symbolCount;
@ -128,9 +120,7 @@ printGlobalSymbols()
}
void
printExpression(expression, length)
expressionPCType expression;
int length;
printExpression(expressionPCType expression, int length)
{
int line;
int i;

View File

@ -48,7 +48,7 @@ static bool hitFreturn = FALSE;
static addressType functionResult;
int
getNumber()
getNumber(void)
{
register int result;
register int i;
@ -61,7 +61,7 @@ getNumber()
}
addressType
evaluateArray()
evaluateArray(void)
{
error(ARRAY_TERM_IN_OBJECT_ERROR);
skipArray();
@ -69,7 +69,7 @@ evaluateArray()
}
addressType
evaluateAssert()
evaluateAssert(void)
{
if (!evaluateExpression())
error(ASSERT_FAILED_ERROR, pc);
@ -77,7 +77,7 @@ evaluateAssert()
}
addressType
evaluateBinop()
evaluateBinop(void)
{
int op;
symbolType *leftSymbol;
@ -156,7 +156,7 @@ evaluateBinop()
}
addressType
evaluateBlock()
evaluateBlock(void)
{
while (*pc != END_TAG) {
evaluateExpression();
@ -169,7 +169,7 @@ evaluateBlock()
}
addressType
evaluateConditionCode()
evaluateConditionCode(void)
{
overByte();
error(CONDITION_CODE_EXPRESSION_ENCOUNTERED_ERROR);
@ -177,9 +177,7 @@ evaluateConditionCode()
}
void
pushSymbol(symbol, value)
symbolType *symbol;
addressType value;
pushSymbol(symbolType *symbol, addressType value)
{
bindingListType *newBinding;
@ -194,9 +192,7 @@ pushSymbol(symbol, value)
}
void
bindFunctionArguments(theFunction, argCount)
functionType *theFunction;
int argCount;
bindFunctionArguments(functionType *theFunction, int argCount)
{
argumentListType *argList;
@ -220,7 +216,7 @@ bindFunctionArguments(theFunction, argCount)
}
void
undoBindings()
undoBindings(void)
{
bindingListType *deadBinding;
@ -236,7 +232,7 @@ undoBindings()
}
addressType
evaluateFreturn()
evaluateFreturn(void)
{
hitFreturn = TRUE;
functionResult = evaluateExpression();
@ -244,7 +240,7 @@ evaluateFreturn()
}
addressType
evaluateBuiltinFunctionCall()
evaluateBuiltinFunctionCall(void)
{
int theFunction;
int argCount;
@ -259,7 +255,7 @@ evaluateBuiltinFunctionCall()
}
addressType
evaluateFunctionCall()
evaluateFunctionCall(void)
{
expressionPCType savePoint;
functionType *theFunction;
@ -285,13 +281,13 @@ evaluateFunctionCall()
}
addressType
evaluateHere()
evaluateHere(void)
{
return(here);
}
addressType
evaluateMdefine()
evaluateMdefine(void)
{
symbolType *symbol;
@ -300,7 +296,7 @@ evaluateMdefine()
}
addressType
evaluateMdoUntil()
evaluateMdoUntil(void)
{
expressionPCType testPoint;
expressionPCType endPoint;
@ -317,7 +313,7 @@ evaluateMdoUntil()
}
addressType
evaluateMdoWhile()
evaluateMdoWhile(void)
{
expressionPCType testPoint;
expressionPCType endPoint;
@ -334,7 +330,7 @@ evaluateMdoWhile()
}
addressType
evaluateMfor()
evaluateMfor(void)
{
expressionPCType testPoint;
expressionPCType incrPoint;
@ -364,7 +360,7 @@ evaluateMfor()
}
addressType
evaluateMif()
evaluateMif(void)
{
if (evaluateExpression()) {
evaluateExpression();
@ -377,8 +373,7 @@ evaluateMif()
}
bool
evaluateClause(pattern)
addressType pattern;
evaluateClause(addressType pattern)
{
bool match;
@ -396,7 +391,7 @@ evaluateClause(pattern)
}
addressType
evaluateMswitch()
evaluateMswitch(void)
{
addressType pattern;
@ -411,7 +406,7 @@ evaluateMswitch()
}
addressType
evaluateMwhile()
evaluateMwhile(void)
{
expressionPCType testPoint;
expressionPCType endPoint;
@ -430,7 +425,7 @@ evaluateMwhile()
}
addressType
evaluateMvariable()
evaluateMvariable(void)
{
symbolType *symbol;
@ -439,7 +434,7 @@ evaluateMvariable()
}
addressType
evaluateNumber()
evaluateNumber(void)
{
addressType result;
int i;
@ -452,20 +447,20 @@ evaluateNumber()
}
addressType
evaluateRelocatableNumber()
evaluateRelocatableNumber(void)
{
return(evaluateNumber() + relocationOffset);
}
addressType
evaluatePerform()
evaluatePerform(void)
{
evaluateExpression();
return(0);
}
addressType
evaluatePostop()
evaluatePostop(void)
{
int op;
symbolType *target;
@ -482,7 +477,7 @@ evaluatePostop()
}
addressType
evaluatePreop()
evaluatePreop(void)
{
int op;
symbolType *target;
@ -499,7 +494,7 @@ evaluatePreop()
}
addressType
evaluateString()
evaluateString(void)
{
addressType result;
@ -510,7 +505,7 @@ evaluateString()
}
addressType
evaluateSymbol()
evaluateSymbol(void)
{
symbolType *target;
@ -519,7 +514,7 @@ evaluateSymbol()
}
addressType
evaluateUnop()
evaluateUnop(void)
{
int op;
addressType arg;
@ -545,7 +540,7 @@ evaluateUnop()
}
addressType
evaluateExpression()
evaluateExpression(void)
{
if (pc == NULL)
return(0);
@ -647,21 +642,21 @@ evaluateExpression()
}
void
skipArray()
skipArray(void)
{
overSymbol();
skipExpression();
}
void
skipAssert()
skipAssert(void)
{
skipExpression();
skipString();
}
void
skipBinop()
skipBinop(void)
{
overByte();
skipExpression();
@ -669,7 +664,7 @@ skipBinop()
}
void
skipBlock()
skipBlock(void)
{
while (*pc != END_TAG)
skipExpression();
@ -677,7 +672,7 @@ skipBlock()
}
void
skipFunctionCall()
skipFunctionCall(void)
{
int argCount;
@ -688,28 +683,28 @@ skipFunctionCall()
}
void
skipMdefine()
skipMdefine(void)
{
overSymbol();
skipExpression();
}
void
skipMdoUntil()
skipMdoUntil(void)
{
skipExpression();
skipExpression();
}
void
skipMdoWhile()
skipMdoWhile(void)
{
skipExpression();
skipExpression();
}
void
skipMfor()
skipMfor(void)
{
skipExpression();
skipExpression();
@ -718,7 +713,7 @@ skipMfor()
}
void
skipMif()
skipMif(void)
{
skipExpression();
skipExpression();
@ -726,7 +721,7 @@ skipMif()
}
void
skipClause()
skipClause(void)
{
while (*pc != BLOCK_TAG)
skipExpression;
@ -734,7 +729,7 @@ skipClause()
}
void
skipMswitch()
skipMswitch(void)
{
skipExpression();
while (*pc != END_TAG)
@ -743,49 +738,49 @@ skipMswitch()
}
void
skipMvariable()
skipMvariable(void)
{
overSymbol();
skipExpression();
}
void
skipMwhile()
skipMwhile(void)
{
skipExpression();
skipExpression();
}
void
skipPostop()
skipPostop(void)
{
overByte();
skipExpression();
}
void
skipPreop()
skipPreop(void)
{
overByte();
skipExpression();
}
void
skipString()
skipString(void)
{
while (*pc++ != '\0')
;
}
void
skipUnop()
skipUnop(void)
{
overByte();
skipExpression();
}
void
skipExpression()
skipExpression(void)
{
if (pc == NULL)
return;

View File

@ -39,16 +39,14 @@
static char *outputFileName;
void
chokePukeAndDie()
chokePukeAndDie(void)
{
unlink(outputFileName);
exit(1);
}
void
initializeStuff(argc, argv)
int argc;
char *argv[];
initializeStuff(int argc, char **argv)
{
int i;
int j;
@ -177,8 +175,7 @@ initializeStuff(argc, argv)
void
queueInputFile(name)
char *name;
queueInputFile(char *name)
{
objectFileListType *newObjectFile;
@ -197,8 +194,7 @@ queueInputFile(name)
}
void
queueLoadAddress(addressString)
char *addressString;
queueLoadAddress(char *addressString)
{
int loadAddress;
objectFileListType *newObjectFile;

View File

@ -42,8 +42,7 @@
#define nextByte(byt) (byt = *pc++)
void
putNumber(number)
int number;
putNumber(int number)
{
int i;
for (i=0; i<sizeof(int); ++i) {
@ -53,7 +52,7 @@ putNumber(number)
}
void
instantiateSymbol()
instantiateSymbol(void)
{
int index;
@ -63,7 +62,7 @@ instantiateSymbol()
}
void
instantiateFunction()
instantiateFunction(void)
{
int index;
@ -73,21 +72,21 @@ instantiateFunction()
}
void
putSymbolPointersIntoArray()
putSymbolPointersIntoArray(void)
{
instantiateSymbol();
putSymbolPointersIntoExpression();
}
void
putSymbolPointersIntoAssert()
putSymbolPointersIntoAssert(void)
{
putSymbolPointersIntoExpression();
skipString();
}
void
putSymbolPointersIntoBinop()
putSymbolPointersIntoBinop(void)
{
overByte();
putSymbolPointersIntoExpression();
@ -95,7 +94,7 @@ putSymbolPointersIntoBinop()
}
void
putSymbolPointersIntoBlock()
putSymbolPointersIntoBlock(void)
{
while (*pc != END_TAG)
putSymbolPointersIntoExpression();
@ -103,7 +102,7 @@ putSymbolPointersIntoBlock()
}
void
putSymbolPointersIntoBuiltinFunctionCall()
putSymbolPointersIntoBuiltinFunctionCall(void)
{
int argCount;
@ -114,7 +113,7 @@ putSymbolPointersIntoBuiltinFunctionCall()
}
void
putSymbolPointersIntoFunctionCall()
putSymbolPointersIntoFunctionCall(void)
{
int argCount;
@ -125,28 +124,28 @@ putSymbolPointersIntoFunctionCall()
}
void
putSymbolPointersIntoMdefine()
putSymbolPointersIntoMdefine(void)
{
instantiateSymbol();
putSymbolPointersIntoExpression();
}
void
putSymbolPointersIntoMdoUntil()
putSymbolPointersIntoMdoUntil(void)
{
putSymbolPointersIntoExpression();
putSymbolPointersIntoExpression();
}
void
putSymbolPointersIntoMdoWhile()
putSymbolPointersIntoMdoWhile(void)
{
putSymbolPointersIntoExpression();
putSymbolPointersIntoExpression();
}
void
putSymbolPointersIntoMfor()
putSymbolPointersIntoMfor(void)
{
putSymbolPointersIntoExpression();
putSymbolPointersIntoExpression();
@ -155,7 +154,7 @@ putSymbolPointersIntoMfor()
}
void
putSymbolPointersIntoMif()
putSymbolPointersIntoMif(void)
{
putSymbolPointersIntoExpression();
putSymbolPointersIntoExpression();
@ -163,7 +162,7 @@ putSymbolPointersIntoMif()
}
void
putSymbolPointersIntoClause()
putSymbolPointersIntoClause(void)
{
while (*pc != BLOCK_TAG)
putSymbolPointersIntoExpression();
@ -171,7 +170,7 @@ putSymbolPointersIntoClause()
}
void
putSymbolPointersIntoMswitch()
putSymbolPointersIntoMswitch(void)
{
putSymbolPointersIntoExpression();
while (*pc != END_TAG)
@ -180,42 +179,42 @@ putSymbolPointersIntoMswitch()
}
void
putSymbolPointersIntoMvariable()
putSymbolPointersIntoMvariable(void)
{
instantiateSymbol();
putSymbolPointersIntoExpression();
}
void
putSymbolPointersIntoMwhile()
putSymbolPointersIntoMwhile(void)
{
putSymbolPointersIntoExpression();
putSymbolPointersIntoExpression();
}
void
putSymbolPointersIntoPostop()
putSymbolPointersIntoPostop(void)
{
overByte();
putSymbolPointersIntoExpression();
}
void
putSymbolPointersIntoPreop()
putSymbolPointersIntoPreop(void)
{
overByte();
putSymbolPointersIntoExpression();
}
void
putSymbolPointersIntoUnop()
putSymbolPointersIntoUnop(void)
{
overByte();
putSymbolPointersIntoExpression();
}
void
putSymbolPointersIntoExpression()
putSymbolPointersIntoExpression(void)
{
if (pc == NULL)
return;

View File

@ -103,8 +103,7 @@
*/
bool
internalizeOneObjectFile(objectFile)
objectFileListType *objectFile;
internalizeOneObjectFile(objectFileListType *objectFile)
{
FILE *objectFildes;
int magic;
@ -160,9 +159,7 @@ internalizeOneObjectFile(objectFile)
#define toLowerCase(c) (('A'<=(c)&&(c)<='Z')?((c)-'A'+'a'):(c));
bool
strcmplc(s1, s2)
char *s1;
char *s2;
strcmplc(char *s1, char *s2)
{
register char c1;
register char c2;
@ -184,9 +181,7 @@ strcmplc(s1, s2)
}
bool
compareSymbols(symbol1, symbol2)
symbolType **symbol1;
symbolType **symbol2;
compareSymbols(symbolType **symbol1, symbolType **symbol2)
{
bool result;
@ -201,8 +196,7 @@ compareSymbols(symbol1, symbol2)
}
void
buildGlobalSymbolTable(inputFileList)
objectFileListType *inputFileList;
buildGlobalSymbolTable(objectFileListType *inputFileList)
{
int symbolCount;
symbolType **symbol;
@ -234,7 +228,7 @@ buildGlobalSymbolTable(inputFileList)
}
bool
readem()
readem(void)
{
objectFileListType *inputFileList;
@ -254,8 +248,7 @@ readem()
}
codeSegmentHeaderType *
locateConflictingSegment(codeSegment)
codeSegmentHeaderType *codeSegment;
locateConflictingSegment(codeSegmentHeaderType *codeSegment)
{
segmentListType *segmentPtr;
int segmentListOffset;
@ -291,9 +284,7 @@ locateConflictingSegment(codeSegment)
}
void
reserveSegment(start, end)
addressType start;
addressType end;
reserveSegment(addressType start, addressType end)
{
freeSegmentEntryType *freeSegmentPtr;
freeSegmentEntryType *previousSegmentPtr;
@ -346,8 +337,7 @@ reserveSegment(start, end)
}
codeSegmentHeaderType *
allocateAbsolute(codeSegment)
codeSegmentHeaderType *codeSegment;
allocateAbsolute(codeSegmentHeaderType *codeSegment)
{
freeSegmentEntryType *freeSegmentPtr;
freeSegmentEntryType *previousSegmentPtr;
@ -397,7 +387,7 @@ allocateAbsolute(codeSegment)
}
void
reserveReservations()
reserveReservations(void)
{
while (reservationList != NULL) {
reserveSegment(reservationList->startAddress,
@ -408,8 +398,7 @@ reserveReservations()
}
void
installSegment(codeSegment)
codeSegmentHeaderType *codeSegment;
installSegment(codeSegmentHeaderType *codeSegment)
{
segmentListType *previousSegment;
segmentListType *installSegmentList;
@ -444,8 +433,7 @@ installSegment(codeSegment)
}
void
installAbsoluteCodeSegment(codeSegment)
codeSegmentHeaderType *codeSegment;
installAbsoluteCodeSegment(codeSegmentHeaderType *codeSegment)
{
codeSegmentHeaderType *conflictingSegment;
@ -460,7 +448,7 @@ installAbsoluteCodeSegment(codeSegment)
}
void
linkem()
linkem(void)
{
if (!readem())
return;

View File

@ -34,9 +34,7 @@
#include "link.h"
int
main(argc, argv)
int argc;
char *argv[];
main(int argc, char **argv)
{
initializeStuff(argc, argv);
linkem();
@ -46,7 +44,7 @@ main(argc, argv)
}
void
printVersion()
printVersion(void)
{
printf("Slinky version 1.16.\n");
}

View File

@ -35,9 +35,7 @@
#include "link.h"
int
compareLoadMapEntries(entry1, entry2)
loadMapTableEntryType *entry1;
loadMapTableEntryType *entry2;
compareLoadMapEntries(loadMapTableEntryType *entry1, loadMapTableEntryType *entry2)
{
int result;
@ -53,7 +51,7 @@ compareLoadMapEntries(entry1, entry2)
}
void
outputLoadMap()
outputLoadMap(void)
{
loadMapTableEntryType *loadMapTable;
loadMapTableEntryType *loadMapPtr;

View File

@ -37,31 +37,25 @@
#include "expr.h"
bool
isWordSized(value)
int value;
isWordSized(int value)
{
return (-32768<=value && value<=65535);
}
bool
isByteSized(value)
int value;
isByteSized(int value)
{
return (-128<=value && value<=255);
}
bool
isByteOffset(value)
int value;
isByteOffset(int value)
{
return (-128<=value && value<=127);
}
int
computeRelativeValue(valueToPoke, codeSegment, offset)
int valueToPoke;
codeSegmentHeaderType *codeSegment;
int offset;
computeRelativeValue(int valueToPoke, codeSegmentHeaderType *codeSegment, int offset)
{
int fromLocation;
int result;
@ -81,10 +75,7 @@ computeRelativeValue(valueToPoke, codeSegment, offset)
}
int
getBaseValue(codeBuffer, offset, referenceKind)
byte codeBuffer[];
int offset;
int referenceKind;
getBaseValue(byte *codeBuffer, int offset, int referenceKind)
{
int result;
@ -105,12 +96,7 @@ getBaseValue(codeBuffer, offset, referenceKind)
}
void
pokeValue(value, codeBuffer, offset, referenceKind, trueAddress)
int value;
byte codeBuffer[];
int offset;
int referenceKind;
int trueAddress;
pokeValue(int value, byte *codeBuffer, int offset, int referenceKind, int trueAddress)
{
switch (referenceKind) {
case REF_BYTE:
@ -154,9 +140,7 @@ pokeValue(value, codeBuffer, offset, referenceKind, trueAddress)
}
void
fixupReference(reference, codeSegment)
expressionReferenceType *reference;
codeSegmentHeaderType *codeSegment;
fixupReference(expressionReferenceType *reference, codeSegmentHeaderType *codeSegment)
{
int offset;
addressType baseValue;
@ -186,7 +170,7 @@ fixupReference(reference, codeSegment)
}
void
pokem()
pokem(void)
{
objectFileListType *inputFileList;
codeSegmentHeaderType *codeSegment;

View File

@ -42,9 +42,7 @@
#define isRelocatable(symbol) (((symbol)->symbolClass &SYMBOL_RELOCATABLE)!=0)
void
fileCheck(fildes, fileName)
FILE *fildes;
char *fileName;
fileCheck(FILE *fildes, char *fileName)
{
if (feof(fildes)) {
error(PREMATURE_EOF_ERROR, fileName);
@ -57,9 +55,7 @@ fileCheck(fildes, fileName)
}
wordType
readWord(file, fileName)
FILE *file;
char *fileName;
readWord(FILE *file, char *fileName)
{
wordType result;
register char loByte;
@ -73,9 +69,7 @@ readWord(file, fileName)
}
byte
readByte(file, fileName)
FILE *file;
char *fileName;
readByte(FILE *file, char *fileName)
{
int result;
@ -86,9 +80,7 @@ readByte(file, fileName)
}
bigWord
readBigword(file, fileName)
FILE *file;
char *fileName;
readBigword(FILE *file, char *fileName)
{
register bigWord result;
@ -101,9 +93,7 @@ readBigword(file, fileName)
}
bigWord
read3ByteWord(file, fileName)
FILE *file;
char *fileName;
read3ByteWord(FILE *file, char *fileName)
{
register bigWord result;
@ -115,10 +105,7 @@ read3ByteWord(file, fileName)
}
int
readString(buffer, fildes, fileName)
char *buffer;
FILE *fildes;
char *fileName;
readString(char *buffer, FILE *fildes, char *fileName)
{
register char c;
register char *scratchBuffer;
@ -132,11 +119,7 @@ readString(buffer, fildes, fileName)
}
void
readChunk(buffer, numberOfBytes, fildes, fileName)
byte *buffer;
int numberOfBytes;
FILE *fildes;
char *fileName;
readChunk(byte *buffer, int numberOfBytes, FILE *fildes, char *fileName)
{
do {
*buffer++ = getc(fildes);
@ -145,12 +128,7 @@ readChunk(buffer, numberOfBytes, fildes, fileName)
}
void
readCode(startAddress, endAddress, mode, objectFile, objectFildes)
addressType startAddress;
addressType endAddress;
int mode;
objectFileListType *objectFile;
FILE *objectFildes;
readCode(addressType startAddress, addressType endAddress, int mode, objectFileListType *objectFile, FILE *objectFildes)
{
int size;
byte *codeBuffer;
@ -199,9 +177,7 @@ readCode(startAddress, endAddress, mode, objectFile, objectFildes)
}
bool
compareReferences(reference1, reference2)
expressionReferenceType *reference1;
expressionReferenceType *reference2;
compareReferences(expressionReferenceType *reference1, expressionReferenceType *reference2)
{
if (reference1->referenceMode == MODE_ABSOLUTE && reference2->
referenceMode == MODE_RELOCATABLE)
@ -218,19 +194,14 @@ compareReferences(reference1, reference2)
}
void
sortReferences(theReferences, numberOfReferences)
expressionReferenceType *theReferences;
int numberOfReferences;
sortReferences(expressionReferenceType *theReferences, int numberOfReferences)
{
qsort(theReferences, numberOfReferences,
sizeof(expressionReferenceType), compareReferences);
}
void
readReference(reference, fildes, fileName)
expressionReferenceType *reference;
FILE *fildes;
char *fileName;
readReference(expressionReferenceType *reference, FILE *fildes, char *fileName)
{
register byte funnyByte;
@ -247,9 +218,7 @@ readReference(reference, fildes, fileName)
}
void
readReferences(objectFile, objectFildes)
objectFileListType *objectFile;
FILE *objectFildes;
readReferences(objectFileListType *objectFile, FILE *objectFildes)
{
int count;
int readCount;
@ -298,9 +267,7 @@ readReferences(objectFile, objectFildes)
}
bool
compareSymbolValues(symbol1, symbol2)
symbolType **symbol1;
symbolType **symbol2;
compareSymbolValues(symbolType **symbol1, symbolType **symbol2)
{
if ((isAbsolute(*symbol1) && !isAbsolute(*symbol2)) ||
(isRelocatable(*symbol1) && !isRelocatable(*symbol2)
@ -321,9 +288,7 @@ compareSymbolValues(symbol1, symbol2)
}
void
readSymbols(objectFile, objectFildes)
objectFileListType *objectFile;
FILE *objectFildes;
readSymbols(objectFileListType *objectFile, FILE *objectFildes)
{
symbolType *symbolTable;
symbolType **symbolTableIndir;
@ -365,9 +330,7 @@ readSymbols(objectFile, objectFildes)
}
expressionPCType
readOneExpression(objectFile, objectFildes)
objectFileListType *objectFile;
FILE *objectFildes;
readOneExpression(objectFileListType *objectFile, FILE *objectFildes)
{
char *fileName;
int expressionSize;
@ -392,9 +355,7 @@ readOneExpression(objectFile, objectFildes)
}
void
readExpressions(objectFile, objectFildes)
objectFileListType *objectFile;
FILE *objectFildes;
readExpressions(objectFileListType *objectFile, FILE *objectFildes)
{
expressionPCType *expressions;
int expressionCount;
@ -426,9 +387,7 @@ readExpressions(objectFile, objectFildes)
}
argumentListType *
readArgumentList(objectFile, objectFildes)
objectFileListType *objectFile;
FILE *objectFildes;
readArgumentList(objectFileListType *objectFile, FILE *objectFildes)
{
int argumentCount;
char *fileName;
@ -453,9 +412,7 @@ readArgumentList(objectFile, objectFildes)
}
void
readFunctions(objectFile, objectFildes)
objectFileListType *objectFile;
FILE *objectFildes;
readFunctions(objectFileListType *objectFile, FILE *objectFildes)
{
functionType *functions;
int functionCount;
@ -489,8 +446,7 @@ readFunctions(objectFile, objectFildes)
}
void
instantiateExpressionAndSymbolPointers(objectFile)
objectFileListType *objectFile;
instantiateExpressionAndSymbolPointers(objectFileListType *objectFile)
{
symbolType **symbolTable;
expressionPCType *expressions;
@ -521,9 +477,7 @@ instantiateExpressionAndSymbolPointers(objectFile)
}
void
readReservations(objectFile, objectFildes)
objectFileListType *objectFile;
FILE *objectFildes;
readReservations(objectFileListType *objectFile, FILE *objectFildes)
{
addressType startAddress;
@ -537,10 +491,7 @@ readReservations(objectFile, objectFildes)
}
reservationListType *
buildReservation(startAddress, blockSize, nextReservation)
addressType startAddress;
int blockSize;
reservationListType *nextReservation;
buildReservation(addressType startAddress, int blockSize, reservationListType *nextReservation)
{
reservationListType *result;

View File

@ -39,7 +39,7 @@
#define isUndefined(symbol) (((symbol)->symbolClass & ~SYMBOL_EXTERNAL) == 0)
void
removeZeroPageFromFreeList()
removeZeroPageFromFreeList(void)
{
while (freeSegmentList->segmentEndAddress <= 0x100)
freeSegmentList = freeSegmentList->nextFreeSegment;
@ -48,9 +48,7 @@ removeZeroPageFromFreeList()
}
addressType
align(address, alignment)
addressType address;
int alignment;
align(addressType address, int alignment)
{
if (alignment == 0)
return(address);
@ -59,10 +57,7 @@ align(address, alignment)
}
addressType
constrain(address, size, constraint)
addressType address;
int size;
addressType constraint;
constrain(addressType address, int size, addressType constraint)
{
if (constraint == 0)
return(address);
@ -72,8 +67,7 @@ constrain(address, size, constraint)
return(address);
}
void
moveRelocationBase(newBase)
addressType newBase;
moveRelocationBase(addressType newBase)
{
freeSegmentEntryType *freePtr;
freeSegmentEntryType *newFreePtr;
@ -95,8 +89,7 @@ moveRelocationBase(newBase)
}
addressType
allocateRelocatable(codeSegment)
codeSegmentHeaderType *codeSegment;
allocateRelocatable(codeSegmentHeaderType *codeSegment)
{
freeSegmentEntryType *freePtr;
freeSegmentEntryType *previousPtr;
@ -151,9 +144,7 @@ allocateRelocatable(codeSegment)
}
void
relocateOneCodeSegment(codeSegment, targetLocation)
codeSegmentHeaderType *codeSegment;
addressType targetLocation;
relocateOneCodeSegment(codeSegmentHeaderType *codeSegment, addressType targetLocation)
{
int relocationOffset;
@ -175,7 +166,7 @@ relocateOneCodeSegment(codeSegment, targetLocation)
}
void
relocatem()
relocatem(void)
{
objectFileListType *inputFileList;
addressType targetLocation;
@ -210,9 +201,7 @@ relocatem()
}
codeSegmentHeaderType *
matchModes(symbol, codeSegment)
symbolType *symbol;
codeSegmentHeaderType *codeSegment;
matchModes(symbolType *symbol, codeSegmentHeaderType *codeSegment)
{
while (codeSegment!=NULL && ((codeSegment->segmentMode==MODE_ABSOLUTE
&& !(symbol->symbolClass & SYMBOL_ABSOLUTE)) ||
@ -224,9 +213,7 @@ matchModes(symbol, codeSegment)
}
bool
matchedModes(symbol, codeSegment)
symbolType *symbol;
codeSegmentHeaderType *codeSegment;
matchedModes(symbolType *symbol, codeSegmentHeaderType *codeSegment)
{
return(((symbol->symbolClass & SYMBOL_ABSOLUTE) && codeSegment->
segmentMode == MODE_ABSOLUTE) || ((symbol->symbolClass &
@ -235,9 +222,7 @@ matchedModes(symbol, codeSegment)
}
codeSegmentHeaderType *
synchronizeCodeSegment(symbol, codeSegment)
symbolType *symbol;
codeSegmentHeaderType *codeSegment;
synchronizeCodeSegment(symbolType *symbol, codeSegmentHeaderType *codeSegment)
{
codeSegment = matchModes(symbol, codeSegment);
while (codeSegment != NULL && codeSegment->nextSegment != NULL &&
@ -250,15 +235,12 @@ synchronizeCodeSegment(symbol, codeSegment)
}
void
handleGlobalSymbol(symbol)
symbolType *symbol;
handleGlobalSymbol(symbolType *symbol)
{
}
void
valueSymbol(symbol, codeSegment)
symbolType *symbol;
codeSegmentHeaderType *codeSegment;
valueSymbol(symbolType *symbol, codeSegmentHeaderType *codeSegment)
{
if (symbol->symbolClass & SYMBOL_ABSOLUTE) {
return;
@ -270,8 +252,7 @@ valueSymbol(symbol, codeSegment)
}
symbolType *
lookupGlobalSymbol(symbolName)
char *symbolName;
lookupGlobalSymbol(char *symbolName)
{
int guess;
int top;
@ -300,8 +281,7 @@ lookupGlobalSymbol(symbolName)
}
void
valueUndefinedSymbol(symbol)
symbolType *symbol;
valueUndefinedSymbol(symbolType *symbol)
{
symbolType *globalSymbol;
@ -314,7 +294,7 @@ valueUndefinedSymbol(symbol)
}
void
valuem()
valuem(void)
{
objectFileListType *inputFileList;
codeSegmentHeaderType *codeSegmentPtr;

View File

@ -37,7 +37,7 @@
#define writeByte(aByte) putc(aByte & 0xFF, loadFileOutput)
void
writeEntryPoint()
writeEntryPoint(void)
{
writeWord(entryPointAddress);
writeWord(entryPointAddress);
@ -45,8 +45,7 @@ writeEntryPoint()
}
void
writeCodeSegment(codeSegment)
codeSegmentHeaderType *codeSegment;
writeCodeSegment(codeSegmentHeaderType *codeSegment)
{
int length;
int i;
@ -60,7 +59,7 @@ writeCodeSegment(codeSegment)
}
void
writem()
writem(void)
{
int regionNumber;
codeSegmentHeaderType *lastSegment;