1 //
2 // cprintf.cpp
3 //
4 // Copyright (c) Microsoft Corporation. All rights reserved.
5 //
6 // The standard output functions, which perform formatted output to the
7 // console.
8 //
9 #include <corecrt_internal_stdio_output.h>
10
11
12 using namespace __crt_stdio_output;
13
14
15
16 template <template <typename, typename> class Base, typename Character>
common_vcprintf(unsigned __int64 const options,Character const * const format,__crt_cached_ptd_host & ptd,va_list const arglist)17 static int __cdecl common_vcprintf(
18 unsigned __int64 const options,
19 Character const* const format,
20 __crt_cached_ptd_host& ptd,
21 va_list const arglist
22 )
23 {
24 typedef output_processor<
25 Character,
26 console_output_adapter<Character>,
27 Base<Character, console_output_adapter<Character>>
28 > processor_type;
29
30 processor_type processor(
31 console_output_adapter<Character>(),
32 options,
33 format,
34 ptd,
35 arglist);
36
37 return processor.process();
38 }
39
__conio_common_vcprintf(unsigned __int64 const options,char const * const format,_locale_t const locale,va_list const arglist)40 extern "C" int __cdecl __conio_common_vcprintf(
41 unsigned __int64 const options,
42 char const* const format,
43 _locale_t const locale,
44 va_list const arglist
45 )
46 {
47 __crt_cached_ptd_host ptd{locale};
48 return common_vcprintf<standard_base>(options, format, ptd, arglist);
49 }
50
__conio_common_vcprintf_s(unsigned __int64 const options,char const * const format,_locale_t const locale,va_list const arglist)51 extern "C" int __cdecl __conio_common_vcprintf_s(
52 unsigned __int64 const options,
53 char const* const format,
54 _locale_t const locale,
55 va_list const arglist
56 )
57 {
58 __crt_cached_ptd_host ptd{locale};
59 return common_vcprintf<format_validation_base>(options, format, ptd, arglist);
60 }
61
__conio_common_vcprintf_p(unsigned __int64 const options,char const * const format,_locale_t const locale,va_list const arglist)62 extern "C" int __cdecl __conio_common_vcprintf_p(
63 unsigned __int64 const options,
64 char const* const format,
65 _locale_t const locale,
66 va_list const arglist
67 )
68 {
69 __crt_cached_ptd_host ptd{locale};
70 return common_vcprintf<positional_parameter_base>(options, format, ptd, arglist);
71 }
72
__conio_common_vcwprintf(unsigned __int64 const options,wchar_t const * const format,_locale_t const locale,va_list const arglist)73 extern "C" int __cdecl __conio_common_vcwprintf(
74 unsigned __int64 const options,
75 wchar_t const* const format,
76 _locale_t const locale,
77 va_list const arglist
78 )
79 {
80 __crt_cached_ptd_host ptd{locale};
81 return common_vcprintf<standard_base>(options, format, ptd, arglist);
82 }
83
__conio_common_vcwprintf_s(unsigned __int64 const options,wchar_t const * const format,_locale_t const locale,va_list const arglist)84 extern "C" int __cdecl __conio_common_vcwprintf_s(
85 unsigned __int64 const options,
86 wchar_t const* const format,
87 _locale_t const locale,
88 va_list const arglist
89 )
90 {
91 __crt_cached_ptd_host ptd{locale};
92 return common_vcprintf<format_validation_base>(options, format, ptd, arglist);
93 }
94
__conio_common_vcwprintf_p(unsigned __int64 const options,wchar_t const * const format,_locale_t const locale,va_list const arglist)95 extern "C" int __cdecl __conio_common_vcwprintf_p(
96 unsigned __int64 const options,
97 wchar_t const* const format,
98 _locale_t const locale,
99 va_list const arglist
100 )
101 {
102 __crt_cached_ptd_host ptd{locale};
103 return common_vcprintf<positional_parameter_base>(options, format, ptd, arglist);
104 }
105