ELinks 0.16.1.1
option_init Struct Reference

How to initialize and register struct option. More...

#include <options.h>

Data Fields

const char * path
 The name of the option tree where the option should be registered.
const char * name
 The name of the option.
const char * capt
 The caption shown in the option manager.
const char * desc
 The long description shown when the user edits the option, or NULL if not available.
option_flags_T flags
 Flags for the option.
enum option_type type
 Type of the option.
long min
 Minimum value of the option.
long max
 Maximum value of the option.
Default value of the option

The value of an option can be an integer, a data pointer, or a function pointer. This structure has a separate member for each of those types, to avoid compile-time casts that could lose some bits of the value. Although this scheme looks a bit bloaty, struct option_init remains smaller than struct option and so does not require any extra space in union option_info.

long value_long
 The default value of the option, if the type is OPT_BOOL, OPT_INT, or OPT_LONG.
const void * value_dataptr
 The default value of the option, if the type is OPT_STRING, OPT_CODEPAGE, OPT_COLOR, or OPT_ALIAS.
option_command_fn_Tvalue_funcptr
 The constant value of the option, if the type is OPT_COMMAND.

Detailed Description

How to initialize and register struct option.

register_options() moves the values from this to struct option. This initialization must be deferred to run time because C89 provides no portable way to initialize the correct member of union option_value at compile time.

Field Documentation

◆ capt

const char* option_init::capt

The caption shown in the option manager.

This goes to option.capt.

◆ desc

const char* option_init::desc

The long description shown when the user edits the option, or NULL if not available.

This goes to option.desc.

◆ flags

option_flags_T option_init::flags

Flags for the option.

These go to option.flags.

◆ max

long option_init::max

Maximum value of the option.

This goes to option.max. For some option types, max is the maximum length or fixed length instead.

◆ min

long option_init::min

Minimum value of the option.

This goes to option.min.

◆ name

const char* option_init::name

The name of the option.

This goes to option.name.

◆ path

const char* option_init::path

The name of the option tree where the option should be registered.

option.root is computed from this.

◆ type

enum option_type option_init::type

Type of the option.

This goes to option.type.

◆ value_dataptr

const void* option_init::value_dataptr

The default value of the option, if the type is OPT_STRING, OPT_CODEPAGE, OPT_COLOR, or OPT_ALIAS.

NULL otherwise. This goes to option_value.string, or after some parsing to option_value.color or option_value.number.

◆ value_funcptr

option_command_fn_T* option_init::value_funcptr

The constant value of the option, if the type is OPT_COMMAND.

NULL otherwise. This goes to option_value.command.

◆ value_long

long option_init::value_long

The default value of the option, if the type is OPT_BOOL, OPT_INT, or OPT_LONG.

Zero otherwise. This goes to option_value.number or option_value.big_number.


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