| 1 |
;;;; -*- Mode: lisp; indent-tabs-mode: nil -*- |
| 2 |
;;; |
| 3 |
;;; package.lisp --- Package definition for CFFI. |
| 4 |
;;; |
| 5 |
;;; Copyright (C) 2005-2006, James Bielman <[email protected]> |
| 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 #:cl-user) |
| 29 |
|
| 30 |
(defpackage #:cffi |
| 31 |
(:use #:common-lisp #:cffi-sys #:babel-encodings) |
| 32 |
(:import-from #:alexandria |
| 33 |
#:compose |
| 34 |
#:ensure-list |
| 35 |
#:featurep |
| 36 |
#:format-symbol |
| 37 |
#:hash-table-values |
| 38 |
#:if-let |
| 39 |
#:ignore-some-conditions |
| 40 |
#:lastcar |
| 41 |
#:make-gensym-list |
| 42 |
#:make-keyword |
| 43 |
#:mappend |
| 44 |
#:once-only |
| 45 |
#:parse-body |
| 46 |
#:simple-style-warning |
| 47 |
#:symbolicate |
| 48 |
#:unwind-protect-case |
| 49 |
#:when-let |
| 50 |
#:with-unique-names) |
| 51 |
(:export |
| 52 |
;; Types. |
| 53 |
#:foreign-pointer |
| 54 |
|
| 55 |
;; FIXME: the following types are undocumented. They should |
| 56 |
;; probably be replaced with a proper type introspection API |
| 57 |
;; though. |
| 58 |
#:*built-in-foreign-types* |
| 59 |
#:*other-builtin-types* |
| 60 |
#:*built-in-integer-types* |
| 61 |
#:*built-in-float-types* |
| 62 |
|
| 63 |
;; Primitive pointer operations. |
| 64 |
#:foreign-free |
| 65 |
#:foreign-alloc |
| 66 |
#:mem-aptr |
| 67 |
#:mem-aref |
| 68 |
#:mem-ref |
| 69 |
#:pointerp |
| 70 |
#:pointer-eq |
| 71 |
#:null-pointer |
| 72 |
#:null-pointer-p |
| 73 |
#:inc-pointer |
| 74 |
#:incf-pointer |
| 75 |
#:with-foreign-pointer |
| 76 |
#:make-pointer |
| 77 |
#:pointer-address |
| 78 |
|
| 79 |
;; Shareable vectors. |
| 80 |
#:make-shareable-byte-vector |
| 81 |
#:with-pointer-to-vector-data |
| 82 |
|
| 83 |
;; Foreign string operations. |
| 84 |
#:*default-foreign-encoding* |
| 85 |
#:foreign-string-alloc |
| 86 |
#:foreign-string-free |
| 87 |
#:foreign-string-to-lisp |
| 88 |
#:lisp-string-to-foreign |
| 89 |
#:with-foreign-string |
| 90 |
#:with-foreign-strings |
| 91 |
#:with-foreign-pointer-as-string |
| 92 |
|
| 93 |
;; Foreign array operations. |
| 94 |
;; TODO: document these |
| 95 |
#:foreign-array-alloc |
| 96 |
#:foreign-array-free |
| 97 |
#:foreign-array-to-lisp |
| 98 |
#:lisp-array-to-foreign |
| 99 |
#:with-foreign-array |
| 100 |
#:foreign-aref |
| 101 |
|
| 102 |
;; Foreign function operations. |
| 103 |
#:defcfun |
| 104 |
#:foreign-funcall |
| 105 |
#:foreign-funcall-pointer |
| 106 |
#:foreign-funcall-varargs |
| 107 |
#:foreign-funcall-pointer-varargs |
| 108 |
#:translate-camelcase-name |
| 109 |
#:translate-name-from-foreign |
| 110 |
#:translate-name-to-foreign |
| 111 |
#:translate-underscore-separated-name |
| 112 |
|
| 113 |
;; Foreign library operations. |
| 114 |
#:*foreign-library-directories* |
| 115 |
#:*darwin-framework-directories* |
| 116 |
#:foreign-library |
| 117 |
#:foreign-library-load-state |
| 118 |
#:foreign-library-name |
| 119 |
#:foreign-library-pathname |
| 120 |
#:foreign-library-type |
| 121 |
#:foreign-library-loaded-p |
| 122 |
#:list-foreign-libraries |
| 123 |
#:define-foreign-library |
| 124 |
#:load-foreign-library |
| 125 |
#:load-foreign-library-error |
| 126 |
#:use-foreign-library |
| 127 |
#:close-foreign-library |
| 128 |
#:reload-foreign-libraries |
| 129 |
|
| 130 |
;; Callbacks. |
| 131 |
#:callback |
| 132 |
#:get-callback |
| 133 |
#:defcallback |
| 134 |
|
| 135 |
;; Foreign type operations. |
| 136 |
#:defcstruct |
| 137 |
#:defcunion |
| 138 |
#:defctype |
| 139 |
#:defcenum |
| 140 |
#:defbitfield |
| 141 |
#:define-foreign-type |
| 142 |
#:define-parse-method |
| 143 |
#:define-c-struct-wrapper |
| 144 |
#:foreign-enum-keyword |
| 145 |
#:foreign-enum-keyword-list |
| 146 |
#:foreign-enum-value |
| 147 |
#:foreign-bitfield-symbol-list |
| 148 |
#:foreign-bitfield-symbols |
| 149 |
#:foreign-bitfield-value |
| 150 |
#:foreign-slot-pointer |
| 151 |
#:foreign-slot-value |
| 152 |
#:foreign-slot-type |
| 153 |
#:foreign-slot-offset |
| 154 |
#:foreign-slot-count |
| 155 |
#:foreign-slot-names |
| 156 |
#:foreign-type-alignment |
| 157 |
#:foreign-type-size |
| 158 |
#:with-foreign-object |
| 159 |
#:with-foreign-objects |
| 160 |
#:with-foreign-slots |
| 161 |
#:convert-to-foreign |
| 162 |
#:convert-from-foreign |
| 163 |
#:convert-into-foreign-memory |
| 164 |
#:free-converted-object |
| 165 |
#:translation-forms-for-class |
| 166 |
|
| 167 |
;; Extensible foreign type operations. |
| 168 |
#:define-translation-method ; FIXME: undocumented |
| 169 |
#:translate-to-foreign |
| 170 |
#:translate-from-foreign |
| 171 |
#:translate-into-foreign-memory |
| 172 |
#:free-translated-object |
| 173 |
#:expand-to-foreign-dyn |
| 174 |
#:expand-to-foreign |
| 175 |
#:expand-from-foreign |
| 176 |
#:expand-into-foreign-memory |
| 177 |
|
| 178 |
;; Foreign globals. |
| 179 |
#:defcvar |
| 180 |
#:get-var-pointer |
| 181 |
#:foreign-symbol-pointer |
| 182 |
)) |