ascii-chat
Binary v0.15.83-53-gb711d8720
Library lib/v0.3.2-701-gb711d8720
Video chat in your terminal
Loading...
Searching...
No Matches
common.h File Reference

Shared structures and macros for registry implementation. More...

Go to the source code of this file.

Data Structures

struct  registry_entry_t
 Registry entry - stores option definition with mode bitmask and metadata. More...
struct  category_builder_t
 Registry entry - stores option definition with mode bitmask and metadata. More...

Macros

#define REGISTRY_TERMINATOR()
 Initialize a terminator entry (sentinel value for array end) Uses designated initializers to properly initialize all fields to zero/NULL.

Typedefs

typedef const void *(* mode_default_getter_fn) (asciichat_mode_t mode)
 Temporary builder for a help/category index. name identifies the category and entries points at the entries accumulated for it; the builder is discarded after the final index is emitted.

Detailed Description

Shared structures and macros for registry implementation.

Author
Zachary Fogg me@zf.nosp@m.o.gg
Date
January 2026

Definition in file options/registry/common.h.

Macro Definition Documentation

◆ REGISTRY_TERMINATOR

#define REGISTRY_TERMINATOR ( )
Value:
{.long_name = NULL, \
.short_name = '\0', \
.type = OPTION_TYPE_BOOL, \
.offset = 0, \
.default_value = NULL, \
.mode_default_getter = NULL, \
.default_value_size = 0, \
.help_text = NULL, \
.group = NULL, \
.arg_placeholder = NULL, \
.required = false, \
.env_var_name = NULL, \
.validate_fn = NULL, \
.parse_fn = NULL, \
.owns_memory = false, \
.optional_arg = false, \
.mode_bitmask = OPTION_MODE_NONE, \
.metadata = {0}}
@ OPTION_TYPE_BOOL
Boolean flag (–flag, no value).
Definition builder.h:167
@ OPTION_MODE_NONE
No modes (invalid).
Definition options.h:937

Initialize a terminator entry (sentinel value for array end) Uses designated initializers to properly initialize all fields to zero/NULL.

Definition at line 69 of file options/registry/common.h.

69#define REGISTRY_TERMINATOR() \
70 {.long_name = NULL, \
71 .short_name = '\0', \
72 .type = OPTION_TYPE_BOOL, \
73 .offset = 0, \
74 .default_value = NULL, \
75 .mode_default_getter = NULL, \
76 .default_value_size = 0, \
77 .help_text = NULL, \
78 .group = NULL, \
79 .arg_placeholder = NULL, \
80 .required = false, \
81 .env_var_name = NULL, \
82 .validate_fn = NULL, \
83 .parse_fn = NULL, \
84 .owns_memory = false, \
85 .optional_arg = false, \
86 .mode_bitmask = OPTION_MODE_NONE, \
87 .metadata = {0}}

Typedef Documentation

◆ mode_default_getter_fn

typedef const void *(* mode_default_getter_fn) (asciichat_mode_t mode)

Temporary builder for a help/category index. name identifies the category and entries points at the entries accumulated for it; the builder is discarded after the final index is emitted.

Mode-aware default value getter function type

Returns the default value for an option based on the current mode. Used for options that have different defaults per mode (e.g., log-file, port, websocket-port).

Parameters
modeThe mode to get the default for
Returns
Pointer to the default value for this mode (must remain valid)

Definition at line 27 of file options/registry/common.h.