ref: a014537837b5078593de740badc153e4472be309
parent: ddd7fdac011efda5478748a0cd3cee8431db460e
author: anthony <[email protected]>
date: Wed Dec 30 07:51:32 EST 2009
reran indent (whitespace changes) Merging lai's source with this one is very irritating because they have different indentation styles. I couldn't find what profile vegard used for his version, so I used these flags (which should bring the source close to KNF): -bap -br -ce -ci4 -cli0 -d0 -di0 -i8 -ip -l79 -nbc -ncdb -ndj -ei -nfc1 -nlp -npcs -psl -sc -sob
--- a/src/asm/alloca.c
+++ b/src/asm/alloca.c
@@ -56,9 +56,9 @@
#define ADDRESS_FUNCTION(arg) &(arg)
#endif
#if __STDC__
-typedef void *pointer;
+ typedef void *pointer;
#else
-typedef char *pointer;
+ typedef char *pointer;
#endif
#define NULL 0
@@ -104,9 +104,11 @@
static int stack_dir; /* 1 or -1 once known. */
#define STACK_DIR stack_dir
-static void find_stack_direction()
+static void
+find_stack_direction()
{
- static char *addr = NULL; /* Address of first `dummy', once known. */
+ static char *addr = NULL; /* Address of first `dummy', once
+ * known. */
auto char dummy; /* To get stack address. */
if (addr == NULL) { /* Initial entry. */
@@ -121,7 +123,6 @@
stack_dir = -1; /* Stack grew downward. */
}
}
-
#endif /* STACK_DIRECTION == 0 */
/* An "alloca header" is used to:
@@ -138,10 +139,10 @@
typedef union hdr {
char align[ALIGN_SIZE]; /* To force sizeof(header). */
struct {
- union hdr *next; /* For chaining headers. */
+ union hdr *next;/* For chaining headers. */
char *deep; /* For stack depth measure. */
- } h;
-} header;
+ } h;
+} header;
static header *last_alloca_header = NULL; /* -> last alloca header. */
@@ -152,8 +153,9 @@
caller, but that method cannot be made to work for some
implementations of C, for example under Gould's UTX/32. */
-pointer alloca(size)
-unsigned size;
+pointer
+alloca(size)
+ unsigned size;
{
auto char probe; /* Probes stack depth: */
register char *depth = ADDRESS_FUNCTION(probe);
@@ -163,8 +165,8 @@
find_stack_direction();
#endif
- /* Reclaim garbage, defined as all alloca'd storage that
- was allocated from deeper in the stack than currently. */
+ /* Reclaim garbage, defined as all alloca'd storage that was allocated
+ * from deeper in the stack than currently. */
{
register header *hp; /* Traverses linked list. */
@@ -207,10 +209,9 @@
/* User storage begins just after header. */
- return (pointer) ((char *)new + sizeof(header));
+ return (pointer) ((char *) new + sizeof(header));
}
}
-
#if defined (CRAY) && defined (CRAY_STACKSEG_END)
#ifdef DEBUG_I00AFUNC
@@ -227,7 +228,6 @@
long shhwm:32; /* High water mark of stack. */
long shsize:32; /* Current size of stack (all segments). */
};
-
/* The stack segment linkage control information occurs at
the high-address end of a stack segment. (The stack
grows from low addresses to high addresses.) The initial
@@ -241,11 +241,11 @@
long ssbase:32; /* Offset to stack base. */
long:32;
long sspseg:32; /* Offset to linkage control of previous
- segment of stack. */
+ * segment of stack. */
long:32;
long sstcpt:32; /* Pointer to task common address block. */
long sscsnm; /* Private control structure number for
- microtasking. */
+ * microtasking. */
long ssusr1; /* Reserved for user. */
long ssusr2; /* Reserved for user. */
long sstpid; /* Process ID for pid based multi-tasking. */
@@ -268,15 +268,14 @@
long sss6;
long sss7;
};
-
#else /* CRAY2 */
/* The following structure defines the vector of words
returned by the STKSTAT library routine. */
struct stk_stat {
long now; /* Current total stack size. */
- long maxc; /* Amount of contiguous space which would
- be required to satisfy the maximum
- stack demand to date. */
+ long maxc; /* Amount of contiguous space which would be
+ * required to satisfy the maximum stack
+ * demand to date. */
long high_water; /* Stack high-water mark. */
long overflows; /* Number of stack overflow ($STKOFEN) calls. */
long hits; /* Number of internal buffer hits. */
@@ -289,13 +288,12 @@
long maxs; /* Maximum number of stack segments so far. */
long pad_size; /* Stack pad size. */
long current_address; /* Current stack segment address. */
- long current_size; /* Current stack segment size. This
- number is actually corrupted by STKSTAT to
- include the fifteen word trailer area. */
+ long current_size; /* Current stack segment size. This number is
+ * actually corrupted by STKSTAT to include
+ * the fifteen word trailer area. */
long initial_address; /* Address of initial segment. */
long initial_size; /* Size of initial segment. */
};
-
/* The following structure describes the data structure which trails
any stack segment. I think that the description in 'asdef' is
out of date. I only describe the parts that I am sure about. */
@@ -302,12 +300,12 @@
struct stk_trailer {
long this_address; /* Address of this block. */
- long this_size; /* Size of this block (does not include
- this trailer). */
+ long this_size; /* Size of this block (does not include this
+ * trailer). */
long unknown2;
long unknown3;
long link; /* Address of trailer block of previous
- segment. */
+ * segment. */
long unknown5;
long unknown6;
long unknown7;
@@ -319,7 +317,6 @@
long unknown13;
long unknown14;
};
-
#endif /* CRAY2 */
#endif /* not CRAY_STACK */
@@ -327,7 +324,8 @@
/* Determine a "stack measure" for an arbitrary ADDRESS.
I doubt that "lint" will like this much. */
-static long i00afunc(long *address)
+static long
+i00afunc(long *address)
{
struct stk_stat status;
struct stk_trailer *trailer;
@@ -334,20 +332,20 @@
long *block, size;
long result = 0;
- /* We want to iterate through all of the segments. The first
- step is to get the stack status structure. We could do this
- more quickly and more directly, perhaps, by referencing the
- $LM00 common block, but I know that this works. */
+ /* We want to iterate through all of the segments. The first step is
+ * to get the stack status structure. We could do this more quickly
+ * and more directly, perhaps, by referencing the $LM00 common block,
+ * but I know that this works. */
STKSTAT(&status);
/* Set up the iteration. */
- trailer = (struct stk_trailer *)(status.current_address
- + status.current_size - 15);
+ trailer = (struct stk_trailer *) (status.current_address
+ + status.current_size - 15);
- /* There must be at least one stack segment. Therefore it is
- a fatal error if "trailer" is null. */
+ /* There must be at least one stack segment. Therefore it is a fatal
+ * error if "trailer" is null. */
if (trailer == 0)
abort();
@@ -355,17 +353,17 @@
/* Discard segments that do not contain our argument address. */
while (trailer != 0) {
- block = (long *)trailer->this_address;
+ block = (long *) trailer->this_address;
size = trailer->this_size;
if (block == 0 || size == 0)
abort();
- trailer = (struct stk_trailer *)trailer->link;
+ trailer = (struct stk_trailer *) trailer->link;
if ((block <= address) && (address < (block + size)))
break;
}
- /* Set the result to the offset in this segment and add the sizes
- of all predecessor segments. */
+ /* Set the result to the offset in this segment and add the sizes of
+ * all predecessor segments. */
result = address - block;
@@ -372,23 +370,21 @@
if (trailer == 0) {
return result;
}
-
do {
if (trailer->this_size <= 0)
abort();
result += trailer->this_size;
- trailer = (struct stk_trailer *)trailer->link;
+ trailer = (struct stk_trailer *) trailer->link;
}
while (trailer != 0);
- /* We are done. Note that if you present a bogus address (one
- not in any segment), you will get a different number back, formed
- from subtracting the address of the first block. This is probably
- not what you want. */
+ /* We are done. Note that if you present a bogus address (one not in
+ * any segment), you will get a different number back, formed from
+ * subtracting the address of the first block. This is probably not
+ * what you want. */
return (result);
}
-
#else /* not CRAY2 */
/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
Determine the number of the cell within the stack,
@@ -396,7 +392,8 @@
routine is to linearize, in some sense, stack addresses
for alloca. */
-static long i00afunc(long address)
+static long
+i00afunc(long address)
{
long stkl = 0;
@@ -405,41 +402,40 @@
struct stack_segment_linkage *ssptr;
- /* Register B67 contains the address of the end of the
- current stack segment. If you (as a subprogram) store
- your registers on the stack and find that you are past
- the contents of B67, you have overflowed the segment.
+ /* Register B67 contains the address of the end of the current stack
+ * segment. If you (as a subprogram) store your registers on the
+ * stack and find that you are past the contents of B67, you have
+ * overflowed the segment.
+ *
+ * B67 also points to the stack segment linkage control area, which is
+ * what we are really interested in. */
- B67 also points to the stack segment linkage control
- area, which is what we are really interested in. */
-
stkl = CRAY_STACKSEG_END();
- ssptr = (struct stack_segment_linkage *)stkl;
+ ssptr = (struct stack_segment_linkage *) stkl;
- /* If one subtracts 'size' from the end of the segment,
- one has the address of the first word of the segment.
+ /* If one subtracts 'size' from the end of the segment, one has the
+ * address of the first word of the segment.
+ *
+ * If this is not the first segment, 'pseg' will be nonzero. */
- If this is not the first segment, 'pseg' will be
- nonzero. */
-
pseg = ssptr->sspseg;
size = ssptr->sssize;
this_segment = stkl - size;
- /* It is possible that calling this routine itself caused
- a stack overflow. Discard stack segments which do not
- contain the target address. */
+ /* It is possible that calling this routine itself caused a stack
+ * overflow. Discard stack segments which do not contain the target
+ * address. */
while (!(this_segment <= address && address <= stkl)) {
#ifdef DEBUG_I00AFUNC
fprintf(stderr, "%011o %011o %011o\n", this_segment, address,
- stkl);
+ stkl);
#endif
if (pseg == 0)
break;
stkl = stkl - pseg;
- ssptr = (struct stack_segment_linkage *)stkl;
+ ssptr = (struct stack_segment_linkage *) stkl;
size = ssptr->sssize;
pseg = ssptr->sspseg;
this_segment = stkl - size;
@@ -447,10 +443,9 @@
result = address - this_segment;
- /* If you subtract pseg from the current end of the stack,
- you get the address of the previous stack segment's end.
- This seems a little convoluted to me, but I'll bet you save
- a cycle somewhere. */
+ /* If you subtract pseg from the current end of the stack, you get the
+ * address of the previous stack segment's end. This seems a little
+ * convoluted to me, but I'll bet you save a cycle somewhere. */
while (pseg != 0) {
#ifdef DEBUG_I00AFUNC
@@ -457,7 +452,7 @@
fprintf(stderr, "%011o %011o\n", pseg, size);
#endif
stkl = stkl - pseg;
- ssptr = (struct stack_segment_linkage *)stkl;
+ ssptr = (struct stack_segment_linkage *) stkl;
size = ssptr->sssize;
pseg = ssptr->sspseg;
result += size;
@@ -464,7 +459,6 @@
}
return (result);
}
-
#endif /* not CRAY2 */
#endif /* CRAY */
--- a/src/asm/fstack.c
+++ b/src/asm/fstack.c
@@ -46,7 +46,8 @@
#define STAT_isMacroArg 2
#define STAT_isREPTBlock 3
-ULONG filesize(char *s)
+ULONG
+filesize(char *s)
{
FILE *f;
ULONG size = 0;
@@ -58,7 +59,6 @@
}
return (size);
}
-
/*
* RGBAsm - FSTACK.C (FileStack routines)
*
@@ -66,7 +66,8 @@
*
*/
-void pushcontext(void)
+void
+pushcontext(void)
{
struct sContext **ppFileStack;
@@ -75,11 +76,11 @@
ppFileStack = &((*ppFileStack)->pNext);
if ((*ppFileStack =
- (struct sContext *)malloc(sizeof(struct sContext))) != NULL) {
+ (struct sContext *) malloc(sizeof(struct sContext))) != NULL) {
(*ppFileStack)->FlexHandle = CurrentFlexHandle;
(*ppFileStack)->pNext = NULL;
- strcpy((char *)(*ppFileStack)->tzFileName,
- (char *)tzCurrentFileName);
+ strcpy((char *) (*ppFileStack)->tzFileName,
+ (char *) tzCurrentFileName);
(*ppFileStack)->nLine = nLineNo;
switch ((*ppFileStack)->nStatus = nCurrentStatus) {
case STAT_isMacroArg:
@@ -103,7 +104,8 @@
fatalerror("No memory for context");
}
-int popcontext(void)
+int
+popcontext(void)
{
struct sContext *pLastFile, **ppLastFile;
@@ -112,7 +114,7 @@
yy_delete_buffer(CurrentFlexHandle);
CurrentFlexHandle =
yy_scan_bytes(pCurrentREPTBlock,
- nCurrentREPTBlockSize);
+ nCurrentREPTBlockSize);
yy_switch_to_buffer(CurrentFlexHandle);
sym_UseCurrentMacroArgs();
sym_SetMacroArgID(nMacroCount++);
@@ -120,7 +122,6 @@
return (0);
}
}
-
if ((pLastFile = pFileStack) != NULL) {
ppLastFile = &pFileStack;
while (pLastFile->pNext) {
@@ -140,8 +141,8 @@
nLineNo += 1;
CurrentFlexHandle = pLastFile->FlexHandle;
- strcpy((char *)tzCurrentFileName,
- (char *)pLastFile->tzFileName);
+ strcpy((char *) tzCurrentFileName,
+ (char *) pLastFile->tzFileName);
switch (nCurrentStatus = pLastFile->nStatus) {
case STAT_isMacroArg:
case STAT_isMacro:
@@ -167,11 +168,11 @@
return (1);
}
-int yywrap(void)
+int
+yywrap(void)
{
return (popcontext());
}
-
/*
* RGBAsm - FSTACK.C (FileStack routines)
*
@@ -179,7 +180,8 @@
*
*/
-void fstk_Dump(void)
+void
+fstk_Dump(void)
{
struct sContext *pLastFile;
@@ -192,7 +194,6 @@
printf("%s(%ld)", tzCurrentFileName, nLineNo);
}
-
/*
* RGBAsm - FSTACK.C (FileStack routines)
*
@@ -200,12 +201,14 @@
*
*/
-void fstk_AddIncludePath(char *s)
+void
+fstk_AddIncludePath(char *s)
{
strcpy(IncludePaths[NextIncPath++], s);
}
-void fstk_FindFile(char *s)
+void
+fstk_FindFile(char *s)
{
char t[_MAX_PATH + 1];
SLONG i = -1;
@@ -227,7 +230,6 @@
}
}
}
-
/*
* RGBAsm - FSTACK.C (FileStack routines)
*
@@ -235,16 +237,17 @@
*
*/
-ULONG fstk_RunInclude(char *s)
+ULONG
+fstk_RunInclude(char *s)
{
FILE *f;
char tzFileName[_MAX_PATH + 1];
- //printf( "INCLUDE: %s\n", s );
+ //printf("INCLUDE: %s\n", s);
strcpy(tzFileName, s);
fstk_FindFile(tzFileName);
- //printf( "INCLUDING: %s\n", tzFileName );
+ //printf("INCLUDING: %s\n", tzFileName);
if ((f = fopen(tzFileName, "rt")) != NULL) {
pushcontext();
@@ -255,9 +258,9 @@
CurrentFlexHandle = yy_create_buffer(pCurrentFile);
yy_switch_to_buffer(CurrentFlexHandle);
- // Dirty hack to give the INCLUDE directive a linefeed
+ //Dirty hack to give the INCLUDE directive a linefeed
- yyunput('\n');
+ yyunput('\n');
nLineNo -= 1;
return (1);
@@ -264,7 +267,6 @@
} else
return (0);
}
-
/*
* RGBAsm - FSTACK.C (FileStack routines)
*
@@ -272,7 +274,8 @@
*
*/
-ULONG fstk_RunMacro(char *s)
+ULONG
+fstk_RunMacro(char *s)
{
struct sSymbol *sym;
@@ -286,13 +289,12 @@
pCurrentMacro = sym;
CurrentFlexHandle =
yy_scan_bytes(pCurrentMacro->pMacro,
- pCurrentMacro->ulMacroSize);
+ pCurrentMacro->ulMacroSize);
yy_switch_to_buffer(CurrentFlexHandle);
return (1);
} else
return (0);
}
-
/*
* RGBAsm - FSTACK.C (FileStack routines)
*
@@ -300,7 +302,8 @@
*
*/
-void fstk_RunMacroArg(SLONG s)
+void
+fstk_RunMacroArg(SLONG s)
{
char *sym;
@@ -318,7 +321,6 @@
} else
fatalerror("No such macroargument");
}
-
/*
* RGBAsm - FSTACK.C (FileStack routines)
*
@@ -326,7 +328,8 @@
*
*/
-void fstk_RunString(char *s)
+void
+fstk_RunString(char *s)
{
struct sSymbol *pSym;
@@ -340,7 +343,6 @@
} else
yyerror("No such string symbol");
}
-
/*
* RGBAsm - FSTACK.C (FileStack routines)
*
@@ -348,7 +350,8 @@
*
*/
-void fstk_RunRept(ULONG count)
+void
+fstk_RunRept(ULONG count)
{
if (count) {
pushcontext();
@@ -364,7 +367,6 @@
yy_switch_to_buffer(CurrentFlexHandle);
}
}
-
/*
* RGBAsm - FSTACK.C (FileStack routines)
*
@@ -372,7 +374,8 @@
*
*/
-ULONG fstk_Init(char *s)
+ULONG
+fstk_Init(char *s)
{
char tzFileName[_MAX_PATH + 1];
--- a/src/asm/gameboy/locallex.c
+++ b/src/asm/gameboy/locallex.c
@@ -5,85 +5,85 @@
#include "../asmy.h"
struct sLexInitString localstrings[] = {
- { "adc", T_Z80_ADC },
- { "add", T_Z80_ADD },
- { "and", T_Z80_AND },
- { "bit", T_Z80_BIT },
- { "call", T_Z80_CALL },
- { "ccf", T_Z80_CCF },
- { "cpl", T_Z80_CPL },
- { "cp", T_Z80_CP },
- { "daa", T_Z80_DAA },
- { "dec", T_Z80_DEC },
- { "di", T_Z80_DI },
- { "ei", T_Z80_EI },
- { "ex", T_Z80_EX },
- { "halt", T_Z80_HALT },
- { "inc", T_Z80_INC },
- { "jp", T_Z80_JP },
- { "jr", T_Z80_JR },
- { "ld", T_Z80_LD },
- { "ldi", T_Z80_LDI },
- { "ldd", T_Z80_LDD },
- { "ldio", T_Z80_LDIO },
- { "ldh", T_Z80_LDIO },
- { "nop", T_Z80_NOP },
- { "or", T_Z80_OR },
- { "pop", T_Z80_POP },
- { "push", T_Z80_PUSH },
- { "res", T_Z80_RES },
- { "reti", T_Z80_RETI },
- { "ret", T_Z80_RET },
- { "rlca", T_Z80_RLCA },
- { "rlc", T_Z80_RLC },
- { "rla", T_Z80_RLA },
- { "rl", T_Z80_RL },
- { "rrc", T_Z80_RRC },
- { "rrca", T_Z80_RRCA },
- { "rra", T_Z80_RRA },
- { "rr", T_Z80_RR },
- { "rst", T_Z80_RST },
- { "sbc", T_Z80_SBC },
- { "scf", T_Z80_SCF },
+ {"adc", T_Z80_ADC},
+ {"add", T_Z80_ADD},
+ {"and", T_Z80_AND},
+ {"bit", T_Z80_BIT},
+ {"call", T_Z80_CALL},
+ {"ccf", T_Z80_CCF},
+ {"cpl", T_Z80_CPL},
+ {"cp", T_Z80_CP},
+ {"daa", T_Z80_DAA},
+ {"dec", T_Z80_DEC},
+ {"di", T_Z80_DI},
+ {"ei", T_Z80_EI},
+ {"ex", T_Z80_EX},
+ {"halt", T_Z80_HALT},
+ {"inc", T_Z80_INC},
+ {"jp", T_Z80_JP},
+ {"jr", T_Z80_JR},
+ {"ld", T_Z80_LD},
+ {"ldi", T_Z80_LDI},
+ {"ldd", T_Z80_LDD},
+ {"ldio", T_Z80_LDIO},
+ {"ldh", T_Z80_LDIO},
+ {"nop", T_Z80_NOP},
+ {"or", T_Z80_OR},
+ {"pop", T_Z80_POP},
+ {"push", T_Z80_PUSH},
+ {"res", T_Z80_RES},
+ {"reti", T_Z80_RETI},
+ {"ret", T_Z80_RET},
+ {"rlca", T_Z80_RLCA},
+ {"rlc", T_Z80_RLC},
+ {"rla", T_Z80_RLA},
+ {"rl", T_Z80_RL},
+ {"rrc", T_Z80_RRC},
+ {"rrca", T_Z80_RRCA},
+ {"rra", T_Z80_RRA},
+ {"rr", T_Z80_RR},
+ {"rst", T_Z80_RST},
+ {"sbc", T_Z80_SBC},
+ {"scf", T_Z80_SCF},
/* Handled by globallex.c */
/* { "set", T_POP_SET }, */
- { "sla", T_Z80_SLA },
- { "sra", T_Z80_SRA },
- { "srl", T_Z80_SRL },
- { "stop", T_Z80_STOP },
- { "sub", T_Z80_SUB },
- { "swap", T_Z80_SWAP },
- { "xor", T_Z80_XOR },
+ {"sla", T_Z80_SLA},
+ {"sra", T_Z80_SRA},
+ {"srl", T_Z80_SRL},
+ {"stop", T_Z80_STOP},
+ {"sub", T_Z80_SUB},
+ {"swap", T_Z80_SWAP},
+ {"xor", T_Z80_XOR},
- { "nz", T_CC_NZ },
- { "z", T_CC_Z },
- { "nc", T_CC_NC },
+ {"nz", T_CC_NZ},
+ {"z", T_CC_Z},
+ {"nc", T_CC_NC},
/* { "c", T_MODE_C }, */
- { "[hl]", T_MODE_HL_IND },
- { "[hl+]", T_MODE_HL_INDINC },
- { "[hl-]", T_MODE_HL_INDDEC },
- { "[hli]", T_MODE_HL_INDINC },
- { "[hld]", T_MODE_HL_INDDEC },
- { "hl", T_MODE_HL },
- { "af", T_MODE_AF },
- { "[bc]", T_MODE_BC_IND },
- { "bc", T_MODE_BC },
- { "[de]", T_MODE_DE_IND },
- { "de", T_MODE_DE },
- { "[sp]", T_MODE_SP_IND },
- { "sp", T_MODE_SP },
- { "a", T_MODE_A },
- { "b", T_MODE_B },
- { "[$ff00+c]", T_MODE_C_IND },
- { "[c]", T_MODE_C_IND },
- { "c", T_MODE_C },
- { "d", T_MODE_D },
- { "e", T_MODE_E },
- { "h", T_MODE_H },
- { "l", T_MODE_L },
+ {"[hl]", T_MODE_HL_IND},
+ {"[hl+]", T_MODE_HL_INDINC},
+ {"[hl-]", T_MODE_HL_INDDEC},
+ {"[hli]", T_MODE_HL_INDINC},
+ {"[hld]", T_MODE_HL_INDDEC},
+ {"hl", T_MODE_HL},
+ {"af", T_MODE_AF},
+ {"[bc]", T_MODE_BC_IND},
+ {"bc", T_MODE_BC},
+ {"[de]", T_MODE_DE_IND},
+ {"de", T_MODE_DE},
+ {"[sp]", T_MODE_SP_IND},
+ {"sp", T_MODE_SP},
+ {"a", T_MODE_A},
+ {"b", T_MODE_B},
+ {"[$ff00+c]", T_MODE_C_IND},
+ {"[c]", T_MODE_C_IND},
+ {"c", T_MODE_C},
+ {"d", T_MODE_D},
+ {"e", T_MODE_E},
+ {"h", T_MODE_H},
+ {"l", T_MODE_L},
- { NULL, 0 }
+ {NULL, 0}
};
--- a/src/asm/globlex.c
+++ b/src/asm/globlex.c
@@ -16,7 +16,8 @@
SLONG nGBGfxID = -1;
SLONG nBinaryID = -1;
-SLONG gbgfx2bin(char ch)
+SLONG
+gbgfx2bin(char ch)
{
SLONG i;
@@ -29,7 +30,8 @@
return (0);
}
-SLONG binary2bin(char ch)
+SLONG
+binary2bin(char ch)
{
SLONG i;
@@ -37,13 +39,13 @@
if (CurrentOptions.binary[i] == ch) {
return (i);
}
-
}
return (0);
}
-SLONG char2bin(char ch)
+SLONG
+char2bin(char ch)
{
if (ch >= 'a' && ch <= 'f')
return (ch - 'a' + 10);
@@ -59,7 +61,8 @@
typedef SLONG(*x2bin) (char ch);
-SLONG ascii2bin(char *s)
+SLONG
+ascii2bin(char *s)
{
SLONG radix = 10;
SLONG result = 0;
@@ -103,7 +106,8 @@
return (result);
}
-ULONG ParseFixedPoint(char *s, ULONG size)
+ULONG
+ParseFixedPoint(char *s, ULONG size)
{
char dest[256];
ULONG i = 0, dot = 0;
@@ -128,7 +132,8 @@
return (1);
}
-ULONG ParseNumber(char *s, ULONG size)
+ULONG
+ParseNumber(char *s, ULONG size)
{
char dest[256];
@@ -139,7 +144,8 @@
return (1);
}
-ULONG ParseSymbol(char *src, ULONG size)
+ULONG
+ParseSymbol(char *src, ULONG size)
{
char dest[MAXSYMLEN + 1];
int copied = 0, size_backup = size;
@@ -196,7 +202,8 @@
}
}
-ULONG PutMacroArg(char *src, ULONG size)
+ULONG
+PutMacroArg(char *src, ULONG size)
{
char *s;
@@ -209,7 +216,8 @@
return (0);
}
-ULONG PutUniqueArg(char *src, ULONG size)
+ULONG
+PutUniqueArg(char *src, ULONG size)
{
src = src;
yyskipbytes(size);
@@ -225,119 +233,119 @@
extern struct sLexInitString localstrings[];
struct sLexInitString staticstrings[] = {
- { "||", T_OP_LOGICOR },
- { "&&", T_OP_LOGICAND },
- { "==", T_OP_LOGICEQU },
- { ">", T_OP_LOGICGT },
- { "<", T_OP_LOGICLT },
- { ">=", T_OP_LOGICGE },
- { "<=", T_OP_LOGICLE },
- { "!=", T_OP_LOGICNE },
- { "!", T_OP_LOGICNOT },
- { "|", T_OP_OR },
- { "^", T_OP_XOR },
- { "&", T_OP_AND },
- { "<<", T_OP_SHL },
- { ">>", T_OP_SHR },
- { "+", T_OP_ADD },
- { "-", T_OP_SUB },
- { "*", T_OP_MUL },
- { "/", T_OP_DIV },
- { "%", T_OP_MOD },
- { "~", T_OP_NOT },
+ {"||", T_OP_LOGICOR},
+ {"&&", T_OP_LOGICAND},
+ {"==", T_OP_LOGICEQU},
+ {">", T_OP_LOGICGT},
+ {"<", T_OP_LOGICLT},
+ {">=", T_OP_LOGICGE},
+ {"<=", T_OP_LOGICLE},
+ {"!=", T_OP_LOGICNE},
+ {"!", T_OP_LOGICNOT},
+ {"|", T_OP_OR},
+ {"^", T_OP_XOR},
+ {"&", T_OP_AND},
+ {"<<", T_OP_SHL},
+ {">>", T_OP_SHR},
+ {"+", T_OP_ADD},
+ {"-", T_OP_SUB},
+ {"*", T_OP_MUL},
+ {"/", T_OP_DIV},
+ {"%", T_OP_MOD},
+ {"~", T_OP_NOT},
- { "def", T_OP_DEF },
+ {"def", T_OP_DEF},
- { "bank", T_OP_BANK },
+ {"bank", T_OP_BANK},
- { "div", T_OP_FDIV },
- { "mul", T_OP_FMUL },
- { "sin", T_OP_SIN },
- { "cos", T_OP_COS },
- { "tan", T_OP_TAN },
- { "asin", T_OP_ASIN },
- { "acos", T_OP_ACOS },
- { "atan", T_OP_ATAN },
- { "atan2", T_OP_ATAN2 },
+ {"div", T_OP_FDIV},
+ {"mul", T_OP_FMUL},
+ {"sin", T_OP_SIN},
+ {"cos", T_OP_COS},
+ {"tan", T_OP_TAN},
+ {"asin", T_OP_ASIN},
+ {"acos", T_OP_ACOS},
+ {"atan", T_OP_ATAN},
+ {"atan2", T_OP_ATAN2},
- { "strcmp", T_OP_STRCMP },
- { "strin", T_OP_STRIN },
- { "strsub", T_OP_STRSUB },
- { "strlen", T_OP_STRLEN },
- { "strcat", T_OP_STRCAT },
- { "strupr", T_OP_STRUPR },
- { "strlwr", T_OP_STRLWR },
+ {"strcmp", T_OP_STRCMP},
+ {"strin", T_OP_STRIN},
+ {"strsub", T_OP_STRSUB},
+ {"strlen", T_OP_STRLEN},
+ {"strcat", T_OP_STRCAT},
+ {"strupr", T_OP_STRUPR},
+ {"strlwr", T_OP_STRLWR},
- { "include", T_POP_INCLUDE },
- { "printt", T_POP_PRINTT },
- { "printv", T_POP_PRINTV },
- { "printf", T_POP_PRINTF },
- { "export", T_POP_EXPORT },
- { "xdef", T_POP_EXPORT },
- { "import", T_POP_IMPORT },
- { "xref", T_POP_IMPORT },
- { "global", T_POP_GLOBAL },
- { "ds", T_POP_DS },
- { NAME_DB, T_POP_DB },
- { NAME_DW, T_POP_DW },
+ {"include", T_POP_INCLUDE},
+ {"printt", T_POP_PRINTT},
+ {"printv", T_POP_PRINTV},
+ {"printf", T_POP_PRINTF},
+ {"export", T_POP_EXPORT},
+ {"xdef", T_POP_EXPORT},
+ {"import", T_POP_IMPORT},
+ {"xref", T_POP_IMPORT},
+ {"global", T_POP_GLOBAL},
+ {"ds", T_POP_DS},
+ {NAME_DB, T_POP_DB},
+ {NAME_DW, T_POP_DW},
#ifdef NAME_DL
- { NAME_DL, T_POP_DL },
+ {NAME_DL, T_POP_DL},
#endif
- { "section", T_POP_SECTION },
- { "purge", T_POP_PURGE },
+ {"section", T_POP_SECTION},
+ {"purge", T_POP_PURGE},
- { "rsreset", T_POP_RSRESET },
- { "rsset", T_POP_RSSET },
+ {"rsreset", T_POP_RSRESET},
+ {"rsset", T_POP_RSSET},
- { "incbin", T_POP_INCBIN },
+ {"incbin", T_POP_INCBIN},
- { "fail", T_POP_FAIL },
- { "warn", T_POP_WARN },
+ {"fail", T_POP_FAIL},
+ {"warn", T_POP_WARN},
- { "macro", T_POP_MACRO },
+ {"macro", T_POP_MACRO},
/* Not needed but we have it here just to protect the name */
- { "endm", T_POP_ENDM },
- { "shift", T_POP_SHIFT },
+ {"endm", T_POP_ENDM},
+ {"shift", T_POP_SHIFT},
- { "rept", T_POP_REPT },
+ {"rept", T_POP_REPT},
/* Not needed but we have it here just to protect the name */
- { "endr", T_POP_ENDR },
+ {"endr", T_POP_ENDR},
- { "if", T_POP_IF },
- { "else", T_POP_ELSE },
- { "endc", T_POP_ENDC },
+ {"if", T_POP_IF},
+ {"else", T_POP_ELSE},
+ {"endc", T_POP_ENDC},
- { "bss", T_SECT_BSS },
+ {"bss", T_SECT_BSS},
#if defined(GAMEBOY) || defined(PCENGINE)
- { "vram", T_SECT_VRAM },
+ {"vram", T_SECT_VRAM},
#endif
- { "code", T_SECT_CODE },
- { "data", T_SECT_CODE },
+ {"code", T_SECT_CODE},
+ {"data", T_SECT_CODE},
#ifdef GAMEBOY
- { "home", T_SECT_HOME },
- { "hram", T_SECT_HRAM },
+ {"home", T_SECT_HOME},
+ {"hram", T_SECT_HRAM},
#endif
- { NAME_RB, T_POP_RB },
- { NAME_RW, T_POP_RW },
+ {NAME_RB, T_POP_RB},
+ {NAME_RW, T_POP_RW},
#ifdef NAME_RL
- { NAME_RL, T_POP_RL },
+ {NAME_RL, T_POP_RL},
#endif
- { "equ", T_POP_EQU },
- { "equs", T_POP_EQUS },
+ {"equ", T_POP_EQU},
+ {"equs", T_POP_EQUS},
- { "set", T_POP_SET },
- { "=", T_POP_SET },
+ {"set", T_POP_SET},
+ {"=", T_POP_SET},
- { "pushs", T_POP_PUSHS },
- { "pops", T_POP_POPS },
- { "pusho", T_POP_PUSHO },
- { "popo", T_POP_POPO },
+ {"pushs", T_POP_PUSHS},
+ {"pops", T_POP_POPS},
+ {"pusho", T_POP_PUSHO},
+ {"popo", T_POP_POPO},
- { "opt", T_POP_OPT },
+ {"opt", T_POP_OPT},
- { NULL, 0 }
+ {NULL, 0}
};
struct sLexFloat tNumberToken = {
@@ -365,7 +373,8 @@
T_LEX_MACROUNIQUE
};
-void setuplex(void)
+void
+setuplex(void)
{
ULONG id;
@@ -373,9 +382,9 @@
lex_AddStrings(staticstrings);
lex_AddStrings(localstrings);
- // Macro arguments
+ //Macro arguments
- id = lex_FloatAlloc(&tMacroArgToken);
+ id = lex_FloatAlloc(&tMacroArgToken);
lex_FloatAddFirstRange(id, '\\', '\\');
lex_FloatAddSecondRange(id, '0', '9');
id = lex_FloatAlloc(&tMacroUniqueToken);
@@ -382,53 +391,53 @@
lex_FloatAddFirstRange(id, '\\', '\\');
lex_FloatAddSecondRange(id, '@', '@');
- // Decimal constants
+ //Decimal constants
- id = lex_FloatAlloc(&tNumberToken);
+ id = lex_FloatAlloc(&tNumberToken);
lex_FloatAddFirstRange(id, '0', '9');
lex_FloatAddSecondRange(id, '0', '9');
lex_FloatAddRange(id, '0', '9');
- // Binary constants
+ //Binary constants
- nBinaryID = id = lex_FloatAlloc(&tNumberToken);
+ nBinaryID = id = lex_FloatAlloc(&tNumberToken);
lex_FloatAddFirstRange(id, '%', '%');
lex_FloatAddSecondRange(id, CurrentOptions.binary[0],
- CurrentOptions.binary[0]);
+ CurrentOptions.binary[0]);
lex_FloatAddSecondRange(id, CurrentOptions.binary[1],
- CurrentOptions.binary[1]);
+ CurrentOptions.binary[1]);
lex_FloatAddRange(id, CurrentOptions.binary[0],
- CurrentOptions.binary[0]);
+ CurrentOptions.binary[0]);
lex_FloatAddRange(id, CurrentOptions.binary[1],
- CurrentOptions.binary[1]);
+ CurrentOptions.binary[1]);
- // Octal constants
+ //Octal constants
- id = lex_FloatAlloc(&tNumberToken);
+ id = lex_FloatAlloc(&tNumberToken);
lex_FloatAddFirstRange(id, '&', '&');
lex_FloatAddSecondRange(id, '0', '7');
lex_FloatAddRange(id, '0', '7');
- // Gameboy gfx constants
+ //Gameboy gfx constants
- nGBGfxID = id = lex_FloatAlloc(&tNumberToken);
+ nGBGfxID = id = lex_FloatAlloc(&tNumberToken);
lex_FloatAddFirstRange(id, '`', '`');
lex_FloatAddSecondRange(id, CurrentOptions.gbgfx[0],
- CurrentOptions.gbgfx[0]);
+ CurrentOptions.gbgfx[0]);
lex_FloatAddSecondRange(id, CurrentOptions.gbgfx[1],
- CurrentOptions.gbgfx[1]);
+ CurrentOptions.gbgfx[1]);
lex_FloatAddSecondRange(id, CurrentOptions.gbgfx[2],
- CurrentOptions.gbgfx[2]);
+ CurrentOptions.gbgfx[2]);
lex_FloatAddSecondRange(id, CurrentOptions.gbgfx[3],
- CurrentOptions.gbgfx[3]);
+ CurrentOptions.gbgfx[3]);
lex_FloatAddRange(id, CurrentOptions.gbgfx[0], CurrentOptions.gbgfx[0]);
lex_FloatAddRange(id, CurrentOptions.gbgfx[1], CurrentOptions.gbgfx[1]);
lex_FloatAddRange(id, CurrentOptions.gbgfx[2], CurrentOptions.gbgfx[2]);
lex_FloatAddRange(id, CurrentOptions.gbgfx[3], CurrentOptions.gbgfx[3]);
- // Hex constants
+ //Hex constants
- id = lex_FloatAlloc(&tNumberToken);
+ id = lex_FloatAlloc(&tNumberToken);
lex_FloatAddFirstRange(id, '$', '$');
lex_FloatAddSecondRange(id, '0', '9');
lex_FloatAddSecondRange(id, 'A', 'F');
@@ -437,9 +446,9 @@
lex_FloatAddRange(id, 'A', 'F');
lex_FloatAddRange(id, 'a', 'f');
- // ID's
+ //ID 's
- id = lex_FloatAlloc(&tIDToken);
+ id = lex_FloatAlloc(&tIDToken);
lex_FloatAddFirstRange(id, 'a', 'z');
lex_FloatAddFirstRange(id, 'A', 'Z');
lex_FloatAddFirstRange(id, '_', '_');
@@ -458,9 +467,9 @@
lex_FloatAddRange(id, '@', '@');
lex_FloatAddRange(id, '#', '#');
- // Local ID
+ //Local ID
- id = lex_FloatAlloc(&tIDToken);
+ id = lex_FloatAlloc(&tIDToken);
lex_FloatAddFirstRange(id, '.', '.');
lex_FloatAddSecondRange(id, 'a', 'z');
lex_FloatAddSecondRange(id, 'A', 'Z');
@@ -473,14 +482,14 @@
lex_FloatAddRange(id, '@', '@');
lex_FloatAddRange(id, '#', '#');
- // @ ID
+ //@ID
- id = lex_FloatAlloc(&tIDToken);
+ id = lex_FloatAlloc(&tIDToken);
lex_FloatAddFirstRange(id, '@', '@');
- // Fixed point constants
+ //Fixed point constants
- id = lex_FloatAlloc(&tFixedPointToken);
+ id = lex_FloatAlloc(&tFixedPointToken);
lex_FloatAddFirstRange(id, '.', '.');
lex_FloatAddFirstRange(id, '0', '9');
lex_FloatAddSecondRange(id, '.', '.');
--- a/src/asm/lexer.c
+++ b/src/asm/lexer.c
@@ -18,7 +18,6 @@
ULONG nNameLength;
struct sLexString *pNext;
};
-
#define pLexBuffer (pCurrentBuffer->pBuffer)
#define nLexBufferLeng (pCurrentBuffer->nBufferSize)
@@ -41,7 +40,8 @@
#define AtLineStart pCurrentBuffer->oAtLineStart
#ifdef __GNUC__
-void strupr(char *s)
+void
+strupr(char *s)
{
while (*s) {
*s = toupper(*s);
@@ -49,7 +49,8 @@
}
}
-void strlwr(char *s)
+void
+strlwr(char *s)
{
while (*s) {
*s = tolower(*s);
@@ -56,24 +57,27 @@
s += 1;
}
}
-
#endif
-void yyskipbytes(ULONG count)
+void
+yyskipbytes(ULONG count)
{
pLexBuffer += count;
}
-void yyunputbytes(ULONG count)
+void
+yyunputbytes(ULONG count)
{
pLexBuffer -= count;
}
-void yyunput(char c)
+void
+yyunput(char c)
{
*(--pLexBuffer) = c;
}
-void yyunputstr(char *s)
+void
+yyunputstr(char *s)
{
SLONG i;
@@ -83,31 +87,35 @@
yyunput(s[i--]);
}
-void yy_switch_to_buffer(YY_BUFFER_STATE buf)
+void
+yy_switch_to_buffer(YY_BUFFER_STATE buf)
{
pCurrentBuffer = buf;
}
-void yy_set_state(enum eLexerState i)
+void
+yy_set_state(enum eLexerState i)
{
lexerstate = i;
}
-void yy_delete_buffer(YY_BUFFER_STATE buf)
+void
+yy_delete_buffer(YY_BUFFER_STATE buf)
{
free(buf->pBufferStart - SAFETYMARGIN);
free(buf);
}
-YY_BUFFER_STATE yy_scan_bytes(char *mem, ULONG size)
+YY_BUFFER_STATE
+yy_scan_bytes(char *mem, ULONG size)
{
YY_BUFFER_STATE pBuffer;
if ((pBuffer =
- (YY_BUFFER_STATE) malloc(sizeof(struct yy_buffer_state))) !=
+ (YY_BUFFER_STATE) malloc(sizeof(struct yy_buffer_state))) !=
NULL) {
if ((pBuffer->pBuffer = pBuffer->pBufferStart =
- (char *)malloc(size + 1 + SAFETYMARGIN)) != NULL) {
+ (char *) malloc(size + 1 + SAFETYMARGIN)) != NULL) {
pBuffer->pBuffer += SAFETYMARGIN;
pBuffer->pBufferStart += SAFETYMARGIN;
memcpy(pBuffer->pBuffer, mem, size);
@@ -117,17 +125,17 @@
return (pBuffer);
}
}
-
fatalerror("Out of memory!");
return (NULL);
}
-YY_BUFFER_STATE yy_create_buffer(FILE * f)
+YY_BUFFER_STATE
+yy_create_buffer(FILE * f)
{
YY_BUFFER_STATE pBuffer;
if ((pBuffer =
- (YY_BUFFER_STATE) malloc(sizeof(struct yy_buffer_state))) !=
+ (YY_BUFFER_STATE) malloc(sizeof(struct yy_buffer_state))) !=
NULL) {
ULONG size;
@@ -136,7 +144,7 @@
fseek(f, 0, SEEK_SET);
if ((pBuffer->pBuffer = pBuffer->pBufferStart =
- (char *)malloc(size + 2 + SAFETYMARGIN)) != NULL) {
+ (char *) malloc(size + 2 + SAFETYMARGIN)) != NULL) {
char *mem;
ULONG instring = 0;
@@ -167,15 +175,15 @@
mem[0] = '\n';
mem += 1;
} else if (mem[0] == '\n'
- && mem[1] == '*') {
+ && mem[1] == '*') {
mem += 1;
while (!
- (*mem == '\n'
+ (*mem == '\n'
|| *mem == '\0'))
*mem++ = ' ';
} else if (*mem == ';') {
while (!
- (*mem == '\n'
+ (*mem == '\n'
|| *mem == '\0'))
*mem++ = ' ';
} else
@@ -187,12 +195,12 @@
return (pBuffer);
}
}
-
fatalerror("Out of memory!");
return (NULL);
}
-ULONG lex_FloatAlloc(struct sLexFloat * tok)
+ULONG
+lex_FloatAlloc(struct sLexFloat * tok)
{
tLexFloat[nFloating] = (*tok);
@@ -199,7 +207,8 @@
return (1 << (nFloating++));
}
-void lex_FloatDeleteRange(ULONG id, UWORD start, UWORD end)
+void
+lex_FloatDeleteRange(ULONG id, UWORD start, UWORD end)
{
while (start <= end) {
tFloatingChars[start] &= ~id;
@@ -207,7 +216,8 @@
}
}
-void lex_FloatAddRange(ULONG id, UWORD start, UWORD end)
+void
+lex_FloatAddRange(ULONG id, UWORD start, UWORD end)
{
while (start <= end) {
tFloatingChars[start] |= id;
@@ -215,7 +225,8 @@
}
}
-void lex_FloatDeleteFirstRange(ULONG id, UWORD start, UWORD end)
+void
+lex_FloatDeleteFirstRange(ULONG id, UWORD start, UWORD end)
{
while (start <= end) {
tFloatingFirstChar[start] &= ~id;
@@ -223,7 +234,8 @@
}
}
-void lex_FloatAddFirstRange(ULONG id, UWORD start, UWORD end)
+void
+lex_FloatAddFirstRange(ULONG id, UWORD start, UWORD end)
{
while (start <= end) {
tFloatingFirstChar[start] |= id;
@@ -231,7 +243,8 @@
}
}
-void lex_FloatDeleteSecondRange(ULONG id, UWORD start, UWORD end)
+void
+lex_FloatDeleteSecondRange(ULONG id, UWORD start, UWORD end)
{
while (start <= end) {
tFloatingSecondChar[start] &= ~id;
@@ -239,7 +252,8 @@
}
}
-void lex_FloatAddSecondRange(ULONG id, UWORD start, UWORD end)
+void
+lex_FloatAddSecondRange(ULONG id, UWORD start, UWORD end)
{
while (start <= end) {
tFloatingSecondChar[start] |= id;
@@ -247,7 +261,8 @@
}
}
-struct sLexFloat *lexgetfloat(ULONG id)
+struct sLexFloat *
+lexgetfloat(ULONG id)
{
ULONG r = 0, mask = 1;
@@ -262,7 +277,8 @@
return (&tLexFloat[r]);
}
-ULONG lexcalchash(char *s)
+ULONG
+lexcalchash(char *s)
{
ULONG r = 0;
@@ -274,7 +290,8 @@
return (r);
}
-void lex_Init(void)
+void
+lex_Init(void)
{
ULONG i;
@@ -292,7 +309,8 @@
nFloating = 0;
}
-void lex_AddStrings(struct sLexInitString *lex)
+void
+lex_AddStrings(struct sLexInitString * lex)
{
while (lex->tzName) {
struct sLexString **ppHash;
@@ -302,13 +320,13 @@
while (*ppHash)
ppHash = &((*ppHash)->pNext);
-// printf( "%s has hashvalue %d\n", lex->tzName, hash );
+ //printf("%s has hashvalue %d\n", lex->tzName, hash);
if (((*ppHash) =
- (struct sLexString *)malloc(sizeof(struct sLexString))) !=
+ (struct sLexString *) malloc(sizeof(struct sLexString))) !=
NULL) {
if (((*ppHash)->tzName =
- (char *)strdup(lex->tzName)) != NULL) {
+ (char *) strdup(lex->tzName)) != NULL) {
(*ppHash)->nNameLength = strlen(lex->tzName);
(*ppHash)->nToken = lex->nToken;
(*ppHash)->pNext = NULL;
@@ -327,7 +345,8 @@
}
}
-ULONG yylex(void)
+ULONG
+yylex(void)
{
ULONG hash, maxlen;
char *s;
@@ -339,7 +358,7 @@
case LEX_STATE_NORMAL:
AtLineStart = 0;
- scanagain:
+scanagain:
while (*pLexBuffer == ' ' || *pLexBuffer == '\t') {
linestart = 0;
@@ -353,7 +372,6 @@
goto scanagain;
}
}
-
s = pLexBuffer;
nOldFloatMask = nFloatLen = 0;
nFloatMask = tFloatingFirstChar[(int) *s++];
@@ -385,7 +403,7 @@
if (lex->nNameLength == yyleng) {
if (strnicmp
(pLexBuffer, lex->tzName,
- yyleng) == 0) {
+ yyleng) == 0) {
pLongestFixed = lex;
}
}
@@ -392,7 +410,6 @@
lex = lex->pNext;
}
}
-
}
if (nFloatLen == 0 && pLongestFixed == NULL) {
@@ -401,7 +418,7 @@
pLexBuffer += 1;
while ((*pLexBuffer != '"')
- && (*pLexBuffer != '\n')) {
+ && (*pLexBuffer != '\n')) {
char ch, *marg;
if ((ch = *pLexBuffer++) == '\\') {
@@ -423,9 +440,9 @@
case '8':
case '9':
if ((marg =
- sym_FindMacroArg(ch
- -
- '0'))
+ sym_FindMacroArg(ch
+ -
+ '0'))
!= NULL) {
while (*marg)
yylval.
@@ -438,8 +455,8 @@
break;
case '@':
if ((marg =
- sym_FindMacroArg
- (-1)) != NULL) {
+ sym_FindMacroArg
+ (-1)) != NULL) {
while (*marg)
yylval.
tzString
@@ -455,15 +472,14 @@
int i = 0;
while ((*pLexBuffer != '}')
- && (*pLexBuffer != '"')
- && (*pLexBuffer !=
- '\n')) {
+ && (*pLexBuffer != '"')
+ && (*pLexBuffer !=
+ '\n')) {
if ((ch =
- *pLexBuffer++) ==
+ *pLexBuffer++) ==
'\\') {
switch (ch =
- (*pLexBuffer++))
- {
+ (*pLexBuffer++)) {
case '0':
case '1':
case '2':
@@ -497,9 +513,9 @@
sym[i] = 0;
index +=
symvaluetostring(&yylval.
- tzString
- [index],
- sym);
+ tzString
+ [index],
+ sym);
if (*pLexBuffer == '}')
pLexBuffer += 1;
else
@@ -506,7 +522,6 @@
yyerror("Missing }");
ch = 0;
}
-
if (ch)
yylval.tzString[index++] = ch;
}
@@ -526,7 +541,7 @@
pLexBuffer += 1;
while ((*pLexBuffer != '}')
- && (*pLexBuffer != '\n')) {
+ && (*pLexBuffer != '\n')) {
if ((ch = *pLexBuffer++) == '\\') {
switch (ch = (*pLexBuffer++)) {
case '0':
@@ -540,9 +555,9 @@
case '8':
case '9':
if ((marg =
- sym_FindMacroArg(ch
- -
- '0'))
+ sym_FindMacroArg(ch
+ -
+ '0'))
!= NULL) {
while (*marg)
sym[i++]
@@ -553,8 +568,8 @@
break;
case '@':
if ((marg =
- sym_FindMacroArg
- (-1)) != NULL) {
+ sym_FindMacroArg
+ (-1)) != NULL) {
while (*marg)
sym[i++]
=
@@ -582,13 +597,11 @@
return (*pLexBuffer++);
}
}
-
if (nFloatLen == 0) {
yyleng = pLongestFixed->nNameLength;
pLexBuffer += yyleng;
return (pLongestFixed->nToken);
}
-
if (pLongestFixed == NULL) {
struct sLexFloat *tok;
@@ -598,7 +611,6 @@
if (tok->Callback(pLexBuffer, yyleng) == 0)
goto scanagain;
}
-
if (tok->nToken == T_ID && linestart) {
pLexBuffer += yyleng;
return (T_LABEL);
@@ -607,7 +619,6 @@
return (tok->nToken);
}
}
-
if (nFloatLen > pLongestFixed->nNameLength) {
struct sLexFloat *tok;
@@ -617,7 +628,6 @@
if (tok->Callback(pLexBuffer, yyleng) == 0)
goto scanagain;
}
-
if (tok->nToken == T_ID && linestart) {
pLexBuffer += yyleng;
return (T_LABEL);
@@ -642,7 +652,7 @@
}
while ((*pLexBuffer != ',')
- && (*pLexBuffer != '\n')) {
+ && (*pLexBuffer != '\n')) {
char ch, *marg;
if ((ch = *pLexBuffer++) == '\\') {
@@ -664,8 +674,8 @@
case '8':
case '9':
if ((marg =
- sym_FindMacroArg(ch -
- '0')) !=
+ sym_FindMacroArg(ch -
+ '0')) !=
NULL) {
while (*marg)
yylval.
@@ -677,7 +687,7 @@
break;
case '@':
if ((marg =
- sym_FindMacroArg(-1)) !=
+ sym_FindMacroArg(-1)) !=
NULL) {
while (*marg)
yylval.
@@ -693,13 +703,12 @@
int i = 0;
while ((*pLexBuffer != '}')
- && (*pLexBuffer != '"')
- && (*pLexBuffer != '\n')) {
+ && (*pLexBuffer != '"')
+ && (*pLexBuffer != '\n')) {
if ((ch =
- *pLexBuffer++) == '\\') {
+ *pLexBuffer++) == '\\') {
switch (ch =
- (*pLexBuffer++))
- {
+ (*pLexBuffer++)) {
case '0':
case '1':
case '2':
@@ -711,9 +720,9 @@
case '8':
case '9':
if ((marg =
- sym_FindMacroArg
- (ch -
- '0')) !=
+ sym_FindMacroArg
+ (ch -
+ '0')) !=
NULL) {
while
(*marg)
@@ -723,8 +732,8 @@
break;
case '@':
if ((marg =
- sym_FindMacroArg
- (-1)) !=
+ sym_FindMacroArg
+ (-1)) !=
NULL) {
while
(*marg)
@@ -739,8 +748,8 @@
sym[i] = 0;
index +=
symvaluetostring(&yylval.
- tzString[index],
- sym);
+ tzString[index],
+ sym);
if (*pLexBuffer == '}')
pLexBuffer += 1;
else
@@ -747,7 +756,6 @@
yyerror("Missing }");
ch = 0;
}
-
if (ch)
yylval.tzString[index++] = ch;
}
--- a/src/asm/main.c
+++ b/src/asm/main.c
@@ -56,73 +56,71 @@
struct sOptionStackEntry *pOptionStack = NULL;
-void opt_SetCurrentOptions(struct sOptions *pOpt)
+void
+opt_SetCurrentOptions(struct sOptions * pOpt)
{
if (nGBGfxID != -1) {
lex_FloatDeleteRange(nGBGfxID, CurrentOptions.gbgfx[0],
- CurrentOptions.gbgfx[0]);
+ CurrentOptions.gbgfx[0]);
lex_FloatDeleteRange(nGBGfxID, CurrentOptions.gbgfx[1],
- CurrentOptions.gbgfx[1]);
+ CurrentOptions.gbgfx[1]);
lex_FloatDeleteRange(nGBGfxID, CurrentOptions.gbgfx[2],
- CurrentOptions.gbgfx[2]);
+ CurrentOptions.gbgfx[2]);
lex_FloatDeleteRange(nGBGfxID, CurrentOptions.gbgfx[3],
- CurrentOptions.gbgfx[3]);
+ CurrentOptions.gbgfx[3]);
lex_FloatDeleteSecondRange(nGBGfxID, CurrentOptions.gbgfx[0],
- CurrentOptions.gbgfx[0]);
+ CurrentOptions.gbgfx[0]);
lex_FloatDeleteSecondRange(nGBGfxID, CurrentOptions.gbgfx[1],
- CurrentOptions.gbgfx[1]);
+ CurrentOptions.gbgfx[1]);
lex_FloatDeleteSecondRange(nGBGfxID, CurrentOptions.gbgfx[2],
- CurrentOptions.gbgfx[2]);
+ CurrentOptions.gbgfx[2]);
lex_FloatDeleteSecondRange(nGBGfxID, CurrentOptions.gbgfx[3],
- CurrentOptions.gbgfx[3]);
+ CurrentOptions.gbgfx[3]);
}
-
if (nBinaryID != -1) {
lex_FloatDeleteRange(nBinaryID, CurrentOptions.binary[0],
- CurrentOptions.binary[0]);
+ CurrentOptions.binary[0]);
lex_FloatDeleteRange(nBinaryID, CurrentOptions.binary[1],
- CurrentOptions.binary[1]);
+ CurrentOptions.binary[1]);
lex_FloatDeleteSecondRange(nBinaryID, CurrentOptions.binary[0],
- CurrentOptions.binary[0]);
+ CurrentOptions.binary[0]);
lex_FloatDeleteSecondRange(nBinaryID, CurrentOptions.binary[1],
- CurrentOptions.binary[1]);
+ CurrentOptions.binary[1]);
}
-
CurrentOptions = *pOpt;
if (nGBGfxID != -1) {
lex_FloatAddRange(nGBGfxID, CurrentOptions.gbgfx[0],
- CurrentOptions.gbgfx[0]);
+ CurrentOptions.gbgfx[0]);
lex_FloatAddRange(nGBGfxID, CurrentOptions.gbgfx[1],
- CurrentOptions.gbgfx[1]);
+ CurrentOptions.gbgfx[1]);
lex_FloatAddRange(nGBGfxID, CurrentOptions.gbgfx[2],
- CurrentOptions.gbgfx[2]);
+ CurrentOptions.gbgfx[2]);
lex_FloatAddRange(nGBGfxID, CurrentOptions.gbgfx[3],
- CurrentOptions.gbgfx[3]);
+ CurrentOptions.gbgfx[3]);
lex_FloatAddSecondRange(nGBGfxID, CurrentOptions.gbgfx[0],
- CurrentOptions.gbgfx[0]);
+ CurrentOptions.gbgfx[0]);
lex_FloatAddSecondRange(nGBGfxID, CurrentOptions.gbgfx[1],
- CurrentOptions.gbgfx[1]);
+ CurrentOptions.gbgfx[1]);
lex_FloatAddSecondRange(nGBGfxID, CurrentOptions.gbgfx[2],
- CurrentOptions.gbgfx[2]);
+ CurrentOptions.gbgfx[2]);
lex_FloatAddSecondRange(nGBGfxID, CurrentOptions.gbgfx[3],
- CurrentOptions.gbgfx[3]);
+ CurrentOptions.gbgfx[3]);
}
-
if (nBinaryID != -1) {
lex_FloatAddRange(nBinaryID, CurrentOptions.binary[0],
- CurrentOptions.binary[0]);
+ CurrentOptions.binary[0]);
lex_FloatAddRange(nBinaryID, CurrentOptions.binary[1],
- CurrentOptions.binary[1]);
+ CurrentOptions.binary[1]);
lex_FloatAddSecondRange(nBinaryID, CurrentOptions.binary[0],
- CurrentOptions.binary[0]);
+ CurrentOptions.binary[0]);
lex_FloatAddSecondRange(nBinaryID, CurrentOptions.binary[1],
- CurrentOptions.binary[1]);
+ CurrentOptions.binary[1]);
}
-
}
-void opt_Parse(char *s)
+void
+opt_Parse(char *s)
{
struct sOptions newopt;
@@ -197,13 +195,14 @@
opt_SetCurrentOptions(&newopt);
}
-void opt_Push(void)
+void
+opt_Push(void)
{
struct sOptionStackEntry *pOpt;
if ((pOpt =
- (struct sOptionStackEntry *)
- malloc(sizeof(struct sOptionStackEntry))) != NULL) {
+ (struct sOptionStackEntry *)
+ malloc(sizeof(struct sOptionStackEntry))) != NULL) {
pOpt->Options = CurrentOptions;
pOpt->pNext = pOptionStack;
pOptionStack = pOpt;
@@ -211,7 +210,8 @@
fatalerror("No memory for option stack");
}
-void opt_Pop(void)
+void
+opt_Pop(void)
{
if (pOptionStack) {
struct sOptionStackEntry *pOpt;
@@ -223,7 +223,6 @@
} else
fatalerror("No entries in the option stack");
}
-
/*
* RGBAsm - MAIN.C
*
@@ -231,7 +230,8 @@
*
*/
-void yyerror(char *s)
+void
+yyerror(char *s)
{
printf("*ERROR*\t");
fstk_Dump();
@@ -239,12 +239,12 @@
nErrors += 1;
}
-void fatalerror(char *s)
+void
+fatalerror(char *s)
{
yyerror(s);
exit(5);
}
-
/*
* RGBAsm - MAIN.C
*
@@ -252,10 +252,11 @@
*
*/
-void PrintUsage(void)
+void
+PrintUsage(void)
{
printf(APPNAME " v" ASM_VERSION " (part of ASMotor " ASMOTOR_VERSION
- ")\n\nUsage: " EXENAME " [options] asmfile\n");
+ ")\n\nUsage: " EXENAME " [options] asmfile\n");
printf("Options:\n");
printf("\t-h\t\tThis text\n");
printf("\t-i<path>\tExtra include path\n");
@@ -263,16 +264,15 @@
printf("\t-e(l|b)\t\tChange endianness (CAUTION!)\n");
printf
("\t-g<ASCI>\tChange the four characters used for Gameboy graphics\n"
- "\t\t\tconstants (default is 0123)\n");
+ "\t\t\tconstants (default is 0123)\n");
printf
("\t-b<AS>\t\tChange the two characters used for binary constants\n"
- "\t\t\t(default is 01)\n");
+ "\t\t\t(default is 01)\n");
printf
("\t-z<hx>\t\tSet the byte value (hex format) used for uninitialised\n"
- "\t\t\tdata (default is ? for random)\n");
+ "\t\t\tdata (default is ? for random)\n");
exit(0);
}
-
/*
* RGBAsm - MAIN.C
*
@@ -280,7 +280,8 @@
*
*/
-int main(int argc, char *argv[])
+int
+main(int argc, char *argv[])
{
char *tzMainfile;
int argn = 1;
@@ -299,8 +300,9 @@
DefaultOptions.gbgfx[3] = '3';
DefaultOptions.binary[0] = '0';
DefaultOptions.binary[1] = '1';
- DefaultOptions.fillchar = -1; // fill uninitialised data with random values
- opt_SetCurrentOptions(&DefaultOptions);
+ DefaultOptions.fillchar = -1;
+ //fill uninitialised data with random values
+ opt_SetCurrentOptions(&DefaultOptions);
while (argv[argn][0] == '-' && argc) {
switch (argv[argn][1]) {
@@ -321,7 +323,7 @@
break;
default:
printf("*ERROR*\t :\n\tUnknown option '%c'\n",
- argv[argn][1]);
+ argv[argn][1]);
exit(5);
break;
}
@@ -331,8 +333,7 @@
DefaultOptions = CurrentOptions;
- /*tzMainfile=argv[argn++];
- * argc-=1; */
+ /* tzMainfile=argv[argn++]; argc-=1; */
tzMainfile = argv[argn];
setuplex();
@@ -375,24 +376,24 @@
nEndClock = clock();
timespent =
- ((double)(nEndClock - nStartClock))
- / (double)CLOCKS_PER_SEC;
+ ((double) (nEndClock - nStartClock))
+ / (double) CLOCKS_PER_SEC;
printf
("Success! %ld lines in %d.%02d seconds ",
- nTotalLines, (int)timespent,
- ((int)(timespent * 100.0)) % 100);
+ nTotalLines, (int) timespent,
+ ((int) (timespent * 100.0)) % 100);
if (timespent == 0)
printf
("(INFINITY lines/minute)\n");
else
printf("(%d lines/minute)\n",
- (int)(60 / timespent *
- nTotalLines));
+ (int) (60 / timespent *
+ nTotalLines));
out_WriteObject();
} else {
printf
("Assembly aborted in pass 2 (%ld errors)!\n",
- nErrors);
+ nErrors);
//sym_PrintSymbolTable();
exit(5);
}
@@ -399,12 +400,12 @@
} else {
printf
("*ERROR*\t:\tUnterminated IF construct (%ld levels)!\n",
- nIFDepth);
+ nIFDepth);
exit(5);
}
} else {
printf("Assembly aborted in pass 1 (%ld errors)!\n",
- nErrors);
+ nErrors);
exit(5);
}
} else {
--- a/src/asm/math.c
+++ b/src/asm/math.c
@@ -25,11 +25,11 @@
*
*/
-void math_DefinePI(void)
+void
+math_DefinePI(void)
{
sym_AddEqu("_PI", double2fix(PI));
}
-
/*
* RGBAsm - MATH.C (Fixedpoint math routines)
*
@@ -37,16 +37,16 @@
*
*/
-void math_Print(SLONG i)
+void
+math_Print(SLONG i)
{
if (i >= 0)
printf("%ld.%05ld", i >> 16,
- ((SLONG) (fix2double(i) * 100000 + 0.5)) % 100000);
+ ((SLONG) (fix2double(i) * 100000 + 0.5)) % 100000);
else
printf("-%ld.%05ld", (-i) >> 16,
- ((SLONG) (fix2double(-i) * 100000 + 0.5)) % 100000);
+ ((SLONG) (fix2double(-i) * 100000 + 0.5)) % 100000);
}
-
/*
* RGBAsm - MATH.C (Fixedpoint math routines)
*
@@ -54,11 +54,11 @@
*
*/
-SLONG math_Sin(SLONG i)
+SLONG
+math_Sin(SLONG i)
{
return (double2fix(sin(fix2double(i) * 2 * PI / 65536)));
}
-
/*
* RGBAsm - MATH.C (Fixedpoint math routines)
*
@@ -66,11 +66,11 @@
*
*/
-SLONG math_Cos(SLONG i)
+SLONG
+math_Cos(SLONG i)
{
return (double2fix(cos(fix2double(i) * 2 * PI / 65536)));
}
-
/*
* RGBAsm - MATH.C (Fixedpoint math routines)
*
@@ -78,11 +78,11 @@
*
*/
-SLONG math_Tan(SLONG i)
+SLONG
+math_Tan(SLONG i)
{
return (double2fix(tan(fix2double(i) * 2 * PI / 65536)));
}
-
/*
* RGBAsm - MATH.C (Fixedpoint math routines)
*
@@ -90,11 +90,11 @@
*
*/
-SLONG math_ASin(SLONG i)
+SLONG
+math_ASin(SLONG i)
{
return (double2fix(asin(fix2double(i)) / 2 / PI * 65536));
}
-
/*
* RGBAsm - MATH.C (Fixedpoint math routines)
*
@@ -102,11 +102,11 @@
*
*/
-SLONG math_ACos(SLONG i)
+SLONG
+math_ACos(SLONG i)
{
return (double2fix(acos(fix2double(i)) / 2 / PI * 65536));
}
-
/*
* RGBAsm - MATH.C (Fixedpoint math routines)
*
@@ -114,11 +114,11 @@
*
*/
-SLONG math_ATan(SLONG i)
+SLONG
+math_ATan(SLONG i)
{
return (double2fix(atan(fix2double(i)) / 2 / PI * 65536));
}
-
/*
* RGBAsm - MATH.C (Fixedpoint math routines)
*
@@ -126,12 +126,12 @@
*
*/
-SLONG math_ATan2(SLONG i, SLONG j)
+SLONG
+math_ATan2(SLONG i, SLONG j)
{
return (double2fix
- (atan2(fix2double(i), fix2double(j)) / 2 / PI * 65536));
+ (atan2(fix2double(i), fix2double(j)) / 2 / PI * 65536));
}
-
/*
* RGBAsm - MATH.C (Fixedpoint math routines)
*
@@ -139,11 +139,11 @@
*
*/
-SLONG math_Mul(SLONG i, SLONG j)
+SLONG
+math_Mul(SLONG i, SLONG j)
{
return (double2fix(fix2double(i) * fix2double(j)));
}
-
/*
* RGBAsm - MATH.C (Fixedpoint math routines)
*
@@ -151,7 +151,8 @@
*
*/
-SLONG math_Div(SLONG i, SLONG j)
+SLONG
+math_Div(SLONG i, SLONG j)
{
return (double2fix(fix2double(i) / fix2double(j)));
}
--- a/src/asm/output.c
+++ b/src/asm/output.c
@@ -26,7 +26,7 @@
*
*/
-void out_SetCurrentSection(struct Section *pSect);
+void out_SetCurrentSection(struct Section * pSect);
struct Patch {
char tzFilename[_MAX_PATH + 1];
@@ -48,7 +48,6 @@
struct Section *pSection;
struct SectionStackEntry *pNext;
};
-
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -68,13 +67,14 @@
*
*/
-void out_PushSection(void)
+void
+out_PushSection(void)
{
struct SectionStackEntry *pSect;
if ((pSect =
- (struct SectionStackEntry *)
- malloc(sizeof(struct SectionStackEntry))) != NULL) {
+ (struct SectionStackEntry *)
+ malloc(sizeof(struct SectionStackEntry))) != NULL) {
pSect->pSection = pCurrentSection;
pSect->pNext = pSectionStack;
pSectionStack = pSect;
@@ -82,7 +82,8 @@
fatalerror("No memory for section stack");
}
-void out_PopSection(void)
+void
+out_PopSection(void)
{
if (pSectionStack) {
struct SectionStackEntry *pSect;
@@ -94,7 +95,6 @@
} else
fatalerror("No entries in the section stack");
}
-
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -102,7 +102,8 @@
*
*/
-ULONG countsymbols(void)
+ULONG
+countsymbols(void)
{
struct PatchSymbol *pSym;
ULONG count = 0;
@@ -116,7 +117,6 @@
return (count);
}
-
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -124,7 +124,8 @@
*
*/
-ULONG countsections(void)
+ULONG
+countsections(void)
{
struct Section *pSect;
ULONG count = 0;
@@ -138,7 +139,6 @@
return (count);
}
-
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -146,7 +146,8 @@
*
*/
-ULONG countpatches(struct Section * pSect)
+ULONG
+countpatches(struct Section * pSect)
{
struct Patch *pPatch;
ULONG r = 0;
@@ -159,7 +160,6 @@
return (r);
}
-
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -167,7 +167,8 @@
*
*/
-void fputlong(ULONG i, FILE * f)
+void
+fputlong(ULONG i, FILE * f)
{
fputc(i, f);
fputc(i >> 8, f);
@@ -174,7 +175,6 @@
fputc(i >> 16, f);
fputc(i >> 24, f);
}
-
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -182,13 +182,13 @@
*
*/
-void fputstring(char *s, FILE * f)
+void
+fputstring(char *s, FILE * f)
{
while (*s)
fputc(*s++, f);
fputc(0, f);
}
-
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -196,7 +196,8 @@
*
*/
-ULONG getsectid(struct Section *pSect)
+ULONG
+getsectid(struct Section * pSect)
{
struct Section *sec;
ULONG ID = 0;
@@ -213,7 +214,6 @@
fatalerror("INTERNAL: Unknown section");
return ((ULONG) - 1);
}
-
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -221,7 +221,8 @@
*
*/
-void writepatch(struct Patch *pPatch, FILE * f)
+void
+writepatch(struct Patch * pPatch, FILE * f)
{
fputstring(pPatch->tzFilename, f);
fputlong(pPatch->nLine, f);
@@ -230,7 +231,6 @@
fputlong(pPatch->nRPNSize, f);
fwrite(pPatch->pRPN, 1, pPatch->nRPNSize, f);
}
-
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -238,17 +238,20 @@
*
*/
-void writesection(struct Section *pSect, FILE * f)
+void
+writesection(struct Section * pSect, FILE * f)
{
- //printf( "SECTION: %s, ID: %d\n", pSect->pzName, getsectid(pSect) );
+ //printf("SECTION: %s, ID: %d\n", pSect->pzName, getsectid(pSect));
fputlong(pSect->nPC, f);
fputc(pSect->nType, f);
- fputlong(pSect->nOrg, f); // RGB1 addition
+ fputlong(pSect->nOrg, f);
+ //RGB1 addition
- fputlong(pSect->nBank, f); // RGB1 addition
+ fputlong(pSect->nBank, f);
+ //RGB1 addition
- if ((pSect->nType == SECT_HOME)
+ if ((pSect->nType == SECT_HOME)
|| (pSect->nType == SECT_CODE)) {
struct Patch *pPatch;
@@ -262,7 +265,6 @@
}
}
}
-
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -270,7 +272,8 @@
*
*/
-void writesymbol(struct sSymbol *pSym, FILE * f)
+void
+writesymbol(struct sSymbol * pSym, FILE * f)
{
char symname[MAXSYMLEN * 2 + 1];
ULONG type;
@@ -312,7 +315,6 @@
fputlong(offset, f);
}
}
-
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -320,7 +322,8 @@
*
*/
-ULONG addsymbol(struct sSymbol *pSym)
+ULONG
+addsymbol(struct sSymbol * pSym)
{
struct PatchSymbol *pPSym, **ppPSym;
ULONG ID = 0;
@@ -337,7 +340,7 @@
}
if ((*ppPSym = pPSym =
- (struct PatchSymbol *)malloc(sizeof(struct PatchSymbol))) !=
+ (struct PatchSymbol *) malloc(sizeof(struct PatchSymbol))) !=
NULL) {
pPSym->pNext = NULL;
pPSym->pSymbol = pSym;
@@ -348,7 +351,6 @@
return ((ULONG) - 1);
}
-
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -356,7 +358,8 @@
*
*/
-void addexports(void)
+void
+addexports(void)
{
int i;
@@ -371,7 +374,6 @@
}
}
}
-
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -379,7 +381,8 @@
*
*/
-struct Patch *allocpatch(void)
+struct Patch *
+allocpatch(void)
{
struct Patch *pPatch, **ppPatch;
@@ -392,7 +395,7 @@
}
if ((*ppPatch = pPatch =
- (struct Patch *)malloc(sizeof(struct Patch))) != NULL) {
+ (struct Patch *) malloc(sizeof(struct Patch))) != NULL) {
pPatch->pNext = NULL;
pPatch->nRPNSize = 0;
pPatch->pRPN = NULL;
@@ -401,7 +404,6 @@
return (pPatch);
}
-
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -409,7 +411,8 @@
*
*/
-void createpatch(ULONG type, struct Expression *expr)
+void
+createpatch(ULONG type, struct Expression * expr)
{
struct Patch *pPatch;
UWORD rpndata;
@@ -434,7 +437,7 @@
break;
case RPN_SYM:
symptr = 0;
- while ((tzSym[symptr++] = rpn_PopByte(expr)) != 0) ;
+ while ((tzSym[symptr++] = rpn_PopByte(expr)) != 0);
if (sym_isConstant(tzSym)) {
ULONG value;
@@ -455,7 +458,7 @@
break;
case RPN_BANK:
symptr = 0;
- while ((tzSym[symptr++] = rpn_PopByte(expr)) != 0) ;
+ while ((tzSym[symptr++] = rpn_PopByte(expr)) != 0);
symptr = addsymbol(sym_FindSymbol(tzSym));
rpnexpr[rpnptr++] = RPN_BANK;
rpnexpr[rpnptr++] = symptr & 0xFF;
@@ -473,7 +476,6 @@
pPatch->nRPNSize = rpnptr;
}
}
-
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -481,7 +483,8 @@
*
*/
-void checksection(void)
+void
+checksection(void)
{
if (pCurrentSection)
return;
@@ -488,7 +491,6 @@
else
fatalerror("Code generation before SECTION directive");
}
-
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -497,21 +499,22 @@
*
*/
-void checkcodesection(SLONG size)
+void
+checkcodesection(SLONG size)
{
checksection();
if ((pCurrentSection->nType == SECT_HOME
- || pCurrentSection->nType == SECT_CODE)
+ || pCurrentSection->nType == SECT_CODE)
&& (pCurrentSection->nPC + size <= MAXSECTIONSIZE)) {
if (((pCurrentSection->nPC % SECTIONCHUNK) >
- ((pCurrentSection->nPC + size) % SECTIONCHUNK))
+ ((pCurrentSection->nPC + size) % SECTIONCHUNK))
&& (pCurrentSection->nType == SECT_HOME
|| pCurrentSection->nType == SECT_CODE)) {
if ((pCurrentSection->tData =
- (UBYTE *) realloc(pCurrentSection->tData,
- ((pCurrentSection->nPC +
- size) / SECTIONCHUNK +
- 1) * SECTIONCHUNK)) != NULL) {
+ (UBYTE *) realloc(pCurrentSection->tData,
+ ((pCurrentSection->nPC +
+ size) / SECTIONCHUNK +
+ 1) * SECTIONCHUNK)) != NULL) {
return;
} else
fatalerror
@@ -522,7 +525,6 @@
fatalerror
("Section can't contain initialized data or section limit exceeded");
}
-
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -530,7 +532,8 @@
*
*/
-void out_WriteObject(void)
+void
+out_WriteObject(void)
{
FILE *f;
@@ -559,7 +562,6 @@
fclose(f);
}
}
-
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -567,7 +569,8 @@
*
*/
-void out_PrepPass2(void)
+void
+out_PrepPass2(void)
{
struct Section *pSect;
@@ -579,7 +582,6 @@
pCurrentSection = NULL;
pSectionStack = NULL;
}
-
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -587,7 +589,8 @@
*
*/
-void out_SetFileName(char *s)
+void
+out_SetFileName(char *s)
{
strcpy(tzObjectname, s);
printf("Output filename %s\n", s);
@@ -595,7 +598,6 @@
pCurrentSection = NULL;
pPatchSymbols = NULL;
}
-
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -603,8 +605,9 @@
*
*/
-struct Section *out_FindSection(char *pzName, ULONG secttype, SLONG org,
- SLONG bank)
+struct Section *
+out_FindSection(char *pzName, ULONG secttype, SLONG org,
+ SLONG bank)
{
struct Section *pSect, **ppSect;
@@ -626,10 +629,10 @@
}
if ((*ppSect =
- (pSect =
- (struct Section *)malloc(sizeof(struct Section)))) != NULL) {
+ (pSect =
+ (struct Section *) malloc(sizeof(struct Section)))) != NULL) {
if ((pSect->pzName =
- (char *)malloc(strlen(pzName) + 1)) != NULL) {
+ (char *) malloc(strlen(pzName) + 1)) != NULL) {
strcpy(pSect->pzName, pzName);
pSect->nType = secttype;
pSect->nPC = 0;
@@ -640,7 +643,7 @@
pPatchSymbols = NULL;
if ((pSect->tData =
- (UBYTE *) malloc(SECTIONCHUNK)) != NULL) {
+ (UBYTE *) malloc(SECTIONCHUNK)) != NULL) {
return (pSect);
} else
fatalerror("Not enough memory for section");
@@ -651,7 +654,6 @@
return (NULL);
}
-
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -659,7 +661,8 @@
*
*/
-void out_SetCurrentSection(struct Section *pSect)
+void
+out_SetCurrentSection(struct Section * pSect)
{
pCurrentSection = pSect;
nPC = pSect->nPC;
@@ -667,7 +670,6 @@
pPCSymbol->nValue = nPC;
pPCSymbol->pSection = pCurrentSection;
}
-
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -675,11 +677,11 @@
*
*/
-void out_NewSection(char *pzName, ULONG secttype)
+void
+out_NewSection(char *pzName, ULONG secttype)
{
out_SetCurrentSection(out_FindSection(pzName, secttype, -1, -1));
}
-
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -687,11 +689,11 @@
*
*/
-void out_NewAbsSection(char *pzName, ULONG secttype, SLONG org, SLONG bank)
+void
+out_NewAbsSection(char *pzName, ULONG secttype, SLONG org, SLONG bank)
{
out_SetCurrentSection(out_FindSection(pzName, secttype, org, bank));
}
-
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -699,7 +701,8 @@
*
*/
-void out_AbsByte(int b)
+void
+out_AbsByte(int b)
{
checkcodesection(1);
b &= 0xFF;
@@ -710,7 +713,6 @@
nPC += 1;
pPCSymbol->nValue += 1;
}
-
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -718,12 +720,13 @@
*
*/
-void out_Skip(int skip)
+void
+out_Skip(int skip)
{
checksection();
if ((CurrentOptions.fillchar == -1)
|| !((pCurrentSection->nType == SECT_HOME)
- || (pCurrentSection->nType == SECT_CODE))) {
+ || (pCurrentSection->nType == SECT_CODE))) {
pCurrentSection->nPC += skip;
nPC += skip;
pPCSymbol->nValue += skip;
@@ -733,7 +736,6 @@
out_AbsByte(CurrentOptions.fillchar);
}
}
-
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -741,13 +743,13 @@
*
*/
-void out_String(char *s)
+void
+out_String(char *s)
{
checkcodesection(strlen(s));
while (*s)
out_AbsByte(*s++);
}
-
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -756,7 +758,8 @@
*
*/
-void out_RelByte(struct Expression *expr)
+void
+out_RelByte(struct Expression * expr)
{
checkcodesection(1);
if (rpn_isReloc(expr)) {
@@ -772,7 +775,6 @@
rpn_Reset(expr);
}
-
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -780,7 +782,8 @@
*
*/
-void out_AbsWord(int b)
+void
+out_AbsWord(int b)
{
checkcodesection(2);
b &= 0xFFFF;
@@ -789,8 +792,8 @@
pCurrentSection->tData[nPC] = b & 0xFF;
pCurrentSection->tData[nPC + 1] = b >> 8;
} else {
- // Assume big endian
- pCurrentSection->tData[nPC] = b >> 8;
+ //Assume big endian
+ pCurrentSection->tData[nPC] = b >> 8;
pCurrentSection->tData[nPC + 1] = b & 0xFF;
}
}
@@ -798,7 +801,6 @@
nPC += 2;
pPCSymbol->nValue += 2;
}
-
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -807,7 +809,8 @@
*
*/
-void out_RelWord(struct Expression *expr)
+void
+out_RelWord(struct Expression * expr)
{
ULONG b;
@@ -820,8 +823,8 @@
pCurrentSection->tData[nPC + 1] = b >> 8;
createpatch(PATCH_WORD_L, expr);
} else {
- // Assume big endian
- pCurrentSection->tData[nPC] = b >> 8;
+ //Assume big endian
+ pCurrentSection->tData[nPC] = b >> 8;
pCurrentSection->tData[nPC + 1] = b & 0xFF;
createpatch(PATCH_WORD_B, expr);
}
@@ -833,7 +836,6 @@
out_AbsWord(expr->nVal);
rpn_Reset(expr);
}
-
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -841,7 +843,8 @@
*
*/
-void out_AbsLong(SLONG b)
+void
+out_AbsLong(SLONG b)
{
checkcodesection(sizeof(SLONG));
if (nPass == 2) {
@@ -851,8 +854,8 @@
pCurrentSection->tData[nPC + 2] = b >> 16;
pCurrentSection->tData[nPC + 3] = b >> 24;
} else {
- // Assume big endian
- pCurrentSection->tData[nPC] = b >> 24;
+ //Assume big endian
+ pCurrentSection->tData[nPC] = b >> 24;
pCurrentSection->tData[nPC + 1] = b >> 16;
pCurrentSection->tData[nPC + 2] = b >> 8;
pCurrentSection->tData[nPC + 3] = b & 0xFF;
@@ -862,7 +865,6 @@
nPC += 4;
pPCSymbol->nValue += 4;
}
-
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -871,7 +873,8 @@
*
*/
-void out_RelLong(struct Expression *expr)
+void
+out_RelLong(struct Expression * expr)
{
SLONG b;
@@ -886,8 +889,8 @@
pCurrentSection->tData[nPC + 3] = b >> 24;
createpatch(PATCH_LONG_L, expr);
} else {
- // Assume big endian
- pCurrentSection->tData[nPC] = b >> 24;
+ //Assume big endian
+ pCurrentSection->tData[nPC] = b >> 24;
pCurrentSection->tData[nPC + 1] = b >> 16;
pCurrentSection->tData[nPC + 2] = b >> 8;
pCurrentSection->tData[nPC + 3] = b & 0xFF;
@@ -901,7 +904,6 @@
out_AbsLong(expr->nVal);
rpn_Reset(expr);
}
-
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -909,7 +911,8 @@
*
*/
-void out_PCRelByte(struct Expression *expr)
+void
+out_PCRelByte(struct Expression * expr)
{
SLONG b = expr->nVal;
@@ -921,7 +924,6 @@
out_AbsByte(b);
rpn_Reset(expr);
}
-
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -929,7 +931,8 @@
*
*/
-void out_BinaryFile(char *s)
+void
+out_BinaryFile(char *s)
{
FILE *f;
@@ -951,7 +954,6 @@
while (todo--)
pCurrentSection->tData[dest++] = fgetc(f);
}
-
pCurrentSection->nPC += fsize;
nPC += fsize;
pPCSymbol->nValue += fsize;
@@ -960,7 +962,8 @@
fatalerror("File not found");
}
-void out_BinaryFileSlice(char *s, SLONG start_pos, SLONG length)
+void
+out_BinaryFileSlice(char *s, SLONG start_pos, SLONG length)
{
FILE *f;
@@ -970,41 +973,36 @@
if (length < 0)
fatalerror("Number of bytes to read must be greater than zero");
- fstk_FindFile (s);
+ fstk_FindFile(s);
- if( (f=fopen(s,"rb"))!=NULL )
- {
- SLONG fsize;
+ if ((f = fopen(s, "rb")) != NULL) {
+ SLONG fsize;
- fseek (f, 0, SEEK_END);
- fsize = ftell (f);
+ fseek(f, 0, SEEK_END);
+ fsize = ftell(f);
- if (start_pos >= fsize)
- fatalerror("Specified start position is greater than length of file");
+ if (start_pos >= fsize)
+ fatalerror("Specified start position is greater than length of file");
- if( (start_pos + length) > fsize )
- fatalerror("Specified range in INCBIN is out of bounds");
+ if ((start_pos + length) > fsize)
+ fatalerror("Specified range in INCBIN is out of bounds");
- fseek (f, start_pos, SEEK_SET);
+ fseek(f, start_pos, SEEK_SET);
- checkcodesection (length);
+ checkcodesection(length);
- if (nPass == 2)
- {
- SLONG dest = nPC;
- SLONG todo = length;
+ if (nPass == 2) {
+ SLONG dest = nPC;
+ SLONG todo = length;
- while (todo--)
- pCurrentSection->tData[dest++] = fgetc (f);
- }
+ while (todo--)
+ pCurrentSection->tData[dest++] = fgetc(f);
+ }
+ pCurrentSection->nPC += length;
+ nPC += length;
+ pPCSymbol->nValue += length;
- pCurrentSection->nPC += length;
- nPC += length;
- pPCSymbol->nValue += length;
-
- fclose (f);
- }
- else
- fatalerror ("File not found");
+ fclose(f);
+ } else
+ fatalerror("File not found");
}
-
--- a/src/asm/rpn.c
+++ b/src/asm/rpn.c
@@ -15,8 +15,9 @@
#include "asm/main.h"
#include "asm/rpn.h"
-void mergetwoexpressions(struct Expression *expr, struct Expression *src1,
- struct Expression *src2)
+void
+mergetwoexpressions(struct Expression * expr, struct Expression * src1,
+ struct Expression * src2)
{
*expr = *src1;
memcpy(&(expr->tRPN[expr->nRPNLength]), src2->tRPN, src2->nRPNLength);
@@ -25,7 +26,6 @@
expr->isReloc |= src2->isReloc;
expr->isPCRel |= src2->isPCRel;
}
-
#define joinexpr() mergetwoexpressions(expr,src1,src2)
/*
@@ -35,11 +35,11 @@
*
*/
-//UBYTE rpnexpr[2048];
-//ULONG rpnptr = 0;
-//ULONG rpnoutptr = 0;
-//ULONG reloc = 0;
-//ULONG pcrel = 0;
+//UBYTE rpnexpr[2048];
+//ULONG rpnptr = 0;
+//ULONG rpnoutptr = 0;
+//ULONG reloc = 0;
+//ULONG pcrel = 0;
/*
* RGBAsm - RPN.C - Controls RPN expressions for objectfiles
@@ -48,11 +48,11 @@
*
*/
-void pushbyte(struct Expression *expr, int b)
+void
+pushbyte(struct Expression * expr, int b)
{
expr->tRPN[expr->nRPNLength++] = b & 0xFF;
}
-
/*
* RGBAsm - RPN.C - Controls RPN expressions for objectfiles
*
@@ -60,11 +60,11 @@
*
*/
-void rpn_Reset(struct Expression *expr)
+void
+rpn_Reset(struct Expression * expr)
{
expr->nRPNLength = expr->nRPNOut = expr->isReloc = expr->isPCRel = 0;
}
-
/*
* RGBAsm - RPN.C - Controls RPN expressions for objectfiles
*
@@ -72,7 +72,8 @@
*
*/
-UWORD rpn_PopByte(struct Expression *expr)
+UWORD
+rpn_PopByte(struct Expression * expr)
{
if (expr->nRPNOut == expr->nRPNLength) {
return (0xDEAD);
@@ -79,7 +80,6 @@
} else
return (expr->tRPN[expr->nRPNOut++]);
}
-
/*
* RGBAsm - RPN.C - Controls RPN expressions for objectfiles
*
@@ -87,11 +87,11 @@
*
*/
-ULONG rpn_isReloc(struct Expression * expr)
+ULONG
+rpn_isReloc(struct Expression * expr)
{
return (expr->isReloc);
}
-
/*
* RGBAsm - RPN.C - Controls RPN expressions for objectfiles
*
@@ -99,11 +99,11 @@
*
*/
-ULONG rpn_isPCRelative(struct Expression * expr)
+ULONG
+rpn_isPCRelative(struct Expression * expr)
{
return (expr->isPCRel);
}
-
/*
* RGBAsm - RPN.C - Controls RPN expressions for objectfiles
*
@@ -111,7 +111,8 @@
*
*/
-void rpn_Number(struct Expression *expr, ULONG i)
+void
+rpn_Number(struct Expression * expr, ULONG i)
{
rpn_Reset(expr);
pushbyte(expr, RPN_CONST);
@@ -122,7 +123,8 @@
expr->nVal = i;
}
-void rpn_Symbol(struct Expression *expr, char *tzSym)
+void
+rpn_Symbol(struct Expression * expr, char *tzSym)
{
if (!sym_isConstant(tzSym)) {
struct sSymbol *psym;
@@ -143,7 +145,8 @@
rpn_Number(expr, sym_GetConstantValue(tzSym));
}
-void rpn_Bank(struct Expression *expr, char *tzSym)
+void
+rpn_Bank(struct Expression * expr, char *tzSym)
{
if (!sym_isConstant(tzSym)) {
struct sSymbol *psym;
@@ -164,8 +167,9 @@
yyerror("BANK argument must be a relocatable identifier");
}
-int rpn_RangeCheck(struct Expression *expr, struct Expression *src, SLONG low,
- SLONG high)
+int
+rpn_RangeCheck(struct Expression * expr, struct Expression * src, SLONG low,
+ SLONG high)
{
*expr = *src;
@@ -184,9 +188,9 @@
return (expr->nVal >= low && expr->nVal <= high);
}
}
-
#ifdef GAMEBOY
-void rpn_CheckHRAM(struct Expression *expr, struct Expression *src)
+void
+rpn_CheckHRAM(struct Expression * expr, struct Expression * src)
{
*expr = *src;
pushbyte(expr, RPN_HRAM);
@@ -194,7 +198,8 @@
#endif
#ifdef PCENGINE
-void rpn_CheckZP(struct Expression *expr, struct Expression *src)
+void
+rpn_CheckZP(struct Expression * expr, struct Expression * src)
{
*expr = *src;
pushbyte(expr, RPN_PCEZP);
@@ -201,14 +206,16 @@
}
#endif
-void rpn_LOGNOT(struct Expression *expr, struct Expression *src)
+void
+rpn_LOGNOT(struct Expression * expr, struct Expression * src)
{
*expr = *src;
pushbyte(expr, RPN_LOGUNNOT);
}
-void rpn_LOGOR(struct Expression *expr, struct Expression *src1,
- struct Expression *src2)
+void
+rpn_LOGOR(struct Expression * expr, struct Expression * src1,
+ struct Expression * src2)
{
joinexpr();
expr->nVal = (expr->nVal || src2->nVal);
@@ -215,8 +222,9 @@
pushbyte(expr, RPN_LOGOR);
}
-void rpn_LOGAND(struct Expression *expr, struct Expression *src1,
- struct Expression *src2)
+void
+rpn_LOGAND(struct Expression * expr, struct Expression * src1,
+ struct Expression * src2)
{
joinexpr();
expr->nVal = (expr->nVal && src2->nVal);
@@ -223,8 +231,9 @@
pushbyte(expr, RPN_LOGAND);
}
-void rpn_LOGEQU(struct Expression *expr, struct Expression *src1,
- struct Expression *src2)
+void
+rpn_LOGEQU(struct Expression * expr, struct Expression * src1,
+ struct Expression * src2)
{
joinexpr();
expr->nVal = (expr->nVal == src2->nVal);
@@ -231,8 +240,9 @@
pushbyte(expr, RPN_LOGEQ);
}
-void rpn_LOGGT(struct Expression *expr, struct Expression *src1,
- struct Expression *src2)
+void
+rpn_LOGGT(struct Expression * expr, struct Expression * src1,
+ struct Expression * src2)
{
joinexpr();
expr->nVal = (expr->nVal > src2->nVal);
@@ -239,8 +249,9 @@
pushbyte(expr, RPN_LOGGT);
}
-void rpn_LOGLT(struct Expression *expr, struct Expression *src1,
- struct Expression *src2)
+void
+rpn_LOGLT(struct Expression * expr, struct Expression * src1,
+ struct Expression * src2)
{
joinexpr();
expr->nVal = (expr->nVal < src2->nVal);
@@ -247,8 +258,9 @@
pushbyte(expr, RPN_LOGLT);
}
-void rpn_LOGGE(struct Expression *expr, struct Expression *src1,
- struct Expression *src2)
+void
+rpn_LOGGE(struct Expression * expr, struct Expression * src1,
+ struct Expression * src2)
{
joinexpr();
expr->nVal = (expr->nVal >= src2->nVal);
@@ -255,8 +267,9 @@
pushbyte(expr, RPN_LOGGE);
}
-void rpn_LOGLE(struct Expression *expr, struct Expression *src1,
- struct Expression *src2)
+void
+rpn_LOGLE(struct Expression * expr, struct Expression * src1,
+ struct Expression * src2)
{
joinexpr();
expr->nVal = (expr->nVal <= src2->nVal);
@@ -263,8 +276,9 @@
pushbyte(expr, RPN_LOGLE);
}
-void rpn_LOGNE(struct Expression *expr, struct Expression *src1,
- struct Expression *src2)
+void
+rpn_LOGNE(struct Expression * expr, struct Expression * src1,
+ struct Expression * src2)
{
joinexpr();
expr->nVal = (expr->nVal != src2->nVal);
@@ -271,8 +285,9 @@
pushbyte(expr, RPN_LOGNE);
}
-void rpn_ADD(struct Expression *expr, struct Expression *src1,
- struct Expression *src2)
+void
+rpn_ADD(struct Expression * expr, struct Expression * src1,
+ struct Expression * src2)
{
joinexpr();
expr->nVal = (expr->nVal + src2->nVal);
@@ -279,8 +294,9 @@
pushbyte(expr, RPN_ADD);
}
-void rpn_SUB(struct Expression *expr, struct Expression *src1,
- struct Expression *src2)
+void
+rpn_SUB(struct Expression * expr, struct Expression * src1,
+ struct Expression * src2)
{
joinexpr();
expr->nVal = (expr->nVal - src2->nVal);
@@ -287,8 +303,9 @@
pushbyte(expr, RPN_SUB);
}
-void rpn_XOR(struct Expression *expr, struct Expression *src1,
- struct Expression *src2)
+void
+rpn_XOR(struct Expression * expr, struct Expression * src1,
+ struct Expression * src2)
{
joinexpr();
expr->nVal = (expr->nVal ^ src2->nVal);
@@ -295,8 +312,9 @@
pushbyte(expr, RPN_XOR);
}
-void rpn_OR(struct Expression *expr, struct Expression *src1,
- struct Expression *src2)
+void
+rpn_OR(struct Expression * expr, struct Expression * src1,
+ struct Expression * src2)
{
joinexpr();
expr->nVal = (expr->nVal | src2->nVal);
@@ -303,8 +321,9 @@
pushbyte(expr, RPN_OR);
}
-void rpn_AND(struct Expression *expr, struct Expression *src1,
- struct Expression *src2)
+void
+rpn_AND(struct Expression * expr, struct Expression * src1,
+ struct Expression * src2)
{
joinexpr();
expr->nVal = (expr->nVal & src2->nVal);
@@ -311,8 +330,9 @@
pushbyte(expr, RPN_AND);
}
-void rpn_SHL(struct Expression *expr, struct Expression *src1,
- struct Expression *src2)
+void
+rpn_SHL(struct Expression * expr, struct Expression * src1,
+ struct Expression * src2)
{
joinexpr();
expr->nVal = (expr->nVal << src2->nVal);
@@ -319,8 +339,9 @@
pushbyte(expr, RPN_SHL);
}
-void rpn_SHR(struct Expression *expr, struct Expression *src1,
- struct Expression *src2)
+void
+rpn_SHR(struct Expression * expr, struct Expression * src1,
+ struct Expression * src2)
{
joinexpr();
expr->nVal = (expr->nVal >> src2->nVal);
@@ -327,8 +348,9 @@
pushbyte(expr, RPN_SHR);
}
-void rpn_MUL(struct Expression *expr, struct Expression *src1,
- struct Expression *src2)
+void
+rpn_MUL(struct Expression * expr, struct Expression * src1,
+ struct Expression * src2)
{
joinexpr();
expr->nVal = (expr->nVal * src2->nVal);
@@ -335,8 +357,9 @@
pushbyte(expr, RPN_MUL);
}
-void rpn_DIV(struct Expression *expr, struct Expression *src1,
- struct Expression *src2)
+void
+rpn_DIV(struct Expression * expr, struct Expression * src1,
+ struct Expression * src2)
{
joinexpr();
expr->nVal = (expr->nVal / src2->nVal);
@@ -343,8 +366,9 @@
pushbyte(expr, RPN_DIV);
}
-void rpn_MOD(struct Expression *expr, struct Expression *src1,
- struct Expression *src2)
+void
+rpn_MOD(struct Expression * expr, struct Expression * src1,
+ struct Expression * src2)
{
joinexpr();
expr->nVal = (expr->nVal % src2->nVal);
@@ -351,7 +375,8 @@
pushbyte(expr, RPN_MOD);
}
-void rpn_UNNEG(struct Expression *expr, struct Expression *src)
+void
+rpn_UNNEG(struct Expression * expr, struct Expression * src)
{
*expr = *src;
expr->nVal = -expr->nVal;
@@ -358,7 +383,8 @@
pushbyte(expr, RPN_UNSUB);
}
-void rpn_UNNOT(struct Expression *expr, struct Expression *src)
+void
+rpn_UNNOT(struct Expression * expr, struct Expression * src)
{
*expr = *src;
expr->nVal = expr->nVal ^ 0xFFFFFFFF;
--- a/src/asm/symbol.c
+++ b/src/asm/symbol.c
@@ -32,7 +32,8 @@
char SavedTIME[256];
char SavedDATE[256];
-SLONG Callback_NARG(struct sSymbol *sym)
+SLONG
+Callback_NARG(struct sSymbol * sym)
{
ULONG i = 0;
@@ -43,12 +44,12 @@
return (i);
}
-SLONG Callback__LINE__(struct sSymbol * sym)
+SLONG
+Callback__LINE__(struct sSymbol * sym)
{
sym = sym;
return (nLineNo);
}
-
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -56,7 +57,8 @@
*
*/
-SLONG getvaluefield(struct sSymbol * sym)
+SLONG
+getvaluefield(struct sSymbol * sym)
{
if (sym->Callback) {
return (sym->Callback(sym));
@@ -63,7 +65,6 @@
} else
return (sym->nValue);
}
-
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -71,7 +72,8 @@
*
*/
-ULONG calchash(char *s)
+ULONG
+calchash(char *s)
{
ULONG hash = 0;
@@ -80,7 +82,6 @@
return (hash % HASHSIZE);
}
-
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -88,7 +89,8 @@
*
*/
-struct sSymbol *createsymbol(char *s)
+struct sSymbol *
+createsymbol(char *s)
{
struct sSymbol **ppsym;
ULONG hash;
@@ -100,7 +102,7 @@
ppsym = &((*ppsym)->pNext);
if (((*ppsym) =
- (struct sSymbol *)malloc(sizeof(struct sSymbol))) != NULL) {
+ (struct sSymbol *) malloc(sizeof(struct sSymbol))) != NULL) {
strcpy((*ppsym)->tzName, s);
(*ppsym)->nValue = 0;
(*ppsym)->nType = 0;
@@ -115,7 +117,6 @@
return (NULL);
}
}
-
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -123,7 +124,8 @@
*
*/
-struct sSymbol *findsymbol(char *s, struct sSymbol *scope)
+struct sSymbol *
+findsymbol(char *s, struct sSymbol * scope)
{
struct sSymbol **ppsym;
SLONG hash;
@@ -140,7 +142,6 @@
}
return (NULL);
}
-
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -148,7 +149,8 @@
*
*/
-struct sSymbol **findpsymbol(char *s, struct sSymbol *scope)
+struct sSymbol **
+findpsymbol(char *s, struct sSymbol * scope)
{
struct sSymbol **ppsym;
SLONG hash;
@@ -165,7 +167,6 @@
}
return (NULL);
}
-
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -173,7 +174,8 @@
*
*/
-struct sSymbol *sym_FindSymbol(char *tzName)
+struct sSymbol *
+sym_FindSymbol(char *tzName)
{
struct sSymbol *pscope;
@@ -184,7 +186,6 @@
return (findsymbol(tzName, pscope));
}
-
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -192,7 +193,8 @@
*
*/
-void sym_Purge(char *tzName)
+void
+sym_Purge(char *tzName)
{
struct sSymbol **ppSym;
struct sSymbol *pscope;
@@ -219,7 +221,6 @@
yyerror(temptext);
}
}
-
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -227,7 +228,8 @@
*
*/
-ULONG sym_isConstDefined(char *tzName)
+ULONG
+sym_isConstDefined(char *tzName)
{
struct sSymbol *psym, *pscope;
@@ -244,8 +246,8 @@
return (1);
} else {
sprintf(temptext,
- "'%s' is not allowed as argument to the DEF function",
- tzName);
+ "'%s' is not allowed as argument to the DEF function",
+ tzName);
fatalerror(temptext);
}
}
@@ -252,7 +254,8 @@
return (0);
}
-ULONG sym_isDefined(char *tzName)
+ULONG
+sym_isDefined(char *tzName)
{
struct sSymbol *psym, *pscope;
@@ -268,7 +271,6 @@
else
return (0);
}
-
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -276,7 +278,8 @@
*
*/
-ULONG sym_isConstant(char *s)
+ULONG
+sym_isConstant(char *s)
{
struct sSymbol *psym, *pscope;
@@ -289,10 +292,8 @@
if (psym->nType & SYMF_CONST)
return (1);
}
-
return (0);
}
-
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -300,7 +301,8 @@
*
*/
-char *sym_GetStringValue(char *tzSym)
+char *
+sym_GetStringValue(char *tzSym)
{
struct sSymbol *pSym;
@@ -313,7 +315,6 @@
return (NULL);
}
-
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -321,7 +322,8 @@
*
*/
-ULONG sym_GetConstantValue(char *s)
+ULONG
+sym_GetConstantValue(char *s)
{
struct sSymbol *psym, *pscope;
@@ -343,7 +345,6 @@
return (0);
}
-
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -351,7 +352,8 @@
*
*/
-ULONG sym_GetValue(char *s)
+ULONG
+sym_GetValue(char *s)
{
struct sSymbol *psym, *pscope;
@@ -364,7 +366,7 @@
if (psym->nType & SYMF_DEFINED) {
if (psym->nType & (SYMF_MACRO | SYMF_STRING)) {
sprintf(temptext,
- "'%s' is a macro or string symbol", s);
+ "'%s' is a macro or string symbol", s);
yyerror(temptext);
}
return (getvaluefield(psym));
@@ -389,7 +391,6 @@
return (0);
}
-
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -397,7 +398,8 @@
*
*/
-ULONG sym_GetDefinedValue(char *s)
+ULONG
+sym_GetDefinedValue(char *s)
{
struct sSymbol *psym, *pscope;
@@ -410,10 +412,9 @@
if ((psym->nType & SYMF_DEFINED)) {
if (psym->nType & (SYMF_MACRO | SYMF_STRING)) {
sprintf(temptext,
- "'%s' is a macro or string symbol", s);
+ "'%s' is a macro or string symbol", s);
yyerror(temptext);
}
-
return (getvaluefield(psym));
} else {
sprintf(temptext, "'%s' not defined", s);
@@ -426,7 +427,6 @@
return (0);
}
-
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -434,7 +434,8 @@
*
*/
-void sym_ShiftCurrentMacroArgs(void)
+void
+sym_ShiftCurrentMacroArgs(void)
{
SLONG i;
@@ -445,7 +446,8 @@
currentmacroargs[MAXMACROARGS - 1] = NULL;
}
-char *sym_FindMacroArg(SLONG i)
+char *
+sym_FindMacroArg(SLONG i)
{
if (i == -1)
i = MAXMACROARGS + 1;
@@ -453,7 +455,8 @@
return (currentmacroargs[i - 1]);
}
-void sym_UseNewMacroArgs(void)
+void
+sym_UseNewMacroArgs(void)
{
SLONG i;
@@ -463,7 +466,8 @@
}
}
-void sym_SaveCurrentMacroArgs(char *save[])
+void
+sym_SaveCurrentMacroArgs(char *save[])
{
SLONG i;
@@ -471,7 +475,8 @@
save[i] = currentmacroargs[i];
}
-void sym_RestoreCurrentMacroArgs(char *save[])
+void
+sym_RestoreCurrentMacroArgs(char *save[])
{
SLONG i;
@@ -479,7 +484,8 @@
currentmacroargs[i] = save[i];
}
-void sym_FreeCurrentMacroArgs(void)
+void
+sym_FreeCurrentMacroArgs(void)
{
SLONG i;
@@ -489,7 +495,8 @@
}
}
-void sym_AddNewMacroArg(char *s)
+void
+sym_AddNewMacroArg(char *s)
{
SLONG i = 0;
@@ -505,7 +512,8 @@
yyerror("A maximum of 9 arguments allowed");
}
-void sym_SetMacroArgID(ULONG nMacroCount)
+void
+sym_SetMacroArgID(ULONG nMacroCount)
{
char s[256];
@@ -513,7 +521,8 @@
newmacroargs[MAXMACROARGS] = strdup(s);
}
-void sym_UseCurrentMacroArgs(void)
+void
+sym_UseCurrentMacroArgs(void)
{
SLONG i;
@@ -520,7 +529,6 @@
for (i = 1; i <= MAXMACROARGS; i += 1)
sym_AddNewMacroArg(sym_FindMacroArg(i));
}
-
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -528,11 +536,11 @@
*
*/
-struct sSymbol *sym_FindMacro(char *s)
+struct sSymbol *
+sym_FindMacro(char *s)
{
return (findsymbol(s, NULL));
}
-
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -540,7 +548,8 @@
*
*/
-void sym_AddEqu(char *tzSym, SLONG value)
+void
+sym_AddEqu(char *tzSym, SLONG value)
{
if ((nPass == 1)
|| ((nPass == 2) && (sym_isDefined(tzSym) == 0))) {
@@ -550,7 +559,7 @@
if ((nsym = findsymbol(tzSym, NULL)) != NULL) {
if (nsym->nType & SYMF_DEFINED) {
sprintf(temptext, "'%s' already defined",
- tzSym);
+ tzSym);
yyerror(temptext);
}
} else
@@ -563,7 +572,6 @@
}
}
}
-
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -571,7 +579,8 @@
*
*/
-void sym_AddString(char *tzSym, char *tzValue)
+void
+sym_AddString(char *tzSym, char *tzValue)
{
struct sSymbol *nsym;
@@ -585,7 +594,7 @@
if (nsym) {
if ((nsym->pMacro =
- (char *)malloc(strlen(tzValue) + 1)) != NULL)
+ (char *) malloc(strlen(tzValue) + 1)) != NULL)
strcpy(nsym->pMacro, tzValue);
else
fatalerror("No memory for stringequate");
@@ -594,7 +603,6 @@
nsym->pScope = NULL;
}
}
-
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -602,7 +610,8 @@
*
*/
-ULONG sym_isString(char *tzSym)
+ULONG
+sym_isString(char *tzSym)
{
struct sSymbol *pSym;
@@ -612,7 +621,6 @@
}
return (0);
}
-
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -620,7 +628,8 @@
*
*/
-void sym_AddSet(char *tzSym, SLONG value)
+void
+sym_AddSet(char *tzSym, SLONG value)
{
struct sSymbol *nsym;
@@ -634,7 +643,6 @@
nsym->pScope = NULL;
}
}
-
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -642,7 +650,8 @@
*
*/
-void sym_AddLocalReloc(char *tzSym)
+void
+sym_AddLocalReloc(char *tzSym)
{
if ((nPass == 1)
|| ((nPass == 2) && (sym_isDefined(tzSym) == 0))) {
@@ -653,7 +662,7 @@
if ((nsym = findsymbol(tzSym, pScope)) != NULL) {
if (nsym->nType & SYMF_DEFINED) {
sprintf(temptext,
- "'%s' already defined", tzSym);
+ "'%s' already defined", tzSym);
yyerror(temptext);
}
} else
@@ -670,7 +679,6 @@
fatalerror("Local label in main scope");
}
}
-
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -678,7 +686,8 @@
*
*/
-void sym_AddReloc(char *tzSym)
+void
+sym_AddReloc(char *tzSym)
{
if ((nPass == 1)
|| ((nPass == 2) && (sym_isDefined(tzSym) == 0))) {
@@ -688,7 +697,7 @@
if ((nsym = findsymbol(tzSym, NULL)) != NULL) {
if (nsym->nType & SYMF_DEFINED) {
sprintf(temptext, "'%s' already defined",
- tzSym);
+ tzSym);
yyerror(temptext);
}
} else
@@ -704,7 +713,6 @@
pScope = findsymbol(tzSym, NULL);
}
-
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -712,7 +720,8 @@
*
*/
-void sym_Export(char *tzSym)
+void
+sym_Export(char *tzSym)
{
if (nPass == 1) {
/* only export symbols in pass 1 */
@@ -735,7 +744,6 @@
}
}
-
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -743,7 +751,8 @@
*
*/
-void sym_Import(char *tzSym)
+void
+sym_Import(char *tzSym)
{
if (nPass == 1) {
/* only import symbols in pass 1 */
@@ -753,12 +762,10 @@
sprintf(temptext, "'%s' already defined", tzSym);
yyerror(temptext);
}
-
if ((nsym = createsymbol(tzSym)) != NULL)
nsym->nType |= SYMF_IMPORT;
}
}
-
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -766,7 +773,8 @@
*
*/
-void sym_Global(char *tzSym)
+void
+sym_Global(char *tzSym)
{
if (nPass == 2) {
/* only globalize symbols in pass 2 */
@@ -786,7 +794,6 @@
}
}
}
-
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -794,7 +801,8 @@
*
*/
-void sym_AddMacro(char *tzSym)
+void
+sym_AddMacro(char *tzSym)
{
if ((nPass == 1)
|| ((nPass == 2) && (sym_isDefined(tzSym) == 0))) {
@@ -804,7 +812,7 @@
if ((nsym = findsymbol(tzSym, NULL)) != NULL) {
if (nsym->nType & SYMF_DEFINED) {
sprintf(temptext, "'%s' already defined",
- tzSym);
+ tzSym);
yyerror(temptext);
}
} else
@@ -819,7 +827,6 @@
}
}
}
-
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -827,11 +834,11 @@
*
*/
-void sym_PrepPass1(void)
+void
+sym_PrepPass1(void)
{
sym_Init();
}
-
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -839,7 +846,8 @@
*
*/
-void sym_PrepPass2(void)
+void
+sym_PrepPass2(void)
{
SLONG i;
@@ -865,7 +873,6 @@
sym_AddString("__DATE__", SavedDATE);
sym_AddSet("_RS", 0);
}
-
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -873,7 +880,8 @@
*
*/
-void sym_Init(void)
+void
+sym_Init(void)
{
SLONG i;
time_t tod;
@@ -907,13 +915,11 @@
sym_AddString("__TIME__", SavedTIME);
sym_AddString("__DATE__", SavedDATE);
}
-
pScope = NULL;
math_DefinePI();
}
-
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -921,7 +927,8 @@
*
*/
-void sym_PrintSymbolTable(void)
+void
+sym_PrintSymbolTable(void)
{
ULONG i;
@@ -934,8 +941,8 @@
while (sym != NULL) {
if (sym->nType & SYMF_LOCAL)
printf("LOCAL : '%s%s' - %08lX\n",
- sym->pScope->tzName, sym->tzName,
- getvaluefield(sym));
+ sym->pScope->tzName, sym->tzName,
+ getvaluefield(sym));
else if (sym->nType & (SYMF_MACRO | SYMF_STRING)) {
ULONG i = 0;
@@ -950,24 +957,23 @@
printf("\"\n");
} else if (sym->nType & SYMF_EXPORT)
printf("EXPORT: '%s' - %08lX\n", sym->tzName,
- getvaluefield(sym));
+ getvaluefield(sym));
else if (sym->nType & SYMF_IMPORT)
printf("IMPORT: '%s'\n", sym->tzName);
else if (sym->nType & SYMF_EQU)
printf("EQU : '%s' - %08lX\n", sym->tzName,
- getvaluefield(sym));
+ getvaluefield(sym));
else if (sym->nType & SYMF_SET)
printf("SET : '%s' - %08lX\n", sym->tzName,
- getvaluefield(sym));
+ getvaluefield(sym));
else
printf("SYMBOL: '%s' - %08lX\n", sym->tzName,
- getvaluefield(sym));
+ getvaluefield(sym));
sym = sym->pNext;
}
}
}
-
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -975,7 +981,8 @@
*
*/
-void sym_DumpMacroArgs(void)
+void
+sym_DumpMacroArgs(void)
{
ULONG i;
--- a/src/fix/main.c
+++ b/src/fix/main.c
@@ -36,16 +36,16 @@
0xBB, 0xBB, 0x67, 0x63, 0x6E, 0x0E, 0xEC, 0xCC,
0xDD, 0xDC, 0x99, 0x9F, 0xBB, 0xB9, 0x33, 0x3E,
};
-
/*
* Misc. routines
*
*/
-void PrintUsage(void)
+void
+PrintUsage(void)
{
printf("RGBFix v" RGBFIX_VERSION
- " (part of ASMotor " ASMOTOR_VERSION ")\n\n");
+ " (part of ASMotor " ASMOTOR_VERSION ")\n\n");
printf("Usage: rgbfix [options] image[.gb]\n");
printf("Options:\n");
@@ -60,7 +60,8 @@
exit(0);
}
-void vFatalError(char *s, va_list ap)
+void
+vFatalError(char *s, va_list ap)
{
fprintf(stderr, "*ERROR* : ");
vfprintf(stderr, s, ap);
@@ -67,16 +68,18 @@
fprintf(stderr, "\n");
}
-void FatalError(char *s, ...)
+void
+FatalError(char *s,...)
{
va_list ap;
- va_start (ap, s);
+ va_start(ap, s);
vFatalError(s, ap);
va_end(ap);
exit(5);
}
-void vWarning(char *s, va_list ap)
+void
+vWarning(char *s, va_list ap)
{
fprintf(stderr, "*WARNING* : ");
vfprintf(stderr, s, ap);
@@ -83,7 +86,8 @@
fprintf(stderr, "\n");
}
-void Warning(char *s, ...)
+void
+Warning(char *s,...)
{
va_list ap;
va_start(ap, s);
@@ -91,7 +95,8 @@
va_end(ap);
}
-long int FileSize(FILE * f)
+long int
+FileSize(FILE * f)
{
long prevpos;
long r;
@@ -104,7 +109,8 @@
return (r);
}
-int FileExists(char *s)
+int
+FileExists(char *s)
{
FILE *f;
@@ -114,13 +120,13 @@
} else
return (0);
}
-
/*
* Das main
*
*/
-int main(int argc, char *argv[])
+int
+main(int argc, char *argv[])
{
int argn = 1;
char filename[512];
@@ -133,7 +139,7 @@
PrintUsage();
while (argn < argc) {
- if(argv[argn][0] == '-') {
+ if (argv[argn][0] == '-') {
switch (argv[argn][1]) {
case '?':
case 'h':
@@ -156,7 +162,7 @@
ulOptions |= OPTF_TITLE;
break;
case 'q':
- ulOptions|=OPTF_QUIET;
+ ulOptions |= OPTF_QUIET;
break;
}
}
@@ -163,7 +169,7 @@
argn++;
}
- if(argv[argc - 1][0] == '-')
+ if (argv[argc - 1][0] == '-')
PrintUsage();
strcpy(filename, argv[argc - 1]);
@@ -172,7 +178,7 @@
strcat(filename, ".gb");
f = fopen(filename, "rb+");
- if( (f=fopen(filename,"rb+"))!=NULL ) {
+ if ((f = fopen(filename, "rb+")) != NULL) {
/*
* -d (Debug) option code
@@ -182,7 +188,6 @@
if ((ulOptions & OPTF_DEBUG) && !(ulOptions & OPTF_QUIET)) {
printf("-d (Debug) option enabled...\n");
}
-
/*
* -p (Pad) option code
*
@@ -197,10 +202,9 @@
while (size > padto)
padto *= 2;
- if(!(ulOptions & OPTF_QUIET)) {
+ if (!(ulOptions & OPTF_QUIET)) {
printf("Padding to %ldkB:\n", padto / 1024);
}
-
/*
if( padto<=0x80000L )
{
@@ -217,11 +221,11 @@
}
fflush(f);
- if(!(ulOptions & OPTF_QUIET)) {
+ if (!(ulOptions & OPTF_QUIET)) {
printf("\tAdded %ld bytes\n", bytesadded);
}
} else {
- if(!(ulOptions & OPTF_QUIET)) {
+ if (!(ulOptions & OPTF_QUIET)) {
printf("\tNo padding needed\n");
}
}
@@ -231,7 +235,6 @@
FatalError( "Image size exceeds 512kB" );
*/
}
-
/*
* -r (Truncate) option code
*
@@ -247,10 +250,9 @@
while (size < padto)
padto /= 2;
- if(!(ulOptions & OPTF_QUIET)) {
+ if (!(ulOptions & OPTF_QUIET)) {
printf("Truncating to %ldkB:\n", padto / 1024);
}
-
mkstemp(tempfile);
if ((ulOptions & OPTF_DEBUG) == 0) {
@@ -267,7 +269,6 @@
}
}
}
-
/*
* -t (Set carttitle) option code
*
@@ -274,7 +275,7 @@
*/
if (ulOptions & OPTF_TITLE) {
- if(!(ulOptions & OPTF_QUIET)) {
+ if (!(ulOptions & OPTF_QUIET)) {
printf("Setting cartridge title:\n");
}
if ((ulOptions & OPTF_DEBUG) == 0) {
@@ -283,11 +284,10 @@
fwrite(cartname, 16, 1, f);
fflush(f);
}
- if(!(ulOptions & OPTF_QUIET)) {
+ if (!(ulOptions & OPTF_QUIET)) {
printf("\tTitle set to %s\n", cartname);
}
}
-
/*
* -v (Validate header) option code
*
@@ -299,10 +299,10 @@
long carttype;
unsigned short cartchecksum = 0, calcchecksum = 0;
unsigned char cartcompchecksum = 0, calccompchecksum =
- 0;
+ 0;
int ch;
- if(!(ulOptions & OPTF_VALIDATE)) {
+ if (!(ulOptions & OPTF_VALIDATE)) {
printf("Validating header:\n");
}
fflush(stdout);
@@ -331,15 +331,14 @@
fflush(f);
- if(!(ulOptions & OPTF_QUIET)) {
+ if (!(ulOptions & OPTF_QUIET)) {
if (byteschanged)
printf
- ("\tChanged %ld bytes in the Nintendo Character Area\n",
- byteschanged);
+ ("\tChanged %ld bytes in the Nintendo Character Area\n",
+ byteschanged);
else
printf("\tNintendo Character Area is OK\n");
}
-
/* ROM size */
fflush(f);
@@ -357,18 +356,16 @@
fputc(calcromsize, f);
fflush(f);
}
- if(!(ulOptions & OPTF_QUIET)) {
+ if (!(ulOptions & OPTF_QUIET)) {
printf("\tChanged ROM size byte from 0x%02lX (%ldkB) to 0x%02lX (%ldkB)\n",
- cartromsize,
- (0x8000L << cartromsize) / 1024,
- calcromsize,
- (0x8000L << calcromsize) / 1024);
+ cartromsize,
+ (0x8000L << cartromsize) / 1024,
+ calcromsize,
+ (0x8000L << calcromsize) / 1024);
}
- } else
- if(!(ulOptions & OPTF_QUIET)) {
- printf("\tROM size byte is OK\n");
- }
-
+ } else if (!(ulOptions & OPTF_QUIET)) {
+ printf("\tROM size byte is OK\n");
+ }
/* Cartridge type */
fflush(f);
@@ -385,17 +382,16 @@
fputc(0x01, f);
fflush(f);
}
- if(!(ulOptions & OPTF_QUIET)) {
+ if (!(ulOptions & OPTF_QUIET)) {
printf
- ("\tCartridge type byte changed to 0x01\n");
+ ("\tCartridge type byte changed to 0x01\n");
}
- } else
- if(!(ulOptions & OPTF_QUIET)) {
- printf("\tCartridge type byte is OK\n");
- }
+ } else if (!(ulOptions & OPTF_QUIET)) {
+ printf("\tCartridge type byte is OK\n");
+ }
} else {
/* carttype byte can be anything? */
- if(!(ulOptions & OPTF_QUIET)) {
+ if (!(ulOptions & OPTF_QUIET)) {
printf("\tCartridge type byte is OK\n");
}
}
@@ -436,13 +432,13 @@
fputc(calcchecksum & 0xFF, f);
}
fflush(f);
- if(!(ulOptions & OPTF_QUIET)) {
+ if (!(ulOptions & OPTF_QUIET)) {
printf
- ("\tChecksum changed from 0x%04lX to 0x%04lX\n",
- (long)cartchecksum, (long)calcchecksum);
+ ("\tChecksum changed from 0x%04lX to 0x%04lX\n",
+ (long) cartchecksum, (long) calcchecksum);
}
} else {
- if(!(ulOptions & OPTF_QUIET)) {
+ if (!(ulOptions & OPTF_QUIET)) {
printf("\tChecksum is OK\n");
}
}
@@ -453,23 +449,22 @@
if ((ulOptions & OPTF_DEBUG) == 0)
fputc(calccompchecksum, f);
fflush(f);
- if(!(ulOptions & OPTF_QUIET)) {
+ if (!(ulOptions & OPTF_QUIET)) {
printf
- ("\tCompChecksum changed from 0x%02lX to 0x%02lX\n",
- (long)cartcompchecksum,
- (long)calccompchecksum);
+ ("\tCompChecksum changed from 0x%02lX to 0x%02lX\n",
+ (long) cartcompchecksum,
+ (long) calccompchecksum);
}
} else {
- if(!(ulOptions & OPTF_QUIET)) {
+ if (!(ulOptions & OPTF_QUIET)) {
printf("\tCompChecksum is OK\n");
}
}
}
-
fclose(f);
} else {
- FatalError("File '%s' not found",filename);
+ FatalError("File '%s' not found", filename);
}
return (0);
--- a/src/lib/library.c
+++ b/src/lib/library.c
@@ -7,7 +7,8 @@
extern void fatalerror(char *s);
-SLONG file_Length(FILE * f)
+SLONG
+file_Length(FILE * f)
{
ULONG r, p;
@@ -19,7 +20,8 @@
return (r);
}
-SLONG file_ReadASCIIz(char *b, FILE * f)
+SLONG
+file_ReadASCIIz(char *b, FILE * f)
{
SLONG r = 0;
@@ -29,7 +31,8 @@
return (r + 1);
}
-void file_WriteASCIIz(char *b, FILE * f)
+void
+file_WriteASCIIz(char *b, FILE * f)
{
while (*b)
fputc(*b++, f);
@@ -37,7 +40,8 @@
fputc(0, f);
}
-UWORD file_ReadWord(FILE * f)
+UWORD
+file_ReadWord(FILE * f)
{
UWORD r;
@@ -47,13 +51,15 @@
return (r);
}
-void file_WriteWord(UWORD w, FILE * f)
+void
+file_WriteWord(UWORD w, FILE * f)
{
fputc(w, f);
fputc(w >> 8, f);
}
-ULONG file_ReadLong(FILE * f)
+ULONG
+file_ReadLong(FILE * f)
{
ULONG r;
@@ -65,7 +71,8 @@
return (r);
}
-void file_WriteLong(UWORD w, FILE * f)
+void
+file_WriteLong(UWORD w, FILE * f)
{
fputc(w, f);
fputc(w >> 8, f);
@@ -73,7 +80,8 @@
fputc(w >> 24, f);
}
-sLibrary *lib_ReadLib0(FILE * f, SLONG size)
+sLibrary *
+lib_ReadLib0(FILE * f, SLONG size)
{
if (size) {
sLibrary *l = NULL, *first = NULL;
@@ -102,7 +110,7 @@
size -= 4;
if ((l->pData = malloc(l->nByteLength))) {
fread(l->pData, sizeof(UBYTE), l->nByteLength,
- f);
+ f);
size -= l->nByteLength;
} else
fatalerror("Out of memory");
@@ -111,11 +119,11 @@
}
return (first);
}
-
return (NULL);
}
-sLibrary *lib_Read(char *filename)
+sLibrary *
+lib_Read(char *filename)
{
FILE *f;
@@ -128,7 +136,6 @@
fclose(f);
return (NULL);
}
-
fread(ID, sizeof(char), 4, f);
ID[4] = 0;
size -= 4;
@@ -148,12 +155,13 @@
} else {
printf
("Library '%s' not found, it will be created if necessary\n",
- filename);
+ filename);
return (NULL);
}
}
-BBOOL lib_Write(sLibrary * lib, char *filename)
+BBOOL
+lib_Write(sLibrary * lib, char *filename)
{
FILE *f;
@@ -172,11 +180,11 @@
printf("Library '%s' closed\n", filename);
return (1);
}
-
return (0);
}
-void TruncateFileName(char *dest, char *src)
+void
+TruncateFileName(char *dest, char *src)
{
SLONG l;
@@ -187,7 +195,8 @@
strcpy(dest, &src[l + 1]);
}
-sLibrary *lib_Find(sLibrary * lib, char *filename)
+sLibrary *
+lib_Find(sLibrary * lib, char *filename)
{
char truncname[MAXNAMELENGTH];
@@ -203,7 +212,8 @@
return (lib);
}
-sLibrary *lib_AddReplace(sLibrary * lib, char *filename)
+sLibrary *
+lib_AddReplace(sLibrary * lib, char *filename)
{
FILE *f;
@@ -237,11 +247,11 @@
fclose(f);
}
-
return (lib);
}
-sLibrary *lib_DeleteModule(sLibrary * lib, char *filename)
+sLibrary *
+lib_DeleteModule(sLibrary * lib, char *filename)
{
char truncname[MAXNAMELENGTH];
sLibrary **pp, **first;
@@ -276,7 +286,8 @@
return (*first);
}
-void lib_Free(sLibrary * lib)
+void
+lib_Free(sLibrary * lib)
{
while (lib) {
sLibrary *l;
--- a/src/lib/main.c
+++ b/src/lib/main.c
@@ -8,7 +8,7 @@
#include "lib/types.h"
#include "lib/library.h"
-// Quick and dirty...but it works
+// Quick and dirty...but it works
#ifdef __GNUC__
#define strcmpi strcasecmp
#endif
@@ -18,34 +18,35 @@
*
*/
-void fatalerror(char *s)
+void
+fatalerror(char *s)
{
- fprintf(stderr,"*ERROR* : %s\n", s);
+ fprintf(stderr, "*ERROR* : %s\n", s);
exit(5);
}
-
/*
* Print the usagescreen
*
*/
-void PrintUsage(void)
+void
+PrintUsage(void)
{
printf("xLib v" LIB_VERSION " (part of ASMotor " ASMOTOR_VERSION ")\n\n"
- "Usage: xlib library command [module1 module2 ... modulen]\n"
- "Commands:\n\ta\tAdd/replace modules to library\n"
- "\td\tDelete modules from library\n"
- "\tl\tList library contents\n"
- "\tx\tExtract modules from library\n");
+ "Usage: xlib library command [module1 module2 ... modulen]\n"
+ "Commands:\n\ta\tAdd/replace modules to library\n"
+ "\td\tDelete modules from library\n"
+ "\tl\tList library contents\n"
+ "\tx\tExtract modules from library\n");
exit(0);
}
-
/*
* The main routine
*
*/
-int main(int argc, char *argv[])
+int
+main(int argc, char *argv[])
{
SLONG argn = 0;
char *libname;
@@ -90,8 +91,8 @@
while (l) {
printf("%10ld %s\n",
- l->nByteLength,
- l->tName);
+ l->nByteLength,
+ l->tName);
l = l->pNext;
}
}
@@ -106,13 +107,13 @@
if ((f = fopen(argv[argn], "wb"))) {
fwrite(l->pData,
- sizeof(UBYTE),
- l->nByteLength,
- f);
+ sizeof(UBYTE),
+ l->nByteLength,
+ f);
fclose(f);
printf
("Extracted module '%s'\n",
- argv[argn]);
+ argv[argn]);
} else
fatalerror
("Unable to write module");
--- a/src/link/assign.c
+++ b/src/link/assign.c
@@ -18,7 +18,8 @@
#define DOMAXBANK(x) {if( (x)>MaxBankUsed ) MaxBankUsed=(x);}
-SLONG area_Avail(SLONG bank)
+SLONG
+area_Avail(SLONG bank)
{
SLONG r;
struct sFreeArea *pArea;
@@ -34,7 +35,8 @@
return (r);
}
-SLONG area_AllocAbs(struct sFreeArea ** ppArea, SLONG org, SLONG size)
+SLONG
+area_AllocAbs(struct sFreeArea ** ppArea, SLONG org, SLONG size)
{
struct sFreeArea *pArea;
@@ -55,8 +57,8 @@
struct sFreeArea *pNewArea;
if ((pNewArea =
- (struct sFreeArea *)
- malloc(sizeof(struct sFreeArea)))
+ (struct sFreeArea *)
+ malloc(sizeof(struct sFreeArea)))
!= NULL) {
*pNewArea = *pArea;
pNewArea->pPrev = pArea;
@@ -80,7 +82,8 @@
return (-1);
}
-SLONG area_AllocAbsCODEAnyBank(SLONG org, SLONG size)
+SLONG
+area_AllocAbsCODEAnyBank(SLONG org, SLONG size)
{
SLONG i;
@@ -92,7 +95,8 @@
return (-1);
}
-SLONG area_Alloc(struct sFreeArea ** ppArea, SLONG size)
+SLONG
+area_Alloc(struct sFreeArea ** ppArea, SLONG size)
{
struct sFreeArea *pArea;
@@ -114,7 +118,8 @@
return (-1);
}
-SLONG area_AllocCODEAnyBank(SLONG size)
+SLONG
+area_AllocCODEAnyBank(SLONG size)
{
SLONG i, org;
@@ -126,7 +131,8 @@
return (-1);
}
-struct sSection *FindLargestCode(void)
+struct sSection *
+FindLargestCode(void)
{
struct sSection *pSection, *r = NULL;
SLONG nLargest = 0;
@@ -144,7 +150,8 @@
return (r);
}
-void AssignCodeSections(void)
+void
+AssignCodeSections(void)
{
struct sSection *pSection;
@@ -161,7 +168,8 @@
}
}
-void GBROM_AssignSections(void)
+void
+GBROM_AssignSections(void)
{
SLONG i;
struct sSection *pSection;
@@ -234,10 +242,10 @@
case SECT_BSS:
if (area_AllocAbs
(&BankFree[BANK_BSS], pSection->nOrg,
- pSection->nByteSize) != pSection->nOrg) {
+ pSection->nByteSize) != pSection->nOrg) {
sprintf(temptext,
- "Unable to load fixed BSS section at $%lX",
- pSection->nOrg);
+ "Unable to load fixed BSS section at $%lX",
+ pSection->nOrg);
fatalerror(temptext);
}
pSection->oAssigned = 1;
@@ -246,10 +254,10 @@
case SECT_HRAM:
if (area_AllocAbs
(&BankFree[BANK_HRAM], pSection->nOrg,
- pSection->nByteSize) != pSection->nOrg) {
+ pSection->nByteSize) != pSection->nOrg) {
sprintf(temptext,
- "Unable to load fixed HRAM section at $%lX",
- pSection->nOrg);
+ "Unable to load fixed HRAM section at $%lX",
+ pSection->nOrg);
fatalerror(temptext);
}
pSection->oAssigned = 1;
@@ -258,10 +266,10 @@
case SECT_VRAM:
if (area_AllocAbs
(&BankFree[BANK_VRAM], pSection->nOrg,
- pSection->nByteSize) != pSection->nOrg) {
+ pSection->nByteSize) != pSection->nOrg) {
sprintf(temptext,
- "Unable to load fixed VRAM section at $%lX",
- pSection->nOrg);
+ "Unable to load fixed VRAM section at $%lX",
+ pSection->nOrg);
fatalerror(temptext);
}
pSection->oAssigned = 1;
@@ -270,10 +278,10 @@
case SECT_HOME:
if (area_AllocAbs
(&BankFree[BANK_HOME], pSection->nOrg,
- pSection->nByteSize) != pSection->nOrg) {
+ pSection->nByteSize) != pSection->nOrg) {
sprintf(temptext,
- "Unable to load fixed HOME section at $%lX",
- pSection->nOrg);
+ "Unable to load fixed HOME section at $%lX",
+ pSection->nOrg);
fatalerror(temptext);
}
pSection->oAssigned = 1;
@@ -314,30 +322,30 @@
&& pSection->nBank <= 255) {
if (area_AllocAbs
(&BankFree
- [pSection->nBank],
- pSection->nOrg,
- pSection->
- nByteSize) !=
+ [pSection->nBank],
+ pSection->nOrg,
+ pSection->
+ nByteSize) !=
pSection->nOrg) {
sprintf
(temptext,
- "Unable to load fixed CODE/DATA section at $%lX in bank $%02lX",
- pSection->
- nOrg,
- pSection->
- nBank);
+ "Unable to load fixed CODE/DATA section at $%lX in bank $%02lX",
+ pSection->
+ nOrg,
+ pSection->
+ nBank);
fatalerror
(temptext);
}
DOMAXBANK(pSection->
- nBank);
+ nBank);
pSection->oAssigned = 1;
} else {
sprintf(temptext,
- "Unable to load fixed CODE/DATA section at $%lX in bank $%02lX",
- pSection->nOrg,
- pSection->
- nBank);
+ "Unable to load fixed CODE/DATA section at $%lX in bank $%02lX",
+ pSection->nOrg,
+ pSection->
+ nBank);
fatalerror(temptext);
}
}
@@ -362,11 +370,11 @@
/* User wants to have a say... and he's pissed */
if (pSection->nBank >= 1 && pSection->nBank <= 255) {
if ((pSection->nOrg =
- area_Alloc(&BankFree[pSection->nBank],
- pSection->nByteSize)) == -1) {
+ area_Alloc(&BankFree[pSection->nBank],
+ pSection->nByteSize)) == -1) {
sprintf(temptext,
- "Unable to load fixed CODE/DATA section into bank $%02lX",
- pSection->nBank);
+ "Unable to load fixed CODE/DATA section into bank $%02lX",
+ pSection->nBank);
fatalerror(temptext);
}
pSection->oAssigned = 1;
@@ -373,8 +381,8 @@
DOMAXBANK(pSection->nBank);
} else {
sprintf(temptext,
- "Unable to load fixed CODE/DATA section into bank $%02lX",
- pSection->nBank);
+ "Unable to load fixed CODE/DATA section into bank $%02lX",
+ pSection->nBank);
fatalerror(temptext);
}
}
@@ -391,14 +399,15 @@
if (pSection->oAssigned == 0
&& pSection->Type == SECT_CODE
&& pSection->nOrg != -1 && pSection->nBank == -1) {
- /* User wants to have a say... and he's back with a vengeance */
+ /* User wants to have a say... and he's back with a
+ * vengeance */
if ((pSection->nBank =
- area_AllocAbsCODEAnyBank(pSection->nOrg,
- pSection->nByteSize)) ==
+ area_AllocAbsCODEAnyBank(pSection->nOrg,
+ pSection->nByteSize)) ==
-1) {
sprintf(temptext,
- "Unable to load fixed CODE/DATA section at $%lX into any bank",
- pSection->nOrg);
+ "Unable to load fixed CODE/DATA section at $%lX into any bank",
+ pSection->nOrg);
fatalerror(temptext);
}
pSection->oAssigned = 1;
@@ -419,8 +428,8 @@
switch (pSection->Type) {
case SECT_BSS:
if ((pSection->nOrg =
- area_Alloc(&BankFree[BANK_BSS],
- pSection->nByteSize)) == -1) {
+ area_Alloc(&BankFree[BANK_BSS],
+ pSection->nByteSize)) == -1) {
fatalerror("BSS section too large\n");
}
pSection->nBank = BANK_BSS;
@@ -428,8 +437,8 @@
break;
case SECT_HRAM:
if ((pSection->nOrg =
- area_Alloc(&BankFree[BANK_HRAM],
- pSection->nByteSize)) == -1) {
+ area_Alloc(&BankFree[BANK_HRAM],
+ pSection->nByteSize)) == -1) {
fatalerror("HRAM section too large");
}
pSection->nBank = BANK_HRAM;
@@ -437,8 +446,8 @@
break;
case SECT_VRAM:
if ((pSection->nOrg =
- area_Alloc(&BankFree[BANK_VRAM],
- pSection->nByteSize)) == -1) {
+ area_Alloc(&BankFree[BANK_VRAM],
+ pSection->nByteSize)) == -1) {
fatalerror("VRAM section too large");
}
pSection->nBank = BANK_VRAM;
@@ -446,8 +455,8 @@
break;
case SECT_HOME:
if ((pSection->nOrg =
- area_Alloc(&BankFree[BANK_HOME],
- pSection->nByteSize)) == -1) {
+ area_Alloc(&BankFree[BANK_HOME],
+ pSection->nByteSize)) == -1) {
fatalerror("HOME section too large");
}
pSection->nBank = BANK_HOME;
@@ -466,7 +475,8 @@
AssignCodeSections();
}
-void PSION2_AssignSections(void)
+void
+PSION2_AssignSections(void)
{
struct sSection *pSection;
@@ -483,7 +493,7 @@
pSection = pSections;
while (pSection) {
if (pSection->oAssigned == 0
- && pSection->Type == SECT_CODE) {
+ && pSection->Type == SECT_CODE) {
pSection->oAssigned = 1;
pSection->nBank = 0;
pSection->nOrg = BankFree[0]->nOrg;
@@ -496,7 +506,7 @@
pSection = pSections;
while (pSection) {
if (pSection->oAssigned == 0
- && pSection->Type == SECT_BSS) {
+ && pSection->Type == SECT_BSS) {
pSection->oAssigned = 1;
pSection->nBank = 0;
pSection->nOrg = BankFree[0]->nOrg;
@@ -507,10 +517,11 @@
}
}
-void AssignSections(void)
+void
+AssignSections(void)
{
switch (outputtype) {
- case OUTPUT_GBROM:
+ case OUTPUT_GBROM:
GBROM_AssignSections();
break;
case OUTPUT_PSION2:
@@ -519,7 +530,8 @@
}
}
-void CreateSymbolTable(void)
+void
+CreateSymbolTable(void)
{
struct sSection *pSect;
@@ -535,18 +547,18 @@
while (i--) {
if ((pSect->tSymbols[i]->Type == SYM_EXPORT) &&
((pSect->tSymbols[i]->pSection == pSect) ||
- (pSect->tSymbols[i]->pSection == NULL))) {
+ (pSect->tSymbols[i]->pSection == NULL))) {
if (pSect->tSymbols[i]->pSection == NULL)
sym_CreateSymbol(pSect->tSymbols[i]->
- pzName,
- pSect->tSymbols[i]->
- nOffset, -1);
+ pzName,
+ pSect->tSymbols[i]->
+ nOffset, -1);
else
sym_CreateSymbol(pSect->tSymbols[i]->
- pzName,
- pSect->nOrg +
- pSect->tSymbols[i]->
- nOffset, pSect->nBank);
+ pzName,
+ pSect->nOrg +
+ pSect->tSymbols[i]->
+ nOffset, pSect->nBank);
}
}
pSect = pSect->pNext;
--- a/src/link/library.c
+++ b/src/link/library.c
@@ -6,7 +6,8 @@
#include "link/mylink.h"
#include "link/main.h"
-static BBOOL symboldefined(char *name)
+static BBOOL
+symboldefined(char *name)
{
struct sSection *pSect;
@@ -23,7 +24,6 @@
0)
return (1);
}
-
}
pSect = pSect->pNext;
}
@@ -30,7 +30,8 @@
return (0);
}
-static BBOOL addmodulecontaining(char *name)
+static BBOOL
+addmodulecontaining(char *name)
{
struct sSection **ppLSect;
@@ -46,7 +47,7 @@
(*ppLSect)->tSymbols[i]->pSection))) {
if (strcmp
((*ppLSect)->tSymbols[i]->pzName,
- name) == 0) {
+ name) == 0) {
struct sSection **ppSect;
ppSect = &pSections;
while (*ppSect)
@@ -58,7 +59,6 @@
return (1);
}
}
-
}
ppLSect = &((*ppLSect)->pNext);
}
@@ -65,7 +65,8 @@
return (0);
}
-void AddNeededModules(void)
+void
+AddNeededModules(void)
{
struct sSection *pSect;
@@ -84,21 +85,19 @@
*ppLSect = (*ppLSect)->pNext;
(*ppSect)->pNext = NULL;
- /*ppLSect=&((*ppLSect)->pNext); */
+ /* ppLSect=&((*ppLSect)->pNext); */
}
return;
}
-
if (options & OPT_SMART_C_LINK) {
if (!addmodulecontaining(smartlinkstartsymbol)) {
sprintf(temptext, "Can't find start symbol '%s'",
- smartlinkstartsymbol);
+ smartlinkstartsymbol);
fatalerror(temptext);
} else
printf("Smart linking with symbol '%s'\n",
- smartlinkstartsymbol);
+ smartlinkstartsymbol);
}
-
pSect = pSections;
while (pSect) {
@@ -109,10 +108,9 @@
|| (pSect->tSymbols[i]->Type == SYM_LOCAL)) {
if (!symboldefined(pSect->tSymbols[i]->pzName)) {
addmodulecontaining(pSect->tSymbols[i]->
- pzName);
+ pzName);
}
}
-
}
pSect = pSect->pNext;
}
--- a/src/link/main.c
+++ b/src/link/main.c
@@ -13,7 +13,7 @@
#include "link/main.h"
#include "link/library.h"
-// Quick and dirty...but it works
+// Quick and dirty...but it works
#ifdef __GNUC__
#define strcmpi strcasecmp
#endif
@@ -36,39 +36,40 @@
*
*/
-void fatalerror(char *s)
+void
+fatalerror(char *s)
{
printf("*ERROR* : %s\n", s);
exit(5);
}
-
/*
* Print the usagescreen
*
*/
-void PrintUsage(void)
+void
+PrintUsage(void)
{
printf("xLink v" LINK_VERSION " (part of ASMotor " ASMOTOR_VERSION
- ")\n\n" "Usage: xlink [options] linkfile\n"
- "Options:\n\t-h\t\tThis text\n"
- "\t-m<mapfile>\tWrite a mapfile\n"
- "\t-n<symfile>\tWrite a NO$GMB compatible symfile\n"
- "\t-z<hx>\t\tSet the byte value (hex format) used for uninitialised\n"
- "\t\t\tdata (default is ? for random)\n"
- "\t-s<symbol>\tPerform smart linking starting with <symbol>\n"
- "\t-t\t\tOutput target\n" "\t\t-tg\tGameboy ROM image(default)\n"
- "\t\t-ts\tGameboy small mode (32kB)\n"
- "\t\t-tp\tPsion2 reloc module\n");
+ ")\n\n" "Usage: xlink [options] linkfile\n"
+ "Options:\n\t-h\t\tThis text\n"
+ "\t-m<mapfile>\tWrite a mapfile\n"
+ "\t-n<symfile>\tWrite a NO$GMB compatible symfile\n"
+ "\t-z<hx>\t\tSet the byte value (hex format) used for uninitialised\n"
+ "\t\t\tdata (default is ? for random)\n"
+ "\t-s<symbol>\tPerform smart linking starting with <symbol>\n"
+ "\t-t\t\tOutput target\n" "\t\t-tg\tGameboy ROM image(default)\n"
+ "\t\t-ts\tGameboy small mode (32kB)\n"
+ "\t\t-tp\tPsion2 reloc module\n");
exit(0);
}
-
/*
* Parse the linkfile and load all the objectfiles
*
*/
-void ProcessLinkfile(char *tzLinkfile)
+void
+ProcessLinkfile(char *tzLinkfile)
{
FILE *pLinkfile;
enum eBlockType CurrentBlock = BLOCK_COMMENT;
@@ -78,7 +79,6 @@
sprintf(temptext, "Unable to find linkfile '%s'\n", tzLinkfile);
fatalerror(temptext);
}
-
while (!feof(pLinkfile)) {
char tzLine[256];
@@ -85,38 +85,38 @@
fscanf(pLinkfile, "%s\n", tzLine);
if (tzLine[0] != '#') {
if (tzLine[0] == '['
- && tzLine[strlen(tzLine) - 1] == ']') {
+ && tzLine[strlen(tzLine) - 1] == ']') {
if (strcmpi("[objects]", tzLine) == 0)
CurrentBlock = BLOCK_OBJECTS;
else if (strcmpi("[output]", tzLine) ==
- 0)
+ 0)
CurrentBlock = BLOCK_OUTPUT;
else if (strcmpi("[libraries]", tzLine)
- == 0)
+ == 0)
CurrentBlock = BLOCK_LIBRARIES;
else if (strcmpi("[comment]", tzLine) ==
- 0)
+ 0)
CurrentBlock = BLOCK_COMMENT;
else {
fclose(pLinkfile);
sprintf(temptext,
- "Unknown block '%s'\n",
- tzLine);
+ "Unknown block '%s'\n",
+ tzLine);
fatalerror(temptext);
}
} else {
switch (CurrentBlock) {
- case BLOCK_COMMENT:
- break;
- case BLOCK_OBJECTS:
- obj_Readfile(tzLine);
- break;
- case BLOCK_LIBRARIES:
- lib_Readfile(tzLine);
- break;
- case BLOCK_OUTPUT:
- out_Setname(tzLine);
- break;
+ case BLOCK_COMMENT:
+ break;
+ case BLOCK_OBJECTS:
+ obj_Readfile(tzLine);
+ break;
+ case BLOCK_LIBRARIES:
+ lib_Readfile(tzLine);
+ break;
+ case BLOCK_OUTPUT:
+ out_Setname(tzLine);
+ break;
}
}
}
@@ -124,13 +124,13 @@
fclose(pLinkfile);
}
-
/*
* The main routine
*
*/
-int main(int argc, char *argv[])
+int
+main(int argc, char *argv[])
{
SLONG argn = 0;
@@ -168,7 +168,7 @@
break;
default:
sprintf(temptext, "Unknown option 't%c'\n",
- opt);
+ opt);
fatalerror(temptext);
break;
}
@@ -182,7 +182,7 @@
result =
sscanf(argv[argn - 1] + 2, "%lx",
- &fillchar);
+ &fillchar);
if (!((result == EOF) || (result == 1))) {
fatalerror
("Invalid argument for option 'z'\n");
--- a/src/link/mapfile.c
+++ b/src/link/mapfile.c
@@ -13,7 +13,8 @@
SLONG currentbank = 0;
SLONG sfbank;
-void SetMapfileName(char *name)
+void
+SetMapfileName(char *name)
{
mf = fopen(name, "wt");
@@ -21,7 +22,8 @@
fatalerror("Unable to open mapfile for writing");
}
-void SetSymfileName(char *name)
+void
+SetSymfileName(char *name)
{
sf = fopen(name, "wt");
@@ -31,7 +33,8 @@
fprintf(sf, ";File generated by xLink v" LINK_VERSION "\n\n");
}
-void CloseMapfile(void)
+void
+CloseMapfile(void)
{
if (mf) {
fclose(mf);
@@ -43,7 +46,8 @@
}
}
-void MapfileInitBank(SLONG bank)
+void
+MapfileInitBank(SLONG bank)
{
if (mf) {
currentbank = bank;
@@ -58,13 +62,13 @@
else if (bank == BANK_VRAM)
fprintf(mf, "VRAM:\n");
}
-
if (sf) {
sfbank = (bank >= 1 && bank <= 255) ? bank : 0;
}
}
-void MapfileWriteSection(struct sSection *pSect)
+void
+MapfileWriteSection(struct sSection * pSect)
{
if (!mf && !sf)
return;
@@ -72,30 +76,30 @@
SLONG i;
fprintf(mf, " SECTION: $%04lX-$%04lX ($%04lX bytes)\n",
- pSect->nOrg, pSect->nOrg + pSect->nByteSize - 1,
- pSect->nByteSize);
+ pSect->nOrg, pSect->nOrg + pSect->nByteSize - 1,
+ pSect->nByteSize);
for (i = 0; i < pSect->nNumberOfSymbols; i += 1) {
struct sSymbol *pSym;
pSym = pSect->tSymbols[i];
if ((pSym->pSection == pSect)
- && (pSym->Type != SYM_IMPORT)) {
+ && (pSym->Type != SYM_IMPORT)) {
if (mf) {
fprintf(mf, " $%04lX = %s\n",
- pSym->nOffset + pSect->nOrg,
- pSym->pzName);
+ pSym->nOffset + pSect->nOrg,
+ pSym->pzName);
}
if (sf) {
fprintf(sf, "%02lX:%04lX %s\n", sfbank,
- pSym->nOffset + pSect->nOrg,
- pSym->pzName);
+ pSym->nOffset + pSect->nOrg,
+ pSym->pzName);
}
-
}
}
}
-void MapfileCloseBank(SLONG slack)
+void
+MapfileCloseBank(SLONG slack)
{
if (!mf)
return;
--- a/src/link/object.c
+++ b/src/link/object.c
@@ -21,7 +21,8 @@
*
*/
-SLONG readlong(FILE * f)
+SLONG
+readlong(FILE * f)
{
SLONG r;
@@ -33,7 +34,8 @@
return (r);
}
-UWORD readword(FILE * f)
+UWORD
+readword(FILE * f)
{
UWORD r;
@@ -42,13 +44,13 @@
return (r);
}
-
/*
* Read a NULL terminated string from a file
*
*/
-SLONG readasciiz(char *s, FILE * f)
+SLONG
+readasciiz(char *s, FILE * f)
{
SLONG r = 0;
@@ -57,13 +59,13 @@
return (r + 1);
}
-
/*
* Allocate a new section and link it into the list
*
*/
-struct sSection *AllocSection(void)
+struct sSection *
+AllocSection(void)
{
struct sSection **ppSections;
@@ -80,7 +82,6 @@
fatalerror("Out of memory!");
return NULL;
}
-
(*ppSections)->tSymbols = tSymbols;
(*ppSections)->pNext = NULL;
(*ppSections)->pPatches = NULL;
@@ -87,13 +88,13 @@
(*ppSections)->oAssigned = 0;
return *ppSections;
}
-
/*
* Read a symbol from a file
*
*/
-struct sSymbol *obj_ReadSymbol(FILE * f)
+struct sSymbol *
+obj_ReadSymbol(FILE * f)
{
char s[256];
struct sSymbol *pSym;
@@ -108,20 +109,19 @@
fatalerror("Out of memory!");
strcpy(pSym->pzName, s);
- if ((pSym->Type = (enum eSymbolType)fgetc(f)) != SYM_IMPORT) {
+ if ((pSym->Type = (enum eSymbolType) fgetc(f)) != SYM_IMPORT) {
pSym->nSectionID = readlong(f);
pSym->nOffset = readlong(f);
}
-
return pSym;
}
-
/*
* RGB0 object reader routines
*
*/
-struct sSection *obj_ReadRGB0Section(FILE * f)
+struct sSection *
+obj_ReadRGB0Section(FILE * f)
{
struct sSection *pSection;
@@ -128,7 +128,7 @@
pSection = AllocSection();
pSection->nByteSize = readlong(f);
- pSection->Type = (enum eSectionType)fgetc(f);
+ pSection->Type = (enum eSectionType) fgetc(f);
pSection->nOrg = -1;
pSection->nBank = -1;
@@ -137,7 +137,6 @@
if ((options & OPT_SMALL) && (pSection->Type == SECT_CODE)) {
pSection->Type = SECT_HOME;
}
-
if ((pSection->Type == SECT_CODE) || (pSection->Type == SECT_HOME)) {
/*
* These sectiontypes contain data...
@@ -153,7 +152,7 @@
char s[256];
fread(pSection->pData, sizeof(UBYTE),
- pSection->nByteSize, f);
+ pSection->nByteSize, f);
nNumberOfPatches = readlong(f);
ppPatch = &pSection->pPatches;
@@ -176,12 +175,12 @@
strcpy(pPatch->pzFilename, s);
pPatch->nLineNo =
- readlong(f);
+ readlong(f);
pPatch->nOffset =
- readlong(f);
+ readlong(f);
pPatch->Type =
- (enum ePatchType)
- fgetc(f);
+ (enum ePatchType)
+ fgetc(f);
if ((pPatch->nRPNSize = readlong(f)) > 0) {
pPatch->pRPN = malloc(pPatch->nRPNSize);
@@ -189,7 +188,7 @@
fatalerror("Out of memory!");
fread(pPatch->pRPN, sizeof(UBYTE),
- pPatch->nRPNSize, f);
+ pPatch->nRPNSize, f);
} else
pPatch->pRPN = NULL;
@@ -202,11 +201,11 @@
pSection->pData = &dummymem;
}
}
-
return pSection;
}
-void obj_ReadRGB0(FILE *pObjfile)
+void
+obj_ReadRGB0(FILE * pObjfile)
{
struct sSection *pFirstSection;
SLONG nNumberOfSymbols, nNumberOfSections, i;
@@ -224,7 +223,7 @@
for (i = 0; i < nNumberOfSymbols; i += 1)
tSymbols[i] = obj_ReadSymbol(pObjfile);
} else
- tSymbols = (struct sSymbol **)&dummymem;
+ tSymbols = (struct sSymbol **) & dummymem;
/* Next we have the sections */
@@ -259,13 +258,13 @@
tSymbols[i]->pSection = NULL;
}
}
-
/*
* RGB1 object reader routines
*
*/
-struct sSection *obj_ReadRGB1Section(FILE *f)
+struct sSection *
+obj_ReadRGB1Section(FILE * f)
{
struct sSection *pSection;
@@ -272,7 +271,7 @@
pSection = AllocSection();
pSection->nByteSize = readlong(f);
- pSection->Type = (enum eSectionType)fgetc(f);
+ pSection->Type = (enum eSectionType) fgetc(f);
/*
* And because of THIS new feature I'll have to rewrite loads and
* loads of stuff... oh well it needed to be done anyway
@@ -286,7 +285,6 @@
if ((options & OPT_SMALL) && (pSection->Type == SECT_CODE)) {
pSection->Type = SECT_HOME;
}
-
if ((pSection->Type == SECT_CODE) || (pSection->Type == SECT_HOME)) {
/*
* These sectiontypes contain data...
@@ -302,7 +300,7 @@
char s[256];
fread(pSection->pData, sizeof(UBYTE),
- pSection->nByteSize, f);
+ pSection->nByteSize, f);
nNumberOfPatches = readlong(f);
ppPatch = &pSection->pPatches;
@@ -328,10 +326,10 @@
if ((pPatch->nRPNSize = readlong(f)) > 0) {
pPatch->pRPN = malloc(pPatch->nRPNSize);
if (!pPatch->pRPN)
- fatalerror ("Out of memory!");
+ fatalerror("Out of memory!");
fread(pPatch->pRPN, sizeof(UBYTE),
- pPatch->nRPNSize, f);
+ pPatch->nRPNSize, f);
} else
pPatch->pRPN = NULL;
@@ -344,11 +342,11 @@
pSection->pData = &dummymem;
}
}
-
return pSection;
}
-void obj_ReadRGB1(FILE *pObjfile)
+void
+obj_ReadRGB1(FILE * pObjfile)
{
struct sSection *pFirstSection;
SLONG nNumberOfSymbols, nNumberOfSections, i;
@@ -366,7 +364,7 @@
for (i = 0; i < nNumberOfSymbols; i += 1)
tSymbols[i] = obj_ReadSymbol(pObjfile);
} else
- tSymbols = (struct sSymbol **)&dummymem;
+ tSymbols = (struct sSymbol **) & dummymem;
/* Next we have the sections */
@@ -401,13 +399,13 @@
tSymbols[i]->pSection = NULL;
}
}
-
/*
* The main objectfileloadroutine (phew)
*
*/
-void obj_ReadOpenFile(FILE * pObjfile, char *tzObjectfile)
+void
+obj_ReadOpenFile(FILE * pObjfile, char *tzObjectfile)
{
char tzHeader[8];
@@ -419,12 +417,13 @@
obj_ReadRGB0(pObjfile);
break;
case '1':
- case '2': // V2 is really the same but the are new patch types
- obj_ReadRGB1(pObjfile);
+ case '2':
+ //V2 is really the same but the are new patch types
+ obj_ReadRGB1(pObjfile);
break;
default:
sprintf(temptext, "'%s' is an unsupported version\n",
- tzObjectfile);
+ tzObjectfile);
fatalerror(temptext);
break;
}
@@ -434,7 +433,8 @@
}
}
-void obj_Readfile(char *tzObjectfile)
+void
+obj_Readfile(char *tzObjectfile)
{
FILE *pObjfile;
@@ -448,7 +448,6 @@
sprintf(temptext, "Unable to open '%s'\n", tzObjectfile);
fatalerror(temptext);
}
-
obj_ReadOpenFile(pObjfile, tzObjectfile);
fclose(pObjfile);
@@ -455,7 +454,8 @@
oReadLib = 0;
}
-SLONG file_Length(FILE * f)
+SLONG
+file_Length(FILE * f)
{
ULONG r, p;
@@ -467,7 +467,8 @@
return (r);
}
-void lib_ReadXLB0(FILE * f)
+void
+lib_ReadXLB0(FILE * f)
{
SLONG size;
@@ -486,7 +487,8 @@
}
}
-void lib_Readfile(char *tzLibfile)
+void
+lib_Readfile(char *tzLibfile)
{
FILE *pObjfile;
@@ -497,7 +499,6 @@
sprintf(temptext, "Unable to open '%s'\n", tzLibfile);
fatalerror(temptext);
}
-
char tzHeader[5];
fread(tzHeader, sizeof(char), 4, pObjfile);
@@ -506,7 +507,7 @@
lib_ReadXLB0(pObjfile);
else {
sprintf(temptext, "'%s' is an invalid library\n",
- tzLibfile);
+ tzLibfile);
fatalerror(temptext);
}
fclose(pObjfile);
--- a/src/link/output.c
+++ b/src/link/output.c
@@ -10,7 +10,8 @@
char tzOutname[_MAX_PATH];
BBOOL oOutput = 0;
-void writehome(FILE *f)
+void
+writehome(FILE * f)
{
struct sSection *pSect;
UBYTE *mem;
@@ -28,7 +29,7 @@
while (pSect) {
if (pSect->Type == SECT_HOME) {
memcpy(mem + pSect->nOrg, pSect->pData,
- pSect->nByteSize);
+ pSect->nByteSize);
MapfileWriteSection(pSect);
}
pSect = pSect->pNext;
@@ -40,7 +41,8 @@
free(mem);
}
-void writebank(FILE *f, SLONG bank)
+void
+writebank(FILE * f, SLONG bank)
{
struct sSection *pSect;
UBYTE *mem;
@@ -52,7 +54,6 @@
if (fillchar != -1) {
memset(mem, fillchar, MaxAvail[bank]);
}
-
MapfileInitBank(bank);
pSect = pSections;
@@ -59,7 +60,7 @@
while (pSect) {
if (pSect->Type == SECT_CODE && pSect->nBank == bank) {
memcpy(mem + pSect->nOrg - 0x4000, pSect->pData,
- pSect->nByteSize);
+ pSect->nByteSize);
MapfileWriteSection(pSect);
}
pSect = pSect->pNext;
@@ -71,13 +72,15 @@
free(mem);
}
-void out_Setname(char *tzOutputfile)
+void
+out_Setname(char *tzOutputfile)
{
strcpy(tzOutname, tzOutputfile);
oOutput = 1;
}
-void GBROM_Output(void)
+void
+GBROM_Output(void)
{
SLONG i;
FILE *f;
@@ -89,7 +92,6 @@
fclose(f);
}
-
for (i = 256; i < MAXBANKS; i += 1) {
struct sSection *pSect;
MapfileInitBank(i);
@@ -104,7 +106,8 @@
}
}
-void PSION2_Output(void)
+void
+PSION2_Output(void)
{
FILE *f;
@@ -126,11 +129,11 @@
while (pSect) {
if (pSect->Type == SECT_CODE) {
memcpy(mem + pSect->nOrg, pSect->pData,
- pSect->nByteSize);
+ pSect->nByteSize);
MapfileWriteSection(pSect);
} else {
memset(mem + pSect->nOrg, 0,
- pSect->nByteSize);
+ pSect->nByteSize);
}
pSect = pSect->pNext;
}
@@ -140,7 +143,6 @@
fwrite(mem, 1, MaxAvail[0] - area_Avail(0), f);
free(mem);
}
-
relocpatches = 0;
pSect = pSections;
while (pSect) {
@@ -187,11 +189,12 @@
}
}
-void Output(void)
+void
+Output(void)
{
if (oOutput) {
switch (outputtype) {
- case OUTPUT_GBROM:
+ case OUTPUT_GBROM:
GBROM_Output();
break;
case OUTPUT_PSION2:
--- a/src/link/patch.c
+++ b/src/link/patch.c
@@ -10,20 +10,23 @@
SLONG rpnp;
SLONG nPC;
-void rpnpush(SLONG i)
+void
+rpnpush(SLONG i)
{
rpnstack[rpnp++] = i;
}
-SLONG rpnpop(void)
+SLONG
+rpnpop(void)
{
return (rpnstack[--rpnp]);
}
-SLONG getsymvalue(SLONG symid)
+SLONG
+getsymvalue(SLONG symid)
{
switch (pCurrentSection->tSymbols[symid]->Type) {
- case SYM_IMPORT:
+ case SYM_IMPORT:
return (sym_GetValue(pCurrentSection->tSymbols[symid]->pzName));
break;
case SYM_EXPORT:
@@ -31,13 +34,13 @@
{
if (strcmp
(pCurrentSection->tSymbols[symid]->pzName,
- "@") == 0) {
+ "@") == 0) {
return (nPC);
} else
return (pCurrentSection->tSymbols[symid]->
- nOffset +
- pCurrentSection->tSymbols[symid]->
- pSection->nOrg);
+ nOffset +
+ pCurrentSection->tSymbols[symid]->
+ pSection->nOrg);
}
default:
break;
@@ -46,16 +49,17 @@
return (0);
}
-SLONG getsymbank(SLONG symid)
+SLONG
+getsymbank(SLONG symid)
{
switch (pCurrentSection->tSymbols[symid]->Type) {
- case SYM_IMPORT:
+ case SYM_IMPORT:
return (sym_GetBank(pCurrentSection->tSymbols[symid]->pzName));
break;
case SYM_EXPORT:
case SYM_LOCAL:
return (pCurrentSection->tSymbols[symid]->pSection->nBank);
- //return( pCurrentSection->nBank );
+ //return (pCurrentSection->nBank);
default:
break;
}
@@ -63,7 +67,8 @@
return (0);
}
-SLONG calcrpn(struct sPatch * pPatch)
+SLONG
+calcrpn(struct sPatch * pPatch)
{
SLONG t, size;
UBYTE *rpn;
@@ -154,8 +159,8 @@
rpnpush(t & 0xFF);
if (t < 0 || (t > 0xFF && t < 0xFF00) || t > 0xFFFF) {
sprintf(temptext,
- "%s(%ld) : Value must be in the HRAM area",
- pPatch->pzFilename, pPatch->nLineNo);
+ "%s(%ld) : Value must be in the HRAM area",
+ pPatch->pzFilename, pPatch->nLineNo);
fatalerror(temptext);
}
break;
@@ -164,8 +169,8 @@
rpnpush(t & 0xFF);
if (t < 0x2000 || t > 0x20FF) {
sprintf(temptext,
- "%s(%ld) : Value must be in the ZP area",
- pPatch->pzFilename, pPatch->nLineNo);
+ "%s(%ld) : Value must be in the ZP area",
+ pPatch->pzFilename, pPatch->nLineNo);
fatalerror(temptext);
}
break;
@@ -212,9 +217,9 @@
t = rpnpop();
if (t < low || t > high) {
sprintf(temptext,
- "%s(%ld) : Value must be in the range [%ld;%ld]",
- pPatch->pzFilename,
- pPatch->nLineNo, low, high);
+ "%s(%ld) : Value must be in the range [%ld;%ld]",
+ pPatch->pzFilename,
+ pPatch->nLineNo, low, high);
fatalerror(temptext);
}
rpnpush(t);
@@ -226,7 +231,8 @@
return (rpnpop());
}
-void Patch(void)
+void
+Patch(void)
{
struct sSection *pSect;
@@ -249,9 +255,9 @@
(UBYTE) t;
} else {
sprintf(temptext,
- "%s(%ld) : Value must be 8-bit\n",
- pPatch->pzFilename,
- pPatch->nLineNo);
+ "%s(%ld) : Value must be 8-bit\n",
+ pPatch->pzFilename,
+ pPatch->nLineNo);
fatalerror(temptext);
}
break;
@@ -263,20 +269,20 @@
pSect->pData[pPatch->nOffset] =
t & 0xFF;
pSect->pData[pPatch->nOffset +
- 1] =
+ 1] =
(t >> 8) & 0xFF;
} else {
- // Assume big endian
- pSect->pData[pPatch->nOffset] =
+ //Assume big endian
+ pSect->pData[pPatch->nOffset] =
(t >> 8) & 0xFF;
pSect->pData[pPatch->nOffset +
- 1] = t & 0xFF;
+ 1] = t & 0xFF;
}
} else {
sprintf(temptext,
- "%s(%ld) : Value must be 16-bit\n",
- pPatch->pzFilename,
- pPatch->nLineNo);
+ "%s(%ld) : Value must be 16-bit\n",
+ pPatch->pzFilename,
+ pPatch->nLineNo);
fatalerror(temptext);
}
break;
--- a/src/link/symbol.c
+++ b/src/link/symbol.c
@@ -11,13 +11,15 @@
struct ISymbol {
char *pzName;
SLONG nValue;
- SLONG nBank; // -1=const
+ SLONG nBank;
+ //-1 = const
struct ISymbol *pNext;
};
struct ISymbol *tHash[HASHSIZE];
-SLONG calchash(char *s)
+SLONG
+calchash(char *s)
{
SLONG r = 0;
while (*s)
@@ -26,7 +28,8 @@
return (r % HASHSIZE);
}
-void sym_Init(void)
+void
+sym_Init(void)
{
SLONG i;
for (i = 0; i < HASHSIZE; i += 1)
@@ -33,7 +36,8 @@
tHash[i] = NULL;
}
-SLONG sym_GetValue(char *tzName)
+SLONG
+sym_GetValue(char *tzName)
{
if (strcmp(tzName, "@") == 0) {
return (nPC);
@@ -55,7 +59,8 @@
}
}
-SLONG sym_GetBank(char *tzName)
+SLONG
+sym_GetBank(char *tzName)
{
struct ISymbol **ppSym;
@@ -73,7 +78,8 @@
return (0);
}
-void sym_CreateSymbol(char *tzName, SLONG nValue, SBYTE nBank)
+void
+sym_CreateSymbol(char *tzName, SLONG nValue, SBYTE nBank)
{
if (strcmp(tzName, "@") == 0)
return;
@@ -90,8 +96,8 @@
return;
sprintf(temptext,
- "Symbol '%s' defined more than once\n",
- tzName);
+ "Symbol '%s' defined more than once\n",
+ tzName);
fatalerror(temptext);
}
}