preprocess.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. #include <preprocess.h>
  2. #include FILE_PATH
  3. #include TARGET_PATH
  4. #include <string.h>
  5. #include <stdio.h>
  6. int check_defines_C(void)
  7. {
  8. int result = 1;
  9. #ifndef PREPROCESS_VS6
  10. if(strcmp(FILE_STRING, STRING_VALUE) != 0)
  11. {
  12. fprintf(stderr,
  13. "FILE_STRING has wrong value in C [%s]\n", FILE_STRING);
  14. result = 0;
  15. }
  16. if(strcmp(TARGET_STRING, STRING_VALUE) != 0)
  17. {
  18. fprintf(stderr,
  19. "TARGET_STRING has wrong value in C [%s]\n", TARGET_STRING);
  20. result = 0;
  21. }
  22. {
  23. int x = 2;
  24. int y = 3;
  25. if((FILE_EXPR) != (EXPR))
  26. {
  27. fprintf(stderr, "FILE_EXPR did not work in C [%s]\n",
  28. TO_STRING(FILE_EXPR));
  29. result = 0;
  30. }
  31. if((TARGET_EXPR) != (EXPR))
  32. {
  33. fprintf(stderr, "TARGET_EXPR did not work in C [%s]\n",
  34. TO_STRING(FILE_EXPR));
  35. result = 0;
  36. }
  37. }
  38. #endif
  39. #ifdef NDEBUG
  40. # ifdef FILE_DEF_DEBUG
  41. {
  42. fprintf(stderr, "FILE_DEF_DEBUG should not be defined in C\n");
  43. result = 0;
  44. }
  45. # endif
  46. # ifdef TARGET_DEF_DEBUG
  47. {
  48. fprintf(stderr, "TARGET_DEF_DEBUG should not be defined in C\n");
  49. result = 0;
  50. }
  51. # endif
  52. # ifdef DIRECTORY_DEF_DEBUG
  53. {
  54. fprintf(stderr, "DIRECTORY_DEF_DEBUG should not be defined in C\n");
  55. result = 0;
  56. }
  57. # endif
  58. # ifndef FILE_DEF_RELEASE
  59. # ifndef PREPROCESS_XCODE
  60. {
  61. fprintf(stderr, "FILE_DEF_RELEASE should be defined in C\n");
  62. result = 0;
  63. }
  64. # endif
  65. # endif
  66. # ifndef TARGET_DEF_RELEASE
  67. {
  68. fprintf(stderr, "TARGET_DEF_RELEASE should be defined in C\n");
  69. result = 0;
  70. }
  71. # endif
  72. # ifndef DIRECTORY_DEF_RELEASE
  73. {
  74. fprintf(stderr, "DIRECTORY_DEF_RELEASE should be defined in C\n");
  75. result = 0;
  76. }
  77. # endif
  78. #endif
  79. #ifdef PREPROCESS_DEBUG
  80. # ifndef FILE_DEF_DEBUG
  81. # ifndef PREPROCESS_XCODE
  82. {
  83. fprintf(stderr, "FILE_DEF_DEBUG should be defined in C\n");
  84. result = 0;
  85. }
  86. # endif
  87. # endif
  88. # ifndef TARGET_DEF_DEBUG
  89. {
  90. fprintf(stderr, "TARGET_DEF_DEBUG should be defined in C\n");
  91. result = 0;
  92. }
  93. # endif
  94. # ifndef DIRECTORY_DEF_DEBUG
  95. {
  96. fprintf(stderr, "DIRECTORY_DEF_DEBUG should be defined in C\n");
  97. result = 0;
  98. }
  99. # endif
  100. # ifdef FILE_DEF_RELEASE
  101. {
  102. fprintf(stderr, "FILE_DEF_RELEASE should not be defined in C\n");
  103. result = 0;
  104. }
  105. # endif
  106. # ifdef TARGET_DEF_RELEASE
  107. {
  108. fprintf(stderr, "TARGET_DEF_RELEASE should not be defined in C\n");
  109. result = 0;
  110. }
  111. # endif
  112. # ifdef DIRECTORY_DEF_RELEASE
  113. {
  114. fprintf(stderr, "DIRECTORY_DEF_RELEASE should not be defined in C\n");
  115. result = 0;
  116. }
  117. # endif
  118. #endif
  119. #if defined(FILE_DEF_DEBUG) || defined(TARGET_DEF_DEBUG)
  120. # if !defined(FILE_DEF_DEBUG) || !defined(TARGET_DEF_DEBUG)
  121. # ifndef PREPROCESS_XCODE
  122. {
  123. fprintf(stderr,
  124. "FILE_DEF_DEBUG and TARGET_DEF_DEBUG inconsistent in C\n");
  125. result = 0;
  126. }
  127. # endif
  128. # endif
  129. # if defined(FILE_DEF_RELEASE) || defined(TARGET_DEF_RELEASE)
  130. {
  131. fprintf(stderr, "DEBUG and RELEASE definitions inconsistent in C\n");
  132. result = 0;
  133. }
  134. # endif
  135. #endif
  136. #if defined(FILE_DEF_RELEASE) || defined(TARGET_DEF_RELEASE)
  137. # if !defined(FILE_DEF_RELEASE) || !defined(TARGET_DEF_RELEASE)
  138. # ifndef PREPROCESS_XCODE
  139. {
  140. fprintf(stderr,
  141. "FILE_DEF_RELEASE and TARGET_DEF_RELEASE inconsistent in C\n");
  142. result = 0;
  143. }
  144. # endif
  145. # endif
  146. # if defined(FILE_DEF_DEBUG) || defined(TARGET_DEF_DEBUG)
  147. {
  148. fprintf(stderr, "RELEASE and DEBUG definitions inconsistent in C\n");
  149. result = 0;
  150. }
  151. # endif
  152. #endif
  153. #ifndef FILE_PATH_DEF
  154. {
  155. fprintf(stderr, "FILE_PATH_DEF not defined in C\n");
  156. result = 0;
  157. }
  158. #endif
  159. #ifndef TARGET_PATH_DEF
  160. {
  161. fprintf(stderr, "TARGET_PATH_DEF not defined in C\n");
  162. result = 0;
  163. }
  164. #endif
  165. #ifndef FILE_DEF
  166. {
  167. fprintf(stderr, "FILE_DEF not defined in C\n");
  168. result = 0;
  169. }
  170. #endif
  171. #ifndef TARGET_DEF
  172. {
  173. fprintf(stderr, "TARGET_DEF not defined in C\n");
  174. result = 0;
  175. }
  176. #endif
  177. #ifndef DIRECTORY_DEF
  178. {
  179. fprintf(stderr, "DIRECTORY_DEF not defined in C\n");
  180. result = 0;
  181. }
  182. #endif
  183. #ifndef OLD_DEF
  184. {
  185. fprintf(stderr, "OLD_DEF not defined in C\n");
  186. result = 0;
  187. }
  188. #endif
  189. #if !defined(OLD_EXPR) || OLD_EXPR != 2
  190. {
  191. fprintf(stderr, "OLD_EXPR id not work in C [%s]\n",
  192. TO_STRING(OLD_EXPR));
  193. result = 0;
  194. }
  195. #endif
  196. return result;
  197. }