Changeset 33496 in vbox
- Timestamp:
- Oct 27, 2010 12:15:28 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/string.h
r33111 r33496 1424 1424 1425 1425 1426 /** @page pg_rt_str_format The IPRT Format Strings 1427 * 1428 * IPRT implements most of the commonly used format types and flags with the 1429 * exception of floating point which is completely missing. In addition IPRT 1430 * provides a number of IPRT specific format types for the IPRT typedefs and 1431 * other useful things. Note that several of these extensions are similar to 1432 * \%p and doesn't care much if you try add formating flags/width/precision. 1433 * 1434 * 1435 * Group 0a, The commonly used format types: 1436 * - \%s - Takes a pointer to a zero terminated string (UTF-8) and 1437 * prints it with the optionally adjustment (width, -) and 1438 * length restriction (precision). 1439 * - \%ls - Same as \%s except that the input is UTF-16 (output UTF-8). 1440 * - \%Ls - Same as \%s except that the input is UCS-32 (output UTF-8). 1441 * - \%S - R3: Same as \%s except it is printed in the current codeset 1442 * instead of UTF-8 (source is still UTF-8). 1443 * Other contexts: Same as \%s. 1444 * - \%lS - Same as \%S except that the input is UTF-16 (output UTF-8). 1445 * - \%LS - Same as \%S except that the input is UCS-32 (output UTF-8). 1446 * - \%c - Takes a char and prints it. 1447 * - \%d - Takes a signed integer and prints it as decimal. Thousand 1448 * separator (\'), zero padding (0), adjustment (-+), width, 1449 * precision 1450 * - \%i - Same as \%d. 1451 * - \%u - Takes an unsigned integer and prints it as decimal. Thousand 1452 * separator (\'), zero padding (0), adjustment (-+), width, 1453 * precision 1454 * - \%x - Takes an unsigned integer and prints it as lowercased 1455 * hexadecimal. The special hash (\#) flag causes a '0x' 1456 * prefixed to be printed. Zero padding (0), adjustment (-+), 1457 * width, precision. 1458 * - \%X - Same as \%x except that it is uppercased. 1459 * - \%o - Takes an unsigned (?) integer and prints it as octal. Zero 1460 * padding (0), adjustment (-+), width, precision. 1461 * - \%p - Takes a pointer (void technically) and prints it. Zero 1462 * padding (0), adjustment (-+), width, precision. 1463 * 1464 * The \%d, \%i, \%u, \%x, \%X and \%o format types support the following 1465 * argument type specifiers: 1466 * - \%ll - long long (uint64_t). 1467 * - \%L - long long (uint64_t). 1468 * - \%l - long (uint32_t, uint64_t) 1469 * - \%h - short (int16_t). 1470 * - \%hh - char (int8_t). 1471 * - \%H - char (int8_t). 1472 * - \%z - size_t. 1473 * - \%j - intmax_t (int64_t). 1474 * - \%t - ptrdiff_t. 1475 * The type in parentheses is typical sizes, however when printing those types 1476 * you are better off using the special group 2 format types below (\%RX32 and 1477 * such). 1478 * 1479 * 1480 * Group 0b, IPRT format tricks: 1481 * - %M - Replaces the format string, takes a string pointer. 1482 * - %N - Nested formatting, takes a pointer to a format string 1483 * followed by the pointer to a va_list variable. The va_list 1484 * variable will not be modified and the caller must do va_end() 1485 * on it. Make sure the va_list variable is NOT in a parameter 1486 * list or some gcc versions/targets may get it all wrong. 1487 * 1488 * 1489 * Group 1, the basic runtime typedefs (excluding those which obviously are 1490 * pointer): 1491 * - \%RTbool - Takes a bool value and prints 'true', 'false', or '!%d!'. 1492 * - \%RTfile - Takes a #RTFILE value. 1493 * - \%RTfmode - Takes a #RTFMODE value. 1494 * - \%RTfoff - Takes a #RTFOFF value. 1495 * - \%RTfp16 - Takes a #RTFAR16 value. 1496 * - \%RTfp32 - Takes a #RTFAR32 value. 1497 * - \%RTfp64 - Takes a #RTFAR64 value. 1498 * - \%RTgid - Takes a #RTGID value. 1499 * - \%RTino - Takes a #RTINODE value. 1500 * - \%RTint - Takes a #RTINT value. 1501 * - \%RTiop - Takes a #RTIOPORT value. 1502 * - \%RTldrm - Takes a #RTLDRMOD value. 1503 * - \%RTmac - Takes a #PCRTMAC pointer. 1504 * - \%RTnaddr - Takes a #PCRTNETADDR value. 1505 * - \%RTnaipv4 - Takes a #RTNETADDRIPV4 value. 1506 * - \%RTnaipv6 - Takes a #PCRTNETADDRIPV6 value. 1507 * - \%RTnthrd - Takes a #RTNATIVETHREAD value. 1508 * - \%RTnthrd - Takes a #RTNATIVETHREAD value. 1509 * - \%RTproc - Takes a #RTPROCESS value. 1510 * - \%RTptr - Takes a #RTINTPTR or #RTUINTPTR value (but not void *). 1511 * - \%RTreg - Takes a #RTCCUINTREG value. 1512 * - \%RTsel - Takes a #RTSEL value. 1513 * - \%RTsem - Takes a #RTSEMEVENT, #RTSEMEVENTMULTI, #RTSEMMUTEX, #RTSEMFASTMUTEX, or #RTSEMRW value. 1514 * - \%RTsock - Takes a #RTSOCKET value. 1515 * - \%RTthrd - Takes a #RTTHREAD value. 1516 * - \%RTuid - Takes a #RTUID value. 1517 * - \%RTuint - Takes a #RTUINT value. 1518 * - \%RTunicp - Takes a #RTUNICP value. 1519 * - \%RTutf16 - Takes a #RTUTF16 value. 1520 * - \%RTuuid - Takes a #PCRTUUID and will print the UUID as a string. 1521 * - \%RTxuint - Takes a #RTUINT or #RTINT value, formatting it as hex. 1522 * - \%RGi - Takes a #RTGCINT value. 1523 * - \%RGp - Takes a #RTGCPHYS value. 1524 * - \%RGr - Takes a #RTGCUINTREG value. 1525 * - \%RGu - Takes a #RTGCUINT value. 1526 * - \%RGv - Takes a #RTGCPTR, #RTGCINTPTR or #RTGCUINTPTR value. 1527 * - \%RGx - Takes a #RTGCUINT or #RTGCINT value, formatting it as hex. 1528 * - \%RHi - Takes a #RTHCINT value. 1529 * - \%RHp - Takes a #RTHCPHYS value. 1530 * - \%RHr - Takes a #RTHCUINTREG value. 1531 * - \%RHu - Takes a #RTHCUINT value. 1532 * - \%RHv - Takes a #RTHCPTR, #RTHCINTPTR or #RTHCUINTPTR value. 1533 * - \%RHx - Takes a #RTHCUINT or #RTHCINT value, formatting it as hex. 1534 * - \%RRv - Takes a #RTRCPTR, #RTRCINTPTR or #RTRCUINTPTR value. 1535 * - \%RCi - Takes a #RTINT value. 1536 * - \%RCp - Takes a #RTCCPHYS value. 1537 * - \%RCr - Takes a #RTCCUINTREG value. 1538 * - \%RCu - Takes a #RTUINT value. 1539 * - \%RCv - Takes a #uintptr_t, #intptr_t, void * value. 1540 * - \%RCx - Takes a #RTUINT or #RTINT value, formatting it as hex. 1541 * 1542 * 1543 * Group 2, the generic integer types which are prefered over relying on what 1544 * bit-count a 'long', 'short', or 'long long' has on a platform. This are 1545 * highly prefered for the [u]intXX_t kind of types: 1546 * - \%RI[8|16|32|64] - Signed integer value of the specifed bit count. 1547 * - \%RU[8|16|32|64] - Unsigned integer value of the specifed bit count. 1548 * - \%RX[8|16|32|64] - Hexadecimal integer value of the specifed bit count. 1549 * 1550 * 1551 * Group 3, hex dumpers and other complex stuff which requires more than simple 1552 * formatting: 1553 * - \%Rhxd - Takes a pointer to the memory which is to be dumped in typical 1554 * hex format. Use the precision to specify the length, and the width to 1555 * set the number of bytes per line. Default width and precision is 16. 1556 * - \%Rhxs - Takes a pointer to the memory to be displayed as a hex string, 1557 * i.e. a series of space separated bytes formatted as two digit hex value. 1558 * Use the precision to specify the length. Default length is 16 bytes. 1559 * The width, if specified, is ignored. 1560 * - \%Rrc - Takes an integer iprt status code as argument. Will insert the 1561 * status code define corresponding to the iprt status code. 1562 * - \%Rrs - Takes an integer iprt status code as argument. Will insert the 1563 * short description of the specified status code. 1564 * - \%Rrf - Takes an integer iprt status code as argument. Will insert the 1565 * full description of the specified status code. 1566 * - \%Rra - Takes an integer iprt status code as argument. Will insert the 1567 * status code define + full description. 1568 * - \%Rwc - Takes a long Windows error code as argument. Will insert the status 1569 * code define corresponding to the Windows error code. 1570 * - \%Rwf - Takes a long Windows error code as argument. Will insert the 1571 * full description of the specified status code. 1572 * - \%Rwa - Takes a long Windows error code as argument. Will insert the 1573 * error code define + full description. 1574 * 1575 * - \%Rhrc - Takes a COM/XPCOM status code as argument. Will insert the status 1576 * code define corresponding to the Windows error code. 1577 * - \%Rhrf - Takes a COM/XPCOM status code as argument. Will insert the 1578 * full description of the specified status code. 1579 * - \%Rhra - Takes a COM/XPCOM error code as argument. Will insert the 1580 * error code define + full description. 1581 * 1582 * - \%Rfn - Pretty printing of a function or method. It drops the 1583 * return code and parameter list. 1584 * - \%Rbn - Prints the base name. For dropping the path in 1585 * order to save space when printing a path name. 1586 * 1587 * On other platforms, \%Rw? simply prints the argument in a form of 0xXXXXXXXX. 1588 * 1589 * 1590 * Group 4, structure dumpers: 1591 * - \%RDtimespec - Takes a PCRTTIMESPEC. 1592 * 1593 * 1594 * Group 5, XML / HTML escapers: 1595 * - \%RMas - Takes a string pointer (const char *) and outputs 1596 * it as an attribute value with the proper escaping. 1597 * This typically ends up in double quotes. 1598 * 1599 * - \%RMes - Takes a string pointer (const char *) and outputs 1600 * it as an element with the necessary escaping. 1601 * 1602 * 1603 */ 1426 1604 1427 1605 #ifndef DECLARED_FNRTSTROUTPUT /* duplicated in iprt/log.h */ 1428 # define DECLARED_FNRTSTROUTPUT1606 # define DECLARED_FNRTSTROUTPUT 1429 1607 /** 1430 1608 * Output callback. … … 1509 1687 * @param pfnFormat Custom format worker. 1510 1688 * @param pvArgFormat Argument to the format worker. 1511 * @param pszFormat Format string pointer.1689 * @param pszFormat Pointer to the format string, @see pg_rt_str_format. 1512 1690 * @param InArgs Argument list. 1513 1691 */ … … 1526 1704 * @param pfnFormat Custom format worker. 1527 1705 * @param pvArgFormat Argument to the format worker. 1528 * @param pszFormat Format string.1706 * @param pszFormat Pointer to the format string, @see pg_rt_str_format. 1529 1707 * @param ... Argument list. 1530 1708 */ … … 1628 1806 * @param pszBuffer Output buffer. 1629 1807 * @param cchBuffer Size of the output buffer. 1630 * @param pszFormat The format string.1808 * @param pszFormat Pointer to the format string, @see pg_rt_str_format. 1631 1809 * @param args The format argument. 1632 1810 */ … … 1640 1818 * @param pszBuffer Output buffer. 1641 1819 * @param cchBuffer Size of the output buffer. 1642 * @param pszFormat The format string.1820 * @param pszFormat Pointer to the format string, @see pg_rt_str_format. 1643 1821 * @param ... The format argument. 1644 1822 */ … … 1655 1833 * @param pszBuffer Output buffer. 1656 1834 * @param cchBuffer Size of the output buffer. 1657 * @param pszFormat The format string.1835 * @param pszFormat Pointer to the format string, @see pg_rt_str_format. 1658 1836 * @param args The format argument. 1659 1837 */ … … 1669 1847 * @param pszBuffer Output buffer. 1670 1848 * @param cchBuffer Size of the output buffer. 1671 * @param pszFormat The format string.1849 * @param pszFormat Pointer to the format string, @see pg_rt_str_format. 1672 1850 * @param ... The format argument. 1673 1851 */ … … 1684 1862 * The buffer should be freed using RTStrFree(). 1685 1863 * On failure *ppszBuffer will be set to NULL. 1686 * @param pszFormat The format string.1864 * @param pszFormat Pointer to the format string, @see pg_rt_str_format. 1687 1865 * @param args The format argument. 1688 1866 */ … … 1698 1876 * The buffer should be freed using RTStrFree(). 1699 1877 * On failure *ppszBuffer will be set to NULL. 1700 * @param pszFormat The format string.1878 * @param pszFormat Pointer to the format string, @see pg_rt_str_format. 1701 1879 * @param args The format argument. 1702 1880 * @param pszTag Allocation tag used for statistics and such. … … 1713 1891 * The buffer should be freed using RTStrFree(). 1714 1892 * On failure *ppszBuffer will be set to NULL. 1715 * @param pszFormat The format string.1893 * @param pszFormat Pointer to the format string, @see pg_rt_str_format. 1716 1894 * @param ... The format argument. 1717 1895 */ … … 1736 1914 * On failure *ppszBuffer will be set to NULL. 1737 1915 * @param pszTag Allocation tag used for statistics and such. 1738 * @param pszFormat The format string.1916 * @param pszFormat Pointer to the format string, @see pg_rt_str_format. 1739 1917 * @param ... The format argument. 1740 1918 */ … … 1754 1932 * @returns Formatted string. Use RTStrFree() to free it. NULL when out of 1755 1933 * memory. 1756 * @param pszFormat The format string.1934 * @param pszFormat Pointer to the format string, @see pg_rt_str_format. 1757 1935 * @param args The format argument. 1758 1936 */ … … 1764 1942 * @returns Formatted string. Use RTStrFree() to free it. NULL when out of 1765 1943 * memory. 1766 * @param pszFormat The format string.1944 * @param pszFormat Pointer to the format string, @see pg_rt_str_format. 1767 1945 * @param args The format argument. 1768 1946 * @param pszTag Allocation tag used for statistics and such. … … 1775 1953 * @returns Formatted string. Use RTStrFree() to free it. NULL when out of 1776 1954 * memory. 1777 * @param pszFormat The format string.1955 * @param pszFormat Pointer to the format string, @see pg_rt_str_format. 1778 1956 * @param ... The format argument. 1779 1957 */ … … 1794 1972 * memory. 1795 1973 * @param pszTag Allocation tag used for statistics and such. 1796 * @param pszFormat The format string.1974 * @param pszFormat Pointer to the format string, @see pg_rt_str_format. 1797 1975 * @param ... The format argument. 1798 1976 */ -
trunk/src/VBox/Runtime/common/log/logformat.cpp
r28800 r33496 72 72 /** 73 73 * Callback to format VBox formatting extentions. 74 * See @ref pg_rt_str_format _rtfor a reference on the format types.74 * See @ref pg_rt_str_format for a reference on the format types. 75 75 * 76 76 * @returns The number of bytes formatted. -
trunk/src/VBox/Runtime/common/string/strformat.cpp
r29783 r33496 485 485 #ifndef IN_RING3 486 486 case 'S': /* Unicode string as current code page -> Unicode as UTF-8 in GC/R0. */ 487 chArgSize = 'l'; 487 chArgSize = 'l'; /** @todo this is nonsensical, isn't it? */ 488 488 /* fall thru */ 489 489 #endif -
trunk/src/VBox/Runtime/common/string/strformatrt.cpp
r33299 r33496 5 5 6 6 /* 7 * Copyright (C) 2006-20 07Oracle Corporation7 * Copyright (C) 2006-2010 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 25 25 */ 26 26 27 /** @page pg_rt_str_format_rt The IPRT String Format Extensions28 *29 * The string formatter supports most of the non-float format types and flags.30 * See RTStrFormatV() for the full tail there. In addition we've added a number31 * of iprt specific format types for the iprt typedefs and other useful stuff.32 * Note that several of these are similar to \%p and doesn't care much if you try33 * add formating flags/width/precision.34 *35 *36 * Group 1, the basic runtime typedefs (excluding those which obviously are pointer).37 * - \%RTbool - Takes a bool value and prints 'true', 'false', or '!%d!'.38 * - \%RTfile - Takes a #RTFILE value.39 * - \%RTfmode - Takes a #RTFMODE value.40 * - \%RTfoff - Takes a #RTFOFF value.41 * - \%RTfp16 - Takes a #RTFAR16 value.42 * - \%RTfp32 - Takes a #RTFAR32 value.43 * - \%RTfp64 - Takes a #RTFAR64 value.44 * - \%RTgid - Takes a #RTGID value.45 * - \%RTino - Takes a #RTINODE value.46 * - \%RTint - Takes a #RTINT value.47 * - \%RTiop - Takes a #RTIOPORT value.48 * - \%RTldrm - Takes a #RTLDRMOD value.49 * - \%RTmac - Takes a #PCRTMAC pointer.50 * - \%RTnaddr - Takes a #PCRTNETADDR value.51 * - \%RTnaipv4 - Takes a #RTNETADDRIPV4 value.52 * - \%RTnaipv6 - Takes a #PCRTNETADDRIPV6 value.53 * - \%RTnthrd - Takes a #RTNATIVETHREAD value.54 * - \%RTnthrd - Takes a #RTNATIVETHREAD value.55 * - \%RTproc - Takes a #RTPROCESS value.56 * - \%RTptr - Takes a #RTINTPTR or #RTUINTPTR value (but not void *).57 * - \%RTreg - Takes a #RTCCUINTREG value.58 * - \%RTsel - Takes a #RTSEL value.59 * - \%RTsem - Takes a #RTSEMEVENT, #RTSEMEVENTMULTI, #RTSEMMUTEX, #RTSEMFASTMUTEX, or #RTSEMRW value.60 * - \%RTsock - Takes a #RTSOCKET value.61 * - \%RTthrd - Takes a #RTTHREAD value.62 * - \%RTuid - Takes a #RTUID value.63 * - \%RTuint - Takes a #RTUINT value.64 * - \%RTunicp - Takes a #RTUNICP value.65 * - \%RTutf16 - Takes a #RTUTF16 value.66 * - \%RTuuid - Takes a #PCRTUUID and will print the UUID as a string.67 * - \%RTxuint - Takes a #RTUINT or #RTINT value, formatting it as hex.68 * - \%RGi - Takes a #RTGCINT value.69 * - \%RGp - Takes a #RTGCPHYS value.70 * - \%RGr - Takes a #RTGCUINTREG value.71 * - \%RGu - Takes a #RTGCUINT value.72 * - \%RGv - Takes a #RTGCPTR, #RTGCINTPTR or #RTGCUINTPTR value.73 * - \%RGx - Takes a #RTGCUINT or #RTGCINT value, formatting it as hex.74 * - \%RHi - Takes a #RTHCINT value.75 * - \%RHp - Takes a #RTHCPHYS value.76 * - \%RHr - Takes a #RTHCUINTREG value.77 * - \%RHu - Takes a #RTHCUINT value.78 * - \%RHv - Takes a #RTHCPTR, #RTHCINTPTR or #RTHCUINTPTR value.79 * - \%RHx - Takes a #RTHCUINT or #RTHCINT value, formatting it as hex.80 * - \%RRv - Takes a #RTRCPTR, #RTRCINTPTR or #RTRCUINTPTR value.81 * - \%RCi - Takes a #RTINT value.82 * - \%RCp - Takes a #RTCCPHYS value.83 * - \%RCr - Takes a #RTCCUINTREG value.84 * - \%RCu - Takes a #RTUINT value.85 * - \%RCv - Takes a #uintptr_t, #intptr_t, void * value.86 * - \%RCx - Takes a #RTUINT or #RTINT value, formatting it as hex.87 *88 *89 * Group 2, the generic integer types which are prefered over relying on what90 * bit-count a 'long', 'short', or 'long long' has on a platform. This are91 * highly prefered for the [u]intXX_t kind of types.92 * - \%RI[8|16|32|64] - Signed integer value of the specifed bit count.93 * - \%RU[8|16|32|64] - Unsigned integer value of the specifed bit count.94 * - \%RX[8|16|32|64] - Hexadecimal integer value of the specifed bit count.95 *96 *97 * Group 3, hex dumpers and other complex stuff which requires more than simple formatting.98 * - \%Rhxd - Takes a pointer to the memory which is to be dumped in typical99 * hex format. Use the precision to specify the length, and the width to100 * set the number of bytes per line. Default width and precision is 16.101 * - \%Rhxs - Takes a pointer to the memory to be displayed as a hex string,102 * i.e. a series of space separated bytes formatted as two digit hex value.103 * Use the precision to specify the length. Default length is 16 bytes.104 * The width, if specified, is ignored.105 * - \%Rrc - Takes an integer iprt status code as argument. Will insert the106 * status code define corresponding to the iprt status code.107 * - \%Rrs - Takes an integer iprt status code as argument. Will insert the108 * short description of the specified status code.109 * - \%Rrf - Takes an integer iprt status code as argument. Will insert the110 * full description of the specified status code.111 * - \%Rra - Takes an integer iprt status code as argument. Will insert the112 * status code define + full description.113 * - \%Rwc - Takes a long Windows error code as argument. Will insert the status114 * code define corresponding to the Windows error code.115 * - \%Rwf - Takes a long Windows error code as argument. Will insert the116 * full description of the specified status code.117 * - \%Rwa - Takes a long Windows error code as argument. Will insert the118 * error code define + full description.119 *120 * - \%Rhrc - Takes a COM/XPCOM status code as argument. Will insert the status121 * code define corresponding to the Windows error code.122 * - \%Rhrf - Takes a COM/XPCOM status code as argument. Will insert the123 * full description of the specified status code.124 * - \%Rhra - Takes a COM/XPCOM error code as argument. Will insert the125 * error code define + full description.126 *127 * - \%Rfn - Pretty printing of a function or method. It drops the128 * return code and parameter list.129 * - \%Rbn - Prints the base name. For dropping the path in130 * order to save space when printing a path name.131 *132 * On other platforms, \%Rw? simply prints the argument in a form of 0xXXXXXXXX.133 *134 *135 * Group 4, structure dumpers.136 *137 * - \%RDtimespec - Takes a PCRTTIMESPEC.138 *139 *140 * Group 5, XML / HTML escapers.141 * - \%RMas - Takes a string pointer (const char *) and outputs142 * it as an attribute value with the proper escaping.143 * This typically ends up in double quotes.144 *145 * - \%RMes - Takes a string pointer (const char *) and outputs146 * it as an element with the necessary escaping.147 *148 *149 */150 27 151 28 /******************************************************************************* … … 174 51 /** 175 52 * Callback to format iprt formatting extentions. 176 * See @ref pg_rt_str_format _rtfor a reference on the format types.53 * See @ref pg_rt_str_format for a reference on the format types. 177 54 * 178 55 * @returns The number of bytes formatted.
Note:
See TracChangeset
for help on using the changeset viewer.