[Openmcl-devel] two ccl11 issues

Shannon Spires svs at bearlanding.com
Fri Sep 30 09:17:05 PDT 2016


On Sep 30, 2016, at 9:03 AM, Arthur Cater <arthur.cater at ucd.ie> wrote:

> Hi, I’m trying to move over to Darwin CCL 11   from Darwin CCL 10.
> I’m using a mid-2015 MacBook Pro with OS X El Capitan 10.11.5.
> I started lisp in Terminal with   ./dx86cl64 —no-init
> and then said    (require “COCOA”)
> 
> The first issue I want to mention is that, while preparing for the mention of
> the second issue, I had a once-off weirdness as this screenshot shows:
> 
> The second is that my macro for writing messages to the listener window
> misbehaves when used in the gui (main) thread. Here’s evidence:
> lisp was started again, successfullyb this time, as described above, and code
> was pasted into the listener window, and then three functions called in turn.
> The one where the gui thread is used to execute the form produces no output.
> In ccl10 there was no such problem with a very similar WRITEOUT macro, I’ve
> simplified it very slightly for presentation here.
> 
> Welcome to Clozure Common Lisp Version 1.11-r16635  (DarwinX8664)!
> ? (in-package :cl-user)
> 
> (defmacro writeout (msg &rest args)
>  (let ((p (gensym)))
>    `(let ((,p (find 'gui::cocoa-listener-process (ccl::all-processes) :key #'type-of)))
>       (if ,p
>           (format (gui::cocoa-listener-process-output-stream ,p) ,msg , at args)))))
> 
> (defun test-in-listener ()
>  (writeout "~%Writing in the listener.~%"))
> 
> (defun test-in-main ()
>  (gui::execute-in-gui (lambda () (writeout "~&Writing in the gui.~%"))))
> 
> (defun test-in-another ()
>  (ccl::process-run-function "A new process"
>    (lambda () (writeout "~&Writing in a new process.~%")))
>  (sleep 1))
> 
> #<Package "COMMON-LISP-USER">
> ? 
> WRITEOUT
> ? 
> TEST-IN-LISTENER
> ? 
> TEST-IN-MAIN
> ? 
> TEST-IN-ANOTHER
> ? ;;; The above was copied from a file and pasted into the listener all at once
> ;;; Now to test. Get a prompt ...
> t
> T
> ? (test-in-listener)
> 
> Writing in the listener.
> NIL
> ? (test-in-main)
> NIL
> ? (test-in-another)
> Writing in a new process.
> NIL
> ? 
> 
> — end of quoted output, resumption of email text —
> 
> The SLEEP btw is there just to avoid intermingling of the text output and the
> function result, which otherwise is a process.
> 
> I can work around this by changing my WRITEOUT macro to always use a new
> process to write its output, but this seems very heavyweight. I don’t understand
> what’s changed in CCL to make the behaviour different from CCL10.
> 
> Help would be appreciated, as always!
> 
> Arthur

This was because of http://trac.clozure.com/ccl/changeset/16524 and it was fixed in http://trac.clozure.com/ccl/changeset/16526.
To take advantage of the fix, change your definitions as follows:

(defmacro writeout (msg &rest args)
  `(hi::with-output-to-listener
       (format *standard-output* ,msg , at args)))

(defun test-in-main ()
 (gui::execute-in-gui (lambda () (writeout "~%Writing in the gui.~%"))))

Note the change from ~& to ~% in #'test-in-main. It's not clear that ~& knows what it's doing in the listener.

-SS




More information about the Openmcl-devel mailing list