1 /* -----------------------------------------------------------------------
2 ffi_common.h - Copyright (c) 1996 Red Hat, Inc.
4 Common internal definitions and macros. Only necessary for building
6 ----------------------------------------------------------------------- */
15 #include <fficonfig.h>
17 /* Do not move this. Some versions of AIX are very picky about where
18 this is positioned. */
20 # define alloca __builtin_alloca
28 # ifndef alloca /* predefined by HP cc +Olibcalls */
35 /* Check for the existence of memcpy. */
40 # define memcpy(d, s, n) bcopy ((s), (d), (n))
44 #if defined(FFI_DEBUG)
49 /*@exits@*/ void ffi_assert(/*@temp@*/ char *expr
, /*@temp@*/ char *file
, int line
);
50 void ffi_stop_here(void);
51 void ffi_type_test(/*@temp@*/ /*@out@*/ ffi_type
*a
, /*@temp@*/ char *file
, int line
);
53 #define FFI_ASSERT(x) ((x) ? (void)0 : ffi_assert(#x, __FILE__,__LINE__))
54 #define FFI_ASSERT_AT(x, f, l) ((x) ? 0 : ffi_assert(#x, (f), (l)))
55 #define FFI_ASSERT_VALID_TYPE(x) ffi_type_test (x, __FILE__, __LINE__)
58 #define FFI_ASSERT_AT(x, f, l)
59 #define FFI_ASSERT_VALID_TYPE(x)
62 #define ALIGN(v, a) (((((size_t) (v))-1) | ((a)-1))+1)
63 #define ALIGN_DOWN(v, a) (((size_t) (v)) & -a)
65 /* Perform machine dependent cif processing */
66 ffi_status
ffi_prep_cif_machdep(ffi_cif
*cif
);
68 /* Extended cif, used in callback from assembly routine */
71 /*@dependent@*/ ffi_cif
*cif
;
72 /*@dependent@*/ void *rvalue
;
73 /*@dependent@*/ void **avalue
;
76 /* Terse sized type definitions. */
77 typedef unsigned int UINT8
__attribute__((__mode__(__QI__
)));
78 typedef signed int SINT8
__attribute__((__mode__(__QI__
)));
79 typedef unsigned int UINT16
__attribute__((__mode__(__HI__
)));
80 typedef signed int SINT16
__attribute__((__mode__(__HI__
)));
81 typedef unsigned int UINT32
__attribute__((__mode__(__SI__
)));
82 typedef signed int SINT32
__attribute__((__mode__(__SI__
)));
83 typedef unsigned int UINT64
__attribute__((__mode__(__DI__
)));
84 typedef signed int SINT64
__attribute__((__mode__(__DI__
)));
86 typedef float FLOAT32
;