Author Topic: Language Bindings  (Read 4462 times)

Matthew

  • Douchebag
  • Addicted
  • *
  • Posts: 567
    • View Profile
Language Bindings
« on: December 11, 2007, 10:12:31 pm »
In a discussion "LinuxMCE and Misterhouse" on the Users forum, tschak909 tricked me ;) into volunteering to help produce new language bindings for LMCE scripting in addition to existing Ruby support:

What is the current state of the APIs for making language bindings to LMCE? Where can I find a guide to making a new language binding (generally, not just for LMCE) that will work properly and be recognizable to developers who use them? Preferably a HowTo for binding Perl, which will be the first one I try. If the LMCE API is not in a condition to just add a new Perl language binding, who can help me upgrade it to be ready for that project?

darrenmason

  • Addicted
  • *
  • Posts: 529
    • View Profile
Re: Language Bindings
« Reply #1 on: December 12, 2007, 01:14:29 am »
Matthew,

My first suggestion would be to pull apart GSD and see how that works, don't forget the generation part as that is important.

Also, check through some of the Pluto archives as there was similar discussions at some point in history.
I think bulek was involved in it and I am pretty sure that he has done some Perl integration.

There was also someone attempting to do a Java binding right at the DCE level and this was how text based messages came about inside DCERouter. It seems that nothing much really came of it though - although there was a sourceforge project for it.

Is your intention just to get Command/Events handlers and genrators in Perl?

Regards
Darren

Matthew

  • Douchebag
  • Addicted
  • *
  • Posts: 567
    • View Profile
Re: Language Bindings
« Reply #2 on: December 12, 2007, 03:33:13 am »
My first suggestion would be to pull apart GSD and see how that works, don't forget the generation part as that is important.

Also, check through some of the Pluto archives as there was similar discussions at some point in history.
I think bulek was involved in it and I am pretty sure that he has done some Perl integration.

There was also someone attempting to do a Java binding right at the DCE level and this was how text based messages came about inside DCERouter. It seems that nothing much really came of it though - although there was a sourceforge project for it.

Thanks for the tips.


Is your intention just to get Command/Events handlers and genrators in Perl?

My intention is to add Perl as a language that the GSD can use on exactly the same basis as it currently uses Ruby. So that GSD devices can include practically any Perl script to interface with all of LMCE. I'd like to do that by making sure there's an interface so the next language can be added with the least effort.

Matthew

  • Douchebag
  • Addicted
  • *
  • Posts: 567
    • View Profile
Re: Language Bindings
« Reply #3 on: December 17, 2007, 05:27:00 pm »
I'm looking through the code, but it's sparse, and uncommented (except rarely and cryptically). I'd like to make the GSD code allow calling either Ruby or Perl code with equal power. And I'd like to spend my time making it work, rather than duplicating effort navigating the code that other developers might already have expended, who can just run it down for me (and other developers reading this, who might want to add other languages later).

It seems that Ruby support is included in GSD from in code contained in the Generic_Serial_Device, specifically

RubyCommandWrapper.[cpp,h]
RubyDCECodeSupplier.[cpp,h]
RubyDCEConnector.h
RubyDCEDeviceNode.[cpp,h]
RubyDCEEmbededClass.[cpp,h]
RubyDeviceWrapper.[cpp,h]
RubyEmbededClass.[cpp,h]
RubyEmbeder.[cpp,h]

Is there any other scope in the code that would need explicit support for Perl scripting of GSD?

Does anyone already know the model for embedding the Ruby interpreter? Does a GSD device process start up a Ruby interpreter and pass the script to it via the stack? Or is there a running interpreter that gets scripts piped to it over IO, maybe a socket or some other IPC? And how does the Ruby interpreter get access to the GSD itself (and the rest of LMCE), to change the GSD state (or other device/process states)?