Fixed warnings and some style issues

Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
This commit is contained in:
Vegard Nossum
2009-06-11 08:51:55 +02:00
parent b6c749ffbd
commit 3c82b1ae03
12 changed files with 569 additions and 589 deletions

View File

@@ -4,85 +4,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,
/* 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,
// "c" , T_MODE_C
{ "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

@@ -223,116 +223,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,
"endm", T_POP_ENDM, // Not needed but we have it here just to protect the name
"shift", T_POP_SHIFT,
{ "macro", T_POP_MACRO },
"rept", T_POP_REPT,
"endr", T_POP_ENDR, // Not needed but we have it here just to protect the name
/* Not needed but we have it here just to protect the name */
{ "endm", T_POP_ENDM },
{ "shift", T_POP_SHIFT },
"if", T_POP_IF,
"else", T_POP_ELSE,
"endc", T_POP_ENDC,
{ "rept", T_POP_REPT },
/* Not needed but we have it here just to protect the name */
{ "endr", T_POP_ENDR },
"bss", T_SECT_BSS,
{ "if", T_POP_IF },
{ "else", T_POP_ELSE },
{ "endc", T_POP_ENDC },
{ "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 = {

View File

@@ -354,14 +354,14 @@ ULONG yylex(void)
s = pLexBuffer;
nOldFloatMask = nFloatLen = 0;
nFloatMask = tFloatingFirstChar[*s++];
nFloatMask = tFloatingFirstChar[(int) *s++];
while (nFloatMask && nFloatLen < nLexBufferLeng) {
nFloatLen += 1;
nOldFloatMask = nFloatMask;
if (nFloatLen == 1)
nFloatMask &= tFloatingSecondChar[*s++];
nFloatMask &= tFloatingSecondChar[(int) *s++];
else
nFloatMask &= tFloatingChars[*s++];
nFloatMask &= tFloatingChars[(int) *s++];
}
maxlen = nLexBufferLeng;