Hi!
As some of you might know from my Amsterdam talk or from Bill
Clementson's weblog I'm currently working on a .NET bridge for Common
Lisp[1] called RDNZL. It is now in a quite usable state and before I
release it (it needs some more tweaks and some documentation) I'd like
to test it. So, if you have a Windows machine it'd be very nice if
you could download and try one or both of the following applications:
1. <http://zappa.agharta.de/RDNZL_Eliza.zip>
This is a 2.4MB ZIP archive that includes a file called Eliza.exe
(a Lisp application delivered with Xanalys Lispworks) and two DLLs:
RDNZL.dll is written in Managed C++ and is the glue needed to
connect from Lisp to .NET. ElizaGUI.dll is a Windows Control
Library (written in C# and created with Visual Studio .NET) which
is responsible for drawing the graphical user interface.
If you have the .NET framework[2] installed you should be able to
launch the application by double-clicking Eliza.exe provided all
three files are in the same folder. It's a simple Eliza program
based on Peter Norvig's code[3] from the PAIP book. The Lisp
program loads the GUI DLL and instantiates it. Whenever you enter
text into the small text box on the bottom a Lisp function is
called which generates Eliza's answer and writes it into the large
text box. That's it. Nothing to write home about but it's just a
test...
2. <http://zappa.agharta.de/RDNZL_Eliza_big.zip>
This is a 30.6MB (!) ZIP archive which mainly consists of a Windows
Installer file. The reason this file is so big is that it includes
a redistributable version of the .NET framework as well as a
redistributable version of Microsoft's Text-to-Speech (TTS) engine
- both of these will be installed if necessary and can be easily
removed if you wish so.
The actual Lisp application is the same as above with the added
"benefit" that Eliza's answers are also spoken through your
speakers. For this the Lisp calls into another .NET library called
SpeechLib.dll which interacts with the TTS engine via COM.
SpeechLib.dll was written by Pedro Pinto and is distributed as a
part of the Dot-Scheme[4] project.
If you download and test this stuff please let me know by email (see
the end of this message for my real email address) if it works for you
or if it doesn't. Please, in both cases, include information about
your Windows version and the version of the .NET framework you have
installed.
Note that this is beta software and I can't guarantee for anything.
You might end up with a dead cat if you try it but you'll have the
warm and fuzzy feeling that you tried to help a Lisp open source
project... :)
Thanks in advance for your time,
Edi.
PS: In case you're curious, the Lisp code for the second application
(minus Norvig's Eliza code) looks like this:
(use-package :rdnzl)
(let ((forms-assembly (load-assembly "System.Windows.Forms")))
(import-type "System.Windows.Forms.KeyPressEventHandler" forms-assembly)
(import-type "System.Windows.Forms.Application" forms-assembly)
(import-type "System.Windows.Forms.Form" forms-assembly)
(import-type "System.Windows.Forms.TextBox" forms-assembly)
(import-type "System.Windows.Forms.DockStyle" forms-assembly))
(let ((eliza-assembly (load-assembly "ElizaGUI")))
(import-type "ElizaGUI.MainControl" eliza-assembly))
(import-type "System.Environment")
(use-namespace "System")
(use-namespace "System.Windows.Forms")
(use-namespace "ElizaGUI")
(let ((speech-assembly (load-assembly "SpeechLib")))
(import-type "SpeechLib.SpVoiceClass" speech-assembly)
(import-type "SpeechLib.SpeechVoiceSpeakFlags" speech-assembly))
(use-namespace "SpeechLib")
(defun say (what)
(let ((voice (new "SpVoiceClass")))
(invoke voice "Speak" (format nil
"<voice required=\"Gender=Female\">~A</voice>"
what)
(combine-enums
(field "SpeechVoiceSpeakFlags" "SVSFIsXML")
(field "SpeechVoiceSpeakFlags" "SVSFlagsAsync")))))
(defun run-form ()
(let* ((user-name (property "Environment" "UserName"))
(control (new "MainControl"))
(form (new "Form"))
(list-box (field control "listBox")))
(flet ((reply (object event)
(when (char= (property event "KeyChar") #\Return)
(cast object "TextBox")
(let ((input-string (property object "Text")))
(when (plusp (length input-string))
(let ((reply (eliza-reply input-string)))
(invoke list-box "AppendText" (format nil "~A: ~A~%Eliza: ~A~%"
user-name input-string
reply))
(say reply))
(setf (property object "Text") ""))))))
(setf (property control "Dock") (field "DockStyle" "Fill")
(property form "ClientSize") (property control "ClientSize")
(property form "Text") "RDNZL Eliza")
(invoke (field control "textBox")
"add_KeyPress"
(new "KeyPressEventHandler" #'reply))
(invoke (property form "Controls") "Add" control)
(invoke "Application" "Run" form))))
The code for the first application is the same except for the SAY
function and the SpeechLib stuff. I'll add some reader macrology
before I release RDNZL so finally calls into .NET will look a
little bit neater than
(field control "textBox")
or
(invoke (property form "Controls") "Add" control)
but I think you get the basic idea from this.
RDNZL currently works fully with LispWorks. Corman Lisp is also
supported but there are some GC issues that I haven't resolved
yet. A port to AllegroCL is in the works.
[1] <http://weitz.de/files/RDNZL.pps>
[2] <http://msdn.microsoft.com/netframework/downloads/framework1_1/>
[3] <http://www.norvig.com/paip/eliza.lisp>
[4] <http://www.rivendell.ws/dot-scheme/>
--
Lisp is not dead, it just smells funny.
Real email: (replace (subseq "spamt...@agharta.de" 5) "edi")