2002-09-08 22:31:01 +00:00
|
|
|
|
2016-11-03 12:04:40 +00:00
|
|
|
#ifndef SWIGLUA
|
2003-04-06 18:52:16 +00:00
|
|
|
%module Hamlib
|
2016-11-03 12:04:40 +00:00
|
|
|
#else
|
|
|
|
%module Hamliblua
|
|
|
|
#endif
|
2002-09-08 22:31:01 +00:00
|
|
|
|
|
|
|
%{
|
|
|
|
/*
|
|
|
|
* Hamlib bindings - swig interface file
|
2008-05-04 21:38:25 +00:00
|
|
|
* Copyright (c) 2001-2008 by Stephane Fillod
|
2002-09-08 22:31:01 +00:00
|
|
|
*
|
|
|
|
*
|
2011-08-20 23:22:51 +00:00
|
|
|
* 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.
|
2002-09-08 22:31:01 +00:00
|
|
|
*
|
2011-08-20 23:22:51 +00:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
2002-09-08 22:31:01 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2011-08-20 23:22:51 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2002-09-08 22:31:01 +00:00
|
|
|
*
|
2011-08-20 23:22:51 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2002-09-08 22:31:01 +00:00
|
|
|
* License along with this library; if not, write to the Free Software
|
2011-08-20 23:22:51 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2002-09-08 22:31:01 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <hamlib/rig.h>
|
|
|
|
#include <hamlib/rotator.h>
|
2020-03-14 04:40:32 +00:00
|
|
|
#include <hamlib/amplifier.h>
|
|
|
|
//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"
|
2002-10-07 21:44:51 +00:00
|
|
|
|
|
|
|
#include <limits.h>
|
2016-11-03 12:04:40 +00:00
|
|
|
|
2002-09-08 22:31:01 +00:00
|
|
|
%}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* symbols that won't be wrapped
|
|
|
|
*/
|
|
|
|
%include "ignore.swg"
|
|
|
|
|
2008-05-04 21:38:25 +00:00
|
|
|
%include typemaps.i
|
2018-12-27 21:10:10 +00:00
|
|
|
%include stdint.i
|
2008-05-04 21:38:25 +00:00
|
|
|
%include exception.i
|
2016-11-03 12:04:40 +00:00
|
|
|
#ifndef SWIGLUA
|
2020-03-14 04:40:32 +00:00
|
|
|
#ifndef SWIGJAVA
|
2008-05-04 21:38:25 +00:00
|
|
|
%include cstring.i
|
2016-11-03 12:04:40 +00:00
|
|
|
#endif
|
2020-03-14 04:40:32 +00:00
|
|
|
#endif
|
2011-09-14 20:43:06 +00:00
|
|
|
#ifdef SWIGPYTHON
|
|
|
|
%include python/file.i
|
2016-08-27 19:24:17 +00:00
|
|
|
|
|
|
|
%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;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-11-03 12:04:40 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef SWIGLUA
|
|
|
|
|
|
|
|
%typemap(out) int [ANY] {
|
|
|
|
int len,i;
|
|
|
|
len = $1_dim0;
|
|
|
|
lua_createtable (L, len, 0);
|
|
|
|
for(i=0; i<len; i++) {
|
|
|
|
lua_pushinteger(L, (i+1)); // Lua starts list index with 1
|
|
|
|
lua_pushinteger(L, (lua_Integer)$1[i]);
|
|
|
|
lua_rawset(L, -3);
|
|
|
|
}
|
|
|
|
SWIG_arg++;
|
|
|
|
}
|
|
|
|
|
|
|
|
%typemap(varout) int [ANY] {
|
|
|
|
int len,i;
|
|
|
|
len = $1_dim0;
|
|
|
|
lua_createtable (L, len, 0);
|
|
|
|
for(i=0; i<len; i++) {
|
|
|
|
lua_pushinteger(L, (i+1)); // Lua starts list index with 1
|
|
|
|
lua_pushinteger(L, (lua_Integer)$1[i]);
|
|
|
|
lua_rawset(L, -3);
|
|
|
|
}
|
|
|
|
SWIG_arg++;
|
|
|
|
}
|
|
|
|
|
|
|
|
%typemap(in,numinputs=0) char * OUTPUT (char *returnstr) {
|
|
|
|
char returnstr[1024];
|
|
|
|
$1 = returnstr;
|
|
|
|
}
|
|
|
|
|
|
|
|
%typemap(argout) char * OUTPUT {
|
|
|
|
lua_pushstring(L,(char *)$1); SWIG_arg++;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-09-14 20:43:06 +00:00
|
|
|
#endif
|
2008-05-04 21:38:25 +00:00
|
|
|
|
|
|
|
%apply double *OUTPUT { double *distance, double *azimuth };
|
|
|
|
%apply int *OUTPUT { int *degrees, int *minutes, double *seconds, int *sw };
|
|
|
|
%apply int *OUTPUT { int *degrees, double *minutes, int *sw };
|
|
|
|
%apply double *OUTPUT { double *longitude, double *latitude };
|
2016-11-03 12:04:40 +00:00
|
|
|
|
2020-03-14 04:40:32 +00:00
|
|
|
#ifndef SWIGJAVA
|
|
|
|
// If SWIGJAVA ever maps char * we can enable these
|
2008-05-04 21:38:25 +00:00
|
|
|
%apply char *OUTPUT { char *locator_res };
|
2016-11-03 12:04:40 +00:00
|
|
|
%apply char *OUTPUT { char *hamlib_version2 };
|
|
|
|
%apply char *OUTPUT { char *hamlib_copyright2 };
|
|
|
|
%apply char *OUTPUT { char *returnstr };
|
2020-03-14 04:40:32 +00:00
|
|
|
#endif
|
2008-05-04 21:38:25 +00:00
|
|
|
|
2016-11-03 12:04:40 +00:00
|
|
|
#ifndef SWIGLUA
|
2016-05-20 20:08:10 +00:00
|
|
|
#ifndef SWIG_CSTRING_UNIMPL
|
2020-03-14 04:40:32 +00:00
|
|
|
#ifndef SWIGJAVA
|
2008-05-04 21:38:25 +00:00
|
|
|
/* longlat2locator */
|
2011-08-20 23:22:51 +00:00
|
|
|
%cstring_bounded_output(char *locator_res, 13)
|
2016-11-03 12:04:40 +00:00
|
|
|
%cstring_bounded_output(char *hamlib_version2, 4)
|
|
|
|
%cstring_bounded_output(char *hamlib_copyright2, 4)
|
|
|
|
#endif
|
2016-05-20 20:08:10 +00:00
|
|
|
#endif
|
2020-03-14 04:40:32 +00:00
|
|
|
#endif
|
2008-05-04 21:38:25 +00:00
|
|
|
|
2014-02-03 21:38:48 +00:00
|
|
|
%immutable confparams::name;
|
|
|
|
%immutable confparams::label;
|
|
|
|
%immutable confparams::tooltip;
|
|
|
|
%immutable confparams::dflt;
|
|
|
|
%immutable cs;
|
|
|
|
%immutable rig_caps::model_name;
|
|
|
|
%immutable rig_caps::mfg_name;
|
|
|
|
%immutable rig_caps::version;
|
|
|
|
%immutable rig_caps::copyright;
|
2016-11-03 12:04:40 +00:00
|
|
|
%immutable hamlib_version2;
|
|
|
|
%immutable hamlib_copyright2;
|
2014-02-03 21:38:48 +00:00
|
|
|
|
|
|
|
%immutable clone_combo_set;
|
|
|
|
%immutable clone_combo_get;
|
|
|
|
|
|
|
|
%immutable rot_caps::model_name;
|
|
|
|
%immutable rot_caps::mfg_name;
|
|
|
|
%immutable rot_caps::version;
|
|
|
|
%immutable rot_caps::copyright;
|
2002-10-08 21:54:58 +00:00
|
|
|
|
2002-09-08 22:31:01 +00:00
|
|
|
%include <hamlib/rig_dll.h>
|
|
|
|
|
|
|
|
%include <hamlib/riglist.h>
|
|
|
|
%include <hamlib/rig.h>
|
|
|
|
|
|
|
|
%include <hamlib/rotlist.h>
|
|
|
|
%include <hamlib/rotator.h>
|
|
|
|
|
2016-05-20 20:46:23 +00:00
|
|
|
%inline {
|
|
|
|
typedef const char * const_char_string;
|
|
|
|
}
|
|
|
|
|
2002-09-08 22:31:01 +00:00
|
|
|
/*
|
|
|
|
* The Rig "class"
|
|
|
|
*/
|
|
|
|
%include "rig.swg"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The Rot "class"
|
|
|
|
*/
|
|
|
|
%include "rotator.swg"
|
|
|
|
|
2020-03-14 13:46:28 +00:00
|
|
|
/*
|
|
|
|
* The Amp "class"
|
|
|
|
*/
|
|
|
|
%include "amplifier.swg"
|
|
|
|
|
2002-09-08 22:31:01 +00:00
|
|
|
/*
|
|
|
|
* Put binding specific code in separate files
|
|
|
|
*
|
|
|
|
%include "perl.i"
|
|
|
|
%include "tcl.i"
|
|
|
|
%include "python.i"
|
|
|
|
%include "whatever.i"
|
|
|
|
*/
|