Dear Stewart, You can find some code using the Oz compiler from within Emacs Lisp as part of the Emacs org mode sources online at http://orgmode.org/w/?p=org-mode.git;a=blob_plain;f=contrib/scripts/StartOzServer.oz;hb=HEAD or in the source tree at contrib/scripts/StartOzServer.oz. I did some documenting comments, but if you have any questions about this just ask. (Note that there is some subtle bug, see last paragraph of http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-oz.html. However, this bug is likely on the Emacs Lisp side).
The other approach I mentioned is as follows. You define a data structure (I used a dictionary) that links atoms (symbols) to procedures. Whenever a message is received (I used a socket for communicating), then the matching procedure is called. This approach can be generalised with argument support as follows. You send stings representing nested data (e.g., strings with Oz records), parse these (e.g., with the parser generator Gump, http://www.mozart-oz.org/documentation/gump/index.html), then use the record label to access the procedure associated with that label from the mentioned data structure and call it with the parsed record. I implemented this approach in the OSC (Open Sound Control) interface of my software Strasheela (sending and parsing OSC messages). See online at http://strasheela.svn.sourceforge.net/viewvc/strasheela/trunk/strasheela/contributions/anders/OSC/?pathrev=2312 or in the source tree at strasheela/contributions/anders/OSC/). Unfortunately, on recent Macs Gumps seems to be broken. Quite possibly, the error is another case of the 64bit platform issue, as I never had such problem before trying to compile it on my latest Macbook with MacOS 10.6. When you try to compile Gump code (e.g. the mentioned OSC interface of Strasheela, but I tried it with other Gump code as well) on such a machine it results in an error like the one I posted after this message. I should really file a bug report for this problem. I probably should not release any new Strasheela version (even though I already finished a lot of changes) before Gump is working again. Unfortunately I cannot fix that myself, because I am not "speaking" C++ :-/ Should I file bug reports to the list of issues at the Mozart github (https://github.com/mozart/mozart/issues?sort=created&direction=desc&state=closed) or is there a better place I did not find. Thanks! Best, Torsten ==== Begin error message ==== cd $StrasheelaDir/contributions/./anders/OSC; ozmake --upgrade ozc -c OSC_Scanner.oz -o OSC_Scanner.ozf In file included from /Applications/Mozart/Mozart.app/Contents/Resources//include/lexer.h:26, from OSC_Scanner.l:29: /Applications/Mozart/Mozart.app/Contents/Resources//include/mozart.h: In member function ‘void OZ_Container::cacMark(OZ_Container*)’: /Applications/Mozart/Mozart.app/Contents/Resources//include/mozart.h:731: error: cast from ‘OZ_Container*’ to ‘unsigned int’ loses precision In file included from OSC_Scanner.l:29: /Applications/Mozart/Mozart.app/Contents/Resources//include/lexer.h: In function ‘OZ_Return zy_lexer_delete(OZ_Term**)’: /Applications/Mozart/Mozart.app/Contents/Resources//include/lexer.h:59: warning: deprecated conversion from string constant to ‘char*’ /Applications/Mozart/Mozart.app/Contents/Resources//include/lexer.h: In function ‘OZ_Return zy_lexer_getNextMatch(OZ_Term**)’: /Applications/Mozart/Mozart.app/Contents/Resources//include/lexer.h:67: warning: deprecated conversion from string constant to ‘char*’ /Applications/Mozart/Mozart.app/Contents/Resources//include/lexer.h:72: warning: deprecated conversion from string constant to ‘char*’ /Applications/Mozart/Mozart.app/Contents/Resources//include/lexer.h: In function ‘OZ_Return zy_lexer_getAtom(OZ_Term**)’: /Applications/Mozart/Mozart.app/Contents/Resources//include/lexer.h:81: warning: deprecated conversion from string constant to ‘char*’ /Applications/Mozart/Mozart.app/Contents/Resources//include/lexer.h: In function ‘OZ_Return zy_lexer_getString(OZ_Term**)’: /Applications/Mozart/Mozart.app/Contents/Resources//include/lexer.h:90: warning: deprecated conversion from string constant to ‘char*’ /Applications/Mozart/Mozart.app/Contents/Resources//include/lexer.h: In function ‘OZ_Return zy_lexer_getLength(OZ_Term**)’: /Applications/Mozart/Mozart.app/Contents/Resources//include/lexer.h:103: warning: deprecated conversion from string constant to ‘char*’ /Applications/Mozart/Mozart.app/Contents/Resources//include/lexer.h: In function ‘OZ_Return zy_lexer_switchToBuffer(OZ_Term**)’: /Applications/Mozart/Mozart.app/Contents/Resources//include/lexer.h:110: warning: deprecated conversion from string constant to ‘char*’ /Applications/Mozart/Mozart.app/Contents/Resources//include/lexer.h:111: warning: deprecated conversion from string constant to ‘char*’ /Applications/Mozart/Mozart.app/Contents/Resources//include/lexer.h: In function ‘OZ_Return zy_lexer_setMode(OZ_Term**)’: /Applications/Mozart/Mozart.app/Contents/Resources//include/lexer.h:119: warning: deprecated conversion from string constant to ‘char*’ /Applications/Mozart/Mozart.app/Contents/Resources//include/lexer.h:120: warning: deprecated conversion from string constant to ‘char*’ /Applications/Mozart/Mozart.app/Contents/Resources//include/lexer.h: In function ‘OZ_Return zy_lexer_currentMode(OZ_Term**)’: /Applications/Mozart/Mozart.app/Contents/Resources//include/lexer.h:128: warning: deprecated conversion from string constant to ‘char*’ /Applications/Mozart/Mozart.app/Contents/Resources//include/lexer.h: In function ‘OZ_Return zy_lexer_input(OZ_Term**)’: /Applications/Mozart/Mozart.app/Contents/Resources//include/lexer.h:135: warning: deprecated conversion from string constant to ‘char*’ Mozart Compiler 1.4.0 (20080703) playing Oz 3 %%% feeding file /Users/torsten/oz/music/Strasheela/strasheela/trunk/strasheela/contributions/anders/OSC/source/OSC_Scanner.oz %************************** system error ************************ %** %** invocation of oztool failed %** %** Command: oztool c++ -c OSC_Scanner.C -o OSC_Scanner.o %** Exit code: 256 %** ------------------ rejected (1 error) %********************** ozmake [build] error ******************** %** %** there were errors during compilation %** %**-------------------------------------------------------------- ==== End error message ====== On 21 Jul 2011, at 12:21, stewart mackenzie wrote: > Hi Torsten, > > I am greatly interested in those code snippets. These solutions sound > perfect for my usage. > > Thank you so much. > > Stewart > > On Thu, Jul 21, 2011 at 7:07 PM, Torsten Anders > <torsten.and...@plymouth.ac.uk> wrote: >> Dear Stewart, >> >> On 20 Jul 2011, at 17:03, stewart mackenzie wrote: >>> We need to get erlang to call mozart oz and visa versa. >> >> >> I have no experience with Erlang whatsoever. However, I called Mozart from >> other languages, e.g., Emacs Lisp, Max/MSP, and SuperCollider. Are you aware >> that you have standard sockets in Mozart >> (http://www.mozart-oz.org/documentation/system/node55.html) and that you can >> instantiate a full Mozart compiler which you can feed strings of arbitrary >> Oz code received from the outside (with concurrent execution of received >> code snippets, if you wish). For example., you could create Oz code in >> Erlang and then it over for execution. >> >> If you do not want a full Mozart compiler, e.g., for security reasons, you >> could program some interface with, e.g., on receipt of certain strings >> executes certain programs. >> >> I have flying around code snippets for either approach, if that would >> interest you. >> >> Best, >> Torsten >> >> >> On 20 Jul 2011, at 17:03, stewart mackenzie wrote: >> >>> Hi all. >>> >>> We need to get erlang to call mozart oz and visa versa. >>> >>> Can anyone with experience please drop a hint on how to do it? >>> >>> Kind regards >>> Stewart >>> _________________________________________________________________________________ >>> mozart-hackers mailing list >>> mozart-hack...@mozart-oz.org >>> http://www.mozart-oz.org/mailman/listinfo/mozart-hackers >> >> >> -- >> Dr Torsten Anders >> Course Leader, Music Technology >> University of Bedfordshire >> Park Square, Room A315 >> http://strasheela.sourceforge.net >> http://www.torsten-anders.de >> >> >> >> >> >> >> _________________________________________________________________________________ >> mozart-users mailing list >> mozart-users@mozart-oz.org >> http://www.mozart-oz.org/mailman/listinfo/mozart-users >> > _________________________________________________________________________________ > mozart-users mailing list > mozart-users@mozart-oz.org > http://www.mozart-oz.org/mailman/listinfo/mozart-users Best wishes, Torsten -- Dr Torsten Anders Course Leader, Music Technology University of Bedfordshire Park Square, Room A315 http://strasheela.sourceforge.net http://www.torsten-anders.de _________________________________________________________________________________ mozart-users mailing list mozart-users@mozart-oz.org http://www.mozart-oz.org/mailman/listinfo/mozart-users