mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
@@ -43,9 +43,6 @@ void opt_Push(void);
|
||||
void opt_Pop(void);
|
||||
void opt_Parse(char *s);
|
||||
|
||||
void upperstring(char *s);
|
||||
void lowerstring(char *s);
|
||||
|
||||
/* TODO: are these really needed? */
|
||||
#define YY_FATAL_ERROR fatalerror
|
||||
|
||||
|
||||
@@ -197,22 +197,6 @@ static void opt_ParseDefines(void)
|
||||
sym_AddString(cldefines[i], cldefines[i + 1]);
|
||||
}
|
||||
|
||||
void upperstring(char *s)
|
||||
{
|
||||
while (*s) {
|
||||
*s = toupper(*s);
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
||||
void lowerstring(char *s)
|
||||
{
|
||||
while (*s) {
|
||||
*s = tolower(*s);
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Escapes Make-special chars from a string */
|
||||
static char *make_escape(const char *str)
|
||||
{
|
||||
|
||||
@@ -39,6 +39,20 @@ uint32_t nListCountEmpty;
|
||||
int32_t nPCOffset;
|
||||
bool executeElseBlock; /* If this is set, ELIFs cannot be executed anymore */
|
||||
|
||||
static void upperstring(char *dest, char const *src)
|
||||
{
|
||||
while (*src)
|
||||
*dest++ = toupper(*src++);
|
||||
*dest = '\0';
|
||||
}
|
||||
|
||||
static void lowerstring(char *dest, char const *src)
|
||||
{
|
||||
while (*src)
|
||||
*dest++ = tolower(*src++);
|
||||
*dest = '\0';
|
||||
}
|
||||
|
||||
static uint32_t str2int2(uint8_t *s, int32_t length)
|
||||
{
|
||||
int32_t i;
|
||||
@@ -1084,10 +1098,10 @@ string : T_STRING
|
||||
strcpy($$, $3);
|
||||
}
|
||||
| T_OP_STRUPR T_LPAREN string T_RPAREN {
|
||||
upperstring($$);
|
||||
upperstring($$, $3);
|
||||
}
|
||||
| T_OP_STRLWR T_LPAREN string T_RPAREN {
|
||||
lowerstring($$);
|
||||
lowerstring($$, $3);
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
4
test/asm/strupr-strlwr.asm
Normal file
4
test/asm/strupr-strlwr.asm
Normal file
@@ -0,0 +1,4 @@
|
||||
foo equs strupr("xii")
|
||||
bar equs strlwr("LOL")
|
||||
|
||||
printt "foo={foo} bar={bar}\n"
|
||||
0
test/asm/strupr-strlwr.err
Normal file
0
test/asm/strupr-strlwr.err
Normal file
1
test/asm/strupr-strlwr.out
Normal file
1
test/asm/strupr-strlwr.out
Normal file
@@ -0,0 +1 @@
|
||||
foo=XII bar=lol
|
||||
Reference in New Issue
Block a user