String functions missing from EDK.
More...
#include <Library/UefiLib.h>
#include <Library/MemoryAllocationLib.h>
#include <UEFIStarter/core/memory.h>
#include <UEFIStarter/core/string.h>
#include <UEFIStarter/core/logger.h>
|
CHAR16 * | ftowcs (double value) |
| Converts a double value into a UTF-16 string with 3 decimals. More...
|
|
UINT64 | atoui64 (char *str) |
| Converts an ASCII integer string to UINT64. More...
|
|
BOOLEAN | ctype_whitespace (char ch) |
| Checks if an ASCII character is a whitespace. More...
|
|
CHAR16 * | sprint_status (CHAR16 *function, EFI_STATUS code) |
| Helper function to format an EFI function call result into a human-readable string. More...
|
|
void | print_status (CHAR16 *function, EFI_STATUS code) |
| Prints a nicely formatted EFI function call result. More...
|
|
CHAR16 *EFIAPI | memsprintf (const CHAR16 *fmt,...) |
| sprintf() replacement that tracks allocated pool memory for automatic cleanup. More...
|
|
UINTN | split_string (CHAR16 ***list, CHAR16 *input, CHAR16 separator) |
| Splits a string by a separator character into an array of strings. More...
|
|
String functions missing from EDK.
- Author
- Richard Nusser
- Copyright
- 2017-2018 Richard Nusser
- License
- GPLv3 (see http://www.gnu.org/licenses/)
- See also
- https://github.com/rinusser/UEFIStarter
◆ ftowcs()
CHAR16* ftowcs |
( |
double |
value | ) |
|
Converts a double value into a UTF-16 string with 3 decimals.
Will only convert numbers between FTOWCS_MIN_VALUE and FTOWCS_MAX_VALUE.
- Parameters
-
value | the number to convert |
- Returns
- the number as a UTF-16 string, or NULL on error
- Todo:
- make number of decimals configurable
◆ atoui64()
UINT64 atoui64 |
( |
char * |
str | ) |
|
Converts an ASCII integer string to UINT64.
- Parameters
-
str | the integer string to convert, as ASCII |
- Returns
- the UINT64 integer, or -1 on error
◆ ctype_whitespace()
BOOLEAN ctype_whitespace |
( |
char |
ch | ) |
|
Checks if an ASCII character is a whitespace.
- Parameters
-
ch | the ASCII character to check |
- Returns
- whether it's a whitespace character
◆ sprint_status()
CHAR16* sprint_status |
( |
CHAR16 * |
function, |
|
|
EFI_STATUS |
code |
|
) |
| |
Helper function to format an EFI function call result into a human-readable string.
- Parameters
-
function | the function name, as UTF-16 |
code | the resulting EFI status code |
- Returns
- the pretty-printed UTF-16 string
◆ print_status()
void print_status |
( |
CHAR16 * |
function, |
|
|
EFI_STATUS |
code |
|
) |
| |
Prints a nicely formatted EFI function call result.
- Parameters
-
function | the function name, as UTF-16 |
code | the resulting EFI status code |
- Todo:
- check if this function is still required
◆ memsprintf()
CHAR16* EFIAPI memsprintf |
( |
const CHAR16 * |
fmt, |
|
|
|
... |
|
) |
| |
sprintf() replacement that tracks allocated pool memory for automatic cleanup.
This function uses the same format codes as Print().
- Parameters
-
fmt | the format string, as UTF-16 |
... | any additional parameters matching the format string placeholders |
- Returns
- a pointer to the formatted UTF-16 string
◆ split_string()
UINTN split_string |
( |
CHAR16 *** |
list, |
|
|
CHAR16 * |
input, |
|
|
CHAR16 |
separator |
|
) |
| |
Splits a string by a separator character into an array of strings.
- Parameters
-
list | the address where to write the resulting array of strings to |
input | the text to split |
separator | the character to split the text by |
- Returns
- the number of array entries