guile-snarf-docs.in 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/bin/sh
  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.
  6. #
  7. # This program is free software; you can redistribute it and/or modify
  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.
  11. #
  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.
  16. #
  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
  21. ##
  22. # Usage: guile-snarf-docs -o DOC SRC -- [CPPSNARFOPTS...]
  23. ##
  24. filter='./guile_filter_doc_snarfage@EXEEXT@'
  25. ## Let the user override the preprocessor autoconf found.
  26. test -n "${CPP+set}" || CPP="@CPP@"
  27. ## Likewise for AWK.
  28. test -n "${AWK+set}" || AWK="@AWK@"
  29. bummer ()
  30. {
  31. echo 'Bad command-line' $1
  32. exit 1
  33. }
  34. test "x$1" = x-o || bummer
  35. shift
  36. test "x$1" = x && bummer ': missing DOC'
  37. output="$1"
  38. temout="$output"T
  39. shift
  40. test "x$1" && test -r "$1" || bummer ': missing SRC'
  41. input="$1"
  42. shift
  43. test "x$1" = x-- || bummer
  44. shift
  45. # Before snarfing, do the function name check.
  46. ${AWK} -f '@srcdir@/guile-func-name-check' "$input" || exit 1
  47. # Snarfing takes two steps: cpp and tokenization.
  48. # If cpp fails, don't bother with tokenization.
  49. if ${CPP} -DSCM_MAGIC_SNARF_DOCS "$@" "$input" > "$temout" ; then
  50. $filter --filter-snarfage < "$temout" > "$output"
  51. rv=0
  52. else
  53. rv=1
  54. fi
  55. rm -f "$temout"
  56. exit $rv
  57. # guile-snarf-docs ends here