[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Groff] unicode support, part 4: abstract output character datatype
From: |
Bruno Haible |
Subject: |
[Groff] unicode support, part 4: abstract output character datatype |
Date: |
Wed, 8 Feb 2006 11:23:29 +0100 |
User-agent: |
KMail/1.5 |
Here is an additional patch creating a name for the "output character"
type. It's probably not worth making this type abstract, since it occurs
only in a single source file.
2006-02-05 Bruno Haible <address@hidden>
* src/devices/grotty/tty.cpp (output_character_t): New type.
(tty_printer::make_bold, tty_printer::add_char, tty_printer::put_char):
Change argument type to output_character_t.
(crossings): Change element type to output_character_t.
diff -r -c3 groff-20060204.orig/src/devices/grotty/tty.cpp
groff-20060204/src/devices/grotty/tty.cpp
--- groff-20060204.orig/src/devices/grotty/tty.cpp Mon Feb 6 02:34:13 2006
+++ groff-20060204/src/devices/grotty/tty.cpp Mon Feb 6 02:38:42 2006
@@ -42,6 +42,9 @@
#define TAB_WIDTH 8
+// A character of the output device fits in a 32-bit word.
+typedef unsigned int output_character_t;
+
static int horizontal_tab_flag = 0;
static int form_feed_flag = 0;
static int bold_flag_option = 1;
@@ -206,9 +209,9 @@
int cu_flag;
PTABLE(schar) tty_colors;
void make_underline(int);
- void make_bold(unsigned int, int);
+ void make_bold(output_character_t, int);
schar color_to_idx(color *col);
- void add_char(unsigned int, int, int, int, color *, color *, unsigned char);
+ void add_char(output_character_t, int, int, int, color *, color *, unsigned
char);
char *make_rgb_string(unsigned int, unsigned int, unsigned int);
int tty_color(unsigned int, unsigned int, unsigned int, schar *,
schar = DEFAULT_COLOR_IDX);
@@ -220,7 +223,7 @@
void special(char *arg, const environment *env, char type);
void change_color(const environment * const env);
void change_fill_color(const environment * const env);
- void put_char(unsigned int);
+ void put_char(output_character_t);
void put_color(schar, int);
void begin_page(int) { }
void end_page(int page_length);
@@ -326,7 +329,7 @@
}
}
-void tty_printer::make_bold(unsigned int c, int w)
+void tty_printer::make_bold(output_character_t c, int w)
{
if (old_drawing_scheme) {
if (!w)
@@ -371,7 +374,7 @@
((tty_font *)f)->get_mode());
}
-void tty_printer::add_char(unsigned int c, int w,
+void tty_printer::add_char(output_character_t c, int w,
int h, int v,
color *fore, color *back,
unsigned char mode)
@@ -546,7 +549,7 @@
}
}
-void tty_printer::put_char(unsigned int wc)
+void tty_printer::put_char(output_character_t wc)
{
if (is_utf8 && wc >= 0x80) {
char buf[6 + 1];
@@ -610,7 +613,7 @@
// ` ' = 0, ` ' = 1, `|' = 2, `|' = 3
// | |
-static int crossings[4*4] = {
+static output_character_t crossings[4*4] = {
0x0000, 0x2577, 0x2575, 0x2502,
0x2576, 0x250C, 0x2514, 0x251C,
0x2574, 0x2510, 0x2518, 0x2524,
@@ -658,7 +661,7 @@
for (p = g; p; delete p, p = nextp) {
nextp = p->next;
if (p->mode & CU_MODE) {
- cu_flag = p->code;
+ cu_flag = (p->code != 0);
continue;
}
if (nextp && p->hpos == nextp->hpos) {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Groff] unicode support, part 4: abstract output character datatype,
Bruno Haible <=