6 if grep --version 2>/dev
/null |
grep GNU
>/dev
/null
; then
9 echo "GNU grep not found; skipping test"
13 test -z "$srcdir" && srcdir
=.
16 echo Checking documentation
for incorrect syntax
20 if test "x$SGML_DOCS" = x
; then
21 FILES
=$all_cairo_files
22 if test "x$FILES" = x
; then
23 FILES
=`find . -name 'cairo*.h' -or -name 'cairo*.c' -or -name 'cairo*.cpp'`
27 enum_regexp
="\([^%@']\|^\)\<\(FALSE\|TRUE\|NULL\|CAIRO_[0-9A-Z_]*\)\($\|[^(A-Za-z0-9_]\)"
28 if test "x$SGML_DOCS" = x
; then
29 enum_regexp
='^[^:]*:[/ ][*]\(\|[ \t].*\)'$enum_regexp\
($\|
[^
:]\
)
31 if echo $FILES |
xargs grep .
/dev
/null |
sed -e '/<programlisting>/,/<\/programlisting>/d' |
grep "$enum_regexp" |
grep -v '#####'; then
33 echo Error
: some macros
in the docs are not prefixed by percent sign.
34 echo Fix this by searching
for the following regexp
in the above files
:
35 echo " '$enum_regexp'"
38 type_regexp
="\( .*[^#']\| \|^\)\<cairo[0-9a-z_]*_t\>\($\|[^:]$\|[^:].\)"
39 if test "x$SGML_DOCS" = x
; then
40 type_regexp
='^[^:]*:[/ ][*]'$type_regexp
42 type_regexp
='\(.'$type_regexp'\)\|\('$type_regexp'.\)'
45 if echo $FILES |
xargs grep .
/dev
/null |
sed -e '/<programlisting>/,/<\/programlisting>/d' |
grep -v "@Title" |
grep "$type_regexp" |
grep -v '#####'; then
47 echo Error
: some
type names
in the docs are not prefixed by
hash sign
,
48 echo neither are the only token
in the doc line followed by colon.
49 echo Fix this by searching
for the following regexp
in the above files
:
50 echo " '$type_regexp'"
53 func_regexp
="\([^#']\|^\)\<\(cairo_[][<>/0-9a-z_]*\>[^][<>(]\)"
54 if test "x$SGML_DOCS" = x
; then
55 func_regexp
='^[^:]*:[/ ][*]\(\|[ \t].*\)'$func_regexp
58 # We need to filter out gtk-doc markup errors for program listings.
59 if echo $FILES |
xargs grep .
/dev
/null |
sed -e '/<programlisting>/,/<\/programlisting>/d' |
grep "$func_regexp" |
grep -v '^[^:]*: [*] [a-z_0-9]*:$' |
grep -v '#####'; then
61 echo Error
: some
function names
in the docs are not followed by parentheses.
62 echo Fix this by searching
for the following regexp
in the above files
:
63 echo " '$func_regexp'"
66 note_regexp
='\<NOTE\>'
67 if echo $FILES |
xargs grep "$note_regexp" /dev
/null
; then
69 echo Error
: some
source files contain the string
'NOTE'.
70 echo Be civil and replace it by
'Note' please.
73 # Only run the syntax checker on the source files (not doc/)
74 if test -e .
/check-doc-syntax.
awk; then
75 if echo $FILES |
xargs awk -f .
/check-doc-syntax.
awk ; then