Code: Alles auswählen
;-TOP
; *******************************************************************
; -------------------------------------------------------------------
Prototype newLispEvalStrProto(EvalStr.p-utf8)
Prototype newlispCallbackStrProto(input.p-utf8, callbackaddress.i , calltype.p-utf8 )
Global _newLispEvalStr.newLispEvalStrProto
Global newlispCallbackStr.newlispCallbackStrProto
Global newlispLib
; -------------------------------------------------------------------
Procedure InitNewLisp()
newlispLib = OpenLibrary(#PB_Any,"newlisp.dll")
If newlispLib
_newLispEvalStr = GetFunction(newlispLib,"newlispEvalStr")
newlispCallbackStr = GetFunction(newlispLib, "newlispCallback")
ProcedureReturn #True
Else
ProcedureReturn #False
EndIf
EndProcedure
; -------------------------------------------------------------------
Procedure.s newLispEvalStr(EvalStr.s)
Protected *result, result.s
*result = _newLispEvalStr(EvalStr)
If *result
result = PeekS(*result, -1, #PB_UTF8)
Else
result = "Error: No result"
EndIf
ProcedureReturn result
EndProcedure
; *******************************************************************
Global result.s, evalstr.s, r1
; -------------------------------------------------------------------
Procedure callme(*Info)
Protected text.s
If *Info
text = PeekS(*info, -1, #PB_UTF8)
ProcedureReturn MessageRequester("newLisp", "Result = " + text, #PB_MessageRequester_YesNoCancel)
Else
ProcedureReturn MessageRequester("newLisp", "No Info")
EndIf
EndProcedure
; -------------------------------------------------------------------
If InitNewLisp()
evalstr = "(callme 'Hello world')"
evalstr = ReplaceString(evalstr, "'", #DQUOTE$)
r1 = newlispCallbackStr("callme", @callme(), "stdcall")
If r1
result.s = newLispEvalStr(evalstr)
Debug "result = " + result
Else
Debug "Error: Register Callback"
EndIf
EndIf