HackJavaCpp.java.in 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /* $Id: HackJavaCpp.java.in,v 1.15 2009-01-12 09:46:33 rzr Exp $ */
  2. #ifndef HackJavaCpp_java_in_
  3. #define HackJavaCpp_java_in_
  4. #include "Config.java.in"
  5. /**
  6. * @author www.Philippe.COVAL.free.fr
  7. * Copyright and License : http://rzr.online.fr/license.htm
  8. **/
  9. // Then edit *.java.in :
  10. // This in a template java source file which can be preprocessed with GNU cpp
  11. // see CppHack.java.in
  12. // File Generated this way (may help):
  13. //
  14. // cp ${SRCDIR}Cpphack.java.in ${TMPDIR}$@
  15. // sed -e "s/\s*\/\/@cpp \(.*\)/\1/g" < $^ | \
  16. // cpp -undef -fno-show-column ${DEFINES} -C -P \
  17. // | grep -v "^#" >> ${TMPDIR}$@
  18. // You can think it is ugly, but it saved some of my time
  19. // If you want more details contact me
  20. // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  21. #if ( ! defined DEVEL )
  22. #define MACRO_print(x)
  23. #define MACRO_println(x)
  24. #else
  25. #define MACRO_print(x) System.out.print(x)
  26. #define MACRO_println(x) System.out.println(x)
  27. #endif
  28. #ifdef DEVEL
  29. #define debug MACRO_println
  30. #endif
  31. #define debug2lt( a , b ) \
  32. MACRO_println("( " + a +" < " + b + " )");
  33. #define debug2ltif( a , b ) \
  34. if ( a < b ) { debug2lt(a,b); }
  35. #define debug2gt( a , b ) \
  36. MACRO_println("( " + a +" > " + b + " )");
  37. #define debug2gtif( a , b ) \
  38. if ( a > b ) { debug2gt(a,b); }
  39. #define debug3lt( a , b , c ) \
  40. MACRO_println("( " + a +" < " + b +" < " + c + " )");
  41. #define FPfloat int
  42. //#define FPpow
  43. #define FPoff 8
  44. #define FPtoFloat(a) ( a << FPoff ) //masks CHECK
  45. #define FPtoInt(a) (a >> FPoff ) //masks CHECK
  46. #define FPmult(a,b) ( (a*b) >> FPoff )
  47. //#define FPdiv(x,y) ((((x)<<6)/((y)>>6))>>4) //16:16 flipcode
  48. #define FPdiv(a,b) ( (a << (FPoff<<1)) / (b << FPoff ) ) //ok
  49. #define FPdivProtected(a,b,c) ( b != 0 ) ? FPdiv(a,b) : c
  50. #define toint FPtoInt
  51. #define tofloat FPtoFloat
  52. #define TYPE_COLOR int
  53. #ifdef AWT
  54. # define COLOR(x) ( new Color(x) )
  55. //#define TYPE_COLOR Color
  56. #elif defined ANDROID
  57. # define COLOR(x) Color.x
  58. #else
  59. # define COLOR(x) x
  60. #endif
  61. // http://code.google.com/intl/fr-FR/android/reference/android/graphics/Color.html
  62. #ifdef ANDROID
  63. # define COLOR_WHITE COLOR(WHITE)
  64. # define COLOR_BLACK COLOR(BLACK)
  65. # define COLOR_YELLOW COLOR(YELLOW)
  66. # define COLOR_RED COLOR(RED)
  67. # define COLOR_GREEN COLOR(GREEN)
  68. # define COLOR_BLUE COLOR(BLUE)
  69. #else
  70. # define COLOR_BLACK 0x00000000
  71. # define COLOR_WHITE 0x00FFFFFF
  72. # define COLOR_YELLOW 0x00FFFF00
  73. # define COLOR_RED 0x00FF0000
  74. # define COLOR_GREEN 0x0000FF00
  75. # define COLOR_BLUE 0x000000FF
  76. #endif
  77. #ifdef WANT_DARK
  78. # define COLOR_BG COLOR_BLACK
  79. # define COLOR_FG COLOR_WHITE
  80. # define COLOR_FG_POINT COLOR_YELLOW
  81. # define COLOR_FG_LINE COLOR_GREEN
  82. # define COLOR_FG_TEST (COLOR_RED | COLOR_BLUE)
  83. # define COLOR_FG_FACE 0x000000E0
  84. #else
  85. # define COLOR_BG COLOR_WHITE
  86. # define COLOR_FG COLOR_BLACK
  87. # define COLOR_FG_POINT COLOR_RED
  88. # define COLOR_FG_LINE COLOR_GREEN
  89. # define COLOR_FG_TEST 0x00FF00FF
  90. # define COLOR_FG_FACE 0x000000E0
  91. #endif
  92. #define swap(a,b,t) { t=a; a=b; b=t; }
  93. #define clip(x,min,max) (( x < min) ? min : ( (x > max) ? max : x ))
  94. //#define debug(x) System.out.println(x)
  95. #define ZSORT
  96. #define PIXEL
  97. #ifdef DEVEL
  98. #define MAPPING
  99. #endif
  100. #ifdef NOKIA
  101. //#define WANT_NO_TUX
  102. #endif
  103. #endif //HackJavaCpp_java_in_
  104. /* #eof "$Id: HackJavaCpp.java.in,v 1.15 2009-01-12 09:46:33 rzr Exp $" */