TASSERT.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. #ifndef TASSERT_H
  2. #define TASSERT_H
  3. #if !defined TECPLOTKERNEL && !defined STD_ASSERTS && !defined CHECKED_BUILD
  4. #define STD_ASSERTS
  5. #endif
  6. # include <assert.h>
  7. # if !defined ASSERT
  8. # define ASSERT assert
  9. # endif
  10. #if defined MSWIN
  11. #if defined ENSURE
  12. #undef ENSURE
  13. #endif
  14. #endif
  15. #define INVALID_REF ((void *)0x0000FFFF)
  16. #define UNINITIALIZED_REF ((void *)0x11111111)
  17. #define INVALID_FN_REF ((void *)NULL)
  18. #ifdef UNIXX
  19. #if !defined TECPLOTKERNEL
  20. # if !defined VALID_REF
  21. # define VALID_REF(p) ( (p) != NULL )
  22. # endif
  23. # if !defined VALID_FN_REF
  24. # define VALID_FN_REF(___1481) ( (___1481) != NULL )
  25. # endif
  26. #endif
  27. # define VALID_WIDGET(widget) VALID_REF((widget))
  28. # define VALID_MENU_WIDGET(widget) VALID_REF((widget))
  29. #endif
  30. #ifdef MSWIN
  31. #if defined NO_ASSERTS
  32. # if !defined VALID_REF
  33. # define VALID_REF(p) ((p) != NULL)
  34. # endif
  35. # if !defined VALID_FN_REF
  36. # define VALID_FN_REF(___3002) ((___3002) != NULL)
  37. # endif
  38. #else
  39. # if !defined VALID_REF
  40. # define VALID_REF(p) ((p) != NULL && !IsBadReadPtr((const void *)(p), 1))
  41. # endif
  42. # if !defined VALID_FN_REF
  43. # define VALID_FN_REF(___3002) ((___3002) != NULL && !IsBadReadPtr((const void *)(___3002),(UINT_PTR)sizeof(const void*)))
  44. # endif
  45. #endif
  46. # define VALID_WIDGET(widget) ((widget) != NULL)
  47. # define VALID_MENU_WIDGET(widget) ((widget)!=NULL)
  48. #endif
  49. #define VALID_HANDLE(handle) ((handle)!=0)
  50. #if !defined VALID_BOOLEAN
  51. # define VALID_BOOLEAN(b) ((b) == ___4226 || (b) == ___1305)
  52. #endif
  53. #if !defined VALID_ENUM
  54. # define VALID_ENUM(___4314, type) (0 <= (int)(___4314) && \
  55. (int)(___4314) < END_##type)
  56. #endif
  57. #if !defined VALID_REF_OR_NULL
  58. # define VALID_REF_OR_NULL(___3251) IMPLICATION((___3251) != NULL, VALID_REF(___3251))
  59. #endif
  60. #if !defined VALID_FN_REF_OR_NULL
  61. # define VALID_FN_REF_OR_NULL(___3251) IMPLICATION((___3251) != NULL, VALID_FN_REF(___3251))
  62. #endif
  63. #define VALID_TRANSLATED_STRING(___4228) (!(___4228).___2035())
  64. struct ___802; namespace tecplot { class ___2090; } bool VALID_FE_CLASSIC_CELL_INDEX( ___802 const* ___800, ___2227 ___462); bool VALID_FE_CELL_INDEX( ___802 const* ___800, ___2227 ___462); bool VALID_FE_CELL_INDEX( ___802 const* ___800, tecplot::___2090 const& ___451);
  65. #define VALID_IPLANE_CELL_INDEX(___801,___463) \
  66. ( \
  67. (___463) >= 0 && \
  68. ___1842((___801),___463) <= MAX((___801)->___2811,1) && \
  69. ___2112((___801),___463) < MAX((___801)->___2816,1) && \
  70. ___2157((___801),___463) < MAX((___801)->___2819,1))
  71. #define VALID_JPLANE_CELL_INDEX(___801,___463) \
  72. ( \
  73. (___463) >= 0 && \
  74. ___1842((___801),___463) < MAX((___801)->___2811,1) && \
  75. ___2112((___801),___463) <= MAX((___801)->___2816,1) && \
  76. ___2157((___801),___463) < MAX((___801)->___2819,1))
  77. #define VALID_KPLANE_CELL_INDEX(___801,___463) \
  78. ( \
  79. (___463) >= 0 && \
  80. ___1842((___801),___463) < MAX((___801)->___2811,1) && \
  81. ___2112((___801),___463) < MAX((___801)->___2816,1) && \
  82. ___2157((___801),___463) <= MAX((___801)->___2819,1))
  83. #define VALID_ORDERED_CELL_INDEX(___801, ___463, ___3095) \
  84. ( \
  85. ((IJKPlanes_e)(___3095) == ___1867 || \
  86. (IJKPlanes_e)(___3095) == ___1872 || \
  87. (IJKPlanes_e)(___3095) == ___1874 || \
  88. (IJKPlanes_e)(___3095) == ___1876) && \
  89. \
  90. \
  91. (IMPLICATION(((IJKPlanes_e)(___3095) == ___1867 || \
  92. (IJKPlanes_e)(___3095) == ___1876), \
  93. VALID_IPLANE_CELL_INDEX((___801),___463)) && \
  94. IMPLICATION(((IJKPlanes_e)(___3095) == ___1872 || \
  95. (IJKPlanes_e)(___3095) == ___1876), \
  96. VALID_JPLANE_CELL_INDEX((___801),___463)) && \
  97. IMPLICATION(((IJKPlanes_e)(___3095) == ___1874 || \
  98. (IJKPlanes_e)(___3095) == ___1876), \
  99. VALID_KPLANE_CELL_INDEX((___801),___463))))
  100. bool VALID_CELL_INDEX( ___802 const* ___800, ___2227 ___462, IJKPlanes_e ___1865); bool VALID_CELL_INDEX( ___802 const* ___800, tecplot::___2090 const& ___451, IJKPlanes_e ___1865);
  101. #define VALID_DATASET(___882,___484) (((___882) != NULL) && \
  102. IMPLICATION((___484),(___882)->___2847 >= 1))
  103. #ifdef MSWIN
  104. # define VALID_WND(___3257) (::___2083((___3257)->___1771()))
  105. #else
  106. # define VALID_WND(___3257)
  107. #endif
  108. #if !defined VALID_NON_ZERO_LEN_STR
  109. # if defined MSWIN
  110. # if defined NO_ASSERTS
  111. # define VALID_NON_ZERO_LEN_STR(str) (VALID_REF(str) && !___2017(str))
  112. # else
  113. # define VALID_NON_ZERO_LEN_STR(str) \
  114. (VALID_REF(str) && \
  115. !IsBadReadPtr((const void*)(str),(UINT_PTR)(1+strlen((const char*)(str)))) && \
  116. !___2017(str))
  117. # endif
  118. # else
  119. # define VALID_NON_ZERO_LEN_STR(str) (VALID_REF(str) && !___2017(str))
  120. # endif
  121. #endif
  122. #if !defined VALID_SET_INDEX
  123. # define VALID_SET_INDEX(___3492) (((___3493)___3492)>=(___3493)1)
  124. #endif
  125. #if !defined VALID_FILE_HANDLE
  126. # define VALID_FILE_HANDLE(___3792) ((___3792) != NULL)
  127. #endif
  128. #define VALID_BASIC_COLOR(___351) \
  129. (___1420<=(___351) && (___351)<=___2195)
  130. #define VALID_CONTOUR_COLOR(Color) \
  131. (___614<=(Color) && \
  132. (Color)<___614+___1547.___2241.___2379+1)
  133. #define VALID_PLOTTING_COLOR(Color) \
  134. (VALID_BASIC_COLOR(Color) || VALID_CONTOUR_COLOR(Color))
  135. #define VALID_INTERFACE_SPECIFIC_COLOR(___351) \
  136. (___1423<=(___351) && (___351)<=___2200)
  137. #define VALID_INTERFACE_COLOR(Color) \
  138. (VALID_PLOTTING_COLOR(Color) || VALID_INTERFACE_SPECIFIC_COLOR(Color))
  139. #define VALID_MULTICOLOR_COLOR(Color) \
  140. (((Color) == ___2662) || ((Color) == ___2655) || \
  141. ((Color) == ___2656) || ((Color) == ___2657) || \
  142. ((Color) == ___2658) || ((Color) == ___2659) || \
  143. ((Color) == ___2660) || ((Color) == ___2661))
  144. #define VALID_RGB_COLOR(Color) \
  145. ((Color) == ___3375)
  146. #define VALID_ASSIGNABLE_COLOR(C) \
  147. (VALID_BASIC_COLOR(C) || \
  148. VALID_MULTICOLOR_COLOR(C) || \
  149. VALID_RGB_COLOR(C))
  150. #define VALID_PEN_OFFSET(___3000) \
  151. (___364<=(___3000) && (___3000)<=___2826)
  152. #define VALID_PEN_OFFSET_FOR_OBJECT(___3000) \
  153. (___1424<=(___3000) && (___3000)<=___2202)
  154. #define VALID_NAME(___2686, ___2376) \
  155. (VALID_REF(___2686) && \
  156. (___2017(___2686) || \
  157. (!tecplot::isspace((___2686)[0]) && !tecplot::isspace((___2686)[strlen(___2686)-1]))) && \
  158. strlen(___2686) <= (___2376))
  159. #define VALID_ZONE_NAME(___2686) VALID_NAME((___2686), ___2358)
  160. #define VALID_VAR_NAME(___2686) VALID_NAME((___2686), ___2356)
  161. #define VALID_LIGHTINGEFFECT(___2165) \
  162. (((___2165) == ___2239) || ((___2165) == ___2236))
  163. typedef void (*TAssertFailureNotifyFunc)( const char *___1246, const char *___1396, int line);
  164. #if !defined STD_ASSERTS
  165. extern void TAssert( const char *___1246, const char *___1396, int line); extern TAssertFailureNotifyFunc ___1957( TAssertFailureNotifyFunc ___2698);
  166. #endif
  167. #if defined NO_ASSERTS
  168. # define TASSERT(___1245)
  169. # if !defined INVARIANT
  170. # define INVARIANT(___1245)
  171. # endif
  172. # if !defined REQUIRE
  173. # define REQUIRE(___1245)
  174. # endif
  175. # if !defined ENSURE
  176. # define ENSURE(___1245)
  177. # endif
  178. # if !defined ___478
  179. # define ___478(___1245)
  180. # endif
  181. # ifdef VERIFY
  182. # undef VERIFY
  183. # endif
  184. # define VERIFY(___1245) ((void)(___1245))
  185. # if !defined ASSERT_ONLY
  186. # define ASSERT_ONLY(___2972)
  187. # endif
  188. # if !defined NOT_IMPLEMENTED
  189. # if defined ___1840
  190. # define NOT_IMPLEMENTED() ___478(___1305)
  191. # else
  192. # if defined MSWIN
  193. # define NOT_IMPLEMENTED(x) TAssert("Not Implemented", __FILE__, __LINE__)
  194. # endif
  195. # if defined UNIXX
  196. # define NOT_IMPLEMENTED() not ___1907
  197. # endif
  198. # endif
  199. # endif
  200. #elif defined STD_ASSERTS
  201. # define TASSERT(___1245) assert(___1245)
  202. # if !defined INVARIANT
  203. # define INVARIANT(___1245) assert(___1245)
  204. # endif
  205. # if !defined REQUIRE
  206. # define REQUIRE(___1245) assert(___1245)
  207. # endif
  208. # if !defined ENSURE
  209. # define ENSURE(___1245) assert(___1245)
  210. # endif
  211. # if !defined ___478
  212. # define ___478(___1245) assert(___1245)
  213. # endif
  214. # ifdef VERIFY
  215. # undef VERIFY
  216. # endif
  217. # ifndef VERIFY
  218. # if defined NDEBUG
  219. # define VERIFY(___1245) ((void)(___1245))
  220. # else
  221. # define VERIFY(___1245) assert(___1245)
  222. # endif
  223. # endif
  224. # if !defined NOT_IMPLEMENTED
  225. # define NOT_IMPLEMENTED() assert(!("Not Implemented"))
  226. # endif
  227. # if !defined ASSERT_ONLY
  228. # define ASSERT_ONLY(___2972) ___2972
  229. # endif
  230. #else
  231. #if defined (MSWIN)
  232. #if defined CHECKED_BUILD
  233. #include <string>
  234. #include <vector>
  235. #include <algorithm>
  236. class ___212 { public: static void ___1934(const std::string &___1394); static bool ___2031(); static void ___5(const std::string &___2432); private: static void ___4540(const std::string &___2432); private: static bool ___2317; static std::string ___2318; static std::vector<std::string> ___213; };
  237. #define TASSERT(___1245)\
  238. do { if (!(___1245)) { } } while (0)
  239. #else
  240. #define TASSERT(___1245) ASSERT(___1245)
  241. #endif
  242. #else
  243. #define TASSERT(___1245) (void)((___1245) || (TAssert(#___1245, __FILE__, __LINE__), 0))
  244. #endif
  245. # if !defined INVARIANT
  246. # if defined NO_INVARIANTS
  247. # define INVARIANT(___1245)
  248. # else
  249. # define INVARIANT(___1245) TASSERT(___1245)
  250. # endif
  251. # endif
  252. # if !defined REQUIRE
  253. # if defined ___2753
  254. # define REQUIRE(___1245)
  255. # else
  256. # define REQUIRE(___1245) TASSERT(___1245)
  257. # endif
  258. # endif
  259. # if !defined ENSURE
  260. # if defined ___2752
  261. # define ENSURE(___1245)
  262. # else
  263. # define ENSURE(___1245) TASSERT(___1245)
  264. # endif
  265. # endif
  266. # if !defined ___478
  267. # if defined NO_CHECKS
  268. # define ___478(___1245)
  269. # else
  270. # define ___478(___1245) TASSERT(___1245)
  271. # endif
  272. # endif
  273. # if !defined VERIFY
  274. # if defined NO_CHECKS
  275. # define VERIFY(___1245) ((void)(___1245))
  276. # else
  277. # if defined NDEBUG
  278. # define VERIFY(___1245) ((void)(___1245))
  279. # else
  280. # define VERIFY(___1245) TASSERT(___1245)
  281. # endif
  282. # endif
  283. # endif
  284. # if defined NICE_NOT_IMPLEMENTED
  285. # define NOT_IMPLEMENTED() ___2706()
  286. # else
  287. # define NOT_IMPLEMENTED() TASSERT(!("Not Implemented"))
  288. # endif
  289. # if !defined ASSERT_ONLY
  290. # define ASSERT_ONLY(___2972) ___2972
  291. # endif
  292. #endif
  293. #if !defined ASSERT_ONLY_PARAM && defined ASSERT_ONLY
  294. # define ASSERT_ONLY_PARAM(___2972) ASSERT_ONLY(___2972)
  295. #endif
  296. #if !defined STD_ASSERTS
  297. extern void ___4027(void);
  298. #endif
  299. #if defined NICE_NOT_IMPLEMENTED
  300. extern void ___2706(void);
  301. #endif
  302. #if !defined IMPLICATION
  303. # define IMPLICATION(___2894,___3258) (!(___2894) || (___3258))
  304. #endif
  305. #if !defined EQUIVALENCE
  306. # define EQUIVALENCE(___2894,___3258) ((___2894) == (___3258))
  307. #endif
  308. #endif