ELinks 0.16.1.1
option Struct Reference

#include <options.h>

Collaboration diagram for option:

Data Fields

void * magic1
struct optionnext
struct optionprev
void * magic2
struct object object
union { 
   const char *   name 
   char *   aname 
}; 
option_flags_T flags
enum option_type type
long min
long max
union option_value value
const char * desc
const char * capt
unsigned int node_number
struct optionroot
change_hook_T change_hook
 To be called when the option (or sub-option if it's a tree) is changed.
struct listbox_itembox_item

(Note that these are not member symbols.)

static void debug_check_option_syntax (struct option *option)
struct optionget_opt_rec (struct option *tree, const char *name_)
 Get record of option of given name, or NULL if there's no such option.
struct optionget_opt_rec_real (struct option *tree, const char *name)
 Get record of option of given name, or NULL if there's no such option.
struct optionindirect_option (struct option *alias)
 If opt is an alias, return the option to which it refers.
union option_valueget_opt_ (char *file, int line, enum option_type option_type, struct option *tree, const char *name, struct session *ses)
 Fetch pointer to value of certain option.
static void add_opt_sort (struct option *tree, struct option *option, int abi)
static void add_opt_rec (struct option *tree, const char *path, struct option *option)
 Add option to tree.
static struct listbox_iteminit_option_listbox_item (struct option *option)
struct optionadd_opt (struct option *tree, const char *path, const char *capt, const char *name, option_flags_T flags, enum option_type type, long min, long max, longptr_T value, const char *desc)
static void done_option (struct option *option)
static void delete_option_do (struct option *option, int recursive)
void mark_option_as_deleted (struct option *option)
void delete_option (struct option *option)
struct optioncopy_option (struct option *template_, int flags)
struct option listinit_options_tree (void)
static void update_visibility (struct option list *tree, int show)
 Make option templates visible or invisible in the option manager.
static void free_options_tree (struct option list *tree, int recursive)
void prepare_mustsave_flags (struct option list *tree, int set_all)
 Set or clear the OPT_MUST_SAVE flag in all descendants of tree.
void untouch_options (struct option list *tree)
 Clear the OPT_TOUCHED flag in all descendants of tree.
static int check_nonempty_tree (struct option list *options)
void smart_config_string (struct string *str, int print_comment, int i18n, struct option list *options, char *path, int depth, void(*fn)(struct string *, struct option *, char *, int, int, int, int))
#define INIT_OPTION(name, flags, type, min, max, value, desc, capt)
 An initializer for struct option.
void toggle_option (struct session *ses, struct option *option)
 Toggle the value of the given option numeric, respecting option->min and option->max.
void call_change_hooks (struct session *ses, struct option *current, struct option *option)
 Call the change-hooks for the given option and recur on its parent.
void option_changed (struct session *ses, struct option *option)
 Do proper bookkeeping after an option has changed - call this every time you change an option value.
#define add_opt_bool_tree(tree, path, capt, name, flags, def, desc)
#define add_opt_int_tree(tree, path, capt, name, flags, min, max, def, desc)
#define add_opt_long_tree(tree, path, capt, name, flags, min, max, def, desc)
#define add_opt_str_tree(tree, path, capt, name, flags, def, desc)
#define add_opt_codepage_tree(tree, path, capt, name, flags, def, desc)
#define add_opt_lang_tree(tree, path, capt, name, flags, desc)
#define add_opt_color_tree(tree, path, capt, name, flags, def, desc)
#define add_opt_command_tree(tree, path, capt, name, flags, cmd, desc)
#define add_opt_alias_tree(tree, path, capt, name, flags, def, desc)
#define add_opt_tree_tree(tree, path, capt, name, flags, desc)

◆ add_opt()

struct option * add_opt ( struct option * tree,
const char * path,
const char * capt,
const char * name,
option_flags_T flags,
enum option_type type,
long min,
long max,
longptr_T value,
const char * desc )
related

◆ add_opt_alias_tree

#define add_opt_alias_tree ( tree,
path,
capt,
name,
flags,
def,
desc )
related
Value:
add_opt(tree, path, capt, name, flags, OPT_ALIAS, 0, strlen(def), (longptr_T) def, DESC(desc))
@ OPT_ALIAS
Definition options.h:115
struct option * add_opt(struct option *, const char *, const char *, const char *, option_flags_T, enum option_type, long, long, longptr_T, const char *)
#define DESC(x)
Definition options.h:357
option_flags_T flags
Definition options.h:199
const char * desc
Definition options.h:203
const char * capt
Definition options.h:204
const char * name
Definition options.h:196
long longptr_T
Definition types.h:145

◆ add_opt_bool_tree

#define add_opt_bool_tree ( tree,
path,
capt,
name,
flags,
def,
desc )
related
Value:
add_opt(tree, path, capt, name, flags, OPT_BOOL, 0, 1, (longptr_T) def, DESC(desc))
@ OPT_BOOL
Definition options.h:104

◆ add_opt_codepage_tree

#define add_opt_codepage_tree ( tree,
path,
capt,
name,
flags,
def,
desc )
related
Value:
add_opt(tree, path, capt, name, flags, OPT_CODEPAGE, 0, 0, (longptr_T) get_cp_index(def), DESC(desc))
int get_cp_index(const char *name)
Definition charsets.c:1652
@ OPT_CODEPAGE
Definition options.h:109

◆ add_opt_color_tree

#define add_opt_color_tree ( tree,
path,
capt,
name,
flags,
def,
desc )
related
Value:
add_opt(tree, path, capt, name, flags, OPT_COLOR, 0, 0, (longptr_T) def, DESC(desc))
@ OPT_COLOR
Definition options.h:111

◆ add_opt_command_tree

#define add_opt_command_tree ( tree,
path,
capt,
name,
flags,
cmd,
desc )
related
Value:
add_opt(tree, path, capt, name, flags, OPT_COMMAND, 0, 0, (longptr_T) cmd, DESC(desc));
@ OPT_COMMAND
Definition options.h:113

◆ add_opt_int_tree

#define add_opt_int_tree ( tree,
path,
capt,
name,
flags,
min,
max,
def,
desc )
related
Value:
add_opt(tree, path, capt, name, flags, OPT_INT, min, max, (longptr_T) def, DESC(desc))
@ OPT_INT
Definition options.h:105
long min
Definition options.h:201
long max
Definition options.h:201

◆ add_opt_lang_tree

#define add_opt_lang_tree ( tree,
path,
capt,
name,
flags,
desc )
related
Value:
add_opt(tree, path, capt, name, flags, OPT_LANGUAGE, 0, 0, (longptr_T) 0, DESC(desc))
@ OPT_LANGUAGE
Definition options.h:110

◆ add_opt_long_tree

#define add_opt_long_tree ( tree,
path,
capt,
name,
flags,
min,
max,
def,
desc )
related
Value:
add_opt(tree, path, capt, name, flags, OPT_LONG, min, max, (longptr_T) def, DESC(desc))
@ OPT_LONG
Definition options.h:106

◆ add_opt_rec()

void add_opt_rec ( struct option * tree,
const char * path,
struct option * option )
related

Add option to tree.

◆ add_opt_sort()

void add_opt_sort ( struct option * tree,
struct option * option,
int abi )
related

◆ add_opt_str_tree

#define add_opt_str_tree ( tree,
path,
capt,
name,
flags,
def,
desc )
related
Value:
do { \
char *ptr = (char *)mem_alloc(MAX_STR_LEN); \
safe_strncpy(ptr, def, MAX_STR_LEN); \
add_opt(tree, path, capt, name, flags, OPT_STRING, 0, MAX_STR_LEN, (longptr_T) ptr, DESC(desc)); \
} while (0)
@ OPT_STRING
Definition options.h:107
void * mem_alloc(size_t)
#define MAX_STR_LEN
Definition setup.h:78

◆ add_opt_tree_tree

#define add_opt_tree_tree ( tree,
path,
capt,
name,
flags,
desc )
related
Value:
@ OPT_TREE
Definition options.h:117
struct option list * init_options_tree(void)

◆ call_change_hooks()

void call_change_hooks ( struct session * ses,
struct option * current,
struct option * option )
related

Call the change-hooks for the given option and recur on its parent.

◆ check_nonempty_tree()

int check_nonempty_tree ( struct option list * options)
related

◆ copy_option()

struct option * copy_option ( struct option * template_,
int flags )
related

◆ debug_check_option_syntax()

void debug_check_option_syntax ( struct option * option)
related

◆ delete_option()

void delete_option ( struct option * option)
related

◆ delete_option_do()

void delete_option_do ( struct option * option,
int recursive )
related

◆ done_option()

void done_option ( struct option * option)
related

◆ free_options_tree()

void free_options_tree ( struct option list * tree,
int recursive )
related

◆ get_opt_()

union option_value * get_opt_ ( char * file,
int line,
enum option_type option_type,
struct option * tree,
const char * name,
struct session * ses )
related

Fetch pointer to value of certain option.

It is guaranteed to never return NULL. Note that you are supposed to use wrapper get_opt().

◆ get_opt_rec()

struct option * get_opt_rec ( struct option * tree,
const char * name_ )
related

Get record of option of given name, or NULL if there's no such option.

If the specified option is an OPT_ALIAS, this function returns the alias, rather than the option to which the alias refers. It must work this way because the alias may have the OPT_ALIAS_NEGATE flag. Instead, if the caller tries to read or set the value of the alias, the functions associated with OPT_ALIAS will forward the operation to the underlying option. However, see indirect_option().

◆ get_opt_rec_real()

struct option * get_opt_rec_real ( struct option * tree,
const char * name )
related

Get record of option of given name, or NULL if there's no such option.

But do not create the option if it doesn't exist and there's autocreation enabled.

◆ indirect_option()

struct option * indirect_option ( struct option * alias)
related

If opt is an alias, return the option to which it refers.

Warning
Because the alias may have the OPT_ALIAS_NEGATE flag, the caller must not access the value of the returned option as if it were also the value of the alias. However, it is safe to access flags such as OPT_MUST_SAVE and OPT_DELETED.

◆ INIT_OPTION

#define INIT_OPTION ( name,
flags,
type,
min,
max,
value,
desc,
capt )
related
Value:
{ NULL_LIST_HEAD, INIT_OBJECT("option"), {name}, flags, type, min, max, { (LIST_OF(struct option) *) (value) }, desc, capt }
#define option
Definition options.h:17
#define NULL_LIST_HEAD
Definition lists.h:115
#define LIST_OF(element_T)
A list intended to contain elements of a specific type.
Definition lists.h:127
#define INIT_OBJECT(name)
Definition object.h:56
const char * type
Definition download.c:1812

An initializer for struct option.

This is quite rare: most places should instead initialize struct option_init, with ::INIT_OPT_INT or a similar macro.

◆ init_option_listbox_item()

struct listbox_item * init_option_listbox_item ( struct option * option)
related

◆ init_options_tree()

struct option list * init_options_tree ( void )
related

◆ mark_option_as_deleted()

void mark_option_as_deleted ( struct option * option)
related

◆ option_changed()

void option_changed ( struct session * ses,
struct option * option )
related

Do proper bookkeeping after an option has changed - call this every time you change an option value.

◆ prepare_mustsave_flags()

void prepare_mustsave_flags ( struct option list * tree,
int set_all )
related

Set or clear the OPT_MUST_SAVE flag in all descendants of tree.

Parameters
treeThe option tree in which this function recursively sets or clears the flag.
set_allIf true, set OPT_MUST_SAVE in all options of the tree. If false, set it only in touched or deleted options, and clear in others.

◆ smart_config_string()

void smart_config_string ( struct string * str,
int print_comment,
int i18n,
struct option list * options,
char * path,
int depth,
void(* fn )(struct string *, struct option *, char *, int, int, int, int) )
related

◆ toggle_option()

void toggle_option ( struct session * ses,
struct option * option )
related

Toggle the value of the given option numeric, respecting option->min and option->max.

◆ untouch_options()

void untouch_options ( struct option list * tree)
related

Clear the OPT_TOUCHED flag in all descendants of tree.

◆ update_visibility()

void update_visibility ( struct option list * tree,
int show )
related

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.

Parameters
treeThe option tree whose children should be affected.
showA 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 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.

Field Documentation

◆ [union]

union { ... } option

◆ aname

char* option::aname

◆ box_item

struct listbox_item* option::box_item

◆ capt

const char* option::capt

◆ change_hook

change_hook_T option::change_hook

To be called when the option (or sub-option if it's a tree) is changed.

If it returns zero, we will continue descending the options tree checking for change handlers.

◆ desc

const char* option::desc

◆ flags

option_flags_T option::flags

◆ magic1

void* option::magic1

◆ magic2

void* option::magic2

◆ max

long option::max

◆ min

long option::min

◆ name

const char* option::name

◆ next

struct option* option::next

◆ node_number

unsigned int option::node_number

◆ object

struct object option::object

◆ prev

struct option* option::prev

◆ root

struct option* option::root

◆ type

enum option_type option::type

◆ value

union option_value option::value

The documentation for this struct was generated from the following files: