summaryrefslogtreecommitdiff
path: root/libguile/guile-snarf.in
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2014-03-06 17:17:11 -0500
committerMark H Weaver <mhw@netris.org>2014-03-06 17:25:55 -0500
commitc3c3032608c9658c5dc5019d85446b6a1c2f7fcc (patch)
tree692a950dbcc09cb629289fb48248aad89a44976c /libguile/guile-snarf.in
parentbf0d59e54de22f0a2e384b0fea2aa039769676fb (diff)
downloadguile-c3c3032608c9658c5dc5019d85446b6a1c2f7fcc.tar.gz
Make snarfing tools more robust to varied C preprocessor behavior.
* libguile/guile-snarf.in (modern_snarf): Rewrite sed script to cope with newlines in the snarfed code segments, or multiple code segments on the same line. * module/scripts/snarf-check-and-output-texi.scm (process-stream): Strip all 'hash' tokens from the stream. (do-command): Remove special cases that handled 'hash' tokens in a few places.
Diffstat (limited to 'libguile/guile-snarf.in')
-rw-r--r--libguile/guile-snarf.in19
1 files changed, 11 insertions, 8 deletions
diff --git a/libguile/guile-snarf.in b/libguile/guile-snarf.in
index c73e8ce1e..47bbc0422 100644
--- a/libguile/guile-snarf.in
+++ b/libguile/guile-snarf.in
@@ -1,7 +1,8 @@
#!/bin/sh
# Extract the initialization actions from source files.
#
-# Copyright (C) 1996, 97, 98, 99, 2000, 2001, 2002, 2004, 2006, 2008, 2009 Free Software Foundation, Inc.
+# Copyright (C) 1996, 97, 98, 99, 2000, 2001, 2002, 2004, 2006, 2008,
+# 2009, 2014 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
@@ -51,19 +52,21 @@ modern_snarf () # writes stdout
## empty file.
echo "/* cpp arguments: $@ */" ;
${cpp} -DSCM_MAGIC_SNARF_INITS -DSCM_MAGIC_SNARFER "$@" > ${temp} && cpp_ok_p=true
- sed -ne 's/ *\^ *: *\^/\
+ sed -ne 's/ *\^ *\^ */\
/
-h
-s/\n.*//
+s/.*\n//
t x
d
: x
-s/.*\^ *\^ *\(.*\)/\1;/
+s/ *\^ *: *\^ */;\
+/
t y
-d
+N
+s/\n\(#.*\)/ /
+s/\n/ /
+t x
: y
-p
-x
+P
D' ${temp}
}