summaryrefslogtreecommitdiff
path: root/src/roff/troff/input.cpp
diff options
context:
space:
mode:
authorwl <wl>2006-02-17 16:23:21 +0000
committerwl <wl>2006-02-17 16:23:21 +0000
commit2d8ea136167d1a4c79fcc2eafe62f892f31a0e90 (patch)
tree542b1405b001e0641586f616d773926ff1674043 /src/roff/troff/input.cpp
parent9f9f4b09af5eb0bb1dc390d3edf5ba4423013890 (diff)
downloadgroff-2d8ea136167d1a4c79fcc2eafe62f892f31a0e90.tar.gz
* src/include/font.h (struct glyphinfo): New class.
(struct glyph): Change internal representation. Change constructor signature. New method glyph::glyph_number(). (glyph::glyph, glyph glyph::undefined_glyph, glyph::glyph_index, glyph::operator==, glyph::operator!=): Update. (font::index_to_name, font::index_to_number): New functions. * src/include/itable.h: New file, based on src/include/ptable.h. * src/libs/libgroff/nametoindex.cpp: Include itable.h. (class charinfo): New class. (class character_indexer): Change table result type from `int' to `class charinfo'. Add table with integer key. (character_indexer::character_indexer): Update. (character_indexer::ascii_char_index): Update. (character_indexer::numbered_char_index): Use NULL as name, not a string starting with a space. (character_indexer::named_char_index): Update. (font::number_to_index, font::name_to_index): Remove no-op cast. (glyph::glyph_name): New method. * src/roff/troff/charinfo.h (class charinfo): Inherit from class glyphinfo. (NUMBERED): Remove flag bit. (charinfo::numbered, charinfo::get_index): Update. * src/roff/troff/input.cpp (charinfo::charinfo): Update. (charinfo::set_number, charinfo::get_number): Update. (glyph::glyph_name): New method.
Diffstat (limited to 'src/roff/troff/input.cpp')
-rw-r--r--src/roff/troff/input.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 51d4beb8..f7f7e66f 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -8094,7 +8094,8 @@ charinfo::charinfo(symbol s)
not_found(0), transparent_translate(1), translate_input(0),
mode(CHAR_NORMAL), nm(s)
{
- index = glyph(next_index++, s.contents());
+ index = next_index++;
+ number = -1;
}
void charinfo::set_hyphenation_code(unsigned char c)
@@ -8152,13 +8153,13 @@ macro *charinfo::setx_macro(macro *m, char_mode cm)
void charinfo::set_number(int n)
{
+ assert(n >= 0);
number = n;
- flags |= NUMBERED;
}
int charinfo::get_number()
{
- assert(flags & NUMBERED);
+ assert(number >= 0);
return number;
}
@@ -8213,3 +8214,9 @@ glyph font::number_to_index(int n)
{
return get_charinfo_by_number(n)->get_index();
}
+
+const char *glyph::glyph_name()
+{
+ charinfo *ci = (charinfo *)ptr; // Every glyphinfo is actually a charinfo.
+ return (ci->nm != UNNAMED_SYMBOL ? ci->nm.contents() : NULL);
+}