TASSERT.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  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;
  65. namespace tecplot
  66. {
  67. class ___2090;
  68. }
  69. bool VALID_FE_CLASSIC_CELL_INDEX(___802 const *___800, ___2227 ___462);
  70. bool VALID_FE_CELL_INDEX(___802 const *___800, ___2227 ___462);
  71. bool VALID_FE_CELL_INDEX(___802 const *___800, tecplot::___2090 const &___451);
  72. #define VALID_IPLANE_CELL_INDEX(___801, ___463) \
  73. ( \
  74. (___463) >= 0 && \
  75. ___1842((___801), ___463) <= MAX((___801)->___2811, 1) && \
  76. ___2112((___801), ___463) < MAX((___801)->___2816, 1) && \
  77. ___2157((___801), ___463) < MAX((___801)->___2819, 1))
  78. #define VALID_JPLANE_CELL_INDEX(___801, ___463) \
  79. ( \
  80. (___463) >= 0 && \
  81. ___1842((___801), ___463) < MAX((___801)->___2811, 1) && \
  82. ___2112((___801), ___463) <= MAX((___801)->___2816, 1) && \
  83. ___2157((___801), ___463) < MAX((___801)->___2819, 1))
  84. #define VALID_KPLANE_CELL_INDEX(___801, ___463) \
  85. ( \
  86. (___463) >= 0 && \
  87. ___1842((___801), ___463) < MAX((___801)->___2811, 1) && \
  88. ___2112((___801), ___463) < MAX((___801)->___2816, 1) && \
  89. ___2157((___801), ___463) <= MAX((___801)->___2819, 1))
  90. #define VALID_ORDERED_CELL_INDEX(___801, ___463, ___3095) \
  91. ( \
  92. ((IJKPlanes_e)(___3095) == ___1867 || \
  93. (IJKPlanes_e)(___3095) == ___1872 || \
  94. (IJKPlanes_e)(___3095) == ___1874 || \
  95. (IJKPlanes_e)(___3095) == ___1876) && \
  96. \
  97. (IMPLICATION(((IJKPlanes_e)(___3095) == ___1867 || \
  98. (IJKPlanes_e)(___3095) == ___1876), \
  99. VALID_IPLANE_CELL_INDEX((___801), ___463)) && \
  100. IMPLICATION(((IJKPlanes_e)(___3095) == ___1872 || \
  101. (IJKPlanes_e)(___3095) == ___1876), \
  102. VALID_JPLANE_CELL_INDEX((___801), ___463)) && \
  103. IMPLICATION(((IJKPlanes_e)(___3095) == ___1874 || \
  104. (IJKPlanes_e)(___3095) == ___1876), \
  105. VALID_KPLANE_CELL_INDEX((___801), ___463))))
  106. bool VALID_CELL_INDEX(___802 const *___800, ___2227 ___462, IJKPlanes_e ___1865);
  107. bool VALID_CELL_INDEX(___802 const *___800, tecplot::___2090 const &___451, IJKPlanes_e ___1865);
  108. #define VALID_DATASET(___882, ___484) (((___882) != NULL) && \
  109. IMPLICATION((___484), (___882)->___2847 >= 1))
  110. #ifdef MSWIN
  111. #define VALID_WND(___3257) (::___2083((___3257)->___1771()))
  112. #else
  113. #define VALID_WND(___3257)
  114. #endif
  115. #if !defined VALID_NON_ZERO_LEN_STR
  116. #if defined MSWIN
  117. #if defined NO_ASSERTS
  118. #define VALID_NON_ZERO_LEN_STR(str) (VALID_REF(str) && !___2017(str))
  119. #else
  120. #define VALID_NON_ZERO_LEN_STR(str) \
  121. (VALID_REF(str) && \
  122. !IsBadReadPtr((const void *)(str), (UINT_PTR)(1 + strlen((const char *)(str)))) && \
  123. !___2017(str))
  124. #endif
  125. #else
  126. #define VALID_NON_ZERO_LEN_STR(str) (VALID_REF(str) && !___2017(str))
  127. #endif
  128. #endif
  129. #if !defined VALID_SET_INDEX
  130. #define VALID_SET_INDEX(___3492) (((___3493)___3492) >= (___3493)1)
  131. #endif
  132. #if !defined VALID_FILE_HANDLE
  133. #define VALID_FILE_HANDLE(___3792) ((___3792) != NULL)
  134. #endif
  135. #define VALID_BASIC_COLOR(___351) \
  136. (___1420 <= (___351) && (___351) <= ___2195)
  137. #define VALID_CONTOUR_COLOR(Color) \
  138. (___614 <= (Color) && \
  139. (Color) < ___614 + ___1547.___2241.___2379 + 1)
  140. #define VALID_PLOTTING_COLOR(Color) \
  141. (VALID_BASIC_COLOR(Color) || VALID_CONTOUR_COLOR(Color))
  142. #define VALID_INTERFACE_SPECIFIC_COLOR(___351) \
  143. (___1423 <= (___351) && (___351) <= ___2200)
  144. #define VALID_INTERFACE_COLOR(Color) \
  145. (VALID_PLOTTING_COLOR(Color) || VALID_INTERFACE_SPECIFIC_COLOR(Color))
  146. #define VALID_MULTICOLOR_COLOR(Color) \
  147. (((Color) == ___2662) || ((Color) == ___2655) || \
  148. ((Color) == ___2656) || ((Color) == ___2657) || \
  149. ((Color) == ___2658) || ((Color) == ___2659) || \
  150. ((Color) == ___2660) || ((Color) == ___2661))
  151. #define VALID_RGB_COLOR(Color) \
  152. ((Color) == ___3375)
  153. #define VALID_ASSIGNABLE_COLOR(C) \
  154. (VALID_BASIC_COLOR(C) || \
  155. VALID_MULTICOLOR_COLOR(C) || \
  156. VALID_RGB_COLOR(C))
  157. #define VALID_PEN_OFFSET(___3000) \
  158. (___364 <= (___3000) && (___3000) <= ___2826)
  159. #define VALID_PEN_OFFSET_FOR_OBJECT(___3000) \
  160. (___1424 <= (___3000) && (___3000) <= ___2202)
  161. #define VALID_NAME(___2686, ___2376) \
  162. (VALID_REF(___2686) && \
  163. (___2017(___2686) || \
  164. (!tecplot::isspace((___2686)[0]) && !tecplot::isspace((___2686)[strlen(___2686) - 1]))) && \
  165. strlen(___2686) <= (___2376))
  166. #define VALID_ZONE_NAME(___2686) VALID_NAME((___2686), ___2358)
  167. #define VALID_VAR_NAME(___2686) VALID_NAME((___2686), ___2356)
  168. #define VALID_LIGHTINGEFFECT(___2165) \
  169. (((___2165) == ___2239) || ((___2165) == ___2236))
  170. typedef void (*TAssertFailureNotifyFunc)(const char *___1246, const char *___1396, int line);
  171. #if !defined STD_ASSERTS
  172. extern void TAssert(const char *___1246, const char *___1396, int line);
  173. extern TAssertFailureNotifyFunc ___1957(TAssertFailureNotifyFunc ___2698);
  174. #endif
  175. #if defined NO_ASSERTS
  176. #define TASSERT(___1245)
  177. #if !defined INVARIANT
  178. #define INVARIANT(___1245)
  179. #endif
  180. #if !defined REQUIRE
  181. #define REQUIRE(___1245)
  182. #endif
  183. #if !defined ENSURE
  184. #define ENSURE(___1245)
  185. #endif
  186. #if !defined ___478
  187. #define ___478(___1245)
  188. #endif
  189. #ifdef VERIFY
  190. #undef VERIFY
  191. #endif
  192. #define VERIFY(___1245) ((void)(___1245))
  193. #if !defined ASSERT_ONLY
  194. #define ASSERT_ONLY(___2972)
  195. #endif
  196. #if !defined NOT_IMPLEMENTED
  197. #if defined ___1840
  198. #define NOT_IMPLEMENTED() ___478(___1305)
  199. #else
  200. #if defined MSWIN
  201. #define NOT_IMPLEMENTED(x) TAssert("Not Implemented", __FILE__, __LINE__)
  202. #endif
  203. #if defined UNIXX
  204. #define NOT_IMPLEMENTED() not ___1907
  205. #endif
  206. #endif
  207. #endif
  208. #elif defined STD_ASSERTS
  209. #define TASSERT(___1245) assert(___1245)
  210. #if !defined INVARIANT
  211. #define INVARIANT(___1245) assert(___1245)
  212. #endif
  213. #if !defined REQUIRE
  214. #define REQUIRE(___1245) assert(___1245)
  215. #endif
  216. #if !defined ENSURE
  217. #define ENSURE(___1245) assert(___1245)
  218. #endif
  219. #if !defined ___478
  220. #define ___478(___1245) assert(___1245)
  221. #endif
  222. #ifdef VERIFY
  223. #undef VERIFY
  224. #endif
  225. #ifndef VERIFY
  226. #if defined NDEBUG
  227. #define VERIFY(___1245) ((void)(___1245))
  228. #else
  229. #define VERIFY(___1245) assert(___1245)
  230. #endif
  231. #endif
  232. #if !defined NOT_IMPLEMENTED
  233. #define NOT_IMPLEMENTED() assert(!("Not Implemented"))
  234. #endif
  235. #if !defined ASSERT_ONLY
  236. #define ASSERT_ONLY(___2972) ___2972
  237. #endif
  238. #else
  239. #if defined(MSWIN)
  240. #if defined CHECKED_BUILD
  241. #include <string>
  242. #include <vector>
  243. #include <algorithm>
  244. class ___212
  245. {
  246. public:
  247. static void ___1934(const std::string &___1394);
  248. static bool ___2031();
  249. static void ___5(const std::string &___2432);
  250. private:
  251. static void ___4540(const std::string &___2432);
  252. private:
  253. static bool ___2317;
  254. static std::string ___2318;
  255. static std::vector<std::string> ___213;
  256. };
  257. #define TASSERT(___1245) \
  258. do \
  259. { \
  260. if (!(___1245)) \
  261. { \
  262. } \
  263. } while (0)
  264. #else
  265. #define TASSERT(___1245) ASSERT(___1245)
  266. #endif
  267. #else
  268. #define TASSERT(___1245) (void)((___1245) || (TAssert(#___1245, __FILE__, __LINE__), 0))
  269. #endif
  270. #if !defined INVARIANT
  271. #if defined NO_INVARIANTS
  272. #define INVARIANT(___1245)
  273. #else
  274. #define INVARIANT(___1245) TASSERT(___1245)
  275. #endif
  276. #endif
  277. #if !defined REQUIRE
  278. #if defined ___2753
  279. #define REQUIRE(___1245)
  280. #else
  281. #define REQUIRE(___1245) TASSERT(___1245)
  282. #endif
  283. #endif
  284. #if !defined ENSURE
  285. #if defined ___2752
  286. #define ENSURE(___1245)
  287. #else
  288. #define ENSURE(___1245) TASSERT(___1245)
  289. #endif
  290. #endif
  291. #if !defined ___478
  292. #if defined NO_CHECKS
  293. #define ___478(___1245)
  294. #else
  295. #define ___478(___1245) TASSERT(___1245)
  296. #endif
  297. #endif
  298. #if !defined VERIFY
  299. #if defined NO_CHECKS
  300. #define VERIFY(___1245) ((void)(___1245))
  301. #else
  302. #if defined NDEBUG
  303. #define VERIFY(___1245) ((void)(___1245))
  304. #else
  305. #define VERIFY(___1245) TASSERT(___1245)
  306. #endif
  307. #endif
  308. #endif
  309. #if defined NICE_NOT_IMPLEMENTED
  310. #define NOT_IMPLEMENTED() ___2706()
  311. #else
  312. #define NOT_IMPLEMENTED() TASSERT(!("Not Implemented"))
  313. #endif
  314. #if !defined ASSERT_ONLY
  315. #define ASSERT_ONLY(___2972) ___2972
  316. #endif
  317. #endif
  318. #if !defined ASSERT_ONLY_PARAM && defined ASSERT_ONLY
  319. #define ASSERT_ONLY_PARAM(___2972) ASSERT_ONLY(___2972)
  320. #endif
  321. #if !defined STD_ASSERTS
  322. extern void ___4027(void);
  323. #endif
  324. #if defined NICE_NOT_IMPLEMENTED
  325. extern void ___2706(void);
  326. #endif
  327. #if !defined IMPLICATION
  328. #define IMPLICATION(___2894, ___3258) (!(___2894) || (___3258))
  329. #endif
  330. #if !defined EQUIVALENCE
  331. #define EQUIVALENCE(___2894, ___3258) ((___2894) == (___3258))
  332. #endif
  333. #endif