Re: python/comedi

bryan cole wrote:
>>module Comedi
>>   class SWIG::TYPE_p_comedi_t
>>     def command_test(*args)
>>       comedi_command_test(self, *args)
>>      end
>>   end
>>end
> 
> How about doing this using the SWIG %rename directive: In the comedi.i
> file include:
> 
> %rename(command_test) comedi_command_test;
> ... and so on for each function ...
> 
> This way swig takes care of the renaming and it works for all wrapping
> languages.

That works for renaming, but it doesn't make the renamed method an 
instance method of SWIG::TYPE_p_comedi_t.

>>I also added some stuff to raise Ruby exceptions. The general idea is to 
>>make the API idiomatic in Ruby, as the original is in C. (The C-like API 
>>is still there in Ruby.)
> 
> SWIG can also do exceptions but I've not investigated this aspect
> further. 

Nor I. I think the right way to do it would be to start with an empty 
interface file and write a custom typemap, with exception handler if 
appropriate, for every comedilib function. It'd be a nice exercise in XP 
(write the tests first, do one function at a time), but I don't think 
I'll have time for it.

For now, the core functionality is there in at least two scripting 
languages.

Steve

Received on 2004-03-25Z06:14:24