| 1342 | */ |
| 1343 | #endif |
| 1344 | void |
| 1345 | console_g_putch(int in_ch) |
| 1346 | { |
| 1347 | unsigned char ch = (unsigned char) in_ch; |
| 1348 | cell_t cell; |
| 1349 | #ifndef VIRTUAL_TERMINAL_SEQUENCES |
| 1350 | boolean inverse = FALSE; |
| 1351 | #else /* VIRTUAL_TERMINAL_SEQUENCES */ |
| 1352 | ccount = 0; |
| 1353 | WCHAR wch[2]; |
| 1354 | boolean usemap = (ch >= 0 && ((int) ch < SIZE(console.cpMap))); |
| 1355 | #endif /* VIRTUAL_TERMINAL_SEQUENCES */ |
| 1356 | |
| 1357 | set_console_cursor(ttyDisplay->curx, ttyDisplay->cury); |
| 1358 | #ifndef VIRTUAL_TERMINAL_SEQUENCES |
| 1359 | inverse = (console.current_nhattr[ATR_INVERSE] && iflags.wc_inverse); |
| 1360 | console.attr = (console.current_nhattr[ATR_INVERSE] && iflags.wc_inverse) ? |
| 1361 | ttycolors_inv[console.current_nhcolor] : |
| 1362 | ttycolors[console.current_nhcolor]; |
| 1363 | if (console.current_nhattr[ATR_BOLD]) |
| 1364 | console.attr |= (inverse) ? BACKGROUND_INTENSITY : FOREGROUND_INTENSITY; |
| 1365 | cell.attribute = console.attr; |
| 1366 | cell.character = (console.has_unicode ? cp437[ch] : ch); |
| 1367 | #else |
| 1368 | cell.attr = console.attr; |
| 1369 | cell.colorseq = esc_seq_colors[console.current_nhcolor]; |
| 1370 | cell.bkcolorseq = esc_seq_bkcolors[console.current_nhbkcolor]; |
| 1371 | cell.color24 = console.color24 ? console.color24 : 0L; |
| 1372 | cell.color256idx = 0; |
| 1373 | wch[1] = 0; |
| 1374 | if (console.has_unicode) { |
| 1375 | wch[0] = (usemap) ? console.cpMap[ch] : ch; |
| 1376 | #ifdef UTF8_FROM_CORE |
| 1377 | if (SYMHANDLING(H_UTF8)) { |
| 1378 | /* we have to convert it to UTF-8 for cell.utf8str */ |
| 1379 | ccount = WideCharToMultiByte( |
| 1380 | CP_UTF8, 0, wch, -1, (char *) cell.utf8str, |
| 1381 | (int) sizeof cell.utf8str, NULL, NULL); |
| 1382 | } else { |
| 1383 | #endif |
| 1384 | /* store the wide version here also, so we don't slow |
| 1385 | down back_buffer_flip() with conversions */ |
| 1386 | cell.wcharacter = wch[0]; |
| 1387 | #ifdef UTF8_FROM_CORE |
| 1388 | } |
| 1389 | #endif |
| 1390 | } else { |
| 1391 | /* we can just use the UTF-8 utf8str field, since ascii is a |
| 1392 | single-byte representation of a small subset of unicode */ |
| 1393 | cell.utf8str[0] = ch; |
| 1394 | cell.utf8str[1] = 0; |
| 1395 | ccount = 2; |
| 1396 | } |
| 1397 | #endif /* VIRTUAL_TERMINAL_SEQUENCES */ |
| 1398 | buffer_write(console.back_buffer, &cell, console.cursor); |
| 1399 | } |
| 1400 | |
| 1401 | /* |
no test coverage detected