shithub: rgbds

Download patch

ref: 1d174f37da1407b7fbcbe46f48cf2697181c39ec
parent: 2777044f705ffc2d36ed87f12624510cec113b95
author: Anthony J. Bentley <[email protected]>
date: Wed Jan 7 18:52:22 EST 2015

rgbasm: Convert oDontExpandStrings to bool.

--- a/include/asm/asm.h
+++ b/include/asm/asm.h
@@ -9,8 +9,9 @@
 #ifndef ASMOTOR_ASM_ASM_H
 #define ASMOTOR_ASM_ASM_H
 
-#include <stdlib.h>
+#include <stdbool.h>
 #include <stdio.h>
+#include <stdlib.h>
 
 #include "asm/types.h"
 #include "asm/symbol.h"
@@ -26,7 +27,7 @@
 extern struct Section *pCurrentSection;
 extern struct sSymbol *tHashedSymbols[HASHSIZE];
 extern struct sSymbol *pPCSymbol;
-extern UBYTE oDontExpandStrings;
+extern bool oDontExpandStrings;
 
 #define MAXMACROARGS	9
 #define MAXINCPATHS		16
--- a/src/asm/asmy.y
+++ b/src/asm/asmy.y
@@ -706,11 +706,11 @@
 
 purge			:	T_POP_PURGE
 					{
-						oDontExpandStrings=1;
+						oDontExpandStrings = true;
 					}
 					purge_list
 					{
-						oDontExpandStrings=0;
+						oDontExpandStrings = false;
 					}
 ;
 
@@ -952,8 +952,8 @@
 						{ rpn_UNNOT(&$$,&$2); }
 				|	T_OP_BANK '(' T_ID ')'
 						{ rpn_Bank(&$$,$3); $$.nVal = 0; }
-				|	T_OP_DEF { oDontExpandStrings=1; } '(' T_ID ')'
-						{ rpn_Number(&$$,sym_isConstDefined($4)); oDontExpandStrings=0; }
+				|	T_OP_DEF { oDontExpandStrings = true; } '(' T_ID ')'
+						{ rpn_Number(&$$,sym_isConstDefined($4)); oDontExpandStrings = false; }
 				|	T_OP_ROUND '(' const ')'			{ rpn_Number(&$$,math_Round($3)); }
 				|	T_OP_CEIL '(' const ')'			{ rpn_Number(&$$,math_Ceil($3)); }
 				|	T_OP_FLOOR '(' const ')'			{ rpn_Number(&$$,math_Floor($3)); }
@@ -1022,7 +1022,7 @@
 				|	T_OP_ACOS '(' const ')'			{ $$ = math_ACos($3); }
 				|	T_OP_ATAN '(' const ')'			{ $$ = math_ATan($3); }
 				|	T_OP_ATAN2 '(' const ',' const ')'	{ $$ = math_ATan2($3,$5); }
-				|	T_OP_DEF { oDontExpandStrings=1; } '(' T_ID ')'	{ $$ = sym_isConstDefined($4); oDontExpandStrings=0; }
+				|	T_OP_DEF { oDontExpandStrings = true; } '(' T_ID ')'	{ $$ = sym_isConstDefined($4); oDontExpandStrings = false; }
 				|	T_OP_STRCMP '(' string ',' string ')'	{ $$ = strcmp( $3, $5 ); }
 				|	T_OP_STRIN '(' string ',' string ')'
 					{
--- a/src/asm/globlex.c
+++ b/src/asm/globlex.c
@@ -7,12 +7,13 @@
 
 #include "asmy.h"
 
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
 #include <string.h>
 
-UBYTE oDontExpandStrings = 0;
+bool oDontExpandStrings = false;
 SLONG nGBGfxID = -1;
 SLONG nBinaryID = -1;
 
@@ -184,7 +185,7 @@
 
 	dest[copied] = 0;
 
-	if (oDontExpandStrings == 0 && sym_isString(dest)) {
+	if (!oDontExpandStrings && sym_isString(dest)) {
 		char *s;
 
 		yyskipbytes(size_backup);