Changeset 643 for libcaca/trunk/caca
- Timestamp:
- Mar 17, 2006, 2:32:58 PM (15 years ago)
- Location:
- libcaca/trunk/caca
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/caca/driver_conio.c
r631 r643 34 34 #include "cucul.h" 35 35 #include "cucul_internals.h" 36 37 static uint8_t conio_utf32_to_cp437(uint32_t);38 36 39 37 struct driver_private … … 107 105 for(n = kk->qq->height * kk->qq->width; n--; ) 108 106 { 109 *screen++ = conio_utf32_to_cp437(*chars++);107 *screen++ = _cucul_utf32_to_cp437(*chars++); 110 108 *screen++ = *attr++; 111 109 } … … 137 135 138 136 /* 139 * XXX: following functions are local140 */141 142 static uint8_t conio_utf32_to_cp437(uint32_t c)143 {144 static uint32_t const lookup1[] =145 {146 /* 0x01 - 0x0f: ☺ ☻ ♥ ♦ ♣ ♠ • ◘ ○ ◙ ♂ ♀ ♪ ♫ ☼ */147 0x263a, 0x263b, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022,148 0x25d8, 0x25cb, 0x25d9, 0x2642, 0x2640, 0x266a, 0x266b, 0x263c,149 /* 0x10 - 0x1f: ► ◄ ↕ ‼ ¶ § ▬ ↨ ↑ ↓ → ← ∟ ↔ ▲ ▼ */150 0x25ba, 0x25c4, 0x2195, 0x203c, 0xb6, 0xa7, 0x25ac, 0x21a8,151 0x2191, 0x2193, 0x2192, 0x2190, 0x221f, 0x2194, 0x25b2, 0x25bc152 };153 154 static uint32_t const lookup2[] =155 {156 /* 0x7f: ⌂ */157 0x2302,158 /* 0x80 - 0x8f: Ç ü é â ä à å ç ê ë è ï î ì Ä Å */159 0xc7, 0xfc, 0xe9, 0xe2, 0xe4, 0xe0, 0xe5, 0xe7,160 0xea, 0xeb, 0xe8, 0xef, 0xee, 0xec, 0xc4, 0xc5,161 /* 0x90 - 0x9f: É æ Æ ô ö ò û ù ÿ Ö Ü ¢ £ ¥ ₧ ƒ */162 0xc9, 0xe6, 0xc6, 0xf4, 0xf6, 0xf2, 0xfb, 0xf9,163 0xff, 0xd6, 0xdc, 0xa2, 0xa3, 0xa5, 0x20a7, 0x192,164 /* 0xa0 - 0xaf: á í ó ú ñ Ñ ª º ¿ ⌐ ¬ ½ ¼ ¡ « » */165 0xe1, 0xed, 0xf3, 0xfa, 0xf1, 0xd1, 0xaa, 0xba,166 0xbf, 0x2310, 0xac, 0xbd, 0xbc, 0xa1, 0xab, 0xbb,167 /* 0xb0 - 0xbf: ░ ▒ ▓ │ ┤ ╡ ╢ ╖ ╕ ╣ ║ ╗ ╝ ╜ ╛ ┐ */168 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556,169 0x2555, 0x2563, 0x2551, 0x2557, 0x255d, 0x255c, 0x255b, 0x2510,170 /* 0xc0 - 0xcf: └ ┴ ┬ ├ ─ ┼ ╞ ╟ ╚ ╔ ╩ ╦ ╠ ═ ╬ ╧ */171 0x2514, 0x2534, 0x252c, 0x251c, 0x2500, 0x253c, 0x255e, 0x255f,172 0x255a, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256c, 0x2567,173 /* 0xd0 - 0xdf: ╨ ╤ ╥ ╙ ╘ ╒ ╓ ╫ ╪ ┘ ┌ █ ▄ ▌ ▐ ▀ */174 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256b,175 0x256a, 0x2518, 0x250c, 0x2588, 0x2584, 0x258c, 0x2590, 0x2580,176 /* 0xe0 - 0xef: α ß Γ π Σ σ µ τ Φ Θ Ω δ ∞ φ ε ∩ */177 0x3b1, 0xdf, 0x393, 0x3c0, 0x3a3, 0x3c3, 0xb5, 0x3c4,178 0x3a6, 0x398, 0x3a9, 0x3b4, 0x221e, 0x3c6, 0x3b5, 0x2229,179 /* 0xf0 - 0xff: ≡ ± ≥ ≤ ⌠ ⌡ ÷ ≈ ° ∙ · √ ⁿ ² ■ <nbsp> */180 0x2261, 0xb1, 0x2265, 0x2264, 0x2320, 0x2321, 0xf7, 0x2248,181 0xb0, 0x2219, 0xb7, 0x221a, 0x207f, 0xb2, 0x25a0, 0xa0182 };183 184 unsigned int i;185 186 if(c < 0x00000020)187 return '?';188 189 if(c < 0x00000080)190 return c;191 192 for(i = 0; i < sizeof(lookup1) / sizeof(*lookup1); i++)193 if(lookup1[i] == c)194 return 0x01 + i;195 196 for(i = 0; i < sizeof(lookup2) / sizeof(*lookup2); i++)197 if(lookup2[i] == c)198 return 0x7f + i;199 200 return '?';201 }202 203 /*204 137 * Driver initialisation 205 138 */ -
libcaca/trunk/caca/driver_vga.c
r631 r643 26 26 #include "cucul.h" 27 27 #include "cucul_internals.h" 28 29 static uint8_t vga_utf32_to_cp437(uint32_t);30 28 31 29 /* Address of the VGA screen */ … … 125 123 for(n = kk->qq->height * kk->qq->width; n--; ) 126 124 { 127 *screen++ = vga_utf32_to_cp437(*chars++);125 *screen++ = _cucul_utf32_to_cp437(*chars++); 128 126 *screen++ = *attr++; 129 127 } … … 141 139 /* FIXME */ 142 140 return CACA_EVENT_NONE; 143 }144 145 /*146 * XXX: following functions are local147 */148 149 static uint8_t vga_utf32_to_cp437(uint32_t c)150 {151 static uint32_t const lookup1[] =152 {153 /* 0x01 - 0x0f: ☺ ☻ ♥ ♦ ♣ ♠ • ◘ ○ ◙ ♂ ♀ ♪ ♫ ☼ */154 0x263a, 0x263b, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022,155 0x25d8, 0x25cb, 0x25d9, 0x2642, 0x2640, 0x266a, 0x266b, 0x263c,156 /* 0x10 - 0x1f: ► ◄ ↕ ‼ ¶ § ▬ ↨ ↑ ↓ → ← ∟ ↔ ▲ ▼ */157 0x25ba, 0x25c4, 0x2195, 0x203c, 0xb6, 0xa7, 0x25ac, 0x21a8,158 0x2191, 0x2193, 0x2192, 0x2190, 0x221f, 0x2194, 0x25b2, 0x25bc159 };160 161 static uint32_t const lookup2[] =162 {163 /* 0x7f: ⌂ */164 0x2302,165 /* 0x80 - 0x8f: Ç ü é â ä à å ç ê ë è ï î ì Ä Å */166 0xc7, 0xfc, 0xe9, 0xe2, 0xe4, 0xe0, 0xe5, 0xe7,167 0xea, 0xeb, 0xe8, 0xef, 0xee, 0xec, 0xc4, 0xc5,168 /* 0x90 - 0x9f: É æ Æ ô ö ò û ù ÿ Ö Ü ¢ £ ¥ ₧ ƒ */169 0xc9, 0xe6, 0xc6, 0xf4, 0xf6, 0xf2, 0xfb, 0xf9,170 0xff, 0xd6, 0xdc, 0xa2, 0xa3, 0xa5, 0x20a7, 0x192,171 /* 0xa0 - 0xaf: á í ó ú ñ Ñ ª º ¿ ⌐ ¬ ½ ¼ ¡ « » */172 0xe1, 0xed, 0xf3, 0xfa, 0xf1, 0xd1, 0xaa, 0xba,173 0xbf, 0x2310, 0xac, 0xbd, 0xbc, 0xa1, 0xab, 0xbb,174 /* 0xb0 - 0xbf: ░ ▒ ▓ │ ┤ ╡ ╢ ╖ ╕ ╣ ║ ╗ ╝ ╜ ╛ ┐ */175 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556,176 0x2555, 0x2563, 0x2551, 0x2557, 0x255d, 0x255c, 0x255b, 0x2510,177 /* 0xc0 - 0xcf: └ ┴ ┬ ├ ─ ┼ ╞ ╟ ╚ ╔ ╩ ╦ ╠ ═ ╬ ╧ */178 0x2514, 0x2534, 0x252c, 0x251c, 0x2500, 0x253c, 0x255e, 0x255f,179 0x255a, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256c, 0x2567,180 /* 0xd0 - 0xdf: ╨ ╤ ╥ ╙ ╘ ╒ ╓ ╫ ╪ ┘ ┌ █ ▄ ▌ ▐ ▀ */181 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256b,182 0x256a, 0x2518, 0x250c, 0x2588, 0x2584, 0x258c, 0x2590, 0x2580,183 /* 0xe0 - 0xef: α ß Γ π Σ σ µ τ Φ Θ Ω δ ∞ φ ε ∩ */184 0x3b1, 0xdf, 0x393, 0x3c0, 0x3a3, 0x3c3, 0xb5, 0x3c4,185 0x3a6, 0x398, 0x3a9, 0x3b4, 0x221e, 0x3c6, 0x3b5, 0x2229,186 /* 0xf0 - 0xff: ≡ ± ≥ ≤ ⌠ ⌡ ÷ ≈ ° ∙ · √ ⁿ ² ■ <nbsp> */187 0x2261, 0xb1, 0x2265, 0x2264, 0x2320, 0x2321, 0xf7, 0x2248,188 0xb0, 0x2219, 0xb7, 0x221a, 0x207f, 0xb2, 0x25a0, 0xa0189 };190 191 unsigned int i;192 193 if(c < 0x00000020)194 return '?';195 196 if(c < 0x00000080)197 return c;198 199 for(i = 0; i < sizeof(lookup1) / sizeof(*lookup1); i++)200 if(lookup1[i] == c)201 return 0x01 + i;202 203 for(i = 0; i < sizeof(lookup2) / sizeof(*lookup2); i++)204 if(lookup2[i] == c)205 return 0x7f + i;206 207 return '?';208 141 } 209 142
Note: See TracChangeset
for help on using the changeset viewer.