mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
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.
This commit is contained in:
parent
bf0d59e54d
commit
c3c3032608
2 changed files with 13 additions and 21 deletions
|
@ -1,7 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Extract the initialization actions from source files.
|
# 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
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Lesser General Public License as
|
# it under the terms of the GNU Lesser General Public License as
|
||||||
|
@ -51,19 +52,21 @@ 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/ *\^ *: *\^/\
|
sed -ne 's/ *\^ *\^ */\
|
||||||
/
|
/
|
||||||
h
|
s/.*\n//
|
||||||
s/\n.*//
|
|
||||||
t x
|
t x
|
||||||
d
|
d
|
||||||
: x
|
: x
|
||||||
s/.*\^ *\^ *\(.*\)/\1;/
|
s/ *\^ *: *\^ */;\
|
||||||
|
/
|
||||||
t y
|
t y
|
||||||
d
|
N
|
||||||
|
s/\n\(#.*\)/ /
|
||||||
|
s/\n/ /
|
||||||
|
t x
|
||||||
: y
|
: y
|
||||||
p
|
P
|
||||||
x
|
|
||||||
D' ${temp}
|
D' ${temp}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
;;; snarf-check-and-output-texi --- called by the doc snarfer.
|
;;; snarf-check-and-output-texi --- called by the doc snarfer.
|
||||||
|
|
||||||
;; Copyright (C) 2001, 2002, 2006, 2011 Free Software Foundation, Inc.
|
;; Copyright (C) 2001, 2002, 2006, 2011, 2014 Free Software Foundation, Inc.
|
||||||
;;
|
;;
|
||||||
;; This program is free software; you can redistribute it and/or
|
;; This program is free software; you can redistribute it and/or
|
||||||
;; modify it under the terms of the GNU Lesser General Public License
|
;; modify it under the terms of the GNU Lesser General Public License
|
||||||
|
@ -63,7 +63,7 @@
|
||||||
(let loop ((s s))
|
(let loop ((s s))
|
||||||
(cond
|
(cond
|
||||||
((stream-null? s) #t)
|
((stream-null? s) #t)
|
||||||
((eq? 'eol (stream-car s))
|
((memq (stream-car s) '(eol hash))
|
||||||
(loop (stream-cdr s)))
|
(loop (stream-cdr s)))
|
||||||
(else (cons (stream-car s) (stream-cdr s))))))
|
(else (cons (stream-car s) (stream-cdr s))))))
|
||||||
(port->stream port read)))))
|
(port->stream port read)))))
|
||||||
|
@ -265,17 +265,6 @@
|
||||||
(set! *file* file)
|
(set! *file* file)
|
||||||
(set! *line* line))
|
(set! *line* line))
|
||||||
|
|
||||||
;; newer gccs like to throw around more location markers into the
|
|
||||||
;; preprocessed source; these (hash . hash) bits are what they translate to
|
|
||||||
;; in snarfy terms.
|
|
||||||
(('location ('string . file) ('int . line) ('hash . 'hash))
|
|
||||||
(set! *file* file)
|
|
||||||
(set! *line* line))
|
|
||||||
|
|
||||||
(('location ('hash . 'hash) ('string . file) ('int . line) ('hash . 'hash))
|
|
||||||
(set! *file* file)
|
|
||||||
(set! *line* line))
|
|
||||||
|
|
||||||
(('arglist rest ...)
|
(('arglist rest ...)
|
||||||
(set! *args* (do-arglist rest)))
|
(set! *args* (do-arglist rest)))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue