Re: [Chicken-users] Re: bytevectors

2009-02-19 Thread felix winkelmann
On Tue, Feb 17, 2009 at 11:33 PM, Eduardo Cavazos
 wrote:
> Here's a screenshot of the fruits of today's labors:
>
> http://proteus.freeshell.org/abstracting-screenshots/game1-turn6-chicken.png
>
> That was produced by a pure Scheme implementation of the ContextFreeArt
> semantics. More info about ContextFree:
>
>http://www.contextfreeart.org/
>
> The code that rendered it also runs on Larceny and Ypsilon.
>
> If anybody is curious to see the code behind the program and the framework
> supporting it:
>
>http://github.com/dharmatech/abstracting/tree/master
>

Wow - very impressive. Well done, Eduardo. The contextfreeart site has
a few examples that are really mind-boggling.

I have to find some time to play with it.


cheers,
felix


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Re: bytevectors

2009-02-17 Thread Eduardo Cavazos


Eduardo Cavazos wrote:


--
(use srfi-4)

(define (make-bytevector n)
 (u8vector->blob/shared (make-u8vector n)))

(define bytevector-length blob-size)

(define (bytevector-ieee-double-native-ref bv i)
 (f64vector-ref (blob->f64vector/shared bv) (/ i 8)))

(define (bytevector-ieee-double-native-set! bv i val)
 (f64vector-set! (blob->f64vector/shared bv) (/ i 8) val))
--



felix winkelmann wrote:


That looks good. And it should also be the most efficient
solution.


Cool!

Here's a screenshot of the fruits of today's labors:

http://proteus.freeshell.org/abstracting-screenshots/game1-turn6-chicken.png

That was produced by a pure Scheme implementation of the ContextFreeArt 
semantics. More info about ContextFree:


http://www.contextfreeart.org/

The code that rendered it also runs on Larceny and Ypsilon.

If anybody is curious to see the code behind the program and the 
framework supporting it:


http://github.com/dharmatech/abstracting/tree/master

Ed


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Re: bytevectors

2009-02-17 Thread felix winkelmann
On Tue, Feb 17, 2009 at 10:51 PM, Eduardo Cavazos
 wrote:
>
> --
> (use srfi-4)
>
> (define (make-bytevector n)
>  (u8vector->blob/shared (make-u8vector n)))
>
> (define bytevector-length blob-size)
>
> (define (bytevector-ieee-double-native-ref bv i)
>  (f64vector-ref (blob->f64vector/shared bv) (/ i 8)))
>
> (define (bytevector-ieee-double-native-set! bv i val)
>  (f64vector-set! (blob->f64vector/shared bv) (/ i 8) val))
> --
>

That looks good. And it should also be the most efficient
solution.


chers,
felix


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Re: bytevectors

2009-02-17 Thread Eduardo Cavazos

Eduardo Cavazos wrote:

Hmmm... After poking around some, I see that I can probably cook up a 
compatability layer. Something along these lines:


This is what I ended up using. I loaded into Chicken and it's handling 
some "R6RS" code of mine. These procedures are in tight loops. Chicken 
is keeping up with Larceny and Ypsilon so I'm guessing the overhead 
introduced isn't too bad. ;-)


--
(use srfi-4)

(define (make-bytevector n)
  (u8vector->blob/shared (make-u8vector n)))

(define bytevector-length blob-size)

(define (bytevector-ieee-double-native-ref bv i)
  (f64vector-ref (blob->f64vector/shared bv) (/ i 8)))

(define (bytevector-ieee-double-native-set! bv i val)
  (f64vector-set! (blob->f64vector/shared bv) (/ i 8) val))
--

Ed


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Re: bytevectors

2009-02-17 Thread Eduardo Cavazos

Eduardo Cavazos wrote:


So... do you think chicken can support the bytevectors api? :-)


Hmmm... After poking around some, I see that I can probably cook up a 
compatability layer. Something along these lines:


--
(use srfi-4)

(define (make-bytevector n) (make-blob n))

(define (bytevector-ieee-double-native-ref blob i)

  (f64vector-ref (blob->f64vector/shared blob) i))

(define (bytevector-ieee-double-native-set! blob i val)

  (f64vector-set! (blob->f64vector/shared blob) i val))
--

Hopefully somebody can advise on the most efficient approach.

Let's suppose I take this approach, where I use Chicken blobs in place 
of R6RS bytevectors. There's one problem that exists. Some of the 
procedures in the OpenGL egg want f64vector objects. For example, this 
results in an error:


(let ((bv (make-blob (* 16 8
  (glGetDoublev GL_MODELVIEW_MATRIX bv)
  bv)

Again for comparison, the OpenGL libraries in Larceny, Ypsilon, and 
Ikarus allow a bytevector to be passed to 'glGetDoublev'.


I'm willing to use a customized gl egg for my purposes. This is from 
'gl.scm' in the opengl egg:


void  glGetDoublev( GLenum pname, GLdouble *params );

What could I change that to such that blobs are allowed as the second 
argument?


Ed


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users