diff options
author | Sergio Garcia Murillo <sergio.garcia.murillo@gmail.com> | 2021-11-29 16:12:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-29 16:12:38 +0100 |
commit | 975a36d5a55d69fdd96693e5f8e3f9ac559f70a7 (patch) | |
tree | d3a027a098f0a093f7435770fea91e1a445deb36 /Lib/uffi/uffi.swg | |
parent | 56e7455af91911c06210cf551729df61a428e5a6 (diff) | |
parent | 0304bdb82baaf5da94b6273c93e2623f1522a2a0 (diff) | |
download | swig-975a36d5a55d69fdd96693e5f8e3f9ac559f70a7.tar.gz |
Merge branch 'fix-cast' into master
Diffstat (limited to 'Lib/uffi/uffi.swg')
-rw-r--r-- | Lib/uffi/uffi.swg | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/Lib/uffi/uffi.swg b/Lib/uffi/uffi.swg deleted file mode 100644 index 41b085998..000000000 --- a/Lib/uffi/uffi.swg +++ /dev/null @@ -1,101 +0,0 @@ -/* Define a C preprocessor symbol that can be used in interface files - to distinguish between the SWIG language modules. */ - -#define SWIG_UFFI - -/* Typespecs for basic types. */ - -%typemap(ffitype) char ":char"; -%typemap(ffitype) unsigned char ":unsigned-char"; -%typemap(ffitype) signed char ":char"; -%typemap(ffitype) short ":short"; -%typemap(ffitype) signed short ":short"; -%typemap(ffitype) unsigned short ":unsigned-short"; -%typemap(ffitype) int ":int"; -%typemap(ffitype) signed int ":int"; -%typemap(ffitype) unsigned int ":unsigned-int"; -%typemap(ffitype) long ":long"; -%typemap(ffitype) signed long ":long"; -%typemap(ffitype) unsigned long ":unsigned-long"; -%typemap(ffitype) float ":float"; -%typemap(ffitype) double ":double"; -%typemap(ffitype) char * ":cstring"; -%typemap(ffitype) void * ":pointer-void"; -%typemap(ffitype) void ":void"; - -// FIXME: This is guesswork -typedef long size_t; - -%wrapper %{ -(eval-when (compile eval) - -;;; You can define your own identifier converter if you want. -;;; Use the -identifier-converter command line argument to -;;; specify its name. - -(defun identifier-convert-null (id &key type) - (declare (ignore type)) - (read-from-string id)) - -(defun identifier-convert-lispify (cname &key type) - (assert (stringp cname)) - (if (eq type :constant) - (setf cname (format nil "*~A*" cname))) - (setf cname (replace-regexp cname "_" "-")) - (let ((lastcase :other) - newcase char res) - (dotimes (n (length cname)) - (setf char (schar cname n)) - (if* (alpha-char-p char) - then - (setf newcase (if (upper-case-p char) :upper :lower)) - - (when (or (and (eq lastcase :upper) (eq newcase :lower)) - (and (eq lastcase :lower) (eq newcase :upper))) - ;; case change... add a dash - (push #\- res) - (setf newcase :other)) - - (push (char-downcase char) res) - - (setf lastcase newcase) - - else - (push char res) - (setf lastcase :other))) - (read-from-string (coerce (nreverse res) 'string)))) - -(defun identifier-convert-low-level (cname &key type) - (assert (stringp cname)) - (if (eq type :constant) - (setf cname (format nil "+~A+" cname))) - (setf cname (substitute #\- #\_ cname)) - (if (eq type :operator) - (setf cname (format nil "%~A" cname))) - (if (eq type :constant-function) - nil) - (read-from-string cname)) - - - -(defmacro swig-defconstant (string value &key (export T)) - (let ((symbol (funcall *swig-identifier-converter* string :type :constant))) - `(eval-when (compile load eval) - (uffi:def-constant ,symbol ,value ,export)))) - -(defmacro swig-defun (name &rest rest) - (let ((symbol (funcall *swig-identifier-converter* name :type :operator))) - `(eval-when (compile load eval) - (uffi:def-function (,name ,symbol) ,@rest) - (export (quote ,symbol))))) - -(defmacro swig-def-struct (name &rest fields) - "Declare a struct object" - (let ((symbol (funcall *swig-identifier-converter* name :type :type))) - `(eval-when (compile load eval) - (uffi:def-struct ,symbol ,@fields) - (export (quote ,symbol))))) - - -) ;; eval-when -%} |