types.h (3265B)
1 /* -*-comment-start: "//";comment-end:""-*- 2 * GNU Mes --- Maxwell Equations of Software 3 * Copyright © 2017,2022 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 23 #include <mes/lib-cc.h> 24 25 #if SYSTEM_LIBC 26 #undef __MES_SYS_TYPES_H 27 #include_next <sys/types.h> 28 #else // ! SYSTEM_LIBC 29 30 #include <endian.h> 31 32 #ifndef __MESCCLIB__ 33 #define __MESCCLIB__ 15 34 #endif 35 36 #ifndef NULL 37 #define NULL 0 38 #endif 39 40 #ifndef __MES_CLOCK_T 41 #define __MES_CLOCK_T 42 #undef clock_t 43 typedef long clock_t; 44 #endif 45 46 #ifndef __MES_DEV_T 47 #define __MES_DEV_T 48 #undef dev_t 49 typedef long dev_t; 50 #endif 51 52 #if !defined (__MES_FILE_T) && ! defined (_FILE_T) 53 #define __MES_FILE_T 54 #define _FILE_T 55 typedef long FILE; 56 #endif 57 58 #ifndef __MES_GID_T 59 #define __MES_GID_T 60 #undef gid_t 61 typedef unsigned gid_t; 62 #endif 63 64 #ifndef __MES_INO_T 65 #define __MES_INO_T 66 #undef ino_t 67 #if __M2__ 68 typedef unsigned ino_t; 69 #else 70 typedef unsigned long ino_t; 71 #endif 72 #endif 73 74 #if __SIZEOF_LONG_LONG__ == 8 75 #ifndef __MES_INO64_T 76 #define __MES_INO64_T 77 #undef ino64_t 78 #if __M2__ 79 typedef unsigned ino64_t; 80 #else 81 typedef unsigned long long ino64_t; 82 #endif 83 #endif 84 #endif // __SIZEOF_LONG_LONG__ == 8 85 86 #if !defined (__MES_INTPTR_T) && !defined (__intptr_t_defined) 87 #define __MES_INTPTR_T 88 #define __intptr_t_defined 89 #undef intptr_t 90 typedef long intptr_t; 91 #undef uintptr_t 92 #if __M2__ 93 typedef unsigned uintptr_t; 94 #else 95 typedef unsigned long uintptr_t; 96 #endif 97 #endif 98 99 #ifndef __MES_OFF_T 100 #define __MES_OFF_T 101 #undef off_t 102 typedef long off_t; 103 #endif 104 105 #if __SIZEOF_LONG_LONG__ == 8 106 #ifndef __MES_OFF64_T 107 #define __MES_OFF64_T 108 #undef off64_t 109 #if __M2__ 110 typedef unsigned off64_t; 111 #else 112 typedef unsigned long long off64_t; 113 #endif 114 #endif 115 #endif // __SIZEOF_LONG_LONG__ == 8 116 117 #ifndef __MES_PID_T 118 #define __MES_PID_T 119 #undef pid_t 120 typedef int pid_t; 121 #endif 122 123 #ifndef __PTRDIFF_T 124 #define __PTRDIFF_T 125 #ifndef __MES_PTRDIFF_T 126 #define __MES_PTRDIFF_T 127 #undef ptrdiff_t 128 typedef long ptrdiff_t; 129 #endif 130 #endif 131 132 #ifndef __MES_SIGVAL_T 133 #define __MES_SIGVAL_T 134 #undef clock_t 135 typedef long sigval_t; 136 #endif 137 138 #ifndef __SIZE_T 139 #define __SIZE_T 140 #ifndef __MES_SIZE_T 141 #define __MES_SIZE_T 142 #undef size_t 143 #if __M2__ 144 typedef unsigned size_t; 145 #else 146 typedef unsigned long size_t; 147 #endif 148 #endif 149 #endif 150 151 #ifndef __MES_SSIZE_T 152 #define __MES_SSIZE_T 153 #undef ssize_t 154 typedef long ssize_t; 155 #endif 156 157 #ifndef __MES_UID_T 158 #define __MES_UID_T 159 #undef uid_t 160 typedef unsigned uid_t; 161 #endif 162 163 #ifndef __WCHAR_T 164 #define __WCHAR_T 165 #ifndef __MES_WCHAR_T 166 #define __MES_WCHAR_T 167 #undef wchar_t 168 typedef int wchar_t; 169 #endif 170 #endif 171 172 #endif // ! SYSTEM_LIBC 173 174 #endif // __MES_SYS_TYPES_H