Changeset 1785 for libcaca/trunk/caca
- Timestamp:
- Jun 28, 2007, 2:58:17 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/caca/driver_ncurses.c
r1462 r1785 2 2 * libcaca Colour ASCII-Art library 3 3 * Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org> 4 * 2007 Ben Wiley Sittler <bsittler@gmail.com> 4 5 * All Rights Reserved 5 6 * … … 45 46 #endif 46 47 48 #ifndef TIOCGWINSZ 49 # include <termios.h> 50 #endif 51 47 52 #include "caca.h" 48 53 #include "caca_internals.h" 49 54 #include "cucul.h" 50 55 #include "cucul_internals.h" 56 57 /* 58 * Emulation for missing ACS_* in older curses 59 */ 60 61 #ifndef ACS_BLOCK 62 #define ACS_BLOCK '#' 63 #endif 64 65 #ifndef ACS_BOARD 66 #define ACS_BOARD '#' 67 #endif 68 69 #ifndef ACS_BTEE 70 #define ACS_BTEE '+' 71 #endif 72 73 #ifndef ACS_BULLET 74 #define ACS_BULLET '.' 75 #endif 76 77 #ifndef ACS_CKBOARD 78 #define ACS_CKBOARD ':' 79 #endif 80 81 #ifndef ACS_DARROW 82 #define ACS_DARROW 'v' 83 #endif 84 85 #ifndef ACS_DEGREE 86 #define ACS_DEGREE '\'' 87 #endif 88 89 #ifndef ACS_DIAMOND 90 #define ACS_DIAMOND '+' 91 #endif 92 93 #ifndef ACS_GEQUAL 94 #define ACS_GEQUAL '>' 95 #endif 96 97 #ifndef ACS_HLINE 98 #define ACS_HLINE '-' 99 #endif 100 101 #ifndef ACS_LANTERN 102 #define ACS_LANTERN '#' 103 #endif 104 105 #ifndef ACS_LARROW 106 #define ACS_LARROW '<' 107 #endif 108 109 #ifndef ACS_LEQUAL 110 #define ACS_LEQUAL '<' 111 #endif 112 113 #ifndef ACS_LLCORNER 114 #define ACS_LLCORNER '+' 115 #endif 116 117 #ifndef ACS_LRCORNER 118 #define ACS_LRCORNER '+' 119 #endif 120 121 #ifndef ACS_LTEE 122 #define ACS_LTEE '+' 123 #endif 124 125 #ifndef ACS_NEQUAL 126 #define ACS_NEQUAL '!' 127 #endif 128 129 #ifndef ACS_PI 130 #define ACS_PI '*' 131 #endif 132 133 #ifndef ACS_STERLING 134 #define ACS_STERLING 'f' 135 #endif 136 137 #ifndef ACS_PLMINUS 138 #define ACS_PLMINUS '#' 139 #endif 140 141 #ifndef ACS_PLUS 142 #define ACS_PLUS '+' 143 #endif 144 145 #ifndef ACS_RARROW 146 #define ACS_RARROW '>' 147 #endif 148 149 #ifndef ACS_RTEE 150 #define ACS_RTEE '+' 151 #endif 152 153 #ifndef ACS_S1 154 #define ACS_S1 '-' 155 #endif 156 157 #ifndef ACS_S3 158 #define ACS_S3 '-' 159 #endif 160 161 #ifndef ACS_S7 162 #define ACS_S7 '-' 163 #endif 164 165 #ifndef ACS_S9 166 #define ACS_S9 '-' 167 #endif 168 169 #ifndef ACS_TTEE 170 #define ACS_TTEE '+' 171 #endif 172 173 #ifndef ACS_UARROW 174 #define ACS_UARROW '^' 175 #endif 176 177 #ifndef ACS_ULCORNER 178 #define ACS_ULCORNER '+' 179 #endif 180 181 #ifndef ACS_URCORNER 182 #define ACS_URCORNER '+' 183 #endif 184 185 #ifndef ACS_VLINE 186 #define ACS_VLINE '|' 187 #endif 51 188 52 189 /* … … 452 589 #else 453 590 if(ch < 0x80) 591 { 454 592 addch(ch); 455 else if(cucul_utf32_is_fullwidth(ch)) 456 addstr("? "); 593 } 457 594 else 458 addch('?'); 595 { 596 chtype cch; 597 chtype cch2; 598 599 cch = '?'; 600 cch2 = ' '; 601 if ((ch > 0x0000ff00) && (ch < 0x0000ff5f)) 602 { 603 cch = ch - 0x0000ff00 + ' '; 604 } 605 switch (ch) 606 { 607 case 0x000000a0: /* <nbsp> */ 608 case 0x00003000: /* */ 609 cch = ' '; 610 break; 611 case 0x000000a3: /* £ */ 612 cch = ACS_STERLING; 613 break; 614 case 0x000000b0: /* ° */ 615 cch = ACS_DEGREE; 616 break; 617 case 0x000000b1: /* ± */ 618 cch = ACS_PLMINUS; 619 break; 620 case 0x000000b7: /* · */ 621 case 0x00002219: /* ∙ */ 622 case 0x000030fb: /* ・ */ 623 cch = ACS_BULLET; 624 break; 625 case 0x000003c0: /* π */ 626 cch = ACS_PI; 627 break; 628 case 0x00002018: /* ‘ */ 629 case 0x00002019: /* ’ */ 630 cch = '\''; 631 break; 632 case 0x0000201c: /* “ */ 633 case 0x0000201d: /* ” */ 634 cch = '"'; 635 break; 636 case 0x00002190: /* ← */ 637 cch = ACS_LARROW; 638 break; 639 case 0x00002191: /* ↑ */ 640 cch = ACS_UARROW; 641 break; 642 case 0x00002192: /* → */ 643 cch = ACS_RARROW; 644 break; 645 case 0x00002193: /* ↓ */ 646 cch = ACS_DARROW; 647 break; 648 case 0x00002260: /* ≠ */ 649 cch = ACS_NEQUAL; 650 break; 651 case 0x00002261: /* ≡ */ 652 cch = '='; 653 break; 654 case 0x00002264: /* ≤ */ 655 cch = ACS_LEQUAL; 656 break; 657 case 0x00002265: /* ≥ */ 658 cch = ACS_GEQUAL; 659 break; 660 case 0x000023ba: /* ⎺ */ 661 cch = ACS_S1; 662 cch2 = cch; 663 break; 664 case 0x000023bb: /* ⎻ */ 665 cch = ACS_S3; 666 cch2 = cch; 667 break; 668 case 0x000023bc: /* ⎼ */ 669 cch = ACS_S7; 670 cch2 = cch; 671 break; 672 case 0x000023bd: /* ⎽ */ 673 cch = ACS_S9; 674 cch2 = cch; 675 break; 676 case 0x00002500: /* ─ */ 677 case 0x00002550: /* ═ */ 678 cch = ACS_HLINE; 679 cch2 = cch; 680 break; 681 case 0x00002502: /* │ */ 682 case 0x00002551: /* ║ */ 683 cch = ACS_VLINE; 684 break; 685 case 0x0000250c: /* ┌ */ 686 case 0x00002552: /* ╒ */ 687 case 0x00002553: /* ╓ */ 688 case 0x00002554: /* ╔ */ 689 cch = ACS_ULCORNER; 690 cch2 = ACS_HLINE; 691 break; 692 case 0x00002510: /* ┐ */ 693 case 0x00002555: /* ╕ */ 694 case 0x00002556: /* ╖ */ 695 case 0x00002557: /* ╗ */ 696 cch = ACS_URCORNER; 697 break; 698 case 0x00002514: /* └ */ 699 case 0x00002558: /* ╘ */ 700 case 0x00002559: /* ╙ */ 701 case 0x0000255a: /* ╚ */ 702 cch = ACS_LLCORNER; 703 cch2 = ACS_HLINE; 704 break; 705 case 0x00002518: /* ┘ */ 706 case 0x0000255b: /* ╛ */ 707 case 0x0000255c: /* ╜ */ 708 case 0x0000255d: /* ╝ */ 709 cch = ACS_LRCORNER; 710 break; 711 case 0x0000251c: /* ├ */ 712 case 0x0000255e: /* ╞ */ 713 case 0x0000255f: /* ╟ */ 714 case 0x00002560: /* ╠ */ 715 cch = ACS_LTEE; 716 cch2 = ACS_HLINE; 717 break; 718 case 0x00002524: /* ┤ */ 719 case 0x00002561: /* ╡ */ 720 case 0x00002562: /* ╢ */ 721 case 0x00002563: /* ╣ */ 722 cch = ACS_RTEE; 723 break; 724 case 0x0000252c: /* ┬ */ 725 case 0x00002564: /* ╤ */ 726 case 0x00002565: /* ╥ */ 727 case 0x00002566: /* ╦ */ 728 cch = ACS_TTEE; 729 cch2 = ACS_HLINE; 730 break; 731 case 0x00002534: /* ┴ */ 732 case 0x00002567: /* ╧ */ 733 case 0x00002568: /* ╨ */ 734 case 0x00002569: /* ╩ */ 735 cch = ACS_BTEE; 736 cch2 = ACS_HLINE; 737 break; 738 case 0x0000253c: /* ┼ */ 739 case 0x0000256a: /* ╪ */ 740 case 0x0000256b: /* ╫ */ 741 case 0x0000256c: /* ╬ */ 742 cch = ACS_PLUS; 743 cch2 = ACS_HLINE; 744 break; 745 case 0x00002591: /* ░ */ 746 cch = ACS_BOARD; 747 cch2 = cch; 748 break; 749 case 0x00002592: /* ▒ */ 750 case 0x00002593: /* ▓ */ 751 cch = ACS_CKBOARD; 752 cch2 = cch; 753 break; 754 case 0x00002580: /* ▀ */ 755 case 0x00002584: /* ▄ */ 756 case 0x00002588: /* █ */ 757 case 0x0000258c: /* ▌ */ 758 case 0x00002590: /* ▐ */ 759 case 0x000025a0: /* ■ */ 760 case 0x000025ac: /* ▬ */ 761 case 0x000025ae: /* ▮ */ 762 cch = ACS_BLOCK; 763 cch2 = cch; 764 break; 765 case 0x000025c6: /* ◆ */ 766 case 0x00002666: /* ♦ */ 767 cch = ACS_DIAMOND; 768 break; 769 case 0x00002022: /* • */ 770 case 0x000025cb: /* ○ */ 771 case 0x000025cf: /* ● */ 772 case 0x00002603: /* ☃ */ 773 case 0x0000263c: /* ☼ */ 774 cch = ACS_LANTERN; 775 break; 776 case 0x0000301c: /* 〜 */ 777 cch = '~'; 778 break; 779 } 780 addch(cch); 781 if(cucul_utf32_is_fullwidth(ch)) 782 { 783 addch(cch2); 784 } 785 } 459 786 #endif 460 787 }
Note: See TracChangeset
for help on using the changeset viewer.