2014-09-24 14:45:10 +00:00
|
|
|
/*
|
|
|
|
!!DESCRIPTION!! check if character constants are translated correctly
|
|
|
|
!!ORIGIN!! cc65 bug report
|
|
|
|
!!LICENCE!! Public Domain
|
|
|
|
*/
|
|
|
|
|
2014-11-22 17:28:05 +00:00
|
|
|
#include "common.h"
|
2014-09-24 14:45:10 +00:00
|
|
|
#include <limits.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
|
|
|
|
void backslash(unsigned char c)
|
|
|
|
{
|
|
|
|
printf("%c : ",c);
|
|
|
|
|
|
|
|
switch (c)
|
|
|
|
{
|
2019-02-12 21:50:49 +00:00
|
|
|
case 'b':
|
|
|
|
c = '\b';
|
|
|
|
case 'f':
|
|
|
|
c = '\f';
|
|
|
|
case 'n':
|
|
|
|
c = '\n';
|
|
|
|
case 'r':
|
|
|
|
c = '\r';
|
|
|
|
case 't':
|
|
|
|
c = '\t';
|
|
|
|
case 'v':
|
2014-09-24 14:45:10 +00:00
|
|
|
#ifndef NO_BACKSLASH_V
|
|
|
|
c = '\v';
|
|
|
|
#else
|
|
|
|
c = 0x0b;
|
|
|
|
#endif
|
2019-02-12 21:50:49 +00:00
|
|
|
}
|
2014-09-24 14:45:10 +00:00
|
|
|
|
|
|
|
if(!isprint(c))
|
|
|
|
{
|
|
|
|
printf("ok.\n");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
printf("failed.\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void testbackslash(void)
|
|
|
|
{
|
|
|
|
backslash('b');
|
|
|
|
backslash('f');
|
|
|
|
backslash('n');
|
|
|
|
backslash('r');
|
|
|
|
backslash('t');
|
|
|
|
backslash('v');
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
2019-02-12 21:50:49 +00:00
|
|
|
testbackslash();
|
2014-09-24 14:45:10 +00:00
|
|
|
|
2019-02-12 21:50:49 +00:00
|
|
|
return 0;
|
2014-09-24 14:45:10 +00:00
|
|
|
}
|