experiences when changing from 6.22 to 7.5

Q&A's, tips, howto's
Locked
stellan
Posts: 2
Joined: Sun Mar 21, 2004 11:49 am
Location: Stockholm
Contact:

experiences when changing from 6.22 to 7.5

Post by stellan »

Hello everybody,

I am new to these groups, mainly because I have stayed behind with version 6.22 and have pestered Lutz with personal mail instead. I was turned away by the change to Tcl/tk, but now it feels OK. I do not know why but has the documentation become clearer?

OK, so I have a Windows application supporting creativity and structuring of thoughts in a mindmap-like way. It is made up of two processes: a front-end in Delphi (400 kB of source code) and a back-end in newlisp (200 kB of source code). They communicate with TCP/IP. I have a web site www.succeed.se which up to now only is in Swedish, sorry.

I thought I should give my experiences when changing over to 7.5 to whoever might be interested. I can't see who whould be, but anyway, it might give me some friends and contacts to solve problems in the future.

The lisp code size is rather large (I think) but the work took only a few days. My main problems were:
- reserved symbols collided
- time and date functions were changed
- default in case statement changed
- system functions missing, like events and timers
- tcp/ip functions were different, not even driven
- I spent almost a day on chasing the quote in
(net-receive port 'str size)
Now, I know it is my fault but is not this a stupid syntax? In the case (set 'var value) I understand it, but here - no.
- At most errors during the debugging the back-end (=newlisp) exited in stead of staying up and displaying an error message and letting me investigate what went wrong. I start newlisp with
winExec(pChar('"' + _sysDir + 'newlisp.exe"'), sw_minimize);
Do not bother about delphi details but you can see that it is the raw newlisp without any switches.

One last (and first) thing - what a marvellous job Lutz has done. The documentation is also superb. Thanks!

Hope I did not bore you to death
best regards
Stellan Borg

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post by HPW »

Hello Stellan,

Welcome to the group.

As you can read here on the board, I have also worked with delphi and newLISP. But i used the new newLISP.DLL to integrate it into delphi apps. So I created the neobook plugin to bring newLISP into neobook (which is written in delphi). With this combination you have another option for a powerfull but also easy GUI and this great LISP (small and smart).

I have no knowledge about chaining apps from delphi via TCP, so the DLL-way was a nice alternative to go.
Hans-Peter

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

Hi Stellan,

a big welcome from me too, I hope we can address all your issues with the port from 6.22. A couple of comments to your post:

When running newLISP as a backend care must be taken to capture error messages somehow. There are two possibilities to do this:

(1) when running newLISP over TCP/IP the way you do, (net-listen, nat-accept, net-receive ...), error messages which go to standard out might get lost. You could right your own 'error-event' handler and write the error message to a file:

(define (my-error-handler) (write-file "error-file" (error-text)))
(error-event 'my-error-handler)

(2) The way newLISP-tk solves the problem, is opening newLISP doing:

newlisp -p 64001

or whatever port you want to use newLISP will start listening on port 64001, like it would listen to the commandline, all standard I/O is redirected now via 64001 and you controlling application talks to it like it would talk to a commandline. This automaticallly gives you all the error messages from newLISP. And you will not loose the communications link as in method (1), where the rrror throws you out of the communications loop.

When using method (2) you will also make frequently use of a function called 'silent': this function evaluates your epression without doing the console output:

(silent (set 'x 123)) ; you can try this in a console window

It helps to simplify communications with your frontend tremendously.

An advantage of method (2) is, that you can debug the newlisp.exe backend by just starting it up from the commandline normally and simulate your Delphi frontend by doing the input from the keyboard (or by starting up newlisp -p and use telnet to talk to it).

And here the last tip, which is not doumented until 8.0, but works since 7.3.5:

You can send multiline statements when enclosing them in [cmd] [/cmd] tags, try this on the command line:

>[cmd]
(set 'x 123)
(set 'y 456)
[/cmd]

newLISP will aquire all lines until it encounters [/cmd]. This allows you to send bigger code portions over the communications link (started with newlisp -p )

Lutz

Locked