2 * Copyright (c) 2014 - 2015 Steffen (Daode) Nurpmeso <sdaoden@users.sf.net>.
4 * Copyright (C) 1989 - 1992, 2001, 2002, 2006
5 * Free Software Foundation, Inc.
6 * Written by James Clark (jjc@jclark.com)
8 * This is free software; you can redistribute it and/or modify it under
9 * the terms of the GNU General Public License as published by the Free
10 * Software Foundation; either version 2, or (at your option) any later
13 * This is distributed in the hope that it will be useful, but WITHOUT ANY
14 * WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * You should have received a copy of the GNU General Public License along
19 * with groff; see the file COPYING. If not, write to the Free Software
20 * Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA.
26 #include "troff-config.h"
33 static int next_index
;
35 charinfo
*translation
;
37 unsigned char special_translation
;
38 unsigned char hyphenation_code
;
40 unsigned char ascii_code
;
41 unsigned char asciify_code
;
43 char transparent_translate
; // non-zero means translation applies
44 // to transparent throughput
45 char translate_input
; // non-zero means that asciify_code is
46 // active for .asciify (set by .trin)
50 enum { // Values for the flags bitmask. See groff
51 // manual, description of the `.cflags' request.
55 OVERLAPS_HORIZONTALLY
= 8,
56 OVERLAPS_VERTICALLY
= 16,
64 TRANSLATE_STRETCHABLE_SPACE
,
65 TRANSLATE_HYPHEN_INDICATOR
73 int overlaps_vertically();
74 int overlaps_horizontally();
75 int can_break_before();
76 int can_break_after();
79 unsigned char get_hyphenation_code();
80 unsigned char get_ascii_code();
81 unsigned char get_asciify_code();
82 void set_hyphenation_code(unsigned char);
83 void set_ascii_code(unsigned char);
84 void set_asciify_code(unsigned char);
85 void set_translation_input();
86 int get_translation_input();
87 charinfo
*get_translation(int = 0);
88 void set_translation(charinfo
*, int, int);
89 void set_flags(unsigned char);
90 void set_special_translation(int, int);
91 int get_special_translation(int = 0);
92 macro
*set_macro(macro
*);
93 macro
*setx_macro(macro
*, char_mode
);
95 int first_time_not_found();
102 symbol
*get_symbol();
105 charinfo
*get_charinfo(symbol
);
106 extern charinfo
*charset_table
[];
107 charinfo
*get_charinfo_by_number(int);
109 inline int charinfo::overlaps_horizontally()
111 return flags
& OVERLAPS_HORIZONTALLY
;
114 inline int charinfo::overlaps_vertically()
116 return flags
& OVERLAPS_VERTICALLY
;
119 inline int charinfo::can_break_before()
121 return flags
& BREAK_BEFORE
;
124 inline int charinfo::can_break_after()
126 return flags
& BREAK_AFTER
;
129 inline int charinfo::ends_sentence()
131 return flags
& ENDS_SENTENCE
;
134 inline int charinfo::transparent()
136 return flags
& TRANSPARENT
;
139 inline int charinfo::ignore_hcodes()
141 return flags
& IGNORE_HCODES
;
144 inline int charinfo::numbered()
149 inline int charinfo::is_normal()
151 return mode
== CHAR_NORMAL
;
154 inline int charinfo::is_fallback()
156 return mode
== CHAR_FALLBACK
;
159 inline int charinfo::is_special()
161 return mode
== CHAR_SPECIAL
;
164 inline charinfo
*charinfo::get_translation(int transparent_throughput
)
166 return (transparent_throughput
&& !transparent_translate
171 inline unsigned char charinfo::get_hyphenation_code()
173 return hyphenation_code
;
176 inline unsigned char charinfo::get_ascii_code()
181 inline unsigned char charinfo::get_asciify_code()
183 return (translate_input
? asciify_code
: 0);
186 inline void charinfo::set_flags(unsigned char c
)
191 inline glyph
*charinfo::as_glyph()
196 inline void charinfo::set_translation_input()
201 inline int charinfo::get_translation_input()
203 return translate_input
;
206 inline int charinfo::get_special_translation(int transparent_throughput
)
208 return (transparent_throughput
&& !transparent_translate
209 ? int(TRANSLATE_NONE
)
210 : special_translation
);
213 inline macro
*charinfo::get_macro()
218 inline int charinfo::first_time_not_found()
228 inline symbol
*charinfo::get_symbol()
233 #endif // _CHARINFO_H