PageRenderTime 21ms CodeModel.GetById 13ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/Modules/_ctypes/libffi/include/ffi_common.h

http://unladen-swallow.googlecode.com/
C++ Header | 98 lines | 67 code | 18 blank | 13 comment | 1 complexity | 8dc0c5539602888ff32ddcc8fe0996f5 MD5 | raw file
 1/* -----------------------------------------------------------------------
 2   ffi_common.h - Copyright (c) 1996  Red Hat, Inc.
 3   Copyright (C) 2007 Free Software Foundation, Inc
 4
 5   Common internal definitions and macros. Only necessary for building
 6   libffi.
 7   ----------------------------------------------------------------------- */
 8
 9#ifndef FFI_COMMON_H
10#define FFI_COMMON_H
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16#include <fficonfig.h>
17
18/* Do not move this. Some versions of AIX are very picky about where
19   this is positioned. */
20#ifdef __GNUC__
21# define alloca __builtin_alloca
22# define MAYBE_UNUSED __attribute__((__unused__))
23#else
24# define MAYBE_UNUSED
25# if HAVE_ALLOCA_H
26#  include <alloca.h>
27# else
28#  ifdef _AIX
29 #pragma alloca
30#  else
31#   ifndef alloca /* predefined by HP cc +Olibcalls */
32char *alloca ();
33#   endif
34#  endif
35# endif
36#endif
37
38/* Check for the existence of memcpy. */
39#if STDC_HEADERS
40# include <string.h>
41#else
42# ifndef HAVE_MEMCPY
43#  define memcpy(d, s, n) bcopy ((s), (d), (n))
44# endif
45#endif
46
47#if defined(FFI_DEBUG)
48#include <stdio.h>
49#endif
50
51#ifdef FFI_DEBUG
52void ffi_assert(char *expr, char *file, int line);
53void ffi_stop_here(void);
54void ffi_type_test(ffi_type *a, char *file, int line);
55
56#define FFI_ASSERT(x) ((x) ? (void)0 : ffi_assert(#x, __FILE__,__LINE__))
57#define FFI_ASSERT_AT(x, f, l) ((x) ? 0 : ffi_assert(#x, (f), (l)))
58#define FFI_ASSERT_VALID_TYPE(x) ffi_type_test (x, __FILE__, __LINE__)
59#else
60#define FFI_ASSERT(x)
61#define FFI_ASSERT_AT(x, f, l)
62#define FFI_ASSERT_VALID_TYPE(x)
63#endif
64
65#define ALIGN(v, a)  (((((size_t) (v))-1) | ((a)-1))+1)
66#define ALIGN_DOWN(v, a) (((size_t) (v)) & -a)
67
68/* Perform machine dependent cif processing */
69ffi_status ffi_prep_cif_machdep(ffi_cif *cif);
70
71/* Extended cif, used in callback from assembly routine */
72typedef struct
73{
74  ffi_cif *cif;
75  void *rvalue;
76  void **avalue;
77} extended_cif;
78
79/* Terse sized type definitions.  */
80typedef unsigned int UINT8  __attribute__((__mode__(__QI__)));
81typedef signed int   SINT8  __attribute__((__mode__(__QI__)));
82typedef unsigned int UINT16 __attribute__((__mode__(__HI__)));
83typedef signed int   SINT16 __attribute__((__mode__(__HI__)));
84typedef unsigned int UINT32 __attribute__((__mode__(__SI__)));
85typedef signed int   SINT32 __attribute__((__mode__(__SI__)));
86typedef unsigned int UINT64 __attribute__((__mode__(__DI__)));
87typedef signed int   SINT64 __attribute__((__mode__(__DI__)));
88
89typedef float FLOAT32;
90
91
92#ifdef __cplusplus
93}
94#endif
95
96#endif
97
98