Now the abstract glyph datatype appears sufficiently future-proof that I think it can be made concrete again. It contains just a 'glyphinfo *' pointer, so let's use this pointer instead everywhere. The 'glyph' class therefore disappears.
After doing this, I rename 'glyphinfo' to 'glyph'. 2006-02-19 Bruno Haible <[EMAIL PROTECTED]> Concretize the glyph datatype. * src/include/font.h (struct glyph): Remove class. (struct glyph): Renamed from struct glyphinfo. (glyph_to_index): New inline function. (glyph_to_name): Make extern, not inline. (glyph_to_number): Update. (class font): Use 'glyph *' instead of 'glyph'. * src/libs/libgroff/nametoindex.cpp (class charinfo): Inherit from class glyph. Make 'name' field public. (character_indexer, number_to_glyph, name_to_glyph): Use 'glyph *' instead of 'glyph'. (glyph_to_name): Renamed from glyph::glyph_name. * src/roff/troff/charinfo.h (class charinfo): Inherit from class glyph. Use 'glyph *' instead of 'glyph'. * src/roff/troff/input.cpp (name_to_glyph, number_to_glyph: Use 'glyph *' instead of 'glyph'. (glyph_to_name): Renamed from glyph::glyph_name. * src/libs/libgroff/font.cpp: Use 'glyph *' instead of 'glyph', and glyph_to_index instead of glyph::glyph_index. * src/include/printer.h (class printer): Use 'glyph *' instead of 'glyph'. * src/libs/libdriver/printer.cpp: Likewise. * src/devices/grodvi/dvi.cpp: Likewise. * src/devices/grohtml/post-html.cpp: Likewise. * src/devices/grolbp/lbp.cpp: Likewise. * src/devices/grolj4/lj4.cpp: Likewise. * src/devices/grops/ps.cpp: Likewise. * src/devices/grotty/tty.cpp: Likewise. diff -r -c3 groff-20060217.orig/src/include/font.h groff-20060217/src/include/font.h --- groff-20060217.orig/src/include/font.h 2006-02-17 18:21:45.000000000 +0100 +++ groff-20060217/src/include/font.h 2006-02-19 14:17:35.000000000 +0100 @@ -26,8 +26,8 @@ const char *, // file int); // lineno -// A glyph is represented by a font-independent `glyph' object. -// The functions name_to_glyph and number_to_glyph return such an object. +// A glyph is represented by a font-independent `glyph *' pointer. +// The functions name_to_glyph and number_to_glyph return such a pointer. // // There are two types of glyphs: // @@ -44,93 +44,45 @@ // `charinfo' exists in two versions: one in roff/troff/input.cpp for troff, // and one in libs/libgroff/nametoindex.cpp for the preprocessors and the // postprocessors. -struct glyphinfo { +struct glyph { int index; // A font-independent integer value. int number; // Glyph number or -1. friend class character_indexer; }; -struct glyph { -private: - glyphinfo *ptr; // Pointer to the complete information. - friend class character_indexer; - friend class charinfo; - glyph(glyphinfo *); // Glyph with given complete information. -public: - glyph(); // Uninitialized glyph. - static glyph undefined_glyph(); // Undefined glyph. - int glyph_index(); - const char *glyph_name(); // Return the glyph name or NULL. - int glyph_number(); // Return the glyph number or -1. - int operator==(const glyph &) const; - int operator!=(const glyph &) const; -}; - -inline glyph::glyph(glyphinfo *p) -: ptr (p) -{ -} - -inline glyph::glyph() -: ptr ((glyphinfo *) 0xdeadbeef) -{ -} - -inline glyph glyph::undefined_glyph() -{ - return glyph(NULL); -} -#define UNDEFINED_GLYPH glyph::undefined_glyph() - -inline int glyph::glyph_index() -{ - return ptr->index; -} - -inline int glyph::glyph_number() -{ - return ptr->number; -} - -inline int glyph::operator==(const glyph &other) const -{ - return ptr == other.ptr; -} - -inline int glyph::operator!=(const glyph &other) const -{ - return ptr != other.ptr; -} +#define UNDEFINED_GLYPH ((glyph *) NULL) -// The next two functions and glyph::glyph_name() exist in two versions: one in +// The next three functions exist in two versions: one in // roff/troff/input.cpp for troff, and one in // libs/libgroff/nametoindex.cpp for the preprocessors and the // postprocessors. -extern glyph name_to_glyph(const char *); // Convert the glyph with +extern glyph *name_to_glyph(const char *); // Convert the glyph with // the given name (arg1) to a `glyph' object. This // has the same semantics as the groff escape sequence // \C'name'. If such a `glyph' object does not yet // exist, a new one is allocated. -extern glyph number_to_glyph(int); // Convert the font-dependent glyph +extern glyph *number_to_glyph(int); // Convert the font-dependent glyph // with the given number (in the font) to a `glyph' // object. This has the same semantics as the groff // escape sequence \N'number'. If such a `glyph' // object does not yet exist, a new one is allocated. -inline const char *glyph_to_name(glyph); // Convert the given glyph +extern const char *glyph_to_name(glyph *); // Convert the given glyph // back to its name. Return NULL if the glyph // doesn't have a name. -inline int glyph_to_number(glyph); // Convert the given glyph back to +inline int glyph_to_number(glyph *); // Convert the given glyph back to // its number. Return -1 if it does not designate // a numbered character. +inline int glyph_to_index(glyph *); // Return the unique index that is + // associated with the given glyph. It is >= 0. -inline const char *glyph_to_name(glyph g) +inline int glyph_to_number(glyph *g) { - return g.glyph_name(); + return g->number; } -inline int glyph_to_number(glyph g) +inline int glyph_to_index(glyph *g) { - return g.glyph_number(); + return g->index; } // Types used in non-public members of `class font'. @@ -152,23 +104,23 @@ }; virtual ~font(); // Destructor. - int contains(glyph); // Return 1 if this font contains the given + int contains(glyph *); // Return 1 if this font contains the given // glyph, 0 otherwise. int is_special(); // Return 1 if this font is special, 0 otherwise. // See section `Special Fonts' in the info file of // groff. Used by make_glyph_node(). - int get_width(glyph, int); // A rectangle represents the shape of the + int get_width(glyph *, int); // A rectangle represents the shape of the // given glyph (arg1) at the given point size // (arg2). Return the horizontal dimension of this // rectangle. - int get_height(glyph, int); // A rectangle represents the shape of the + int get_height(glyph *, int); // A rectangle represents the shape of the // given glyph (arg1) at the given point size // (arg2). Return the distance between the base // line and the top of this rectangle. // This is often also called the `ascent' of the // glyph. If the top is above the base line, this // value is positive. - int get_depth(glyph, int); // A rectangle represents the shape of the + int get_depth(glyph *, int); // A rectangle represents the shape of the // given glyph (arg1) at the given point size // (arg2). Return the distance between the base // line and the bottom of this rectangle. @@ -177,15 +129,15 @@ // this value is positive. int get_space_width(int); // Return the normal width of a space at the // given point size. - int get_character_type(glyph); // Return a bit mask describing the + int get_character_type(glyph *); // Return a bit mask describing the // shape of the given glyph. Bit 0 is set if the // character has a descender. Bit 1 is set if the // character has a tall glyph. See groff manual, // description of \w and the `ct' register. - int get_kern(glyph, glyph, int); // Return the kerning between the + int get_kern(glyph *, glyph *, int); // Return the kerning between the // given glyphs (arg1 and arg2), both at the given // point size (arg3). - int get_skew(glyph, int, int); // A rectangle represents the shape + int get_skew(glyph *, int, int); // A rectangle represents the shape // of the given glyph (arg1) at the given point size // (arg2). For slanted fonts like Times-Italic, the // optical vertical axis is naturally slanted. The @@ -208,27 +160,27 @@ int has_ligature(int); // Return a non-zero value if this font has // the given ligature type (one of LIG_ff, LIG_fi, // etc.), 0 otherwise. - int get_italic_correction(glyph, int); // If the given glyph (arg1) + int get_italic_correction(glyph *, int); // If the given glyph (arg1) // at the given point size (arg2) is followed by an // unslanted glyph, some horizontal white space may // need to be inserted in between. See the groff // manual, description of \/. Return the amount // (width) of this white space. - int get_left_italic_correction(glyph, int); // If the given glyph (arg1) + int get_left_italic_correction(glyph *, int); // If the given glyph (arg1) // at the given point size (arg2) is preceded by an // unslanted roman glyph, some horizontal white // space may need to be inserted in between. See // the groff manual, description of \,. Return the // amount (width) of this white space. - int get_subscript_correction(glyph, int); // If the given glyph (arg1) + int get_subscript_correction(glyph *, int); // If the given glyph (arg1) // at the given point size (arg2)is followed by a // subscript glyph, the horizontal position may need // to be advanced by some (possibly negative) // amount. See groff manual, description of \w and // the `ssc' register. Return this amount. - int get_code(glyph); // Return the code point in the physical + int get_code(glyph *); // Return the code point in the physical // font of the given glyph. - const char *get_special_device_encoding(glyph); // Return special + const char *get_special_device_encoding(glyph *); // Return special // device dependent information about the given // glyph. Return NULL if there is no special // information. @@ -340,18 +292,18 @@ // pairs. // These methods add new characters to the ch_index[] and ch[] arrays. - void add_entry(glyph, // glyph + void add_entry(glyph *, // glyph const font_char_metric &); // metric - void copy_entry(glyph, // new_glyph - glyph); // old_glyph + void copy_entry(glyph *, // new_glyph + glyph *); // old_glyph void alloc_ch_index(int); // index void extend_ch(); void compact(); - void add_kern(glyph, glyph, int); // Add to the kerning table a + void add_kern(glyph *, glyph *, int); // Add to the kerning table a // kerning amount (arg3) between two given glyphs // (arg1 and arg2). - static int hash_kern(glyph, glyph); // Return a hash code for + static int hash_kern(glyph *, glyph *); // Return a hash code for // the pair of glyphs (arg1 and arg2). /* Returns w * pointsize / unitwidth, rounded to the nearest integer. */ diff -r -c3 groff-20060217.orig/src/include/printer.h groff-20060217/src/include/printer.h --- groff-20060217.orig/src/include/printer.h 2006-02-13 13:00:19.000000000 +0100 +++ groff-20060217/src/include/printer.h 2006-02-19 14:12:48.000000000 +0100 @@ -66,7 +66,7 @@ void set_ascii_char(unsigned char, const environment *, int * = 0); void set_special_char(const char *, const environment *, int * = 0); virtual void set_numbered_char(int, const environment *, int * = 0); - glyph set_char_and_width(const char *, const environment *, int *, font **); + glyph *set_char_and_width(const char *, const environment *, int *, font **); font *get_font_from_index(int); virtual void draw(int, int *, int, const environment *); // perform change of line color (text, outline) in the print-out @@ -94,7 +94,7 @@ private: font *find_font(const char *); - virtual void set_char(glyph, font *, const environment *, int, + virtual void set_char(glyph *, font *, const environment *, int, const char *) = 0; }; diff -r -c3 groff-20060217.orig/src/libs/libdriver/printer.cpp groff-20060217/src/libs/libdriver/printer.cpp --- groff-20060217.orig/src/libs/libdriver/printer.cpp 2006-02-17 18:21:45.000000000 +0100 +++ groff-20060217/src/libs/libdriver/printer.cpp 2006-02-19 14:12:48.000000000 +0100 @@ -182,7 +182,7 @@ buf[0] = c; buf[1] = '\0'; - glyph g = set_char_and_width(buf, env, &w, &f); + glyph *g = set_char_and_width(buf, env, &w, &f); set_char(g, f, env, w, 0); if (widthp) { *widthp = w; @@ -194,7 +194,7 @@ { font *f; int w; - glyph g = set_char_and_width(nm, env, &w, &f); + glyph *g = set_char_and_width(nm, env, &w, &f); if (g != UNDEFINED_GLYPH) { set_char(g, f, env, w, nm); if (widthp) @@ -202,10 +202,10 @@ } } -glyph printer::set_char_and_width(const char *nm, const environment *env, - int *widthp, font **f) +glyph *printer::set_char_and_width(const char *nm, const environment *env, + int *widthp, font **f) { - glyph g = name_to_glyph(nm); + glyph *g = name_to_glyph(nm); int fn = env->fontno; if (fn < 0 || fn >= nfonts) { error("bad font position `%1'", fn); @@ -235,7 +235,7 @@ void printer::set_numbered_char(int num, const environment *env, int *widthp) { - glyph g = number_to_glyph(num); + glyph *g = number_to_glyph(num); int fn = env->fontno; if (fn < 0 || fn >= nfonts) { error("bad font position `%1'", fn); diff -r -c3 groff-20060217.orig/src/libs/libgroff/font.cpp groff-20060217/src/libs/libgroff/font.cpp --- groff-20060217.orig/src/libs/libgroff/font.cpp 2006-02-17 18:21:45.000000000 +0100 +++ groff-20060217/src/libs/libgroff/font.cpp 2006-02-19 14:12:48.000000000 +0100 @@ -47,12 +47,12 @@ }; struct font_kern_list { - glyph glyph1; - glyph glyph2; + glyph *glyph1; + glyph *glyph2; int amount; font_kern_list *next; - font_kern_list(glyph, glyph, int, font_kern_list * = 0); + font_kern_list(glyph *, glyph *, int, font_kern_list * = 0); }; struct font_widths_cache { @@ -239,15 +239,15 @@ return 0; } -int font::get_skew(glyph g, int point_size, int sl) +int font::get_skew(glyph *g, int point_size, int sl) { int h = get_height(g, point_size); return int(h * tan((slant + sl) * PI / 180.0) + .5); } -int font::contains(glyph g) +int font::contains(glyph *g) { - int idx = g.glyph_index(); + int idx = glyph_to_index(g); assert(idx >= 0); return idx < nindices && ch_index[idx] >= 0; } @@ -271,9 +271,9 @@ a_delete width; } -int font::get_width(glyph g, int point_size) +int font::get_width(glyph *g, int point_size) { - int idx = g.glyph_index(); + int idx = glyph_to_index(g); assert(idx >= 0 && idx < nindices); int i = ch_index[idx]; assert(i >= 0); @@ -303,37 +303,37 @@ return w; } -int font::get_height(glyph g, int point_size) +int font::get_height(glyph *g, int point_size) { - int idx = g.glyph_index(); + int idx = glyph_to_index(g); assert(idx >= 0 && idx < nindices && ch_index[idx] >= 0); return scale(ch[ch_index[idx]].height, point_size); } -int font::get_depth(glyph g, int point_size) +int font::get_depth(glyph *g, int point_size) { - int idx = g.glyph_index(); + int idx = glyph_to_index(g); assert(idx >= 0 && idx < nindices && ch_index[idx] >= 0); return scale(ch[ch_index[idx]].depth, point_size); } -int font::get_italic_correction(glyph g, int point_size) +int font::get_italic_correction(glyph *g, int point_size) { - int idx = g.glyph_index(); + int idx = glyph_to_index(g); assert(idx >= 0 && idx < nindices && ch_index[idx] >= 0); return scale(ch[ch_index[idx]].italic_correction, point_size); } -int font::get_left_italic_correction(glyph g, int point_size) +int font::get_left_italic_correction(glyph *g, int point_size) { - int idx = g.glyph_index(); + int idx = glyph_to_index(g); assert(idx >= 0 && idx < nindices && ch_index[idx] >= 0); return scale(ch[ch_index[idx]].pre_math_space, point_size); } -int font::get_subscript_correction(glyph g, int point_size) +int font::get_subscript_correction(glyph *g, int point_size) { - int idx = g.glyph_index(); + int idx = glyph_to_index(g); assert(idx >= 0 && idx < nindices && ch_index[idx] >= 0); return scale(ch[ch_index[idx]].subscript_correction, point_size); } @@ -343,19 +343,19 @@ return scale(space_width, point_size); } -font_kern_list::font_kern_list(glyph g1, glyph g2, int n, font_kern_list *p) +font_kern_list::font_kern_list(glyph *g1, glyph *g2, int n, font_kern_list *p) : glyph1(g1), glyph2(g2), amount(n), next(p) { } -inline int font::hash_kern(glyph g1, glyph g2) +inline int font::hash_kern(glyph *g1, glyph *g2) { - int n = ((g1.glyph_index() << 10) + g2.glyph_index()) + int n = ((glyph_to_index(g1) << 10) + glyph_to_index(g2)) % KERN_HASH_TABLE_SIZE; return n < 0 ? -n : n; } -void font::add_kern(glyph g1, glyph g2, int amount) +void font::add_kern(glyph *g1, glyph *g2, int amount) { if (!kern_hash_table) { kern_hash_table = new font_kern_list *[int(KERN_HASH_TABLE_SIZE)]; @@ -366,7 +366,7 @@ *p = new font_kern_list(g1, g2, amount, *p); } -int font::get_kern(glyph g1, glyph g2, int point_size) +int font::get_kern(glyph *g1, glyph *g2, int point_size) { if (kern_hash_table) { for (font_kern_list *p = kern_hash_table[hash_kern(g1, g2)]; p; @@ -382,16 +382,16 @@ return mask & ligatures; } -int font::get_character_type(glyph g) +int font::get_character_type(glyph *g) { - int idx = g.glyph_index(); + int idx = glyph_to_index(g); assert(idx >= 0 && idx < nindices && ch_index[idx] >= 0); return ch[ch_index[idx]].type; } -int font::get_code(glyph g) +int font::get_code(glyph *g) { - int idx = g.glyph_index(); + int idx = glyph_to_index(g); assert(idx >= 0 && idx < nindices && ch_index[idx] >= 0); return ch[ch_index[idx]].code; } @@ -406,9 +406,9 @@ return internalname; } -const char *font::get_special_device_encoding(glyph g) +const char *font::get_special_device_encoding(glyph *g) { - int idx = g.glyph_index(); + int idx = glyph_to_index(g); assert(idx >= 0 && idx < nindices && ch_index[idx] >= 0); return ch[ch_index[idx]].special_device_coding; } @@ -479,9 +479,9 @@ } } -void font::add_entry(glyph g, const font_char_metric &metric) +void font::add_entry(glyph *g, const font_char_metric &metric) { - int idx = g.glyph_index(); + int idx = glyph_to_index(g); assert(idx >= 0); if (idx >= nindices) alloc_ch_index(idx); @@ -493,10 +493,10 @@ ch[ch_used++] = metric; } -void font::copy_entry(glyph new_glyph, glyph old_glyph) +void font::copy_entry(glyph *new_glyph, glyph *old_glyph) { - int new_index = new_glyph.glyph_index(); - int old_index = old_glyph.glyph_index(); + int new_index = glyph_to_index(new_glyph); + int old_index = glyph_to_index(old_glyph); assert(new_index >= 0 && old_index >= 0 && old_index < nindices); if (new_index >= nindices) alloc_ch_index(new_index); @@ -693,15 +693,14 @@ t.error("bad kern amount `%1'", p); return 0; } - glyph g1 = name_to_glyph(c1); - glyph g2 = name_to_glyph(c2); + glyph *g1 = name_to_glyph(c1); + glyph *g2 = name_to_glyph(c2); add_kern(g1, g2, n); } } else if (strcmp(command, "charset") == 0) { had_charset = 1; - glyph last_glyph; - int got_last_glyph = 0; + glyph *last_glyph = NULL; for (;;) { if (!t.next()) { command = 0; @@ -716,7 +715,7 @@ break; } if (p[0] == '"') { - if (!got_last_glyph) { + if (last_glyph == NULL) { t.error("first charset entry is duplicate"); return 0; } @@ -724,7 +723,7 @@ t.error("unnamed character cannot be duplicate"); return 0; } - glyph g = name_to_glyph(nm); + glyph *g = name_to_glyph(nm); copy_entry(g, last_glyph); } else { @@ -787,10 +786,9 @@ add_entry(last_glyph, metric); copy_entry(number_to_glyph(metric.code), last_glyph); } - got_last_glyph = 1; } } - if (!got_last_glyph) { + if (last_glyph == NULL) { t.error("I didn't seem to find any characters"); return 0; } diff -r -c3 groff-20060217.orig/src/libs/libgroff/nametoindex.cpp groff-20060217/src/libs/libgroff/nametoindex.cpp --- groff-20060217.orig/src/libs/libgroff/nametoindex.cpp 2006-02-17 18:21:45.000000000 +0100 +++ groff-20060217/src/libs/libgroff/nametoindex.cpp 2006-02-19 14:12:48.000000000 +0100 @@ -31,12 +31,10 @@ #include "itable.h" // Every glyphinfo is actually a charinfo. -class charinfo : glyphinfo { -private: - const char *name; // The glyph name, or NULL. +class charinfo : glyph { public: + const char *name; // The glyph name, or NULL. friend class character_indexer; - friend class glyph; }; // PTABLE(charinfo) is a hash table mapping `const char *' to `charinfo *'. @@ -54,17 +52,17 @@ character_indexer(); ~character_indexer(); // --------------------- Lookup or creation of a glyph. - glyph ascii_char_glyph(unsigned char); - glyph named_char_glyph(const char *); - glyph numbered_char_glyph(int); + glyph *ascii_char_glyph(unsigned char); + glyph *named_char_glyph(const char *); + glyph *numbered_char_glyph(int); private: int next_index; // Number of glyphs already allocated. PTABLE(charinfo) table; // Table mapping name to glyph. - glyph ascii_glyph[256]; // Shorthand table for looking up "charNNN" + glyph *ascii_glyph[256]; // Shorthand table for looking up "charNNN" // glyphs. ITABLE(charinfo) ntable; // Table mapping number to glyph. enum { NSMALL = 256 }; - glyph small_number_glyph[NSMALL]; // Shorthand table for looking up + glyph *small_number_glyph[NSMALL]; // Shorthand table for looking up // numbered glyphs with small numbers. }; @@ -82,7 +80,7 @@ { } -glyph character_indexer::ascii_char_glyph(unsigned char c) +glyph *character_indexer::ascii_char_glyph(unsigned char c) { if (ascii_glyph[c] == UNDEFINED_GLYPH) { char buf[4+3+1]; @@ -92,12 +90,12 @@ ci->index = next_index++; ci->number = -1; ci->name = strsave(buf); - ascii_glyph[c] = glyph(ci); + ascii_glyph[c] = ci; } return ascii_glyph[c]; } -inline glyph character_indexer::named_char_glyph(const char *s) +inline glyph *character_indexer::named_char_glyph(const char *s) { // Glyphs with name `charNNN' are only stored in ascii_glyph[], not // in the table. Therefore treat them specially here. @@ -114,10 +112,10 @@ ci->number = -1; ci->name = table.define(s, ci); } - return glyph(ci); + return ci; } -inline glyph character_indexer::numbered_char_glyph(int n) +inline glyph *character_indexer::numbered_char_glyph(int n) { if (n >= 0 && n < NSMALL) { if (small_number_glyph[n] == UNDEFINED_GLYPH) { @@ -125,7 +123,7 @@ ci->index = next_index++; ci->number = n; ci->name = NULL; - small_number_glyph[n] = glyph(ci); + small_number_glyph[n] = ci; } return small_number_glyph[n]; } @@ -137,17 +135,17 @@ ci->name = NULL; ntable.define(n, ci); } - return glyph(ci); + return ci; } static character_indexer indexer; -glyph number_to_glyph(int n) +glyph *number_to_glyph(int n) { return indexer.numbered_char_glyph(n); } -glyph name_to_glyph(const char *s) +glyph *name_to_glyph(const char *s) { assert(s != 0 && s[0] != '\0' && s[0] != ' '); if (s[1] == '\0') @@ -156,8 +154,8 @@ return indexer.named_char_glyph(s); } -const char *glyph::glyph_name() +const char *glyph_to_name(glyph *g) { - charinfo *ci = (charinfo *)ptr; // Every glyphinfo is actually a charinfo. + charinfo *ci = (charinfo *)g; // Every glyph is actually a charinfo. return ci->name; } diff -r -c3 groff-20060217.orig/src/roff/troff/charinfo.h groff-20060217/src/roff/troff/charinfo.h --- groff-20060217.orig/src/roff/troff/charinfo.h 2006-02-17 18:21:45.000000000 +0100 +++ groff-20060217/src/roff/troff/charinfo.h 2006-02-19 14:12:48.000000000 +0100 @@ -21,7 +21,7 @@ class macro; -class charinfo : glyphinfo { +class charinfo : glyph { static int next_index; charinfo *translation; macro *mac; @@ -55,7 +55,7 @@ }; symbol nm; charinfo(symbol s); - glyph as_glyph(); + glyph *as_glyph(); int ends_sentence(); int overlaps_vertically(); int overlaps_horizontally(); @@ -169,9 +169,9 @@ flags = c; } -inline glyph charinfo::as_glyph() +inline glyph *charinfo::as_glyph() { - return glyph(this); + return this; } inline void charinfo::set_translation_input() diff -r -c3 groff-20060217.orig/src/roff/troff/input.cpp groff-20060217/src/roff/troff/input.cpp --- groff-20060217.orig/src/roff/troff/input.cpp 2006-02-17 18:21:45.000000000 +0100 +++ groff-20060217/src/roff/troff/input.cpp 2006-02-19 14:12:48.000000000 +0100 @@ -8195,7 +8195,7 @@ } } -glyph name_to_glyph(const char *nm) +glyph *name_to_glyph(const char *nm) { charinfo *ci; if (nm[1] == 0) @@ -8207,13 +8207,13 @@ return ci->as_glyph(); } -glyph number_to_glyph(int n) +glyph *number_to_glyph(int n) { return get_charinfo_by_number(n)->as_glyph(); } -const char *glyph::glyph_name() +const char *glyph_to_name(glyph *g) { - charinfo *ci = (charinfo *)ptr; // Every glyphinfo is actually a charinfo. + charinfo *ci = (charinfo *)g; // Every glyph is actually a charinfo. return (ci->nm != UNNAMED_SYMBOL ? ci->nm.contents() : NULL); } diff -r -c3 groff-20060217.orig/src/devices/grodvi/dvi.cpp groff-20060217/src/devices/grodvi/dvi.cpp --- groff-20060217.orig/src/devices/grodvi/dvi.cpp 2006-02-13 13:00:19.000000000 +0100 +++ groff-20060217/src/devices/grodvi/dvi.cpp 2006-02-19 14:12:48.000000000 +0100 @@ -175,7 +175,7 @@ font *make_font(const char *); void begin_page(int); void end_page(int); - void set_char(glyph, font *, const environment *, int, const char *); + void set_char(glyph *, font *, const environment *, int, const char *); void special(char *, const environment *, char); void end_of_line(); void draw(int, int *, int, const environment *); @@ -340,7 +340,7 @@ do_special(buf); } -void dvi_printer::set_char(glyph g, font *f, const environment *env, +void dvi_printer::set_char(glyph *g, font *f, const environment *env, int w, const char *) { if (*env->col != cur_color) diff -r -c3 groff-20060217.orig/src/devices/grohtml/post-html.cpp groff-20060217/src/devices/grohtml/post-html.cpp --- groff-20060217.orig/src/devices/grohtml/post-html.cpp 2006-02-17 18:21:45.000000000 +0100 +++ groff-20060217/src/devices/grohtml/post-html.cpp 2006-02-19 14:12:48.000000000 +0100 @@ -1417,7 +1417,7 @@ if (html_glyph) html_string += html_glyph; else { - glyph g = name_to_glyph((troff_charname + '\0').contents()); + glyph *g = name_to_glyph((troff_charname + '\0').contents()); if (s->f->contains(g)) html_string += s->f->get_code(g); } @@ -1938,7 +1938,7 @@ files file_list; simple_output html; int res; - glyph space_glyph; + glyph *space_glyph; int space_width; int no_of_printed_pages; int paper_length; @@ -2009,9 +2009,9 @@ void set_line_thickness (const environment *); void terminate_current_font (void); void flush_font (void); - void add_to_sbuf (glyph g, const string &s); + void add_to_sbuf (glyph *g, const string &s); void write_title (int in_head); - int sbuf_continuation (glyph g, const char *name, const environment *env, int w); + int sbuf_continuation (glyph *g, const char *name, const environment *env, int w); void flush_page (void); void troff_tag (text_glob *g); void flush_globs (void); @@ -2062,7 +2062,7 @@ void outstanding_eol (int n); int is_bold (font *f); font *make_bold (font *f); - int overstrike (glyph g, const char *name, const environment *env, int w); + int overstrike (glyph *g, const char *name, const environment *env, int w); void do_body (void); int next_horiz_pos (text_glob *g, int nf); void lookahead_for_tables (void); @@ -2100,9 +2100,9 @@ public: html_printer (); ~html_printer (); - void set_char (glyph g, font *f, const environment *env, int w, const char *name); + void set_char (glyph *g, font *f, const environment *env, int w, const char *name); void set_numbered_char(int num, const environment *env, int *widthp); - glyph set_char_and_width(const char *nm, const environment *env, + glyph *set_char_and_width(const char *nm, const environment *env, int *widthp, font **f); void draw (int code, int *p, int np, const environment *env); void begin_page (int); @@ -4234,7 +4234,7 @@ * add_to_sbuf - adds character code or name to the sbuf. */ -void html_printer::add_to_sbuf (glyph g, const string &s) +void html_printer::add_to_sbuf (glyph *g, const string &s) { if (sbuf_style.f == NULL) return; @@ -4260,7 +4260,7 @@ sbuf += html_glyph; } -int html_printer::sbuf_continuation (glyph g, const char *name, +int html_printer::sbuf_continuation (glyph *g, const char *name, const environment *env, int w) { /* @@ -4302,7 +4302,7 @@ if ((f == 0) || name.empty()) return NULL; else { - glyph g = name_to_glyph((char *)(name + '\0').contents()); + glyph *g = name_to_glyph((char *)(name + '\0').contents()); if (f->contains(g)) return get_html_entity(f->get_code(g)); else @@ -4576,7 +4576,7 @@ * is flushed. */ -int html_printer::overstrike(glyph g, const char *name, const environment *env, int w) +int html_printer::overstrike(glyph *g, const char *name, const environment *env, int w) { if ((env->hpos < sbuf_end_hpos) || ((sbuf_kern != 0) && (sbuf_end_hpos - sbuf_kern < env->hpos))) { @@ -4609,7 +4609,7 @@ * and add character anew. */ -void html_printer::set_char(glyph g, font *f, const environment *env, +void html_printer::set_char(glyph *g, font *f, const environment *env, int w, const char *name) { style sty(f, env->size, env->height, env->slant, env->fontno, *env->col); @@ -4650,7 +4650,7 @@ nbsp_width = -num; num = 160; // } - glyph g = number_to_glyph(num); + glyph *g = number_to_glyph(num); int fn = env->fontno; if (fn < 0 || fn >= nfonts) { error("bad font position `%1'", fn); @@ -4678,10 +4678,10 @@ set_char(g, f, env, w, 0); } -glyph html_printer::set_char_and_width(const char *nm, const environment *env, - int *widthp, font **f) +glyph *html_printer::set_char_and_width(const char *nm, const environment *env, + int *widthp, font **f) { - glyph g = name_to_glyph(nm); + glyph *g = name_to_glyph(nm); int fn = env->fontno; if (fn < 0 || fn >= nfonts) { error("bad font position `%1'", fn); diff -r -c3 groff-20060217.orig/src/devices/grolbp/lbp.cpp groff-20060217/src/devices/grolbp/lbp.cpp --- groff-20060217.orig/src/devices/grolbp/lbp.cpp 2006-02-13 13:00:19.000000000 +0100 +++ groff-20060217/src/devices/grolbp/lbp.cpp 2006-02-19 14:12:48.000000000 +0100 @@ -63,7 +63,7 @@ public: lbp_printer(int, double, double); ~lbp_printer(); - void set_char(glyph, font *, const environment *, int, const char *name); + void set_char(glyph *, font *, const environment *, int, const char *name); void draw(int code, int *p, int np, const environment *env); void begin_page(int); void end_page(int page_length); @@ -277,7 +277,7 @@ return bfont_name; } -void lbp_printer::set_char(glyph g, font *f, const environment *env, +void lbp_printer::set_char(glyph *g, font *f, const environment *env, int w, const char *) { int code = f->get_code(g); diff -r -c3 groff-20060217.orig/src/devices/grolj4/lj4.cpp groff-20060217/src/devices/grolj4/lj4.cpp --- groff-20060217.orig/src/devices/grolj4/lj4.cpp 2006-02-13 13:00:19.000000000 +0100 +++ groff-20060217/src/devices/grolj4/lj4.cpp 2006-02-19 14:12:48.000000000 +0100 @@ -163,7 +163,7 @@ public: lj4_printer(int); ~lj4_printer(); - void set_char(glyph, font *, const environment *, int, const char *name); + void set_char(glyph *, font *, const environment *, int, const char *name); void draw(int code, int *p, int np, const environment *env); void begin_page(int); void end_page(int page_length); @@ -278,7 +278,7 @@ return c < 32 && (c == 0 || (7 <= c && c <= 15) || c == 27); } -void lj4_printer::set_char(glyph g, font *f, const environment *env, +void lj4_printer::set_char(glyph *g, font *f, const environment *env, int w, const char *) { int code = f->get_code(g); diff -r -c3 groff-20060217.orig/src/devices/grops/ps.cpp groff-20060217/src/devices/grops/ps.cpp --- groff-20060217.orig/src/devices/grops/ps.cpp 2006-02-17 18:21:45.000000000 +0100 +++ groff-20060217/src/devices/grops/ps.cpp 2006-02-19 14:12:48.000000000 +0100 @@ -524,7 +524,7 @@ FILE *tempfp; ps_output out; int res; - glyph space_glyph; + glyph *space_glyph; int pages_output; int paper_length; int equalise_spaces; @@ -563,7 +563,7 @@ void set_style(const style &); void set_space_code(unsigned char); int set_encoding_index(ps_font *); - subencoding *set_subencoding(font *, glyph, unsigned char *); + subencoding *set_subencoding(font *, glyph *, unsigned char *); char *get_subfont(subencoding *, const char *); void do_exec(char *, const environment *); void do_import(char *, const environment *); @@ -588,7 +588,7 @@ public: ps_printer(double); ~ps_printer(); - void set_char(glyph, font *, const environment *, int, const char *); + void set_char(glyph *, font *, const environment *, int, const char *); void draw(int, int *, int, const environment *); void begin_page(int); void end_page(int); @@ -656,7 +656,7 @@ return f->encoding_index = next_encoding_index++; } -subencoding *ps_printer::set_subencoding(font *f, glyph g, +subencoding *ps_printer::set_subencoding(font *f, glyph *g, unsigned char *codep) { unsigned int idx = f->get_code(g); @@ -686,7 +686,7 @@ return sub->subfont; } -void ps_printer::set_char(glyph g, font *f, const environment *env, int w, +void ps_printer::set_char(glyph *g, font *f, const environment *env, int w, const char *) { if (g == space_glyph || invis_count > 0) diff -r -c3 groff-20060217.orig/src/devices/grotty/tty.cpp groff-20060217/src/devices/grotty/tty.cpp --- groff-20060217.orig/src/devices/grotty/tty.cpp 2006-02-13 13:00:19.000000000 +0100 +++ groff-20060217/src/devices/grotty/tty.cpp 2006-02-19 14:12:48.000000000 +0100 @@ -219,7 +219,7 @@ public: tty_printer(const char *); ~tty_printer(); - void set_char(glyph, font *, const environment *, int, const char *); + 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); @@ -364,7 +364,7 @@ return idx; } -void tty_printer::set_char(glyph g, 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) _______________________________________________ Groff mailing list Groff@gnu.org http://lists.gnu.org/mailman/listinfo/groff