1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-12 23:10:51 +00:00

[renderer] enum link_state -> link_state_T, enum color_flags -> color_flags_T

This commit is contained in:
Witold Filipczyk 2022-01-28 16:11:54 +01:00
parent 349a27238f
commit 09e7b73a41
5 changed files with 22 additions and 18 deletions

View File

@ -63,6 +63,8 @@ enum link_state {
LINK_STATE_SAME,
};
typedef unsigned char link_state_T;
struct table_cache_entry_key {
char *start;
char *end;
@ -102,7 +104,7 @@ static void put_chars(struct html_context *, char *, int);
static inline void
set_screen_char_color(struct screen_char *schar,
color_T bgcolor, color_T fgcolor,
enum color_flags color_flags,
color_flags_T color_flags,
color_mode_T color_mode)
{
struct color_pair colors = INIT_COLOR_PAIR(bgcolor, fgcolor);
@ -245,7 +247,7 @@ get_frame_char(struct html_context *html_context, struct part *part,
static inline struct screen_char *
get_format_screen_char(struct html_context *html_context,
enum link_state link_state)
link_state_T link_state)
{
static struct text_style ta_cache = INIT_TEXT_STYLE(-1, 0x0, 0x0);
static struct screen_char schar_cache;
@ -469,7 +471,7 @@ put_combined(struct part *part, int x)
* to use since sub- or superscript might change them */
static inline int
set_hline(struct html_context *html_context, char *chars, int charslen,
enum link_state link_state)
link_state_T link_state)
{
struct part *const part = html_context->part;
struct screen_char *const schar = get_format_screen_char(html_context,
@ -749,7 +751,7 @@ good_char:
* to use since sub- or superscript might change them */
static inline void
set_hline(struct html_context *html_context, char *chars, int charslen,
enum link_state link_state)
link_state_T link_state)
{
struct part *part = html_context->part;
struct screen_char *schar = get_format_screen_char(html_context,
@ -1690,11 +1692,11 @@ done_link_state_info(void)
#ifdef CONFIG_UTF8
static inline void
process_link(struct html_context *html_context, enum link_state link_state,
process_link(struct html_context *html_context, link_state_T link_state,
char *chars, int charslen, int cells)
#else
static inline void
process_link(struct html_context *html_context, enum link_state link_state,
process_link(struct html_context *html_context, link_state_T link_state,
char *chars, int charslen)
#endif /* CONFIG_UTF8 */
{
@ -1792,10 +1794,10 @@ process_link(struct html_context *html_context, enum link_state link_state,
}
}
static inline enum link_state
static inline link_state_T
get_link_state(struct html_context *html_context)
{
enum link_state state;
link_state_T state;
if (!(elformat.link || elformat.image || elformat.form)) {
state = LINK_STATE_NONE;
@ -1834,7 +1836,7 @@ html_has_non_space_chars(char *chars, int charslen)
static void
put_chars(struct html_context *html_context, char *chars, int charslen)
{
enum link_state link_state;
link_state_T link_state;
struct part *part;
#ifdef CONFIG_UTF8
int cells;
@ -2208,7 +2210,7 @@ color_link_lines(struct html_context *html_context)
struct document *document = html_context->part->document;
struct color_pair colors = INIT_COLOR_PAIR(par_elformat.color.background, 0x0);
color_mode_T color_mode = document->options.color_mode;
enum color_flags color_flags = document->options.color_flags;
color_flags_T color_flags = document->options.color_flags;
int y;
for (y = 0; y < document->height; y++) {

View File

@ -72,7 +72,7 @@ struct document_options {
unsigned int use_link_number_color:1;
/** Color model/optimizations */
enum color_flags color_flags;
color_flags_T color_flags;
/* XXX: Keep boolean options grouped to save padding */
#ifdef CONFIG_CSS

View File

@ -242,7 +242,7 @@ static const char fg_color[16][8] = {
#define use_inverse(bg, fg) CMPCODE(fg & TERM_COLOR_MASK) < CMPCODE(bg)
NONSTATIC_INLINE void
set_term_color16(struct screen_char *schar, enum color_flags flags,
set_term_color16(struct screen_char *schar, color_flags_T flags,
unsigned char fg, unsigned char bg)
{
/* Adjusts the foreground color to be more visible. */
@ -321,7 +321,7 @@ get_term_color256(unsigned int index)
void
get_screen_char_color(struct screen_char *schar, struct color_pair *pair,
enum color_flags flags, color_mode_T color_mode)
color_flags_T flags, color_mode_T color_mode)
{
unsigned char fg, bg;
@ -376,7 +376,7 @@ get_screen_char_color(struct screen_char *schar, struct color_pair *pair,
void
set_term_color(struct screen_char *schar, struct color_pair *pair,
enum color_flags flags, color_mode_T color_mode)
color_flags_T flags, color_mode_T color_mode)
{
const struct color_mode_info *mode;
enum palette_range palette_range = PALETTE_FULL;

View File

@ -45,6 +45,8 @@ enum color_flags {
COLOR_ENSURE_INVERTED_CONTRAST = 16,
};
typedef unsigned char color_flags_T;
/** How many colors the terminal supports.
* These numbers are used in the terminal._template_.colors and
* document.dump.color_mode options. They should be kept stable so
@ -70,7 +72,7 @@ enum color_mode {
typedef int color_mode_T;
void set_term_color16(struct screen_char *schar, enum color_flags flags,
void set_term_color16(struct screen_char *schar, color_flags_T flags,
unsigned char fg, unsigned char bg);
/** Mixes the color pair and attributes to a terminal text color.
@ -89,9 +91,9 @@ color_T get_term_color256(unsigned int index);
#endif
void get_screen_char_color(struct screen_char *schar, struct color_pair *pair,
enum color_flags flags, color_mode_T color_mode);
color_flags_T flags, color_mode_T color_mode);
void set_term_color(struct screen_char *schar, struct color_pair *pair,
enum color_flags flags, color_mode_T mode);
color_flags_T flags, color_mode_T mode);
#ifdef __cplusplus
}

View File

@ -170,7 +170,7 @@ init_link_drawing(struct document_view *doc_view, struct link *link, int invert,
{
struct document_options *doc_opts;
static struct screen_char template_;
enum color_flags color_flags;
color_flags_T color_flags;
color_mode_T color_mode;
struct color_pair colors;