TongKe Xue | 1 Dec 07:38 2008
Picon

moving "-I blah" into source

Hi,

  Instead of:

  "csi -I some_dir -s blah.scm"

  can I put something in the top of blah.scm so I only have to type:
  "csi -s blah.scm"

Thanks!
--TongKe

_______________________________________________
Chicken-users mailing list
Chicken-users <at> nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users
Tobia Conforto | 1 Dec 17:22 2008
Picon

Re: moving "-I blah" into source

TongKe Xue wrote:
> Instead of:
> "csi -I some_dir -s blah.scm"
> can I put something in the top of blah.scm so I only have to type:
> "csi -s blah.scm"

This should work:

(set! ##sys#include-pathnames (cons "/home/tobia/include"  
##sys#include-pathnames))

It uses a Chicken internal variable, but I don't think there's an  
easier/safer way.  Try to use absolute pathnames, I had trouble with  
relative ones.

Tobia
Kon Lovett | 1 Dec 19:18 2008
Picon

Re: moving "-I blah" into source


On Dec 1, 2008, at 8:22 AM, Tobia Conforto wrote:

> TongKe Xue wrote:
>> Instead of:
>> "csi -I some_dir -s blah.scm"
>> can I put something in the top of blah.scm so I only have to type:
>> "csi -s blah.scm"
>
> This should work:
>
> (set! ##sys#include-pathnames (cons "/home/tobia/include"  
> ##sys#include-pathnames))
>
> It uses a Chicken internal variable, but I don't think there's an  
> easier/safer way.  Try to use absolute pathnames, I had trouble with  
> relative ones.

See also the '(link-options STRING ...)' declaration.

>
>
>
> Tobia
>
>
> _______________________________________________
> Chicken-users mailing list
> Chicken-users <at> nongnu.org
> http://lists.nongnu.org/mailman/listinfo/chicken-users

Best Wishes,
Kon
Daishi Kato | 2 Dec 09:49 2008

z3: gzip compatibility

Hi,

Does anyone know if I can use z3 egg
to reproduce the same result made by gzip?

My first attempt is the following.

Thanks for any help.

Best,
Daishi

daishi <at> spirits[10611] echo foo|gzip>foo.gz
daishi <at> spirits[10612] csi

CHICKEN
(c)2008 The Chicken Team
(c)2000-2007 Felix L. Winkelmann
Version 3.2.0 - linux-unix-gnu-x86      [ manyargs dload ptables applyhook ]
SVN rev. 10664  compiled 2008-05-28 on spirits (Linux)

#;1> (use z3)
; loading /usr/local/chicken-3.2.0/lib/chicken/3/z3.so ...
#;2> (z3:decode-buffer (read-file "foo.gz"))
Error: (string-length) bad argument type: (|?????4IK????????e2~|)

        Call history:

        <syntax>                (z3:decode-buffer (read-file "foo.gz"))
        <syntax>                (read-file "foo.gz")
        <eval>          (z3:decode-buffer (read-file "foo.gz"))
        <eval>          (read-file "foo.gz")    <--
#;2>
felix winkelmann | 2 Dec 10:04 2008
Picon

Re: moving "-I blah" into source

On Mon, Dec 1, 2008 at 7:18 PM, Kon Lovett <klovett <at> pacbell.net> wrote:
>>
>> It uses a Chicken internal variable, but I don't think there's an
>> easier/safer way.  Try to use absolute pathnames, I had trouble with
>> relative ones.
>
> See also the '(link-options STRING ...)' declaration.
>

That would be for compiled code. But note that this feature (together
with the "c-options" declaration) has been removed in chicken 4. Even
though it was practical in some situations, the implementation was
very ugly, and it's use very platform specific.

cheers,
felix
felix winkelmann | 2 Dec 10:05 2008
Picon

Re: moving "-I blah" into source

On Mon, Dec 1, 2008 at 5:22 PM, Tobia Conforto <tobia.conforto <at> gmail.com> wrote:
> TongKe Xue wrote:
>>
>> Instead of:
>> "csi -I some_dir -s blah.scm"
>> can I put something in the top of blah.scm so I only have to type:
>> "csi -s blah.scm"
>
> This should work:
>
> (set! ##sys#include-pathnames (cons "/home/tobia/include"
> ##sys#include-pathnames))
>
> It uses a Chicken internal variable, but I don't think there's an
> easier/safer way.  Try to use absolute pathnames, I had trouble with
> relative ones.
>

You can also use "load-relative", which might be useful, if you want
to load support files.

cheers,
felix
Tobia Conforto | 2 Dec 10:04 2008
Picon

Re: z3: gzip compatibility

Daishi Kato wrote:
> Does anyone know if I can use z3 egg to reproduce the same result  
> made by gzip?

Yes you can, but you have to use the right functions.

Note that a file in gzip format includes some zlib-encoded data, after  
a header, but it's not plain zlib-encoded data.

This works:

$ echo hello > test
$ gzip test
$ csi -q
#;1> (use z3)
; loading /usr/local/lib/chicken/3/z3.so ...
#;2> (read (z3:open-compressed-input-file "test.gz"))
hello
#;3>

Tobia
felix winkelmann | 2 Dec 10:09 2008
Picon

Re: z3: gzip compatibility

On Tue, Dec 2, 2008 at 9:49 AM, Daishi Kato <daishi <at> axlight.com> wrote:
>
> #;1> (use z3)
> ; loading /usr/local/chicken-3.2.0/lib/chicken/3/z3.so ...
> #;2> (z3:decode-buffer (read-file "foo.gz"))
> Error: (string-length) bad argument type: (|?????4IK????????e2~|)
>
>        Call history:
>
>        <syntax>                (z3:decode-buffer (read-file "foo.gz"))
>        <syntax>                (read-file "foo.gz")
>        <eval>          (z3:decode-buffer (read-file "foo.gz"))
>        <eval>          (read-file "foo.gz")    <--
> #;2>
>

Try "read-all", instead of "read-file". "read-file" will return a list
of s-expr's,
"read-all" returns the contents of the file as a string.

cheers,
felix
Daishi Kato | 2 Dec 11:01 2008

Re: z3: gzip compatibility

At Tue, 2 Dec 2008 10:04:29 +0100,
Tobia Conforto wrote:
> 
> Daishi Kato wrote:
> > Does anyone know if I can use z3 egg to reproduce the same result  
> > made by gzip?
> 
> Yes you can, but you have to use the right functions.
> 
> Note that a file in gzip format includes some zlib-encoded data, after  
> a header, but it's not plain zlib-encoded data.
> 
> This works:
> 
> $ echo hello > test
> $ gzip test
> $ csi -q
> #;1> (use z3)
> ; loading /usr/local/lib/chicken/3/z3.so ...
> #;2> (read (z3:open-compressed-input-file "test.gz"))
> hello
> #;3>

Thanks Toiba and Felix.

Can I do it without using the file? maybe using string or port.
In other words, how can I encode/decode the header.
The documentation does not seem to help me on it.

I'm thinking of using it with http-server (or spiffy)
to support Content-Encoding: gzip.

Best,
Daishi
felix winkelmann | 2 Dec 11:05 2008
Picon

Re: z3: gzip compatibility

On Tue, Dec 2, 2008 at 11:01 AM, Daishi Kato <daishi <at> axlight.com> wrote:
>
> Can I do it without using the file? maybe using string or port.
> In other words, how can I encode/decode the header.
> The documentation does not seem to help me on it.
>

Check out "z3:decode-buffer".

cheers,
felix

Gmane