1 /**
2  * @file IxOsPrintf.h
3  *
4  * @brief this file contains the API of the @ref IxOsServices component
5  *
6  * @par
7  * IXP400 SW Release version 2.0
8  *
9  * -- Copyright Notice --
10  *
11  * @par
12  * Copyright 2001-2005, Intel Corporation.
13  * All rights reserved.
14  *
15  * @par
16  * Redistribution and use in source and binary forms, with or without
17  * modification, are permitted provided that the following conditions
18  * are met:
19  * 1. Redistributions of source code must retain the above copyright
20  *    notice, this list of conditions and the following disclaimer.
21  * 2. Redistributions in binary form must reproduce the above copyright
22  *    notice, this list of conditions and the following disclaimer in the
23  *    documentation and/or other materials provided with the distribution.
24  * 3. Neither the name of the Intel Corporation nor the names of its contributors
25  *    may be used to endorse or promote products derived from this software
26  *    without specific prior written permission.
27  *
28  * @par
29  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
30  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
33  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39  * SUCH DAMAGE.
40  *
41  * @par
42  * -- End of Copyright Notice --
43  */
44 
45 #include "IxTypes.h"
46 
47 #ifndef IxOsPrintf_H
48 
49 #ifndef __doxygen_hide
50 #define IxOsPrintf_H
51 #endif /* __doxygen_hide */
52 
53 #ifdef __wince
54 
55 #ifndef IX_USE_SERCONSOLE
56 
57 static int
ixLogMsg(char * pFormat,...)58 ixLogMsg(
59     char *pFormat,
60     ...
61     )
62 {
63 #ifndef IN_KERNEL
64     static WCHAR    pOutputString[256];
65 	static char     pNarrowStr[256];
66     int             returnCnt = 0;
67     va_list ap;
68 
69     pOutputString[0] = 0;
70 	pNarrowStr[0] = 0;
71 
72     va_start(ap, pFormat);
73 
74 	returnCnt = _vsnprintf(pNarrowStr, 256, pFormat, ap);
75 
76     MultiByteToWideChar(
77             CP_ACP,
78             MB_PRECOMPOSED,
79             pNarrowStr,
80             -1,
81             pOutputString,
82             256
83             );
84 
85     OutputDebugString(pOutputString);
86 
87     return returnCnt;
88 #else
89     return 0;
90 #endif
91 }
92 #define printf ixLogMsg
93 
94 #endif /* IX_USE_SERCONSOLE */
95 
96 #endif /* __wince */
97 
98 /**
99  * @} IxOsPrintf
100  */
101 
102 #endif /* IxOsPrintf_H */
103