(New help facility): Add blurb about "(help (my module))" support.
[bpt/guile.git] / libguile / guile-doc-snarf.in
1 #!/bin/sh
2 # Extract the initialization actions for builtin things.
3 #
4 # Copyright (C) 1999, 2000 Free Software Foundation, Inc.
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
9 # any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this software; see the file COPYING. If not, write to
18 # the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
19 # Boston, MA 02111-1307 USA
20
21 fullfilename=$1; shift
22
23 # strip path to source directory
24 filename=`basename $fullfilename`
25
26 # we need to be sure that the .x file exists
27 # since the .c/.cc file may include it
28 # (the old guile-snarf did not have this problem
29 # because the makefile redirects output to the .x file
30 # which creates the file before the inclusion occurs)
31 # --12/12/99 gjb
32 no_ext=`echo $filename | sed 's/\.[^.]*$//g'`
33 dot_doc=${no_ext}.doc
34
35 temp="/tmp/snarf.$$"
36 trap "rm -f $temp" 0 1 2 15
37
38 ## Let the user override the preprocessor & awk autoconf found.
39 test -n "${CPP+set}" || CPP="@CPP@"
40 test -n "${AWK+set}" || AWK="@AWK@"
41
42 ## Must run guile-func-name-check on the unpreprocessed source
43 ${AWK} -f guile-func-name-check "$fullfilename"
44
45 ## We must use a temporary file here, instead of a pipe, because we
46 ## need to know if CPP exits with a non-zero status.
47 ${CPP} -DSCM_MAGIC_SNARFER "$@" > ${temp} || exit $?
48 cut -c1-1023 ${temp} | ${AWK} -f `dirname $0`/guile-snarf.awk ${dot_doc}