diff options
author | wl <wl> | 2006-02-11 20:34:36 +0000 |
---|---|---|
committer | wl <wl> | 2006-02-11 20:34:36 +0000 |
commit | 4002ae89fa6320c0b96889d76aab727c836115c2 (patch) | |
tree | 774a8de73e1017e897d9fd67194599bc0563c672 /src/devices/grotty | |
parent | 6a7f55cf47c291790cf08aaba36a947d7f6d5ab3 (diff) | |
download | groff-4002ae89fa6320c0b96889d76aab727c836115c2.tar.gz |
* src/include/font.h: s/glyph_t/glyph/.
Update all callers.
* src/devices/grotty/tty.cpp: s/glyph/tty_glyph/.
s/output_character_t/output_character/.
Diffstat (limited to 'src/devices/grotty')
-rw-r--r-- | src/devices/grotty/tty.cpp | 81 |
1 files changed, 41 insertions, 40 deletions
diff --git a/src/devices/grotty/tty.cpp b/src/devices/grotty/tty.cpp index b2d60208..622bd82d 100644 --- a/src/devices/grotty/tty.cpp +++ b/src/devices/grotty/tty.cpp @@ -43,7 +43,7 @@ extern "C" const char *Version_string; #define TAB_WIDTH 8 // A character of the output device fits in a 32-bit word. -typedef unsigned int output_character_t; +typedef unsigned int output_character; static int horizontal_tab_flag = 0; static int form_feed_flag = 0; @@ -154,10 +154,10 @@ void tty_font::handle_x_command(int argc, const char **argv) } #endif -class glyph { - static glyph *free_list; +class tty_glyph { + static tty_glyph *free_list; public: - glyph *next; + tty_glyph *next; int w; int hpos; unsigned int code; @@ -171,34 +171,34 @@ public: return mode & (VDRAW_MODE|HDRAW_MODE|CU_MODE|COLOR_CHANGE); } }; -glyph *glyph::free_list = 0; +tty_glyph *tty_glyph::free_list = 0; -void *glyph::operator new(size_t) +void *tty_glyph::operator new(size_t) { if (!free_list) { const int BLOCK = 1024; - free_list = (glyph *)new char[sizeof(glyph) * BLOCK]; + free_list = (tty_glyph *)new char[sizeof(tty_glyph) * BLOCK]; for (int i = 0; i < BLOCK - 1; i++) free_list[i].next = free_list + i + 1; free_list[BLOCK - 1].next = 0; } - glyph *p = free_list; + tty_glyph *p = free_list; free_list = free_list->next; p->next = 0; return p; } -void glyph::operator delete(void *p) +void tty_glyph::operator delete(void *p) { if (p) { - ((glyph *)p)->next = free_list; - free_list = (glyph *)p; + ((tty_glyph *)p)->next = free_list; + free_list = (tty_glyph *)p; } } class tty_printer : public printer { int is_utf8; - glyph **lines; + tty_glyph **lines; int nlines; int cached_v; int cached_vpos; @@ -209,24 +209,25 @@ class tty_printer : public printer { int cu_flag; PTABLE(schar) tty_colors; void make_underline(int); - void make_bold(output_character_t, int); - schar color_to_idx(color *col); - void add_char(output_character_t, int, int, int, color *, color *, unsigned char); + void make_bold(output_character, int); + schar color_to_idx(color *); + void add_char(output_character, 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); public: - tty_printer(const char *device); + tty_printer(const char *); ~tty_printer(); - void set_char(glyph_t, font *, const environment *, int, const char *name); - void draw(int code, int *p, int np, const environment *env); - 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(output_character_t); + void set_char(glyph, font *, const environment *, int, const char *); + void draw(int, int *, int, const environment *); + void special(char *, const environment *, char); + void change_color(const environment * const); + void change_fill_color(const environment * const); + void put_char(output_character); void put_color(schar, int); void begin_page(int) { } - void end_page(int page_length); + void end_page(int); font *make_font(const char *); }; @@ -292,7 +293,7 @@ tty_printer::tty_printer(const char *dev) : cached_v(0) (void)tty_color(color::MAX_COLOR_VAL, 0, color::MAX_COLOR_VAL, &dummy, 5); (void)tty_color(0, color::MAX_COLOR_VAL, color::MAX_COLOR_VAL, &dummy, 6); nlines = 66; - lines = new glyph *[nlines]; + lines = new tty_glyph *[nlines]; for (int i = 0; i < nlines; i++) lines[i] = 0; cu_flag = 0; @@ -329,7 +330,7 @@ void tty_printer::make_underline(int w) } } -void tty_printer::make_bold(output_character_t c, int w) +void tty_printer::make_bold(output_character c, int w) { if (old_drawing_scheme) { if (!w) @@ -363,18 +364,18 @@ schar tty_printer::color_to_idx(color *col) return idx; } -void tty_printer::set_char(glyph_t gly, font *f, const environment *env, +void tty_printer::set_char(glyph g, font *f, const environment *env, int w, const char *) { if (w % font::hor != 0) fatal("width of character not a multiple of horizontal resolution"); - add_char(f->get_code(gly), w, + add_char(f->get_code(g), w, env->hpos, env->vpos, env->col, env->fill, ((tty_font *)f)->get_mode()); } -void tty_printer::add_char(output_character_t c, int w, +void tty_printer::add_char(output_character c, int w, int h, int v, color *fore, color *back, unsigned char mode) @@ -397,9 +398,9 @@ void tty_printer::add_char(output_character_t c, int w, fatal("vertical position not a multiple of vertical resolution"); vpos = v / font::vert; if (vpos > nlines) { - glyph **old_lines = lines; - lines = new glyph *[vpos + 1]; - memcpy(lines, old_lines, nlines * sizeof(glyph *)); + tty_glyph **old_lines = lines; + lines = new tty_glyph *[vpos + 1]; + memcpy(lines, old_lines, nlines * sizeof(tty_glyph *)); for (int i = nlines; i <= vpos; i++) lines[i] = 0; a_delete old_lines; @@ -414,7 +415,7 @@ void tty_printer::add_char(output_character_t c, int w, cached_v = v; cached_vpos = vpos; } - glyph *g = new glyph; + tty_glyph *g = new tty_glyph; g->w = w; g->hpos = hpos; g->code = c; @@ -427,7 +428,7 @@ void tty_printer::add_char(output_character_t c, int w, // HDRAW characters before VDRAW characters before normal characters // at each hpos, and otherwise in order of occurrence. - glyph **pp; + tty_glyph **pp; for (pp = lines + (vpos - 1); *pp; pp = &(*pp)->next) if ((*pp)->hpos < hpos || ((*pp)->hpos == hpos && (*pp)->order() >= g->order())) @@ -549,7 +550,7 @@ void tty_printer::draw(int code, int *p, int np, const environment *env) } } -void tty_printer::put_char(output_character_t wc) +void tty_printer::put_char(output_character wc) { if (is_utf8 && wc >= 0x80) { char buf[6 + 1]; @@ -613,7 +614,7 @@ void tty_printer::put_color(schar color_index, int back) // ` ' = 0, ` ' = 1, `|' = 2, `|' = 3 // | | -static output_character_t crossings[4*4] = { +static output_character crossings[4*4] = { 0x0000, 0x2577, 0x2575, 0x2502, 0x2576, 0x250C, 0x2514, 0x251C, 0x2574, 0x2510, 0x2518, 0x2524, @@ -635,7 +636,7 @@ void tty_printer::end_page(int page_length) do { --last_line; while (lines[last_line]) { - glyph *tem = lines[last_line]; + tty_glyph *tem = lines[last_line]; lines[last_line] = tem->next; delete tem; } @@ -643,17 +644,17 @@ void tty_printer::end_page(int page_length) } #endif for (int i = 0; i < last_line; i++) { - glyph *p = lines[i]; + tty_glyph *p = lines[i]; lines[i] = 0; - glyph *g = 0; + tty_glyph *g = 0; while (p) { - glyph *tem = p->next; + tty_glyph *tem = p->next; p->next = g; g = p; p = tem; } int hpos = 0; - glyph *nextp; + tty_glyph *nextp; curr_fore_idx = DEFAULT_COLOR_IDX; curr_back_idx = DEFAULT_COLOR_IDX; is_underline = 0; |