comedilib/swig/comedi.i
W. Trevor King 1fe137aa24 Add an insn_array array_class to comedi.i.
This makes it possible to populate `comedi_insnslist_struct` for use
with `comedi_do_insnlist`.

I also removed my earlier re-typedefs of `sampl_array` and
`lsampl_array`.  I didn't understand the reason for the underlying
`TypeError` when I added them.  The proper way to avoid that error is
to use the `.cast()` and `.frompointer()` methods.  See
`demo/python/insn.py` (coming soon) for details.
2012-03-13 08:31:36 -04:00

70 lines
2.3 KiB
OpenEdge ABL

/***********************************************************
Interface file for wrapping Comedilib
Copyright (C) 2003 Bryan Cole <bryan.cole@teraview.co.uk>
Copyright (C) 1998-2002 David A. Schleef <ds@schleef.org>
Copyright (C) 2003,2004 Frank Mori Hess <fmhess@users.sourceforge.net>
Copyright (C) 2003 Steven Jenkins <steven.jenkins@ieee.org>
This program 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 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
***********************************************************
*
* This file was created with Python wrappers in mind but wil
* probably work for other swig-supported script languages
*
* to regenerate the wrappers run:
* swig -python comedi.i
*
***********************************************************/
%module comedi
#define SWIG_USE_OLD_TYPEMAPS
%{
#include "comedilib.h"
%}
%include "carrays.i"
%include "typemaps.i"
%inline %{
static unsigned int cr_pack(unsigned int chan, unsigned int rng, unsigned int aref){
return CR_PACK(chan,rng,aref);
}
static unsigned int cr_pack_flags(unsigned int chan, unsigned int rng, unsigned int aref, unsigned int flags){
return CR_PACK_FLAGS(chan,rng,aref, flags);
}
static unsigned int cr_chan(unsigned int a){
return CR_CHAN(a);
}
static unsigned int cr_range(unsigned int a){
return CR_RANGE(a);
}
static unsigned int cr_aref(unsigned int a){
return CR_AREF(a);
}
%}
#ifdef SWIGRUBY
%typemap(argout) comedi_cmd *INOUT(VALUE info) {
$result = output_helper($result, $arg);
};
#endif
%include "comedi.h"
%include "comedilib.h"
%array_class(unsigned int, chanlist);
%array_class(sampl_t, sampl_array);
%array_class(lsampl_t, lsampl_array);
%array_class(comedi_insn, insn_array);