newlisp.DLL possible?

Machine-specific discussion
Unix, Linux, OS X, OS/2, Windows, ..?

Postby HPW » Tue Dec 02, 2003 5:18 pm

Just try to pack newlisp.DLL with ASPACK:

189 to 97 KB

and it still works! ;-)
Hans-Peter
HPW
 
Posts: 1352
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany

Postby Lutz » Tue Dec 02, 2003 5:29 pm

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
Lutz
 
Posts: 5258
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Postby HPW » Tue Dec 02, 2003 6:33 pm

>... 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
HPW
 
Posts: 1352
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany

Postby Lutz » Tue Dec 02, 2003 7:59 pm

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
Lutz
 
Posts: 5258
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Postby HPW » Wed Dec 03, 2003 10:06 pm

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
HPW
 
Posts: 1352
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany

Postby Lutz » Thu Dec 04, 2003 12:12 am

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
Lutz
 
Posts: 5258
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Postby HPW » Thu Dec 04, 2003 6:09 am

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: 1352
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany

Postby HPW » Thu Dec 04, 2003 6:25 am

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: 1352
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany

Postby HPW » Thu Dec 04, 2003 8:31 pm

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
HPW
 
Posts: 1352
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany

Postby Lutz » Thu Dec 04, 2003 8:46 pm

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.
Lutz
 
Posts: 5258
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Postby HPW » Thu Dec 04, 2003 8:54 pm

Oops, did not notice anything.
So the next fix is needed. ;-)
Hans-Peter
HPW
 
Posts: 1352
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany

Postby Lutz » Thu Dec 04, 2003 9:04 pm

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
Lutz
 
Posts: 5258
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Postby HPW » Thu Dec 04, 2003 9:17 pm

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
HPW
 
Posts: 1352
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany

Postby Lutz » Thu Dec 04, 2003 11:44 pm

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

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

Postby HPW » Fri Dec 05, 2003 6:22 am

>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
HPW
 
Posts: 1352
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany

Postby Sammo » Sat Dec 06, 2003 6:23 pm

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.
Sammo
 
Posts: 180
Joined: Sat Dec 06, 2003 6:11 pm
Location: Loveland, Colorado USA

Postby HPW » Sat Dec 06, 2003 6:38 pm

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
HPW
 
Posts: 1352
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany

Postby Lutz » Sat Dec 06, 2003 9:35 pm

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
Lutz
 
Posts: 5258
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Postby Sammo » Sat Dec 06, 2003 9:59 pm

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
Sammo
 
Posts: 180
Joined: Sat Dec 06, 2003 6:11 pm
Location: Loveland, Colorado USA

Postby Lutz » Sat Dec 06, 2003 10:12 pm

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.
Lutz
 
Posts: 5258
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Postby Sammo » Sat Dec 06, 2003 10:40 pm

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
Sammo
 
Posts: 180
Joined: Sat Dec 06, 2003 6:11 pm
Location: Loveland, Colorado USA

Postby Lutz » Sat Dec 06, 2003 11:03 pm

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
Lutz
 
Posts: 5258
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Postby Sammo » Sat Dec 06, 2003 11:10 pm

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

Postby Sammo » Sun Dec 07, 2003 1:12 am

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!
Sammo
 
Posts: 180
Joined: Sat Dec 06, 2003 6:11 pm
Location: Loveland, Colorado USA

Postby HPW » Sun Dec 07, 2003 7:15 am

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
HPW
 
Posts: 1352
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany

PreviousNext

Return to newLISP and the O.S.

Who is online

Users browsing this forum: No registered users and 1 guest

cron