[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do I write top level function?



> 
> Could someone show me the good example of toplevel function which, at
> least, co-work with evaluation facilities provided by fred window?
> 
> **************************************
> Yasuaki Honda
> honda@csl.sony.co.jp
> SONY Computer Science Laboratory Inc.
> **************************************
> 
The following top-level function will let you do evaluation from fred
buffers.  It makes use of functionality provided by the MACL developers.
I have not tested this extensively so there may be other problems, but
it will at least let you do eval-enqueues (which appears to be the
mechanism used by fred windows to force evaluation of expressions).
Hope this helps.  Paul Krueger (plkrueger@serc.3m.com)

(defun simple-toplevel ()
  (setq +++ nil)
  (setq ++ nil)
  (setq + nil)
  (setq *** nil)
  (setq ** nil)
  (setq * nil)
  (setq --- nil)
  (setq -- nil)
  (setq - nil)
  (setq /// nil)
  (setq // nil)
  (setq / nil)
  (loop
    (catch :abort
      (let* ((new-form (ask *terminal-io*
                         (ccl::get-next-form)))
	     (result (eval new-form)))
	(if (eql :quit result)
	  (return-from simple-toplevel)
	  (print result))))))