[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: |
Rob Browning |
Subject: |
Re: Doc organization (Re: Around again, and docs lead role) |
Date: |
Thu, 15 May 2003 11:02:05 -0500 |
User-agent: |
Gnus/5.1001 (Gnus v5.10.1) Emacs/21.3 (gnu/linux) |
Neil Jerram <address@hidden> writes:
> Rob> hack something like that up if they needed to with a makefile
> Rob> and appropriate use of "cat"...
>
> #include <foo.scm> would be very nice, but we'll probably need
> something more dynamic as well. I don't see what you mean by cat
> though.
I hadn't thought very hard about it, but I meant that instead of
#include <foo.scm> in file foo.c (which would still require some
non-scheme code in foo.scm) you could do something primitive like
this:
foo-real.c: foo-pre.c foo.scm foo-post.c
cat foo-pre.c > foo-real.c.tmp
echo 'startup_eval_code = "' >> foo-real.c.tmp
cat foo.scm >> foo-real.c.tmp
echo '";' >> foo-real.c.tmp
cat foo-post.c >> foo-real.c.tmp
mv foo-real.c.tmp foo-real.c
very ugly, of course (really too ugly), but something that could be
done right now. I suppose you could also use perl, sed, etc. with
similar effect.
> Rob> Actually, I've been playing around with code that would
> Rob> make something like this possible (as a dumb example):
>
> Rob> (define (double x)
> Rob> (c-syntax
> Rob> (if ("SCM_INUMP" x)
> Rob> (return (* x x))
> Rob> (return ("scm_apply" ("scm_lookup" "+") x x)))))
>
> I don't see how this helps - please explain.
Well in one possible approach you'd be able to write a file that
contained both scheme and this "inline C" code. That file would then
be compiled to object code via C. In that arrangement, you wouldn't
need a separate file or a giant unwieldy C string for any large
embedded Scheme fragments. i.e. as a psuedo-example:
(define (show-c-+ x y)
(simple-format #t "In C (+ ~A ~A) would yield ~A\n"
x y
(c-style-int-+ x y)))
(define (c-style-int-+ x y)
(c-syntax
(auto int c_x ("scm_num2int" 1 x %function-name))
(auto int c_y ("scm_num2int" 1 y %function-name))
(return ("scm_int2num" (+ c_x c_y)))))
Of course that's not the primary reason I've been playing around with
this, but it's another effect.
--
Rob Browning
rlb @defaultvalue.org, @linuxdevel.com, and @debian.org
Previously @cs.utexas.edu
GPG starting 2002-11-03 = 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4
- Doc organization (Re: Around again, and docs lead role), Ricard Mira, 2003/05/03
- Re: Doc organization (Re: Around again, and docs lead role), Neil Jerram, 2003/05/08
- Re: Doc organization (Re: Around again, and docs lead role), Rob Browning, 2003/05/08
- Re: Doc organization (Re: Around again, and docs lead role), Wolfgang Jaehrling, 2003/05/08
- Re: Doc organization (Re: Around again, and docs lead role), Neil Jerram, 2003/05/08
- Re: Doc organization (Re: Around again, and docs lead role), Rob Browning, 2003/05/08
- Re: Doc organization (Re: Around again, and docs lead role), David Van Horn, 2003/05/09
- Re: Doc organization (Re: Around again, and docs lead role), Neil Jerram, 2003/05/10
- Re: Doc organization (Re: Around again, and docs lead role),
Rob Browning <=
- Re: Doc organization (Re: Around again, and docs lead role), Paul Jarc, 2003/05/15
Re: Doc organization (Re: Around again, and docs lead role), Max Techter, 2003/05/08
Re: Doc organization (Re: Around again, and docs lead role), Neil Jerram, 2003/05/08
Re: Doc organization (Re: Around again, and docs lead role), Max Techter, 2003/05/09
Re: Doc organization (Re: Around again, and docs lead role), tomas, 2003/05/09