Back to index

plt-scheme  4.2.1
ffi_common.h
Go to the documentation of this file.
00001 /* -----------------------------------------------------------------------
00002    ffi_common.h - Copyright (c) 1996  Red Hat, Inc.
00003    Copyright (C) 2007 Free Software Foundation, Inc
00004 
00005    Common internal definitions and macros. Only necessary for building
00006    libffi.
00007    ----------------------------------------------------------------------- */
00008 
00009 #ifndef FFI_COMMON_H
00010 #define FFI_COMMON_H
00011 
00012 #ifdef __cplusplus
00013 extern "C" {
00014 #endif
00015 
00016 #include <fficonfig.h>
00017 
00018 /* Do not move this. Some versions of AIX are very picky about where
00019    this is positioned. */
00020 #ifdef __GNUC__
00021 # define alloca __builtin_alloca
00022 # define MAYBE_UNUSED __attribute__((__unused__))
00023 #else
00024 # define MAYBE_UNUSED
00025 # if HAVE_ALLOCA_H
00026 #  include <alloca.h>
00027 # else
00028 #  ifdef _AIX
00029  #pragma alloca
00030 #  else
00031 #   ifndef alloca /* predefined by HP cc +Olibcalls */
00032 char *alloca ();
00033 #   endif
00034 #  endif
00035 # endif
00036 #endif
00037 
00038 /* Check for the existence of memcpy. */
00039 #if STDC_HEADERS
00040 # include <string.h>
00041 #else
00042 # ifndef HAVE_MEMCPY
00043 #  define memcpy(d, s, n) bcopy ((s), (d), (n))
00044 # endif
00045 #endif
00046 
00047 #if defined(FFI_DEBUG)
00048 #include <stdio.h>
00049 #endif
00050 
00051 #ifdef FFI_DEBUG
00052 void ffi_assert(char *expr, char *file, int line);
00053 void ffi_stop_here(void);
00054 void ffi_type_test(ffi_type *a, char *file, int line);
00055 
00056 #define FFI_ASSERT(x) ((x) ? (void)0 : ffi_assert(#x, __FILE__,__LINE__))
00057 #define FFI_ASSERT_AT(x, f, l) ((x) ? 0 : ffi_assert(#x, (f), (l)))
00058 #define FFI_ASSERT_VALID_TYPE(x) ffi_type_test (x, __FILE__, __LINE__)
00059 #else
00060 #define FFI_ASSERT(x)
00061 #define FFI_ASSERT_AT(x, f, l)
00062 #define FFI_ASSERT_VALID_TYPE(x)
00063 #endif
00064 
00065 #define ALIGN(v, a)  (((((size_t) (v))-1) | ((a)-1))+1)
00066 #define ALIGN_DOWN(v, a) (((size_t) (v)) & -a)
00067 
00068 /* Perform machine dependent cif processing */
00069 ffi_status ffi_prep_cif_machdep(ffi_cif *cif);
00070 
00071 /* Extended cif, used in callback from assembly routine */
00072 typedef struct
00073 {
00074   ffi_cif *cif;
00075   void *rvalue;
00076   void **avalue;
00077 } extended_cif;
00078 
00079 /* Terse sized type definitions.  */
00080 typedef unsigned int UINT8  __attribute__((__mode__(__QI__)));
00081 typedef signed int   SINT8  __attribute__((__mode__(__QI__)));
00082 typedef unsigned int UINT16 __attribute__((__mode__(__HI__)));
00083 typedef signed int   SINT16 __attribute__((__mode__(__HI__)));
00084 typedef unsigned int UINT32 __attribute__((__mode__(__SI__)));
00085 typedef signed int   SINT32 __attribute__((__mode__(__SI__)));
00086 typedef unsigned int UINT64 __attribute__((__mode__(__DI__)));
00087 typedef signed int   SINT64 __attribute__((__mode__(__DI__)));
00088 
00089 typedef float FLOAT32;
00090 
00091 
00092 #ifdef __cplusplus
00093 }
00094 #endif
00095 
00096 #endif
00097 
00098