Options

STP_DURATION_NONE
stp_options stp_options_new(void)

every entry at its default

stp_options stp_options_copy(stp_options)
void stp_options_delete(stp_options)
const stp_error *stp_options_error(stp_options)

the object’s own sticky record (same shape and rule as the manager’s)

void stp_options_clear_error(stp_options)
stp_status stp_options_set_str(stp_options, const char *name, const char *value)

by name; the string form parses the value exactly as the CLI parses it (durations need a unit: “500ms”, “0.5s”; integers read as C reads them: 0x10 is 16, 010 is 8)

stp_status stp_options_set_bool(stp_options, const char *name, bool)
stp_status stp_options_set_int64(stp_options, const char *name, int64_t)
stp_status stp_options_set_uint64(stp_options, const char *name, uint64_t)
stp_status stp_options_set_duration_ms(stp_options, const char *name, uint64_t ms)
stp_status stp_options_set_names(stp_options, const char *name, size_t n, const char *const *members)

set-typed

stp_status stp_options_set_bool_e(stp_options, stp_option, bool)
stp_status stp_options_set_int64_e(stp_options, stp_option, int64_t)
stp_status stp_options_set_uint64_e(stp_options, stp_option, uint64_t)
stp_status stp_options_set_str_e(stp_options, stp_option, const char*)
stp_status stp_options_set_duration_ms_e(stp_options, stp_option, uint64_t ms)
stp_status stp_options_set_args(stp_options, int argc, const char *const *argv)

CLI syntax: argv is the option list only (no program name); the stp binary passes argv + 1. A flag (a bool, or a mode such as incremental) takes a value only after ‘=’; --no-<bool> takes none.

char *stp_options_get_str(stp_options, const char *name)

the value as the CLI would print it; a set-typed entry’s members comma-separated (C++ get_names)

stp_status stp_options_get_bool(stp_options, const char *name, bool *out)
stp_status stp_options_get_int64(stp_options, const char *name, int64_t *out)
stp_status stp_options_get_uint64(stp_options, const char *name, uint64_t *out)
stp_status stp_options_get_duration_ms(stp_options, const char *name, uint64_t *out)
char *stp_options_resolved_str(stp_options, const char *name)

after implications

bool stp_options_is_set(stp_options, const char *name)
stp_status stp_options_reset(stp_options, const char *name)
void stp_options_reset_all(stp_options)
stp_status stp_options_resolve(stp_options)

OPTION_CONFLICT / OPTION_UNAVAILABLE

size_t stp_options_num_names(int tier)
const char *stp_options_name(int tier, size_t i)

static; NULL out of range

char *stp_options_help(int tier)
const char *stp_option_name(stp_option)

static; NULL out of range

stp_status stp_option_from_name(const char *name, stp_option *out)

OPTION_UNKNOWN unless a stable entry (aliases accepted)

const char *stp_option_info_type(const char *name)

introspection, one field per call (no public struct with strings in it); the const char* results are static; every function records OPTION_UNKNOWN in the thread-local record for an unknown name “bool” | “int” | “uint” | “mode” | “enum” | “set” | “string” | “path” | “duration”; NULL if unknown

const char *stp_option_info_python_key(const char *name)
char *stp_option_info_default(const char *name)

as the CLI would print it

stp_tier stp_option_info_tier(const char *name)
stp_settable stp_option_info_settable(const char *name)
stp_option_scope stp_option_info_scope(const char *name)
const char *stp_option_info_category(const char *name)
const char *stp_option_info_help(const char *name)
bool stp_option_info_supported(const char *name)

false when the build lacks what it needs

stp_status stp_option_info_range(const char *name, bool *has_min, int64_t *min, bool *has_max, int64_t *max)
size_t stp_option_info_num_values(const char *name)
const char *stp_option_info_value(const char *name, size_t i)
size_t stp_option_info_num_aliases(const char *name)
const char *stp_option_info_alias(const char *name, size_t i)
const char *stp_option_info_short(const char *name)

“” if none

const char *stp_option_info_negation(const char *name)

“” if none