dtoolbase.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /* Filename: dtoolbase.h
  2. * Created by: drose (12Sep00)
  3. *
  4. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  5. *
  6. * PANDA 3D SOFTWARE
  7. * Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
  8. *
  9. * All use of this software is subject to the terms of the Panda 3d
  10. * Software license. You should have received a copy of this license
  11. * along with this source code; you will also find a current copy of
  12. * the license at http://www.panda3d.org/license.txt .
  13. *
  14. * To contact the maintainers of this program write to
  15. * [email protected] .
  16. *
  17. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  18. /* This file is included at the beginning of every header file and/or
  19. C or C++ file. It must be compilable for C as well as C++ files,
  20. so no C++-specific code or syntax can be put here. See
  21. dtoolbase_cc.h for C++-specific stuff. */
  22. #ifndef DTOOLBASE_H
  23. #define DTOOLBASE_H
  24. #include "dtool_config.h"
  25. #ifdef WIN32_VC
  26. /* These warning pragmas must appear before anything else for VC++ to
  27. respect them. Sheesh. */
  28. /* C4231: extern before template instantiation */
  29. /* For some reason, this particular warning won't disable. */
  30. #pragma warning (disable : 4231)
  31. /* C4786: 255 char debug symbols */
  32. #pragma warning (disable : 4786)
  33. /* C4251: needs dll interface */
  34. #pragma warning (disable : 4251)
  35. /* C4503: decorated name length exceeded */
  36. #pragma warning (disable : 4503)
  37. /* C4305: truncation from 'const double' to 'float' */
  38. #pragma warning (disable : 4305)
  39. /* C4250: 'myclass' : inherits 'baseclass::member' via dominance */
  40. #pragma warning (disable : 4250)
  41. /* C4355: 'this' : used in base member initializer list */
  42. #pragma warning (disable : 4355)
  43. /* C4244: 'initializing' : conversion from 'double' to 'float', possible loss of data */
  44. #pragma warning (disable : 4244)
  45. #if _MSC_VER >= 1300
  46. #if _MSC_VER >= 1310
  47. #define USING_MSVC7_1
  48. //#pragma message("VC 7.1")
  49. #else
  50. //#pragma message("VC 7.0")
  51. #endif
  52. #define USING_MSVC7
  53. #else
  54. // #pragma message("VC 6.0")
  55. #endif
  56. // Use NODEFAULT to optimize a switch() stmt to tell MSVC to automatically go to the final untested case
  57. // after it has failed all the other cases (i.e. 'assume at least one of the cases is always true')
  58. #ifdef _DEBUG
  59. # define NODEFAULT default: assert(0);
  60. #else
  61. # define NODEFAULT default: __assume(0); // special VC keyword
  62. #endif
  63. #else /* if !WIN32_VC */
  64. #ifdef _DEBUG
  65. # define NODEFAULT default: assert(0);
  66. #else
  67. # define NODEFAULT
  68. #endif
  69. #endif /* WIN32_VC */
  70. #include "dtoolsymbols.h"
  71. #ifdef __GNUC__
  72. // Large file >2GB support
  73. // this needs be be before systypes.h and other C headers
  74. #define _FILE_OFFSET_BITS 64
  75. #define _LARGEFILE_SOURCE 1
  76. #endif
  77. #ifdef HAVE_MALLOC_H
  78. #include <malloc.h>
  79. #endif
  80. #ifdef HAVE_ALLOCA_H
  81. #include <alloca.h>
  82. #endif
  83. #ifdef HAVE_UNISTD_H
  84. #include <unistd.h>
  85. #endif
  86. #ifdef HAVE_IO_H
  87. #include <io.h>
  88. #endif
  89. #ifdef HAVE_MINMAX_H
  90. #include <minmax.h>
  91. #endif
  92. #ifdef HAVE_SYS_TYPES_H
  93. #include <sys/types.h>
  94. #endif
  95. #ifdef HAVE_SYS_TIME_H
  96. #include <sys/time.h>
  97. #endif
  98. #ifdef CPPPARSER
  99. #include <stdtypedefs.h>
  100. #endif
  101. /*
  102. We define the macros BEGIN_PUBLISH and END_PUBLISH to bracket
  103. functions and global variable definitions that are to be published
  104. via interrogate to scripting languages.
  105. */
  106. #ifdef CPPPARSER
  107. #define BEGIN_PUBLISH __begin_publish
  108. #define END_PUBLISH __end_publish
  109. #else
  110. #define BEGIN_PUBLISH
  111. #define END_PUBLISH
  112. #endif
  113. #ifdef __cplusplus
  114. #include "dtoolbase_cc.h"
  115. #endif
  116. #endif