unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Rob Browning <rlb@defaultvalue.org>
Cc: guile-devel@gnu.org
Subject: Re: Doc organization (Re: Around again, and docs lead role)
Date: Thu, 15 May 2003 11:02:05 -0500	[thread overview]
Message-ID: <87n0horyf6.fsf@raven.i.defaultvalue.org> (raw)
In-Reply-To: m3k7cz596i.fsf@laruns.ossau.uklinux.net

Neil Jerram <neil@ossau.uklinux.net> 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


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


  reply	other threads:[~2003-05-15 16:02 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-26  7:33 Around again, and docs lead role Neil Jerram
2003-04-26 10:19 ` Thamer Al-Harbash
2003-04-27 20:56   ` Neil Jerram
     [not found]   ` <3E92E1B40021F4D7@pop3.tiscalinet.es>
2003-04-27 21:01     ` Neil Jerram
     [not found]       ` <3E92E1B4002B0632@pop3.tiscalinet.es>
2003-04-30 22:47         ` Neil Jerram
     [not found]           ` <3EAFE4EC000D9733@pop1.tiscalinet.es>
2003-05-07 21:06             ` Doc organization (Re: Around again, and docs lead role) Neil Jerram
2003-05-08 16:21               ` Rob Browning
2003-05-08 17:50                 ` rm
2003-05-08 22:47                   ` Neil Jerram
2003-10-28 16:09                   ` Thien-Thi Nguyen
2003-05-08 22:36                 ` Neil Jerram
2003-05-09  2:23                   ` Rob Browning
2003-05-09 17:46                     ` David Van Horn
2003-05-10 11:32                     ` Neil Jerram
2003-05-15 16:02                       ` Rob Browning [this message]
2003-05-15 16:33                         ` Paul Jarc
2003-05-09 11:52                 ` Bill Schottstaedt
2003-05-13 23:01                   ` Neil Jerram
2003-05-14  1:07                     ` Viktor Pavlenko
2003-05-14 14:29                     ` Bill Schottstaedt
2003-05-15  7:55                       ` Mikael Djurfeldt
2003-05-17  3:02                         ` Max Techter
2003-05-09  8:15               ` tomas
2003-05-10 12:01                 ` Neil Jerram
2003-05-12 11:40                   ` tomas
2003-05-03  4:40         ` Around again, and docs lead role Robert Uhl
2003-05-03 11:34           ` rm
2003-05-03 22:21             ` Robert Uhl
2003-05-03 23:15               ` Thamer Al-Harbash
2003-05-04  8:40                 ` David Allouche
2003-05-04 21:34                 ` Robert Uhl
2003-05-04 19:47               ` rm
2003-05-04 21:42                 ` Robert Uhl
2003-05-04 23:38                   ` Thien-Thi Nguyen
2003-05-07 22:52             ` Neil Jerram
2003-05-08 22:32               ` State of Docs [was] " rm
2003-05-08 23:11                 ` Neil Jerram
2003-05-10  0:47                   ` State of Docs Kevin Ryde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87n0horyf6.fsf@raven.i.defaultvalue.org \
    --to=rlb@defaultvalue.org \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).