Parser for filter-specific options. More...
#include "private.h"
Data Structures | |
struct | name_id_map |
struct | option_map |
Enumerations | |
enum | { OPT_SIZE, OPT_RLE, OPT_ALIGN } |
enum | { OPT_DIST } |
enum | { OPT_PRESET, OPT_DICT, OPT_LC, OPT_LP, OPT_PB, OPT_MODE, OPT_NICE, OPT_MF, OPT_DEPTH } |
Functions | |
static void | parse_options (const char *str, const option_map *opts, void(*set)(void *filter_options, uint32_t key, uint64_t value), void *filter_options) |
static void | set_subblock (void *options, uint32_t key, uint64_t value) |
lzma_options_subblock * | options_subblock (const char *str) |
Parser for Subblock options. | |
static void | set_delta (void *options, uint32_t key, uint64_t value) |
lzma_options_delta * | options_delta (const char *str) |
Parser for Delta options. | |
static void | set_lzma (void *options, uint32_t key, uint64_t value) |
lzma_options_lzma * | options_lzma (const char *str) |
Parser for LZMA options. |
Parser for filter-specific options.
static void parse_options | ( | const char * | str, | |
const option_map * | opts, | |||
void(*)(void *filter_options, uint32_t key, uint64_t value) | set, | |||
void * | filter_options | |||
) | [static] |
Parses option=value pairs that are separated with colons, semicolons, or commas: opt=val:opt=val;opt=val,opt=val
Each option is a string, that is converted to an integer using the index where the option string is in the array.
Value can be either a number with minimum and maximum value limit, or a string-id map mapping a list of possible string values to integers.
When parsing both option and value succeed, a filter-specific function is called, which should update the given value to filter-specific options structure.
str | String containing the options from the command line | |
opts | Filter-specific option map | |
set | Filter-specific function to update filter_options | |
filter_options | Pointer to filter-specific options structure |
References message_fatal(), str_to_uint64(), and xstrdup().
Referenced by options_delta(), options_lzma(), and options_subblock().
lzma_options_subblock* options_subblock | ( | const char * | str | ) |
Parser for Subblock options.
References lzma_options_subblock::allow_subfilters, parse_options(), and xmalloc.
lzma_options_delta* options_delta | ( | const char * | str | ) |
Parser for Delta options.
References parse_options(), lzma_options_delta::type, and xmalloc.
lzma_options_lzma* options_lzma | ( | const char * | str | ) |
Parser for LZMA options.
References lzma_options_lzma::dict_size, lzma_options_lzma::lc, lzma_options_lzma::lp, LZMA_MF_BT2, LZMA_MF_BT3, LZMA_MF_BT4, LZMA_MF_HC3, LZMA_MF_HC4, LZMA_MODE_FAST, LZMA_MODE_NORMAL, message_fatal(), lzma_options_lzma::mf, lzma_options_lzma::nice_len, parse_options(), and xmalloc.