Embeding newLISP in Powerbasic

Started by HPW, May 01, 2004, 04:06:02 AM

Previous topic - Next topic

HPW

I had posted this example to the powerbasic-community's here:



http://www.powerbasic.com/support/forums/Forum4/HTML/010408.html">http://www.powerbasic.com/support/forum ... 10408.html">http://www.powerbasic.com/support/forums/Forum4/HTML/010408.html



http://www.kirschbaum-software.biz/ubbthreads/showflat.php?Cat=&Board=FOR3&Number=536&page=0&view=expanded&sb=5&o=&fpart=1">http://www.kirschbaum-software.biz/ubbt ... o=&fpart=1">http://www.kirschbaum-software.biz/ubbthreads/showflat.php?Cat=&Board=FOR3&Number=536&page=0&view=expanded&sb=5&o=&fpart=1





Here is the powerbasic-code:



'Calling newLISP - DDT style
'By Hans-Peter Wickern  1.5.2004
'newlisp.DLL from www.newlisp.org
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#COMPILE EXE

'#RESOURCE "newLISP.pbr"

#INCLUDE "WIN32API.INC"

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DECLARE FUNCTION dllEvalStr SDECL _
                LIB "newlisp.dll" _
                ALIAS "dllEvalStr" _
                (lspStr AS ASCIIZ) AS STRING
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CALLBACK FUNCTION My_DlgProc
  SELECT CASE CBMSG
    CASE %WM_COMMAND
      SELECT CASE CBCTL
        CASE 101
           DIM txt AS STRING
           DIM txt1 AS STRING
           CONTROL GET TEXT CBHNDL, 103 TO txt$
           IF txt$ <> "" THEN
            txt1$ = dllEvalStr(BYCOPY txt$)
           ELSE
            txt1$ = ""
           END IF
           CONTROL SET TEXT CBHNDL, 104, txt1$
        CASE 102
           DIALOG END CBHNDL,0
      END SELECT
  END SELECT
END FUNCTION
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FUNCTION PBMAIN
    DIM hDlg AS LONG
    DIALOG NEW %HWND_DESKTOP, "Powerbasic meets newLISP",,,350,66, _
                              %WS_CAPTION OR %WS_MINIMIZEBOX OR %WS_SYSMENU, 0 TO hDlg
'    DIALOG SET ICON  hDlg, "IDI_APP"
    CONTROL ADD BUTTON, hDlg, 101,"Lisp Eval",290,10,50,13
    CONTROL ADD BUTTON, hDlg, 102,"Exit",290,45,50,13
    CONTROL ADD TEXTBOX,  hDlg, 103,"(setq a 100)",10,10,270,11, _
                 %ES_MULTILINE OR %ES_WANTRETURN, %WS_EX_CLIENTEDGE
    CONTROL ADD TEXTBOX,  hDlg, 104,"Result",10,25,270,33, _
                 %ES_MULTILINE OR %ES_WANTRETURN, %WS_EX_CLIENTEDGE
    DIALOG SHOW MODAL hDlg, CALL My_DlgProc&()
END FUNCTION
Hans-Peter

newdep

#1
Hello HPW,



Great !!! I was on my way linking Newlisp with Purebasic, as Purebasic does not handle Network routines that great but newlisp does ;-) Ill hack something and ill post it here... I like the combination of easy Gui building under Windows using Purebasic (as it is also compiled in Assembler under windows) and with the combination of the Newlisp power included purebasic finaly rocks :)



Norman.
-- (define? (Cornflakes))