2008-01-28 21:49:26 -05:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
|
|
LANG=C
|
|
|
|
|
|
2008-01-28 23:56:23 -05:00
|
|
|
if ! grep --version 2>/dev/null | grep GNU >/dev/null; then
|
|
|
|
|
echo "GNU grep not found; skipping test"
|
|
|
|
|
exit 0
|
|
|
|
|
fi
|
|
|
|
|
|
2008-01-28 21:49:26 -05:00
|
|
|
test -z "$srcdir" && srcdir=.
|
|
|
|
|
status=0
|
|
|
|
|
|
2008-01-28 23:56:23 -05:00
|
|
|
echo Checking documentation for incorrect syntax
|
2008-01-28 21:49:26 -05:00
|
|
|
|
2008-01-29 00:34:00 -05:00
|
|
|
# Note: this test is also run from doc/public/ to check the SGML files
|
2008-01-28 21:49:26 -05:00
|
|
|
|
2008-01-29 00:34:00 -05:00
|
|
|
if test "x$SGML_DOCS" = x; then
|
2008-05-08 18:18:17 -04:00
|
|
|
FILES=$cairo_all_source_files
|
|
|
|
|
if test "x$FILES" = x; then
|
|
|
|
|
FILES=`find "$srcdir" -name '*.h' -or -name '*.c' -or -name '*.cpp'`
|
|
|
|
|
fi
|
2008-01-29 00:34:00 -05:00
|
|
|
fi
|
|
|
|
|
|
2008-05-09 09:53:40 -04:00
|
|
|
enum_regexp='\([^%@]\|^\)\<\(FALSE\|TRUE\|NULL\|CAIRO_[0-9A-Z_]*\)\($\|[^(A-Za-z0-9_]\)'
|
|
|
|
|
if test "x$SGML_DOCS" = x; then
|
|
|
|
|
enum_regexp='^[^:]*:[/ ][*] .*'$enum_regexp
|
|
|
|
|
fi
|
|
|
|
|
if grep . /dev/null $FILES | sed -e '/<programlisting>/,/<\/programlisting>/d' | grep "$enum_regexp" | grep -v '#####'; then
|
|
|
|
|
status=1
|
|
|
|
|
echo Error: some macros in the docs are not prefixed by percent sign.
|
|
|
|
|
echo Fix this by searching for the following regexp in the above files:
|
|
|
|
|
echo " '$enum_regexp'"
|
|
|
|
|
fi
|
2008-01-28 21:49:26 -05:00
|
|
|
|
2008-01-29 00:34:00 -05:00
|
|
|
type_regexp='\( .*[^#]\| \|^\)\<cairo[0-9a-z_]*_t\>\($\|[^:]$\|[^:].\)'
|
|
|
|
|
if test "x$SGML_DOCS" = x; then
|
2008-05-09 09:53:40 -04:00
|
|
|
type_regexp='^[^:]*:[/ ][*]'$type_regexp
|
2008-01-29 00:34:00 -05:00
|
|
|
else
|
|
|
|
|
type_regexp='\(.'$type_regexp'\)\|\('$type_regexp'.\)'
|
|
|
|
|
fi
|
2008-04-29 10:02:51 +01:00
|
|
|
|
2008-05-09 09:53:40 -04:00
|
|
|
if grep . /dev/null $FILES | sed -e '/<programlisting>/,/<\/programlisting>/d' | grep "$type_regexp" | grep -v '#####'; then
|
2008-01-28 21:49:26 -05:00
|
|
|
status=1
|
2008-01-28 22:10:20 -05:00
|
|
|
echo Error: some type names in the docs are not prefixed by hash sign,
|
2008-01-29 05:32:24 -05:00
|
|
|
echo neither are the only token in the doc line followed by colon.
|
2008-01-28 22:10:20 -05:00
|
|
|
echo Fix this by searching for the following regexp in the above files:
|
|
|
|
|
echo " '$type_regexp'"
|
2008-01-28 21:49:26 -05:00
|
|
|
fi
|
|
|
|
|
|
2008-01-29 00:34:00 -05:00
|
|
|
func_regexp='\([^#]\|^\)\<\(cairo_[][<>/0-9a-z_]*\> \?[^][ <>(]\)'
|
|
|
|
|
if test "x$SGML_DOCS" = x; then
|
2008-05-09 09:53:40 -04:00
|
|
|
func_regexp='^[^:]*:[/ ][*] .*'$func_regexp
|
2008-01-29 00:34:00 -05:00
|
|
|
fi
|
2008-04-29 10:02:51 +01:00
|
|
|
|
|
|
|
|
# We need to filter out gtk-doc markup errors for program listings.
|
2008-05-09 09:53:40 -04:00
|
|
|
if grep . /dev/null $FILES | sed -e '/<programlisting>/,/<\/programlisting>/d' | grep "$func_regexp" | grep -v '#####'; then
|
2008-01-28 21:49:26 -05:00
|
|
|
status=1
|
2008-01-29 05:32:24 -05:00
|
|
|
echo Error: some function names in the docs are not followed by parentheses.
|
2008-01-28 21:49:26 -05:00
|
|
|
echo Fix this by searching for the following regexp in the above files:
|
|
|
|
|
echo " '$func_regexp'"
|
|
|
|
|
fi
|
|
|
|
|
|
2008-01-28 21:53:44 -05:00
|
|
|
note_regexp='NOTE'
|
|
|
|
|
if grep "$note_regexp" $FILES; then
|
|
|
|
|
status=1
|
|
|
|
|
echo Error: some source files contain the string 'NOTE'.
|
|
|
|
|
echo Be civil and replace it by 'Note' please.
|
|
|
|
|
fi
|
|
|
|
|
|
2008-01-28 21:49:26 -05:00
|
|
|
exit $status
|