You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

145 lines
3.4 KiB

  1. /* /////////////////////////////////////////////////////////////////////////
  2. * File: test/scratch/test.scratch.tstring/test.scratch.tstring.cpp
  3. *
  4. * Purpose: Implementation file for the test.scratch.tstring project.
  5. *
  6. * Created: 23rd February 2010
  7. * Updated: 6th August 2012
  8. *
  9. * Status: Wizard-generated
  10. *
  11. * License: (Licensed under the Synesis Software Open License)
  12. *
  13. * Copyright (c) 2010-2012, Synesis Software Pty Ltd.
  14. * All rights reserved.
  15. *
  16. * www: http://www.synesis.com.au/software
  17. *
  18. * ////////////////////////////////////////////////////////////////////// */
  19. #define PANTHEIOS_SAFE_ALLOW_SHIM_INTERMEDIATES
  20. /* Pantheios Header Files */
  21. #include <pantheios/pan.hpp>
  22. #include <pantheios/inserters/w2m.hpp>
  23. /* STLSoft Header Files */
  24. #include <stlsoft/string/simple_string.hpp>
  25. #include <platformstl/platformstl.hpp>
  26. /* UNIXEm Header Files */
  27. #if defined(_WIN32) || \
  28. defined(_WIN64)
  29. # include <unixem/unixem.h>
  30. #endif /* Win32 || Win64 */
  31. /* Standard C++ Header Files */
  32. #include <exception>
  33. #if 0
  34. #include <algorithm>
  35. #include <iterator>
  36. #include <list>
  37. #include <string>
  38. #include <vector>
  39. #endif /* 0 */
  40. #if !defined(__WATCOMC__) && \
  41. ( !defined(_MSC_VER) || \
  42. _MSC_VER >= 1100)
  43. #else /* ? __WATCOMC__ */
  44. namespace std
  45. {
  46. using ::exception;
  47. }
  48. #endif /* __WATCOMC__ */
  49. /* Standard C Header Files */
  50. #include <stdio.h>
  51. #include <stdlib.h>
  52. #if defined(_MSC_VER) && \
  53. defined(_DEBUG)
  54. # include <crtdbg.h>
  55. #endif /* _MSC_VER) && _DEBUG */
  56. /* /////////////////////////////////////////////////////////////////////////
  57. * Globals
  58. */
  59. PANTHEIOS_EXTERN_C PAN_CHAR_T const PANTHEIOS_FE_PROCESS_IDENTITY[] = PANTHEIOS_LITERAL_STRING("test.scratch.tstring");
  60. /* ////////////////////////////////////////////////////////////////////// */
  61. static int main_(int /* argc */, char** /*argv*/)
  62. {
  63. std::string mbs("multibyte string");
  64. std::wstring ws1(L"wide string #1");
  65. stlsoft::simple_wstring ws2(L"wide string #2");
  66. pan::log_NOTICE("mbs=", mbs, ", ws1=", pan::w2m(ws1), ", ws2=", pan::w2m(ws2));
  67. #ifdef PANTHEIOS_SAFE_ALLOW_SHIM_INTERMEDIATES
  68. VARIANT var;
  69. var.vt = VT_I4;
  70. var.lVal = -10;
  71. pan::log_DEBUG("var=", pan::w2m(var));
  72. #endif /* PANTHEIOS_SAFE_ALLOW_SHIM_INTERMEDIATES */
  73. return EXIT_SUCCESS;
  74. }
  75. int main(int argc, char** argv)
  76. {
  77. int res;
  78. #if defined(_MSC_VER) && \
  79. defined(_DEBUG)
  80. _CrtMemState memState;
  81. #endif /* _MSC_VER && _MSC_VER */
  82. #if defined(_MSC_VER) && \
  83. defined(_DEBUG)
  84. _CrtMemCheckpoint(&memState);
  85. #endif /* _MSC_VER && _MSC_VER */
  86. #if 0
  87. { for(size_t i = 0; i < 0xffffffff; ++i){} }
  88. #endif /* 0 */
  89. try
  90. {
  91. #if defined(_DEBUG) || \
  92. defined(__SYNSOFT_DBS_DEBUG)
  93. puts("test.scratch.tstring: " __STLSOFT_COMPILER_LABEL_STRING);
  94. #endif /* debug */
  95. res = main_(argc, argv);
  96. }
  97. catch(std::exception& x)
  98. {
  99. pantheios::log_ALERT("Unexpected general error: ", x, ". Application terminating");
  100. res = EXIT_FAILURE;
  101. }
  102. catch(...)
  103. {
  104. pantheios::puts(pantheios::emergency, "Unhandled unknown error");
  105. res = EXIT_FAILURE;
  106. }
  107. #if defined(_MSC_VER) && \
  108. defined(_DEBUG)
  109. _CrtMemDumpAllObjectsSince(&memState);
  110. #endif /* _MSC_VER) && _DEBUG */
  111. return res;
  112. }
  113. /* ///////////////////////////// end of file //////////////////////////// */