1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-07-26 16:45:12 -04:00

Reorganisation of code to make C++ happy

This commit is contained in:
Witold Filipczyk 2016-04-20 21:23:55 +02:00
parent da15322705
commit 257422f28c
20 changed files with 354 additions and 323 deletions

View File

@ -797,9 +797,136 @@ register_autocreated_options(void)
#endif
}
static union option_info config_options_info[];
extern union option_info cmdline_options_info[];
static const struct change_hook_info change_hooks[];
#include "config/options.inc"
static int
change_hook_cache(struct session *ses, struct option *current, struct option *changed)
{
shrink_memory(0);
return 0;
}
static int
change_hook_connection(struct session *ses, struct option *current, struct option *changed)
{
register_check_queue();
return 0;
}
static int
change_hook_html(struct session *ses, struct option *current, struct option *changed)
{
foreach (ses, sessions) ses->tab->resize = 1;
return 0;
}
static int
change_hook_insert_mode(struct session *ses, struct option *current, struct option *changed)
{
update_status();
return 0;
}
static int
change_hook_active_link(struct session *ses, struct option *current, struct option *changed)
{
update_cached_document_options(ses);
return 0;
}
static int
change_hook_terminal(struct session *ses, struct option *current, struct option *changed)
{
cls_redraw_all_terminals();
return 0;
}
static int
change_hook_ui(struct session *ses, struct option *current, struct option *changed)
{
update_status();
return 0;
}
/** Make option templates visible or invisible in the option manager.
* This is called once on startup, and then each time the value of the
* "config.show_template" option is changed.
*
* @param tree
* The option tree whose children should be affected.
*
* @param show
* A set of bits:
* - The 0x01 bit means templates should be made visible.
* If the bit is clear, templates become invisible instead.
* - The 0x02 bit means @a tree is itself part of a template,
* and so all of its children should be affected, regardless
* of whether they are templates of their own.
*
* Deleted options are never visible.
*
* @relates option */
static void
update_visibility(LIST_OF(struct option) *tree, int show)
{
struct option *opt;
foreach (opt, *tree) {
if (opt->flags & OPT_DELETED) continue;
if (!strcmp(opt->name, "_template_")) {
if (opt->box_item)
opt->box_item->visible = (show & 1);
if (opt->type == OPT_TREE)
update_visibility(opt->value.tree, show | 2);
} else {
if (opt->box_item && (show & 2))
opt->box_item->visible = (show & 1);
if (opt->type == OPT_TREE)
update_visibility(opt->value.tree, show);
}
}
}
static int
change_hook_stemplate(struct session *ses, struct option *current, struct option *changed)
{
update_visibility(config_options->value.tree, changed->value.number);
return 0;
}
static int
change_hook_language(struct session *ses, struct option *current, struct option *changed)
{
#ifdef CONFIG_NLS
set_language(changed->value.number);
#endif
return 0;
}
static const struct change_hook_info change_hooks[] = {
{ "config.show_template", change_hook_stemplate },
{ "connection", change_hook_connection },
{ "document.browse", change_hook_html },
{ "document.browse.forms.insert_mode",
change_hook_insert_mode },
{ "document.browse.links.active_link",
change_hook_active_link },
{ "document.cache", change_hook_cache },
{ "document.codepage", change_hook_html },
{ "document.colors", change_hook_html },
{ "document.html", change_hook_html },
{ "document.plain", change_hook_html },
{ "terminal", change_hook_terminal },
{ "ui.language", change_hook_language },
{ "ui", change_hook_ui },
{ NULL, NULL },
};
void
init_options(void)
@ -1006,98 +1133,6 @@ smart_config_string(struct string *str, int print_comment, int i18n,
}
static int
change_hook_cache(struct session *ses, struct option *current, struct option *changed)
{
shrink_memory(0);
return 0;
}
static int
change_hook_connection(struct session *ses, struct option *current, struct option *changed)
{
register_check_queue();
return 0;
}
static int
change_hook_html(struct session *ses, struct option *current, struct option *changed)
{
foreach (ses, sessions) ses->tab->resize = 1;
return 0;
}
static int
change_hook_insert_mode(struct session *ses, struct option *current, struct option *changed)
{
update_status();
return 0;
}
static int
change_hook_active_link(struct session *ses, struct option *current, struct option *changed)
{
update_cached_document_options(ses);
return 0;
}
static int
change_hook_terminal(struct session *ses, struct option *current, struct option *changed)
{
cls_redraw_all_terminals();
return 0;
}
static int
change_hook_ui(struct session *ses, struct option *current, struct option *changed)
{
update_status();
return 0;
}
/** Make option templates visible or invisible in the option manager.
* This is called once on startup, and then each time the value of the
* "config.show_template" option is changed.
*
* @param tree
* The option tree whose children should be affected.
*
* @param show
* A set of bits:
* - The 0x01 bit means templates should be made visible.
* If the bit is clear, templates become invisible instead.
* - The 0x02 bit means @a tree is itself part of a template,
* and so all of its children should be affected, regardless
* of whether they are templates of their own.
*
* Deleted options are never visible.
*
* @relates option */
static void
update_visibility(LIST_OF(struct option) *tree, int show)
{
struct option *opt;
foreach (opt, *tree) {
if (opt->flags & OPT_DELETED) continue;
if (!strcmp(opt->name, "_template_")) {
if (opt->box_item)
opt->box_item->visible = (show & 1);
if (opt->type == OPT_TREE)
update_visibility(opt->value.tree, show | 2);
} else {
if (opt->box_item && (show & 2))
opt->box_item->visible = (show & 1);
if (opt->type == OPT_TREE)
update_visibility(opt->value.tree, show);
}
}
}
void
update_options_visibility(void)
{
@ -1117,40 +1152,7 @@ toggle_option(struct session *ses, struct option *option)
option_changed(ses, option);
}
static int
change_hook_stemplate(struct session *ses, struct option *current, struct option *changed)
{
update_visibility(config_options->value.tree, changed->value.number);
return 0;
}
static int
change_hook_language(struct session *ses, struct option *current, struct option *changed)
{
#ifdef CONFIG_NLS
set_language(changed->value.number);
#endif
return 0;
}
static const struct change_hook_info change_hooks[] = {
{ "config.show_template", change_hook_stemplate },
{ "connection", change_hook_connection },
{ "document.browse", change_hook_html },
{ "document.browse.forms.insert_mode",
change_hook_insert_mode },
{ "document.browse.links.active_link",
change_hook_active_link },
{ "document.cache", change_hook_cache },
{ "document.codepage", change_hook_html },
{ "document.colors", change_hook_html },
{ "document.html", change_hook_html },
{ "document.plain", change_hook_html },
{ "terminal", change_hook_terminal },
{ "ui.language", change_hook_language },
{ "ui", change_hook_ui },
{ NULL, NULL },
};
void
call_change_hooks(struct session *ses, struct option *current, struct option *option)
@ -1238,7 +1240,6 @@ checkout_option_values(struct option_resolver *resolvers,
Options values
**********************************************************************/
#include "config/options.inc"
/*! @relates option_info */
void

View File

@ -719,7 +719,8 @@ load_cookies(void) {
while (fgets(in_buffer, 6 * MAX_STR_LEN, fp)) {
struct cookie *cookie;
unsigned char *p, *q = in_buffer;
enum { NAME = 0, VALUE, SERVER, PATH, DOMAIN, EXPIRES, SECURE, MEMBERS } member;
enum { NAME = 0, VALUE, SERVER, PATH, DOMAIN, EXPIRES, SECURE, MEMBERS };
int member;
struct {
unsigned char *pos;
int len;

View File

@ -102,7 +102,7 @@ menu_keys(struct terminal *term, void *d_, void *xxx)
if (info->toggle) {
action_id_T action_id;
enum keymap_id keymap_id;
int keymap_id;
for (action_id = 0; action_id < MAIN_ACTIONS - 1; action_id++) {
action_ids[action_id] = action_id + 1;

View File

@ -8,6 +8,81 @@
#include "util/color.h"
#include "util/lists.h"
enum css_property_type {
CSS_PT_NONE,
CSS_PT_BACKGROUND,
CSS_PT_BACKGROUND_COLOR,
CSS_PT_COLOR,
CSS_PT_DISPLAY,
CSS_PT_FONT_STYLE,
CSS_PT_FONT_WEIGHT,
CSS_PT_LIST_STYLE,
CSS_PT_LIST_STYLE_TYPE,
CSS_PT_TEXT_ALIGN,
CSS_PT_TEXT_DECORATION,
CSS_PT_WHITE_SPACE,
CSS_PT_LAST,
};
enum css_property_value_type {
CSS_VT_NONE,
CSS_VT_COLOR,
CSS_VT_DISPLAY,
CSS_VT_FONT_ATTRIBUTE,
CSS_VT_LIST_STYLE,
CSS_VT_TEXT_ALIGN,
CSS_VT_LAST,
};
enum css_display {
CSS_DISP_INLINE,
CSS_DISP_BLOCK,
CSS_DISP_NONE,
};
enum css_list_style {
CSS_LIST_NONE,
CSS_LIST_DISC,
CSS_LIST_CIRCLE,
CSS_LIST_SQUARE,
CSS_LIST_ORDINAL, /* Marker value */
CSS_LIST_DECIMAL,
CSS_LIST_DECIMAL_LEADING_ZERO,
CSS_LIST_LOWER_ROMAN,
CSS_LIST_UPPER_ROMAN,
CSS_LIST_LOWER_ALPHA,
CSS_LIST_UPPER_ALPHA,
CSS_LIST_LOWER_GREEK,
CSS_LIST_LOWER_LATIN,
CSS_LIST_UPPER_LATIN,
CSS_LIST_HEBREW,
CSS_LIST_ARMENIAN,
CSS_LIST_GEORGIAN,
CSS_LIST_CJK_IDEOGRAPHIC,
CSS_LIST_HIRAGANA,
CSS_LIST_KATAKANA,
CSS_LIST_HIRAGANA_IROHA,
CSS_LIST_KATAKANA_IROHA,
};
union css_property_value {
void *none;
color_T color;
enum css_display display;
struct {
enum text_style_format add, rem;
} font_attribute;
enum format_align text_align;
enum css_list_style list_style;
/* TODO:
* Generic numbers
* Percentages
* URL
* Align (struct format_align) */
/* TODO: The size units will be fun yet. --pasky */
};
/** The struct css_property describes one CSS declaration in a rule, therefore
* being basically a parsed instance of struct css_property_info. One list of
* these contains all the declarations contained in one rule. */
@ -16,78 +91,14 @@ struct css_property {
/** Declared property. The enum item name is derived from the
* property name, just uppercase it and tr/-/_/. */
enum css_property_type {
CSS_PT_NONE,
CSS_PT_BACKGROUND,
CSS_PT_BACKGROUND_COLOR,
CSS_PT_COLOR,
CSS_PT_DISPLAY,
CSS_PT_FONT_STYLE,
CSS_PT_FONT_WEIGHT,
CSS_PT_LIST_STYLE,
CSS_PT_LIST_STYLE_TYPE,
CSS_PT_TEXT_ALIGN,
CSS_PT_TEXT_DECORATION,
CSS_PT_WHITE_SPACE,
CSS_PT_LAST,
} type;
enum css_property_type type;
/** Type of the property value. Discriminates the #value union. */
enum css_property_value_type {
CSS_VT_NONE,
CSS_VT_COLOR,
CSS_VT_DISPLAY,
CSS_VT_FONT_ATTRIBUTE,
CSS_VT_LIST_STYLE,
CSS_VT_TEXT_ALIGN,
CSS_VT_LAST,
} value_type;
enum css_property_value_type value_type;
/** Property value. If it is a pointer, it points always to a
* memory to be free()d together with this structure. */
union css_property_value {
void *none;
color_T color;
enum css_display {
CSS_DISP_INLINE,
CSS_DISP_BLOCK,
CSS_DISP_NONE,
} display;
struct {
enum text_style_format add, rem;
} font_attribute;
enum format_align text_align;
enum css_list_style {
CSS_LIST_NONE,
CSS_LIST_DISC,
CSS_LIST_CIRCLE,
CSS_LIST_SQUARE,
CSS_LIST_ORDINAL, /* Marker value */
CSS_LIST_DECIMAL,
CSS_LIST_DECIMAL_LEADING_ZERO,
CSS_LIST_LOWER_ROMAN,
CSS_LIST_UPPER_ROMAN,
CSS_LIST_LOWER_ALPHA,
CSS_LIST_UPPER_ALPHA,
CSS_LIST_LOWER_GREEK,
CSS_LIST_LOWER_LATIN,
CSS_LIST_UPPER_LATIN,
CSS_LIST_HEBREW,
CSS_LIST_ARMENIAN,
CSS_LIST_GEORGIAN,
CSS_LIST_CJK_IDEOGRAPHIC,
CSS_LIST_HIRAGANA,
CSS_LIST_KATAKANA,
CSS_LIST_HIRAGANA_IROHA,
CSS_LIST_KATAKANA_IROHA,
} list_style;
/* TODO:
* Generic numbers
* Percentages
* URL
* Align (struct format_align) */
/* TODO: The size units will be fun yet. --pasky */
} value;
union css_property_value value;
};
struct css_property_info;

View File

@ -64,6 +64,21 @@ struct css_selector_set {
};
#define INIT_CSS_SELECTOR_SET(set) { 0, { D_LIST_HEAD(set.list) } }
enum css_selector_relation {
CSR_ROOT, /**< First class stylesheet member. */
CSR_SPECIFITY, /**< Narrowing-down, i.e. the "x" in "foo#x". */
CSR_ANCESTOR, /**< Ancestor, i.e. the "p" in "p a". */
CSR_PARENT, /**< Direct parent, i.e. the "div" in "div>img". */
};
enum css_selector_type {
CST_ELEMENT,
CST_ID,
CST_CLASS,
CST_PSEUDO,
CST_INVALID, /**< Auxiliary for the parser */
};
/** The struct css_selector is used for mapping elements (or nodes) in the
* document structure to properties. See README for some hints about how the
* trees of these span. */
@ -73,21 +88,10 @@ struct css_selector {
/** This defines relation between this selector fragment and its
* parent in the selector tree.
* Update with set_css_selector_relation(). */
enum css_selector_relation {
CSR_ROOT, /**< First class stylesheet member. */
CSR_SPECIFITY, /**< Narrowing-down, i.e. the "x" in "foo#x". */
CSR_ANCESTOR, /**< Ancestor, i.e. the "p" in "p a". */
CSR_PARENT, /**< Direct parent, i.e. the "div" in "div>img". */
} relation;
enum css_selector_relation relation;
struct css_selector_set leaves;
enum css_selector_type {
CST_ELEMENT,
CST_ID,
CST_CLASS,
CST_PSEUDO,
CST_INVALID, /**< Auxiliary for the parser */
} type;
enum css_selector_type type;
unsigned char *name;
LIST_OF(struct css_property) properties;

View File

@ -68,18 +68,20 @@ enum link_type {
LINK_AREA,
};
enum script_event_hook_type {
SEVHOOK_ONCLICK,
SEVHOOK_ONDBLCLICK,
SEVHOOK_ONMOUSEOVER,
SEVHOOK_ONHOVER,
SEVHOOK_ONFOCUS,
SEVHOOK_ONMOUSEOUT,
SEVHOOK_ONBLUR,
};
struct script_event_hook {
LIST_HEAD(struct script_event_hook);
enum script_event_hook_type {
SEVHOOK_ONCLICK,
SEVHOOK_ONDBLCLICK,
SEVHOOK_ONMOUSEOVER,
SEVHOOK_ONHOVER,
SEVHOOK_ONFOCUS,
SEVHOOK_ONMOUSEOUT,
SEVHOOK_ONBLUR,
} type;
enum script_event_hook_type type;
unsigned char *src;
};

View File

@ -168,7 +168,7 @@ dom_rss_push_document(struct dom_stack *stack, struct dom_node *root, void *xxx)
struct dom_renderer *renderer = stack->current->data;
struct document *document = renderer->document;
struct rss_renderer *rss;
enum rss_style type;
int type;
struct css_stylesheet *css = &default_stylesheet;
{

View File

@ -333,7 +333,7 @@ render_dom_document_start(struct dom_stack *stack, struct dom_node *node, void *
struct dom_renderer *renderer = stack->current->data;
struct document *document = renderer->document;
struct source_renderer *data;
enum dom_node_type type;
int type;
struct css_stylesheet *css = &default_stylesheet;
{

View File

@ -31,7 +31,7 @@ static inline void
init_template(struct screen_char *template_, struct document_options *options,
enum screen_char_attr attr, color_T foreground, color_T background)
{
struct text_style style = INIT_TEXT_STYLE(attr, foreground, background);
struct text_style style = INIT_TEXT_STYLE((int)attr, foreground, background);
get_screen_char_template(template_, options, style);
}

View File

@ -122,6 +122,11 @@ enum html_element_mortality_type {
ELEMENT_WEAK,
};
enum html_element_pseudo_class {
ELEMENT_LINK = 1,
ELEMENT_VISITED = 2,
};
struct html_element {
LIST_HEAD(struct html_element);
@ -148,10 +153,7 @@ struct html_element {
struct frameset_desc *frameset;
/* For the needs of CSS engine. A wannabe bitmask. */
enum html_element_pseudo_class {
ELEMENT_LINK = 1,
ELEMENT_VISITED = 2,
} pseudo_class;
enum html_element_pseudo_class pseudo_class;
};
#define is_inline_element(e) ((e)->linebreak == 0)

View File

@ -37,9 +37,10 @@ struct dom_scanner_token {
((token)->string.length == (sizeof(str) - 1) \
&& !c_strncasecmp((token)->string.string, str, sizeof(str) - 1))
enum dom_scan_type { DOM_SCAN_RANGE, DOM_SCAN_STRING, DOM_SCAN_END };
struct dom_scan_table_info {
enum { DOM_SCAN_RANGE, DOM_SCAN_STRING, DOM_SCAN_END } type;
enum dom_scan_type type;
struct dom_string data;
int bits;
};

View File

@ -41,33 +41,35 @@ SWAP(nls_uint32 i)
24);
}
enum operator_ {
/* Without arguments: */
var, /* The variable "n". */
num, /* Decimal number. */
/* Unary operators: */
lnot, /* Logical NOT. */
/* Binary operators: */
mult, /* Multiplication. */
divide, /* Division. */
module, /* Module operation. */
plus, /* Addition. */
minus, /* Subtraction. */
less_than, /* Comparison. */
greater_than, /* Comparison. */
less_or_equal, /* Comparison. */
greater_or_equal, /* Comparison. */
equal, /* Comparision for equality. */
not_equal, /* Comparision for inequality. */
land, /* Logical AND. */
lor, /* Logical OR. */
/* Ternary operators: */
qmop /* Question mark operator. */
};
/* This is the representation of the expressions to determine the
plural form. */
struct expression {
int nargs; /* Number of arguments. */
enum operator {
/* Without arguments: */
var, /* The variable "n". */
num, /* Decimal number. */
/* Unary operators: */
lnot, /* Logical NOT. */
/* Binary operators: */
mult, /* Multiplication. */
divide, /* Division. */
module, /* Module operation. */
plus, /* Addition. */
minus, /* Subtraction. */
less_than, /* Comparison. */
greater_than, /* Comparison. */
less_or_equal, /* Comparison. */
greater_or_equal, /* Comparison. */
equal, /* Comparision for equality. */
not_equal, /* Comparision for inequality. */
land, /* Logical AND. */
lor, /* Logical OR. */
/* Ternary operators: */
qmop /* Question mark operator. */
} operation;
enum operator_ operation;
union {
unsigned long int num; /* Number value for `num'. */
struct expression *args[3]; /* Up to three arguments. */

View File

@ -161,7 +161,7 @@ union YYSTYPE
#line 42 "plural.y" /* yacc.c:355 */
unsigned long int num;
enum operator op;
enum operator_ op;
struct expression *exp;
#line 168 "plural.c" /* yacc.c:355 */
@ -182,15 +182,15 @@ int gettext__parse (struct parse_args *arg);
#line 48 "plural.y" /* yacc.c:358 */
/* Prototypes for local functions. */
static struct expression *new_exp(int nargs, enum operator op,
static struct expression *new_exp(int nargs, enum operator_ op,
struct expression * const *args);
static inline struct expression *new_exp_0(enum operator op);
static inline struct expression *new_exp_1(enum operator op,
static inline struct expression *new_exp_0(enum operator_ op);
static inline struct expression *new_exp_1(enum operator_ op,
struct expression *right);
static struct expression *new_exp_2(enum operator op,
static struct expression *new_exp_2(enum operator_ op,
struct expression *left,
struct expression *right);
static inline struct expression *new_exp_3(enum operator op,
static inline struct expression *new_exp_3(enum operator_ op,
struct expression *bexp,
struct expression *tbranch,
struct expression *fbranch);
@ -200,7 +200,7 @@ static void yyerror(struct parse_args *arg, const unsigned char *str);
/* Allocation of expressions. */
static struct expression *
new_exp(int nargs, enum operator op, struct expression * const *args)
new_exp(int nargs, enum operator_ op, struct expression * const *args)
{
int i;
struct expression *newp;
@ -229,13 +229,13 @@ new_exp(int nargs, enum operator op, struct expression * const *args)
}
static inline struct expression *
new_exp_0(enum operator op)
new_exp_0(enum operator_ op)
{
return new_exp (0, op, NULL);
}
static inline struct expression *
new_exp_1(enum operator op, struct expression *right)
new_exp_1(enum operator_ op, struct expression *right)
{
struct expression *args[1];
@ -244,7 +244,7 @@ new_exp_1(enum operator op, struct expression *right)
}
static struct expression *
new_exp_2(enum operator op, struct expression *left, struct expression *right)
new_exp_2(enum operator_ op, struct expression *left, struct expression *right)
{
struct expression *args[2];
@ -254,7 +254,7 @@ new_exp_2(enum operator op, struct expression *left, struct expression *right)
}
static inline struct expression *
new_exp_3(enum operator op, struct expression *bexp, struct expression *tbranch,
new_exp_3(enum operator_ op, struct expression *bexp, struct expression *tbranch,
struct expression *fbranch)
{
struct expression *args[3];

View File

@ -41,21 +41,21 @@
%union {
unsigned long int num;
enum operator op;
enum operator_ op;
struct expression *exp;
}
%{
/* Prototypes for local functions. */
static struct expression *new_exp(int nargs, enum operator op,
static struct expression *new_exp(int nargs, enum operator_ op,
struct expression * const *args);
static inline struct expression *new_exp_0(enum operator op);
static inline struct expression *new_exp_1(enum operator op,
static inline struct expression *new_exp_0(enum operator_ op);
static inline struct expression *new_exp_1(enum operator_ op,
struct expression *right);
static struct expression *new_exp_2(enum operator op,
static struct expression *new_exp_2(enum operator_ op,
struct expression *left,
struct expression *right);
static inline struct expression *new_exp_3(enum operator op,
static inline struct expression *new_exp_3(enum operator_ op,
struct expression *bexp,
struct expression *tbranch,
struct expression *fbranch);
@ -65,7 +65,7 @@ static void yyerror(struct parse_args *arg, const unsigned char *str);
/* Allocation of expressions. */
static struct expression *
new_exp(int nargs, enum operator op, struct expression * const *args)
new_exp(int nargs, enum operator_ op, struct expression * const *args)
{
int i;
struct expression *newp;
@ -94,13 +94,13 @@ new_exp(int nargs, enum operator op, struct expression * const *args)
}
static inline struct expression *
new_exp_0(enum operator op)
new_exp_0(enum operator_ op)
{
return new_exp (0, op, NULL);
}
static inline struct expression *
new_exp_1(enum operator op, struct expression *right)
new_exp_1(enum operator_ op, struct expression *right)
{
struct expression *args[1];
@ -109,7 +109,7 @@ new_exp_1(enum operator op, struct expression *right)
}
static struct expression *
new_exp_2(enum operator op, struct expression *left, struct expression *right)
new_exp_2(enum operator_ op, struct expression *left, struct expression *right)
{
struct expression *args[2];
@ -119,7 +119,7 @@ new_exp_2(enum operator op, struct expression *left, struct expression *right)
}
static inline struct expression *
new_exp_3(enum operator op, struct expression *bexp, struct expression *tbranch,
new_exp_3(enum operator_ op, struct expression *bexp, struct expression *tbranch,
struct expression *fbranch)
{
struct expression *args[3];

View File

@ -70,7 +70,7 @@ static void notify_connection_callbacks(struct connection *conn);
static /* inline */ enum connection_priority
get_priority(struct connection *conn)
{
enum connection_priority priority;
int priority;
for (priority = 0; priority < PRIORITIES; priority++)
if (conn->pri[priority])

View File

@ -43,12 +43,12 @@ auth_ok(void *data)
unsigned char *url = get_uri_string(entry->uri, URI_HTTP_AUTH);
if (url) {
struct form form = {
.action = url,
};
struct form form;
INIT_LIST_OF(struct submitted_value, submit);
struct submitted_value *user, *password;
form.action = url;
user = init_submitted_value("user", entry->user, FC_TEXT, NULL, 0);
if (user) {
add_to_list(submit, user);

View File

@ -47,6 +47,8 @@ struct frame {
struct view_state vs;
};
enum kp_mark { KP_MARK_NOTHING, KP_MARK_SET, KP_MARK_GOTO };
/** Use for keyboard prefixes. */
struct kbdprefix {
/** This is the repeat count being inserted by user so far.
@ -56,7 +58,7 @@ struct kbdprefix {
#ifdef CONFIG_MARKS
/** If the previous key was a mark prefix, this describes what kind
* of action are we supposed to do when we receive the next key. */
enum { KP_MARK_NOTHING, KP_MARK_SET, KP_MARK_GOTO } mark;
enum kp_mark mark;
#endif
};
@ -165,7 +167,7 @@ struct session {
struct download loading;
struct uri *loading_uri;
enum cache_mode reloadlevel;
int reloadlevel;
int redirect_cnt;
struct document_view *doc_view;

View File

@ -480,8 +480,9 @@ free_itrm(struct itrm *itrm)
static inline void
resize_terminal_from_str(unsigned char *text)
{
enum { NEW_WIDTH = 0, NEW_HEIGHT, OLD_WIDTH, OLD_HEIGHT, NUMBERS } i;
enum { NEW_WIDTH = 0, NEW_HEIGHT, OLD_WIDTH, OLD_HEIGHT, NUMBERS };
int numbers[NUMBERS];
int i;
assert(text && *text);
if_assert_failed return;

View File

@ -208,6 +208,46 @@ static const struct string fbterm_color256_seqs[] = {
};
#endif
struct screen_driver_opt {
/** Charsets when doing UTF-8 I/O.
* [0] is the common charset and [1] is the frame charset.
* Test whether to use UTF-8 I/O using the use_utf8_io() macro. */
int charsets[2];
/** The frame translation table. May be NULL. */
const unsigned char *frame;
/** The frame mode setup and teardown sequences. May be NULL. */
const struct string *frame_seqs;
/** The italic mode setup and teardown sequences. May be NULL. */
const struct string *italic;
/** The underline mode setup and teardown sequences. May be NULL. */
const struct string *underline;
/** The color mode */
enum color_mode color_mode;
#if defined(CONFIG_88_COLORS) || defined(CONFIG_256_COLORS)
const struct string *color256_seqs;
#endif
/** These are directly derived from the terminal options. */
unsigned int transparent:1;
#ifdef CONFIG_UTF8
/* Whether the charset of the terminal is UTF-8. This
* is the same as is_cp_utf8(charsets[0]), except the
* latter might crash if UTF-8 I/O is disabled. */
unsigned int utf8_cp:1;
#endif /* CONFIG_UTF8 */
#ifdef CONFIG_COMBINE
/* Whether the terminal supports combining characters. */
unsigned int combine:1;
#endif /* CONFIG_COMBINE */
};
/** Used in @c add_char*() and @c redraw_screen() to reduce the logic.
* It is updated from terminal._template_.* using option.change_hook.
*
@ -221,45 +261,7 @@ struct screen_driver {
enum term_mode_type type;
/** set_screen_driver_opt() sets these. */
struct screen_driver_opt {
/** Charsets when doing UTF-8 I/O.
* [0] is the common charset and [1] is the frame charset.
* Test whether to use UTF-8 I/O using the use_utf8_io() macro. */
int charsets[2];
/** The frame translation table. May be NULL. */
const unsigned char *frame;
/** The frame mode setup and teardown sequences. May be NULL. */
const struct string *frame_seqs;
/** The italic mode setup and teardown sequences. May be NULL. */
const struct string *italic;
/** The underline mode setup and teardown sequences. May be NULL. */
const struct string *underline;
/** The color mode */
enum color_mode color_mode;
#if defined(CONFIG_88_COLORS) || defined(CONFIG_256_COLORS)
const struct string *color256_seqs;
#endif
/** These are directly derived from the terminal options. */
unsigned int transparent:1;
#ifdef CONFIG_UTF8
/* Whether the charset of the terminal is UTF-8. This
* is the same as is_cp_utf8(charsets[0]), except the
* latter might crash if UTF-8 I/O is disabled. */
unsigned int utf8_cp:1;
#endif /* CONFIG_UTF8 */
#ifdef CONFIG_COMBINE
/* Whether the terminal supports combining characters. */
unsigned int combine:1;
#endif /* CONFIG_COMBINE */
} opt;
struct screen_driver_opt opt;
/* The terminal._template_ name. */
unsigned char name[1]; /* XXX: Keep last! */

View File

@ -36,13 +36,15 @@ struct scanner_token {
#define scanner_token_contains(token, str) \
scanner_token_strlcasecmp(token, str, sizeof(str) - 1)
enum scan_type { SCAN_RANGE, SCAN_STRING, SCAN_END };
union scan_table_data {
struct { unsigned char *source; long length; } string;
struct { unsigned char *start; long end; } range;
};
struct scan_table_info {
enum { SCAN_RANGE, SCAN_STRING, SCAN_END } type;
union scan_table_data {
struct { unsigned char *source; long length; } string;
struct { unsigned char *start; long end; } range;
} data;
enum scan_type type;
union scan_table_data data;
int bits;
};