|
UEFIStarter
a simple UEFI framework
|
Command line parameter parser. More...
#include <Library/UefiLib.h>#include <Library/BaseMemoryLib.h>#include <Library/MemoryAllocationLib.h>#include <UEFIStarter/core/cmdline.h>#include <UEFIStarter/core/memory.h>#include <UEFIStarter/core/logger.h>#include <UEFIStarter/core/string.h>Data Structures | |
| struct | logger_args_mapping_t |
| data type to map a log level to a command line argument More... | |
Functions | |
| static BOOLEAN | _wctype_number (CHAR16 *string, BOOLEAN allow_decimal) |
| (internal) performs check whether string is numeric More... | |
| BOOLEAN | wctype_int (CHAR16 *string) |
| Checks whether a string looks like an integer. More... | |
| BOOLEAN | wctype_float (CHAR16 *string) |
| Checks whether a string looks like a number. More... | |
| double | _wcstof (CHAR16 *str) |
| Converts a numeric string into a double value. More... | |
| BOOLEAN | validate_double_range (cmdline_value_t v, CHAR16 *field, double min, double max) |
| Checks whether a double command line parameter is within boundaries. More... | |
| BOOLEAN | validate_uint64_range (cmdline_value_t v, CHAR16 *field, UINT64 min, UINT64 max) |
| Checks whether a uint64 command line parameter is within boundaries. More... | |
| static void | _print_argument_group_help (cmdline_argument_group_t *arguments) |
| (internal) prints the help text for a command line argument group More... | |
| void | print_help_text (UINTN argument_group_count, VA_LIST args) |
| Outputs the help text for all argument groups, including the built-in ones. More... | |
| BOOLEAN | check_no_arguments_remaining (INTN argc, CHAR16 **argv) |
| Checks if all command line arguments have been parsed successfully. More... | |
| static BOOLEAN | _parse_logger_args (INTN argc, CHAR16 **argv) |
| (internal) parses logger/help parameters from command line More... | |
| static BOOLEAN | _parse_parameter_group (INTN argc, CHAR16 **argv, cmdline_argument_group_t *arguments) |
| (internal) fills argument group structure with all matching command line arguments More... | |
| EFI_STATUS | parse_parameters (INTN argc, CHAR16 **argv, UINTN group_count, VA_LIST args) |
| Parses command-line parameters. More... | |
| CHAR16 ** | argv_from_ascii (int argc, char **argv_ascii) |
| Converts ASCII command line parameters to UTF-16. More... | |
| void | free_argv () |
| Frees the memory pages for the internal _argv storage. | |
Variables | |
| static logger_args_mapping_t | logger_args [] |
| log level -> command line argument mappings More... | |
| static CHAR16 ** | _argv =NULL |
| internal storage for command line arguments converted to UTF-16 | |
| static UINTN | _argv_pages =0 |
| number of memory pages allocated for _argv | |
Command line parameter parser.
|
static |
(internal) performs check whether string is numeric
| string | the string to check, as UTF-16 |
| allow_decimal | whether decimal numbers are OK |
| BOOLEAN wctype_int | ( | CHAR16 * | string | ) |
Checks whether a string looks like an integer.
| string | the string to check, as UTF-16 |
| BOOLEAN wctype_float | ( | CHAR16 * | string | ) |
Checks whether a string looks like a number.
| string | the string to check, as UTF-16 |
| double _wcstof | ( | CHAR16 * | str | ) |
| BOOLEAN validate_double_range | ( | cmdline_value_t | v, |
| CHAR16 * | field, | ||
| double | min, | ||
| double | max | ||
| ) |
Checks whether a double command line parameter is within boundaries.
| v | the command line parameter |
| field | the field name to use in error messages, as UTF-16 |
| min | the lowest allowed value (inclusive) |
| max | the highest allowed value (inclusive) |
| BOOLEAN validate_uint64_range | ( | cmdline_value_t | v, |
| CHAR16 * | field, | ||
| UINT64 | min, | ||
| UINT64 | max | ||
| ) |
Checks whether a uint64 command line parameter is within boundaries.
| v | the command line parameter |
| field | the field name to use in error messages, as UTF-16 |
| min | the lowest allowed value (inclusive) |
| max | the highest allowed value (inclusive) |
|
static |
(internal) prints the help text for a command line argument group
| arguments | the argument group |
| void print_help_text | ( | UINTN | argument_group_count, |
| VA_LIST | args | ||
| ) |
Outputs the help text for all argument groups, including the built-in ones.
| argument_group_count | the number of argument groups passed |
| args | the vararg list of argument groups (cmdline_argument_group_t *) |
| BOOLEAN check_no_arguments_remaining | ( | INTN | argc, |
| CHAR16 ** | argv | ||
| ) |
Checks if all command line arguments have been parsed successfully.
The parser actually shortens the processed strings to 0 length, this checks for that.
| argc | the number of command-line arguments |
| argv | the list of command-line arguments, as UTF-16 |
|
static |
(internal) parses logger/help parameters from command line
| argc | the number of command-line arguments |
| argv | the list of command-line arguments, as UTF-16 |
|
static |
(internal) fills argument group structure with all matching command line arguments
| argc | the number of command-line arguments |
| argv | the list of command-line arguments, as UTF-16 |
| arguments | the argument group to parse values into |
| EFI_STATUS parse_parameters | ( | INTN | argc, |
| CHAR16 ** | argv, | ||
| UINTN | group_count, | ||
| VA_LIST | args | ||
| ) |
Parses command-line parameters.
| argc | the number of command-line arguments |
| argv | the list of command-line arguments, as UTF-16 |
| group_count | the number of command line argument groups passed |
| args | the vararg list of command line groups (as cmdline_argument_group_t *) |
| CHAR16** argv_from_ascii | ( | int | argc, |
| char ** | argv_ascii | ||
| ) |
Converts ASCII command line parameters to UTF-16.
The StdLib's entry function passes arguments as ASCII, you can use this function to convert the arguments list.
| argc | the number of command-line arguments |
| argv_ascii | the list of command-line arguments, as ASCII |
1.8.13