mxmora@unix.SRI.COM (Matt Mora) (03/16/90)
I am in the process of writing a library routine for Quickbasic that will allow you to call XCMD's & and XFCN's from any quickbasic program. The part that is tripping me up is the callback part. For example: (using the code below supplied by apple's XCMDUtils) function StringMatch; begin with paramPtr^ do begin inArgs[1] := ORD(@pattern); inArgs[2] := ORD(target); request := xreqStringMatch; DoJsr(entryPoint); StringMatch := Ptr(outArgs[1]); end; end; where DoJsr is: PROCEDURE DoJsr (addr : ProcPtr); INLINE $205F, $4E90; {MOVEA.L (A7)+,A0} {JSR (A0)} When the library code starts I set entrypoint to be the address of the procdure to handle the callback. for example paramPtr^.entryPoint:=@CallbackHandler; How do I return control to the xcmd from my callbackhandler? RTS? Now when I actually call the xcmd after filling in then paramptr block, can I just do: myXCmdhndl:=GetNamedResource('XCMD',Xcmdname); if myXCmdHndl<> nil then begin Hlock(myXCmdHndl); DoJSR(myXCmdHndl^^); HunLock(myXCmdHndl); ReleaseResource(myXCmdHndl); end; end; or will this blow up in my face :-) And some other random questions. What exactly is a zero string. Is that a C string? And when I do ZeroToPas, Do I truncate the string if its > 255? Thanks for any clues you can give me. -- ___________________________________________________________ Matthew Mora SRI International mxmora@unix.sri.com ___________________________________________________________