PageRenderTime 294ms CodeModel.GetById 131ms app.highlight 5ms RepoModel.GetById 156ms app.codeStats 0ms

/Modules/_ctypes/libffi_msvc/types.c

http://unladen-swallow.googlecode.com/
C | 104 lines | 48 code | 30 blank | 26 comment | 12 complexity | cb4a2aff3701abec0cc3974eec083e99 MD5 | raw file
  1/* -----------------------------------------------------------------------
  2   types.c - Copyright (c) 1996, 1998  Red Hat, Inc.
  3   
  4   Predefined ffi_types needed by libffi.
  5
  6   Permission is hereby granted, free of charge, to any person obtaining
  7   a copy of this software and associated documentation files (the
  8   ``Software''), to deal in the Software without restriction, including
  9   without limitation the rights to use, copy, modify, merge, publish,
 10   distribute, sublicense, and/or sell copies of the Software, and to
 11   permit persons to whom the Software is furnished to do so, subject to
 12   the following conditions:
 13
 14   The above copyright notice and this permission notice shall be included
 15   in all copies or substantial portions of the Software.
 16
 17   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
 18   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 19   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 20   IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
 21   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 22   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 23   OTHER DEALINGS IN THE SOFTWARE.
 24   ----------------------------------------------------------------------- */
 25
 26#include <ffi.h>
 27#include <ffi_common.h>
 28
 29/* Type definitions */
 30
 31#define FFI_INTEGRAL_TYPEDEF(n, s, a, t) ffi_type ffi_type_##n = { s, a, t, NULL }
 32#define FFI_AGGREGATE_TYPEDEF(n, e) ffi_type ffi_type_##n = { 0, 0, FFI_TYPE_STRUCT, e }
 33
 34/* Size and alignment are fake here. They must not be 0. */
 35FFI_INTEGRAL_TYPEDEF(void, 1, 1, FFI_TYPE_VOID);
 36
 37FFI_INTEGRAL_TYPEDEF(uint8, 1, 1, FFI_TYPE_UINT8);
 38FFI_INTEGRAL_TYPEDEF(sint8, 1, 1, FFI_TYPE_SINT8);
 39FFI_INTEGRAL_TYPEDEF(uint16, 2, 2, FFI_TYPE_UINT16);
 40FFI_INTEGRAL_TYPEDEF(sint16, 2, 2, FFI_TYPE_SINT16);
 41FFI_INTEGRAL_TYPEDEF(uint32, 4, 4, FFI_TYPE_UINT32);
 42FFI_INTEGRAL_TYPEDEF(sint32, 4, 4, FFI_TYPE_SINT32);
 43FFI_INTEGRAL_TYPEDEF(float, 4, 4, FFI_TYPE_FLOAT);
 44
 45#if defined ALPHA || defined SPARC64 || defined X86_64 || defined S390X \
 46    || defined IA64
 47
 48FFI_INTEGRAL_TYPEDEF(pointer, 8, 8, FFI_TYPE_POINTER);
 49
 50#else
 51
 52FFI_INTEGRAL_TYPEDEF(pointer, 4, 4, FFI_TYPE_POINTER);
 53
 54#endif
 55
 56#if defined X86 || defined X86_WIN32 || defined ARM || defined M68K
 57
 58FFI_INTEGRAL_TYPEDEF(uint64, 8, 4, FFI_TYPE_UINT64);
 59FFI_INTEGRAL_TYPEDEF(sint64, 8, 4, FFI_TYPE_SINT64);
 60
 61#elif defined SH
 62
 63FFI_INTEGRAL_TYPEDEF(uint64, 8, 4, FFI_TYPE_UINT64);
 64FFI_INTEGRAL_TYPEDEF(sint64, 8, 4, FFI_TYPE_SINT64);
 65
 66#else
 67
 68FFI_INTEGRAL_TYPEDEF(uint64, 8, 8, FFI_TYPE_UINT64);
 69FFI_INTEGRAL_TYPEDEF(sint64, 8, 8, FFI_TYPE_SINT64);
 70
 71#endif
 72
 73
 74#if defined X86 || defined X86_WIN32 || defined M68K
 75
 76FFI_INTEGRAL_TYPEDEF(double, 8, 4, FFI_TYPE_DOUBLE);
 77FFI_INTEGRAL_TYPEDEF(longdouble, 12, 4, FFI_TYPE_LONGDOUBLE);
 78
 79#elif defined ARM || defined SH || defined POWERPC_AIX || defined POWERPC_DARWIN
 80
 81FFI_INTEGRAL_TYPEDEF(double, 8, 4, FFI_TYPE_DOUBLE);
 82FFI_INTEGRAL_TYPEDEF(longdouble, 8, 4, FFI_TYPE_LONGDOUBLE);
 83
 84#elif defined SPARC
 85
 86FFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE);
 87#ifdef SPARC64
 88FFI_INTEGRAL_TYPEDEF(longdouble, 16, 16, FFI_TYPE_LONGDOUBLE);
 89#else
 90FFI_INTEGRAL_TYPEDEF(longdouble, 16, 8, FFI_TYPE_LONGDOUBLE);
 91#endif
 92
 93#elif defined X86_64
 94
 95FFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE);
 96FFI_INTEGRAL_TYPEDEF(longdouble, 16, 16, FFI_TYPE_LONGDOUBLE);
 97
 98#else
 99
100FFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE);
101FFI_INTEGRAL_TYPEDEF(longdouble, 8, 8, FFI_TYPE_LONGDOUBLE);
102
103#endif
104