Fix STRUPR and STRLWR after 5aabb915ec

Fixes #647
This commit is contained in:
Rangi
2020-12-15 13:07:04 -05:00
committed by Eldred Habert
parent 0956d300c4
commit f31deb5010
6 changed files with 21 additions and 21 deletions

View File

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

View File

@@ -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)
{

View File

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

View File

@@ -0,0 +1,4 @@
foo equs strupr("xii")
bar equs strlwr("LOL")
printt "foo={foo} bar={bar}\n"

View File

View File

@@ -0,0 +1 @@
foo=XII bar=lol