diff --git a/scripts/documented.sh b/scripts/documented.sh old mode 100644 new mode 100755 index 24bb7b3e54..94633a78ea --- a/scripts/documented.sh +++ b/scripts/documented.sh @@ -1,9 +1,15 @@ #!/bin/sh bindir=$1 -VERSION=1.0 +# usage: scripts/documented.sh +# for example: +# scripts/documented.sh $HOME/build/glibc -grep -E -h @deftypefu?nx? *.texi ../linuxthreads/*.texi | +VERSION=1.1 + +# Collect the documented functions from manual/*.texi files. + +grep -E -h @deftypefu?nx? manual/*.texi | sed -e 's/@deftypefunx*[[:space:]]*\({[^{]*}\|[[:alnum:]_]*\)[[:space:]]*\([[:alnum:]_]*\).*/\2/' -e 's/@deftypefn {[^}]*function}*[[:space:]]*\({[^{]*}\|[[:alnum:]_]*\)[[:space:]]*\([[:alnum:]_]*\).*/\2/' -e '/^@/d' | sed -e '/^obstack_/d' -e '/^\([lf]\|\)stat\(\|64\)$/d' -e '/^mknod$/d' | sed -e '/^signbit$/d' -e '/^sigsetjmp$/d' | @@ -12,9 +18,11 @@ sed -e '/^__fwriting$/d' -e '/^__fwritable$/d' -e '/^__fsetlocking$/d' | sed -e '/^__freading$/d' -e '/^__freadable$/d' -e '/^__fpurge$/d' | sed -e '/^__fpending$/d' -e '/^__flbf$/d' -e '/^__fbufsize$/d' | sed -e '/^alloca$/d' | +sed -r '/^\s*$/d' | sort -u > DOCUMENTED -nm --extern --define $bindir/libc.so $bindir/math/libm.so $bindir/rt/librt.so $bindir/linuxthreads/libpthread.so $bindir/dlfcn/libdl.so $bindir/login/libutil.so | +# extract the exported symbols from the libraries. +nm --extern --define $bindir/libc.so $bindir/math/libm.so $bindir/rt/librt.so $bindir/nptl/libpthread.so $bindir/dlfcn/libdl.so $bindir/login/libutil.so | grep -E " [TW] ([[:alpha:]]|_[[:alpha:]])" | sed 's/\(@.*\)//' | cut -b 12- | @@ -23,7 +31,10 @@ sed -e '/^_argp/d' -e '/^_authenticate$/d' -e '/^_environ$/d' | sed -e '/^_errno$/d' -e '/^_h_errno$/d' -e '/^_longjmp$/d' | sed -e '/^_mcleanup$/d' -e '/^_rpc_dtablesize$/d' -e '/^_seterr_reply$/d' | sed -e '/^_nss/d' -e '/^_setjmp$/d' | -sort -u > AVAILABLE +sort -u > AVAILABLE_WITH_OFFSET + +# Build a list of available functions with out the offsets +cat AVAILABLE_WITH_OFFSET | cut -d ' ' -f 3 >AVAILABLE cat < @@ -39,9 +50,7 @@ cat < + starting to work.

A few comments:

@@ -52,18 +61,20 @@ cat <Similarly for the LFS functions (those ending in 64). -

The function sombody already volunteered to document are marked - with a reference to the person.

EOF n=0 -diff -y --width=60 --suppress-common-lines DOCUMENTED AVAILABLE | -expand | cut -b 33- | sed '/^[[:space:]]*$/d' | +# get the list of undocumented functions +grep -Fvx -f DOCUMENTED AVAILABLE> UNDOCUMENTED + +diff -y --width=120 --suppress-common-lines DOCUMENTED UNDOCUMENTED | +expand | cut -b 61- | sed '/^[[:space:]]*$/d' | while read name; do + with_offset=`grep -w $name AVAILABLE_WITH_OFFSET`; line="$line -" +" n=$(expr $n + 1) if [ $n -eq 4 ]; then echo " @@ -95,8 +106,10 @@ cat <
-
Ulrich Drepper
-Generated on $(date) with documented.sh version $VERSION + Generated on $(date) with documented.sh version $VERSION EOF + +# cleanup the files +rm -rf UNDOCUMENTED_WITHOUT_OFFSET UNDOCUMENTED AVAILABLE AVAILABLE_WITH_OFFSET DOCUMENTED
$name$with_offset