Hello Lutz,
I would like to ask if it is possible to make a newlisp.dll where I can call
a function "eval" and pass a string containing a lisp-code.(cdecl)
This would be similar to newlisp "Direct execution mode".
It would return a string to the calling Programm.
But the DLL could then stay in memory and preserve it's memory with code and data.
Would be another powerfull option.
What do you think?
This has also been requested by Steve and it is on the list of things to do. Unfortunately it is one of those features, which needs a different treatment on the Windows and UNIX platforms, and I haven't done any Windows specific development in the last two years after moving newLISP to UNIX.
You might also consider talking to newLISP via TCP/IP, this is the way the newlisp-tk frontend is doing it. If you start newLISP in demon mode with the -d option it will stay in memory with all its data, even if the connecting application exits, you can reconnect and all data are still there.
This would also be a platform independent solution and you can have newLISP running on a different computer on the network/internet.
Anyway I will look into a DLL mode when I have a little bit more time.
Lutz
Quote
If you start newLISP in demon mode with the -d option it will stay in memory with all its data
Have not thought about that. Also interesting. I will give it a try. But direct call would be also nice.
Quote
Note, that the demon mode only works correctly on LINUX and BSD systems. On Win32 based systems newLISP may not be able to reconnect at all times.
Taken from the doc. Seems not so good for Win32 systems! :-((
the problem is with exiting, sometimes on Windows when the client application exits, the demon will receive an exception and exit too. On my system it has never occured again since I installed XP, and I check this feature with every build. I suspect it was only true on Windows 2000.
Give it a try! You can quickly check it out with the telnet command under Windows.
But I will look into the DLL stuff anyway.
Lutz
Quote
But I will look into the DLL stuff anyway.
Quote
In December 7.4 will be released and the rest of the year I will just concentrate on bugfixes, a more comprehensive test-suite and review of the manual.
Any idea or date when the DLL-feature could get reality?
Only a question, so no pressure!
I got it compiled and linked some time ago but cannot get it to work yet,
Lutz
When you need help with testing, let me know!
Of cource the basic function should be in place.
Thanks Hans-Peter, I will look into it again the coming week and might post the files which you use to compile as a DLL, to get some help.
Here in USA we have the long Thanksgiving / holyday weekend, which started yesterday on Thursday, so I will be not very active here on the board until Monday.
Lutz
No problem!
Have a nice Thanksgiving.
We have the 1.Advent. :-)
I'd be happy to help with the testing also.
Thanks Steve, I know you have prpbably the most experience, when it comes to building newLISP on Windows. I'll give it another quick shot tomorrow Monday, because I didn't look at it since I wrote it mid October and sometimes after a while you see some obvious screwup. After that I'll pass it on to you.
Its a .c, .def and a makefile. The .c and .def files just get added to the usual files and the whole thing gets compiled with the new makefile_win32dll.
Lutz
Okay. Just let me know.
I (sort of ;-) got the DLL stuff to work. here is a win32dll-001.tgz in the development directory. It is largely untested and has problems, but it is a start. Read the win32dll.readme first.
Lutz
Okay. I'll download it and start to work with it.
Think I got everything working, a little change was necessary to avoid printing to the console and return the error string from the DLL instead. I still want to make some other changes and then we will have a new development release on Wednesday.
Lutz
Okay. If you post those changes or email them to me, I can still do some testig.
I hope we then get the compiled DLL (for the people without the C-compiler).
The readme is promising.
There is a newlisp_7311.tgz in the development directory, which has just the changes and additional files for making a DLL.
Don't forget to 'make clean' between making the newlisp.exe and newlisp.dll. I n a later step we can try to make a combined newlisp.exe which also can serve as a DLL.
Lutz
>Don't forget to 'make clean' between making the newlisp.exe and newlisp.dll.
I forgot it! :-)
Some first observation:
(get-string (dllEvalStr "(string(main-args))"))
gives a crash. I assume a DLL can not have main-args.
(get-string (dllEvalStr "(load "test1.lsp")"))
gives a crash. Maybe the double-quotes.
(get-string (dllEvalStr "(load "test1.lsp")"))
returns "true" but does not evaluate the expression inside the lsp "(setq a10)".
There is a newlisp_7312.tgz in the development directory, it takes care of crashing in 'main-args' and 'print', both are now suppressed and will be ignored in DLL's. newlisp.dll now passes the QA suite which is not 100% but tests most features of newLISP.
Certain math exceptions i.e. (sqrt -1) result in a correct result of 'NaN', but the DLL pops up a Windows messge box, which has to be acknowledged.
Lutz
Yep, in 7.3.12 problem with main-args is solved.
But this remains:
(get-string (dllEvalStr "(load "test1.lsp")"))
gives a crash. Maybe the double-quotes.
(get-string (dllEvalStr "(load "test1.lsp")"))
returns "true" but does not evaluate the expression inside the lsp "(setq a 10)".
Here a remains nil.
As a quick hack I put together a neobook-plugin (delphi) for newlisp.
(hpwNewLISP.nbp 33KB Interface-DLL binded into neobook runtime)
In the past I have made some free plugins for the authoring package neobook.
I have a plugin running to call corman DLL's.
http://hpwickern.bei.t-online.de/anmeldung/html1/neobook/neobook.html
I upload a demo-exe to my plugin-page:
http://hpwickern.bei.t-online.de/anmeldung/html1/neobook/hpwNewLISP.zip
Question: Is it in the interest of newLisp to release this to the neobook community to spread the word about newlisp to more people?
Remember that all code you execute runs in the environment of newlisp.dll. After loading you 'test1.lsp' which has (setq a 10) do a:
(get-string (dllEvalStr "a")) => "10"
Also, instead of:
(get-string (dllEvalStr "(load "test1.lsp")"))
you can also do for less quote clutter:
(get-string (dllEvalStr {(load "test1.lsp")}))
About the crash:
When putting "(load "test.lsp")" as argment to dllEvalStr, it really receives 3 args: "(load " , test.lsp and ")". This will mess up the call stack in the DLL, where the function expects only one argument. Fixing this would require a lot of overhead when importing functions. Right now imported functions in newLISP are very fast.
When using the DLL from other Win32 applications, this will not be an issue, as all of these to extensive checking and declaring.
In newLISP it is always recommended to put wrappers around imported functions to check for the right type and number of args if these get exposed to users.
The next version will also have fix from Steve/adamss3 for the popup problem with FP exceptions.
Lutz
>Remember that all code you execute runs in the environment of newlisp.dll. After loading you 'test1.lsp' which has (setq a 10) do a:
Of cource you are right. Have not thought much before posting.
Thanks for clearing. Nice advice for less quote clutter.
Seems to be another great thing with the DLL feature.
I like it very much.
Just try to pack newlisp.DLL with ASPACK:
189 to 97 KB
and it still works! ;-)
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
>... 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?
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
Just released a initial release of the newlisp-wrapper for neobook:
See Froum post:
http://www.neosoftware.com/cgi-bin/ikonboard/topic.cgi?forum=3&topic=390
Updated plugin-page:
http://hpwickern.bei.t-online.de/anmeldung/html1/neobook/neobook.html
I upload a new demo-exe of the release demo to my plugin-page:
http://hpwickern.bei.t-online.de/anmeldung/html1/neobook/hpwNewLISPDemo.zip
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
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.
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/anmeldung/html1/neobook/hpwNewLISPDemo.zip
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/anmeldung/html1/neobook/hpwNewLISPDemo.zip
I just realize that error messaging is broken in the Win32 DLL in 7.3.15
Lutz
Oops, did not notice anything.
So the next fix is needed. ;-)
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
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/anmeldung/html1/neobook/hpwNewLISPDemo.zip
yes, error messaging now works, I wonder if newLISP could be used to enhance NeoBook apps, including controlling visual aspects of it?
Lutz
>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. ;-)
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.
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.
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
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
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") "rn")) "rn"))
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
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 rn with [#13][#10] -- NeoBook's syntax for representing ASCII character values. It just wouldn't work with rn or even \r\n.
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
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
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!
With regard to my earlier work-around of replacing "rn 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!
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!
the new development release 7.3.16 has the 'silent' bug fixed.
About the >2048 issue. Longer >2048 results strings from newLISP come back not quoted by "..." but by [text]... [/text] tags, I wonder if that could do something funny to the NeoBook interface which seems to treat [,] square brackest as some sort of escape/special character?
Lutz
Just released release 1.01 of the newlisp-wrapper for neobook:
See Froum post:
http://www.neosoftware.com/cgi-bin/ikonboard/topic.cgi?forum=3&topic=390
Updated plugin-page:
http://hpwickern.bei.t-online.de/anmeldung/html1/neobook/neobook.html
I upload a new demo-exe of the release demo to my plugin-page:
http://hpwickern.bei.t-online.de/anmeldung/html1/neobook/hpwNewLISPDemo.zip
Features:
Action: hpwNewLispCall - Support for callbacks in return-messages into neoScript!
Support-file: nb_util.lsp with usefull functions. Starts with: (nl2nb-list '("1" "2" "3"))
Demo-file: neoTurtle.lsp with fractal-graphics in neobook powered by newLISP/hpwImage.
Last but not least: newlisp.dll Development version 7.3.16
>I wonder if that could do something funny to the NeoBook interface which seems to treat [,] square brackest as some sort of escape/special character?
The brackets mark variables in neobook and have indeed to be treated different. I thought Sam has it working now.
May be we have to check again.
Hi Hans-Peter and Lutz,
I do have it (my program to copy just the unique lines in a text file) working now. All of the work is done in newLISP (thanks, Lutz!) and I am not passing lengthy strings back to NeoBook. I think the problem was that I was unaware of the [text]...[/text] requirement for lengthy strings and so was passing to a newLISP function a >2048 string delimited with double-quotes. I will verify this by returning to my old code and using [text]...[/text] in place of double-quotes. If this proves to be the culprit, we can document it for neoBook coders.
Verified! Using [text]...[/text] in neoBook when passing >2048 strings to newLISP eliminated the "string too long" error.
-- Sam
I uploaded a polished demo-exe of the release demo to my plugin-page:
http://hpwickern.bei.t-online.de/anmeldung/html1/neobook/hpwNewLISPDemo.zip
where did the turle demo go? I loved th turtle port you did, and thought I would see the Hanoi demo in the next NeoBook demo ;). There might be a problem though with the Hanoi demo, because the disk deletion works there by deleting a TK graphic object. I don't know if it is possible to do that with NeoBook.
Anyway, why don't you put it back (load "neoTurtle.lsp") doesn't work, I guess it doesn't find a graphic context to draw to.
Lutz
Dont't know what you mean, when you enter the turtle page it is loaded automaticly. You have to press the 'Start Lisp' button to start the string '(Turtle:run) in the entry field. The articel-object is just there to show the source. I only want to show what is done behind the scene.
To the Hanoi demo, the hpwImage plugin is a scriptable bitmap object, which does not work with objects like TK. Of cource it could be done with a complete redraw each time. Will take a look.
Oops, sorry about it! I always extracted an old version, this latest one is beautiful with the source pane on the right! This NeoBook software looks better to me each time you have a new demo.
About Hanoi: What I did in an older version, was overdraw the disk with 'white' to delete it.
Lutz
Many people (like high-flying MS-User ;-)) think neobook is a toy-tool.
Of cource a Visual studio might be better for huge projects and programmer teams. But Dave has really made a RAD-tool which can produce very nice results in less time. And through it's SDK you get an interface to extent the core-functionality.
>About Hanoi: What I did in an older version, was overdraw the disk with 'white' to delete it.
That was what I mean. The problem with the the neobook interface is, that it is not truly bidirectional. There are not 2 independent running process which communicate via TCP, there is one call into it and the answer has to contain the complete result neoscript. So with Hanoi, newlisp is ready when neobook starts painting. Will see how it will work.
Another idea would be to break it into parts and call it in a neobook loop and update the screen in this loop with subsequent calls for the disk position. Must be also possible.
I uploaded a new demo-exe of the release demo to my plugin-page:
http://hpwickern.bei.t-online.de/anmeldung/html1/neobook/hpwNewLISPDemo.zip
Now with ported Hanoi-Demo.
(Version with one return string)
Great Job on the Hanoi port to NeoBook!
A little optimization, instead of:
(append "foo" (string (nth 2 lst)) "bar")
you can do:
(string "foo" (nth 2 lst) "bar")
'string' can take several arguments and will convert and append at the same time.
Lutz
I uploaded a new demo-exe of the release demo to my plugin-page:
http://hpwickern.bei.t-online.de/anmeldung/html1/neobook/hpwNewLISPDemo.zip
It contains another demo from Sam Cox (Thanks) for calculating roman numbers.
For Hanoi.lsp I have tried to measure the time in newLISP. But I don't know if it is that fast or if the neobook timer just not work as long as the DLL works in the process.
Nice (very LISPish) Roman number algorithm by Sam Cox!
What confused me first was the '(silent (print expr))' instead of just 'expr' used in the NeoBook version, until I realized it was necessary to strip of the quotes from the return value.
Lutz
Late in the evening I upload a revised demo, with a newlisp-timer instead of a neobook timer.
Now there comes result between 800-900 ms for computing in newlisp. (6 Disk 0 Delay)
I uploaded a new demo-exe of the release demo to my plugin-page:
http://hpwickern.bei.t-online.de/anmeldung/html1/neobook/hpwNewLISPDemo.zip
Based on hpwNewLISP.nbp 1.02 with new command hpwNewLispFileread.
It was added to the pluigin to load files in neobook which contains a '|' character which has a special meaning for the neobook 'FileRead'.
In the last Demo a seperate plugin was binded so now it a bit smaller.
Now only hpwNewLISP and hpwImage are binded.
I uploaded a new demo-exe of the release demo to my plugin-page:
http://hpwickern.bei.t-online.de/anmeldung/html1/neobook/hpwNewLISPDemo.zip
Based on hpwNewLISP.nbp 1.03 with new restart-feature for hpwNewLispCall.
Now it is possible to feed commands into the neobook action-engine and get back into newlisp to generate further action-commands. So it is not necessary to compute a complete action-script at once (and wait in neobook). You can start generating at once in neobook and feed commands on demand.
I've been playing with calling newlisp from IBASIC http://www.pyxia.com/ibasic.html and realised it would be good to be able to check the dll newlisp version from the calling program - I couldn't see a function for it -
something like (version) -> "newLISP v7.3.17 Copyright (c) 2003 Lutz Mueller. All rights reserved."
so (nth 1 (parse (version))) -> "v7.3.17".
Also re initialization of dll
Following advice
When the DLL is loaded it looks for an ini.lsp file in the same directory as the DLL and loads it if it exists.
I tried putting ini.lsp (and init.lsp) into the directory but nothing seemed to happen the ini.lsp was
(setq a "this is inited")
Loading ini.lsp with (load "ini.lsp") has the expected effect.
also re suppression of (print ) mentioned earlier in thread
(write-line ) put a line onto an open IBASIC console - I haven't
tested what happens without a console but it may give problems
similar to (print ) but on the other hand outputting to the IBASIC
console could be good.
The IBASIC program I use is just a simple read-eval-print loop viz:
def ins, outs :STRING
declare "newlisp",dllEvalStr(thestring:STRING),STRING
OPENCONSOLE
while 1
input ">",ins
if ins = ""
goto doneit
endif
outs = dllEvalStr( ins)
print "OUT:", outs
endwhile
label doneit
Print "Break - press key to end"
DO:UNTIL INKEY$ <> ""
CLOSECONSOLE
END
In summary
-can we get at version?
-how to in.lsp the dll?
-watch out for (write-line in dll
Nigel
Hello Nigel,
version:
> (sys-info)
(639 298 1 0 1024 7317 6)
> (nth 5(sys-info))
7317
ini:
Couldn't you do the (load "ini.lsp") as the first action from your programm?
writeline:
> (silent(write-line "Test1"))
Test1
Works for me in newlisp-TK and in neobook/newlisp.dll.
So what's the problem with it?
Hello,
version:
Thanks for directing me to (sys-info) - it's what I needed.
ini:
I was really pointing out a statement in the documentation that didn't appear to be implemented or wasn't working (or I didn't understand).
write-line:
I mentioned it because I saw in this thread the post by Lutz:
"There is a newlisp_7312.tgz in the development directory, it takes care of crashing in 'main-args' and 'print', both are now suppressed and will be ignored in DLL's"
I thought that whatever was done to (print will need to be done to
(write-line. However, using (print in the dll of 7.3.17 seems to print to the open IBASIC so I'm not sure what Lutz was referring to as print being suppressed - perhaps you could make it clearer for me Lutz?
Anyway thanks for prompting me to think more about the dll console i/o
I'll fiddle with it a bit to understand it better.
Regards
Nigel
About 'init.lsp':
The file has to be in the current directory of the calling process not of the DLL. The manual is wrong about this. (will change this in the doc)
About 'print' in DLL:
'print' was not working in a DLL in the first version 7.3.12, but was then fixed in 7.3.14 and is now working fine.
Lutz
A suggestion about error reporting:
Now error returns are coming back to a program from a dll rather than just being seen on a console perhaps now is a time to formalise their strucure to be more "machine friendly".
viz
> (div 1 0)
division by zero in function div
>
This eror may be hard to differentiate from a valid reply.
I use the editor Credit that catches compile errors and suggest that the runtime dll error could consider a similar format to 'standard' compiler error formats.
Credit help says:
Error patterns
This area is only used if the tool's output is captured. It contains a list of patterns which are compared to the captured output. If a match is found, a double-click on a message line in the output pane automatically goes to the place in the source file referenced by the line.
For example, if you are using a tool which produces error messages of this kind:
Error 314: myprg.c (21,6) Identifier expected
Perhaps a newlisp error could look like
Error <err-no> <context> <function> <readable error text>
viz as above
Error 25 Main div Math_exception division_by_zero
I don't know how easy it is to return context.
Any comments?
I realize tyhe form I've suggested looks less friendly - perhaps error
format could be a settable option.
Nigel
this is easily done with defining a customized error handling routine in newLISP:
;; define the error handling routine
(define (error-handler) (print "ERR:" (error-number) " " (error-text)))
;; set it as the error-event
(error-event 'error-handler)
now when provoking an error:
(foo) =>
ERR:20 invalid function : (foo)
if 'foo' was called from another subroutines the stack trace would also be returned.
Lutz
thanks for the solution Lutz
Nigel
Lutz,
work for me in newlisp-tk, but not with the newLisp.DLL.
Still returns the old message.
Have you test it with DLL?
I uploaded a new demo-exe of the release demo to my plugin-page:
http://hpwickern.bei.t-online.de/anmeldung/html1/neobook/hpwNewLISPDemo.zip
Based on hpwNewLISP.nbp 1.04 with multiple restart-feature for hpwNewLispCall.
Global neobook var [hpwNewLispRestartCall] contains the current Lisp-call.
In the first nl-restart-call [hpwNewLispRestartCall] is set by the interface and then it can be set from Lisp to call other functions.
;; define the error handling routine
(define (error-handler) (print "ERR:" (error-number) " " (error-text)))
;; set it as the error-event
(error-event 'error-handler)
(foo) =>
ERR:20 invalid function : (foo)
When this would work in the DLL, I could check for starting 'ERR:' and set neobook's global [LastError].
It was not enabled in the DLL, but is working and tested now. Look for a new newlisp.dll.rc2 in the development directory.
Lutz
Thanks for the fast fix.
Works now as expected.
Have to work on the 1.05 now when time will allow.
I uploaded a new demo-exe of the release demo to my plugin-page:
http://hpwickern.bei.t-online.de/anmeldung/html1/neobook/hpwNewLISPDemo.zip
Based on hpwNewLISP.nbp 1.05 with a customised error-handler in newlisp is now connected with the neobook error-handling via [LastError]
So an error in newlisp pops up the neobook error meassage window.
My IBASIC program using the dll (rc2) isn't finding the ini.lsp
my directory looks lile:
C:Program FilesPyxia DevelopmentIBasic>dir
Volume in drive C is P1300
Volume Serial Number is 351A-07ED
Directory of C:Program FilesPyxia DevelopmentIBasic
. <DIR> 12-14-03 7:43a .
.. <DIR> 12-14-03 7:43a ..
UNINST ISU 26,805 12-14-03 7:43a Uninst.isu
SAMPLES <DIR> 12-14-03 7:43a samples
HELP <DIR> 12-14-03 7:43a help
COMPON~1 <DIR> 12-14-03 7:43a components
GORC EXE 49,664 08-25-02 6:25p GORC.EXE
IBCLI OBJ 131,072 11-28-03 2:22a IBCLI.obj
IB OBJ 456,192 11-28-03 2:21a IB.obj
IBNODX OBJ 384,000 11-28-03 2:21a IBNODX.obj
NLDLL IBA 310 12-14-03 8:15a nldll.iba
IBASIC EXE 1,130,496 11-27-03 9:41p ibasic.exe
NEWLISP DLL 196,608 12-14-03 8:17a newlisp.dll
RECOVER IBA 310 12-14-03 9:12a recover.iba
INI LSP 24 12-14-03 8:20a ini.lsp
10 file(s) 2,375,481 bytes
5 dir(s) 492.27 MB free
C:Program FilesPyxia DevelopmentIBasic>type ini.lsp
(setq aa "set by ini")
The Ibasic prog is the read-eval-loop as above
I get after start-up:
>(print aa)
OUT:nilnil
>
The program is running as an interpreted session from within the IDE but from
what I can see all files are in the one directory.
greping source code (7.3.17) gives:
C:newlispnewlisp_7317>grep "ini.lsp" *.c
C:newlispnewlisp_7317>grep "init.lsp" *.c
newlisp.c:#define INIT_FILE "init.lsp"
newlisp.c:#define INIT_FILE "/usr/share/newlisp/init.lsp"
C:newlispnewlisp_7317>
but changing the file to init.lsp doesn't change anything.
What am I missing? Any tips?
Can I check what path the dll is calling home?
Nigel
Just a thought would the spaces in the path cause problems?
ie ...Program Files... etc
Nigel
Hi Nigel,
Should that be init.lsp? newLISP.dll called from NeoBook via Hans-Peter's hpwNewLisp plug-in is loading my just-now-created init.lsp file.
-- Sam
yes! init.lsp not ini.lsp
The init.lsp should be in the current directory of the program importing newlisp.dll.
yes you can check the path newlisp.dll is calling home doing this from your importing program.
dllEvalStr "(directory)"
this will return a list of files in the directory where newlisp.dll is expecting the init.lsp
Lutz
I found that the problem in finding the init.lsp file was that the shortcut to start Ibasic.exe (that had been created by the installer) had the "Start in" directory set incorrectly
- it was pointing to a non-existant subdirectory so the "Start in" directory
defaulted to C:.
Once the "Start in" directory is correctly speciifed everything works fine.
I'll let Pyxia know about the install error.
Nigel
I have released hpwNewLISP 1.06:
Features:
Action: hpwNewLispCall - 1.Parameter for DLL-Path removed!
Action: hpwSetNewLispDir - Set DLL-Path one time in the pub!
Support for Custom-plugin commands. Definitions in file neoLISP.cmd!
nb_util.lsp renamed to init.lsp which is automaticly loaded by newLISP.
iSEDQuickPDF.lsp with all import functions for iSEDQuickPDF.dll
Final newLISP.dll 7.400
This has no effekt to the lisp-functionality. But neobook users can define their own neosript-command via a text-file which are then send to newlisp.dll. Offers better integration in the neobook action-editor.
I uploaded a new demo-exe of the release demo to my plugin-page:
http://hpwickern.bei.t-online.de/anmeldung/html1/neobook/hpwNewLISPDemo.zip
Based on hpwNewLISP.nbp 1.06 with neoLISP.cmd neoscript-definition file.
I uploaded a new demo-exe of the release demo to my plugin-page:
http://hpwickern.bei.t-online.de/anmeldung/html1/neobook/hpwNewLISPDemo.zip
Based on hpwNewLISP.nbp 1.08 with new developed hpwColorMemo-plugin for syntax-highlighting of lsp-files (and others/ see newlisp.cfg).
I uploaded a new demo-exe of the release demo to my plugin-page:
http://hpwickern.bei.t-online.de/anmeldung/html1/neobook/hpwNewLISPDemo.zip
Based on hpwNewLISP.nbp 1.08 with hpwColorMemo 1.01 now supports paranthesis balancing of ( [ { ... } ] ) via Key-shortcut CTRL-B.
I uploaded the last demo-exe of the release demo to the neobook resource site:
http://www.software-zone.com/neosoft/index.php?s=f90faba8d6b776588e3b7eacd46d3a1f&act=SF&f=24
This will save space for the plugin-pages.
Uploaded 'sqlite.lsp' bindings for the SQLite database. Works on Friday's upload of newLISP version 7.4.7, which can import libraries compiled for 'cdecl' calling conventions. Also tested on LINUX and FreeBSD. With this file and the new 'cdecl' parameter in newLISP 'import' you don't need a separate wrapper DLL on Win32.
This library import is also a good demo what to do with things like 'char *** pazValue' or 'char **pzErrmsg'. Nested multiple pointers can all be handled with the right mixture of 'get-integer' and 'get-string'.
SQLite fits very good to newLISP, because it is small and 'in process' so it doesn't need a separate database server running. The generated databases are binary compatible on all platforms. Seems to be the ideal database if MySQL still seems to be too much for the task.
http://newlisp.org/download/development/
and
http://www.sqlite.org
Lutz
Lutz,
I aggree with all points. Good example of the new import-feature.
I think you should have made a new thread, because it is not newlisp.dll related alone. It is an important improvement for its own.
Yes, probably should have made a new thread. Dou you (or anybody else) have any longer experience with SQLite? I mean what do you think about reliablility, speed etc.?
I want to move a newLISP project with about 20,000 records in a flat text file to SQLite. the flat text file works well, but processing is kind of clumsy, because I cannot use SQL for doing the reports.
Also to an earlier question of yours: newLISP is mainly my hobby but I also use it for work related stuff. For my areas of work see my homepage at nuevatec.com.
Lutz
I have released hpwNewLISP 1.13:
Action: hpwNewLispFreeDll - Free newLISP.dll from memory
Allow to explicit free the Dll from applications address space.
I have released hpwNewLISP 2.0:
New bidirectional interface which now offer neobook scripting directly from newLISP.
newLISP-function: hpwDllName (Gets the real plugin-filename)
newLISP-function: hpwPlayAction (Play neobook scripts from newLISP)
newLISP-function: hpwGetVar (Get variable from neobook to newLISP)
The imported functions are registered at startup of the plugin.
Just released hpwNewLISP 2.11:
http://www.hpwsoft.de/anmeldung/html1/neobook/neobook14.html
Command wizards for all commands.
neoLISP.cmd renamed to hpwNewLISP.cfp/hpwNewLISP.cfr
hpwNewLISP.cfr now auto-embedded to allow custom plugin lisp-commands also in web-apps.
hpwNewLISP.ini allows to link an external Lisp-Editor (called from command wizard)
hpwNewLISP.ini allows to config custom command hints.
hpwNewLispCall's command wizard uses syntax-highlighting from newLISP.cfg
Just released hpwNewLISP 2.13:
http://www.hpwsoft.de/anmeldung/html1/neobook/neobook14.html
hpwNewLispCall's command wizard gets buttons for clipboard support (Cut,Copy,Paste)
hpwNewLispCall's command wizard gets button for 'Select All'
hpwNewLispCall's command wizard gets button for 'Paranthesis check' (HotKey CTRL-B)
Just released hpwNewLISP 2.14:
http://www.hpwsoft.de/anmeldung/html1/neobook/neobook14.html
hpwNewLispCall's command wizard 'Paranthesis check' supports now subsequend checking
hpwNewLispCall's command wizard CTRL-A now selects all
hpwNewLispCall's command wizard F1 without any selected show newLISP framed doc.
hpwNewLispCall's command wizard F1 with selected newLISP command show newLISP doc about command.
hpwNewLisp.ini has a new entry: NewLispDirectory (Installdir of full version of newLISP)
Just released hpwNewLISP 2.15:
http://www.hpwsoft.de/anmeldung/html1/neobook/neobook14.html
Bugfix for TaskBarClickAndRestoreOnTop for About-dialog and command wizards
hpwNewLispCall's command wizard CTRL-N now calls 'clear and start new'
hpwNewLispCall's command wizard CTRL-O now calls 'file open'
hpwNewLispCall's command wizard CTRL-S now calls 'file save'
hpwNewLispCall's command wizard ALT-O calls OK-Button
hpwNewLispCall's command wizard ALT-C calls Cancel-Button
hpwNewLispCall's command wizard now supports TAB-key in the source text

(//%3C/s%3E%3CURL%20url=%22http://www.hpwsoft.de/anmeldung/html1/neobook/callwiz.png%22%3E%3CLINK_TEXT%20text=%22http://www.hpwsoft.de/anmeldung/html1/n%20...%20allwiz.png%22%3Ehttp://www.hpwsoft.de/anmeldung/html1/neobook/callwiz.png%3C/LINK_TEXT%3E%3C/URL%3E%3Ce%3E)
Just upload hpwNewLISP 2.25:
http://www.hpwsoft.de/anmeldung/html1/neobook/neobook14.html
Action: hpwNewLispDebug - Output debug info from newLISP into neobook debug window.

(//%3C/s%3E%3CURL%20url=%22http://www.hpwsoft.de/anmeldung/html1/neobook/nbdebug.png%22%3E%3CLINK_TEXT%20text=%22http://www.hpwsoft.de/anmeldung/html1/n%20...%20bdebug.png%22%3Ehttp://www.hpwsoft.de/anmeldung/html1/neobook/nbdebug.png%3C/LINK_TEXT%3E%3C/URL%3E%3Ce%3E)
hpwNewLispDebug is a dummy action which does really nothing.
The newLISPer/neobooker can use it to publish debug-info to the debug window.
Just upload a new zip of hpwNewLISP 2.25:
http://www.hpwsoft.de/anmeldung/html1/neobook/neobook14.html
Demofile: Improved PubViewer 1.09
Added a hpwTreeView for a hierachic view on the pub.
Added a Run-button when CompiledName is set in the pub-source.
When run with a pub-filename as a commandline-parameter the file is displayed on startup.

(//%3C/s%3E%3CURL%20url=%22http://www.hpwsoft.de/anmeldung/html1/neobook/pubviewer109.png%22%3E%3CLINK_TEXT%20text=%22http://www.hpwsoft.de/anmeldung/html1/n%20...%20wer109.png%22%3Ehttp://www.hpwsoft.de/anmeldung/html1/neobook/pubviewer109.png%3C/LINK_TEXT%3E%3C/URL%3E%3Ce%3E)
The neobook-source parser is written in newLISP of course.
Just upload a new zip of hpwNewLISP 2.26:
http://www.hpwsoft.de/anmeldung/html1/neobook/neobook14.html
The wizards of hpwNewLispCall now has a COM-interface button to <B>RegexBuddy</B>
Note:
RegexBuddy has to be installed and registerd on the developer PC.
Press the wizard-button and edit the selected-regex-string (or create at cursorpos) in RegexBuddy and return with the send-button.
(A great tool and a good value for the money)
More info: www.regexbuddy.com
Just upload a new zip of hpwNewLISP 2.31:
http://www.hpwsoft.de/anmeldung/html1/neobook/neobook14.html
New variable in neobook [NEWLISPDIR] readed from enviroment-var NEWLISPDIR from newLISP-install.
This make it easier to use the separate newLISP distribution directly.
Just upload a new hpwNewLISP 2.32:
http://www.hpwsoft.de/anmeldung/html1/neobook/neobook14.html
New error-handling code for changed newLISP error-function in 10.0.5
(Plugin works with old and new versions)
Just released initial OpenNbNewLISP 1.0:
http://www.hpwsoft.de/anmeldung/html1/neobook/neobook14.html
Neobook-forum annoucement:
http://www.neosoftware.com/community/viewtopic.php?f=3&t=20292
This is a stripped-down version of hpwNewLISP released under open-source to meet the needs of open-source developers in terms of license issues. It supports the essential interfacing to the newLISP.dll with callback support.
The delphi-source(D7) is provided on the download page.
Regards
Just upload a new hpwNewLISP 2.35:
http://www.hpwsoft.de/anmeldung/html1/neobook/neobook14.html
New upload with newLISP.dll 10.6.3
Fix in Plugin for changed DLL-call behaviour of newLISP.dll
Regards