PageRenderTime 142ms CodeModel.GetById 81ms app.highlight 0ms RepoModel.GetById 40ms app.codeStats 0ms

/Modules/cjkcodecs/alg_jisx0201.h

http://unladen-swallow.googlecode.com/
C++ Header | 24 lines | 23 code | 1 blank | 0 comment | 29 complexity | a777541cfb0972e765753f0be0de61ca MD5 | raw file
 1#define JISX0201_R_ENCODE(c, assi)			\
 2	if ((c) < 0x80 && (c) != 0x5c && (c) != 0x7e)	\
 3		(assi) = (c);				\
 4	else if ((c) == 0x00a5) (assi) = 0x5c;		\
 5	else if ((c) == 0x203e) (assi) = 0x7e;
 6#define JISX0201_K_ENCODE(c, assi)			\
 7	if ((c) >= 0xff61 && (c) <= 0xff9f)		\
 8		(assi) = (c) - 0xfec0;
 9#define JISX0201_ENCODE(c, assi)			\
10	JISX0201_R_ENCODE(c, assi)			\
11	else JISX0201_K_ENCODE(c, assi)
12
13#define JISX0201_R_DECODE(c, assi)			\
14	if ((c) < 0x5c) (assi) = (c);			\
15	else if ((c) == 0x5c) (assi) = 0x00a5;		\
16	else if ((c) < 0x7e) (assi) = (c);		\
17	else if ((c) == 0x7e) (assi) = 0x203e;		\
18	else if ((c) == 0x7f) (assi) = 0x7f;
19#define JISX0201_K_DECODE(c, assi)			\
20	if ((c) >= 0xa1 && (c) <= 0xdf)			\
21	(assi) = 0xfec0 + (c);
22#define JISX0201_DECODE(c, assi)			\
23	JISX0201_R_DECODE(c, assi)			\
24	else JISX0201_K_DECODE(c, assi)