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
This commit is contained in:
anthony
2009-12-30 12:51:32 -07:00
parent ddd7fdac01
commit a014537837
21 changed files with 1175 additions and 1091 deletions

View File

@@ -56,9 +56,9 @@ long i00afunc();
#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 @@ extern pointer malloc ();
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 @@ static void find_stack_direction()
stack_dir = -1; /* Stack grew downward. */
}
}
#endif /* STACK_DIRECTION == 0 */
/* An "alloca header" is used to:
@@ -138,10 +139,10 @@ static void find_stack_direction()
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 @@ static header *last_alloca_header = NULL; /* -> last alloca header. */
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 @@ unsigned size;
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 @@ unsigned size;
/* 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 @@ struct stack_control_header {
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 @@ struct stack_segment_linkage {
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 @@ struct stack_segment_linkage {
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,25 +288,24 @@ struct stk_stat {
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. */
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 @@ struct stk_trailer {
long unknown13;
long unknown14;
};
#endif /* CRAY2 */
#endif /* not CRAY_STACK */
@@ -327,27 +324,28 @@ struct stk_trailer {
/* 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;
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,40 +353,38 @@ static long i00afunc(long *address)
/* 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;
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 @@ static long i00afunc(long *address)
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 @@ static long i00afunc(long address)
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.
B67 also points to the stack segment linkage control
area, which is what we are really interested in. */
/* 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. */
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 this is not the first segment, 'pseg' will be
nonzero. */
/* 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. */
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,24 +443,22 @@ static long i00afunc(long address)
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
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;
}
return (result);
}
#endif /* not CRAY2 */
#endif /* CRAY */

View File

@@ -46,7 +46,8 @@ ULONG ulMacroReturnValue;
#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 @@ ULONG filesize(char *s)
}
return (size);
}
/*
* RGBAsm - FSTACK.C (FileStack routines)
*
@@ -66,7 +66,8 @@ ULONG filesize(char *s)
*
*/
void pushcontext(void)
void
pushcontext(void)
{
struct sContext **ppFileStack;
@@ -75,11 +76,11 @@ void pushcontext(void)
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 @@ void pushcontext(void)
fatalerror("No memory for context");
}
int popcontext(void)
int
popcontext(void)
{
struct sContext *pLastFile, **ppLastFile;
@@ -112,7 +114,7 @@ int popcontext(void)
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 @@ int popcontext(void)
return (0);
}
}
if ((pLastFile = pFileStack) != NULL) {
ppLastFile = &pFileStack;
while (pLastFile->pNext) {
@@ -140,8 +141,8 @@ int popcontext(void)
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 @@ int popcontext(void)
return (1);
}
int yywrap(void)
int
yywrap(void)
{
return (popcontext());
}
/*
* RGBAsm - FSTACK.C (FileStack routines)
*
@@ -179,7 +180,8 @@ int yywrap(void)
*
*/
void fstk_Dump(void)
void
fstk_Dump(void)
{
struct sContext *pLastFile;
@@ -192,7 +194,6 @@ void fstk_Dump(void)
printf("%s(%ld)", tzCurrentFileName, nLineNo);
}
/*
* RGBAsm - FSTACK.C (FileStack routines)
*
@@ -200,12 +201,14 @@ void fstk_Dump(void)
*
*/
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 @@ void fstk_FindFile(char *s)
}
}
}
/*
* RGBAsm - FSTACK.C (FileStack routines)
*
@@ -235,16 +237,17 @@ void fstk_FindFile(char *s)
*
*/
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,16 +258,15 @@ ULONG fstk_RunInclude(char *s)
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);
} else
return (0);
}
/*
* RGBAsm - FSTACK.C (FileStack routines)
*
@@ -272,7 +274,8 @@ ULONG fstk_RunInclude(char *s)
*
*/
ULONG fstk_RunMacro(char *s)
ULONG
fstk_RunMacro(char *s)
{
struct sSymbol *sym;
@@ -286,13 +289,12 @@ ULONG fstk_RunMacro(char *s)
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 @@ ULONG fstk_RunMacro(char *s)
*
*/
void fstk_RunMacroArg(SLONG s)
void
fstk_RunMacroArg(SLONG s)
{
char *sym;
@@ -318,7 +321,6 @@ void fstk_RunMacroArg(SLONG s)
} else
fatalerror("No such macroargument");
}
/*
* RGBAsm - FSTACK.C (FileStack routines)
*
@@ -326,7 +328,8 @@ void fstk_RunMacroArg(SLONG s)
*
*/
void fstk_RunString(char *s)
void
fstk_RunString(char *s)
{
struct sSymbol *pSym;
@@ -340,7 +343,6 @@ void fstk_RunString(char *s)
} else
yyerror("No such string symbol");
}
/*
* RGBAsm - FSTACK.C (FileStack routines)
*
@@ -348,7 +350,8 @@ void fstk_RunString(char *s)
*
*/
void fstk_RunRept(ULONG count)
void
fstk_RunRept(ULONG count)
{
if (count) {
pushcontext();
@@ -364,7 +367,6 @@ void fstk_RunRept(ULONG count)
yy_switch_to_buffer(CurrentFlexHandle);
}
}
/*
* RGBAsm - FSTACK.C (FileStack routines)
*
@@ -372,7 +374,8 @@ void fstk_RunRept(ULONG count)
*
*/
ULONG fstk_Init(char *s)
ULONG
fstk_Init(char *s)
{
char tzFileName[_MAX_PATH + 1];

View File

@@ -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}
};

View File

@@ -16,7 +16,8 @@ UBYTE oDontExpandStrings = 0;
SLONG nGBGfxID = -1;
SLONG nBinaryID = -1;
SLONG gbgfx2bin(char ch)
SLONG
gbgfx2bin(char ch)
{
SLONG i;
@@ -29,7 +30,8 @@ SLONG gbgfx2bin(char ch)
return (0);
}
SLONG binary2bin(char ch)
SLONG
binary2bin(char ch)
{
SLONG i;
@@ -37,13 +39,13 @@ SLONG binary2bin(char ch)
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 @@ SLONG char2bin(char ch)
typedef SLONG(*x2bin) (char ch);
SLONG ascii2bin(char *s)
SLONG
ascii2bin(char *s)
{
SLONG radix = 10;
SLONG result = 0;
@@ -103,7 +106,8 @@ SLONG ascii2bin(char *s)
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 @@ ULONG ParseFixedPoint(char *s, ULONG size)
return (1);
}
ULONG ParseNumber(char *s, ULONG size)
ULONG
ParseNumber(char *s, ULONG size)
{
char dest[256];
@@ -139,7 +144,8 @@ ULONG ParseNumber(char *s, ULONG size)
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 ParseSymbol(char *src, ULONG size)
}
}
ULONG PutMacroArg(char *src, ULONG size)
ULONG
PutMacroArg(char *src, ULONG size)
{
char *s;
@@ -209,7 +216,8 @@ ULONG PutMacroArg(char *src, ULONG size)
return (0);
}
ULONG PutUniqueArg(char *src, ULONG size)
ULONG
PutUniqueArg(char *src, ULONG size)
{
src = src;
yyskipbytes(size);
@@ -225,119 +233,119 @@ enum {
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 @@ struct sLexFloat tMacroUniqueToken = {
T_LEX_MACROUNIQUE
};
void setuplex(void)
void
setuplex(void)
{
ULONG id;
@@ -373,62 +382,62 @@ void setuplex(void)
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);
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 @@ void setuplex(void)
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 @@ void setuplex(void)
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 @@ void setuplex(void)
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, '.', '.');

View File

@@ -18,7 +18,6 @@ struct sLexString {
ULONG nNameLength;
struct sLexString *pNext;
};
#define pLexBuffer (pCurrentBuffer->pBuffer)
#define nLexBufferLeng (pCurrentBuffer->nBufferSize)
@@ -41,7 +40,8 @@ enum eLexerState lexerstate = LEX_STATE_NORMAL;
#define AtLineStart pCurrentBuffer->oAtLineStart
#ifdef __GNUC__
void strupr(char *s)
void
strupr(char *s)
{
while (*s) {
*s = toupper(*s);
@@ -49,31 +49,35 @@ void strupr(char *s)
}
}
void strlwr(char *s)
void
strlwr(char *s)
{
while (*s) {
*s = tolower(*s);
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 @@ void yyunputstr(char *s)
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 @@ YY_BUFFER_STATE yy_scan_bytes(char *mem, ULONG size)
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 @@ YY_BUFFER_STATE yy_create_buffer(FILE * f)
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 @@ YY_BUFFER_STATE yy_create_buffer(FILE * f)
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,19 +195,20 @@ YY_BUFFER_STATE yy_create_buffer(FILE * f)
return (pBuffer);
}
}
fatalerror("Out of memory!");
return (NULL);
}
ULONG lex_FloatAlloc(struct sLexFloat * tok)
ULONG
lex_FloatAlloc(struct sLexFloat * tok)
{
tLexFloat[nFloating] = (*tok);
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_FloatDeleteRange(ULONG id, UWORD start, UWORD end)
}
}
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_FloatAddRange(ULONG id, UWORD start, UWORD end)
}
}
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_FloatDeleteFirstRange(ULONG id, UWORD start, UWORD end)
}
}
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_FloatAddFirstRange(ULONG id, UWORD start, UWORD end)
}
}
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_FloatDeleteSecondRange(ULONG id, UWORD start, UWORD end)
}
}
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 @@ void lex_FloatAddSecondRange(ULONG id, UWORD start, UWORD end)
}
}
struct sLexFloat *lexgetfloat(ULONG id)
struct sLexFloat *
lexgetfloat(ULONG id)
{
ULONG r = 0, mask = 1;
@@ -262,7 +277,8 @@ struct sLexFloat *lexgetfloat(ULONG id)
return (&tLexFloat[r]);
}
ULONG lexcalchash(char *s)
ULONG
lexcalchash(char *s)
{
ULONG r = 0;
@@ -274,7 +290,8 @@ ULONG lexcalchash(char *s)
return (r);
}
void lex_Init(void)
void
lex_Init(void)
{
ULONG i;
@@ -292,7 +309,8 @@ void lex_Init(void)
nFloating = 0;
}
void lex_AddStrings(struct sLexInitString *lex)
void
lex_AddStrings(struct sLexInitString * lex)
{
while (lex->tzName) {
struct sLexString **ppHash;
@@ -302,13 +320,13 @@ void lex_AddStrings(struct sLexInitString *lex)
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 @@ void lex_AddStrings(struct sLexInitString *lex)
}
}
ULONG yylex(void)
ULONG
yylex(void)
{
ULONG hash, maxlen;
char *s;
@@ -339,7 +358,7 @@ ULONG yylex(void)
case LEX_STATE_NORMAL:
AtLineStart = 0;
scanagain:
scanagain:
while (*pLexBuffer == ' ' || *pLexBuffer == '\t') {
linestart = 0;
@@ -353,7 +372,6 @@ ULONG yylex(void)
goto scanagain;
}
}
s = pLexBuffer;
nOldFloatMask = nFloatLen = 0;
nFloatMask = tFloatingFirstChar[(int) *s++];
@@ -385,14 +403,13 @@ ULONG yylex(void)
if (lex->nNameLength == yyleng) {
if (strnicmp
(pLexBuffer, lex->tzName,
yyleng) == 0) {
yyleng) == 0) {
pLongestFixed = lex;
}
}
lex = lex->pNext;
}
}
}
if (nFloatLen == 0 && pLongestFixed == NULL) {
@@ -401,7 +418,7 @@ ULONG yylex(void)
pLexBuffer += 1;
while ((*pLexBuffer != '"')
&& (*pLexBuffer != '\n')) {
&& (*pLexBuffer != '\n')) {
char ch, *marg;
if ((ch = *pLexBuffer++) == '\\') {
@@ -423,9 +440,9 @@ ULONG yylex(void)
case '8':
case '9':
if ((marg =
sym_FindMacroArg(ch
-
'0'))
sym_FindMacroArg(ch
-
'0'))
!= NULL) {
while (*marg)
yylval.
@@ -438,8 +455,8 @@ ULONG yylex(void)
break;
case '@':
if ((marg =
sym_FindMacroArg
(-1)) != NULL) {
sym_FindMacroArg
(-1)) != NULL) {
while (*marg)
yylval.
tzString
@@ -455,15 +472,14 @@ ULONG yylex(void)
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,16 +513,15 @@ ULONG yylex(void)
sym[i] = 0;
index +=
symvaluetostring(&yylval.
tzString
[index],
sym);
tzString
[index],
sym);
if (*pLexBuffer == '}')
pLexBuffer += 1;
else
yyerror("Missing }");
ch = 0;
}
if (ch)
yylval.tzString[index++] = ch;
}
@@ -526,7 +541,7 @@ ULONG yylex(void)
pLexBuffer += 1;
while ((*pLexBuffer != '}')
&& (*pLexBuffer != '\n')) {
&& (*pLexBuffer != '\n')) {
if ((ch = *pLexBuffer++) == '\\') {
switch (ch = (*pLexBuffer++)) {
case '0':
@@ -540,9 +555,9 @@ ULONG yylex(void)
case '8':
case '9':
if ((marg =
sym_FindMacroArg(ch
-
'0'))
sym_FindMacroArg(ch
-
'0'))
!= NULL) {
while (*marg)
sym[i++]
@@ -553,8 +568,8 @@ ULONG yylex(void)
break;
case '@':
if ((marg =
sym_FindMacroArg
(-1)) != NULL) {
sym_FindMacroArg
(-1)) != NULL) {
while (*marg)
sym[i++]
=
@@ -582,13 +597,11 @@ ULONG yylex(void)
return (*pLexBuffer++);
}
}
if (nFloatLen == 0) {
yyleng = pLongestFixed->nNameLength;
pLexBuffer += yyleng;
return (pLongestFixed->nToken);
}
if (pLongestFixed == NULL) {
struct sLexFloat *tok;
@@ -598,7 +611,6 @@ ULONG yylex(void)
if (tok->Callback(pLexBuffer, yyleng) == 0)
goto scanagain;
}
if (tok->nToken == T_ID && linestart) {
pLexBuffer += yyleng;
return (T_LABEL);
@@ -607,7 +619,6 @@ ULONG yylex(void)
return (tok->nToken);
}
}
if (nFloatLen > pLongestFixed->nNameLength) {
struct sLexFloat *tok;
@@ -617,7 +628,6 @@ ULONG yylex(void)
if (tok->Callback(pLexBuffer, yyleng) == 0)
goto scanagain;
}
if (tok->nToken == T_ID && linestart) {
pLexBuffer += yyleng;
return (T_LABEL);
@@ -642,7 +652,7 @@ ULONG yylex(void)
}
while ((*pLexBuffer != ',')
&& (*pLexBuffer != '\n')) {
&& (*pLexBuffer != '\n')) {
char ch, *marg;
if ((ch = *pLexBuffer++) == '\\') {
@@ -664,8 +674,8 @@ ULONG yylex(void)
case '8':
case '9':
if ((marg =
sym_FindMacroArg(ch -
'0')) !=
sym_FindMacroArg(ch -
'0')) !=
NULL) {
while (*marg)
yylval.
@@ -677,7 +687,7 @@ ULONG yylex(void)
break;
case '@':
if ((marg =
sym_FindMacroArg(-1)) !=
sym_FindMacroArg(-1)) !=
NULL) {
while (*marg)
yylval.
@@ -693,13 +703,12 @@ ULONG yylex(void)
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 @@ ULONG yylex(void)
case '8':
case '9':
if ((marg =
sym_FindMacroArg
(ch -
'0')) !=
sym_FindMacroArg
(ch -
'0')) !=
NULL) {
while
(*marg)
@@ -723,8 +732,8 @@ ULONG yylex(void)
break;
case '@':
if ((marg =
sym_FindMacroArg
(-1)) !=
sym_FindMacroArg
(-1)) !=
NULL) {
while
(*marg)
@@ -739,15 +748,14 @@ ULONG yylex(void)
sym[i] = 0;
index +=
symvaluetostring(&yylval.
tzString[index],
sym);
tzString[index],
sym);
if (*pLexBuffer == '}')
pLexBuffer += 1;
else
yyerror("Missing }");
ch = 0;
}
if (ch)
yylval.tzString[index++] = ch;
}

View File

@@ -56,73 +56,71 @@ struct sOptionStackEntry {
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 @@ void opt_Parse(char *s)
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 @@ void opt_Push(void)
fatalerror("No memory for option stack");
}
void opt_Pop(void)
void
opt_Pop(void)
{
if (pOptionStack) {
struct sOptionStackEntry *pOpt;
@@ -223,7 +223,6 @@ void opt_Pop(void)
} else
fatalerror("No entries in the option stack");
}
/*
* RGBAsm - MAIN.C
*
@@ -231,7 +230,8 @@ void opt_Pop(void)
*
*/
void yyerror(char *s)
void
yyerror(char *s)
{
printf("*ERROR*\t");
fstk_Dump();
@@ -239,12 +239,12 @@ void yyerror(char *s)
nErrors += 1;
}
void fatalerror(char *s)
void
fatalerror(char *s)
{
yyerror(s);
exit(5);
}
/*
* RGBAsm - MAIN.C
*
@@ -252,10 +252,11 @@ void fatalerror(char *s)
*
*/
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 @@ void PrintUsage(void)
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 @@ void PrintUsage(void)
*
*/
int main(int argc, char *argv[])
int
main(int argc, char *argv[])
{
char *tzMainfile;
int argn = 1;
@@ -299,8 +300,9 @@ int main(int argc, char *argv[])
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 @@ int main(int argc, char *argv[])
break;
default:
printf("*ERROR*\t :\n\tUnknown option '%c'\n",
argv[argn][1]);
argv[argn][1]);
exit(5);
break;
}
@@ -331,8 +333,7 @@ int main(int argc, char *argv[])
DefaultOptions = CurrentOptions;
/*tzMainfile=argv[argn++];
* argc-=1; */
/* tzMainfile=argv[argn++]; argc-=1; */
tzMainfile = argv[argn];
setuplex();
@@ -375,36 +376,36 @@ int main(int argc, char *argv[])
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);
}
} 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 {

View File

@@ -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_DefinePI(void)
*
*/
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 @@ void math_Print(SLONG i)
*
*/
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_Sin(SLONG i)
*
*/
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_Cos(SLONG i)
*
*/
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_Tan(SLONG i)
*
*/
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_ASin(SLONG i)
*
*/
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_ACos(SLONG i)
*
*/
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_ATan(SLONG i)
*
*/
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_ATan2(SLONG i, SLONG j)
*
*/
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_Mul(SLONG i, SLONG j)
*
*/
SLONG math_Div(SLONG i, SLONG j)
SLONG
math_Div(SLONG i, SLONG j)
{
return (double2fix(fix2double(i) / fix2double(j)));
}

View File

@@ -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 SectionStackEntry {
struct Section *pSection;
struct SectionStackEntry *pNext;
};
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -68,13 +67,14 @@ struct SectionStackEntry *pSectionStack = NULL;
*
*/
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 @@ void out_PushSection(void)
fatalerror("No memory for section stack");
}
void out_PopSection(void)
void
out_PopSection(void)
{
if (pSectionStack) {
struct SectionStackEntry *pSect;
@@ -94,7 +95,6 @@ void out_PopSection(void)
} else
fatalerror("No entries in the section stack");
}
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -102,7 +102,8 @@ void out_PopSection(void)
*
*/
ULONG countsymbols(void)
ULONG
countsymbols(void)
{
struct PatchSymbol *pSym;
ULONG count = 0;
@@ -116,7 +117,6 @@ ULONG countsymbols(void)
return (count);
}
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -124,7 +124,8 @@ ULONG countsymbols(void)
*
*/
ULONG countsections(void)
ULONG
countsections(void)
{
struct Section *pSect;
ULONG count = 0;
@@ -138,7 +139,6 @@ ULONG countsections(void)
return (count);
}
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -146,7 +146,8 @@ ULONG countsections(void)
*
*/
ULONG countpatches(struct Section * pSect)
ULONG
countpatches(struct Section * pSect)
{
struct Patch *pPatch;
ULONG r = 0;
@@ -159,7 +160,6 @@ ULONG countpatches(struct Section * pSect)
return (r);
}
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -167,14 +167,14 @@ ULONG countpatches(struct Section * pSect)
*
*/
void fputlong(ULONG i, FILE * f)
void
fputlong(ULONG i, FILE * f)
{
fputc(i, f);
fputc(i >> 8, f);
fputc(i >> 16, f);
fputc(i >> 24, f);
}
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -182,13 +182,13 @@ void fputlong(ULONG i, FILE * f)
*
*/
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 @@ void fputstring(char *s, FILE * f)
*
*/
ULONG getsectid(struct Section *pSect)
ULONG
getsectid(struct Section * pSect)
{
struct Section *sec;
ULONG ID = 0;
@@ -213,7 +214,6 @@ ULONG getsectid(struct Section *pSect)
fatalerror("INTERNAL: Unknown section");
return ((ULONG) - 1);
}
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -221,7 +221,8 @@ ULONG getsectid(struct Section *pSect)
*
*/
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 @@ void writepatch(struct Patch *pPatch, FILE * f)
fputlong(pPatch->nRPNSize, f);
fwrite(pPatch->pRPN, 1, pPatch->nRPNSize, f);
}
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -238,17 +238,20 @@ void writepatch(struct Patch *pPatch, FILE * f)
*
*/
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 @@ void writesection(struct Section *pSect, FILE * f)
}
}
}
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -270,7 +272,8 @@ void writesection(struct Section *pSect, FILE * f)
*
*/
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 @@ void writesymbol(struct sSymbol *pSym, FILE * f)
fputlong(offset, f);
}
}
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -320,7 +322,8 @@ void writesymbol(struct sSymbol *pSym, FILE * f)
*
*/
ULONG addsymbol(struct sSymbol *pSym)
ULONG
addsymbol(struct sSymbol * pSym)
{
struct PatchSymbol *pPSym, **ppPSym;
ULONG ID = 0;
@@ -337,7 +340,7 @@ ULONG addsymbol(struct sSymbol *pSym)
}
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 @@ ULONG addsymbol(struct sSymbol *pSym)
return ((ULONG) - 1);
}
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -356,7 +358,8 @@ ULONG addsymbol(struct sSymbol *pSym)
*
*/
void addexports(void)
void
addexports(void)
{
int i;
@@ -371,7 +374,6 @@ void addexports(void)
}
}
}
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -379,7 +381,8 @@ void addexports(void)
*
*/
struct Patch *allocpatch(void)
struct Patch *
allocpatch(void)
{
struct Patch *pPatch, **ppPatch;
@@ -392,7 +395,7 @@ struct Patch *allocpatch(void)
}
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 @@ struct Patch *allocpatch(void)
return (pPatch);
}
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -409,7 +411,8 @@ struct Patch *allocpatch(void)
*
*/
void createpatch(ULONG type, struct Expression *expr)
void
createpatch(ULONG type, struct Expression * expr)
{
struct Patch *pPatch;
UWORD rpndata;
@@ -434,7 +437,7 @@ void createpatch(ULONG type, struct Expression *expr)
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 @@ void createpatch(ULONG type, struct Expression *expr)
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 @@ void createpatch(ULONG type, struct Expression *expr)
pPatch->nRPNSize = rpnptr;
}
}
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -481,14 +483,14 @@ void createpatch(ULONG type, struct Expression *expr)
*
*/
void checksection(void)
void
checksection(void)
{
if (pCurrentSection)
return;
else
fatalerror("Code generation before SECTION directive");
}
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -497,21 +499,22 @@ void checksection(void)
*
*/
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 @@ void checkcodesection(SLONG size)
fatalerror
("Section can't contain initialized data or section limit exceeded");
}
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -530,7 +532,8 @@ void checkcodesection(SLONG size)
*
*/
void out_WriteObject(void)
void
out_WriteObject(void)
{
FILE *f;
@@ -559,7 +562,6 @@ void out_WriteObject(void)
fclose(f);
}
}
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -567,7 +569,8 @@ void out_WriteObject(void)
*
*/
void out_PrepPass2(void)
void
out_PrepPass2(void)
{
struct Section *pSect;
@@ -579,7 +582,6 @@ void out_PrepPass2(void)
pCurrentSection = NULL;
pSectionStack = NULL;
}
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -587,7 +589,8 @@ void out_PrepPass2(void)
*
*/
void out_SetFileName(char *s)
void
out_SetFileName(char *s)
{
strcpy(tzObjectname, s);
printf("Output filename %s\n", s);
@@ -595,7 +598,6 @@ void out_SetFileName(char *s)
pCurrentSection = NULL;
pPatchSymbols = NULL;
}
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -603,8 +605,9 @@ void out_SetFileName(char *s)
*
*/
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 @@ struct Section *out_FindSection(char *pzName, ULONG secttype, SLONG org,
}
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 @@ struct Section *out_FindSection(char *pzName, ULONG secttype, SLONG org,
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 @@ struct Section *out_FindSection(char *pzName, ULONG secttype, SLONG org,
return (NULL);
}
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -659,7 +661,8 @@ struct Section *out_FindSection(char *pzName, ULONG secttype, SLONG org,
*
*/
void out_SetCurrentSection(struct Section *pSect)
void
out_SetCurrentSection(struct Section * pSect)
{
pCurrentSection = pSect;
nPC = pSect->nPC;
@@ -667,7 +670,6 @@ void out_SetCurrentSection(struct Section *pSect)
pPCSymbol->nValue = nPC;
pPCSymbol->pSection = pCurrentSection;
}
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -675,11 +677,11 @@ void out_SetCurrentSection(struct Section *pSect)
*
*/
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_NewSection(char *pzName, ULONG secttype)
*
*/
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_NewAbsSection(char *pzName, ULONG secttype, SLONG org, SLONG bank)
*
*/
void out_AbsByte(int b)
void
out_AbsByte(int b)
{
checkcodesection(1);
b &= 0xFF;
@@ -710,7 +713,6 @@ void out_AbsByte(int b)
nPC += 1;
pPCSymbol->nValue += 1;
}
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -718,12 +720,13 @@ void out_AbsByte(int b)
*
*/
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 @@ void out_Skip(int skip)
out_AbsByte(CurrentOptions.fillchar);
}
}
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -741,13 +743,13 @@ void out_Skip(int skip)
*
*/
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_String(char *s)
*
*/
void out_RelByte(struct Expression *expr)
void
out_RelByte(struct Expression * expr)
{
checkcodesection(1);
if (rpn_isReloc(expr)) {
@@ -772,7 +775,6 @@ void out_RelByte(struct Expression *expr)
rpn_Reset(expr);
}
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -780,7 +782,8 @@ void out_RelByte(struct Expression *expr)
*
*/
void out_AbsWord(int b)
void
out_AbsWord(int b)
{
checkcodesection(2);
b &= 0xFFFF;
@@ -789,8 +792,8 @@ void out_AbsWord(int b)
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 @@ void out_AbsWord(int b)
nPC += 2;
pPCSymbol->nValue += 2;
}
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -807,7 +809,8 @@ void out_AbsWord(int b)
*
*/
void out_RelWord(struct Expression *expr)
void
out_RelWord(struct Expression * expr)
{
ULONG b;
@@ -820,8 +823,8 @@ void out_RelWord(struct Expression *expr)
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 @@ void out_RelWord(struct Expression *expr)
out_AbsWord(expr->nVal);
rpn_Reset(expr);
}
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -841,7 +843,8 @@ void out_RelWord(struct Expression *expr)
*
*/
void out_AbsLong(SLONG b)
void
out_AbsLong(SLONG b)
{
checkcodesection(sizeof(SLONG));
if (nPass == 2) {
@@ -851,8 +854,8 @@ void out_AbsLong(SLONG b)
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 @@ void out_AbsLong(SLONG b)
nPC += 4;
pPCSymbol->nValue += 4;
}
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -871,7 +873,8 @@ void out_AbsLong(SLONG b)
*
*/
void out_RelLong(struct Expression *expr)
void
out_RelLong(struct Expression * expr)
{
SLONG b;
@@ -886,8 +889,8 @@ void out_RelLong(struct Expression *expr)
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 @@ void out_RelLong(struct Expression *expr)
out_AbsLong(expr->nVal);
rpn_Reset(expr);
}
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -909,7 +911,8 @@ void out_RelLong(struct Expression *expr)
*
*/
void out_PCRelByte(struct Expression *expr)
void
out_PCRelByte(struct Expression * expr)
{
SLONG b = expr->nVal;
@@ -921,7 +924,6 @@ void out_PCRelByte(struct Expression *expr)
out_AbsByte(b);
rpn_Reset(expr);
}
/*
* RGBAsm - OUTPUT.C - Outputs an objectfile
*
@@ -929,7 +931,8 @@ void out_PCRelByte(struct Expression *expr)
*
*/
void out_BinaryFile(char *s)
void
out_BinaryFile(char *s)
{
FILE *f;
@@ -951,7 +954,6 @@ void out_BinaryFile(char *s)
while (todo--)
pCurrentSection->tData[dest++] = fgetc(f);
}
pCurrentSection->nPC += fsize;
nPC += fsize;
pPCSymbol->nValue += fsize;
@@ -960,7 +962,8 @@ void out_BinaryFile(char *s)
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 @@ void out_BinaryFileSlice(char *s, SLONG start_pos, SLONG length)
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");
}

View File

@@ -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 @@ void mergetwoexpressions(struct Expression *expr, struct Expression *src1,
expr->isReloc |= src2->isReloc;
expr->isPCRel |= src2->isPCRel;
}
#define joinexpr() mergetwoexpressions(expr,src1,src2)
/*
@@ -35,11 +35,11 @@ void mergetwoexpressions(struct Expression *expr, struct Expression *src1,
*
*/
//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 mergetwoexpressions(struct Expression *expr, struct Expression *src1,
*
*/
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 pushbyte(struct Expression *expr, int b)
*
*/
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,14 +72,14 @@ void rpn_Reset(struct Expression *expr)
*
*/
UWORD rpn_PopByte(struct Expression *expr)
UWORD
rpn_PopByte(struct Expression * expr)
{
if (expr->nRPNOut == expr->nRPNLength) {
return (0xDEAD);
} else
return (expr->tRPN[expr->nRPNOut++]);
}
/*
* RGBAsm - RPN.C - Controls RPN expressions for objectfiles
*
@@ -87,11 +87,11 @@ UWORD rpn_PopByte(struct Expression *expr)
*
*/
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_isReloc(struct Expression * expr)
*
*/
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 @@ ULONG rpn_isPCRelative(struct Expression * expr)
*
*/
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 @@ void rpn_Number(struct Expression *expr, ULONG i)
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 @@ void rpn_Symbol(struct Expression *expr, char *tzSym)
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 @@ void rpn_Bank(struct Expression *expr, char *tzSym)
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 @@ int rpn_RangeCheck(struct Expression *expr, struct Expression *src, SLONG low,
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,171 +198,193 @@ void rpn_CheckHRAM(struct Expression *expr, struct Expression *src)
#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);
}
#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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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;
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;

View File

@@ -32,7 +32,8 @@ char *newmacroargs[MAXMACROARGS + 1];
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 @@ SLONG Callback_NARG(struct sSymbol *sym)
return (i);
}
SLONG Callback__LINE__(struct sSymbol * sym)
SLONG
Callback__LINE__(struct sSymbol * sym)
{
sym = sym;
return (nLineNo);
}
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -56,14 +57,14 @@ SLONG Callback__LINE__(struct sSymbol * sym)
*
*/
SLONG getvaluefield(struct sSymbol * sym)
SLONG
getvaluefield(struct sSymbol * sym)
{
if (sym->Callback) {
return (sym->Callback(sym));
} else
return (sym->nValue);
}
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -71,7 +72,8 @@ SLONG getvaluefield(struct sSymbol * sym)
*
*/
ULONG calchash(char *s)
ULONG
calchash(char *s)
{
ULONG hash = 0;
@@ -80,7 +82,6 @@ ULONG calchash(char *s)
return (hash % HASHSIZE);
}
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -88,7 +89,8 @@ ULONG calchash(char *s)
*
*/
struct sSymbol *createsymbol(char *s)
struct sSymbol *
createsymbol(char *s)
{
struct sSymbol **ppsym;
ULONG hash;
@@ -100,7 +102,7 @@ struct sSymbol *createsymbol(char *s)
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 @@ struct sSymbol *createsymbol(char *s)
return (NULL);
}
}
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -123,7 +124,8 @@ struct sSymbol *createsymbol(char *s)
*
*/
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 @@ struct sSymbol *findsymbol(char *s, struct sSymbol *scope)
}
return (NULL);
}
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -148,7 +149,8 @@ struct sSymbol *findsymbol(char *s, struct sSymbol *scope)
*
*/
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 @@ struct sSymbol **findpsymbol(char *s, struct sSymbol *scope)
}
return (NULL);
}
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -173,7 +174,8 @@ struct sSymbol **findpsymbol(char *s, struct sSymbol *scope)
*
*/
struct sSymbol *sym_FindSymbol(char *tzName)
struct sSymbol *
sym_FindSymbol(char *tzName)
{
struct sSymbol *pscope;
@@ -184,7 +186,6 @@ struct sSymbol *sym_FindSymbol(char *tzName)
return (findsymbol(tzName, pscope));
}
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -192,7 +193,8 @@ struct sSymbol *sym_FindSymbol(char *tzName)
*
*/
void sym_Purge(char *tzName)
void
sym_Purge(char *tzName)
{
struct sSymbol **ppSym;
struct sSymbol *pscope;
@@ -219,7 +221,6 @@ void sym_Purge(char *tzName)
yyerror(temptext);
}
}
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -227,7 +228,8 @@ void sym_Purge(char *tzName)
*
*/
ULONG sym_isConstDefined(char *tzName)
ULONG
sym_isConstDefined(char *tzName)
{
struct sSymbol *psym, *pscope;
@@ -244,15 +246,16 @@ ULONG sym_isConstDefined(char *tzName)
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);
}
}
return (0);
}
ULONG sym_isDefined(char *tzName)
ULONG
sym_isDefined(char *tzName)
{
struct sSymbol *psym, *pscope;
@@ -268,7 +271,6 @@ ULONG sym_isDefined(char *tzName)
else
return (0);
}
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -276,7 +278,8 @@ ULONG sym_isDefined(char *tzName)
*
*/
ULONG sym_isConstant(char *s)
ULONG
sym_isConstant(char *s)
{
struct sSymbol *psym, *pscope;
@@ -289,10 +292,8 @@ ULONG sym_isConstant(char *s)
if (psym->nType & SYMF_CONST)
return (1);
}
return (0);
}
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -300,7 +301,8 @@ ULONG sym_isConstant(char *s)
*
*/
char *sym_GetStringValue(char *tzSym)
char *
sym_GetStringValue(char *tzSym)
{
struct sSymbol *pSym;
@@ -313,7 +315,6 @@ char *sym_GetStringValue(char *tzSym)
return (NULL);
}
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -321,7 +322,8 @@ char *sym_GetStringValue(char *tzSym)
*
*/
ULONG sym_GetConstantValue(char *s)
ULONG
sym_GetConstantValue(char *s)
{
struct sSymbol *psym, *pscope;
@@ -343,7 +345,6 @@ ULONG sym_GetConstantValue(char *s)
return (0);
}
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -351,7 +352,8 @@ ULONG sym_GetConstantValue(char *s)
*
*/
ULONG sym_GetValue(char *s)
ULONG
sym_GetValue(char *s)
{
struct sSymbol *psym, *pscope;
@@ -364,7 +366,7 @@ ULONG sym_GetValue(char *s)
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 @@ ULONG sym_GetValue(char *s)
return (0);
}
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -397,7 +398,8 @@ ULONG sym_GetValue(char *s)
*
*/
ULONG sym_GetDefinedValue(char *s)
ULONG
sym_GetDefinedValue(char *s)
{
struct sSymbol *psym, *pscope;
@@ -410,10 +412,9 @@ ULONG sym_GetDefinedValue(char *s)
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 @@ ULONG sym_GetDefinedValue(char *s)
return (0);
}
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -434,7 +434,8 @@ ULONG sym_GetDefinedValue(char *s)
*
*/
void sym_ShiftCurrentMacroArgs(void)
void
sym_ShiftCurrentMacroArgs(void)
{
SLONG i;
@@ -445,7 +446,8 @@ void sym_ShiftCurrentMacroArgs(void)
currentmacroargs[MAXMACROARGS - 1] = NULL;
}
char *sym_FindMacroArg(SLONG i)
char *
sym_FindMacroArg(SLONG i)
{
if (i == -1)
i = MAXMACROARGS + 1;
@@ -453,7 +455,8 @@ char *sym_FindMacroArg(SLONG i)
return (currentmacroargs[i - 1]);
}
void sym_UseNewMacroArgs(void)
void
sym_UseNewMacroArgs(void)
{
SLONG i;
@@ -463,7 +466,8 @@ void sym_UseNewMacroArgs(void)
}
}
void sym_SaveCurrentMacroArgs(char *save[])
void
sym_SaveCurrentMacroArgs(char *save[])
{
SLONG i;
@@ -471,7 +475,8 @@ void sym_SaveCurrentMacroArgs(char *save[])
save[i] = currentmacroargs[i];
}
void sym_RestoreCurrentMacroArgs(char *save[])
void
sym_RestoreCurrentMacroArgs(char *save[])
{
SLONG i;
@@ -479,7 +484,8 @@ void sym_RestoreCurrentMacroArgs(char *save[])
currentmacroargs[i] = save[i];
}
void sym_FreeCurrentMacroArgs(void)
void
sym_FreeCurrentMacroArgs(void)
{
SLONG i;
@@ -489,7 +495,8 @@ void sym_FreeCurrentMacroArgs(void)
}
}
void sym_AddNewMacroArg(char *s)
void
sym_AddNewMacroArg(char *s)
{
SLONG i = 0;
@@ -505,7 +512,8 @@ void sym_AddNewMacroArg(char *s)
yyerror("A maximum of 9 arguments allowed");
}
void sym_SetMacroArgID(ULONG nMacroCount)
void
sym_SetMacroArgID(ULONG nMacroCount)
{
char s[256];
@@ -513,14 +521,14 @@ void sym_SetMacroArgID(ULONG nMacroCount)
newmacroargs[MAXMACROARGS] = strdup(s);
}
void sym_UseCurrentMacroArgs(void)
void
sym_UseCurrentMacroArgs(void)
{
SLONG i;
for (i = 1; i <= MAXMACROARGS; i += 1)
sym_AddNewMacroArg(sym_FindMacroArg(i));
}
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -528,11 +536,11 @@ void sym_UseCurrentMacroArgs(void)
*
*/
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 @@ struct sSymbol *sym_FindMacro(char *s)
*
*/
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 @@ void sym_AddEqu(char *tzSym, SLONG value)
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 @@ void sym_AddEqu(char *tzSym, SLONG value)
}
}
}
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -571,7 +579,8 @@ void sym_AddEqu(char *tzSym, SLONG value)
*
*/
void sym_AddString(char *tzSym, char *tzValue)
void
sym_AddString(char *tzSym, char *tzValue)
{
struct sSymbol *nsym;
@@ -585,7 +594,7 @@ void sym_AddString(char *tzSym, char *tzValue)
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 @@ void sym_AddString(char *tzSym, char *tzValue)
nsym->pScope = NULL;
}
}
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -602,7 +610,8 @@ void sym_AddString(char *tzSym, char *tzValue)
*
*/
ULONG sym_isString(char *tzSym)
ULONG
sym_isString(char *tzSym)
{
struct sSymbol *pSym;
@@ -612,7 +621,6 @@ ULONG sym_isString(char *tzSym)
}
return (0);
}
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -620,7 +628,8 @@ ULONG sym_isString(char *tzSym)
*
*/
void sym_AddSet(char *tzSym, SLONG value)
void
sym_AddSet(char *tzSym, SLONG value)
{
struct sSymbol *nsym;
@@ -634,7 +643,6 @@ void sym_AddSet(char *tzSym, SLONG value)
nsym->pScope = NULL;
}
}
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -642,7 +650,8 @@ void sym_AddSet(char *tzSym, SLONG value)
*
*/
void sym_AddLocalReloc(char *tzSym)
void
sym_AddLocalReloc(char *tzSym)
{
if ((nPass == 1)
|| ((nPass == 2) && (sym_isDefined(tzSym) == 0))) {
@@ -653,7 +662,7 @@ void sym_AddLocalReloc(char *tzSym)
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 @@ void sym_AddLocalReloc(char *tzSym)
fatalerror("Local label in main scope");
}
}
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -678,7 +686,8 @@ void sym_AddLocalReloc(char *tzSym)
*
*/
void sym_AddReloc(char *tzSym)
void
sym_AddReloc(char *tzSym)
{
if ((nPass == 1)
|| ((nPass == 2) && (sym_isDefined(tzSym) == 0))) {
@@ -688,7 +697,7 @@ void sym_AddReloc(char *tzSym)
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 @@ void sym_AddReloc(char *tzSym)
pScope = findsymbol(tzSym, NULL);
}
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -712,7 +720,8 @@ void sym_AddReloc(char *tzSym)
*
*/
void sym_Export(char *tzSym)
void
sym_Export(char *tzSym)
{
if (nPass == 1) {
/* only export symbols in pass 1 */
@@ -735,7 +744,6 @@ void sym_Export(char *tzSym)
}
}
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -743,7 +751,8 @@ void sym_Export(char *tzSym)
*
*/
void sym_Import(char *tzSym)
void
sym_Import(char *tzSym)
{
if (nPass == 1) {
/* only import symbols in pass 1 */
@@ -753,12 +762,10 @@ void sym_Import(char *tzSym)
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_Import(char *tzSym)
*
*/
void sym_Global(char *tzSym)
void
sym_Global(char *tzSym)
{
if (nPass == 2) {
/* only globalize symbols in pass 2 */
@@ -786,7 +794,6 @@ void sym_Global(char *tzSym)
}
}
}
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -794,7 +801,8 @@ void sym_Global(char *tzSym)
*
*/
void sym_AddMacro(char *tzSym)
void
sym_AddMacro(char *tzSym)
{
if ((nPass == 1)
|| ((nPass == 2) && (sym_isDefined(tzSym) == 0))) {
@@ -804,7 +812,7 @@ void sym_AddMacro(char *tzSym)
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 @@ void sym_AddMacro(char *tzSym)
}
}
}
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -827,11 +834,11 @@ void sym_AddMacro(char *tzSym)
*
*/
void sym_PrepPass1(void)
void
sym_PrepPass1(void)
{
sym_Init();
}
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -839,7 +846,8 @@ void sym_PrepPass1(void)
*
*/
void sym_PrepPass2(void)
void
sym_PrepPass2(void)
{
SLONG i;
@@ -865,7 +873,6 @@ void sym_PrepPass2(void)
sym_AddString("__DATE__", SavedDATE);
sym_AddSet("_RS", 0);
}
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -873,7 +880,8 @@ void sym_PrepPass2(void)
*
*/
void sym_Init(void)
void
sym_Init(void)
{
SLONG i;
time_t tod;
@@ -907,13 +915,11 @@ void sym_Init(void)
sym_AddString("__TIME__", SavedTIME);
sym_AddString("__DATE__", SavedDATE);
}
pScope = NULL;
math_DefinePI();
}
/*
* RGBAsm - SYMBOL.C - Symboltable stuff
*
@@ -921,7 +927,8 @@ void sym_Init(void)
*
*/
void sym_PrintSymbolTable(void)
void
sym_PrintSymbolTable(void)
{
ULONG i;
@@ -934,8 +941,8 @@ void sym_PrintSymbolTable(void)
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 @@ void sym_PrintSymbolTable(void)
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_PrintSymbolTable(void)
*
*/
void sym_DumpMacroArgs(void)
void
sym_DumpMacroArgs(void)
{
ULONG i;