[Top][All Lists]

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

Re: Doc organization (Re: Around again, and docs lead role)

From: David Van Horn
Subject: Re: Doc organization (Re: Around again, and docs lead role)
Date: Fri, 09 May 2003 12:46:00 -0500
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.3) Gecko/20030312

Rob Browning wrote:

> Actually, I've been playing around with code that would make something
> like this possible (as a dumb example):
>   (define (double x)
>     (c-syntax
>       (if ("SCM_INUMP" x)
>           (return (* x x))
>           (return ("scm_apply" ("scm_lookup" "+") x x)))))
> and that already works for
>   (%function "main" int ((int argc) ((%array (* char)) argv))
>     ("printf" "Hello world\\n"))
> etc. (i.e. a C s-expression representation), but I'm not sure how
> likely it is that anyone else would find it amusing.  I can think of a
> few possible uses for such a construction (g-wrap, auto-ffi,
> "c-side"-macros, scm-to-C-compiler-back-end, c equiv of inline-asm),
> but I'm still not sure it's really worthwhile.  I might comment more
> later if I remain intrigued...

Are you familiar with the Gambit-C FFI?  This allows you to write, eg.

   (define fmod (c-lambda (double double) double "fmod"))

Type checking and conversion are done for you.  I think it's a rather nice tool.

   Gambit-C: Interface to C

PLT Scheme supports a subset of this, namely `c-lambda' and `c-declare'.

   MzScheme Compiler Manual: Foreign-Function Interface to C

A Gambit-C style back-end to FFIGEN would be rather useful, especially if
three Schemes supported the emitted code.  I believe there has been some work
done to this end, but I can't seem to find mention of it beyond the to-do list



reply via email to

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