PageRenderTime 35ms CodeModel.GetById 22ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 0ms

/js/src/ctypes/libffi/include/ffi_common.h

http://github.com/zpao/v8monkey
C Header | 122 lines | 90 code | 18 blank | 14 comment | 2 complexity | 6ac39dc1d5ec4b22e08fbdc45913f9e1 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/* mingw64 defines this already in malloc.h. */
 22#ifndef alloca
 23# define alloca __builtin_alloca
 24#endif
 25# define MAYBE_UNUSED __attribute__((__unused__))
 26#else
 27# define MAYBE_UNUSED
 28# if HAVE_ALLOCA_H
 29#  include <alloca.h>
 30# else
 31#  ifdef _AIX
 32 #pragma alloca
 33#  else
 34#   ifndef alloca /* predefined by HP cc +Olibcalls */
 35#    ifdef _MSC_VER
 36#     define alloca _alloca
 37#    else
 38char *alloca ();
 39#    endif
 40#   endif
 41#  endif
 42# endif
 43#endif
 44
 45/* Check for the existence of memcpy. */
 46#if STDC_HEADERS
 47# include <string.h>
 48#else
 49# ifndef HAVE_MEMCPY
 50#  define memcpy(d, s, n) bcopy ((s), (d), (n))
 51# endif
 52#endif
 53
 54#if defined(FFI_DEBUG)
 55#include <stdio.h>
 56#endif
 57
 58#ifdef FFI_DEBUG
 59void ffi_assert(char *expr, char *file, int line);
 60void ffi_stop_here(void);
 61void ffi_type_test(ffi_type *a, char *file, int line);
 62
 63#define FFI_ASSERT(x) ((x) ? (void)0 : ffi_assert(#x, __FILE__,__LINE__))
 64#define FFI_ASSERT_AT(x, f, l) ((x) ? 0 : ffi_assert(#x, (f), (l)))
 65#define FFI_ASSERT_VALID_TYPE(x) ffi_type_test (x, __FILE__, __LINE__)
 66#else
 67#define FFI_ASSERT(x)
 68#define FFI_ASSERT_AT(x, f, l)
 69#define FFI_ASSERT_VALID_TYPE(x)
 70#endif
 71
 72#define ALIGN(v, a)  (((((size_t) (v))-1) | ((a)-1))+1)
 73#define ALIGN_DOWN(v, a) (((size_t) (v)) & -a)
 74
 75/* Perform machine dependent cif processing */
 76ffi_status ffi_prep_cif_machdep(ffi_cif *cif);
 77
 78/* Extended cif, used in callback from assembly routine */
 79typedef struct
 80{
 81  ffi_cif *cif;
 82  void *rvalue;
 83  void **avalue;
 84} extended_cif;
 85
 86/* Terse sized type definitions.  */
 87#if defined(_MSC_VER) || defined(__sgi)
 88typedef unsigned char UINT8;
 89typedef signed char   SINT8;
 90typedef unsigned short UINT16;
 91typedef signed short   SINT16;
 92typedef unsigned int UINT32;
 93typedef signed int   SINT32;
 94# ifdef _MSC_VER
 95typedef unsigned __int64 UINT64;
 96typedef signed __int64   SINT64;
 97# else
 98# include <inttypes.h>
 99typedef uint64_t UINT64;
100typedef int64_t  SINT64;
101# endif
102#else
103typedef unsigned int UINT8  __attribute__((__mode__(__QI__)));
104typedef signed int   SINT8  __attribute__((__mode__(__QI__)));
105typedef unsigned int UINT16 __attribute__((__mode__(__HI__)));
106typedef signed int   SINT16 __attribute__((__mode__(__HI__)));
107typedef unsigned int UINT32 __attribute__((__mode__(__SI__)));
108typedef signed int   SINT32 __attribute__((__mode__(__SI__)));
109typedef unsigned int UINT64 __attribute__((__mode__(__DI__)));
110typedef signed int   SINT64 __attribute__((__mode__(__DI__)));
111#endif
112
113typedef float FLOAT32;
114
115
116#ifdef __cplusplus
117}
118#endif
119
120#endif
121
122