/usr/bin/nountangle is in noweb 2.11b-11+b1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | #!/bin/sh
#
# Copyright 1991 by Norman Ramsey. All rights reserved.
# See file COPYRIGHT for more information.
# set -x
LIB=/usr/lib/noweb
markup=$LIB/markup opt= arg= filters=
width=72 subst='gsub("\\*/", "* /", s)' format='/* %%-%ds */'
while [ $# -gt 0 ]; do
case $1 in
-ml|-m3) format='(* %%-%ds *)' ;
subst='gsub("\\*\\)", "* )", s); gsub("\\(\\*", "( *", s)' ;;
-awk|-icn|-icon) format='# %%-%ds' ; subst=' ' ;;
-lisp|-scm) format=';;; %%-%ds' ; subst=' ' ;;
-matlab) format='%%%% %%-%ds' ; subst=' ' ;;
-c++) format='// %%-%ds' ; subst=' ' ;;
-c) format='/* %%-%ds */' subst='gsub("\\*/", "* /", s)' ;;
-pascal) format='{ %%-%ds }' ; subst='gsub("[{}]", "-", s)' ;;
-f77) format='C %%-%ds' ; subst=' ' ;;
-f90) format='! %%-%ds' ; subst=' ' ;;
-tex) format='%%%% %%-%ds' ; subst=' ' ;;
-L*) ;; # deliberately ignore requests for #line
-w[0-9][0-9]*) width=`echo $1 | sed 's/^-w//'` ;;
-filter) filters=" $filters | $2 " ; shift ;;
-markup) markup="$2" ; shift ;;
-) arg="$arg '$1'" ;;
-*) opt="$opt '$1'" ;;
*) arg="$arg '$1'" ;;
esac
shift
done
PATH="$PATH:$LIB" eval "$markup $arg $filters" |
awk 'BEGIN { line = 0; capture = 0; format=sprintf("'"$format"'",'"$width"') }
function comment(s) {
'"$subst"'
return sprintf(format,s)
}
function grab(s) {
if (capture==0) print
else holding[line] = holding[line] s
}
/^@end doc/ { capture = 0; holding[++line] = "" ; next }
/^@begin doc/ { capture = 1; next }
/^@text / { grab(substr($0,7)); next}
/^@quote$/ { grab("[[") ; next}
/^@endquote$/ { grab("]]") ; next}
/^@nl$/ { if (capture !=0 ) {
holding[++line] = ""
} else if (defn_pending != 0) {
print "@nl"
for (i=0; i<=line && holding[i] ~ /^ *$/; i++) i=i
for (; i<=line; i++) printf "@text %s\n@nl\n", comment(holding[i])
line = 0; holding[0] = ""
defn_pending = 0
} else print
next
}
/^@defn / { holding[line] = holding[line] "<"substr($0,7)">=" # (line should be blank)
print ; defn_pending = 1 ; next }
{ print }' |
eval "$LIB/nt $opt"
|