types.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /* -*-comment-start: "//";comment-end:""-*-
  2. * GNU Mes --- Maxwell Equations of Software
  3. * Copyright © 2017 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
  4. *
  5. * This file is part of GNU Mes.
  6. *
  7. * GNU Mes is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 3 of the License, or (at
  10. * your option) any later version.
  11. *
  12. * GNU Mes is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #ifndef __MES_SYS_TYPES_H
  21. #define __MES_SYS_TYPES_H 1
  22. #if SYSTEM_LIBC
  23. #undef __MES_SYS_TYPES_H
  24. #include_next <sys/types.h>
  25. #else // ! SYSTEM_LIBC
  26. #include <endian.h>
  27. #ifndef __MESCCLIB__
  28. #define __MESCCLIB__ 15
  29. #endif
  30. #ifndef EOF
  31. #define EOF -1
  32. #endif
  33. #ifndef NULL
  34. #define NULL 0
  35. #endif
  36. #ifndef __MES_CLOCK_T
  37. #define __MES_CLOCK_T
  38. #undef clock_t
  39. typedef long clock_t;
  40. #endif
  41. #ifndef __MES_DEV_T
  42. #define __MES_DEV_T
  43. #undef dev_t
  44. typedef long dev_t;
  45. #endif
  46. #if !defined (__MES_FILE_T) && ! defined (_FILE_T)
  47. #define __MES_FILE_T
  48. #define _FILE_T
  49. typedef long FILE;
  50. #endif
  51. #ifndef __MES_GID_T
  52. #define __MES_GID_T
  53. #undef gid_t
  54. typedef unsigned gid_t;
  55. #endif
  56. #ifndef __MES_INO_T
  57. #define __MES_INO_T
  58. #undef ino_t
  59. typedef unsigned long ino_t;
  60. #endif
  61. #if __SIZEOF_LONG_LONG__ == 8
  62. #ifndef __MES_INO64_T
  63. #define __MES_INO64_T
  64. #undef ino64_t
  65. typedef unsigned long long ino64_t;
  66. #endif
  67. #endif // __SIZEOF_LONG_LONG__ == 8
  68. #if !defined (__MES_INTPTR_T) && !defined (__intptr_t_defined)
  69. #define __MES_INTPTR_T
  70. #define __intptr_t_defined
  71. #undef intptr_t
  72. typedef long intptr_t;
  73. #undef uintptr_t
  74. typedef unsigned long uintptr_t;
  75. #endif
  76. #ifndef __MES_OFF_T
  77. #define __MES_OFF_T
  78. #undef off_t
  79. typedef long off_t;
  80. #endif
  81. #if __SIZEOF_LONG_LONG__ == 8
  82. #ifndef __MES_OFF64_T
  83. #define __MES_OFF64_T
  84. #undef off64_t
  85. typedef unsigned long long off64_t;
  86. #endif
  87. #endif // __SIZEOF_LONG_LONG__ == 8
  88. #ifndef __MES_PID_T
  89. #define __MES_PID_T
  90. #undef pid_t
  91. typedef int pid_t;
  92. #endif
  93. #ifndef __PTRDIFF_T
  94. #define __PTRDIFF_T
  95. #ifndef __MES_PTRDIFF_T
  96. #define __MES_PTRDIFF_T
  97. #undef ptrdiff_t
  98. typedef long ptrdiff_t;
  99. #endif
  100. #endif
  101. #ifndef __MES_SIGVAL_T
  102. #define __MES_SIGVAL_T
  103. #undef clock_t
  104. typedef long sigval_t;
  105. #endif
  106. #ifndef __SIZE_T
  107. #define __SIZE_T
  108. #ifndef __MES_SIZE_T
  109. #define __MES_SIZE_T
  110. #undef size_t
  111. typedef unsigned long size_t;
  112. #endif
  113. #endif
  114. #ifndef __MES_SSIZE_T
  115. #define __MES_SSIZE_T
  116. #undef ssize_t
  117. typedef long ssize_t;
  118. #endif
  119. #ifndef __MES_UID_T
  120. #define __MES_UID_T
  121. #undef uid_t
  122. typedef unsigned uid_t;
  123. #endif
  124. #ifndef __WCHAR_T
  125. #define __WCHAR_T
  126. #ifndef __MES_WCHAR_T
  127. #define __MES_WCHAR_T
  128. #undef wchar_t
  129. typedef int wchar_t;
  130. #endif
  131. #endif
  132. #endif // ! SYSTEM_LIBC
  133. #endif // __MES_SYS_TYPES_H