libffi-types.lisp - clic - Clic is an command line interactive client for gophe… | |
git clone git://bitreich.org/clic/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
LICENSE | |
--- | |
libffi-types.lisp (3450B) | |
--- | |
1 ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*- | |
2 ;;; | |
3 ;;; libffi-types.lisp -- CFFI-Grovel definitions for libffi | |
4 ;;; | |
5 ;;; Copyright (C) 2009, 2010, 2011, 2017 Liam M. Healy <lhealy@common-l… | |
6 ;;; | |
7 ;;; Permission is hereby granted, free of charge, to any person | |
8 ;;; obtaining a copy of this software and associated documentation | |
9 ;;; files (the "Software"), to deal in the Software without | |
10 ;;; restriction, including without limitation the rights to use, copy, | |
11 ;;; modify, merge, publish, distribute, sublicense, and/or sell copies | |
12 ;;; of the Software, and to permit persons to whom the Software is | |
13 ;;; furnished to do so, subject to the following conditions: | |
14 ;;; | |
15 ;;; The above copyright notice and this permission notice shall be | |
16 ;;; included in all copies or substantial portions of the Software. | |
17 ;;; | |
18 ;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
19 ;;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
20 ;;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
21 ;;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | |
22 ;;; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | |
23 ;;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
24 ;;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |
25 ;;; DEALINGS IN THE SOFTWARE. | |
26 ;;; | |
27 | |
28 (in-package #:cffi) | |
29 | |
30 #+linux | |
31 (define "_GNU_SOURCE") | |
32 | |
33 ;; When installed through Mac Ports, libffi include files | |
34 ;; will be found in /opt/local/include. | |
35 #+darwin | |
36 (cc-flags "-I/opt/local/include/") | |
37 | |
38 #+openbsd | |
39 (cc-flags "-I/usr/local/include") | |
40 | |
41 #+freebsd | |
42 (cc-flags "-I/usr/local/include") | |
43 | |
44 (pkg-config-cflags "libffi" :optional t) | |
45 | |
46 #+darwin | |
47 (include "ffi/ffi.h") | |
48 #-darwin | |
49 (include "ffi.h") | |
50 | |
51 (cenum status | |
52 ((:ok "FFI_OK")) | |
53 ((:bad-typedef "FFI_BAD_TYPEDEF")) | |
54 ((:bad-abi "FFI_BAD_ABI"))) | |
55 | |
56 #+freebsd | |
57 (cenum abi | |
58 ((:default-abi "FFI_DEFAULT_ABI"))) | |
59 | |
60 #+(and windows x86-64) | |
61 (cenum abi | |
62 ((:default-abi "FFI_DEFAULT_ABI")) | |
63 ((:win64 "FFI_WIN64"))) | |
64 | |
65 #+(and windows (not x86-64)) | |
66 (cenum abi | |
67 ((:default-abi "FFI_DEFAULT_ABI")) | |
68 ((:sysv "FFI_SYSV")) | |
69 ((:stdcall "FFI_STDCALL"))) | |
70 | |
71 #-(or freebsd windows) | |
72 (cenum abi | |
73 ((:default-abi "FFI_DEFAULT_ABI")) | |
74 #-x86-64 | |
75 ((:sysv "FFI_SYSV")) | |
76 ((:unix64 "FFI_UNIX64"))) | |
77 | |
78 (ctype ffi-abi "ffi_abi") | |
79 | |
80 (ctype size-t "size_t") | |
81 | |
82 (cstruct ffi-type "struct _ffi_type" | |
83 (size "size" :type size-t) | |
84 (alignment "alignment" :type :unsigned-short) | |
85 (type "type" :type :unsigned-short) | |
86 (elements "elements" :type :pointer)) | |
87 | |
88 (cstruct ffi-cif "ffi_cif" | |
89 (abi "abi" :type ffi-abi) | |
90 (argument-count "nargs" :type :unsigned-int) | |
91 (argument-types "arg_types" :type :pointer) | |
92 (return-type "rtype" :type :pointer) | |
93 (bytes "bytes" :type :unsigned-int) | |
94 (flags "flags" :type :unsigned-int)) | |
95 | |
96 (constant (+type-void+ "FFI_TYPE_VOID")) | |
97 (constant (+type-int+ "FFI_TYPE_INT")) | |
98 (constant (+type-float+ "FFI_TYPE_FLOAT")) | |
99 (constant (+type-double+ "FFI_TYPE_DOUBLE")) | |
100 (constant (+type-longdouble+ "FFI_TYPE_LONGDOUBLE")) | |
101 (constant (+type-uint8+ "FFI_TYPE_UINT8")) | |
102 (constant (+type-sint8+ "FFI_TYPE_SINT8")) | |
103 (constant (+type-uint16+ "FFI_TYPE_UINT16")) | |
104 (constant (+type-sint16+ "FFI_TYPE_SINT16")) | |
105 (constant (+type-uint32+ "FFI_TYPE_UINT32")) | |
106 (constant (+type-sint32+ "FFI_TYPE_SINT32")) | |
107 (constant (+type-uint64+ "FFI_TYPE_UINT64")) | |
108 (constant (+type-sint64+ "FFI_TYPE_SINT64")) | |
109 (constant (+type-struct+ "FFI_TYPE_STRUCT")) | |
110 (constant (+type-pointer+ "FFI_TYPE_POINTER")) |