interface protocols for erlang

John Gibbons writes:
> Hi,
>
> I want to interface a Lisp system to Erlang and there appear to be two ways to do this. I can invent my own local protocol over TCP/IP for the specific task and implement that in both Erlang and Lisp, or I can use the existing Erlang approach as has been done with Java/Jive.
>
> I would prefer the latter but I can't seem to find any documentation of these protocols. Can someone point me to documentation on these protocols?
Well, first of all, the "jive protocol" merely consist of a way to
pack and unpack erlang data structures, nothing much of it.
As for exchanging arbitrary data structures back and forth between
two different systems, it is indeed possible to write an
marshalling interpreter the way they have done in jive.
There is (to my knowledge) no documentation on the jive internal
marshalling stuff, it's naive and the code is simple.
So I suggest you either invent your own protocol/pack/unpack
routines or make use of orber (The corba implementation) assuming
you have a Corba implementation in your lisp system ??
Take a look at the pack/1 routine in jive.erl and you'll
see that this is no big deal.
Furthermore, if speed is an issue, it's not very efficient to
have marshalling routines that interpret the way they have done
it in jive.
If marshalling is your main problem, maybe the erl_interface
libraries could be an option. Erlang has builtin support to
marshall and unmarshall erlang terms by means of the
two BIF's term_to_binary/1 and binary_to_term/1
1> X = {funky, stuff}.
{funky,stuff}
2> B = term_to_binary(X).
#Bin
3> binary_to_list(B).
[131,104,2,100,0,5,102,117,110,107,121,100,0,5,115,116,117,102,102]
4> binary_to_term(B).
{funky,stuff}
5>
The format produced by term_to_binary/1 can be read in (c-code)
by routines in the erl_interface lib. So if you can somehow
link erl_interface.a into your lisp system, you could send any erlang
term on the socket by means of
gen_tcp:send(Socket, term_to_binary(AnyTerm))
Docs and source of erl_interface is available at www.erlang.org
/klacke