You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

156 lines
3.6 KiB

  1. /**
  2. * xrdp: A Remote Desktop Protocol server.
  3. *
  4. * Copyright (C) Jay Sorg 2004-2014
  5. *
  6. * Licensed under the Apache License, Version 2.0 (the "License");
  7. * you may not use this file except in compliance with the License.
  8. * You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. #if !defined(ARCH_H)
  19. #define ARCH_H
  20. #include <stdlib.h>
  21. #if defined(HAVE_STDINT_H)
  22. #include <stdint.h>
  23. #else
  24. typedef signed char int8_t;
  25. typedef unsigned char uint8_t;
  26. typedef signed short int16_t;
  27. typedef unsigned short uint16_t;
  28. typedef signed int int32_t;
  29. typedef unsigned int uint32_t;
  30. #if defined(_WIN64)
  31. typedef signed __int64 int64_t;
  32. typedef unsigned __int64 uint64_t;
  33. typedef signed __int64 intptr_t;
  34. typedef unsigned __int64 uintptr_t;
  35. #else
  36. typedef signed long long int64_t;
  37. typedef unsigned long long uint64_t;
  38. typedef signed long intptr_t;
  39. typedef unsigned long uintptr_t;
  40. #endif
  41. #endif
  42. typedef int bool_t;
  43. /* you can define L_ENDIAN or B_ENDIAN and NEED_ALIGN or NO_NEED_ALIGN
  44. in the makefile to override */
  45. /* check endianness */
  46. #if !(defined(L_ENDIAN) || defined(B_ENDIAN))
  47. #if !defined(__BYTE_ORDER) && defined(__linux__)
  48. #include <endian.h>
  49. #endif
  50. #if defined(BYTE_ORDER)
  51. #if BYTE_ORDER == BIG_ENDIAN
  52. #define B_ENDIAN
  53. #else
  54. #define L_ENDIAN
  55. #endif
  56. #endif
  57. #if !(defined(L_ENDIAN) || defined(B_ENDIAN))
  58. #if defined(__sparc__) || defined(__PPC__) || defined(__ppc__) || \
  59. defined(__hppa__)
  60. #define B_ENDIAN
  61. #else
  62. #define L_ENDIAN
  63. #endif
  64. #endif
  65. #endif
  66. /* check if we need to align data */
  67. #if !(defined(NEED_ALIGN) || defined(NO_NEED_ALIGN))
  68. #if defined(__sparc__) || defined(__alpha__) || defined(__hppa__) || \
  69. defined(__AIX__) || defined(__PPC__) || defined(__mips__) || \
  70. defined(__ia64__) || defined(__ppc__) || defined(__arm__)
  71. #define NEED_ALIGN
  72. #elif defined(__x86__) || defined(__x86_64__) || \
  73. defined(__AMD64__) || defined(_M_IX86) || defined (_M_AMD64) || \
  74. defined(__i386__) || defined(__aarch64__)
  75. #define NO_NEED_ALIGN
  76. #else
  77. #warning unknown arch
  78. #endif
  79. #endif
  80. /* defines for thread creation factory functions */
  81. #if defined(_WIN32)
  82. #define THREAD_RV unsigned long
  83. #define THREAD_CC __stdcall
  84. #else
  85. #define THREAD_RV void*
  86. #define THREAD_CC
  87. #endif
  88. #if defined(_WIN32)
  89. #if defined(__BORLANDC__)
  90. #define EXPORT_CC _export __cdecl
  91. #else
  92. #define EXPORT_CC
  93. #endif
  94. #else
  95. #define EXPORT_CC
  96. #endif
  97. #ifndef DEFINED_Ts
  98. #define DEFINED_Ts
  99. typedef int8_t ti8;
  100. typedef uint8_t tui8;
  101. typedef int8_t tsi8;
  102. typedef int16_t ti16;
  103. typedef uint16_t tui16;
  104. typedef int16_t tsi16;
  105. typedef int32_t ti32;
  106. typedef uint32_t tui32;
  107. typedef int32_t tsi32;
  108. typedef int64_t ti64;
  109. typedef uint64_t tui64;
  110. typedef int64_t tsi64;
  111. typedef bool_t tbool;
  112. typedef intptr_t tbus;
  113. typedef intptr_t tintptr;
  114. /* wide char, socket */
  115. #if defined(_WIN32)
  116. typedef unsigned short twchar;
  117. typedef unsigned int tsock;
  118. #else
  119. typedef int twchar;
  120. typedef int tsock;
  121. #endif
  122. #endif /* DEFINED_Ts */
  123. /* format string verification */
  124. #if defined(HAVE_FUNC_ATTRIBUTE_FORMAT)
  125. #define printflike(arg_format, arg_first_check) \
  126. __attribute__((__format__(__printf__, arg_format, arg_first_check)))
  127. #else
  128. #define printflike(arg_format, arg_first_check)
  129. #endif
  130. /* module interface */
  131. #ifdef __cplusplus
  132. extern "C" {
  133. #endif
  134. tintptr mod_init(void);
  135. int mod_exit(tintptr);
  136. #ifdef __cplusplus
  137. }
  138. #endif
  139. #endif