On Fri, Aug 1, 2008 at 8:15 AM, Shawn Rutledge
<[EMAIL PROTECTED]> wrote:
>
> This works:
>
> (define g2d_glyphs_baseline (foreign-primitive scheme-object
> ((g2d-glyph-vector glyphs))
>        "C_word* a = C_alloc(C_SIZEOF_PAIR);
>        return(C_pair (&a, C_fix(10), C_fix(256)));" ))
>
> but is there a way to do it in a C source file rather than having to
> write C inside quotes?
>

You can put a C function that looks like this into a separate
file and access it with ##core#primitive:

/* x.c */

#include "chicken.h"

C_word g2d_glyphs_baseline(C_word c, C_word self, C_word k, C_word glyphs)
{
  C_word *a = C_alloc(C_SIZEOF_PAIR);
  C_kontinue(k, C_pair(&a, C_fix(10), C_fix(256)));
}

/* y.scm */

#>
#include "x.h"
<#

(define g2d_glyphs_baseline (##core#primitive "g2d_glyphs_baseline"))


cheers,
felix


_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to