home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 40 / IOPROG_40.ISO / SOFT / NETFrameworkSDK.exe / comsdk.cab / samples1.exe / smc / host.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-23  |  3.2 KB  |  132 lines

  1. /*****************************************************************************/
  2. #ifndef _HOST_H_
  3. #define _HOST_H_
  4. /*****************************************************************************/
  5.  
  6. #define STATIC_UNMANAGED_MEMBERS    1
  7.  
  8. /*****************************************************************************/
  9.  
  10. #pragma warning(disable:4237)
  11.  
  12. /*****************************************************************************/
  13.  
  14. #ifndef __SMC__
  15. typedef unsigned            __uint32;
  16. typedef unsigned __int64    __uint64;
  17. #endif
  18.  
  19. /*****************************************************************************/
  20.  
  21. #ifdef  __64BIT__
  22. typedef  __int64            NatInt;
  23. typedef __uint64            NatUns;
  24. #else
  25. typedef  __int32            NatInt;
  26. typedef __uint32            NatUns;
  27. #endif
  28.  
  29. /*****************************************************************************/
  30.  
  31. #ifdef  __cplusplus
  32.  
  33. #define INOUT
  34. #define   OUT
  35. #define   REF   &
  36.  
  37. #ifndef DEFMGMT
  38. #define DEFMGMT
  39. #define MR  *
  40. #endif
  41.  
  42. typedef wchar_t         wchar;
  43. typedef struct _stat    _Fstat;
  44.  
  45. typedef  char         * AnsiStr;
  46. typedef wchar_t       * wideStr;
  47.  
  48. #endif
  49.  
  50. #ifdef  __SMC__
  51.  
  52. void    DebugBreak();
  53.  
  54. #endif
  55.  
  56. /*****************************************************************************/
  57.  
  58. const   size_t      OS_page_size = 4096;
  59.  
  60. /*****************************************************************************/
  61.  
  62. // NOTE: The following is utterly non-portable
  63.  
  64. #ifndef __SMC__
  65.  
  66. #if defined(_X86_) && defined(_MSC_VER) && !defined(__IL__) // && !defined(__SMC__)
  67.  
  68. #define forceDebugBreak()   __try { __asm {int 3} }                         \
  69.                             __except (EXCEPTION_EXECUTE_HANDLER) {}
  70.  
  71. #else
  72.  
  73. inline
  74. void    forceDebugBreak(){}
  75.  
  76. #endif
  77.  
  78. #endif
  79.  
  80. /*****************************************************************************/
  81.  
  82. #ifdef  __COMRT__
  83.  
  84. typedef String              string_t;
  85. typedef String  managed []  stringArr_t;
  86.  
  87. char    *           makeRawString(String s);
  88. String              makeMgdString(char * s);
  89.  
  90. #else
  91.  
  92. typedef         char *      string_t;
  93. typedef const   char *    * stringArr_t;
  94.  
  95. inline
  96. const   char *      makeRawString(const char *s) { return s; }
  97. inline
  98. const   char *      makeMgdString(const char *s) { return s; }
  99.  
  100. #endif
  101.  
  102. /*****************************************************************************/
  103. #ifndef __SMC__
  104. /*****************************************************************************/
  105.  
  106. #ifndef NDEBUG
  107.  
  108. extern  "C"
  109. void    __cdecl     __AssertAbort(const char *why, const char *file, unsigned line);
  110.  
  111. #undef  assert
  112. #define assert(p)   if (!(p)){ forceDebugBreak(); __AssertAbort(#p, __FILE__, __LINE__); }
  113.  
  114. #define NO_WAY(s)            { forceDebugBreak(); __AssertAbort(#s, __FILE__, __LINE__); }
  115. #define UNIMPL(s)            { forceDebugBreak(); __AssertAbort(#s, __FILE__, __LINE__); }
  116.  
  117. #else
  118.  
  119. #undef  assert
  120. #define assert(p)
  121.  
  122. #define NO_WAY(s)
  123. #define UNIMPL(s)
  124.  
  125. #endif
  126.  
  127. /*****************************************************************************/
  128. #endif//__SMC__
  129. /*****************************************************************************/
  130. #endif
  131. /*****************************************************************************/
  132.