X-Git-Url: http://git.hcoop.net/bpt/guile.git/blobdiff_plain/9d29e9906eb7f44184c57e9564ee6e1d33964018..e87f059319e40b582d5ee8fd815876550f1148b9:/libguile/guile-snarf.awk.in diff --git a/libguile/guile-snarf.awk.in b/libguile/guile-snarf.awk.in index 45ad42b88..8a720a002 100644 --- a/libguile/guile-snarf.awk.in +++ b/libguile/guile-snarf.awk.in @@ -1,3 +1,20 @@ +# Copyright (C) 1999, 2000, 2001, 2006 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation; either version 3, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this software; see the file COPYING.LESSER. If +# not, write to the Free Software Foundation, Inc., 51 Franklin +# Street, Fifth Floor, Boston, MA 02110-1301 USA +# # Written by Greg J. Badros, # 12-Dec-1999 @@ -40,6 +57,9 @@ BEGIN { FS="|"; sub(/ \)/,")",copy); # Now `copy' contains the nice scheme proc "prototype", e.g. # (set-car! pair value) + # Since this is destined to become Texinfo source, + # quote any `@'s that occur in the prototype. + gsub(/\@/,"@@",copy); # print copy > "/dev/stderr"; # for debugging sub(/^\(/,"",copy); sub(/\)[ \t]*$/,"",copy); @@ -76,18 +96,38 @@ BEGIN { FS="|"; print "@deffn primitive " nicer_function_proto > dot_doc_file; } -/SCM_SNARF_DOCSTRING_START/,/SCM_SNARF_DOCSTRING_END.*$/ { copy = $0; - gsub(/.*SCM_SNARF_DOCSTRING_START/,"",copy); - sub(/^[ \t]*\"?/,"", copy); - sub(/\"?[ \t]*SCM_SNARF_DOCSTRING_END.*$/,"", copy); - gsub(/\\n\\n\"?/,"\n",copy); - gsub(/\\n\"?[ \t]*$/,"",copy); - gsub(/\\\"/,"\"",copy); - gsub(/[ \t]*$/,"", copy); - if (copy != "") { print copy > dot_doc_file } +/SCM_SNARF_DOCSTRING_START/,/SCM_SNARF_DOCSTRING_END.*$/ { copy = $0; + + # Trim everything up to and including + # SCM_SNARF_DOCSTRING_START marker. + gsub(/.*SCM_SNARF_DOCSTRING_START/,"",copy); + + # Trim leading whitespace and opening quote. + sub(/^[ \t]*\"?/,"", copy); + + # Trim closing quote and trailing whitespace, or + # closing quote and whitespace followed by the + # SCM_SNARF_DOCSTRING_END marker. + sub(/[ \t]*\"?[ \t]*$/,"", copy); + sub(/[ \t]*\"?[ \t]*SCM_SNARF_DOCSTRING_END.*$/,"", copy); + + # Replace escaped characters. + gsub(/\\n/,"\n",copy); + gsub(/\\\"/,"\"",copy); + gsub(/\\\\/,"\\",copy); + + # Some docstrings end each line with "\n", while + # others don't. Therefore we always strip off one "\n" + # if present at the end of the line. Docstrings must + # therefore always use "\n\n" to indicate a blank line. + if (copy != "") + { + sub(/[ \t]*\n$/, "", copy); + print copy > dot_doc_file; + } } -/SCM_SNARF_DOCSTRING_END[ \t]/ { print "@end deffn" >> dot_doc_file; } +/SCM_SNARF_DOCSTRING_END[ \t]*/ { print "@end deffn" >> dot_doc_file; } /\*&\*&\*&\*SCM_ARG_BETTER_BE_IN_POSITION/ { copy = $0; sub(/.*\*&\*&\*&\*SCM_ARG_BETTER_BE_IN_POSITION\([ \t]*/,"",copy);