Changeset 929 for libcaca/trunk/caca
- Timestamp:
- May 5, 2006, 4:03:40 PM (15 years ago)
- Location:
- libcaca/trunk/caca
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/caca/driver_ncurses.c
r859 r929 488 488 { 489 489 #if defined(HAVE_NCURSESW_NCURSES_H) 490 static const uint8_t mark[7] = 491 { 492 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC 493 }; 494 495 char buf[10], *parser; 490 char buf[10]; 496 491 int bytes; 497 #endif 498 499 if(ch < 0x80) 500 { 501 addch(ch); 502 return; 503 } 504 505 #if defined(HAVE_NCURSESW_NCURSES_H) 506 if(ch < 0x10000) 507 { 508 addch(ch); /* FIXME: doesn't work either */ 509 return; 510 } 511 512 bytes = (ch < 0x800) ? 2 : (ch < 0x10000) ? 3 : 4; 492 493 bytes = _cucul_utf32_to_utf8(buf, ch); 513 494 buf[bytes] = '\0'; 514 parser = buf + bytes;515 516 switch(bytes)517 {518 case 4: *--parser = (ch | 0x80) & 0xbf; ch >>= 6;519 case 3: *--parser = (ch | 0x80) & 0xbf; ch >>= 6;520 case 2: *--parser = (ch | 0x80) & 0xbf; ch >>= 6;521 }522 *--parser = ch | mark[bytes];523 524 495 addstr(buf); 525 496 #else 526 addch( '');497 addch(ch < 0x80 ? ch : '?'); 527 498 #endif 528 499 } -
libcaca/trunk/caca/driver_slang.c
r859 r929 393 393 { 394 394 #ifdef HAVE_SLSMG_UTF8_ENABLE 395 static const uint8_t mark[7] = 396 { 397 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC 398 }; 399 400 char buf[10], *parser; 395 char buf[10]; 401 396 int bytes; 402 #endif 403 404 if(ch < 0x80) 405 { 406 SLsmg_write_char(ch); 407 return; 408 } 409 410 #ifdef HAVE_SLSMG_UTF8_ENABLE 411 bytes = (ch < 0x800) ? 2 : (ch < 0x10000) ? 3 : 4; 397 398 bytes = _cucul_utf32_to_utf8(buf, ch); 412 399 buf[bytes] = '\0'; 413 parser = buf + bytes;414 415 switch(bytes)416 {417 case 4: *--parser = (ch | 0x80) & 0xbf; ch >>= 6;418 case 3: *--parser = (ch | 0x80) & 0xbf; ch >>= 6;419 case 2: *--parser = (ch | 0x80) & 0xbf; ch >>= 6;420 }421 *--parser = ch | mark[bytes];422 423 400 SLsmg_write_string(buf); 424 401 #else 425 SLsmg_write_char( ' ');402 SLsmg_write_char(ch < 0x80 ? ch : ' '); 426 403 #endif 427 404 }
Note: See TracChangeset
for help on using the changeset viewer.