| 1 |
|
| |
| 2 |
|
| /* $Id: sjis_doti.c 4654 2006-07-03 01:33:16Z hio $ */ |
| 3 |
|
| |
| 4 |
|
| #include "Japanese.h" |
| 5 |
|
| #include <stdio.h> |
| 6 |
|
| |
| 7 |
|
| #ifndef __cplusplus |
| 8 |
|
| #undef bool |
| 9 |
|
| #undef true |
| 10 |
|
| #undef false |
| 11 |
|
| typedef enum bool { false, true, } bool; |
| 12 |
|
| #endif |
| 13 |
|
| |
| 14 |
|
| #define DISP_U2S 0 |
| 15 |
|
| #define DISP_S2U 0 |
| 16 |
|
| |
| 17 |
|
| #if DISP_U2S |
| 18 |
|
| #define ECHO_U2S(arg) fprintf arg |
| 19 |
|
| #define ON_U2S(cmd) cmd |
| 20 |
|
| #else |
| 21 |
|
| #define ECHO_U2S(arg) |
| 22 |
|
| #define ON_U2S(cmd) |
| 23 |
|
| #endif |
| 24 |
|
| #if DISP_S2U |
| 25 |
|
| #define ECHO_S2U(arg) fprintf arg |
| 26 |
|
| #define ON_S2U(cmd) cmd |
| 27 |
|
| #else |
| 28 |
|
| #define ECHO_S2U(arg) |
| 29 |
|
| #define ON_S2U(cmd) |
| 30 |
|
| #endif |
| 31 |
|
| |
| 32 |
|
| /* ---------------------------------------------------------------------------- |
| 33 |
|
| * SV* sv_utf8 = xs_sjis_doti_utf8(SV* sv_sjis) |
| 34 |
|
| * convert sjis(doti) into utf8. |
| 35 |
|
| * ------------------------------------------------------------------------- */ |
| 36 |
|
| EXTERN_C |
| 37 |
|
| SV* |
| 38 |
8 |
| xs_sjis_doti_utf8(SV* sv_str) |
| 39 |
|
| { |
| 40 |
|
| STRLEN src_len; |
| 41 |
|
| UJ_UINT8* src; |
| 42 |
|
| int len; |
| 43 |
|
| |
| 44 |
|
| SV_Buf result; |
| 45 |
|
| const UJ_UINT8* src_end; |
| 46 |
|
| |
| 47 |
8 |
▶ | if( sv_str==&PL_sv_undef ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( sv_str==&PL_sv_undef ) |
0 |
8 |
8 |
|
| 48 |
|
| { |
| 49 |
0 |
| return newSVsv(&PL_sv_undef); |
| 50 |
|
| } |
| 51 |
|
| |
| 52 |
8 |
| src = (UJ_UINT8*)SvPV(sv_str,src_len); |
| 53 |
8 |
| len = sv_len(sv_str); |
| 54 |
|
| #if DISP_S2U |
| 55 |
|
| fprintf(stderr,"Unicode::Japanese::(xs)sjis_utf8_doti\n",len); |
| 56 |
|
| bin_dump("in ",src,len); |
| 57 |
|
| #endif |
| 58 |
8 |
▶ | SV_Buf_init(&result,len*3/2+4); |
Branch: 2 branches
| Branch | True | False | Total |
| SV_Buf_init(&result,len*3/2+4); |
8 |
0 |
8 |
| SV_Buf_init(&result,len*3/2+4); |
0 |
8 |
8 |
|
| 59 |
8 |
| src_end = src+len; |
| 60 |
|
| |
| 61 |
17 |
▶ | while( src<src_end ) |
Branch: 1 branch
| Branch | True | False | Total |
| while( src<src_end ) |
9 |
8 |
17 |
|
| 62 |
|
| { |
| 63 |
|
| const UJ_UINT8* ptr; |
| 64 |
9 |
▶ | if( src[0]<0x80 ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( src[0]<0x80 ) |
0 |
9 |
9 |
|
| 65 |
|
| { /* ASCII */ |
| 66 |
|
| ECHO_U2S((stderr,"ascii: %02x\n",src[0])); |
| 67 |
0 |
▶ | if( src[0]=='&' && src+3<src_end && src[1]=='#' ) |
Branch: 3 branches
| Branch | True | False | Total |
| if( src[0]=='&' && src+3<src_end && src[1]=='#' ) |
0 |
0 |
0 |
| if( src[0]=='&' && src+3<src_end && src[1]=='#' ) |
0 |
0 |
0 |
| if( src[0]=='&' && src+3<src_end && src[1]=='#' ) |
0 |
0 |
0 |
|
| 68 |
|
| { /* check "&#ddddd;" */ |
| 69 |
0 |
| int num = 0; |
| 70 |
0 |
| UJ_UINT8* ptr = src+2; |
| 71 |
0 |
| const UJ_UINT8* ptr_end = ptr+8<src_end ? ptr+8 : src_end; |
| 72 |
0 |
▶ | for( ; ptr<ptr_end; ++ptr ) |
Branch: 1 branch
| Branch | True | False | Total |
| for( ; ptr<ptr_end; ++ptr ) |
0 |
0 |
0 |
|
| 73 |
|
| { |
| 74 |
0 |
▶ | if( *ptr==';' ) break; |
Branch: 1 branch
| Branch | True | False | Total |
| if( *ptr==';' ) break; |
0 |
0 |
0 |
|
| 75 |
0 |
▶ | if( *ptr<'0' || '9'<*ptr ) break; |
Branch: 2 branches
| Branch | True | False | Total |
| if( *ptr<'0' || '9'<*ptr ) break; |
0 |
0 |
0 |
| if( *ptr<'0' || '9'<*ptr ) break; |
0 |
0 |
0 |
|
| 76 |
0 |
| num = num*10 + *ptr-'0'; |
| 77 |
|
| } |
| 78 |
0 |
▶ | if( ptr<ptr_end && *ptr==';' && 0xf800<=num && num<=0xf9ff ) |
Branch: 4 branches
| Branch | True | False | Total |
| if( ptr<ptr_end && *ptr==';' && 0xf800<=num && num<=0xf9ff ) |
0 |
0 |
0 |
| if( ptr<ptr_end && *ptr==';' && 0xf800<=num && num<=0xf9ff ) |
0 |
0 |
0 |
| if( ptr<ptr_end && *ptr==';' && 0xf800<=num && num<=0xf9ff ) |
0 |
0 |
0 |
| if( ptr<ptr_end && *ptr==';' && 0xf800<=num && num<=0xf9ff ) |
0 |
0 |
0 |
|
| 79 |
|
| { /* yes, this is "&#ddddd;" */ |
| 80 |
0 |
| const UJ_UINT32* emoji = &g_ed2u_table[num-0xf000]; |
| 81 |
0 |
▶ | if( ((UJ_UINT8*)emoji)[3] ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( ((UJ_UINT8*)emoji)[3] ) |
0 |
0 |
0 |
|
| 82 |
|
| { |
| 83 |
|
| /*fprintf(stderr,"utf8-len: [%d]\n",4); */ |
| 84 |
0 |
▶ | SV_Buf_append_ch4(&result,*emoji); |
Branch: 3 branches
| Branch | True | False | Total |
| SV_Buf_append_ch4(&result,*emoji); |
0 |
0 |
0 |
| SV_Buf_append_ch4(&result,*emoji); |
0 |
0 |
0 |
| SV_Buf_append_ch4(&result,*emoji); |
0 |
0 |
0 |
|
| 85 |
0 |
| src = ptr+1; |
| 86 |
0 |
| continue; |
| 87 |
|
| } |
| 88 |
|
| } |
| 89 |
|
| } |
| 90 |
0 |
▶ | SV_Buf_append_ch(&result,*src); |
Branch: 3 branches
| Branch | True | False | Total |
| SV_Buf_append_ch(&result,*src); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,*src); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,*src); |
0 |
0 |
0 |
|
| 91 |
0 |
| ++src; |
| 92 |
0 |
| continue; |
| 93 |
9 |
▶ | }else if( 0xa1<=src[0] && src[0]<=0xdf ) |
Branch: 2 branches
| Branch | True | False | Total |
| }else if( 0xa1<=src[0] && src[0]<=0xdf ) |
8 |
1 |
9 |
| }else if( 0xa1<=src[0] && src[0]<=0xdf ) |
0 |
8 |
8 |
|
| 94 |
|
| { /* half-width katakana (ja:Ⱦ³Ñ¥«¥Ê) */ |
| 95 |
|
| ECHO_U2S((stderr,"kana: %02x\n",src[0])); |
| 96 |
0 |
| ptr = (UJ_UINT8*)&g_s2u_table[(src[0]-0xa1)*3]; |
| 97 |
0 |
| ++src; |
| 98 |
9 |
▶ | }else if( src+1<src_end && 0x81<=src[0] && src[0]<=0x9f ) |
Branch: 3 branches
| Branch | True | False | Total |
| }else if( src+1<src_end && 0x81<=src[0] && src[0]<=0x9f ) |
9 |
0 |
9 |
| }else if( src+1<src_end && 0x81<=src[0] && src[0]<=0x9f ) |
9 |
0 |
9 |
| }else if( src+1<src_end && 0x81<=src[0] && src[0]<=0x9f ) |
1 |
8 |
9 |
|
| 99 |
1 |
| { /* a double-byte letter (ja:2¥Ð¥¤¥Èʸ»ú) */ |
| 100 |
1 |
| const UJ_UINT16 sjis = (src[0]<<8)+src[1]; /* ntohs */ |
| 101 |
|
| ECHO_U2S((stderr,"sjis.dbcs#1: %04x\n",sjis)); |
| 102 |
1 |
| ptr = (UJ_UINT8*)&g_s2u_table[(sjis - 0x8100 + 0x3f)*3]; |
| 103 |
1 |
| src += 2; |
| 104 |
8 |
▶ | }else if( src+1<src_end && ( 0xf0<=src[0] && src[0]<=0xf4 ) ) |
Branch: 3 branches
| Branch | True | False | Total |
| }else if( src+1<src_end && ( 0xf0<=src[0] && src[0]<=0xf4 ) ) |
8 |
0 |
8 |
| }else if( src+1<src_end && ( 0xf0<=src[0] && src[0]<=0xf4 ) ) |
8 |
0 |
8 |
| }else if( src+1<src_end && ( 0xf0<=src[0] && src[0]<=0xf4 ) ) |
8 |
0 |
8 |
|
| 105 |
0 |
| { /* dot-i emoji */ |
| 106 |
|
| const UJ_UINT32* ptr32; |
| 107 |
|
| ECHO_S2U((stderr,"code: %02x %02x\n", src[0],src[1])); |
| 108 |
8 |
| ptr32 = &g_ed2u_table[((src[0]&0x07)<<8)|src[1]]; |
| 109 |
8 |
▶ | if( *ptr32!=0 ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( *ptr32!=0 ) |
8 |
0 |
8 |
|
| 110 |
|
| { |
| 111 |
8 |
▶ | SV_Buf_append_ch4(&result,*ptr32); |
Branch: 3 branches
| Branch | True | False | Total |
| SV_Buf_append_ch4(&result,*ptr32); |
0 |
8 |
8 |
| SV_Buf_append_ch4(&result,*ptr32); |
0 |
0 |
0 |
| SV_Buf_append_ch4(&result,*ptr32); |
0 |
0 |
0 |
|
| 112 |
8 |
| src += 2; |
| 113 |
8 |
| continue; |
| 114 |
|
| }else |
| 115 |
|
| { |
| 116 |
0 |
| const UJ_UINT16 sjis = (src[0]<<8)+src[1]; /* ntohs */ |
| 117 |
|
| ECHO_U2S((stderr,"sjis.dbcs#2: %04x\n",sjis)); |
| 118 |
0 |
| ptr = (UJ_UINT8*)&g_s2u_table[(sjis- 0xe000 + 0x1f3f)*3]; |
| 119 |
0 |
| src += 2; |
| 120 |
|
| } |
| 121 |
0 |
▶ | }else if( src+1<src_end && 0xe0<=src[0] && src[0]<=0xfc ) |
Branch: 3 branches
| Branch | True | False | Total |
| }else if( src+1<src_end && 0xe0<=src[0] && src[0]<=0xfc ) |
0 |
0 |
0 |
| }else if( src+1<src_end && 0xe0<=src[0] && src[0]<=0xfc ) |
0 |
0 |
0 |
| }else if( src+1<src_end && 0xe0<=src[0] && src[0]<=0xfc ) |
0 |
0 |
0 |
|
| 122 |
0 |
| { /* a double-byte letter (ja:2¥Ð¥¤¥Èʸ»ú) */ |
| 123 |
0 |
| const UJ_UINT16 sjis = (src[0]<<8)+src[1]; /* ntohs */ |
| 124 |
|
| ECHO_U2S((stderr,"sjis.dbcs#2: %04x\n",sjis)); |
| 125 |
0 |
| ptr = (UJ_UINT8*)&g_s2u_table[(sjis- 0xe000 + 0x1f3f)*3]; |
| 126 |
0 |
| src += 2; |
| 127 |
|
| }else |
| 128 |
|
| { /* unknown */ |
| 129 |
|
| /*fprintf(stderr,"unknown: %02x\n",src[0]); */ |
| 130 |
0 |
▶ | SV_Buf_append_ch(&result,'?'); |
Branch: 3 branches
| Branch | True | False | Total |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
|
| 131 |
0 |
| ++src; |
| 132 |
0 |
| continue; |
| 133 |
|
| } |
| 134 |
|
| |
| 135 |
|
| ECHO_U2S((stderr,"offset: 0x%04x\n",ptr-g_s2u_table)); |
| 136 |
|
| ECHO_U2S((stderr,"utf8-char : %02x %02x %02x\n",ptr[0],ptr[1],ptr[2])); |
| 137 |
1 |
▶ | if( ptr[2] ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( ptr[2] ) |
1 |
0 |
1 |
|
| 138 |
|
| { |
| 139 |
|
| /*fprintf(stderr,"utf8-len: [%d]\n",3); */ |
| 140 |
1 |
▶ | SV_Buf_append_mem(&result, ptr, 3); |
Branch: 3 branches
| Branch | True | False | Total |
| SV_Buf_append_mem(&result, ptr, 3); |
0 |
1 |
1 |
| SV_Buf_append_mem(&result, ptr, 3); |
0 |
0 |
0 |
| SV_Buf_append_mem(&result, ptr, 3); |
0 |
0 |
0 |
|
| 141 |
0 |
▶ | }else if( ptr[1] ) |
Branch: 1 branch
| Branch | True | False | Total |
| }else if( ptr[1] ) |
0 |
0 |
0 |
|
| 142 |
|
| { |
| 143 |
|
| /*fprintf(stderr,"utf8-len: [%d]\n",2); */ |
| 144 |
0 |
▶ | SV_Buf_append_mem(&result, ptr, 2); |
Branch: 3 branches
| Branch | True | False | Total |
| SV_Buf_append_mem(&result, ptr, 2); |
0 |
0 |
0 |
| SV_Buf_append_mem(&result, ptr, 2); |
0 |
0 |
0 |
| SV_Buf_append_mem(&result, ptr, 2); |
0 |
0 |
0 |
|
| 145 |
0 |
▶ | }else if( ptr[0] ) |
Branch: 1 branch
| Branch | True | False | Total |
| }else if( ptr[0] ) |
0 |
0 |
0 |
|
| 146 |
|
| { |
| 147 |
|
| /*fprintf(stderr,"utf8-len: [%d]\n",1); */ |
| 148 |
0 |
▶ | SV_Buf_append_ch(&result,*ptr); |
Branch: 3 branches
| Branch | True | False | Total |
| SV_Buf_append_ch(&result,*ptr); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,*ptr); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,*ptr); |
0 |
0 |
0 |
|
| 149 |
|
| }else |
| 150 |
|
| { |
| 151 |
0 |
▶ | SV_Buf_append_ch(&result,'?'); |
Branch: 3 branches
| Branch | True | False | Total |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
|
| 152 |
|
| } |
| 153 |
|
| } |
| 154 |
|
| #if DISP_S2U |
| 155 |
|
| ON_S2U( bin_dump("out",SV_Buf_getBegin(&result),SV_Buf_getLength(&result)) ); |
| 156 |
|
| #endif |
| 157 |
8 |
| SV_Buf_setLength(&result); |
| 158 |
|
| |
| 159 |
8 |
| return SV_Buf_getSv(&result); |
| 160 |
|
| } |
| 161 |
|
| |
| 162 |
|
| /* --------------------------------------------------------------------------- |
| 163 |
|
| * utf8 ==> doti |
| 164 |
|
| * ------------------------------------------------------------------------- */ |
| 165 |
|
| EXTERN_C |
| 166 |
|
| SV* |
| 167 |
30 |
| xs_utf8_sjis_doti(SV* sv_str) |
| 168 |
|
| { |
| 169 |
|
| UJ_UINT8* src; |
| 170 |
|
| int len; |
| 171 |
|
| SV_Buf result; |
| 172 |
|
| const UJ_UINT8* src_end; |
| 173 |
|
| |
| 174 |
30 |
▶ | if( sv_str==&PL_sv_undef ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( sv_str==&PL_sv_undef ) |
0 |
30 |
30 |
|
| 175 |
|
| { |
| 176 |
0 |
| return newSVsv(&PL_sv_undef); |
| 177 |
|
| } |
| 178 |
30 |
| src = (UJ_UINT8*)SvPV(sv_str,PL_na); |
| 179 |
30 |
| len = sv_len(sv_str); |
| 180 |
|
| |
| 181 |
|
| ECHO_U2S((stderr,"Unicode::Japanese::(xs)utf8_sjis_doti\n")); |
| 182 |
|
| ON_U2S( bin_dump("in ",src,len) ); |
| 183 |
|
| |
| 184 |
30 |
▶ | SV_Buf_init(&result,len+4); |
Branch: 2 branches
| Branch | True | False | Total |
| SV_Buf_init(&result,len+4); |
30 |
0 |
30 |
| SV_Buf_init(&result,len+4); |
0 |
30 |
30 |
|
| 185 |
30 |
| src_end = src+len; |
| 186 |
|
| |
| 187 |
62 |
▶ | while( src<src_end ) |
Branch: 1 branch
| Branch | True | False | Total |
| while( src<src_end ) |
32 |
30 |
62 |
|
| 188 |
|
| { |
| 189 |
|
| UJ_UINT32 ucs; |
| 190 |
|
| const UJ_UINT8* sjis_ptr; |
| 191 |
|
| |
| 192 |
32 |
▶ | if( *src<=0x7f ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( *src<=0x7f ) |
0 |
32 |
32 |
|
| 193 |
0 |
| { |
| 194 |
|
| /* ascii chars sequence (ja:ASCII¤Ï¤Þ¤È¤á¤ÆÄɲáÁ) */ |
| 195 |
0 |
| int len = 1; |
| 196 |
0 |
▶ | while( src+len<src_end && src[len]<=0x7f ) |
Branch: 2 branches
| Branch | True | False | Total |
| while( src+len<src_end && src[len]<=0x7f ) |
0 |
0 |
0 |
| while( src+len<src_end && src[len]<=0x7f ) |
0 |
0 |
0 |
|
| 197 |
|
| { |
| 198 |
0 |
| ++len; |
| 199 |
|
| } |
| 200 |
0 |
▶ | SV_Buf_append_mem(&result,src,len); |
Branch: 3 branches
| Branch | True | False | Total |
| SV_Buf_append_mem(&result,src,len); |
0 |
0 |
0 |
| SV_Buf_append_mem(&result,src,len); |
0 |
0 |
0 |
| SV_Buf_append_mem(&result,src,len); |
0 |
0 |
0 |
|
| 201 |
0 |
| src+=len; |
| 202 |
0 |
| continue; |
| 203 |
|
| } |
| 204 |
|
| |
| 205 |
|
| /* non-ascii */ |
| 206 |
32 |
▶ | if( 0xe0<=*src && *src<=0xef ) |
Branch: 2 branches
| Branch | True | False | Total |
| if( 0xe0<=*src && *src<=0xef ) |
32 |
0 |
32 |
| if( 0xe0<=*src && *src<=0xef ) |
2 |
30 |
32 |
|
| 207 |
2 |
| { /* 3byte range. mostly enter here. */ |
| 208 |
2 |
| const int utf8_len = 3; |
| 209 |
2 |
| const UJ_UINT32 ucs_min = 0x800; |
| 210 |
2 |
| const UJ_UINT32 ucs_max = 0xffff; |
| 211 |
|
| ECHO_U2S((stderr,"utf8-len: [%d]\n",utf8_len)); |
| 212 |
|
| /* check length */ |
| 213 |
2 |
▶ | if( src+utf8_len<=src_end ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( src+utf8_len<=src_end ) |
0 |
2 |
2 |
|
| 214 |
|
| { /* noop */ |
| 215 |
|
| }else |
| 216 |
|
| { /* no enough sequence */ |
| 217 |
0 |
▶ | SV_Buf_append_ch(&result,'?'); |
Branch: 3 branches
| Branch | True | False | Total |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
|
| 218 |
0 |
| ++src; |
| 219 |
0 |
| continue; |
| 220 |
|
| } |
| 221 |
|
| /* check follow sequences */ |
| 222 |
2 |
▶ | if( 0x80<=src[1] && src[1]<=0xbf && 0x80<=src[2] && src[2]<=0xbf ) |
Branch: 4 branches
| Branch | True | False | Total |
| if( 0x80<=src[1] && src[1]<=0xbf && 0x80<=src[2] && src[2]<=0xbf ) |
2 |
0 |
2 |
| if( 0x80<=src[1] && src[1]<=0xbf && 0x80<=src[2] && src[2]<=0xbf ) |
2 |
0 |
2 |
| if( 0x80<=src[1] && src[1]<=0xbf && 0x80<=src[2] && src[2]<=0xbf ) |
2 |
0 |
2 |
| if( 0x80<=src[1] && src[1]<=0xbf && 0x80<=src[2] && src[2]<=0xbf ) |
2 |
0 |
2 |
|
| 223 |
|
| { /* noop */ |
| 224 |
|
| }else |
| 225 |
|
| { |
| 226 |
0 |
▶ | SV_Buf_append_ch(&result,'?'); |
Branch: 3 branches
| Branch | True | False | Total |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
|
| 227 |
0 |
| ++src; |
| 228 |
0 |
| continue; |
| 229 |
|
| } |
| 230 |
|
| |
| 231 |
|
| /* compute code point */ |
| 232 |
2 |
| ucs = ((src[0] & 0x0F)<<12)|((src[1] & 0x3F)<<6)|(src[2] & 0x3F); |
| 233 |
2 |
| src += utf8_len; |
| 234 |
2 |
▶ | if( ucs_min<=ucs && ucs<=ucs_max ) |
Branch: 2 branches
| Branch | True | False | Total |
| if( ucs_min<=ucs && ucs<=ucs_max ) |
2 |
0 |
2 |
| if( ucs_min<=ucs && ucs<=ucs_max ) |
2 |
0 |
2 |
|
| 235 |
|
| { /* noop */ |
| 236 |
|
| }else |
| 237 |
|
| { /* illegal sequence */ |
| 238 |
0 |
▶ | SV_Buf_append_ch(&result,'?'); |
Branch: 3 branches
| Branch | True | False | Total |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
|
| 239 |
0 |
| continue; |
| 240 |
|
| } |
| 241 |
|
| /* ok. */ |
| 242 |
30 |
▶ | }else if( 0xf0<=*src && *src<=0xf7 ) |
Branch: 2 branches
| Branch | True | False | Total |
| }else if( 0xf0<=*src && *src<=0xf7 ) |
30 |
0 |
30 |
| }else if( 0xf0<=*src && *src<=0xf7 ) |
30 |
0 |
30 |
|
| 243 |
0 |
| { |
| 244 |
30 |
| const int utf8_len = 4; |
| 245 |
30 |
| const UJ_UINT32 ucs_min = 0x010000; |
| 246 |
30 |
| const UJ_UINT32 ucs_max = 0x10ffff; |
| 247 |
|
| ECHO_U2S((stderr,"utf8-len: [%d]\n",utf8_len)); |
| 248 |
|
| /* check length */ |
| 249 |
30 |
▶ | if( src+utf8_len<=src_end ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( src+utf8_len<=src_end ) |
0 |
30 |
30 |
|
| 250 |
|
| { /* noop */ |
| 251 |
|
| }else |
| 252 |
|
| { /* no enough sequence */ |
| 253 |
0 |
▶ | SV_Buf_append_ch(&result,'?'); |
Branch: 3 branches
| Branch | True | False | Total |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
|
| 254 |
0 |
| ++src; |
| 255 |
0 |
| continue; |
| 256 |
|
| } |
| 257 |
|
| /* check follow sequences */ |
| 258 |
30 |
▶ | if( 0x80<=src[1] && src[1]<=0xbf && 0x80<=src[2] && src[2]<=0xbf |
Branch: 4 branches
| Branch | True | False | Total |
| if( 0x80<=src[1] && src[1]<=0xbf && 0x80<=src[2] && src[2]<=0xbf |
30 |
0 |
30 |
| if( 0x80<=src[1] && src[1]<=0xbf && 0x80<=src[2] && src[2]<=0xbf |
30 |
0 |
30 |
| if( 0x80<=src[1] && src[1]<=0xbf && 0x80<=src[2] && src[2]<=0xbf |
30 |
0 |
30 |
| if( 0x80<=src[1] && src[1]<=0xbf && 0x80<=src[2] && src[2]<=0xbf |
30 |
0 |
30 |
|
| 259 |
30 |
▶ | && 0x80<=src[3] && src[3]<=0xbf ) |
Branch: 2 branches
| Branch | True | False | Total |
| && 0x80<=src[3] && src[3]<=0xbf ) |
30 |
0 |
30 |
| && 0x80<=src[3] && src[3]<=0xbf ) |
30 |
0 |
30 |
|
| 260 |
|
| { /* noop */ |
| 261 |
|
| }else |
| 262 |
|
| { |
| 263 |
0 |
▶ | SV_Buf_append_ch(&result,'?'); |
Branch: 3 branches
| Branch | True | False | Total |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
|
| 264 |
0 |
| ++src; |
| 265 |
0 |
| continue; |
| 266 |
|
| } |
| 267 |
|
| |
| 268 |
|
| /* compute code point */ |
| 269 |
30 |
| ucs = ((src[0] & 0x07)<<18)|((src[1] & 0x3F)<<12)| |
| 270 |
30 |
| ((src[2] & 0x3f) << 6)|(src[3] & 0x3F); |
| 271 |
30 |
| src += utf8_len; |
| 272 |
30 |
▶ | if( ucs_min<=ucs && ucs<=ucs_max ) |
Branch: 2 branches
| Branch | True | False | Total |
| if( ucs_min<=ucs && ucs<=ucs_max ) |
30 |
0 |
30 |
| if( ucs_min<=ucs && ucs<=ucs_max ) |
30 |
0 |
30 |
|
| 273 |
|
| { /* noop */ |
| 274 |
|
| }else |
| 275 |
|
| { /* illegal sequence */ |
| 276 |
0 |
▶ | SV_Buf_append_ch(&result,'?'); |
Branch: 3 branches
| Branch | True | False | Total |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
|
| 277 |
0 |
| continue; |
| 278 |
|
| } |
| 279 |
|
| /* private area: block emoji */ |
| 280 |
30 |
▶ | if( 0x0f0000<=ucs && ucs<=0x0fffff ) |
Branch: 2 branches
| Branch | True | False | Total |
| if( 0x0f0000<=ucs && ucs<=0x0fffff ) |
30 |
0 |
30 |
| if( 0x0f0000<=ucs && ucs<=0x0fffff ) |
30 |
0 |
30 |
|
| 281 |
30 |
| { |
| 282 |
|
| const UJ_UINT16* sjis16; |
| 283 |
|
| const UJ_UINT8* sjis8; |
| 284 |
30 |
▶ | if( ucs<0x0fe000 ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( ucs<0x0fe000 ) |
0 |
30 |
30 |
|
| 285 |
|
| { /* unknown area. */ |
| 286 |
0 |
▶ | SV_Buf_append_ch(&result,'?'); |
Branch: 3 branches
| Branch | True | False | Total |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
|
| 287 |
0 |
| continue; |
| 288 |
|
| } |
| 289 |
|
| /* dot-i emoji */ |
| 290 |
30 |
| sjis16 = &g_eu2d_table[ucs - 0x0fe000]; |
| 291 |
30 |
| sjis8 = (UJ_UINT8*)sjis16; |
| 292 |
30 |
▶ | if( sjis8[1]!=0 ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( sjis8[1]!=0 ) |
27 |
3 |
30 |
|
| 293 |
|
| { /* double-byte char */ |
| 294 |
27 |
▶ | SV_Buf_append_ch2(&result, *sjis16); |
Branch: 3 branches
| Branch | True | False | Total |
| SV_Buf_append_ch2(&result, *sjis16); |
0 |
27 |
27 |
| SV_Buf_append_ch2(&result, *sjis16); |
0 |
0 |
0 |
| SV_Buf_append_ch2(&result, *sjis16); |
0 |
0 |
0 |
|
| 295 |
3 |
▶ | }else if( sjis8[0]!=0 ) |
Branch: 1 branch
| Branch | True | False | Total |
| }else if( sjis8[0]!=0 ) |
3 |
0 |
3 |
|
| 296 |
|
| { /* single-byte char, is it exists?? */ |
| 297 |
3 |
▶ | SV_Buf_append_ch(&result,*sjis8); |
Branch: 3 branches
| Branch | True | False | Total |
| SV_Buf_append_ch(&result,*sjis8); |
0 |
3 |
3 |
| SV_Buf_append_ch(&result,*sjis8); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,*sjis8); |
0 |
0 |
0 |
|
| 298 |
|
| }else |
| 299 |
|
| { /* no mapping */ |
| 300 |
0 |
▶ | SV_Buf_append_ch(&result,'?'); |
Branch: 3 branches
| Branch | True | False | Total |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
|
| 301 |
|
| } |
| 302 |
30 |
| continue; |
| 303 |
|
| } |
| 304 |
|
| |
| 305 |
|
| /* > U+10FFFF not supported by UTF-8 (RFC 3629). */ |
| 306 |
0 |
▶ | if( ucs>0x10FFFF ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( ucs>0x10FFFF ) |
0 |
0 |
0 |
|
| 307 |
|
| { |
| 308 |
0 |
▶ | SV_Buf_append_ch(&result,'?'); |
Branch: 3 branches
| Branch | True | False | Total |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
|
| 309 |
0 |
| continue; |
| 310 |
|
| } |
| 311 |
0 |
▶ | }else if( 0xc0<=*src && *src<=0xdf ) |
Branch: 2 branches
| Branch | True | False | Total |
| }else if( 0xc0<=*src && *src<=0xdf ) |
0 |
0 |
0 |
| }else if( 0xc0<=*src && *src<=0xdf ) |
0 |
0 |
0 |
|
| 312 |
0 |
| { |
| 313 |
0 |
| const int utf8_len = 2; |
| 314 |
0 |
| const UJ_UINT32 ucs_min = 0x80; |
| 315 |
0 |
| const UJ_UINT32 ucs_max = 0x7ff; |
| 316 |
|
| ECHO_U2S((stderr,"utf8-len: [%d]\n",utf8_len)); |
| 317 |
|
| /* check length */ |
| 318 |
0 |
▶ | if( src+utf8_len<=src_end ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( src+utf8_len<=src_end ) |
0 |
0 |
0 |
|
| 319 |
|
| { /* noop */ |
| 320 |
|
| }else |
| 321 |
|
| { /* no enough sequence */ |
| 322 |
0 |
▶ | SV_Buf_append_ch(&result,'?'); |
Branch: 3 branches
| Branch | True | False | Total |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
|
| 323 |
0 |
| ++src; |
| 324 |
0 |
| continue; |
| 325 |
|
| } |
| 326 |
|
| /* check follow sequences */ |
| 327 |
0 |
▶ | if( 0x80<=src[1] && src[1]<=0xbf ) |
Branch: 2 branches
| Branch | True | False | Total |
| if( 0x80<=src[1] && src[1]<=0xbf ) |
0 |
0 |
0 |
| if( 0x80<=src[1] && src[1]<=0xbf ) |
0 |
0 |
0 |
|
| 328 |
|
| { /* noop */ |
| 329 |
|
| }else |
| 330 |
|
| { |
| 331 |
0 |
▶ | SV_Buf_append_ch(&result,'?'); |
Branch: 3 branches
| Branch | True | False | Total |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
|
| 332 |
0 |
| ++src; |
| 333 |
0 |
| continue; |
| 334 |
|
| } |
| 335 |
|
| |
| 336 |
|
| /* compute code point */ |
| 337 |
0 |
| ucs = ((src[0] & 0x1F)<<6)|(src[1] & 0x3F); |
| 338 |
0 |
| src += utf8_len; |
| 339 |
0 |
▶ | if( ucs_min<=ucs && ucs<=ucs_max ) |
Branch: 2 branches
| Branch | True | False | Total |
| if( ucs_min<=ucs && ucs<=ucs_max ) |
0 |
0 |
0 |
| if( ucs_min<=ucs && ucs<=ucs_max ) |
0 |
0 |
0 |
|
| 340 |
|
| { /* noop */ |
| 341 |
|
| }else |
| 342 |
|
| { /* illegal sequence */ |
| 343 |
0 |
▶ | SV_Buf_append_ch(&result,'?'); |
Branch: 3 branches
| Branch | True | False | Total |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
|
| 344 |
0 |
| continue; |
| 345 |
|
| } |
| 346 |
|
| |
| 347 |
|
| /* ok. */ |
| 348 |
0 |
▶ | }else if( 0xf8<=*src && *src<=0xfb ) |
Branch: 2 branches
| Branch | True | False | Total |
| }else if( 0xf8<=*src && *src<=0xfb ) |
0 |
0 |
0 |
| }else if( 0xf8<=*src && *src<=0xfb ) |
0 |
0 |
0 |
|
| 349 |
0 |
| { |
| 350 |
0 |
| const int utf8_len = 5; |
| 351 |
|
| ECHO_U2S((stderr,"utf8-len: [%d]\n",utf8_len)); |
| 352 |
|
| /* check length */ |
| 353 |
0 |
▶ | if( src+utf8_len<=src_end ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( src+utf8_len<=src_end ) |
0 |
0 |
0 |
|
| 354 |
|
| { /* noop */ |
| 355 |
|
| }else |
| 356 |
|
| { /* no enough sequence */ |
| 357 |
0 |
▶ | SV_Buf_append_ch(&result,'?'); |
Branch: 3 branches
| Branch | True | False | Total |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
|
| 358 |
0 |
| ++src; |
| 359 |
0 |
| continue; |
| 360 |
|
| } |
| 361 |
|
| /* check follow sequences */ |
| 362 |
0 |
▶ | if( 0x80<=src[1] && src[1]<=0xbf && 0x80<=src[2] && src[2]<=0xbf |
Branch: 4 branches
| Branch | True | False | Total |
| if( 0x80<=src[1] && src[1]<=0xbf && 0x80<=src[2] && src[2]<=0xbf |
0 |
0 |
0 |
| if( 0x80<=src[1] && src[1]<=0xbf && 0x80<=src[2] && src[2]<=0xbf |
0 |
0 |
0 |
| if( 0x80<=src[1] && src[1]<=0xbf && 0x80<=src[2] && src[2]<=0xbf |
0 |
0 |
0 |
| if( 0x80<=src[1] && src[1]<=0xbf && 0x80<=src[2] && src[2]<=0xbf |
0 |
0 |
0 |
|
| 363 |
0 |
▶ | && 0x80<=src[3] && src[3]<=0xbf && 0x80<=src[4] && src[4]<=0xbf ) |
Branch: 4 branches
| Branch | True | False | Total |
| && 0x80<=src[3] && src[3]<=0xbf && 0x80<=src[4] && src[4]<=0xbf ) |
0 |
0 |
0 |
| && 0x80<=src[3] && src[3]<=0xbf && 0x80<=src[4] && src[4]<=0xbf ) |
0 |
0 |
0 |
| && 0x80<=src[3] && src[3]<=0xbf && 0x80<=src[4] && src[4]<=0xbf ) |
0 |
0 |
0 |
| && 0x80<=src[3] && src[3]<=0xbf && 0x80<=src[4] && src[4]<=0xbf ) |
0 |
0 |
0 |
|
| 364 |
|
| { /* noop */ |
| 365 |
|
| }else |
| 366 |
|
| { |
| 367 |
0 |
▶ | SV_Buf_append_ch(&result,'?'); |
Branch: 3 branches
| Branch | True | False | Total |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
|
| 368 |
0 |
| ++src; |
| 369 |
0 |
| continue; |
| 370 |
|
| } |
| 371 |
|
| |
| 372 |
|
| /* compute code point */ |
| 373 |
|
| /* > U+10FFFF not supported by UTF-8 (RFC 3629). */ |
| 374 |
0 |
| src += utf8_len; |
| 375 |
0 |
▶ | SV_Buf_append_ch(&result,'?'); |
Branch: 3 branches
| Branch | True | False | Total |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
|
| 376 |
0 |
| continue; |
| 377 |
0 |
▶ | }else if( 0xfc<=*src && *src<=0xfd ) |
Branch: 2 branches
| Branch | True | False | Total |
| }else if( 0xfc<=*src && *src<=0xfd ) |
0 |
0 |
0 |
| }else if( 0xfc<=*src && *src<=0xfd ) |
0 |
0 |
0 |
|
| 378 |
0 |
| { |
| 379 |
0 |
| const int utf8_len = 6; |
| 380 |
|
| ECHO_U2S((stderr,"utf8-len: [%d]\n",utf8_len)); |
| 381 |
|
| /* check length */ |
| 382 |
0 |
▶ | if( src+utf8_len<=src_end ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( src+utf8_len<=src_end ) |
0 |
0 |
0 |
|
| 383 |
|
| { /* noop */ |
| 384 |
|
| }else |
| 385 |
|
| { /* no enough sequence */ |
| 386 |
0 |
▶ | SV_Buf_append_ch(&result,'?'); |
Branch: 3 branches
| Branch | True | False | Total |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
|
| 387 |
0 |
| ++src; |
| 388 |
0 |
| continue; |
| 389 |
|
| } |
| 390 |
|
| /* check follow sequences */ |
| 391 |
0 |
▶ | if( 0x80<=src[1] && src[1]<=0xbf && 0x80<=src[2] && src[2]<=0xbf |
Branch: 4 branches
| Branch | True | False | Total |
| if( 0x80<=src[1] && src[1]<=0xbf && 0x80<=src[2] && src[2]<=0xbf |
0 |
0 |
0 |
| if( 0x80<=src[1] && src[1]<=0xbf && 0x80<=src[2] && src[2]<=0xbf |
0 |
0 |
0 |
| if( 0x80<=src[1] && src[1]<=0xbf && 0x80<=src[2] && src[2]<=0xbf |
0 |
0 |
0 |
| if( 0x80<=src[1] && src[1]<=0xbf && 0x80<=src[2] && src[2]<=0xbf |
0 |
0 |
0 |
|
| 392 |
0 |
▶ | && 0x80<=src[3] && src[3]<=0xbf && 0x80<=src[4] && src[4]<=0xbf |
Branch: 4 branches
| Branch | True | False | Total |
| && 0x80<=src[3] && src[3]<=0xbf && 0x80<=src[4] && src[4]<=0xbf |
0 |
0 |
0 |
| && 0x80<=src[3] && src[3]<=0xbf && 0x80<=src[4] && src[4]<=0xbf |
0 |
0 |
0 |
| && 0x80<=src[3] && src[3]<=0xbf && 0x80<=src[4] && src[4]<=0xbf |
0 |
0 |
0 |
| && 0x80<=src[3] && src[3]<=0xbf && 0x80<=src[4] && src[4]<=0xbf |
0 |
0 |
0 |
|
| 393 |
0 |
▶ | && 0x80<=src[5] && src[5]<=0xbf ) |
Branch: 2 branches
| Branch | True | False | Total |
| && 0x80<=src[5] && src[5]<=0xbf ) |
0 |
0 |
0 |
| && 0x80<=src[5] && src[5]<=0xbf ) |
0 |
0 |
0 |
|
| 394 |
|
| { /* noop */ |
| 395 |
|
| }else |
| 396 |
|
| { |
| 397 |
0 |
▶ | SV_Buf_append_ch(&result,'?'); |
Branch: 3 branches
| Branch | True | False | Total |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
|
| 398 |
0 |
| ++src; |
| 399 |
0 |
| continue; |
| 400 |
|
| } |
| 401 |
|
| |
| 402 |
|
| /* compute code point */ |
| 403 |
|
| /* > U+10FFFF not supported by UTF-8 (RFC 3629). */ |
| 404 |
0 |
| src += utf8_len; |
| 405 |
0 |
▶ | SV_Buf_append_ch(&result,'?'); |
Branch: 3 branches
| Branch | True | False | Total |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
|
| 406 |
0 |
| continue; |
| 407 |
|
| }else |
| 408 |
|
| { |
| 409 |
0 |
▶ | SV_Buf_append_ch(&result,'?'); |
Branch: 3 branches
| Branch | True | False | Total |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
|
| 410 |
0 |
| ++src; |
| 411 |
0 |
| continue; |
| 412 |
|
| } |
| 413 |
|
| |
| 414 |
|
| /* ucs => sjis */ |
| 415 |
|
| ECHO_U2S((stderr,"ucs [%04x]\n",ucs)); |
| 416 |
2 |
▶ | if( ucs<=0x9FFF ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( ucs<=0x9FFF ) |
2 |
0 |
2 |
|
| 417 |
|
| { |
| 418 |
2 |
| sjis_ptr = g_u2s_table + ucs*2; |
| 419 |
0 |
▶ | }else if( 0xF900<=ucs && ucs<=0xFFFF ) |
Branch: 2 branches
| Branch | True | False | Total |
| }else if( 0xF900<=ucs && ucs<=0xFFFF ) |
0 |
0 |
0 |
| }else if( 0xF900<=ucs && ucs<=0xFFFF ) |
0 |
0 |
0 |
|
| 420 |
|
| { |
| 421 |
0 |
| sjis_ptr = g_u2s_table + (ucs - 0xF900 + 0xA000)*2; |
| 422 |
0 |
▶ | }else if( 0x0FE000<=ucs && ucs<=0x0FFFFF ) |
Branch: 2 branches
| Branch | True | False | Total |
| }else if( 0x0FE000<=ucs && ucs<=0x0FFFFF ) |
0 |
0 |
0 |
| }else if( 0x0FE000<=ucs && ucs<=0x0FFFFF ) |
0 |
0 |
0 |
|
| 423 |
|
| { |
| 424 |
0 |
| sjis_ptr = (UJ_UINT8*)"?"; /* exactly 2byte: "?\0" */ |
| 425 |
|
| }else |
| 426 |
|
| { |
| 427 |
0 |
| sjis_ptr = (UJ_UINT8*)"\0"; /* exactly 2byte: "\0\0" */ |
| 428 |
|
| } |
| 429 |
2 |
▶ | if( sjis_ptr[0]!=0 || sjis_ptr[1]!=0 ) |
Branch: 2 branches
| Branch | True | False | Total |
| if( sjis_ptr[0]!=0 || sjis_ptr[1]!=0 ) |
1 |
1 |
2 |
| if( sjis_ptr[0]!=0 || sjis_ptr[1]!=0 ) |
0 |
1 |
1 |
|
| 430 |
|
| { /* mapping dest exists. */ |
| 431 |
1 |
▶ | if( sjis_ptr[1]!=0 ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( sjis_ptr[1]!=0 ) |
1 |
0 |
1 |
|
| 432 |
|
| { |
| 433 |
1 |
▶ | SV_Buf_append_mem(&result, sjis_ptr, 2); |
Branch: 3 branches
| Branch | True | False | Total |
| SV_Buf_append_mem(&result, sjis_ptr, 2); |
0 |
1 |
1 |
| SV_Buf_append_mem(&result, sjis_ptr, 2); |
0 |
0 |
0 |
| SV_Buf_append_mem(&result, sjis_ptr, 2); |
0 |
0 |
0 |
|
| 434 |
|
| }else |
| 435 |
|
| { |
| 436 |
0 |
▶ | SV_Buf_append_ch(&result,sjis_ptr[0]); |
Branch: 3 branches
| Branch | True | False | Total |
| SV_Buf_append_ch(&result,sjis_ptr[0]); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,sjis_ptr[0]); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,sjis_ptr[0]); |
0 |
0 |
0 |
|
| 437 |
|
| } |
| 438 |
1 |
▶ | }else if( ucs<=0x7F ) |
Branch: 1 branch
| Branch | True | False | Total |
| }else if( ucs<=0x7F ) |
0 |
1 |
1 |
|
| 439 |
|
| { |
| 440 |
0 |
▶ | SV_Buf_append_ch(&result,(UJ_UINT8)ucs); |
Branch: 3 branches
| Branch | True | False | Total |
| SV_Buf_append_ch(&result,(UJ_UINT8)ucs); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,(UJ_UINT8)ucs); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,(UJ_UINT8)ucs); |
0 |
0 |
0 |
|
| 441 |
|
| }else |
| 442 |
|
| { |
| 443 |
1 |
▶ | SV_Buf_append_ch(&result,'?'); |
Branch: 3 branches
| Branch | True | False | Total |
| SV_Buf_append_ch(&result,'?'); |
0 |
1 |
1 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
| SV_Buf_append_ch(&result,'?'); |
0 |
0 |
0 |
|
| 444 |
|
| } |
| 445 |
|
| } /* while */ |
| 446 |
|
| |
| 447 |
|
| ON_U2S( bin_dump("out",SV_Buf_getBegin(&result),SV_Buf_getLength(&result)) ); |
| 448 |
30 |
| SV_Buf_setLength(&result); |
| 449 |
|
| |
| 450 |
30 |
| return SV_Buf_getSv(&result); |
| 451 |
|
| } |
| 452 |
|
| |
| 453 |
|
| /* ---------------------------------------------------------------------------- |
| 454 |
|
| * End of File. |
| 455 |
|
| * ------------------------------------------------------------------------- */ |