- Timestamp:
- Mar 15, 2006, 9:30:39 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/caca/driver_conio.c
r582 r625 34 34 #include "cucul.h" 35 35 #include "cucul_internals.h" 36 37 static uint8_t conio_utf32_to_cp437(uint32_t); 36 38 37 39 struct driver_private … … 105 107 for(n = kk->qq->height * kk->qq->width; n--; ) 106 108 { 107 uint32_t c = *chars++; 108 109 if(c > 0x00000020 && c < 0x00000080) 110 *screen++ = (char)c; 111 else 112 *screen++ = ' '; 113 109 *screen++ = conio_utf32_to_cp437(*chars++); 114 110 *screen++ = *attr++; 115 111 } … … 138 134 _push_event(kk, CACA_EVENT_KEY_RELEASE | event); 139 135 return CACA_EVENT_KEY_PRESS | event; 136 } 137 138 /* 139 * XXX: following functions are local 140 */ 141 142 static uint8_t conio_utf32_to_cp437(uint32_t c) 143 { 144 static uint32_t const lookup[] = 145 { 146 /* 0x7f */ 147 0x2302, 148 /* 0x80 - 0x8f */ 149 0xc7, 0xfc, 0xe9, 0xe2, 0xe4, 0xe0, 0xe5, 0xe7, 150 0xea, 0xeb, 0xe8, 0xef, 0xee, 0xec, 0xc4, 0xc5, 151 /* 0x90 - 0x9f */ 152 0xc9, 0xe6, 0xc6, 0xf4, 0xf6, 0xf2, 0xfb, 0xf9, 153 0xff, 0xd6, 0xdc, 0xa2, 0xa3, 0xa5, 0x20a7, 0x192, 154 /* 0xa0 - 0xaf */ 155 0xe1, 0xed, 0xf3, 0xfa, 0xf1, 0xd1, 0xaa, 0xba, 156 0xbf, 0x2310, 0xac, 0xbd, 0xbc, 0xa1, 0xab, 0xbb, 157 /* 0xb0 - 0xbf */ 158 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 159 0x2555, 0x2563, 0x2551, 0x2557, 0x255d, 0x255c, 0x255b, 0x2510, 160 /* 0xc0 - 0xcf */ 161 0x2514, 0x2534, 0x252c, 0x251c, 0x2500, 0x253c, 0x255e, 0x255f, 162 0x255a, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256c, 0x2567, 163 /* 0xd0 - 0xdf */ 164 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256b, 165 0x256a, 0x2518, 0x250c, 0x2588, 0x2584, 0x258c, 0x2590, 0x2580, 166 /* 0xe0 - 0xef */ 167 0x3b1, 0xdf, 0x393, 0x3c0, 0x3a3, 0x3c3, 0xb5, 0x3c4, 168 0x3a6, 0x398, 0x3a9, 0x3b4, 0x221e, 0x3c6, 0x3b5, 0x2229, 169 /* 0xf0 - 0xff */ 170 0x2261, 0xb1, 0x2265, 0x2264, 0x2320, 0x2321, 0xf7, 0x2248, 171 0xb0, 0x2219, 0xb7, 0x221a, 0x207f, 0xb2, 0x25a0, 0xa0 172 }; 173 174 unsigned int i; 175 176 if(c < 0x00000020) 177 return '?'; 178 179 if(c < 0x00000080) 180 return c; 181 182 for(i = 0; i < sizeof(lookup) / sizeof(*lookup); i++) 183 { 184 if(lookup[i] == c) 185 return 0x7f + i; 186 } 187 188 return '?'; 140 189 } 141 190
Note: See TracChangeset
for help on using the changeset viewer.