File: m_36_jis.c

package info (click to toggle)
mcpp 2.7.1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 8,024 kB
  • ctags: 29,151
  • sloc: ansic: 35,191; sh: 9,231; makefile: 176; cpp: 84; exp: 18
file content (33 lines) | stat: -rw-r--r-- 1,042 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* m_36_jis.c:  Handling of '\\' in ISO-2022-JP multi--byte character.  */

#include    "defs.h"

#define     str( a)     # a

main( void)
{
    fputs( "started\n", stdout);

/* 36.1:    0x5c in multi-byte character is not an escape character */

#pragma __setlocale( "jis")                 /* For MCPP     */
#pragma setlocale( "jis")                   /* For MCPP on VC   */

#if     '字' == '\x3b\x7a' && '移' != '\x30\x5c'
    fputs( "Bad handling of '\\' in multi-byte character", stdout);
    exit( 1);
#endif

/* 36.2:    # operater should not insert '\\' before 0x5c, 0x22 or 0x27
        in multi-byte character */
    assert( strcmp( str( "移動"), "\"移動\"") == 0);
    assert( strcmp( str( "右3柑陽"), "\"右3柑陽\"") == 0);
    assert( strcmp( str( "右3校宙"), "\"右3校宙\"") == 0);

    fputs( "移動" "\"移動\"\n", stdout);
    fputs( "右3柑陽" "\"右3柑陽\"\n", stdout);
    fputs( "右3校宙" "\"右3校宙\"\n", stdout);
    fputs( "success\n", stdout);
    return  0;
}