From dafc4dbdfc0a83757b8561dff4bca75250f3eb5c Mon Sep 17 00:00:00 2001 From: Surendra Singhi Date: Sat, 28 Jan 2006 14:07:54 +0000 Subject: [PATCH] Frank Buss's fix for anon enums. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8593 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Lib/cffi/cffi.swg | 14 ++++++++++++++ Source/Modules/cffi.cxx | 37 ++++++++++++++++++++++++++----------- 2 files changed, 40 insertions(+), 11 deletions(-) diff --git a/Lib/cffi/cffi.swg b/Lib/cffi/cffi.swg index 102430a23..c6fb29cf7 100644 --- a/Lib/cffi/cffi.swg +++ b/Lib/cffi/cffi.swg @@ -95,3 +95,17 @@ #include %} + +%insert("lisphead") %{ +;;;SWIG wrapper code starts here + +(defmacro defanonenum (&body enums) + "Converts anonymous enums to defconstants." + `(progn ,@(loop for value in enums + for index = 0 then (1+ index) + when (listp value) do (setf index (second value) + value (first value)) + collect `(defconstant ,value ,index)))) + +;;;SWIG wrapper code ends here +%} diff --git a/Source/Modules/cffi.cxx b/Source/Modules/cffi.cxx index 9ef36564e..8b736f914 100644 --- a/Source/Modules/cffi.cxx +++ b/Source/Modules/cffi.cxx @@ -20,7 +20,7 @@ public: File *f_cl; String *f_clhead; String *f_clwrap; - + bool CWrap; // generate wrapper file for C code? File *f_cxx; File *f_cxx_header; File *f_cxx_wrapper; @@ -59,7 +59,7 @@ void CFFI :: main(int argc, char *argv[]) { SWIG_config_file("cffi.swg"); generate_typedef_flag = 0; extern_all_flag=0; - + CWrap = false; for(i=1; i