Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!think!snorkelwacker!bloom-beacon!HPLABS.HP.COM!mayer%hplnpm From: mayer%hplnpm@HPLABS.HP.COM (Niels P. Mayer) Newsgroups: comp.windows.x Subject: Re: WINTERP Questions Message-ID: <9297.630088747@hplnpm> Date: 19 Dec 89 16:39:07 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: Hewlett-Packard Labs, Software Technology Lab, Palo Alto, CA. Lines: 64 Newsflash! WINTERP now has documentation! see expo.lcs.mit.edu:contrib/winterp.tar.Z for details.... In article <1971@eric.mpr.ca> parker@zaphod.mpr.ca (Ross Parker) writes: >I've just finished building winterp (version 1.0), and it >looks pretty neat... Thanks! Please send me any enhancements you make. >and have a couple of questions. The documentation that came >with winterp is a little skimpy (as can be expected - I'm >not complaining). I just updated the file on expo with approx 200kbytes of plaintext documentation. Hope this will make you happy. The documentation is no substitute for the standard Motif documentation, the Xtoolkit documentation, or Doug Young's upcoming Motif Book. The documentation should serve as a good supplement to the official Motif documetation and should help you in translating example code from C to WINTERP-Lisp syntax. > I got the idea from the doc that it is >possible to write out C code, but I couldn't figure out >how to do it. Is it easy? If so, can it be explained in >a paragraph or so? The documentation explains some of the philosophy behind writing hybrid Lisp/C programs. XLISP makes it very easy to merge in new C-implemented primitives and methods into an application. JonnyG did a good job of explaining in one paragraph what needs to be done, and which things you should look at. Writing Lisp callable C code in WINTERP is easy once you get the hang of it. All of the WINTERP source code should serve as an example of how to implement methods and primitives in C. As JonnyG said, the toughest part is remembering to protect newly created objects from getting garbage collected. Also take a look at ./winterp/src-server/w_funtab.{c,h} to see how to add new methods and functions to XLISP's functiontable. I was going to write up a document on how to add new primitives to XLISP and WINTERP, but I didn't find the time. Send me mail if you're interested and I'll mail you something if I ever get around to documenting that aspect of WINTERP. > Are winterp lisp functions only capable of calling other > winterp lisp functions, or can I build a library of 'C' > callbacks that are called by winterp lisp functions? Winterp lisp functions can call other lisp-implemented functions, or they can call C-implemented functions. Similarly, methods for particular object classes can be implemented in C or in Lisp. You can then call these C-implemented lisp primitives via callbacks (XtAddCallback()), event handlers (XtAdd{Raw}Eventhandler()), and timeouts (XtAddTimeout()) . I've even provided a special ActionProc "Lisp()" which will allow you to call the lisp evaluator through translation and accelerator tables (it's lotsa fun)... -- Niels Mayer Hewlett-Packard Laboratories Human-Computer Interaction Department. PS: If anybody sends e-mail questions about WINTERP, be forewarned that I will not be able to answer e-mail until after the first week of January -- I will be on vacation, and I'm leaving tonight.