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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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