unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: BT Templeton <bpt@hcoop.net>
To: guile-devel@gnu.org
Subject: [PATCH] guile-snarf: allow multiple init actions on one line
Date: Tue, 22 Feb 2011 14:14:44 -0500	[thread overview]
Message-ID: <87k4grq3tn.fsf@olor.terpri.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 258 bytes --]

Guile-SDL contains some cpp macros that define multiple subrs. To allow
that, this patch modifies guile-snarf to recognize more than one
initialization action per line, which is necessary because GNU's C
preprocessor removes newlines from macro expansions.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 1085 bytes --]

From e14436798deb8c9bb59273844d194c1bc4af6682 Mon Sep 17 00:00:00 2001
From: BT Templeton <bpt@hcoop.net>
Date: Tue, 22 Feb 2011 13:15:31 -0500
Subject: [PATCH] guile-snarf: allow multiple init actions on one line

* libguile/guile-snarf.in (modern_snarf): Allow programs to specify
  multiple initialization actions on a single line. This makes it
  possible for C programs to define multiple subrs with a single macro
  invocation.
---
 libguile/guile-snarf.in |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libguile/guile-snarf.in b/libguile/guile-snarf.in
index 043b3ed..a1aeba5 100644
--- a/libguile/guile-snarf.in
+++ b/libguile/guile-snarf.in
@@ -51,7 +51,7 @@ modern_snarf ()                         # writes stdout
     ## empty file.
     echo "/* cpp arguments: $@ */" ;
     ${cpp} -DSCM_MAGIC_SNARF_INITS -DSCM_MAGIC_SNARFER "$@" > ${temp} && cpp_ok_p=true
-    grep "^ *\^ *\^" ${temp} | sed -e "s/ *\^ *\^//g" -e "s/\^ *: *\^/;/g"
+    sed -ne "s/ *\^ *: *\^/\n/;s/[^\n]*\^ *\^ *\([^\n]*\)/\1;/;tx;d;:x;P;D" ${temp}
 }
 
 ## main
-- 
1.7.2.3


             reply	other threads:[~2011-02-22 19:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-22 19:14 BT Templeton [this message]
2011-02-22 19:26 ` [PATCH] guile-snarf: allow multiple init actions on one line Andy Wingo
2011-02-22 23:09   ` BT Templeton
2011-02-24 19:31     ` Ludovic Courtès
2011-02-24 20:42       ` Andreas Rottmann
2011-02-24 21:49         ` Ludovic Courtès
2011-02-25 11:01           ` Andy Wingo
2011-03-04 10:34 ` Andy Wingo

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=87k4grq3tn.fsf@olor.terpri.org \
    --to=bpt@hcoop.net \
    --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).