PageRenderTime 48ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/EQEmuServer/common/types.h

http://projecteqemu.googlecode.com/
C Header | 110 lines | 71 code | 15 blank | 24 comment | 3 complexity | b7434d5cbcb08273c7d73990522f3a28 MD5 | raw file
Possible License(s): GPL-2.0
  1. /* EQEMu: Everquest Server Emulator
  2. Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; version 2 of the License.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY except by those people which sell it, which
  8. are required to give you total support for your newly bought product;
  9. without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  10. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  14. */
  15. #ifndef TYPES_H
  16. #define TYPES_H
  17. // TODO: If we require signed or unsigned we should the s and u types..
  18. typedef unsigned char int8;
  19. typedef unsigned char byte;
  20. typedef unsigned short int16;
  21. typedef unsigned int int32;
  22. typedef unsigned char uint8;
  23. typedef signed char sint8;
  24. typedef unsigned short uint16;
  25. typedef signed short sint16;
  26. typedef unsigned int uint32;
  27. typedef signed int sint32;
  28. #ifdef _WINDOWS
  29. #if defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64
  30. typedef unsigned __int64 int64;
  31. typedef unsigned __int64 uint64;
  32. typedef signed __int64 sint64;
  33. #else
  34. #error __int64 not supported
  35. #endif
  36. #else
  37. typedef unsigned long long int64;
  38. typedef unsigned long long uint64;
  39. typedef signed long long sint64;
  40. //typedef __u64 int64;
  41. //typedef __u64 uint64;
  42. //typedef __s64 sint64;
  43. #endif
  44. #ifndef __cplusplus
  45. typedef enum { true, false } bool;
  46. #endif
  47. typedef unsigned long ulong;
  48. typedef unsigned short ushort;
  49. typedef unsigned char uchar;
  50. typedef const char Const_char; //for perl XS
  51. #ifdef _WINDOWS
  52. #define snprintf _snprintf
  53. #if (_MSC_VER < 1500)
  54. #define vsnprintf _vsnprintf
  55. #endif
  56. #define strncasecmp _strnicmp
  57. #define strcasecmp _stricmp
  58. typedef void ThreadReturnType;
  59. // #define THREAD_RETURN(x) return;
  60. #define THREAD_RETURN(x) _endthread(); return;
  61. #else
  62. typedef void* ThreadReturnType;
  63. // typedef int SOCKET;
  64. #define THREAD_RETURN(x) return(x);
  65. #endif
  66. #define safe_delete(d) if(d) { delete d; d=0; }
  67. #define safe_delete_array(d) if(d) { delete[] d; d=0; }
  68. #define L32(i) ((int32) i)
  69. #define H32(i) ((int32) (i >> 32))
  70. #define L16(i) ((int16) i)
  71. #ifndef WIN32
  72. // More WIN32 compatability
  73. typedef unsigned long DWORD;
  74. typedef unsigned char BYTE;
  75. typedef char CHAR;
  76. typedef unsigned short WORD;
  77. typedef float FLOAT;
  78. typedef FLOAT *PFLOAT;
  79. typedef BYTE *PBYTE,*LPBYTE;
  80. typedef int *PINT,*LPINT;
  81. typedef WORD *PWORD,*LPWORD;
  82. typedef long *LPLONG, LONG;
  83. typedef DWORD *PDWORD,*LPDWORD;
  84. typedef int INT;
  85. typedef unsigned int UINT,*PUINT,*LPUINT;
  86. #endif
  87. #ifdef _WINDOWS
  88. #define DLLFUNC extern "C" __declspec(dllexport)
  89. #else
  90. #define DLLFUNC extern "C"
  91. #endif
  92. #endif