| 1 | /* $Id: kTypes.h 95 2016-09-26 07:23:08Z bird $ */
|
|---|
| 2 | /** @file
|
|---|
| 3 | * kTypes - Typedefs And Related Constants And Macros.
|
|---|
| 4 | */
|
|---|
| 5 |
|
|---|
| 6 | /*
|
|---|
| 7 | * Copyright (c) 2006-2009 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net>
|
|---|
| 8 | *
|
|---|
| 9 | * Permission is hereby granted, free of charge, to any person
|
|---|
| 10 | * obtaining a copy of this software and associated documentation
|
|---|
| 11 | * files (the "Software"), to deal in the Software without
|
|---|
| 12 | * restriction, including without limitation the rights to use,
|
|---|
| 13 | * copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|---|
| 14 | * copies of the Software, and to permit persons to whom the
|
|---|
| 15 | * Software is furnished to do so, subject to the following
|
|---|
| 16 | * conditions:
|
|---|
| 17 | *
|
|---|
| 18 | * The above copyright notice and this permission notice shall be
|
|---|
| 19 | * included in all copies or substantial portions of the Software.
|
|---|
| 20 | *
|
|---|
| 21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|---|
| 22 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|---|
| 23 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|---|
| 24 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|---|
| 25 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|---|
| 26 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|---|
| 27 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|---|
| 28 | * OTHER DEALINGS IN THE SOFTWARE.
|
|---|
| 29 | */
|
|---|
| 30 |
|
|---|
| 31 | #ifndef ___k_kTypes_h___
|
|---|
| 32 | #define ___k_kTypes_h___
|
|---|
| 33 |
|
|---|
| 34 | #include <k/kDefs.h>
|
|---|
| 35 |
|
|---|
| 36 | /** @defgroup grp_kTypes kTypes - Typedefs And Related Constants And Macros
|
|---|
| 37 | * @{
|
|---|
| 38 | */
|
|---|
| 39 |
|
|---|
| 40 | /** @typedef KI64
|
|---|
| 41 | * 64-bit signed integer. */
|
|---|
| 42 | /** @typedef KU64
|
|---|
| 43 | * 64-bit unsigned integer. */
|
|---|
| 44 | /** @def KI64_C
|
|---|
| 45 | * 64-bit signed integer constant.
|
|---|
| 46 | * @param c The constant value. */
|
|---|
| 47 | /** @def KU64_C
|
|---|
| 48 | * 64-bit unsigned integer constant.
|
|---|
| 49 | * @param c The constant value. */
|
|---|
| 50 | /** @def KI64_PRI
|
|---|
| 51 | * 64-bit signed integer printf format. */
|
|---|
| 52 | /** @def KU64_PRI
|
|---|
| 53 | * 64-bit unsigned integer printf format. */
|
|---|
| 54 | /** @def KX64_PRI
|
|---|
| 55 | * 64-bit signed and unsigned integer hexadecimal printf format. */
|
|---|
| 56 |
|
|---|
| 57 | /** @typedef KI32
|
|---|
| 58 | * 32-bit signed integer. */
|
|---|
| 59 | /** @typedef KU32
|
|---|
| 60 | * 32-bit unsigned integer. */
|
|---|
| 61 | /** @def KI32_C
|
|---|
| 62 | * 32-bit signed integer constant.
|
|---|
| 63 | * @param c The constant value. */
|
|---|
| 64 | /** @def KU32_C
|
|---|
| 65 | * 32-bit unsigned integer constant.
|
|---|
| 66 | * @param c The constant value. */
|
|---|
| 67 | /** @def KI32_PRI
|
|---|
| 68 | * 32-bit signed integer printf format. */
|
|---|
| 69 | /** @def KU32_PRI
|
|---|
| 70 | * 32-bit unsigned integer printf format. */
|
|---|
| 71 | /** @def KX32_PRI
|
|---|
| 72 | * 32-bit signed and unsigned integer hexadecimal printf format. */
|
|---|
| 73 |
|
|---|
| 74 | /** @typedef KI16
|
|---|
| 75 | * 16-bit signed integer. */
|
|---|
| 76 | /** @typedef KU16
|
|---|
| 77 | * 16-bit unsigned integer. */
|
|---|
| 78 | /** @def KI16_C
|
|---|
| 79 | * 16-bit signed integer constant.
|
|---|
| 80 | * @param c The value. */
|
|---|
| 81 | /** @def KU16_C
|
|---|
| 82 | * 16-bit unsigned integer constant.
|
|---|
| 83 | * @param c The value. */
|
|---|
| 84 | /** @def KI16_PRI
|
|---|
| 85 | * 16-bit signed integer printf format. */
|
|---|
| 86 | /** @def KU16_PRI
|
|---|
| 87 | * 16-bit unsigned integer printf format. */
|
|---|
| 88 | /** @def KX16_PRI
|
|---|
| 89 | * 16-bit signed and unsigned integer hexadecimal printf format. */
|
|---|
| 90 |
|
|---|
| 91 | /** @typedef KI8
|
|---|
| 92 | * 8-bit signed integer. */
|
|---|
| 93 | /** @typedef KU8
|
|---|
| 94 | * 8-bit unsigned integer. */
|
|---|
| 95 | /** @def KI8_C
|
|---|
| 96 | * 8-bit signed integer constant.
|
|---|
| 97 | * @param c The constant value. */
|
|---|
| 98 | /** @def KU8_C
|
|---|
| 99 | * 8-bit unsigned integer constant.
|
|---|
| 100 | * @param c The constant value. */
|
|---|
| 101 | /** @def KI8_PRI
|
|---|
| 102 | * 8-bit signed integer printf format. */
|
|---|
| 103 | /** @def KU8_PRI
|
|---|
| 104 | * 8-bit unsigned integer printf format. */
|
|---|
| 105 | /** @def KX8_PRI
|
|---|
| 106 | * 8-bit signed and unsigned integer hexadecimal printf format. */
|
|---|
| 107 |
|
|---|
| 108 | /** @typedef KSIZE
|
|---|
| 109 | * Memory size type; unsigned integer. */
|
|---|
| 110 | /** @typedef KSSIZE
|
|---|
| 111 | * Memory size type; signed integer. */
|
|---|
| 112 | /** @def KSIZE_C
|
|---|
| 113 | * Memory size constant.
|
|---|
| 114 | * @param c The constant value. */
|
|---|
| 115 | /** @def KSSIZE_C
|
|---|
| 116 | * Memory size constant.
|
|---|
| 117 | * @param c The constant value. */
|
|---|
| 118 | /** @def KSIZE_MAX
|
|---|
| 119 | * Memory size max constant.*/
|
|---|
| 120 | /** @def KSSIZE_MAX
|
|---|
| 121 | * Memory size max constant.*/
|
|---|
| 122 | /** @def KSSIZE_MIN
|
|---|
| 123 | * Memory size min constant.*/
|
|---|
| 124 | /** @def KSIZE_PRI
|
|---|
| 125 | * Memory size default printf format (hex). */
|
|---|
| 126 | /** @def KSIZE_PRI_U
|
|---|
| 127 | * Memory size unsigned decimal printf format. */
|
|---|
| 128 | /** @def KSIZE_PRI_I
|
|---|
| 129 | * Memory size signed decimal printf format. */
|
|---|
| 130 | /** @def KSIZE_PRI_X
|
|---|
| 131 | * Memory size hexadecimal printf format. */
|
|---|
| 132 | /** @def KSSIZE_PRI
|
|---|
| 133 | * Memory size default printf format (hex). */
|
|---|
| 134 | /** @def KSSIZE_PRI_U
|
|---|
| 135 | * Memory size unsigned decimal printf format. */
|
|---|
| 136 | /** @def KSSIZE_PRI_I
|
|---|
| 137 | * Memory size signed decimal printf format. */
|
|---|
| 138 | /** @def KSSIZE_PRI_X
|
|---|
| 139 | * Memory size hexadecimal printf format. */
|
|---|
| 140 |
|
|---|
| 141 | /** @typedef KIPTR
|
|---|
| 142 | * Signed integer type capable of containing a pointer value. */
|
|---|
| 143 | /** @typedef KUPTR
|
|---|
| 144 | * Unsigned integer type capable of containing a pointer value. */
|
|---|
| 145 | /** @def KIPTR_C
|
|---|
| 146 | * Signed pointer constant.
|
|---|
| 147 | * @param c The constant value. */
|
|---|
| 148 | /** @def KUPTR_C
|
|---|
| 149 | * Unsigned pointer constant.
|
|---|
| 150 | * @param c The constant value. */
|
|---|
| 151 | /** @def KIPTR_MAX
|
|---|
| 152 | * Signed pointer max constant.*/
|
|---|
| 153 | /** @def KIPTR_MIN
|
|---|
| 154 | * Signed pointer min constant.*/
|
|---|
| 155 | /** @def KUPTR_MAX
|
|---|
| 156 | * Unsigned pointer max constant.*/
|
|---|
| 157 | /** @def KIPTR_PRI
|
|---|
| 158 | * Signed pointer printf format. */
|
|---|
| 159 | /** @def KUPTR_PRI
|
|---|
| 160 | * Unsigned pointer printf format. */
|
|---|
| 161 |
|
|---|
| 162 |
|
|---|
| 163 | #if K_ARCH_BITS == 32
|
|---|
| 164 | /* ASSUMES int == long == 32-bit, short == 16-bit, char == 8-bit. */
|
|---|
| 165 | # ifdef _MSC_VER
|
|---|
| 166 | typedef signed __int64 KI64;
|
|---|
| 167 | typedef unsigned __int64 KU64;
|
|---|
| 168 | #define KI64_PRI "I64d"
|
|---|
| 169 | #define KU64_PRI "I64u"
|
|---|
| 170 | #define KX64_PRI "I64x"
|
|---|
| 171 | # else
|
|---|
| 172 | typedef signed long long int KI64;
|
|---|
| 173 | typedef unsigned long long int KU64;
|
|---|
| 174 | #define KI64_PRI "lld"
|
|---|
| 175 | #define KU64_PRI "llu"
|
|---|
| 176 | #define KX64_PRI "llx"
|
|---|
| 177 | # endif
|
|---|
| 178 | typedef signed int KI32;
|
|---|
| 179 | typedef unsigned int KU32;
|
|---|
| 180 | typedef signed short int KI16;
|
|---|
| 181 | typedef unsigned short int KU16;
|
|---|
| 182 | typedef signed char KI8;
|
|---|
| 183 | typedef unsigned char KU8;
|
|---|
| 184 | #define KI64_C(c) (c ## LL)
|
|---|
| 185 | #define KU64_C(c) (c ## ULL)
|
|---|
| 186 | #define KI32_C(c) (c)
|
|---|
| 187 | #define KU32_C(c) (c ## U)
|
|---|
| 188 | #define KI16_C(c) (c)
|
|---|
| 189 | #define KU16_C(c) (c)
|
|---|
| 190 | #define KI8_C(c) (c)
|
|---|
| 191 | #define KU8_C(c) (c)
|
|---|
| 192 |
|
|---|
| 193 | #define KI32_PRI "d"
|
|---|
| 194 | #define KU32_PRI "u"
|
|---|
| 195 | #define KX32_PRI "x"
|
|---|
| 196 | #define KI16_PRI "d"
|
|---|
| 197 | #define KU16_PRI "u"
|
|---|
| 198 | #define KX16_PRI "x"
|
|---|
| 199 | #define KI8_PRI "d"
|
|---|
| 200 | #define KU8_PRI "u"
|
|---|
| 201 | #define KX8_PRI "x"
|
|---|
| 202 |
|
|---|
| 203 | typedef KI32 KSSIZE;
|
|---|
| 204 | #define KSSIZE(c) KI32_C(c)
|
|---|
| 205 | #define KSSIZE_MAX KI32_MAX
|
|---|
| 206 | #define KSSIZE_MIN KI32_MIN
|
|---|
| 207 | #define KSSIZE_PRI KX32_PRI
|
|---|
| 208 |
|
|---|
| 209 | typedef KU32 KSIZE;
|
|---|
| 210 | #define KSIZE_C(c) KU32_C(c)
|
|---|
| 211 | #define KSIZE_MAX KU32_MAX
|
|---|
| 212 | #define KSIZE_PRI KX32_PRI
|
|---|
| 213 | #define KSIZE_PRI_U KU32_PRI
|
|---|
| 214 | #define KSIZE_PRI_I KI32_PRI
|
|---|
| 215 | #define KSIZE_PRI_X KX32_PRI
|
|---|
| 216 | #define KIPTR_C(c) KI32_C(c)
|
|---|
| 217 |
|
|---|
| 218 | typedef KI32 KIPTR;
|
|---|
| 219 | #define KIPTR_MAX KI32_MAX
|
|---|
| 220 | #define KIPTR_MIN KI32_MIN
|
|---|
| 221 | #define KIPTR_PRI KX32_PRI
|
|---|
| 222 |
|
|---|
| 223 | typedef KU32 KUPTR;
|
|---|
| 224 | #define KUPTR_C(c) KU32_C(c)
|
|---|
| 225 | #define KUPTR_MAX KU32_MAX
|
|---|
| 226 | #define KUPTR_PRI KX32_PRI
|
|---|
| 227 |
|
|---|
| 228 |
|
|---|
| 229 | #elif K_ARCH_BITS == 64
|
|---|
| 230 |
|
|---|
| 231 | # if K_OS == K_OS_WINDOWS
|
|---|
| 232 | # if _MSC_VER
|
|---|
| 233 | typedef signed __int64 KI64;
|
|---|
| 234 | typedef unsigned __int64 KU64;
|
|---|
| 235 | # define KI64_PRI "I64d"
|
|---|
| 236 | # define KU64_PRI "I64u"
|
|---|
| 237 | # define KX64_PRI "I64x"
|
|---|
| 238 | # else
|
|---|
| 239 | typedef signed long long int KI64;
|
|---|
| 240 | typedef unsigned long long int KU64;
|
|---|
| 241 | # define KI64_PRI "lld"
|
|---|
| 242 | # define KU64_PRI "llu"
|
|---|
| 243 | # define KX64_PRI "llx"
|
|---|
| 244 | # endif
|
|---|
| 245 | # define KI64_C(c) (c ## LL)
|
|---|
| 246 | # define KU64_C(c) (c ## ULL)
|
|---|
| 247 | # else
|
|---|
| 248 | typedef signed long int KI64;
|
|---|
| 249 | typedef unsigned long int KU64;
|
|---|
| 250 | # define KI64_C(c) (c ## L)
|
|---|
| 251 | # define KU64_C(c) (c ## UL)
|
|---|
| 252 | # define KI64_PRI "ld"
|
|---|
| 253 | # define KU64_PRI "lu"
|
|---|
| 254 | # define KX64_PRI "lx"
|
|---|
| 255 | # endif
|
|---|
| 256 | typedef signed int KI32;
|
|---|
| 257 | typedef unsigned int KU32;
|
|---|
| 258 | typedef signed short KI16;
|
|---|
| 259 | typedef unsigned short KU16;
|
|---|
| 260 | typedef signed char KI8;
|
|---|
| 261 | typedef unsigned char KU8;
|
|---|
| 262 | #define KI32_C(c) (c)
|
|---|
| 263 | #define KU32_C(c) (c ## U)
|
|---|
| 264 | #define KI16_C(c) (c)
|
|---|
| 265 | #define KU16_C(c) (c)
|
|---|
| 266 | #define KI8_C(c) (c)
|
|---|
| 267 | #define KU8_C(c) (c)
|
|---|
| 268 |
|
|---|
| 269 | #define KI32_PRI "d"
|
|---|
| 270 | #define KU32_PRI "u"
|
|---|
| 271 | #define KX32_PRI "x"
|
|---|
| 272 | #define KI16_PRI "d"
|
|---|
| 273 | #define KU16_PRI "u"
|
|---|
| 274 | #define KX16_PRI "x"
|
|---|
| 275 | #define KI8_PRI "d"
|
|---|
| 276 | #define KU8_PRI "u"
|
|---|
| 277 | #define KX8_PRI "x"
|
|---|
| 278 |
|
|---|
| 279 | typedef KI64 KSSIZE;
|
|---|
| 280 | #define KSSIZE(c) KI64_C(c)
|
|---|
| 281 | #define KSSIZE_MAX KI64_MAX
|
|---|
| 282 | #define KSSIZE_MIN KI64_MIN
|
|---|
| 283 | #define KSSIZE_PRI KX64_PRI
|
|---|
| 284 | #define KSSIZE_PRI_U KU64_PRI
|
|---|
| 285 | #define KSSIZE_PRI_I KI64_PRI
|
|---|
| 286 | #define KSSIZE_PRI_X KX64_PRI
|
|---|
| 287 |
|
|---|
| 288 | typedef KU64 KSIZE;
|
|---|
| 289 | #define KSIZE_C(c) KU64_C(c)
|
|---|
| 290 | #define KSIZE_MAX KU64_MAX
|
|---|
| 291 | #define KSIZE_PRI_U KU64_PRI
|
|---|
| 292 | #define KSIZE_PRI_I KI64_PRI
|
|---|
| 293 | #define KSIZE_PRI_X KX64_PRI
|
|---|
| 294 | #define KSIZE_PRI KX64_PRI
|
|---|
| 295 |
|
|---|
| 296 | typedef KI64 KIPTR;
|
|---|
| 297 | #define KIPTR_C(c) KI64_C(c)
|
|---|
| 298 | #define KIPTR_MAX KI64_MAX
|
|---|
| 299 | #define KIPTR_MIN KI64_MIN
|
|---|
| 300 | #define KIPTR_PRI KX64_PRI
|
|---|
| 301 |
|
|---|
| 302 | typedef KU64 KUPTR;
|
|---|
| 303 | #define KUPTR_C(c) KU64_C(c)
|
|---|
| 304 | #define KUPTR_MAX KU64_MAX
|
|---|
| 305 | #define KUPTR_PRI KX64_PRI
|
|---|
| 306 |
|
|---|
| 307 | #else
|
|---|
| 308 | # error "Port Me"
|
|---|
| 309 | #endif
|
|---|
| 310 |
|
|---|
| 311 |
|
|---|
| 312 | /** Min KI8 value. */
|
|---|
| 313 | #define KI8_MIN (KI8_C(-0x7f) - 1)
|
|---|
| 314 | /** Min KI16 value. */
|
|---|
| 315 | #define KI16_MIN (KI16_C(-0x7fff) - 1)
|
|---|
| 316 | /** Min KI32 value. */
|
|---|
| 317 | #define KI32_MIN (KI32_C(-0x7fffffff) - 1)
|
|---|
| 318 | /** Min KI64 value. */
|
|---|
| 319 | #define KI64_MIN (KI64_C(-0x7fffffffffffffff) - 1)
|
|---|
| 320 | /** Max KI8 value. */
|
|---|
| 321 | #define KI8_MAX KI8_C(0x7f)
|
|---|
| 322 | /** Max KI16 value. */
|
|---|
| 323 | #define KI16_MAX KI16_C(0x7fff)
|
|---|
| 324 | /** Max KI32 value. */
|
|---|
| 325 | #define KI32_MAX KI32_C(0x7fffffff)
|
|---|
| 326 | /** Max KI64 value. */
|
|---|
| 327 | #define KI64_MAX KI64_C(0x7fffffffffffffff)
|
|---|
| 328 | /** Max KU8 value. */
|
|---|
| 329 | #define KU8_MAX KU8_C(0xff)
|
|---|
| 330 | /** Max KU16 value. */
|
|---|
| 331 | #define KU16_MAX KU16_C(0xffff)
|
|---|
| 332 | /** Max KU32 value. */
|
|---|
| 333 | #define KU32_MAX KU32_C(0xffffffff)
|
|---|
| 334 | /** Max KU64 value. */
|
|---|
| 335 | #define KU64_MAX KU64_C(0xffffffffffffffff)
|
|---|
| 336 |
|
|---|
| 337 | /** File offset. */
|
|---|
| 338 | typedef KI64 KFOFF;
|
|---|
| 339 | /** Pointer a file offset. */
|
|---|
| 340 | typedef KFOFF *PFOFF;
|
|---|
| 341 | /** Pointer a const file offset. */
|
|---|
| 342 | typedef KFOFF *PCFOFF;
|
|---|
| 343 | /** The min value for the KFOFF type. */
|
|---|
| 344 | #define KFOFF_MIN KI64_MIN
|
|---|
| 345 | /** The max value for the KFOFF type. */
|
|---|
| 346 | #define KFOFF_MAX KI64_MAX
|
|---|
| 347 | /** File offset contstant.
|
|---|
| 348 | * @param c The constant value. */
|
|---|
| 349 | #define KFOFF_C(c) KI64_C(c)
|
|---|
| 350 | /** File offset printf format. */
|
|---|
| 351 | #define KFOFF_PRI KI64_PRI
|
|---|
| 352 |
|
|---|
| 353 |
|
|---|
| 354 | /**
|
|---|
| 355 | * Memory Protection.
|
|---|
| 356 | */
|
|---|
| 357 | typedef enum KPROT
|
|---|
| 358 | {
|
|---|
| 359 | /** The usual invalid 0. */
|
|---|
| 360 | KPROT_INVALID = 0,
|
|---|
| 361 | /** No access (page not present). */
|
|---|
| 362 | KPROT_NOACCESS,
|
|---|
| 363 | /** Read only. */
|
|---|
| 364 | KPROT_READONLY,
|
|---|
| 365 | /** Read & write. */
|
|---|
| 366 | KPROT_READWRITE,
|
|---|
| 367 | /** Read & copy on write. */
|
|---|
| 368 | KPROT_WRITECOPY,
|
|---|
| 369 | /** Execute only. */
|
|---|
| 370 | KPROT_EXECUTE,
|
|---|
| 371 | /** Execute & read. */
|
|---|
| 372 | KPROT_EXECUTE_READ,
|
|---|
| 373 | /** Execute, read & write. */
|
|---|
| 374 | KPROT_EXECUTE_READWRITE,
|
|---|
| 375 | /** Execute, read & copy on write. */
|
|---|
| 376 | KPROT_EXECUTE_WRITECOPY,
|
|---|
| 377 | /** The usual end value. (exclusive) */
|
|---|
| 378 | KPROT_END,
|
|---|
| 379 | /** Blow the type up to 32-bits. */
|
|---|
| 380 | KPROT_32BIT_HACK = 0x7fffffff
|
|---|
| 381 | } KPROT;
|
|---|
| 382 | /** Pointer to a memory protection enum. */
|
|---|
| 383 | typedef KPROT *PKPROT;
|
|---|
| 384 | /** Pointer to a const memory protection enum. */
|
|---|
| 385 | typedef KPROT const *PCKPROT;
|
|---|
| 386 |
|
|---|
| 387 | /** Boolean.
|
|---|
| 388 | * This can be used as a tri-state type, but then you *must* do == checks. */
|
|---|
| 389 | typedef KI8 KBOOL;
|
|---|
| 390 | /** Pointer to a boolean value. */
|
|---|
| 391 | typedef KBOOL *PKBOOL;
|
|---|
| 392 | /** Pointer to a const boolean value. */
|
|---|
| 393 | typedef KBOOL const *PCKBOOL;
|
|---|
| 394 | /** Maxium value the KBOOL type can hold (officially). */
|
|---|
| 395 | #define KBOOL_MIN KI8_C(-1)
|
|---|
| 396 | /** Maxium value the KBOOL type can hold (officially). */
|
|---|
| 397 | #define KBOOL_MAX KI8_C(1)
|
|---|
| 398 | /** The KBOOL printf format. */
|
|---|
| 399 | #define KBOOL_PRI KU8_PRI
|
|---|
| 400 | /** Boolean true constant. */
|
|---|
| 401 | #define K_TRUE KI8_C(1)
|
|---|
| 402 | /** Boolean false constant. */
|
|---|
| 403 | #define K_FALSE KI8_C(0)
|
|---|
| 404 | /** Boolean unknown constant (the third state). */
|
|---|
| 405 | #define K_UNKNOWN KI8_C(-1)
|
|---|
| 406 |
|
|---|
| 407 |
|
|---|
| 408 | /**
|
|---|
| 409 | * Integer union.
|
|---|
| 410 | */
|
|---|
| 411 | typedef union KUINT
|
|---|
| 412 | {
|
|---|
| 413 | KFOFF iBig; /**< The biggest member. */
|
|---|
| 414 | KBOOL fBool; /**< Boolean. */
|
|---|
| 415 | KU8 b; /**< unsigned 8-bit. */
|
|---|
| 416 | KU8 u8; /**< unsigned 8-bit. */
|
|---|
| 417 | KI8 i8; /**< signed 8-bit. */
|
|---|
| 418 | KU16 u16; /**< unsigned 16-bit. */
|
|---|
| 419 | KI16 i16; /**< signed 16-bit. */
|
|---|
| 420 | KU32 u32; /**< unsigned 32-bit. */
|
|---|
| 421 | KI32 i32; /**< signed 32-bit. */
|
|---|
| 422 | KU64 u64; /**< unsigned 64-bit. */
|
|---|
| 423 | KI64 i64; /**< signed 64-bit. */
|
|---|
| 424 | KSIZE cbUnsign; /**< unsigned size. */
|
|---|
| 425 | KSSIZE cbSign; /**< signed size. */
|
|---|
| 426 | KFOFF offFile; /**< file offset. */
|
|---|
| 427 | KUPTR uPtr; /**< unsigned pointer. */
|
|---|
| 428 | KIPTR iPtr; /**< signed pointer. */
|
|---|
| 429 | void *pv; /**< void pointer. */
|
|---|
| 430 | char ch; /**< char. */
|
|---|
| 431 | unsigned char uch; /**< unsigned char. */
|
|---|
| 432 | signed char chSigned; /**< signed char. */
|
|---|
| 433 | unsigned short uShort; /**< Unsigned short. */
|
|---|
| 434 | signed short iShort; /**< Signed short. */
|
|---|
| 435 | unsigned int uInt; /**< Unsigned int. */
|
|---|
| 436 | signed int iInt; /**< Signed int. */
|
|---|
| 437 | unsigned long uLong; /**< Unsigned long. */
|
|---|
| 438 | signed long iLong; /**< Signed long. */
|
|---|
| 439 | } KUINT;
|
|---|
| 440 |
|
|---|
| 441 |
|
|---|
| 442 | /**
|
|---|
| 443 | * Integer pointer union.
|
|---|
| 444 | */
|
|---|
| 445 | typedef union KPUINT
|
|---|
| 446 | {
|
|---|
| 447 | KFOFF *piBig; /**< The biggest member. */
|
|---|
| 448 | KBOOL *pfBool; /**< Boolean. */
|
|---|
| 449 | KU8 *pb; /**< unsigned 8-bit. */
|
|---|
| 450 | KU8 *pu8; /**< unsigned 8-bit. */
|
|---|
| 451 | KI8 *pi8; /**< signed 8-bit. */
|
|---|
| 452 | KU16 *pu16; /**< unsigned 16-bit. */
|
|---|
| 453 | KI16 *pi16; /**< signed 16-bit. */
|
|---|
| 454 | KU32 *pu32; /**< unsigned 32-bit. */
|
|---|
| 455 | KI32 *pi32; /**< signed 32-bit. */
|
|---|
| 456 | KU64 *pu64; /**< unsigned 64-bit. */
|
|---|
| 457 | KI64 *pi64; /**< signed 64-bit. */
|
|---|
| 458 | KSIZE *pcbUnsign; /**< unsigned size. */
|
|---|
| 459 | KSSIZE *pcbSign; /**< signed size. */
|
|---|
| 460 | KFOFF *poffFile; /**< file offset. */
|
|---|
| 461 | KUPTR *puPtr; /**< unsigned pointer. */
|
|---|
| 462 | KIPTR *piPtr; /**< signed pointer. */
|
|---|
| 463 | void **ppv; /**< void pointer pointer. */
|
|---|
| 464 | void *pv; /**< void pointer. */
|
|---|
| 465 | char *pch; /**< char. */
|
|---|
| 466 | char *psz; /**< zero terminated string. */
|
|---|
| 467 | unsigned char *puch; /**< unsigned char. */
|
|---|
| 468 | signed char *pchSigned; /**< signed char. */
|
|---|
| 469 | unsigned short *puShort; /**< Unsigned short. */
|
|---|
| 470 | signed short *piShort; /**< Signed short. */
|
|---|
| 471 | unsigned int *puInt; /**< Unsigned int. */
|
|---|
| 472 | signed int *piInt; /**< Signed int. */
|
|---|
| 473 | unsigned long *puLong; /**< Unsigned long. */
|
|---|
| 474 | signed long *piLong; /**< Signed long. */
|
|---|
| 475 | } KPUINT;
|
|---|
| 476 |
|
|---|
| 477 | /**
|
|---|
| 478 | * Integer const pointer union.
|
|---|
| 479 | */
|
|---|
| 480 | typedef union KPCUINT
|
|---|
| 481 | {
|
|---|
| 482 | KFOFF const *piBig; /**< The biggest member. */
|
|---|
| 483 | KBOOL const *pfBool; /**< Boolean. */
|
|---|
| 484 | KU8 const *pb; /**< byte. */
|
|---|
| 485 | KU8 const *pu8; /**< unsigned 8-bit. */
|
|---|
| 486 | KI8 const *pi8; /**< signed 8-bit. */
|
|---|
| 487 | KU16 const *pu16; /**< unsigned 16-bit. */
|
|---|
| 488 | KI16 const *pi16; /**< signed 16-bit. */
|
|---|
| 489 | KU32 const *pu32; /**< unsigned 32-bit. */
|
|---|
| 490 | KI32 const *pi32; /**< signed 32-bit. */
|
|---|
| 491 | KU64 const *pu64; /**< unsigned 64-bit. */
|
|---|
| 492 | KI64 const *pi64; /**< signed 64-bit. */
|
|---|
| 493 | KSIZE const *pcbUnsign; /**< unsigned size. */
|
|---|
| 494 | KSSIZE const *pcbSign; /**< signed size. */
|
|---|
| 495 | KFOFF const *poffFile; /**< file offset. */
|
|---|
| 496 | KUPTR const *puPtr; /**< unsigned pointer. */
|
|---|
| 497 | KIPTR const *piPtr; /**< signed pointer. */
|
|---|
| 498 | void const **ppv; /**< void pointer pointer. */
|
|---|
| 499 | void const *pv; /**< void pointer. */
|
|---|
| 500 | char const *pch; /**< char. */
|
|---|
| 501 | char const *psz; /**< zero terminated string. */
|
|---|
| 502 | unsigned char const *puch; /**< unsigned char. */
|
|---|
| 503 | signed char const *pchSigned; /**< signed char. */
|
|---|
| 504 | unsigned short const *puShort; /**< Unsigned short. */
|
|---|
| 505 | signed short const *piShort; /**< Signed short. */
|
|---|
| 506 | unsigned int const *puInt; /**< Unsigned int. */
|
|---|
| 507 | signed int const *piInt; /**< Signed int. */
|
|---|
| 508 | unsigned long const *puLong; /**< Unsigned long. */
|
|---|
| 509 | signed long const *piLong; /**< Signed long. */
|
|---|
| 510 | } KPCUINT;
|
|---|
| 511 |
|
|---|
| 512 |
|
|---|
| 513 | /** @name Forward Declarations / Handle Types.
|
|---|
| 514 | * @{ */
|
|---|
| 515 |
|
|---|
| 516 | /** Pointer to a file provider instance. */
|
|---|
| 517 | typedef struct KRDR *PKRDR;
|
|---|
| 518 | /** Pointer to a file provider instance pointer. */
|
|---|
| 519 | typedef struct KRDR **PPKRDR;
|
|---|
| 520 |
|
|---|
| 521 | /** Pointer to a loader segment. */
|
|---|
| 522 | typedef struct KLDRSEG *PKLDRSEG;
|
|---|
| 523 | /** Pointer to a loader segment. */
|
|---|
| 524 | typedef const struct KLDRSEG *PCKLDRSEG;
|
|---|
| 525 |
|
|---|
| 526 | /** @} */
|
|---|
| 527 |
|
|---|
| 528 | /** @} */
|
|---|
| 529 |
|
|---|
| 530 | #endif
|
|---|
| 531 |
|
|---|