IxOsPrintf.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. #include "IxTypes.h"
  45. #ifndef IxOsPrintf_H
  46. #ifndef __doxygen_hide
  47. #define IxOsPrintf_H
  48. #endif /* __doxygen_hide */
  49. #ifdef __wince
  50. #ifndef IX_USE_SERCONSOLE
  51. static int
  52. ixLogMsg(
  53. char *pFormat,
  54. ...
  55. )
  56. {
  57. #ifndef IN_KERNEL
  58. static WCHAR pOutputString[256];
  59. static char pNarrowStr[256];
  60. int returnCnt = 0;
  61. va_list ap;
  62. pOutputString[0] = 0;
  63. pNarrowStr[0] = 0;
  64. va_start(ap, pFormat);
  65. returnCnt = _vsnprintf(pNarrowStr, 256, pFormat, ap);
  66. MultiByteToWideChar(
  67. CP_ACP,
  68. MB_PRECOMPOSED,
  69. pNarrowStr,
  70. -1,
  71. pOutputString,
  72. 256
  73. );
  74. OutputDebugString(pOutputString);
  75. return returnCnt;
  76. #else
  77. return 0;
  78. #endif
  79. }
  80. #define printf ixLogMsg
  81. #endif /* IX_USE_SERCONSOLE */
  82. #endif /* __wince */
  83. /**
  84. * @} IxOsPrintf
  85. */
  86. #endif /* IxOsPrintf_H */