#ifndef SWIGLUA %module Hamlib #else %module Hamliblua #endif %{ /* * Hamlib bindings - swig interface file * Copyright (c) 2001-2008 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include #include #include #include //mdblack98 -- Commented this out -- is anybody using the functions in misc.h? //If so, then those functions should be moved to rig.h //#include "misc.h" #include %} /* * symbols that won't be wrapped */ %include "ignore.swg" %include typemaps.i %include stdint.i %include exception.i #ifndef SWIGLUA #ifndef SWIGJAVA %include cstring.i #endif #endif #ifdef SWIGPYTHON %include python/file.i %typemap(out) int [ANY] { int len,i; len = $1_dim0; $result = PyList_New(len); for (i = 0; i < len; i++) { PyList_SetItem($result,i,PyInt_FromLong((long)$1[i])); } } %typemap(varout) int [ANY] { int len,i; len = $1_dim0; $result = PyList_New(len); for (i = 0; i < len; i++) { PyList_SetItem($result,i,PyInt_FromLong((long)$1[i])); } } #endif #ifdef SWIGPERL %typemap(out) int [ANY] { AV * av = newAV(); int i = 0,len = 0; len = $1_dim0; for (i = 0; i < len ; i++) { SV* perlval = newSV(0); sv_setiv(perlval, (IV)$1[i]); av_push(av, perlval); } $result = newRV_noinc((SV *)av); sv_2mortal( $result ); argvi++; } %typemap(argout) int [ANY] { AV * av = newAV(); int i = 0,len = 0; len = $1_dim0; for (i = 0; i < len ; i++) { SV* perlval = newSV(0); sv_setiv(perlval, (IV)$1[i]); av_push(av, perlval); } $result = newRV_noinc((SV *)av); sv_2mortal( $result ); argvi++; } #endif #ifdef SWIGTCL %typemap(out) int [ANY] { int i, len, l; len = $1_dim0; Tcl_Obj * list = Tcl_NewListObj(len, NULL); for(i=0; i < len; i++) { Tcl_ListObjAppendElement(interp, list, Tcl_NewIntObj($1[i])); } Tcl_SetObjResult(interp, list); } %typemap(varout) int [ANY] { int i, len, l; len = $1_dim0; Tcl_Obj * list = Tcl_NewListObj(len, NULL); for(i=0; i < len; i++) { Tcl_ListObjAppendElement(interp, list, Tcl_NewIntObj($1[i])); } $result = list; } #endif #ifdef SWIGLUA %typemap(out) int [ANY] { int len,i; len = $1_dim0; lua_createtable (L, len, 0); for(i=0; i %include %include %include %include %inline { typedef const char * const_char_string; } /* * The Rig "class" */ %include "rig.swg" /* * The Rot "class" */ %include "rotator.swg" /* * The Amp "class" */ %include "amplifier.swg" /* * Put binding specific code in separate files * %include "perl.i" %include "tcl.i" %include "python.i" %include "whatever.i" */