Dear mailing list,

some little issues appeared in my experiments with CRUNCH trunk/v0.99 and maybe
somebody can help me.

== 1. Embed

I am trying to embed crunch modules in test cases written in chicken like this:

    ; test.scm
    (import (scheme base) test crunch)
    (crunch (include "something-in-crunch.scm"))
    (import something-in-crunch)
    ; chicken tests ...

But that fails. Here is a minimal example showing the issue:

    $ cat crunch-embed.scm
    (import (scheme base)
            (scheme write)
            crunch)
    (crunch
        (module crunch-example
                    (foo)
                    (import (scheme base))
                    (define (foo) 123)))
    (import crunch-example)
    (display (foo))
    (newline)

    $ csc crunch-embed.scm
    $ ./crunch-embed

    Error: unbound variable: crunch-example#foo

        Call history:

        crunch-embed.scm:1: chicken.load#load-extension
        crunch-embed.scm:13: crunch-example#foo         <--

The symbol foo is being exported in the module crunch-example, why can't I
access it in the top level? Am I missing something?

Note that foo is in the binary:

    $ nm crunch-embed | grep foo
    00000000004010f4 T foo
    00000000006023a0 D foo___


== 2. (error)

(error ...) does not do what I'd expect. Consider this example:

    $ cat crunch-error.scm
    (import (scheme base))
    (define (main)
        (error 'check "something"))
    (cond-expand ((not crunched) (main)) (else))

When executing with CHICKEN I get the expected error:

    $ csc crunch-error.scm -o err
    $ ./err

    Error: (check) something

        Call history:

        crunch-error.scm:4: main
        crunch-error.scm:3: chicken.base#error          <--

With CRUNCH, I can't compile it:

    $ chicken-crunch crunch-error.scm -o err.c
    Error: crunch-error.scm:3: literal `check' has unrepresentable type
    Error: crunch-error.scm:3: argument types in procedure call 
`(chicken.base#error (quote <check>) (quote "something"))' do not match.
     call: (procedure (string #!optional string ? ?) noreturn)
     expected: (procedure (string #!optional ? ? ?) noreturn)

The documentations says (error S #!optional ...). I assume S means symbol.

== 3. Emit wrappers

The option -emit-wrappers is not working. The case in `crunch-driver.scm` seems
to have a weird form, so I changed it as follows:

    -          ((("-emit-wrappers" fname) . more)
    +          (("-emit-wrappers" fname . more)

But the file passed to -emit-wrappers ends up empty. How to use this option
properly? What I am trying is again to compile the module with crunch and
import it later in chicken.

Thanks!

Cheers,
-Diogo



-- 

Reply via email to