Commit | Line | Data |
---|---|---|
c99f9605 | 1 | #!/bin/sh |
e6d67f1e TTN |
2 | # guile-snarf-docs --- Extract the doc stuff for builtin things. |
3 | ## | |
4 | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, | |
5 | # 2006, 2010 Free Software Foundation, Inc. | |
c99f9605 | 6 | # |
c99f9605 | 7 | # This program is free software; you can redistribute it and/or modify |
53befeb7 NJ |
8 | # it under the terms of the GNU Lesser General Public License as |
9 | # published by the Free Software Foundation; either version 3, or (at | |
10 | # your option) any later version. | |
e6d67f1e | 11 | # |
53befeb7 NJ |
12 | # This program is distributed in the hope that it will be useful, but |
13 | # WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 | # Lesser General Public License for more details. | |
e6d67f1e | 16 | # |
53befeb7 NJ |
17 | # You should have received a copy of the GNU Lesser General Public |
18 | # License along with this software; see the file COPYING.LESSER. If | |
19 | # not, write to the Free Software Foundation, Inc., 51 Franklin | |
20 | # Street, Fifth Floor, Boston, MA 02110-1301 USA | |
e6d67f1e TTN |
21 | ## |
22 | # Usage: guile-snarf-docs -o DOC SRC -- [CPPSNARFOPTS...] | |
23 | ## | |
c99f9605 | 24 | |
e6d67f1e | 25 | filter='./guile_filter_doc_snarfage@EXEEXT@' |
c99f9605 | 26 | |
c99f9605 ML |
27 | ## Let the user override the preprocessor autoconf found. |
28 | test -n "${CPP+set}" || CPP="@CPP@" | |
29 | ||
e6d67f1e TTN |
30 | ## Likewise for AWK. |
31 | test -n "${AWK+set}" || AWK="@AWK@" | |
32 | ||
33 | bummer () | |
34 | { | |
35 | echo 'Bad command-line' $1 | |
36 | exit 1 | |
37 | } | |
38 | ||
39 | test "x$1" = x-o || bummer | |
40 | shift | |
41 | ||
42 | test "x$1" = x && bummer ': missing DOC' | |
43 | output="$1" | |
44 | temout="$output"T | |
45 | shift | |
46 | ||
47 | test "x$1" && test -r "$1" || bummer ': missing SRC' | |
48 | input="$1" | |
49 | shift | |
50 | ||
51 | test "x$1" = x-- || bummer | |
52 | shift | |
53 | ||
54 | # Before snarfing, do the function name check. | |
34cbb053 | 55 | ${AWK} -f '@srcdir@/guile-func-name-check' "$input" || exit 1 |
e6d67f1e TTN |
56 | |
57 | # Snarfing takes two steps: cpp and tokenization. | |
58 | # If cpp fails, don't bother with tokenization. | |
59 | if ${CPP} -DSCM_MAGIC_SNARF_DOCS "$@" "$input" > "$temout" ; then | |
60 | $filter --filter-snarfage < "$temout" > "$output" | |
61 | rv=0 | |
62 | else | |
63 | rv=1 | |
64 | fi | |
65 | rm -f "$temout" | |
66 | exit $rv | |
67 | ||
68 | # guile-snarf-docs ends here |