1 | /* -----------------------------------------------------------------------
|
---|
2 | ffi_common.h - Copyright (c) 1996 Cygnus Solutions
|
---|
3 |
|
---|
4 | $Id: ffi_common.h,v 1.1 1999/08/08 22:58:30 green Exp $
|
---|
5 |
|
---|
6 | Common internal definitions and macros. Only necessary for building
|
---|
7 | libffi.
|
---|
8 | ----------------------------------------------------------------------- */
|
---|
9 |
|
---|
10 | #ifndef FFI_COMMON_H
|
---|
11 | #define FFI_COMMON_H
|
---|
12 |
|
---|
13 | #ifdef __cplusplus
|
---|
14 | extern "C" {
|
---|
15 | #endif
|
---|
16 |
|
---|
17 | /* Do not move this. Some versions of AIX are very picky about where
|
---|
18 | this is positioned. */
|
---|
19 | #ifdef __GNUC__
|
---|
20 | # define alloca __builtin_alloca
|
---|
21 | #else
|
---|
22 | # if HAVE_ALLOCA_H
|
---|
23 | # include <alloca.h>
|
---|
24 | # else
|
---|
25 | # ifdef _AIX
|
---|
26 | #pragma alloca
|
---|
27 | # else
|
---|
28 | # ifndef alloca /* predefined by HP cc +Olibcalls */
|
---|
29 | char *alloca ();
|
---|
30 | # endif
|
---|
31 | # endif
|
---|
32 | # endif
|
---|
33 | #endif
|
---|
34 |
|
---|
35 | /* Check for the existence of memcpy. */
|
---|
36 | #if STDC_HEADERS
|
---|
37 | # include <string.h>
|
---|
38 | #else
|
---|
39 | # ifndef HAVE_MEMCPY
|
---|
40 | # define memcpy(d, s, n) bcopy ((s), (d), (n))
|
---|
41 | # endif
|
---|
42 | #endif
|
---|
43 |
|
---|
44 | #ifndef FALSE
|
---|
45 | #define FALSE 0
|
---|
46 | #endif
|
---|
47 |
|
---|
48 | #ifndef TRUE
|
---|
49 | #define TRUE (!FALSE)
|
---|
50 | #endif
|
---|
51 |
|
---|
52 | #ifndef __cplusplus
|
---|
53 | /* bool is a keyword in C++ */
|
---|
54 | /*@-cppnames@*/
|
---|
55 | typedef int bool;
|
---|
56 | /*@=cppnames@*/
|
---|
57 | #endif
|
---|
58 |
|
---|
59 | #ifdef FFI_DEBUG
|
---|
60 |
|
---|
61 | /* Debugging functions */
|
---|
62 | /*@exits@*/ int ffi_assert(/*@temp@*/ char *file, int line);
|
---|
63 | void ffi_stop_here(void);
|
---|
64 | bool ffi_type_test(/*@temp@*/ /*@out@*/ ffi_type *a);
|
---|
65 |
|
---|
66 | #define FFI_ASSERT(x) ((x) ? 0 : ffi_assert(__FILE__,__LINE__))
|
---|
67 |
|
---|
68 | #else
|
---|
69 |
|
---|
70 | #define FFI_ASSERT(x)
|
---|
71 |
|
---|
72 | #endif
|
---|
73 |
|
---|
74 | /* Perform machine dependent cif processing */
|
---|
75 | ffi_status ffi_prep_cif_machdep(ffi_cif *cif);
|
---|
76 |
|
---|
77 | /* Extended cif, used in callback from assembly routine */
|
---|
78 | typedef struct
|
---|
79 | {
|
---|
80 | /*@dependent@*/ ffi_cif *cif;
|
---|
81 | /*@dependent@*/ void *rvalue;
|
---|
82 | /*@dependent@*/ void **avalue;
|
---|
83 | } extended_cif;
|
---|
84 |
|
---|
85 | #ifdef __cplusplus
|
---|
86 | }
|
---|
87 | #endif
|
---|
88 |
|
---|
89 | #endif
|
---|
90 |
|
---|
91 |
|
---|