unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* [PATCH] guile-snarf: allow multiple init actions on one line
@ 2011-02-22 19:14 BT Templeton
  2011-02-22 19:26 ` Andy Wingo
  2011-03-04 10:34 ` Andy Wingo
  0 siblings, 2 replies; 8+ messages in thread
From: BT Templeton @ 2011-02-22 19:14 UTC (permalink / raw)
  To: guile-devel

[-- 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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-03-04 10:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-22 19:14 [PATCH] guile-snarf: allow multiple init actions on one line BT Templeton
2011-02-22 19:26 ` 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

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).