Embeding newLISP in Powerbasic

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

Embeding newLISP in Powerbasic

Post by HPW »

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

http://www.powerbasic.com/support/forum ... 10408.html

http://www.kirschbaum-software.biz/ubbt ... o=&fpart=1


Here is the powerbasic-code:

Code: Select all

'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
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Post by newdep »

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))

Locked