PageRenderTime 58ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/Lib/swigarch.i

#
Swig | 62 lines | 32 code | 7 blank | 23 comment | 0 complexity | ebc2415a3efe96e79c9615f4813b7743 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. /* -----------------------------------------------------------------------------
  2. * swigarch.i
  3. *
  4. * SWIG library file for 32bit/64bit code specialization and checking.
  5. *
  6. * Use only in extreme cases, when no arch. independent code can be
  7. * generated
  8. *
  9. * To activate architecture specific code, use
  10. *
  11. * swig -DSWIGWORDSIZE32
  12. *
  13. * or
  14. *
  15. * swig -DSWIGWORDSIZE64
  16. *
  17. * Note that extra checking code will be added to the wrapped code,
  18. * which will prevent the compilation in a different architecture.
  19. *
  20. * If you don't specify the SWIGWORDSIZE (the default case), swig will
  21. * generate architecture independent and/or 32bits code, with no extra
  22. * checking code added.
  23. * ----------------------------------------------------------------------------- */
  24. #if !defined(SWIGWORDSIZE32) && !defined(SWIGWORDSIZE64)
  25. # if (__WORDSIZE == 32)
  26. # define SWIGWORDSIZE32
  27. # endif
  28. #endif
  29. #if !defined(SWIGWORDSIZE64) && !defined(SWIGWORDSIZE32)
  30. # if defined(__x86_64) || defined(__x86_64__) || (__WORDSIZE == 64)
  31. # define SWIGWORDSIZE64
  32. # endif
  33. #endif
  34. #ifdef SWIGWORDSIZE32
  35. %{
  36. #define SWIGWORDSIZE32
  37. #ifndef LONG_MAX
  38. #include <limits.h>
  39. #endif
  40. #if (__WORDSIZE == 64) || (LONG_MAX != INT_MAX)
  41. # error "SWIG wrapped code invalid in 64 bit architecture, regenarete code using -DSWIGWORDSIZE64"
  42. #endif
  43. %}
  44. #endif
  45. #ifdef SWIGWORDSIZE64
  46. %{
  47. #define SWIGWORDSIZE64
  48. #ifndef LONG_MAX
  49. #include <limits.h>
  50. #endif
  51. #if (__WORDSIZE == 32) || (LONG_MAX == INT_MAX)
  52. # error "SWIG wrapped code invalid in 32 bit architecture, regenarete code using -DSWIGWORDSIZE32"
  53. #endif
  54. %}
  55. #endif