z_axis | 8 Feb 01:09
Favicon

Some problem on freebsd

hi, friends
The CCL runs great on my Archlinux box but not on my FreeBSD box.

> uname -a
FreeBSD mybsd.zsoft.com 8.2-RELEASE FreeBSD 8.2-RELEASE #3: Fri Sep 30  
15:23:56 CST 2011
root <at> mybsd.zsoft.com:/media/G/usr/obj/media/G/usr/src/sys/MYKERNEL  i386

? (sys-info)
Machine: "i386" "AMD Athlon(tm) 64 X2 Dual Core Processor 3600+"  
"mybsd.zsoft.com"
OS: "FreeBSD" "8.2-RELEASE"
Lisp: "Clozure Common Lisp" "Version 1.7  (FreebsdX8632)"

? (ql:quickload "hunchentoot")
To load "hunchentoot":
Load 1 ASDF system:
hunchentoot
; Loading "hunchentoot"
> Error: Unable to load any of the alternatives:
>           ("libssl.so.0.9.8" "libssl.so" "libssl.so.4")
> While executing: CFFI::FL-ERROR, in process listener(1).?

? (ql:quickload "elephant")
To load "elephant":
Load 1 ASDF system:
elephant
; Loading "elephant"
Attempting to load libmemutil.so...
> Error: value #<A Foreign Pointer #x280B4000> is not of the expected type  
(Continue reading)

Antony | 7 Feb 15:14
Picon
Gravatar

ccl64 freebsd64 hunchentoot segfault

Hi

I have been developing CL with CCL under Linux.
 From the point of intereacting with stuff outside CL, I basically use 
cl-postgres for db and hunchentoot (and required dependencies) for https.
Things seem to work fine in this world.

I wanted to try out FreeBSD (cause I am a bit worried about going to 
production with Linux as my only choice)
It works, but under testing (that's a bit loaded) it segfaults 
(basically in the context of a serving a https request)
All I get in the repl is
Segmentation fault (core dumped)

System info is
uname -a
gives
FreeBSD 9.0-RELEASE #0: Tue Jan  3 07:46:30 UTC 2012     
root <at> farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64

Clozure Common Lisp Version 1.7-r15199M  (FreebsdX8664)

It's hard to give version info for all the libs, but I had recently 
(less than two months) updated most of them
The code is identical (since it's a shred folder) across my Linux and bsd.
Both Linux and bsd are actually under VirtualBox inside a Win 7. 
Everything is 64bit. bsd is assigned one cpu (not sure if any of this 
matters)

Do others use this combo successfully?
(Continue reading)

Xiaofeng Yang | 6 Feb 12:25
Picon

the value of constant `lambda-list-keywords' changed after sort/stable-sort

This problem can also be found at version 1.7. If I apply `sort' to `lambda-list-keywords', the result is the same as below.
Is this a bug ?

Welcome to Clozure Common Lisp Version 1.8-dev-r14962-trunk  (WindowsX8632)!
? (lisp-implementation-version)
"Version 1.8-dev-r14962-trunk  (WindowsX8632)"
? lambda-list-keywords
(&OPTIONAL &REST &AUX &KEY &ALLOW-OTHER-KEYS &BODY &ENVIRONMENT &WHOLE)
? (stable-sort lambda-list-keywords
             #'(lambda (a b)
                 (string<= (symbol-name a) (symbol-name b))))
(&ALLOW-OTHER-KEYS &AUX &BODY &ENVIRONMENT &KEY &OPTIONAL &REST &WHOLE)
? lambda-list-keywords
(&OPTIONAL &REST &WHOLE)
? (stable-sort lambda-list-keywords
             #'(lambda (a b)
                 (string<= (symbol-name a) (symbol-name b))))
(&OPTIONAL &REST &WHOLE)
?


     Best regards,
Xiaofeng Yang
_______________________________________________
Openmcl-devel mailing list
Openmcl-devel <at> clozure.com
http://clozure.com/mailman/listinfo/openmcl-devel
Gary Byers | 1 Feb 21:05
Favicon

Re: Clozure CL on Android


On Wed, 1 Feb 2012, Roman Kovalev wrote:

> Thanks for the quick response.
>
>>> 1. I transferred Android-headers to the device and tried to run
>>> rebuild-ccl:
>>> Error: File #P"ccl:lib;systems.lisp.newest" not found.
>>> Sources needed?
>>
>>
>> Yes, ...
> From http://article.gmane.org/gmane.lisp.openmcl.devel/7511 :
> "get CCL sources onto the device (you can use
> "adb push".)  There's a basic set of interfaces in svn at
> http://svn.clozure.com/publicsvn/openmcl/trunk/android-headers
> and if you copy them to /data/local/ccl/android-headers you should be
> able to use #_/#$ and do
> ? (rebuild-ccl :clean t)"
>
> Which sources are needed?
> ? only http://svn.clozure.com/publicsvn/openmcl/trunk/android-headers
> ? http://svn.clozure.com/publicsvn/openmcl/trunk/source/compiler/ARM

On a Mac, the device is mounted at /Volumes/NO\ NAME/, so:

$ cd /Volumes/NO\ NAME
$ svn co http://svn.clozure.com/publicsvn/openmcl/trunk/androidarm/ccl

will check out all sources and androidarm-specific binaries, analogous
to what checking out a similar platform-specific URL does for other
platforms.  Getting the android-headers directory this way may be
more convenient than "adb push"ing them from the host device.  Getting
an androidarm-specific kernel and image this way isn't very useful, because
(a) whatever's in svn isn't likely to be up-to-date and (b) you can't run
executable code off of the sdcard on Android.

Unmount the device and connect to it via "adb shell".  The disk or partition
that had been mounted on the Mac (or whatever) will probably be at /sdcard
and/or /mnt/sdcard; there should be a shiny new ccl directory there.  Make
symbolic links from the toplevel subdirectories of /sdcard/ccl to /data/local/ccl.

If you don't understand what you're doing here, don't bother.  It's
possible that someday there'll be a less kludgy way to install CCL on
an Android and it'd probably make sense to wait for that.

> ? ...
>
>> If you type
>> ? #$FIONREAD
>
> result: 21531
>
>> If you can get the reader macro to return a value, that package will have at least
>> one symbol in it.
>
> Why is the result of expression - an empty list?
> expression: (do-external-symbols (s (find-package "ARM-ANDROID")) (print s))

Because you're looking for external (exported) symbols in a a package that
doesn't have any external symbols in it ?

Why you're interested in these symbols at all is beyond me, but you'd find
some symbols if you used DO-SYMBOLS instead of DO-EXTERNAL-SYMBOLS.

>
>>> 3. Is it possible to using android's graphic and other (java)libraries
>>> with ccl now?
>>
>> No, but that's obiously desirable.
>
> Does anyone working on this?
>
>>> 4. In that compiles aarmc as a result?
>>
>> I don't understand.
>
> CCL running on Dalvik or what?
>

What.  CCL doesn't "run on" any Java virtual machine.

Like other native applications, it can use the Java Native Interface (JNI)
to communicate with a JVM; if it did this on Android, it would be communicating
with Android's Dalvik JVM, but the only way to know this would be the fact
that some things in the JNI (whatever Google didn't bother to implement) would
be missing.

The JNI tries to abstract away some of the details of the JVM, but it's still
incredibly low-level and hard to deal with; it'd certainly be desirable to
deal with Java at a somewhat higher level.  I'm personally still trying to
understand what's possible, and it'll probably take a while (and may take
several iterations) before anything is really usable.
Arthur Cater | 1 Feb 16:36
Picon
Favicon
Gravatar

format to a

I am having trouble with cursor position in a programmatic Hemlock view.
The attached (also enclosed) code makes a Hemlock view, creates a stream
to write to it, and writes a few lines using format.

Attachment (unclickable.lisp): application/octet-stream, 1389 bytes

Clicking in this view makes the insertion-point cursor blink where you clicked,
but then trying to move the cursor using arrow keys reveals the insertion
point is really still at the end of the buffer.

I don't think my code does anything naughty. Perhaps there is something it
ought to do nice?

Arthur

Welcome to Clozure Common Lisp Version 1.7-r15184M  (DarwinX8664)!

(in-package hemlock)

; --------------------------------------------------------------------------------
; Redefine methods given in ccl:cocoa-ide;hemlock;src;streams.lisp merely
; to ensure that hemlock buffer modification is done in the proper thread
; --------------------------------------------------------------------------------

(defmethod hi::stream-write-char ((stream hi::hemlock-output-stream) char)
  (gui::execute-in-gui
   (lambda nil
     (gui::assume-cocoa-thread)
     (funcall (hi::old-lisp-stream-out stream) stream char))))

(defmethod hi::stream-write-string ((stream hi::hemlock-output-stream) string
                                &optional
                                (start 0)
                                (end (length string)))
  (gui::execute-in-gui
   (lambda nil
     (gui::assume-cocoa-thread)
     (funcall (hi::old-lisp-stream-sout stream) stream string start end))))

(defun cl-user::myview (nlines)
  (gui::execute-in-gui   ; Makes the view
   #'(lambda nil
       (let* ((ccl::*default-file-character-encoding* :utf-8)
              (view (gui::find-or-make-hemlock-view nil))
              (buffer (hemlock-view-buffer view))
              (stream (hi:make-hemlock-output-stream (buffer-start-mark buffer) :none)))
         (dotimes (num nlines) (format stream "Line ~a is here~%" num))))))

(cl-user::myview 7)

_______________________________________________
Openmcl-devel mailing list
Openmcl-devel <at> clozure.com
http://clozure.com/mailman/listinfo/openmcl-devel
Marco Antoniotti | 1 Feb 14:15
Picon

ELS 2012, Zadar, Croatia

Apologies for the multiple postings. 

PAPER SUBMISSION DEADLINE EXTENDED 

European Lisp Symposium 2012, Zadar, Croatia, April 30th - May 1st, 2012 

http://european-lisp-symposium.org 

The purpose of the European Lisp Symposium is to provide a forum for 
the discussion and dissemination of all aspects of design, 
implementation and application of any of the Lisp and Lisp-inspired 
dialects, including Common Lisp, Scheme, Emacs Lisp, AutoLisp, ISLISP, 
Dylan, Clojure, ACL2, ECMAScript, Racket, SKILL, and so on. We 
encourage everyone interested in Lisp to participate. 

The main theme of the 2012 European Lisp Conference is 
"Interoperability: Systems, Libraries, Workflows".  Lisp based and 
functional-languages based systems have grown a variety of solutions 
to become more and more integrated with the wider world of Information 
and Communication Technologies in current use.  There are several 
dimensions to the scope of the solutions proposed, ranging from 
"embedding" of interpreters in C-based systems, to the development of 
abstractions levels that facilitate the expression of complex context 
dependent tasks, to the construction of exchange formats handling 
libraries, to the construction of theorem-provers for the "Semantic 
Web".  The European Lisp Symposium 2012 solicits the submission of 
papers with this specific theme in mind, alongside the more 
traditional tracks which have appeared in the past editions. 

We invite submissions in the following forms: 

Papers: Technical papers of up to 15 pages that describe original 
results or explain known ideas in new and elegant ways. 

Demonstrations: Abstracts of up to 4 pages for demonstrations of 
tools, libraries, and applications. 

Tutorials: Abstracts of up to 4 pages for in-depth presentations about 
topics of special interest for at least 90 minutes and up to 180 
minutes. 

Lightning talks: Abstracts of up to one page for talks to last for no 
more than 5 minutes. 

All submissions should be formatted following the ACM SIGS guidelines 
and include ACM classification categories and terms. For more 
information on the submission guidelines and the ACM keywords, see: 
http://www.acm.org/sigs/publications/proceedings-templates and 
http://www.acm.org/about/class/1998. 

Important dates: 

February 15th 2012: submission deadline (extended deadline) 
March 7th 2012: acceptance results 

April 30th 2012: Conference opens 

Program Commitee. 
Chair: 
Marco Antoniotti, Università degli Studi di Milano Bicocca, Milan, ITALY 

Local organizers: 
Damir Cavar, Eastern Michigan University 
Franjo Pehar, University of Zadar 
Damir Kero, University of Zadar 

Members: 
Giuseppe Attardi, Università degli Studi di Pisa, Pisa, ITALY 
Pascal Costanza, Intel, Bruxelles, BELGIUM 
Marc Feeley, Université de Montreal, Montreal, CANADA 
Scott McKay, Google, U.S.A. 
Kent Pitman, U.S.A. 
Christophe Rhodes, Department of Computing, Goldsmiths, University of London, London, UNITED KINGDOM 
Robert Strandh, LABRI, Université de Bordeaux, Bordaux, FRANCE 
Didier Verna, EPITA / LRDE, FRANCE 
Taiichi Yuasa, Kyoto University, JAPAN

--
Marco Antoniotti
Roman Kovalev | 31 Jan 23:27
Picon
Gravatar

Clozure CL on Android

CCL is now working on my Android and I have some questions.

1. I transferred Android-headers to the device and tried to run rebuild-ccl:
Error: File #P"ccl:lib;systems.lisp.newest" not found.
Sources needed?

2. I ran the following code.
(do-external-symbols (s (find-package "ARM-ANDROID")) (print s))

And the output list is empty. Situation will change after a rebuilding CCL?

3. Is it possible to using android's graphic and other (java)libraries
with ccl now?

4. In that compiles aarmc as a result?
Arthur Cater | 28 Jan 17:57
Picon
Favicon
Gravatar

Fwd: How does Hemlock ...



Begin forwarded message:

From: Arthur Cater <arthur.cater <at> ucd.ie>
Date: 28 January 2012 12:23:56 GMT
To: Glen Foy <lisp <at> clairvaux.org>
Subject: Re: [Openmcl-devel] How does Hemlock ...

Thank you Glen for that help. I've adapted it for my use by using the
buffer-plist instead of parameter *process-down-mouse-p* and instead of
rebinding the #k"LeftDown". It works now for the single-line case but not
for the multi-line case. I think my claim that the invocation happens after
mouse-up was wrong, the result of my code switching attention to another
buffer - the listener's - in order to be seen to do something.

So my problems a,b,c seem fixed, but not d.

I still don't understand how the buffer-point gets to be set in the first place,
nor why what I was doing previously caused it to be set only belatedly.
And I like to understand.

Arthur


On 27 Jan 2012, at 01:19, Glen Foy wrote:

Arthur,

This is ugly as sin, but it will respond to left-down-mouse,  and it will read point after it has been set to the new click position.  There may be a cleaner way to do this (surely there is), but I couldn't find it:

-- Glen

(defConstant *left-mouse-down* 65535)
(defParameter *process-down-mouse-p* nil)

;;; Redefintion of a Hemlock method in cocoa-editor.lisp
(defMethod hi::handle-hemlock-event :around ((view hi:hemlock-view) event)
(ccl::with-autorelease-pool
    (call-next-method))
(let ((keysym (when (typep event 'hi::key-event) (hi::key-event-keysym event))))
  (when (and (numberp keysym) (= keysym *left-mouse-down*))
    (setf *process-down-mouse-p* t))))

(defmethod gui::compute-temporary-attributes :around ((self gui::hemlock-textstorage-text-view))
(call-next-method)
(when *process-down-mouse-p*
  (let* ((view (gui::hemlock-view self))
         (hi::*current-buffer* (hi::hemlock-view-buffer view))
         (point (hi::current-point))
         (line (when point (hi::mark-line point)))
         (pos (when point (hi::mark-charpos point))))
    (format t "~%~%line: ~S" line)
    (format t "~%pos: ~S" pos))
  (setq *process-down-mouse-p* nil)))


On Jan 26, 2012, at 5:52 AM, Arthur Cater wrote:

I'm looking for some help because I'm floundering in trying to program Hemlock.
I'm using a MacBook Pro, OS 10.6.8, ClozureCL Version 1.7-r15184M  (DarwinX8664)

What I'm trying to do is write a format directive that gives a behaviour rather like
hyperlinks when used on a customised Hemlock view: text should be highlighted
(underlined and printed in red) and clicking on it should invoke the function of choice.

I can get the red and underlining, and get a function invoked. But

a) the invocation of the function happens on mouse-up rather than mouse-down

b) the invocation does happen on mouse-downwhen in the minibuffer

c) when there is just one line of text with no terminating newline, the current-point
 of the buffer seems to correspond to the previous mouse-down-up sequence
 rather than the current one

d) when there are many lines of text with a terminating newline, the current-point
 stubbornly stays at buffer end.


I have searched the Hemlock sources for various things, but I do not understand
how a mouse-click gets to move the buffer's buffer-point. Please can somebody
explain to me how that is done, or tell me where to look more carefully?


Below, if anyone cares to look, is the code I have. It will create a hemlock view,
if in the listener you type (hemlock::two) you will see a line of text with two words
in red and underlined. Clicking on them - or elsewhere - causes informative messages
to be written to the listener.  If you close the window, make a new one with
(hemlock::my) and (hemlock::twentytwo) you see many lines of text each with one
word red and underlined. I must be doing something wrong :( and would gratefully
receive advice.

(I am aware of difficulties ahead, eg interaction with justification directives. I'm
not too concerned with those at the moment because I'm trying to build a tool to
help with examining datastructures in an application I'm building.)

Thanks in advance for any help I get!
Arthur



(in-package hemlock)

(defmacro do-objc-array ((itemvar arrayexpr) &body body)
"Perform BODY with ITEMVAR bound to successive elements of the ObjC array which
is value of ARRAYEXPR, while allowing for the possibility it is a null pointer."
(let ((arrayvar (gensym)) (countvar (gensym)) (indexvar (gensym)))
 `(let ((,arrayvar ,arrayexpr))
    (unless (ccl::%null-ptr-p ,arrayvar)
      (let ((,countvar (#/count ,arrayvar)))
        (dotimes (,indexvar ,countvar)
          (let ((,itemvar (#/objectAtIndex: ,arrayvar ,indexvar))) , <at> body)))))))

(defmacro write-listener (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)))))


(defmethod gui::compute-temporary-attributes ((self gui::hemlock-textstorage-text-view))
nil)

(defparameter *my* nil "Gets set to a hemlock-view")

(defparameter *mystream* nil "Gets set to an output stream for the hemlock-view in *MY*")

(defparameter *click-color* nil)

(defparameter *underlinedict* nil "Gets set to a ns-mutable-dictionary")

(defparameter *info* nil "Accumulates some debug info")

(defun underlinedict nil "Makes or reuses a ns-mutable-dictionary"
(or *underlinedict*
   (prog1
    (setf *underlinedict*
          (make-instance 'ns:ns-mutable-dictionary :with-capacity 2))
    (setf *click-color* (#/colorWithCalibratedRed:green:blue:alpha: ns:ns-color 1.0 0.2 0.2 1.0))
    (#/setObject:forKey: *underlinedict* (#/numberWithInt: ns:ns-number 1)
                         #&NSUnderlineStyleAttributeName)
    (#/setObject:forKey: *underlinedict* *click-color*
                         #&NSForegroundColorAttributeName))))

(defcommand "Invoke Click Response" (p) "Responds to 'CLICKABLE' text by invoking its associated function."
(declare (ignore p))
;(write-listener "Invoking...~%")
(gui::execute-in-gui
(lambda nil
  (gui::assume-cocoa-thread)
  (let* ((point (current-point))
         (line (mark-line point))
         (pos (mark-charpos point))
         (pchange (find pos (slot-value line 'hi::charprops-changes) :from-end t :test #'>= :key #'hi::charprops-change-index))
         (props (when pchange (hi::charprops-change-plist pchange))))
    (write-listener "point=~s~%line=~s~%pos=~s~%LastKeyEvent=~s~%" point line pos (last-key-event-typed))
    (when (and props (<= pos (+ (getf props :length) (hi::charprops-change-index pchange))))
      (write-listener "props are ~s, fn is ~s, arg is ~s~%"
                      props (getf props :clickfunction) (getf props :argument)))))))

(defun my ()
(gui::execute-in-gui   ; Makes the view
#'(lambda nil
    (setf hemlock::*my* (gui::find-or-make-hemlock-view nil))
    (let ((buffer (hemlock-view-buffer hemlock::*my*)))
      (underlinedict)
      (bind-key "Invoke Click Response" #k"LeftDown" :buffer buffer)
      (setf *mystream* (hi:make-hemlock-output-stream (buffer-start-mark buffer) :none)) ))))

(my)

(defun open-hemlock-output-stream-p (stream)
(and (typep stream 'hemlock::hemlock-output-stream)
    (slot-value stream 'hi::mark)
    t))

; --------------------------------------------------------------------------------
; Redefine methods given in ccl:cocoa-ide;hemlock;src;streams.lisp
; to ensure that hemlock buffer modification is done in the proper thread
; --------------------------------------------------------------------------------

(defmethod hi::stream-write-char ((stream hi::hemlock-output-stream) char)
(gui::execute-in-gui
(lambda nil
  (gui::assume-cocoa-thread)
  (funcall (hi::old-lisp-stream-out stream) stream char))))

(defmethod hi::stream-write-string ((stream hi::hemlock-output-stream) string
                             &optional
                             (start 0)
                             (end (length string)))
(gui::execute-in-gui
(lambda nil
  (gui::assume-cocoa-thread)
  (funcall (hi::old-lisp-stream-sout stream) stream string start end))))

; --------------------------------------------------------------------------------
; The ~V/CLICKABLE/ format directive
; Consumes one or two arguments from the format args list
; The principal argument is something to be output to the stream.
; By default it is printed as if by PRINC (~A), but the colon modifier causes it
; to be printed as if by PRIN1 (~S).
; The prefix argument (corresponding to V) should be a function of one argument
; or a symbol naming one.
; - If the stream is a hemlock-output-stream that has not been closed, then the
;   text produced for the principal argument will be mouse-sensitive. Clicking on
;   it will cause the function to be invoked with the argument that was printed.
; - On other streams, the prefix argument will be consumed but ignored.
; - If the V prefix is omitted, then no function will be invoked by clicking.
; --------------------------------------------------------------------------------

(defun clickable (stream arg colon atsign &optional prefix)
(declare (ignorable atsign))
(cond
((open-hemlock-output-stream-p stream)
 (let* ((mark (hi:copy-mark (slot-value stream 'hi::mark) :temporary))
        (markabsolute (hi::mark-absolute-position mark))
        (line (slot-value mark 'hi::line))
        (charprops (when prefix `(:font-underline :single :font-color ,*click-color*
                                  :clickfunction ,prefix  :argument ,arg)))
        (start (when charprops (slot-value mark 'hi::charpos)))
        end)
   (if colon (prin1 arg stream) (princ arg stream))
   (when charprops
     (let* ((length (- (hi::mark-absolute-position (slot-value stream 'hi::mark)) markabsolute))
            (doc (hi::buffer-document (line-buffer line)))
            (store (when doc (slot-value doc 'gui::textstorage))))
       (setf end (slot-value (slot-value stream 'hi::mark) 'hi::charpos))
       (setf *info* `(:start ,start :end ,end))
       (hi::set-line-charprops line (list* :length length charprops) :start start :end end)
       (when doc
         (do-objc-array (layout (#/layoutManagers store))
           (ns:with-ns-range (range markabsolute length)
             (#/addTemporaryAttributes:forCharacterRange: layout (underlinedict) range))))
       (gui::perform-edit-change-notification
        store
        (objc:\ <at> selector #/noteHemlockAttrChangeAtPosition:length:)
        markabsolute length 0)
       (setf *info* `(:changes ,(hi::line-charprops-changes line) , <at> *info*))))))
(t (if colon (prin1 arg stream) (princ arg stream)))))

(defun twentytwo nil
(dotimes (k 22)
 (format *mystream*
         "Try ~v/hemlock::clickable/ out.~%" :that (format nil "~5,'xD" k))))

(defun two nil
(format *mystream*
       "Try ~v/hemlock::clickable/ or ~v/hemlock::clickable/ now."
       :first :one :second :two))

_______________________________________________
Openmcl-devel mailing list
Openmcl-devel <at> clozure.com
http://clozure.com/mailman/listinfo/openmcl-devel



_______________________________________________
Openmcl-devel mailing list
Openmcl-devel <at> clozure.com
http://clozure.com/mailman/listinfo/openmcl-devel
Raffael Cavallaro | 27 Jan 16:57
Picon
Gravatar

*read-default-float-format* in IDE

No matter what I do, I can't seem to save a 64-bit Cocoa IDE application where *read-default-float-format*
is anything other than single-float. Ideally, I like to set it to ns:cg-float so that both 32 and 64 bit
cocoa lisps read the proper format (as you know, CGFloat is 32 bits on 32-bit systems and 64 bits on 64-bit systems)

Even something as simple as this in a 64-bit cocoa IDE fails:

Welcome to Clozure Common Lisp Version 1.8-dev-r15184M-trunk  (DarwinX8664)!
? *read-default-float-format*
SINGLE-FLOAT
? (type-of 2.0)
SINGLE-FLOAT
? (setf *read-default-float-format* 'ns:cg-float)
NS:CG-FLOAT
? *read-default-float-format*
NS:CG-FLOAT
? (type-of 2.0)
DOUBLE-FLOAT
? ;; so far so good...
(require 'build-application)
;Compiler warnings for "/Users/raffaelc/ccl/cocoa-ide/builder-utilities.lisp" :
;   In MAKE-DOCTYPE-DICT: Unused lexical variable EXPORTABLE-AS
;Compiler warnings for "/Users/raffaelc/ccl/cocoa-ide/builder-utilities.lisp" :
;   In MAKE-DOCTYPE-DICT: Unused lexical variable BUNDLEP
;Compiler warnings for "/Users/raffaelc/ccl/cocoa-ide/builder-utilities.lisp" :
;   In MAKE-DOCTYPE-DICT: Unused lexical variable ICON-FILE
BUILD-APPLICATION
("BUILDER-UTILITIES" "BUILD-APPLICATION")
? (ccl::build-application
   :directory "/Users/raffaelc/ccl/"
   :name "Clozure CL64 test")

But launching Clozure CL64 test yields:

Welcome to Clozure Common Lisp Version 1.8-dev-r15184M-trunk  (DarwinX8664)!
? *read-default-float-format*
SINGLE-FLOAT

Wrapping the ccl:build-application form in the appropriate let doesn't work either. Neither does
setting *read-default-float-format* in my ide init file (which I can verify is otherwise being loaded).

What am I missing?

Raffael Cavallaro
raffaelcavallaro <at> me.com
Marco Antoniotti | 23 Jan 12:15
Picon
Gravatar

ELS2012 Zadar, Croatia, Call for Papers

Apologies for the multiple postings...

===========================================================================

European Lisp Symposium 2012, Zadar, Croatia, April 30th - May 1st, 2012
http://european-lisp-symposium.org

The purpose of the European Lisp Symposium is to provide a forum for
the discussion and dissemination of all aspects of design,
implementation and application of any of the Lisp and Lisp-inspired
dialects, including Common Lisp, Scheme, Emacs Lisp, AutoLisp, ISLISP,
Dylan, Clojure, ACL2, ECMAScript, Racket, SKILL, and so on. We
encourage everyone interested in Lisp to participate.

The main theme of the 2012 European Lisp Conference is
"Interoperabilty: Systems, Libraries, Workflows".  Lisp based and
functional-languages based systems have grown a variety of solutions
to become more and more integrated with the wider world of Information
and Communication Technologies in current use.  There are several
dimensions to the scope of the solutions proposed, ranging from
"embedding" of interpreters in C-based systems, to the development of
abstractions levels that facilitate the expression of complex context
dependent tasks, to the construction of exchange formats handling
libraries, to the construction of theorem-provers for the "Semantic
Web".  The European Lisp Symposium 2012 solicits the submission of
papers with this specific theme in mind, alongside the more
traditional tracks which have appeared in the past editions.

We invite submissions in the following forms:

Papers: Technical papers of up to 15 pages that describe original
results or explain known ideas in new and elegant ways.

Demonstrations: Abstracts of up to 4 pages for demonstrations of
tools, libraries, and applications.

Tutorials: Abstracts of up to 4 pages for in-depth presentations about
topics of special interest for at least 90 minutes and up to 180
minutes.

Lightning talks: Abstracts of up to one page for talks to last for no
more than 5 minutes.

All submissions should be formatted following the ACM SIGS guidelines
and include ACM classification categories and terms. For more
information on the submission guidelines and the ACM keywords, see:
http://www.acm.org/sigs/publications/proceedings-templates and
http://www.acm.org/about/class/1998.

Important dates:

Jan 31st 2012: submission deadline
Feb 21st 2012: acceptance results

April 30th, 2012 Conference opens

Program Commitee.
Chair:
Marco Antoniotti, Università degli Studi di Milano Bicocca, Milan, ITALY

Local organizers:
Damir Ćavar, Eastern Michigan University
Franjo Pehar, University of Zadar
Damir Kero, University of Zadar

Members:
Giuseppe Attardi, Università degli Studi di Pisa, Pisa, ITALY
Pascal Costanza, Intel, Bruxelles, BELGIUM
Marc Feeley, Université de Montreal, Montreal, CANADA
Scott McKay, Google, U.S.A.
Kent Pitman, U.S.A.
Christophe Rhodes, Department of Computing, Goldsmiths, University of London, London, UNITED KINGDOM
Robert Strandh, LABRI, Université de Bordeaux, Bordaux, FRANCE
Didier Verna, EPITA / LRDE, FRANCE
Taiichi Yuasa, Kyoto University, JAPAN
_______________________________________________
Openmcl-devel mailing list
Openmcl-devel <at> clozure.com
http://clozure.com/mailman/listinfo/openmcl-devel
Arthur Cater | 26 Jan 11:52
Picon
Favicon
Gravatar

How does Hemlock ...

I'm looking for some help because I'm floundering in trying to program Hemlock.
I'm using a MacBook Pro, OS 10.6.8, ClozureCL Version 1.7-r15184M  (DarwinX8664) 

What I'm trying to do is write a format directive that gives a behaviour rather like
hyperlinks when used on a customised Hemlock view: text should be highlighted
(underlined and printed in red) and clicking on it should invoke the function of choice.

I can get the red and underlining, and get a function invoked. But

a) the invocation of the function happens on mouse-up rather than mouse-down

b) the invocation does happen on mouse-downwhen in the minibuffer

c) when there is just one line of text with no terminating newline, the current-point
    of the buffer seems to correspond to the previous mouse-down-up sequence
    rather than the current one

d) when there are many lines of text with a terminating newline, the current-point
    stubbornly stays at buffer end.

I have searched the Hemlock sources for various things, but I do not understand
how a mouse-click gets to move the buffer's buffer-point. Please can somebody
explain to me how that is done, or tell me where to look more carefully?

Below, if anyone cares to look, is the code I have. It will create a hemlock view,
if in the listener you type (hemlock::two) you will see a line of text with two words
in red and underlined. Clicking on them - or elsewhere - causes informative messages
to be written to the listener.  If you close the window, make a new one with
(hemlock::my) and (hemlock::twentytwo) you see many lines of text each with one
word red and underlined. I must be doing something wrong :( and would gratefully
receive advice.

(I am aware of difficulties ahead, eg interaction with justification directives. I'm
not too concerned with those at the moment because I'm trying to build a tool to
help with examining datastructures in an application I'm building.)

Thanks in advance for any help I get!
Arthur

(in-package hemlock)

(defmacro do-objc-array ((itemvar arrayexpr) &body body)
"Perform BODY with ITEMVAR bound to successive elements of the ObjC array which
is value of ARRAYEXPR, while allowing for the possibility it is a null pointer."
  (let ((arrayvar (gensym)) (countvar (gensym)) (indexvar (gensym)))
    `(let ((,arrayvar ,arrayexpr))
       (unless (ccl::%null-ptr-p ,arrayvar)
         (let ((,countvar (#/count ,arrayvar)))
           (dotimes (,indexvar ,countvar)
             (let ((,itemvar (#/objectAtIndex: ,arrayvar ,indexvar))) ,@body)))))))

(defmacro write-listener (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 ,@args)))))

(defmethod gui::compute-temporary-attributes ((self gui::hemlock-textstorage-text-view))
  nil)

(defparameter *my* nil "Gets set to a hemlock-view")

(defparameter *mystream* nil "Gets set to an output stream for the hemlock-view in *MY*")

(defparameter *click-color* nil)

(defparameter *underlinedict* nil "Gets set to a ns-mutable-dictionary")

(defparameter *info* nil "Accumulates some debug info")

(defun underlinedict nil "Makes or reuses a ns-mutable-dictionary"
  (or *underlinedict*
      (prog1
       (setf *underlinedict*
             (make-instance 'ns:ns-mutable-dictionary :with-capacity 2))
       (setf *click-color* (#/colorWithCalibratedRed:green:blue:alpha: ns:ns-color 1.0 0.2 0.2 1.0))
       (#/setObject:forKey: *underlinedict* (#/numberWithInt: ns:ns-number 1)
                            #&NSUnderlineStyleAttributeName)
       (#/setObject:forKey: *underlinedict* *click-color*
                            #&NSForegroundColorAttributeName))))

(defcommand "Invoke Click Response" (p) "Responds to 'CLICKABLE' text by invoking its associated function."
  (declare (ignore p))
  ;(write-listener "Invoking...~%")
  (gui::execute-in-gui
   (lambda nil
     (gui::assume-cocoa-thread)
     (let* ((point (current-point))
            (line (mark-line point))
            (pos (mark-charpos point))
            (pchange (find pos (slot-value line 'hi::charprops-changes) :from-end t :test #'>= :key #'hi::charprops-change-index))
            (props (when pchange (hi::charprops-change-plist pchange))))
       (write-listener "point=~s~%line=~s~%pos=~s~%LastKeyEvent=~s~%" point line pos (last-key-event-typed))
       (when (and props (<= pos (+ (getf props :length) (hi::charprops-change-index pchange))))
         (write-listener "props are ~s, fn is ~s, arg is ~s~%"
                         props (getf props :clickfunction) (getf props :argument)))))))

(defun my ()
  (gui::execute-in-gui   ; Makes the view
   #'(lambda nil
       (setf hemlock::*my* (gui::find-or-make-hemlock-view nil))
       (let ((buffer (hemlock-view-buffer hemlock::*my*)))
         (underlinedict)
         (bind-key "Invoke Click Response" #k"LeftDown" :buffer buffer)
         (setf *mystream* (hi:make-hemlock-output-stream (buffer-start-mark buffer) :none)) ))))

(my)

(defun open-hemlock-output-stream-p (stream)
  (and (typep stream 'hemlock::hemlock-output-stream)
       (slot-value stream 'hi::mark)
       t))

; --------------------------------------------------------------------------------
; Redefine methods given in ccl:cocoa-ide;hemlock;src;streams.lisp
; to ensure that hemlock buffer modification is done in the proper thread
; --------------------------------------------------------------------------------

(defmethod hi::stream-write-char ((stream hi::hemlock-output-stream) char)
  (gui::execute-in-gui
   (lambda nil
     (gui::assume-cocoa-thread)
     (funcall (hi::old-lisp-stream-out stream) stream char))))

(defmethod hi::stream-write-string ((stream hi::hemlock-output-stream) string
                                &optional
                                (start 0)
                                (end (length string)))
  (gui::execute-in-gui
   (lambda nil
     (gui::assume-cocoa-thread)
     (funcall (hi::old-lisp-stream-sout stream) stream string start end))))

; --------------------------------------------------------------------------------
; The ~V/CLICKABLE/ format directive
; Consumes one or two arguments from the format args list
; The principal argument is something to be output to the stream.
; By default it is printed as if by PRINC (~A), but the colon modifier causes it
; to be printed as if by PRIN1 (~S).
; The prefix argument (corresponding to V) should be a function of one argument
; or a symbol naming one.
; - If the stream is a hemlock-output-stream that has not been closed, then the
;   text produced for the principal argument will be mouse-sensitive. Clicking on
;   it will cause the function to be invoked with the argument that was printed.
; - On other streams, the prefix argument will be consumed but ignored.
; - If the V prefix is omitted, then no function will be invoked by clicking.
; --------------------------------------------------------------------------------

(defun clickable (stream arg colon atsign &optional prefix)
  (declare (ignorable atsign))
  (cond
   ((open-hemlock-output-stream-p stream)
    (let* ((mark (hi:copy-mark (slot-value stream 'hi::mark) :temporary))
           (markabsolute (hi::mark-absolute-position mark))
           (line (slot-value mark 'hi::line))
           (charprops (when prefix `(:font-underline :single :font-color ,*click-color*
                                     :clickfunction ,prefix  :argument ,arg)))
           (start (when charprops (slot-value mark 'hi::charpos)))
           end)
      (if colon (prin1 arg stream) (princ arg stream))
      (when charprops
        (let* ((length (- (hi::mark-absolute-position (slot-value stream 'hi::mark)) markabsolute))
               (doc (hi::buffer-document (line-buffer line)))
               (store (when doc (slot-value doc 'gui::textstorage))))
          (setf end (slot-value (slot-value stream 'hi::mark) 'hi::charpos))
          (setf *info* `(:start ,start :end ,end))
          (hi::set-line-charprops line (list* :length length charprops) :start start :end end)
          (when doc
            (do-objc-array (layout (#/layoutManagers store))
              (ns:with-ns-range (range markabsolute length)
                (#/addTemporaryAttributes:forCharacterRange: layout (underlinedict) range))))
          (gui::perform-edit-change-notification
           store
           (objc:\@selector #/noteHemlockAttrChangeAtPosition:length:)
           markabsolute length 0)
          (setf *info* `(:changes ,(hi::line-charprops-changes line) ,@*info*))))))
   (t (if colon (prin1 arg stream) (princ arg stream)))))

(defun twentytwo nil
  (dotimes (k 22)
    (format *mystream*
            "Try ~v/hemlock::clickable/ out.~%" :that (format nil "~5,'xD" k))))

(defun two nil
  (format *mystream*
          "Try ~v/hemlock::clickable/ or ~v/hemlock::clickable/ now."
          :first :one :second :two))

Gmane