UEFIStarter
a simple UEFI framework
Functions
string.h File Reference

String functions missing from EDK. More...

#include <Uefi.h>

Go to the source code of this file.

Functions

CHAR16 * ftowcs (double value)
 Converts a double value into a UTF-16 string with 3 decimals. More...
 
CHAR16 * sprint_status (CHAR16 *funcname, EFI_STATUS status)
 Helper function to format an EFI function call result into a human-readable string. More...
 
BOOLEAN ctype_whitespace (char ch)
 Checks if an ASCII character is a whitespace. More...
 
UINT64 atoui64 (char *str)
 Converts an ASCII integer string to UINT64. 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...
 

Detailed Description

String functions missing from EDK.

Author
Richard Nusser
License
GPLv3 (see http://www.gnu.org/licenses/)
See also
https://github.com/rinusser/UEFIStarter

Function Documentation

◆ 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
valuethe number to convert
Returns
the number as a UTF-16 string, or NULL on error
Todo:
make number of decimals configurable

◆ 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
functionthe function name, as UTF-16
codethe resulting EFI status code
Returns
the pretty-printed UTF-16 string

◆ ctype_whitespace()

BOOLEAN ctype_whitespace ( char  ch)

Checks if an ASCII character is a whitespace.

Parameters
chthe ASCII character to check
Returns
whether it's a whitespace character

◆ atoui64()

UINT64 atoui64 ( char *  str)

Converts an ASCII integer string to UINT64.

Parameters
strthe integer string to convert, as ASCII
Returns
the UINT64 integer, or -1 on error

◆ 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
fmtthe 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
listthe address where to write the resulting array of strings to
inputthe text to split
separatorthe character to split the text by
Returns
the number of array entries