1 krisbash 1.1 /*
2 **==============================================================================
3 **
4 ** Open Management Infrastructure (OMI)
5 **
6 ** Copyright (c) Microsoft Corporation
7 **
8 ** Licensed under the Apache License, Version 2.0 (the "License"); you may not
9 ** use this file except in compliance with the License. You may obtain a copy
10 ** of the License at
11 **
12 ** http://www.apache.org/licenses/LICENSE-2.0
13 **
14 ** THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 ** KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
16 ** WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
17 ** MERCHANTABLITY OR NON-INFRINGEMENT.
18 **
19 ** See the Apache 2 License for the specific language governing permissions
20 ** and limitations under the License.
21 **
22 krisbash 1.1 **==============================================================================
23 */
24
25 #ifndef _base_format_placeholders_h
26 #define _base_format_placeholders_h
27
28 #ifdef INTLSTR_RC_INC
29 # define PAL_PRItstr "s"
30 # define PAL_PRItchr "c"
31 #elif defined(CONFIG_ENABLE_WCHAR)
32 # define PAL_PRItstr "S"
33 # define PAL_PRItchr "C"
34 #else
35 # define PAL_PRItstr "s"
36 # define PAL_PRItchr "c"
37 #endif
38
39 #if defined(_MSC_VER) || defined(INTLSTR_RC_INC)
40 # define PAL_PRId64 "I64d"
41 # define PAL_PRIu64 "I64u"
42 # define PAL_PRIx64 "I64x"
43 krisbash 1.1 #else
44 #define PAL_PRId64 "lld"
45 #define PAL_PRIu64 "llu"
46 #define PAL_PRIx64 "llx"
47 #endif
48
49 #if defined(_MSC_VER) || defined(INTLSTR_RC_INC)
50 /* the format specifiers below follows the documentation of FormatMessage
51 from http://msdn.microsoft.com/en-us/library/windows/desktop/ms679351(v=vs.85).aspx */
52 #define Intlstr_UnverifiedPlaceholder(orderNumber, regularFormatSpecifier) \
53 "%" #orderNumber "!" regularFormatSpecifier "!"
54 #else
55 /* the format specifiers below follows the specification
56 from http://www.opengroup.org/onlinepubs/009695399/functions/printf.html */
57 #define Intlstr_UnverifiedPlaceholder(orderNumber, regularFormatSpecifier) \
58 "%" #orderNumber "$" regularFormatSpecifier
59 #endif
60
61 #define Intlstr_d(orderNumber) Intlstr_UnverifiedPlaceholder(orderNumber, "d")
62 #define Intlstr_x(orderNumber) Intlstr_UnverifiedPlaceholder(orderNumber, "x")
63 #define Intlstr_tstr(orderNumber) Intlstr_UnverifiedPlaceholder(orderNumber, PAL_PRItstr)
64 krisbash 1.1 #define Intlstr_tchr(orderNumber) Intlstr_UnverifiedPlaceholder(orderNumber, PAL_PRItchr)
65
66 /* Format specifiers that do NOT work and should not be added above:
67 * %f and %g - floating point not supported by FormatMessage
68 * http://msdn.microsoft.com/en-us/library/windows/desktop/ms679351(v=vs.85).aspx explicitly says:
69 * Floating-point format specifiers - e, E, f, and g - are not supported.
70 * %p - apparently not supported by FormatMessage - failed when unit testing
71 */
72
73 #endif /* _base_format_placeholders_h */
|