summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2006-06-15 13:30:55 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2006-06-15 13:30:55 +0000
commit4ffee69f8de513f0db0e777ed195476c74c59090 (patch)
tree8fb6b160166cdc6d35d9473501b1ade6bb3defbb
parent3bd03f85964a48e82d2c488cc5dc3c36c6dcab2a (diff)
downloadmailutils-4ffee69f8de513f0db0e777ed195476c74c59090.tar.gz
mailutils-4ffee69f8de513f0db0e777ed195476c74c59090.tar.bz2
Fix docfile generation
-rwxr-xr-xscripts/guile-1.6/guile-doc-snarf15
-rw-r--r--scripts/guile-1.6/guile-doc-snarf.awk26
2 files changed, 22 insertions, 19 deletions
diff --git a/scripts/guile-1.6/guile-doc-snarf b/scripts/guile-1.6/guile-doc-snarf
index b3645f276..c7264bdf3 100755
--- a/scripts/guile-1.6/guile-doc-snarf
+++ b/scripts/guile-1.6/guile-doc-snarf
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2002 Sergey Poznyakoff
+# Copyright (C) 2002, 2006 Sergey Poznyakoff
#
# This is a snarfer for guile version 1.6
#
@@ -33,7 +33,7 @@ do
-d) DOCFILE=1; shift;;
*) break;;
esac
-done
+done
INFILE=$1; shift
@@ -50,15 +50,8 @@ snarf_x() {
snarf_doc() {
$CPP -DSCM_MAGIC_SNARF_DOCS "$@" > ${temp}
cpp_exit=$?
- $AWK '
-NF<2 {next}
-state == 0 && /\^\^ {/ { state = 1; print; next }
-state == 0 && /\^\^/ { print }
-state == 1 && /\^\^ }/ { state = 0; print; next }
-state == 1 { print }
-state == 0 { next }' $temp |\
- tr -d '\n' | tr '^' '\n' |\
- $AWK -f $BASEDIR/guile-doc-snarf.awk > $OUTFILE
+ sed -n '/\^^ *{.*^^ *}/{s,\^^,\n,pg}' $temp | \
+ $AWK -f $BASEDIR/guile-doc-snarf.awk
}
case "$DOCFILE" in
diff --git a/scripts/guile-1.6/guile-doc-snarf.awk b/scripts/guile-1.6/guile-doc-snarf.awk
index d31043cd0..78725c188 100644
--- a/scripts/guile-1.6/guile-doc-snarf.awk
+++ b/scripts/guile-1.6/guile-doc-snarf.awk
@@ -1,4 +1,4 @@
-# Copyright (C) 2002 Sergey Poznyakoff
+# Copyright (C) 2002, 2006 Sergey Poznyakoff
#
# This is a snarfer for guile version 1.6
#
@@ -27,11 +27,18 @@ function flush() {
if (arg_req + arg_opt + arg_var != numargs)
error(cname " incorrectly defined as taking " numargs " arguments")
- print "\f" cname
+ print "\f" fname
print "@c snarfed from " loc_source ":" loc_line
- printf "@deffn {Scheme procedure} %s", cname
- for (i = 1; i <= numargs; i++)
- printf(" %s", arglist[i])
+ printf "@deffn {Scheme procedure} %s", fname
+ # All scheme primitives follow the same naming style:
+ # SCM argument names are in upper case.
+ # So, we convert them to lower case for @deffn line and
+ # replace their occurrences in the docstring by appropriate
+ # @var{} commands.
+ for (i = 1; i <= numargs; i++) {
+ printf(" %s", tolower(arglist[i]))
+ gsub(arglist[i], "@var{" tolower(arglist[i]) "}", docstring)
+ }
print ""
print docstring
print "@end deffn\n"
@@ -46,13 +53,13 @@ function error(s) {
exit 1
}
-state == 0 && /{/ {
+state == 0 && $1 == "{" {
flush()
cname = $3
next
}
-state == 0 && /fname/ { fname = $2; next }
+state == 0 && /fname/ { fname = substr($2,2,length($2)-2); next }
state == 0 && /type/ { type = $2; next }
state == 0 && /location/ { loc_source = $2; loc_line = $3 }
state == 0 && /arglist/ {
@@ -70,13 +77,16 @@ state == 0 && /arglist/ {
n = b[2]
}
if (m > 2 || t != "SCM")
- error(cname ": wrong argument type for arg " i " " t)
+ error(cname ": wrong argument type for arg " i " " t)
arglist[i] = n
}
}
state == 0 && /argsig/ { arg_req = $2; arg_opt = $3; arg_var = $4 }
state == 0 && /.*\"/ {
+ # Concatenate strings. A very simplified version, but
+ # works for us
+ gsub("\\\\n\" *\"", "\n")
gsub("\"\"", "")
gsub("\\\\n", "\n")
match($0,"\".*\"")

Return to:

Send suggestions and report system problems to the System administrator.