Go to the source code of this file.
Data Structures |
struct | explain_parse_bits_table_t |
Typedefs |
typedef struct
explain_parse_bits_table_t | explain_parse_bits_table_t |
Functions |
int | explain_parse_bits (const char *text, const explain_parse_bits_table_t *table, size_t table_size, int *result) |
const char * | explain_parse_bits_get_error (void) |
int | explain_parse_bits_or_die (const char *text, const explain_parse_bits_table_t *table, size_t table_size, const char *caption) |
const explain_parse_bits_table_t * | explain_parse_bits_find_by_name (const char *name, const explain_parse_bits_table_t *table, size_t table_size) |
const explain_parse_bits_table_t * | explain_parse_bits_find_by_name_fuzzy (const char *name, const explain_parse_bits_table_t *table, size_t table_size) |
const explain_parse_bits_table_t * | explain_parse_bits_find_by_value (int value, const explain_parse_bits_table_t *table, size_t table_size) |
void | explain_parse_bits_print (struct explain_string_buffer_t *sb, int value, const explain_parse_bits_table_t *table, int table_size) |
void | explain_parse_bits_print_single (struct explain_string_buffer_t *sb, int value, const explain_parse_bits_table_t *table, int table_size) |
Typedef Documentation
Function Documentation
The explain_parse_bits function may be used to parse an input string against a table of bitfields. There may be symbols (from the bits table) or numeric conatsnts (using C notation) and there may be plus (+) or bit-wise-or (|) operators.
- Parameters:
-
text | The text to be parsed. |
table | The table of symbols for the parser. |
table_size | The lentgh of the table of symbols. |
result | Where to put the results of parsing and evluating the expression. |
- Returns:
- 0 in success, -1 on error
- Note:
- this function is not thread safe
The explain_parse_bits_find_by_name function is used to search a parse-bits table for the given name.
- Parameters:
-
name | The name to search for in the table |
table | The table to be searched. |
table_size | The number of members in the table to be searched. |
- Returns:
- pointer to table entry on succes, or NULL on no match
Definition at line 26 of file find_by_name.c.
The explain_parse_bits_find_by_name_fuzzy function is used to search a parse-bits table for the given name, using fuzzy matching. This is best used after explain_parse_bits_find_by_name has already failed, for the purpose of producing a better error message.
- Parameters:
-
name | The name to search for in the table |
table | The table to be searched. |
table_size | The number of members in the table to be searched. |
- Returns:
- pointer to table entry on succes, or NULL on no match
The explain_parse_bits_find_by_name_fuzzy function is used to search a parse-bits table for the given name, using fuzzy matching.
- Parameters:
-
name | The name to search for in the table |
table | The table to be searched. |
table_size | The number of members in the table to be searched. |
- Returns:
- pointer to table entry on succes, or NULL on no match
Definition at line 25 of file find_by_name_fuzzy.c.
The explain_parse_bits_find_by_value function is used to search a parse-bits table for the given value.
- Parameters:
-
value | The value to search for in the table |
table | The table to be searched. |
table_size | The number of members in the table to be searched. |
- Returns:
- pointer to table entry on succes, or NULL on no match
Definition at line 24 of file find_by_value.c.
The explain_parse_bits_get_error function may be used to obtain the error message emitted by the parser by the previous call to explain_parse_bits.
The explain_parse_bits_or_die function may be used to parse an input string against a table of bitfields. There may be symbols (from the bits table) or numeric conatsnts (using C notation) and there may be plus (+) or bit-wise-or (|) operators.
- Parameters:
-
text | The text to be parsed. |
table | The table of symbols for the parser. |
table_size | The lentgh of the table of symbols. |
caption | Caption to add to start of error message, or NULL for none |
- Returns:
- The value of the expression. Does not return on error, but prints diagnostic and exits EXIT_FAILURE.
- Note:
- this function is not thread safe
Definition at line 31 of file or_die.c.
The explain_parse_bits_print function may be used to break a bit-set value into its component bits and print the result.
- Parameters:
-
sb | The string buffer to print into. |
value | The value to dismantle and search for bits in the table |
table | The table to be searched. |
table_size | The number of members in the table to be searched. |
Definition at line 25 of file print.c.
The explain_parse_bits_print_single function may be used to lookup a value and print the name.
- Parameters:
-
sb | The string buffer to print into. |
value | The value to dismantle and search for in the table |
table | The table to be searched. |
table_size | The number of members in the table to be searched. |
Definition at line 25 of file print_single.c.