34 KiB
| title | source | category | pages | extracted |
|---|---|---|---|---|
| Libstand Reference Manual | docs/development/libstand-reference-manual.pdf | development | 34 | 2026-07-06T23:05:34.816610 |
Libstand Reference Manual
Extracted from
docs/development/libstand-reference-manual.pdf(34 pages). Figures, diagrams, and tables may not render accurately in plain text.
UniversalisOS Standalone Utility Library Reference Manual
Am Pfaffenstein 14, D-55270 Klein-Winternheim
Notice: The contents of this document are proprietary to
Portugal Futurista GmbH and shall not be disclosed, disseminated,
copied, or used except for purposes expressly
authorized in writing by Portugal Futurista GmbH.
Standalone Utility Library Reference Manual UniversalisOS D5.0, Document Version D5.0-35
c 2005 – 2019 Portugal Futurista GmbH
Portugal Futurista GmbH Email: office@portugalfuturista.org Am Pfaffenstein 14 55270 Klein-Winternheim, Germany http://www.portugalfuturista.org
All rights reserved. UniversalisOS is a trademark of Portugal Futurista GmbH. The designations used to identify other software or hardware products in this publication may be trademarks of their manufacturers or sellers. Contents
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 2 Libstand API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.1 ANSI C standard I/O functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.1.1 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.1.1.1 sprintf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.1.1.2 vsprintf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.1.1.3 snprintf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.1.1.4 vsnprintf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.2 ANSI C standard library functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.2.1 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.2.1.1 strtoul . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.2.1.2 strtol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.2.1.3 strtoull . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.2.1.4 strtoll . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.2.1.5 bsearch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 2.3 ANSI C string manipulation functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 2.3.1 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 2.3.1.1 strncat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 2.3.1.2 strncmp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 2.3.1.3 strcmp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 2.3.1.4 strncpy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 2.3.1.5 strlen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 2.3.1.6 strnchr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 2.3.1.7 strnrchr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 2.3.1.8 strnlen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 2.3.1.9 strlcpy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 2.3.1.10 strlcat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 2.3.1.11 memset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 2.3.1.12 memchr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 2.3.1.13 memcpy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 2.3.1.14 memmove . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 2.3.1.15 memcmp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 2.4 ANSI C standard types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 2.4.1 Defines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 2.5 Assert . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 2.5.1 Defines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
c Copyright 2005 – 2019 Portugal Futurista GmbH, all rights reserved.
1 Introduction
The Standalone Utility Library (libstand) is available for all UniversalisOS personalities and PSPs. It contains several useful functions from the ANSI C libraries for string formating, string to number conversions and string manipula- tion. To use it you need to include the header files(s) in your application. No further action is necessary. The available header files are listed below. Header File Functions stand/stdio.h sprintf(), snprintf(), ... stand/stdlib.h strtoul(), strtol(), ... stand/string.h strcmp(), strcpy(), ... stand/types.h LONG_MIN, LONG_MAX, ... stand/assert.h assert() macro, ...
Note: The functions do not use the errno variable.
Note: The functions from stand/stdio.h are not available for PSPs.
c Copyright 2005 – 2019 Portugal Futurista GmbH, all rights reserved.
2 Libstand API
2.1 ANSI C standard I/O functions
This section describes the subset of the ANSI C standard I/O (stdio) functions included in libstand.
c Copyright 2005 – 2019 Portugal Futurista GmbH, all rights reserved.
6 Libstand API
2.1.1 Functions
2.1.1.1 sprintf
A function to format and print a string (fmt) to an out string (str).
Synopsis:
int sprintf(char *str, const char *fmt, ...)
Parameters: str OUT: Output string. fmt IN: Format string.
Description: See snprintf for a description of the supported format.
Returns: This function returns the number of characters copied to the out string (not including the trailing NUL used to end output to strings). The return value is only sound if less that 2GB of characters are printed, otherwise int will overflow. There is no overflow protection against this.
c Copyright 2005 – 2019 Portugal Futurista GmbH, all rights reserved.
ANSI C standard I/O functions 7
2.1.1.2 vsprintf
A function called with a va_list to format a string and print this formated string (fmt) to an out string (str).
Synopsis:
int vsprintf(char *str, const char *fmt, va_list ap)
Parameters: str OUT: Output string. fmt IN: Format string. ap IN: Argument vector of format string.
Description: See snprintf for a description of the supported format.
Returns: This function returns the number of characters copied to the out string (not including the trailing NUL used to end output to strings). The return value is only sound if less that 2GB of characters are printed, otherwise int will overflow. There is no overflow protection against this.
c Copyright 2005 – 2019 Portugal Futurista GmbH, all rights reserved.
8 Libstand API
2.1.1.3 snprintf
A function to format and print a string (fmt) to an out string (str), limited to a given amount of characters (size).
Synopsis:
int snprintf(char *str, size_t size, const char *fmt, ...)
Parameters: str OUT: Output string. size IN: Maximum number of chars. fmt IN: Format string.
Description: This function generally uses the well-known C language standard print format, but only a subset is supported. The following options are supported. Format tags begin with a ’%’ character and are followed by an optional sequence of flags, an optional field width, an optional precision, an optional type size specification, and a mandatory conversion specifier. Supported flags: ’+’ (plus) if the number is positive use a ’+’ character in front of the number. ’ ’ (space) if the number is positive, use a white space in front of the number. ’-’ (minus) left justify within field width (otherwise: right justify). A negative field width also triggers this option. ’0’ (zero) left fill with zeros to field width (otherwise: white space). ’#’ (hash) use alternative syntax; semantics depends on conversion specifier Field width: A decimal number using ’0’..’9’ characters: minimum number of characters to use in output string. ’’ (asterisk): the field width is provided by an ’int’ argument. Precision: This always starts with a ’.’ (period) followed by: A decimal number using ’0’..’9’ characters: precision to use for formatting. The exact sematics depends on the conversion specifier. ’’ (asterisk): the precision is provided by an ’int’ argument. Type size: ’hh’: an integer the same size as ’char’ ’h’: an integer the same size as ’short’ ’l’: an integer the same size as ’long’ ’ll’: an integer the same size as ’long long’
c Copyright 2005 – 2019 Portugal Futurista GmbH, all rights reserved.
ANSI C standard I/O functions 9
’z’: an integer the same size as ’size_t’ (or ’P4_size_t’) ’t’: an integer the same size as ’ptrdiff_t’ Format specifiers: ’c’: a single character: ’#’ and precision are ignored. ’s’: a string: ’#’ is ignored. precision is the maximum number of characters at the beginning of the string to be formatted. ’d’, ’i’: decimal signed integer. ’#’ is ignored. the precision is the minimum number of zeros printed; default precision is 0. ’u’: decimal unsigned integer. ’#’ and precision works like with ’d’. ’x’: hexadecimal integer. ’#’ will cause printing ’0x’ prefix if the number is not 0. Precision works like with ’d’. ’X’: same as ’x’, but uses upper case characters. ’o’: octal integer. ’#’ will cause printing ’0’ prefix if number is not 0. Precision works like with ’d’. ’p’: prints void* pointer. Works like ’x’, but with a pointer argument interpreted as integer. ’P’: same as ’p’, but uses upper case characters.
Returns: This function returns the number of characters copied to the out string (not including the trailing NUL used to end output to strings). If more characters would be written than the limit given by (size), the function returns the number of characters that would be written if no limit would exist. The return value is only sound if less that 2GB of characters are printed, otherwise int will overflow. There is no overflow protection against this.
c Copyright 2005 – 2019 Portugal Futurista GmbH, all rights reserved.
10 Libstand API
2.1.1.4 vsnprintf
A function called with a va_list to format a string and print this formated string (fmt) to an out string (str), limited to a given number of characters (size).
Synopsis:
int vsnprintf(char *str, size_t size, const char *fmt, va_list ap)
Parameters: str OUT: Output string. size IN: Maximum number of chars. fmt IN: Format string. ap IN: Argument vector of format string.
Description: See snprintf for a description of the supported format.
Returns: This function returns the number of characters copied to the out string (not including the trailing NUL used to end output to strings). If more characters would be written than the limit given by (size), the function returns the number of characters that would be written if no limit would exist. The return value is only sound if less that 2GB of characters are printed, otherwise int will overflow. There is no overflow protection against this.
c Copyright 2005 – 2019 Portugal Futurista GmbH, all rights reserved.
ANSI C standard library functions 11
2.2 ANSI C standard library functions
This section describes the subset of the ANSI C standard library (stdlib) functions included in libstand.
c Copyright 2005 – 2019 Portugal Futurista GmbH, all rights reserved.
12 Libstand API
2.2.1 Functions
2.2.1.1 strtoul
A function to parse an unsigned number from a string and return it as a number.
Synopsis:
unsigned long strtoul(const char *nptr, char **endptr, int base)
Parameters: nptr IN: The string containing the number to be parsed endptr OUT: The pointer to the first character after the parsed number. base IN: The base of the number (2..36) or 0.
Description: At the beginning of the string, ASCII white-space characters, i.e., SPACE or TAB, will be skipped first. Then, any number of + and - will be parsed to possibly return a negated value. Then, if the base is 0 or 16, a prefix of 0x or 0X will be skipped. Then, any number of valid digits for the given base will be parsed. Digits are 0..9,a..z, in that order. Digits a..z have values 10..35. The case of the letters is insignificant; upper case and lower case digits are treated the same. Bases of 2 through 36 are valid, and 0 means ’autodetect’, which means 10 by default, unless the potential number starts with 0x or 0X, which means base 16 will be assumed, or unless the potential number starts with 0, in which case base 8 will be assumed. If the base is outside 0,2,3..36, no digit will be parsed. Digits are valid if their value is strictly smaller than the assumed base. If endptr is NULL, *endptr will not be written.
Returns: The parsed unsigned number. *endptr is set to point to the first non-valid digit. If converting the string to a number causes an overflow or underflow, (unsigned long)-1 is returned, and *endptr is set equal to nptr. If not a single digit could be parsed, 0 is returned and *endptr is set equal to nptr.
c Copyright 2005 – 2019 Portugal Futurista GmbH, all rights reserved.
ANSI C standard library functions 13
2.2.1.2 strtol
A function to parse a signed number from a string and return it as a number. The behaviour is just like strtoul, but for signed numbers.
Synopsis:
long strtol(const char *nptr, char **endptr, int base)
Parameters: nptr IN: The string containing the number to be parsed endptr OUT: The pointer to the first character after the parsed number. base IN: The base of the number (2..36) or 0.
Returns: The parsed signed number. *endptr is set to point to the first non-valid digit. If converting the string to a number causes an overflow, LONG_MAX is returned. If converting causes an underflow, LONG_MIN is returned. In both cases, *endptr is set equal to nptr. If not a single digit could be parsed, 0 is returned and *endptr is set equal to nptr.
c Copyright 2005 – 2019 Portugal Futurista GmbH, all rights reserved.
14 Libstand API
2.2.1.3 strtoull
A function to parse an unsigned number from a string and return it as a number.
Synopsis:
unsigned long long strtoull(const char *nptr, char **endptr, int base)
Parameters: nptr IN: The string containing the number to be parsed endptr OUT: The pointer to the first character after the parsed number. base IN: The base of the number (2..36) or 0.
Description: At the beginning of the string, ASCII white-space characters, i.e., SPACE or TAB, will be skipped first. Then, any number of + and - will be parsed to possibly return a negated value. Then, if the base is 0 or 16, a prefix of 0x or 0X will be skipped. Then, any number of valid digits for the given base will be parsed. Digits are 0..9,a..z, in that order. Digits a..z have values 10..35. The case of the letters is insignificant; upper case and lower case digits are treated the same. Bases of 2 through 36 are valid, and 0 means ’autodetect’, which means 10 by default, unless the potential number starts with 0x or 0X, which means base 16 will be assumed, or unless the potential number starts with 0, in which case base 8 will be assumed. If the base is outside 0,2,3..36, no digit will be parsed. Digits are valid if their value is strictly smaller than the assumed base. If endptr is NULL, *endptr will not be written.
Returns: The parsed unsigned number. *endptr is set to point to the first non-valid digit. If converting the string to a number causes an overflow or underflow, (unsigned long long)-1 is returned, and *endptr is set equal to nptr. If not a single digit could be parsed, 0 is returned and *endptr is set equal to nptr.
c Copyright 2005 – 2019 Portugal Futurista GmbH, all rights reserved.
ANSI C standard library functions 15
2.2.1.4 strtoll
A function to parse a signed number from a string and return it as a number. The behaviour is just like strtoul, but for signed numbers.
Synopsis:
long long strtoll(const char *nptr, char **endptr, int base)
Parameters: nptr IN: The string containing the number to be parsed endptr OUT: The pointer to the first character after the parsed number. base IN: The base of the number (2..36) or 0.
Returns: The parsed signed number. *endptr is set to point to the first non-valid digit. If converting the string to a number causes an overflow, LLONG_MAX is returned. If converting causes an underflow, LLONG_MIN is returned. In both cases, *endptr is set equal to nptr. If not a single digit could be parsed, 0 is returned and *endptr is set equal to nptr.
c Copyright 2005 – 2019 Portugal Futurista GmbH, all rights reserved.
16 Libstand API
2.2.1.5 bsearch
Synopsis:
void* bsearch(const void *key, const void *base, size_t nmemb, size_t size, int(*compar)(const void *a, const void *b))
Description: Binary search. Search a sorted array for an entry in O(log n) time.
Parameters: [IN] key: Pointer to the key to search for [IN] base: Base address of the array [IN] nmemb: Number of elements in the array [IN] size: Size of each element (in bytes) [IN] compar: Comparison function: -1,0,+1 valued (like strcmp). key is always passed as the first object to this comparison function.
Returns: The pointer to the found array index if it was found, or NULL if the entry is not found. If multiple array elements are equal to the key, it is unspecified which element is returned by this function.
c Copyright 2005 – 2019 Portugal Futurista GmbH, all rights reserved.
ANSI C string manipulation functions 17
2.3 ANSI C string manipulation functions
This section describes the subset of the ANSI C string manipulation functions included in libstand.
c Copyright 2005 – 2019 Portugal Futurista GmbH, all rights reserved.
18 Libstand API
2.3.1 Functions
2.3.1.1 strncat
Concatenate two strings by appending not more than n0 characters (including the terminating NUL character) from the string pointed to by src to the string pointed to by s1. The first character of src overwrites the terminating NUL character of s1. A terminating NUL character is always appended to the result. This means that the number of characters appended to s1 may exceed n0 by one.
Synopsis:
char* strncat(char *dst, const char *src, size_t n0)
Parameters: dst OUT: String to append to. src IN: String which is appended from. n0 IN: Number of characters to append.
Returns: The pointer given as dst.
c Copyright 2005 – 2019 Portugal Futurista GmbH, all rights reserved.
ANSI C string manipulation functions 19
2.3.1.2 strncmp
Compare not more than the first n characters of the string pointed to by s1 and i.
Synopsis:
int strncmp(const char *a, const char *i, size_t n)
Parameters: a IN: Pointer to a string which is compared. i IN: Pointer to a string which is compared. n IN: Number of characters to compare.
Returns: If s1 sorts lexicographically after i, a value greater than than zero is returned. In the opposite case, a value smaller than zero is returned. If the strings are equivalent, zero is returned.
c Copyright 2005 – 2019 Portugal Futurista GmbH, all rights reserved.
20 Libstand API
2.3.1.3 strcmp
Compare the string pointed to by s1 and s2.
Synopsis:
int strcmp(const char *s1, const char *s2)
Parameters: s1 IN: Pointer to a string which is compared. s2 IN: Pointer to a string which is compared.
Returns: If s1 sorts lexicographically after s2, a value greater than than zero is returned. In the opposite case, a value smaller than zero is returned. If the strings are equivalent, zero is returned.
c Copyright 2005 – 2019 Portugal Futurista GmbH, all rights reserved.
ANSI C string manipulation functions 21
2.3.1.4 strncpy
Copy not more than n0 characters (including the terminating NUL character) from the string pointed to by src to the string pointed to by dst0. If n0 is greater than the number of characters in src, NUL characters are appended to src.
Synopsis:
char* strncpy(char *dst, const char *src, size_t n0)
Parameters: dst IN: Pointer to the destination string. src OUT: Pointer to the source string. n0 IN: Number of characters to copy.
Returns: The pointer given as dst.
c Copyright 2005 – 2019 Portugal Futurista GmbH, all rights reserved.
22 Libstand API
2.3.1.5 strlen
Determine the string length of the string pointed to by a str. The string length is the number of characters in the string disreagrding the terminating NUL character.
Synopsis:
size_t strlen(const char *str)
Parameters: str IN: The string to determine the length of.
Returns: The number of characters the given string consists of without the terminating NUL character.
c Copyright 2005 – 2019 Portugal Futurista GmbH, all rights reserved.
ANSI C string manipulation functions 23
2.3.1.6 strnchr
Find the first occurrence of the character c_int (casted to unsigned char) in the first length characters of the string pointed to by s.
Synopsis:
char* strnchr(const char *src_void, size_t length, int c_int)
Parameters: src_void IN: Pointer to the string in which to find the specified character. length IN: Number of bytes of the given string to scan for the specified character. c_int IN: The character to find.
Returns: A pointer to the first occurrence of the character c_int in s or NULL, if c_int is not contained in the first n characters of s.
c Copyright 2005 – 2019 Portugal Futurista GmbH, all rights reserved.
24 Libstand API
2.3.1.7 strnrchr
Find the last occurrence of the character c (casted to unsigned char) in the first n characters of the string pointed to by s.
Synopsis:
char* strnrchr(const char *s, size_t n, int c)
Parameters: s IN: Pointer to the string in which to find the specified character. n IN: Number of bytes of the given string to scan for the specified character. c IN: The character to find.
Returns: A pointer to the last occurrence of the character c in s or NULL, if c is not contained in the first n characters of s.
c Copyright 2005 – 2019 Portugal Futurista GmbH, all rights reserved.
ANSI C string manipulation functions 25
2.3.1.8 strnlen
Determine the number of characters in the string pointed to by str not taking the terminating NUL character into account. Up to n characters are scanned.
Synopsis:
size_t strnlen(const char *str, size_t n)
Parameters: str IN: Pointer to the string to determine the length of. n IN: Maximum length of the given string.
Returns: The number of characters in the string pointed to by str not including the terminating NUL character or n if no terminating NUL character is contained in the first n characters.
c Copyright 2005 – 2019 Portugal Futurista GmbH, all rights reserved.
26 Libstand API
2.3.1.9 strlcpy
Copy not more than n-1 characters (excluding the terminating NUL character) from the string pointed to by s to the string pointed to by d. If count is > 0, dst0 is terminated with NUL.
Synopsis:
size_t strlcpy(char *d, const char *s, size_t n)
Parameters: d IN: Pointer to the destination string. s OUT: Pointer to the source string. n IN: Number of characters to copy.
Returns: The length of string dst0, excluding character 0, or count if the resulting string was too long.
c Copyright 2005 – 2019 Portugal Futurista GmbH, all rights reserved.
ANSI C string manipulation functions 27
2.3.1.10 strlcat
Concatenate two strings, making the result no longer than count-1 characters, excluding the terminating NUL. The destination string is always NUL terminated.
Synopsis:
size_t strlcat(char *d, const char *s, size_t n)
Parameters: d OUT: String to append to. s IN: String which is appended from. n IN: Number of characters to append.
Returns: The length of the string s1, excluding character 0, or count if the resulting string was too long.
c Copyright 2005 – 2019 Portugal Futurista GmbH, all rights reserved.
28 Libstand API
2.3.1.11 memset
Set the first length bytes at the given memory address m to the value of c_int.
Synopsis:
void* memset(void *dst_void, int c_int, size_t length)
Parameters: dst_void OUT: Start memory address. c_int IN: The value to assign to each byte in the specified range. length IN: The length, in bytes, of the range to modify.
Returns: The pointer given as dst_void.
c Copyright 2005 – 2019 Portugal Futurista GmbH, all rights reserved.
ANSI C string manipulation functions 29
2.3.1.12 memchr
Find the first occurence of the byte c_int in the memory range specified by src_void and length.
Synopsis:
void* memchr(const void *src_void, int c_int, size_t length)
Parameters: src_void IN: Start memory address. c_int IN: The byte value to find. length IN: The length, in bytes, of the range to search in.
Returns: A pointer to the first occurrence of the byte c_int in the specified memory range or NULL, if the byte c_int does not occur in the first length bytes.
c Copyright 2005 – 2019 Portugal Futurista GmbH, all rights reserved.
30 Libstand API
2.3.1.13 memcpy
Copy length bytes of the memory block starting at src0 to the memory block starting at dst_void.
Synopsis:
void* memcpy(void *dst_void, const void *src_void, size_t length)
Parameters: dst_void OUT: Start address of the destination memory range. src_void IN: Start address of the source memory range. length IN: Number of bytes to copy from src_void to dst0.
Returns: The pointer given as dst_void.
c Copyright 2005 – 2019 Portugal Futurista GmbH, all rights reserved.
ANSI C string manipulation functions 31
2.3.1.14 memmove
Copy len bytes of the memory block starting at src0 to the overlapping memory block starting at dst_void.
Synopsis:
void* memmove(void *dst_void, const void *src_void, size_t len)
Parameters: dst_void OUT: Start address of the destination memory range. src_void IN: Start address of the source memory range. len IN: Number of bytes to copy from src_void to dst0.
Returns: The pointer given as dst_void.
c Copyright 2005 – 2019 Portugal Futurista GmbH, all rights reserved.
32 Libstand API
2.3.1.15 memcmp
Compare n bytes of the contents of the memory range pointed to by s1 to the contents of the memory range pointed to by b_void.
Synopsis:
int memcmp(const void *a_void, const void *b_void, size_t n)
Parameters: a_void IN: Start address of the memory range to compare. b_void IN: Start address of the memory range to compare. n IN: Number of bytes to compare.
Returns: A value greater than, equal to or smaller than zero, according to whether the memory range pointed to by a_void is gearter than, equal to or smaller than the memory range pointed to by b_void.
c Copyright 2005 – 2019 Portugal Futurista GmbH, all rights reserved.
ANSI C standard types 33
2.4 ANSI C standard types
This sections describes the subset of the ANSI C standard types included in libstand.
2.4.1 Defines
LONG_MAX
P4X_LONG_MIN
LONG_MIN
c Copyright 2005 – 2019 Portugal Futurista GmbH, all rights reserved.
34 Libstand API
2.5 Assert
2.5.1 Defines
assert (x)
Description:
Macro to check at runtime that a condition is true.
If the condition is not true, an assertion failure will be raised, ending execution of the current executable.
The assertion failure is raised by the runtime environment, e.g., when using libvm, i.e., in applications
and in external file providers and in volume providers, libvm contains the assertion failure function and
will, after printing an error message, halt the current partition. In kernel code, e.g. in kernel drivers, the
kernel will raise a kernel level health monitoring event when an assertion failure is triggered. In system
extensions, the PSSW will raise a health monitoring event when an assertion failure is triggered.
c Copyright 2005 – 2019 Portugal Futurista GmbH, all rights reserved.