[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] zobjc egg
From: |
felix winkelmann |
Subject: |
Re: [Chicken-users] zobjc egg |
Date: |
Mon, 12 Dec 2005 07:35:16 +0100 |
Splendid!
I can't wait to get home to try it out. Note that I have no problems
dumping my old objc egg, so you should use the name objc instead.
cheers,
felix
On 12/9/05, Zbigniew <address@hidden> wrote:
> I integrated Felix's objc egg into mine, and added classes, instance
> variables, and automatic memory management. The result is called
> "zobjc" to avoid clobbering the existing objc egg. I plan to write up
> an eggdoc shortly, but in the meantime I could not resist creating the
> first Cocoa application for Chicken. :) That code is included below,
> and also in the egg (cd tests/; make).
>
> Get zobjc at: http://jiyu.gnook.org/~zbigniew/eggs/zobjc.egg
>
> Oh, and it's a cold, snowy 19F here... or -7.222222222222222 C.
>
> ;;; ------------------------------------------
>
> ;;; test f->c app
> ;;; Derived from the gauche-objc bridge test application.
>
> (use cocoa) ;; and compile with -X zobjc
>
> (objc:nsbeep)
> (print "Starting F->C application...")
>
> (define (f2c f)
> (/ (- f 32.0) 1.8))
>
> (define (c2f c)
> (+ (* 1.8 c) 32))
>
> (define-objc-class Controller NSObject ((ID far) (ID cel))
> (- VOID awakeFromNib
> (let ((far @far)
> (cel @cel))
> @[far setTitle: "Far"]
> @[cel setTitle: "Cel"]
> @[cel setFloatValue: 0.0]
> @[far setFloatValue: (c2f 0.0)]))
>
> (- VOID ((convertToCel: ID sender))
> (print "convertToCel: called; sender " sender)
>
> @[ @cel setDoubleValue:
> (f2c @[ @far doubleValue])])
>
> (- VOID ((convertToFar: ID sender))
> (print "convertToFar: called; sender " sender)
>
> @[ @far setDoubleValue:
> (c2f @[ @cel doubleValue ] )])
> )
>
> (objc:nsapplication-main)
>
>
> _______________________________________________
> Chicken-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/chicken-users
>