Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!portal!fernwood!franz!layer From: layer@Franz.COM (Kevin Layer) Newsgroups: comp.sys.next Subject: Re: Allegro CL on NeXT Message-ID: Date: 21 Mar 91 18:15:08 GMT References: <210@gouche.UUCP> Sender: news@Franz.COM Organization: Franz Inc., Berkeley, CA Lines: 135 In-reply-to: grant@gouche.UUCP's message of 19 Mar 91 16:48:03 GMT In article <210@gouche.UUCP> grant@gouche.UUCP (Grant Munsey) writes: Is the complete version of Allegro 3.1 for Next 2.0 shipping? Does it have any hooks into NIB/Objective C. While you want a user's testimony of Allegro CL on the NeXT, I can add that ACL on the NeXT is complete with respect to ACL 3.1 available on other machines. In addition to being complete, there are some nice additional features of ACL on the NeXT: 1. Due to Mach, running an image created dumplisp (saving the running image to disk for later execution in the "same" state) is particularly efficient at start because we use the memory mapping features of the Mach-O (object) file format. On non-Mach systems we must "shuffle" parts of the heap to their final location instead of having them mapped there from the object file itself. 2. Also due to Mach, a foreign file can be reloaded without removing the entry points that clash. So, (load "foo.o") (load "foo.o") will "unmap" foo.o before the second load. 3. There is an interface to Objective-C, which offers the ability to dynamically load Objective-C object files into ACL and to define Objective-C classes and methods. Below is an example application, which creates a window that reads expressions from the users, evaluates the results and prints the *Lisp* results. There is a `nib' file which is not included here (it is on the Allegro CL distribution, however). ;; Evaluator ;; A very simple class and set of method definitions which demonstrates ;; the high interactiveness between lisp and an interface built by the ;; interface builder. ;; Written by Charley Cox, Franz Inc. Aug, 1989 ;; ;; When this file is loaded into lisp, a window with two text forms, ;; a button, and a sample form cell is brought up. One can type ;; forms into the input form, and see what lisp returns through the ;; output form. The output form is not bound to *standard-output*. ;; Thus, *standard-output* will, by default, be the terminal running lisp. ;; ;; Hitting return in the input form is equivalent to clicking on the ;; button (this example is heavily inspired by the sample ;; project in the NeXT chapter on using the interface builder). ;; ;; Some things to play with are to see what happens when you type the ;; following things into lisp: ;; self ;; (break) ;; This enters a lisp break loop--to continue with the ;; ;; application, type `:cont' to the lisp. Do not type ;; ;; `:res' or (reset) since that throws you out of the ;; ;; application. ;; ;; The following (print-* ...) functions will print to standard output ;; and not to the display window. ;; ;; (print-class-ivars (send self "class")) ;; ;; This should print out the three outlets that were designed ;; ;; by the interface builder. They are outputForm, inputForm, ;; ;; and testForm. testForm is for the TestForm Cell. ;; (print-class-methods (send (iv "testForm") "class")) ;; ;; This prints the methods available to the TestForm Cell. ;; ;; One of these methods should be `setEnabled:'. ;; (send (iv "testForm") "setEnabled=" 0) ;; ;; This `dims' the test form cell. Calling "setEnabled=" ;; ;; with argument 1, restores it. ;; (send (iv "testForm") "setStringValue=" (string-to-char* "Hello, There")) ;; ;; This displays the string in TestForm's window. ;; $aclHeader: Evaluator.cl,v 1.1 89/08/28 18:51:30 layer Exp Locker: layer $ (in-package :evaluator) (require :objc) (require :foreign) (use-package :excl) (use-package :objc) (use-package :appkit) (use-package :foreign-functions) (def-objc-class Evaluator (Object) ((outputForm :type :id) (inputForm :type :id) (testForm :type :id))) (def-objc-method (setOutputForm= Evaluator :id) ((anObject :id)) (setf (iv "outputForm") anObject) self) (def-objc-method (setInputForm= Evaluator :id) ((anObject :id)) (setf (iv "inputForm") anObject) self) (def-objc-method (setTestForm= Evaluator :id) ((anObject :id)) (setf (iv "testForm") anObject) self) (def-objc-method (eval= Evaluator :id) ((sender :id)) (let* ((raw-input-string (send (iv "inputForm") "stringValue")) (input-string (char*-to-string raw-input-string))) (send (iv "inputForm") "selectText=" sender) (send (iv "outputForm") "setStringValue=" (string-to-char* (write-to-string (eval (read-from-string input-string))))))) (format t "Starting application...~%") (format t "making application...") (force-output) (make-application "eval") (format t "loading nib file...") (force-output) (send NXApp "loadNibFile=owner=" (namestring (merge-pathnames "objc/Evaluator.nib" excl::*library-pathname*)) NXApp) (format t "running...") (run-application) (format t "done~%") -- Kevin Layer, Franz Inc. 1995 University Avenue, Suite 275 layer@Franz.COM (internet) Berkeley, CA 94704 uunet!franz!layer (uucp) Phone: (415) 548-3600; FAX: (415) 548-8253