newlisp.DLL possible?

Machine-specific discussion
Unix, Linux, OS X, OS/2, Windows, ..?
HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post by HPW »

Just try to pack newlisp.DLL with ASPACK:

189 to 97 KB

and it still works! ;-)
Hans-Peter

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

Post by Lutz »

Just tried you demo, very nice, what you can do with Delphi and newLISP together, this may be the best option to deliver GUI heavy applications with newLISP. A user in Sweden wrote a commercial app this way but communicating with newLISP via TCP/IP: http://www.succeed.se/

Just a little observation:

(string (eval a)" "(eval b)" "(eval c))

you could just say:

(string a " " b " " c)

Because 'string' evaluates its args before stringing them together.

Lutz

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

Post by HPW »

>... what you can do with Delphi and newLISP together,

In this case it's delphi in indirekt case. neobook is developed with delphi and therefor the native interface language (SDK) is delphi. Others are possible. So neobook provides a easy to use enviroment and a scripting language. So combined with a lisp-engine a lot of things are possible. But it has not the true dynamic features like the TK-enviroment.

> (string (eval a)" "(eval b)" "(eval c))
> (string a " " b " " c)

Thanks, I had copied it from a corman demo.


And Question again: Is it in the interest of newLisp (and yours) to release the DLL-wrapper to the neobook community to spread the word about newlisp to more people?
Hans-Peter

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

Post by Lutz »

HPW >>>
And Question again: Is it in the interest of newLisp (and yours) to release the DLL-wrapper to the neobook community to spread the word about newlisp to more people?
<<<

Yes, absolutely!

Lutz

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

Post by HPW »

Just released a initial release of the newlisp-wrapper for neobook:

See Froum post:

http://www.neosoftware.com/cgi-bin/ikon ... &topic=390

Updated plugin-page:

http://hpwickern.bei.t-online.de/anmeld ... obook.html

I upload a new demo-exe of the release demo to my plugin-page:

http://hpwickern.bei.t-online.de/anmeld ... SPDemo.zip
Hans-Peter

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

Post by Lutz »

congratulations! nice demo, but ;)

(assoc 20 (list(list 20 "Dog")(list 30 "CAT")(list 40 "Mice")))

you could just do:

(assoc 20 '( (20 "Dog") (30 "CAT") (40 "Mice") ) )

or even

(assoc 20 '( (20 Dog) (30 CAT) (40 Mice) ) )

(just trying to present newLISP in a positive light)

Anyway, I am delighted by this demo of yours, as I think it will bring new friends to newLISP. There are so many tools on Windows for building GUI / Multi Media stuff where newLISP could be he 'intelligent' backend.

Lutz

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

Post by HPW »

congratulations! great lisp language! ;-)

I will add your sugestions and also will put all lisp-samples in
an external lsp-file. Then you can add as much sample as you like.
Hans-Peter

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

Post by HPW »

Now the lisp samples are in sample.lsp and have your suggestions.
I upload the new demo-exe of the release demo to my plugin-page:

http://hpwickern.bei.t-online.de/anmeld ... SPDemo.zip
Hans-Peter

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

Post by HPW »

I upload the new demo-exe with DLL 7.3.15 and a Fix in the demo to allow pipes in the sample lsp-file. (pipes are CR in native neobook fileread, so a plugin based own fileread is used)

http://hpwickern.bei.t-online.de/anmeld ... SPDemo.zip
Hans-Peter

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

Post by Lutz »

I just realize that error messaging is broken in the Win32 DLL in 7.3.15

Lutz
Last edited by Lutz on Thu Dec 04, 2003 8:57 pm, edited 1 time in total.

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

Post by HPW »

Oops, did not notice anything.
So the next fix is needed. ;-)
Hans-Peter

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

Post by Lutz »

in makefile_win32.dll replace

CC = bcc32 -O2 -DOPSYS=6 ;; wrong

with


CC = bcc32 -O2 -DOPSYS=6 -DWIN32DLL ;; corect


and recompile the DLL.

I'll also put a recompile in the development directory

Lutz

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

Post by HPW »

I upload the new demo-exe with recompiled DLL 7.3.15 and a Fix in the demo without a key-binding for '1' for the lisp-call button.

http://hpwickern.bei.t-online.de/anmeld ... SPDemo.zip
Hans-Peter

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

Post by Lutz »

yes, error messaging now works, I wonder if newLISP could be used to enhance NeoBook apps, including controlling visual aspects of it?

Lutz

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

Post by HPW »

>I wonder if newLISP could be used to enhance NeoBook apps, including controlling visual aspects of it?

Sure, you can do a lot of things, but not so dynamic as in TK. You can control navigation through neobook pages or modify/enable/disable objects. Filling listboxes, articels and Text-objects are possible. All math and string processing can be done. Everywhere you can define a callback-action you could jump into plugins. Commands from plugins simply enhance the neoscript language.

Dave from neosoft has true dynamic object on his list, but he had not decided, when and if they could appear. (next major release? I hope!).

I will look into some small lisp-functions to convert return data from newlisp into neobook list and arrays. neobook has some similar functions like freewrap to bind files into the EXE and unpack them at runtime. So this could be use to start the DLL and load some initial lisp files. Neobook can intergrate a lot of file-formats and plugins. The last DBF-plugin features a BLOB field where you can store any sort of file. So here is another point where you can store lisp-code.

So finally the user has to decide what solutiion fits best to get the job done. ;-)
Hans-Peter

Sammo
Posts: 180
Joined: Sat Dec 06, 2003 6:11 pm
Location: Loveland, Colorado USA

Post by Sammo »

Hello everyone,

I found my way here following Hans-Peter's lead from the NeoBook Forum. In my first attempt at using the newLisp.DLL from NeoBook, I encountered what I perceive to be a problem in the documentation -- or in my understanding of the documentation.

Manual p.116 (parse str-data [str-break int-option])

"When str-break is not specified, the maximum token size is 2048 for quoted strings .... If str-break is specified, there is no limitation on the length of tokens."

I wrote this:

;; long string with "%%" delimiters
(set 'mystring "string%%longer%%than%%2048%%charcters")
(parse mystring "%%") ==> string token too long

Have I misunderstood the documentaiton? I don't think I should be getting the "string token too long" error. The (parse ...) works perfectly for strings less than 2048 characters.

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

Post by HPW »

Hello Sammo (or schould I say Sam),

Welcome on this forum.

May be Lutz give some explanation about your parse problem.
For your sample on the neobook forum I would made a different approach.
Instead of making a big string of a whole file in neobook and push it over the interface, I would do it on the newlisp side.

There I would read one line after another with read-line and
put them i a list and check each new line with (not(member ...))
before I put it into the list.
Hans-Peter

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

Post by Lutz »

Welcome Sammo,

pasted everyting from your posting into the NeoBook demo (DLL based on 7.3.15) and it worked fine for me. I also tried it in the release version of newLISP v.7.3.1 and in the latest development version (7.3.15) and it also works ok, giving me a:

("string" "longer" "than" "2048" "charcters")

Are you sure your original did not miss a quote somewhere, that would also give you a "string too long error".

Lutz

Sammo
Posts: 180
Joined: Sat Dec 06, 2003 6:11 pm
Location: Loveland, Colorado USA

Post by Sammo »

Hi Lutz,

Thanks for the welcome and for responding so quickly.

I wasn't as clear as I could have been in my first post. In my application, the string represented in the post by "string%%longer%%than%%2048%%charcters" is constructed by reading (in NeoBook) an entire file into a string, replacing the CR and LF pairs in the string with "%%", and then calling the parse function. It works just fine until the length of the assembled string is greater than 2048 characters. Because it works for strings shorter than 2048 characters, I'm pretty sure my quotes are balanced. I haven't tried (parse ...) with a long string in the non-DLL version of newLISP. It's possible (maybe even likely?) that Hans-Peter's interface is truncating long strings passed to the newLISP.DLL.

Taking Hans-Peter's hint, I have rewritten the code using a different approach. I have a question about that, too, but I will start a new thread since the focus is different.

-- Sam

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

Post by Lutz »

Hi Sam,

now I understand your > 2038 issue. The string to be parsed can be > 2048 bytes, but the resulting tokens still should be < 2048 bytes.

I just went to the neoforum and saw this from you:

>>>
.. Purpose: create [OutFile] consisting of just one copy of each unique line in [InFile]
<<<

Your code is correct, but you could do this in just one line of newLISP:

(write-file "OutFile" (join (unique (parse (read-file "InFile") "\r\n")) "\r\n"))

I tried this with the following file

>>>
one
one
two
two
one
three
two
three
<<<

and it gives me:

>>> outfile
one
two
three
<<<

(remark about >2048 bytes deleted, there is no limitations of string or token length in 'parse', when using with break string, 2002-12-07)

Lutz
Last edited by Lutz on Sun Dec 07, 2003 8:50 pm, edited 2 times in total.

Sammo
Posts: 180
Joined: Sat Dec 06, 2003 6:11 pm
Location: Loveland, Colorado USA

Post by Sammo »

Thank you, Lutz

That worked dandy! Here's the entire NeoBook program now using HPW's conduit to the newLISP.DLL. You'll notice that I replaced \r\n with [#13][#10] -- NeoBook's syntax for representing ASCII character values. It just wouldn't work with \r\n or even \\r\\n.

Code: Select all

SetVar "[InFile]" "[PubDir]Data1.txt"
SetVar "[OutFile]" "[PubDir]Data2.txt"
SetVar "[LispCode]" "(write-file {[OutFile]} (join (unique (parse (read-file {[InFile]}) {[#13][#10]})) {[#13][#10]}))"
hpwNewLispCall "[PubDir]" "[LispCode]" "[LispResult]"
Thank you, again.
-- Sam

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

Post by Lutz »

I am glad newLISP 'is doing it' for you with NeoBook. The different representation of binary characters is always a hassle to work with, but it seems that NeoBook is applying its translation from [#13] correctly and you found out about {,} for string delimiters, you also can use {,} inside {,} as long as they are balanced.

Another string delimiter in newLISP is [text] and [/text], these are used for strings longer than 2048 bytes and newLISP also uses them when returning quoted strings to the user.

Lutz

Sammo
Posts: 180
Joined: Sat Dec 06, 2003 6:11 pm
Location: Loveland, Colorado USA

Post by Sammo »

Thank you again, Lutz, for the help and for the pointer to the updated manuals. I will be studying them. newLISP is going to be lots of fun!

Sammo
Posts: 180
Joined: Sat Dec 06, 2003 6:11 pm
Location: Loveland, Colorado USA

Post by Sammo »

With regard to my earlier work-around of replacing "\r\n with [#13][#10]" in the NeoBook shell, I find in the manual that "[c]urly braces suppress the preprocessing of backslash escaped characters." That explains that!

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

Post by HPW »

Sam,

Glad to know that it was an easy explanation to the problem.
Now it is even shorter than your workaround. Lutz has made a really great job on newLISP.
May the workaround will provide ideas for future problems, which could not be done with unique.

>It's possible (maybe even likely?) that Hans-Peter's interface is truncating long strings passed to the newLISP.DLL.

No, to my current knowledge there is no limitation. The string is stored into memory and only a pointer is passed through the interface.

When Lutz has fixed the bug on (silent ) there will be a 1.01 of the interface with another very, very cool feature. ;-)

Stay tuned!
Hans-Peter

Locked