mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
fix guile-snarf
* libguile/snarf.h: New macro `SCM_SNARF_INIT_PREFIX'. (SCM_SNARF_INIT) Use `SCM_SNARF_INIT_PREFIX' instead of including a literal marker. If the preprocessor echoes #define directives to its output, this will prevent `guile-snarf' from snarfing the `SCM_SNARF_INIT' definition itself. Reported by Mike Gran <spk121@yahoo.com>. * libguile/guile-snarf.in (modern_snarf): Don't output anything for lines in which only one of the magic snarfing markers is present. Modify the `sed' program for compatibility with POSIX `sed'. The new `sed' program is based on a version by Wolfgang Jenkner <wjenkner@inode.at>. * test-suite/standalone/test-guile-snarf: New tests.
This commit is contained in:
parent
13f1461c24
commit
95c1cfb550
3 changed files with 23 additions and 2 deletions
|
@ -51,7 +51,20 @@ modern_snarf () # writes stdout
|
||||||
## empty file.
|
## empty file.
|
||||||
echo "/* cpp arguments: $@ */" ;
|
echo "/* cpp arguments: $@ */" ;
|
||||||
${cpp} -DSCM_MAGIC_SNARF_INITS -DSCM_MAGIC_SNARFER "$@" > ${temp} && cpp_ok_p=true
|
${cpp} -DSCM_MAGIC_SNARF_INITS -DSCM_MAGIC_SNARFER "$@" > ${temp} && cpp_ok_p=true
|
||||||
sed -ne "s/ *\^ *: *\^/\n/;s/[^\n]*\^ *\^ *\([^\n]*\)/\1;/;tx;d;:x;P;D" ${temp}
|
sed -ne 's/ *\^ *: *\^/\
|
||||||
|
/
|
||||||
|
h
|
||||||
|
s/\n.*//
|
||||||
|
t x
|
||||||
|
d
|
||||||
|
: x
|
||||||
|
s/.*\^ *\^ *\(.*\)/\1;/
|
||||||
|
t y
|
||||||
|
d
|
||||||
|
: y
|
||||||
|
p
|
||||||
|
x
|
||||||
|
D' ${temp}
|
||||||
}
|
}
|
||||||
|
|
||||||
## main
|
## main
|
||||||
|
|
|
@ -53,11 +53,17 @@
|
||||||
* The SCM_SNARF_INIT text goes into the corresponding .x file
|
* The SCM_SNARF_INIT text goes into the corresponding .x file
|
||||||
* up through the first occurrence of SCM_SNARF_DOC_START on that
|
* up through the first occurrence of SCM_SNARF_DOC_START on that
|
||||||
* line, if any.
|
* line, if any.
|
||||||
|
*
|
||||||
|
* Some debugging options can cause the preprocessor to echo #define
|
||||||
|
* directives to its output. Keeping the snarfing markers on separate
|
||||||
|
* lines prevents guile-snarf from inadvertently snarfing the definition
|
||||||
|
* of SCM_SNARF_INIT if those options are in effect.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef SCM_MAGIC_SNARF_INITS
|
#ifdef SCM_MAGIC_SNARF_INITS
|
||||||
# define SCM_SNARF_HERE(X)
|
# define SCM_SNARF_HERE(X)
|
||||||
# define SCM_SNARF_INIT(X) ^^ X ^:^
|
# define SCM_SNARF_INIT_PREFIX ^^
|
||||||
|
# define SCM_SNARF_INIT(X) SCM_SNARF_INIT_PREFIX X ^:^
|
||||||
# define SCM_SNARF_DOCS(TYPE, CNAME, FNAME, ARGLIST, REQ, OPT, VAR, DOCSTRING)
|
# define SCM_SNARF_DOCS(TYPE, CNAME, FNAME, ARGLIST, REQ, OPT, VAR, DOCSTRING)
|
||||||
#else
|
#else
|
||||||
# ifdef SCM_MAGIC_SNARF_DOCS
|
# ifdef SCM_MAGIC_SNARF_DOCS
|
||||||
|
|
|
@ -18,3 +18,5 @@ snarf_test " ^ ^ b ^ : ^ " "b;"
|
||||||
snarf_test "c\n^^d^:^\ne" "d;"
|
snarf_test "c\n^^d^:^\ne" "d;"
|
||||||
snarf_test "f^^g^:^h" "g;"
|
snarf_test "f^^g^:^h" "g;"
|
||||||
snarf_test "^^i^:^j^^k^:^" "i;k;"
|
snarf_test "^^i^:^j^^k^:^" "i;k;"
|
||||||
|
snarf_test "l^^m" ""
|
||||||
|
snarf_test "n^:^o" ""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue