X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdePkg%2FLibrary%2FBasePrintLib%2FPrintLibInternal.h;h=9e3ce67709d2a581ab6d8dc71a68aeb67f559e79;hb=9095d37b8fe5bfc3d02adad6ba7fd7359ebc0107;hp=32a21266c82b26c035851141eb890e57a7ba46bb;hpb=f405c0674aef0fb8bff34acb0011c47f7cd38ea6;p=mirror_edk2.git diff --git a/MdePkg/Library/BasePrintLib/PrintLibInternal.h b/MdePkg/Library/BasePrintLib/PrintLibInternal.h index 32a21266c8..9e3ce67709 100644 --- a/MdePkg/Library/BasePrintLib/PrintLibInternal.h +++ b/MdePkg/Library/BasePrintLib/PrintLibInternal.h @@ -1,7 +1,7 @@ /** @file Base Print Library instance Internal Functions definition. - Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -19,6 +19,7 @@ #include #include #include +#include // @@ -34,6 +35,7 @@ #define PRECISION BIT11 #define ARGUMENT_REVERSED BIT12 #define COUNT_ONLY_NO_PRINT BIT13 +#define UNSIGNED_TYPE BIT14 // // Record date and time information @@ -53,21 +55,21 @@ typedef struct { } TIME; /** - Worker function that produces a Null-terminated string in an output buffer + Worker function that produces a Null-terminated string in an output buffer based on a Null-terminated format string and a VA_LIST argument list. - VSPrint function to process format and place the results in Buffer. Since a - VA_LIST is used this routine allows the nesting of Vararg routines. Thus + VSPrint function to process format and place the results in Buffer. Since a + VA_LIST is used this routine allows the nesting of Vararg routines. Thus this is the main print working routine. If COUNT_ONLY_NO_PRINT is set in Flags, Buffer will not be modified at all. - @param[out] Buffer The character buffer to print the results of the + @param[out] Buffer The character buffer to print the results of the parsing of Format into. - @param[in] BufferSize The maximum number of characters to put into + @param[in] BufferSize The maximum number of characters to put into buffer. @param[in] Flags Initial flags value. - Can only have FORMAT_UNICODE, OUTPUT_UNICODE, + Can only have FORMAT_UNICODE, OUTPUT_UNICODE, and COUNT_ONLY_NO_PRINT set. @param[in] Format A Null-terminated format string. @param[in] VaListMarker VA_LIST style variable argument list consumed by @@ -91,11 +93,11 @@ BasePrintLibSPrintMarker ( ); /** - Worker function that produces a Null-terminated string in an output buffer + Worker function that produces a Null-terminated string in an output buffer based on a Null-terminated format string and variable argument list. - VSPrint function to process format and place the results in Buffer. Since a - VA_LIST is used this routine allows the nesting of Vararg routines. Thus + VSPrint function to process format and place the results in Buffer. Since a + VA_LIST is used this routine allows the nesting of Vararg routines. Thus this is the main print working routine @param StartOfBuffer The character buffer to print the results of the parsing @@ -127,7 +129,7 @@ BasePrintLibSPrint ( @param Buffer Buffer to place the Unicode or ASCII string. @param EndBuffer The end of the input Buffer. No characters will be - placed after that. + placed after that. @param Length The count of character to be placed into Buffer. (Negative value indicates no buffer fill.) @param Character The character to be placed into Buffer. @@ -159,30 +161,30 @@ BasePrintLibFillBuffer ( **/ CHAR8 * BasePrintLibValueToString ( - IN OUT CHAR8 *Buffer, - IN INT64 Value, + IN OUT CHAR8 *Buffer, + IN INT64 Value, IN UINTN Radix ); /** Internal function that converts a decimal value to a Null-terminated string. - - Converts the decimal number specified by Value to a Null-terminated + + Converts the decimal number specified by Value to a Null-terminated string specified by Buffer containing at most Width characters. If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed. The total number of characters placed in Buffer is returned. If the conversion contains more than Width characters, then only the first - Width characters are returned, and the total number of characters + Width characters are returned, and the total number of characters required to perform the conversion is returned. - Additional conversion parameters are specified in Flags. + Additional conversion parameters are specified in Flags. The Flags bit LEFT_JUSTIFY is always ignored. All conversions are left justified in Buffer. If Width is 0, PREFIX_ZERO is ignored in Flags. If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas are inserted every 3rd digit starting from the right. If Value is < 0, then the fist character in Buffer is a '-'. - If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, - then Buffer is padded with '0' characters so the combination of the optional '-' + If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, + then Buffer is padded with '0' characters so the combination of the optional '-' sign character, '0' characters, digit characters for Value, and the Null-terminator add up to Width characters. @@ -198,7 +200,7 @@ BasePrintLibValueToString ( @param Width The maximum number of characters to place in Buffer, not including the Null-terminator. @param Increment Character increment in Buffer. - + @return Total number of characters required to perform the conversion. **/ @@ -211,4 +213,65 @@ BasePrintLibConvertValueToString ( IN UINTN Increment ); +/** + Internal function that converts a decimal value to a Null-terminated string. + + Converts the decimal number specified by Value to a Null-terminated string + specified by Buffer containing at most Width characters. If Width is 0 then a + width of MAXIMUM_VALUE_CHARACTERS is assumed. If the conversion contains more + than Width characters, then only the first Width characters are placed in + Buffer. Additional conversion parameters are specified in Flags. + The Flags bit LEFT_JUSTIFY is always ignored. + All conversions are left justified in Buffer. + If Width is 0, PREFIX_ZERO is ignored in Flags. + If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and + commas are inserted every 3rd digit starting from the right. + If Value is < 0, then the fist character in Buffer is a '-'. + If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, + then Buffer is padded with '0' characters so the combination of the optional + '-' sign character, '0' characters, digit characters for Value, and the + Null-terminator add up to Width characters. + + If an error would be returned, the function will ASSERT(). + + @param Buffer The pointer to the output buffer for the produced + Null-terminated string. + @param BufferSize The size of Buffer in bytes, including the + Null-terminator. + @param Flags The bitmask of flags that specify left justification, + zero pad, and commas. + @param Value The 64-bit signed value to convert to a string. + @param Width The maximum number of characters to place in Buffer, + not including the Null-terminator. + @param Increment The character increment in Buffer. + + @retval RETURN_SUCCESS The decimal value is converted. + @retval RETURN_BUFFER_TOO_SMALL If BufferSize cannot hold the converted + value. + @retval RETURN_INVALID_PARAMETER If Buffer is NULL. + If Increment is 1 and + PcdMaximumAsciiStringLength is not zero, + BufferSize is greater than + PcdMaximumAsciiStringLength. + If Increment is not 1 and + PcdMaximumUnicodeStringLength is not zero, + BufferSize is greater than + (PcdMaximumUnicodeStringLength * + sizeof (CHAR16) + 1). + If unsupported bits are set in Flags. + If both COMMA_TYPE and RADIX_HEX are set in + Flags. + If Width >= MAXIMUM_VALUE_CHARACTERS. + +**/ +RETURN_STATUS +BasePrintLibConvertValueToStringS ( + IN OUT CHAR8 *Buffer, + IN UINTN BufferSize, + IN UINTN Flags, + IN INT64 Value, + IN UINTN Width, + IN UINTN Increment + ); + #endif