mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
Added support for escape characters of the form \### where ### is the
decimal value of the desired character.
This commit is contained in:
parent
d605394a8d
commit
99e18513f0
1 changed files with 13 additions and 1 deletions
|
@ -263,7 +263,19 @@ GIB_Process_Escapes (dstring_t *token)
|
||||||
for (i = 0; token->str[i]; i++) {
|
for (i = 0; token->str[i]; i++) {
|
||||||
if (token->str[i] == '\\') {
|
if (token->str[i] == '\\') {
|
||||||
dstring_snip (token, i, 1); // Get rid of slash
|
dstring_snip (token, i, 1); // Get rid of slash
|
||||||
switch (token->str[i]) {
|
if (strlen(token->str+i) > 2 &&
|
||||||
|
isdigit ((byte) token->str[i]) &&
|
||||||
|
isdigit ((byte) token->str[i+1]) &&
|
||||||
|
isdigit ((byte) token->str[i+2])) {
|
||||||
|
unsigned int num;
|
||||||
|
num = 100 * (token->str[i] - '0') + 10 * (token->str[i+1] - '0') + (token->str[i+2] - '0');
|
||||||
|
if (num > 255)
|
||||||
|
dstring_snip (token, i, 3);
|
||||||
|
else {
|
||||||
|
dstring_snip (token, i, 2);
|
||||||
|
token->str[i] = (char) num;
|
||||||
|
}
|
||||||
|
} else switch (token->str[i]) {
|
||||||
case 'n':
|
case 'n':
|
||||||
token->str[i] = '\n';
|
token->str[i] = '\n';
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue