[Top][All Lists]

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

Re: [Chicken-users] some progress on zlib

From: Felix
Subject: Re: [Chicken-users] some progress on zlib
Date: Wed, 18 Sep 2002 09:04:12 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.0) Gecko/20020530

Peter Keller wrote:

After figuring out I could pass a byte-vector into a foreign-lambda
declaration where something expects a void* that is treated as a char*,
my zlib FFI has come into reality.

Here's an example:
(declare (uses zlib))
(require 'srfi-4)
(require 'lolevel)

;; test.gz contains "Hello World" as compressed by gzip
(let (  (fin (gzopen "test.gz" "r"))
        (data (make-byte-vector 1024 0)))

    (gzread fin data 12)
    (print "Read: " (byte-vector->string data))
    (gzclose fin))
;; Wow, actually printed Hello World!

Hey, that's nice. I did some minor Zlib stuff with
Chicken, but having a port-like interface is even better.
You should try out `make-input-port'/`make-output-port'
(unit `extras', I think)

I figure in a week or so(or in a single night, depending on time and
motivation), I'll have enough of the API to do very, very basic file i/o
where you can read or write compressed files. When I get to that point,
I'll package it up nice and release it since it can be useful right away
to someone.

Wonderful! How about a proper extensions (i.e. "egg") ?

Thanks for your help.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]