mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
@@ -206,6 +206,7 @@ static inline void failAssertMsg(enum AssertionType type, char const *msg)
|
|||||||
%type <nConstValue> sectiontype
|
%type <nConstValue> sectiontype
|
||||||
|
|
||||||
%type <tzString> string
|
%type <tzString> string
|
||||||
|
%type <tzString> strcat_args
|
||||||
|
|
||||||
%type <nConstValue> sectorg
|
%type <nConstValue> sectorg
|
||||||
%type <sectSpec> sectattrs
|
%type <sectSpec> sectattrs
|
||||||
@@ -1066,38 +1067,38 @@ const : relocexpr {
|
|||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
string : T_STRING {
|
string : T_STRING
|
||||||
if (snprintf($$, MAXSTRLEN + 1, "%s", $1) > MAXSTRLEN)
|
|
||||||
warning(WARNING_LONG_STR, "String is too long '%s'\n", $1);
|
|
||||||
}
|
|
||||||
| T_OP_STRSUB T_LPAREN string T_COMMA uconst T_COMMA uconst T_RPAREN {
|
| T_OP_STRSUB T_LPAREN string T_COMMA uconst T_COMMA uconst T_RPAREN {
|
||||||
strsubUTF8($$, $3, $5, $7);
|
strsubUTF8($$, $3, $5, $7);
|
||||||
}
|
}
|
||||||
| T_OP_STRCAT T_LPAREN string T_COMMA string T_RPAREN {
|
| T_OP_STRCAT T_LPAREN T_RPAREN {
|
||||||
if (snprintf($$, MAXSTRLEN + 1, "%s%s", $3, $5) > MAXSTRLEN)
|
$$[0] = '\0';
|
||||||
warning(WARNING_LONG_STR, "STRCAT: String too long '%s%s'\n",
|
}
|
||||||
$3, $5);
|
| T_OP_STRCAT T_LPAREN strcat_args T_RPAREN {
|
||||||
|
strcpy($$, $3);
|
||||||
}
|
}
|
||||||
| T_OP_STRUPR T_LPAREN string T_RPAREN {
|
| T_OP_STRUPR T_LPAREN string T_RPAREN {
|
||||||
if (snprintf($$, MAXSTRLEN + 1, "%s", $3) > MAXSTRLEN)
|
|
||||||
warning(WARNING_LONG_STR, "STRUPR: String too long '%s'\n", $3);
|
|
||||||
|
|
||||||
upperstring($$);
|
upperstring($$);
|
||||||
}
|
}
|
||||||
| T_OP_STRLWR T_LPAREN string T_RPAREN {
|
| T_OP_STRLWR T_LPAREN string T_RPAREN {
|
||||||
if (snprintf($$, MAXSTRLEN + 1, "%s", $3) > MAXSTRLEN)
|
|
||||||
warning(WARNING_LONG_STR, "STRUPR: String too long '%s'\n", $3);
|
|
||||||
|
|
||||||
lowerstring($$);
|
lowerstring($$);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
strcat_args : string
|
||||||
|
| strcat_args T_COMMA string {
|
||||||
|
if (snprintf($$, MAXSTRLEN + 1, "%s%s", $1, $3) > MAXSTRLEN)
|
||||||
|
warning(WARNING_LONG_STR, "STRCAT: String too long '%s%s'\n",
|
||||||
|
$1, $3);
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
section : T_POP_SECTION sectmod string T_COMMA sectiontype sectorg sectattrs {
|
section : T_POP_SECTION sectmod string T_COMMA sectiontype sectorg sectattrs {
|
||||||
out_NewSection($3, $5, $6, &$7, $2);
|
out_NewSection($3, $5, $6, &$7, $2);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
sectmod : /* empty */ { $$ = SECTION_NORMAL; }
|
sectmod : /* empty */ { $$ = SECTION_NORMAL; }
|
||||||
| T_POP_UNION { $$ = SECTION_UNION; }
|
| T_POP_UNION { $$ = SECTION_UNION; }
|
||||||
| T_POP_FRAGMENT{ $$ = SECTION_FRAGMENT; }
|
| T_POP_FRAGMENT{ $$ = SECTION_FRAGMENT; }
|
||||||
;
|
;
|
||||||
|
|||||||
9
test/asm/strcat.asm
Normal file
9
test/asm/strcat.asm
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
print: MACRO
|
||||||
|
PRINTT \1
|
||||||
|
PRINTT "\n"
|
||||||
|
ENDM
|
||||||
|
|
||||||
|
print STRCAT()
|
||||||
|
print STRCAT("Durrr")
|
||||||
|
print STRCAT("Left"\, "right")
|
||||||
|
print STRCAT("Whoa"\, "\, "\, "baby!")
|
||||||
0
test/asm/strcat.err
Normal file
0
test/asm/strcat.err
Normal file
4
test/asm/strcat.out
Normal file
4
test/asm/strcat.out
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
Durrr
|
||||||
|
Leftright
|
||||||
|
Whoa, baby!
|
||||||
Reference in New Issue
Block a user