Purebasic meets newLISP
Purebasic meets newLISP
As a followup from Hans-Peters example on Powerbasic ill post here the
Purebasic version. The binary compiled version you can find on my website
(http://www.nodep.nl/newlisp/) windows is ready, linux in the make.
below the code..
Enjoy...
;
; Purebasic 3.91 meets newLISP 8.0.15 by Norman.
; (this is the windows exmaple, ill bake a linux too)
; as purebasic lacks some good essentials like
; logic programming grammer and a good network library
; it has i.e. a very nice advantage like GUI development
; for windows and linux. Purebasic is not freeware.
;
; below you see how purebasic GUI incorporates with
; the language power of newlisp.
;
; the example below inserts all new messages from the
; udp-threadened listener into a GUI text API.
;
; Purebasic has the abbility of including Library calls
; into its own environment, so i had to import the newlisp
; newlispEvalStr into PureBasic to make a litte more basic-like.
; Still it is also possible to do direct Library calls to the
; newlisp.dll. Not included here.
;
; make sure you run this program with the newlisp.dll in the
; same directory or place newlisp.dll (8.0.15) somewhere in your
; windows system directory.
;
;
; create a socket thread in Purebasic
; calling the (net-receive-udp) from newLISP.
Procedure listen()
Repeat
Delay(10); cpu cooler :-)
gotdata = newlispEvalStr_( "(set 'nlgotdata (net-receive-udp 54054 512))" )
If gotdata > 0
AddGadgetItem(1,0,PeekS(newlispEvalStr_( "(nth 1 nlgotdata)" )) + " -> " + PeekS(newlispEvalStr_( "(nth 0 nlgotdata)")))
EndIf
Until quit = 1
EndProcedure
If OpenWindow(0,100,100,400,200,#PB_Window_SystemMenu,"PureBasic meets newLISP")
If CreateGadgetList(WindowID(0))
EditorGadget(1,10, 10, 380, 180)
AddGadgetItem(1,0,"Now Listening at 127.0.0.1 on port 54054")
AddGadgetItem(1,0,"Try send a (net-send-udp address port text)")
EndIf
; launch the thread
tid = CreateThread(@listen(),100)
Repeat
Delay(10) ; another cpu cooler...
Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf
; kill the thread
KillThread(tid)
End
Purebasic version. The binary compiled version you can find on my website
(http://www.nodep.nl/newlisp/) windows is ready, linux in the make.
below the code..
Enjoy...
;
; Purebasic 3.91 meets newLISP 8.0.15 by Norman.
; (this is the windows exmaple, ill bake a linux too)
; as purebasic lacks some good essentials like
; logic programming grammer and a good network library
; it has i.e. a very nice advantage like GUI development
; for windows and linux. Purebasic is not freeware.
;
; below you see how purebasic GUI incorporates with
; the language power of newlisp.
;
; the example below inserts all new messages from the
; udp-threadened listener into a GUI text API.
;
; Purebasic has the abbility of including Library calls
; into its own environment, so i had to import the newlisp
; newlispEvalStr into PureBasic to make a litte more basic-like.
; Still it is also possible to do direct Library calls to the
; newlisp.dll. Not included here.
;
; make sure you run this program with the newlisp.dll in the
; same directory or place newlisp.dll (8.0.15) somewhere in your
; windows system directory.
;
;
; create a socket thread in Purebasic
; calling the (net-receive-udp) from newLISP.
Procedure listen()
Repeat
Delay(10); cpu cooler :-)
gotdata = newlispEvalStr_( "(set 'nlgotdata (net-receive-udp 54054 512))" )
If gotdata > 0
AddGadgetItem(1,0,PeekS(newlispEvalStr_( "(nth 1 nlgotdata)" )) + " -> " + PeekS(newlispEvalStr_( "(nth 0 nlgotdata)")))
EndIf
Until quit = 1
EndProcedure
If OpenWindow(0,100,100,400,200,#PB_Window_SystemMenu,"PureBasic meets newLISP")
If CreateGadgetList(WindowID(0))
EditorGadget(1,10, 10, 380, 180)
AddGadgetItem(1,0,"Now Listening at 127.0.0.1 on port 54054")
AddGadgetItem(1,0,"Try send a (net-send-udp address port text)")
EndIf
; launch the thread
tid = CreateThread(@listen(),100)
Repeat
Delay(10) ; another cpu cooler...
Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf
; kill the thread
KillThread(tid)
End
-- (define? (Cornflakes))
Just test a neobook based UdpSender with your PB-UdpListener.
Works fine.
With its 17 KB filesize it take 3.5 MB memory.
A neobook Listener take about 6 MB (because the runtime)
A pure newlisp.exe with linked LSP take about 1.3 MB memory.
Now it would be interesting to see a demo with a text-entry widget
where I can type a lisp expression and then I press a 'eval' button
and the result is shown somewhere. A mini-IDE in purebasic.
Works fine.
With its 17 KB filesize it take 3.5 MB memory.
A neobook Listener take about 6 MB (because the runtime)
A pure newlisp.exe with linked LSP take about 1.3 MB memory.
Now it would be interesting to see a demo with a text-entry widget
where I can type a lisp expression and then I press a 'eval' button
and the result is shown somewhere. A mini-IDE in purebasic.
Hans-Peter
Oke i build a very very very very simple evaluation example
with a Windows GUI in Purebasic.
Actualy it lacts a lot ;-)
above all the GUI will hang untill a "blocking IO command" return a value. This could actualy be fixed with a Thread in the tool, but its just an example..
http://www.nodep.nl/downloads/newlisp/pbnl.exe
with a Windows GUI in Purebasic.
Actualy it lacts a lot ;-)
above all the GUI will hang untill a "blocking IO command" return a value. This could actualy be fixed with a Thread in the tool, but its just an example..
http://www.nodep.nl/downloads/newlisp/pbnl.exe
-- (define? (Cornflakes))
Since I was not familar with your GTK-server, I just give it a try and installed it.
I ran your demo-scripts and it works as expected.
I have a question about your GTK-server and the GTK-enviroment.
Is there a way to bundle the enviroment and the server to a self-contained windows executable? (TK has a TclApp/TclDevKit for building Starpacks/Starlibs).
Or how would I install it on a fresh user-mashine?
(3 Installer one after another?)
I ran your demo-scripts and it works as expected.
I have a question about your GTK-server and the GTK-enviroment.
Is there a way to bundle the enviroment and the server to a self-contained windows executable? (TK has a TclApp/TclDevKit for building Starpacks/Starlibs).
Or how would I install it on a fresh user-mashine?
(3 Installer one after another?)
Hans-Peter
My GTK-server for Windows currently needs 2 installers: the GTK environment and the GTK-server itself. The installer for the GTK-environment was created by somebody else, I just asked for permission to host the installer on my site. (I have to ask for his installscripts and combine that with mine to create one big installer containing everything.)
But the GTK-environment can also be used for other applications using GTK, like the Gimp, Ethereal, and so on. Therefore it seems logical to me that it has it's own installer.
With the Windows-port it is not possible to create a stand-alone binary which contains all the GTK stuff by itself (statically linked). This is a limitation of the Win32 version of GTK. In Unix however this is possible; see my Makefile.static in the sourcepackage for details.
Concluded: a fresh user-machine needs only 2 installers - the GTK-environment for GTK2 (recommended) and the GTK-server for GTK2.
But the GTK-environment can also be used for other applications using GTK, like the Gimp, Ethereal, and so on. Therefore it seems logical to me that it has it's own installer.
With the Windows-port it is not possible to create a stand-alone binary which contains all the GTK stuff by itself (statically linked). This is a limitation of the Win32 version of GTK. In Unix however this is possible; see my Makefile.static in the sourcepackage for details.
Concluded: a fresh user-machine needs only 2 installers - the GTK-environment for GTK2 (recommended) and the GTK-server for GTK2.
-
- Posts: 429
- Joined: Tue Nov 11, 2003 2:11 am
- Location: Brisbane, Australia
-
- Posts: 429
- Joined: Tue Nov 11, 2003 2:11 am
- Location: Brisbane, Australia
Hi HPW,
In this thread we were discussing the amount of installers with GTK-server:
http://www.gtk-server.org/UDP-Chat.zip
Just unzip and run the VBS starter "chat.vbs" (no virus in there).
It's just an example on how a newLisp program could be distributed without the tedious procedure of going through all kinds of installers... The ZIP file also could have been a self-extractable ZIP, or an NSIS installer, or whatever.
Peter
In this thread we were discussing the amount of installers with GTK-server:
Accidentaly I have prepared an example ZIP package, which includes eveything you need to run a newLisp program. It is the UDP demo program converted to an EXE, also the GTK-server and all necessary DLL's are in the ZIP:With the third installer I mean my own files with the newLISP-logic.
So anyway this is not so elegant as the possibilitys with TK.
But may be the GTK guys get there in the future.
We (the newLISP users) have the choice.
http://www.gtk-server.org/UDP-Chat.zip
Just unzip and run the VBS starter "chat.vbs" (no virus in there).
It's just an example on how a newLisp program could be distributed without the tedious procedure of going through all kinds of installers... The ZIP file also could have been a self-extractable ZIP, or an NSIS installer, or whatever.
Peter