* Code to manage unicode-based screen buffers
*/
-typedef uint32_t char32_t;
-
/*
* Our screen buffer is preceded by an array of line pointers so that
* scrolling only implies some pointer shuffling.
*/
struct uni_screen {
- char32_t *lines[0];
+ u32 *lines[0];
};
static struct uni_screen *vc_uniscr_alloc(unsigned int cols, unsigned int rows)
vc->vc_uni_screen = new_uniscr;
}
-static void vc_uniscr_putc(struct vc_data *vc, char32_t uc)
+static void vc_uniscr_putc(struct vc_data *vc, u32 uc)
{
struct uni_screen *uniscr = vc->vc_uni_screen;
struct uni_screen *uniscr = vc->vc_uni_screen;
if (uniscr) {
- char32_t *ln = uniscr->lines[vc->state.y];
+ u32 *ln = uniscr->lines[vc->state.y];
unsigned int x = vc->state.x, cols = vc->vc_cols;
memmove(&ln[x + nr], &ln[x], (cols - x - nr) * sizeof(*ln));
struct uni_screen *uniscr = vc->vc_uni_screen;
if (uniscr) {
- char32_t *ln = uniscr->lines[vc->state.y];
+ u32 *ln = uniscr->lines[vc->state.y];
unsigned int x = vc->state.x, cols = vc->vc_cols;
memcpy(&ln[x], &ln[x + nr], (cols - x - nr) * sizeof(*ln));
struct uni_screen *uniscr = vc->vc_uni_screen;
if (uniscr) {
- char32_t *ln = uniscr->lines[vc->state.y];
+ u32 *ln = uniscr->lines[vc->state.y];
memset32(&ln[x], ' ', nr);
}
d = sz - nr;
}
for (i = 0; i < gcd(d, sz); i++) {
- char32_t *tmp = uniscr->lines[t + i];
+ u32 *tmp = uniscr->lines[t + i];
j = i;
while (1) {
k = j + d;
return;
while (src_top_row < src_bot_row) {
- char32_t *src_line = src->lines[src_top_row];
- char32_t *dst_line = dst->lines[dst_row];
+ u32 *src_line = src->lines[src_top_row];
+ u32 *dst_line = dst->lines[dst_row];
memcpy(dst_line, src_line, src_cols * sizeof(*src_line));
if (dst_cols - src_cols)
dst_row++;
}
while (dst_row < dst_rows) {
- char32_t *dst_line = dst->lines[dst_row];
+ u32 *dst_line = dst->lines[dst_row];
memset32(dst_line, ' ', dst_cols);
dst_row++;
p = (unsigned short *)vc->vc_origin;
mask = vc->vc_hi_font_mask | 0xff;
for (y = 0; y < vc->vc_rows; y++) {
- char32_t *line = uniscr->lines[y];
+ u32 *line = uniscr->lines[y];
for (x = 0; x < vc->vc_cols; x++) {
u16 glyph = scr_readw(p++) & mask;
line[x] = inverse_translate(vc, glyph, true);
*/
row = (pos - vc->vc_origin) / vc->vc_size_row;
col = ((pos - vc->vc_origin) % vc->vc_size_row) / 2;
- memcpy(dest, &uniscr->lines[row][col], nr * sizeof(char32_t));
+ memcpy(dest, &uniscr->lines[row][col], nr * sizeof(u32));
} else {
/*
* Scrollback is active. For now let's simply backtranslate
*/
u16 *p = (u16 *)pos;
int mask = vc->vc_hi_font_mask | 0xff;
- char32_t *uni_buf = dest;
+ u32 *uni_buf = dest;
while (nr--) {
u16 glyph = scr_readw(p++) & mask;
*uni_buf++ = inverse_translate(vc, glyph, true);