Skip to content

Commit

Permalink
find files with undocumented code blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Timm Knape committed Aug 7, 2019
1 parent d5ccf7b commit e1ce864
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,8 @@ hx_run: \
@cd ../docs && hx
@touch hx_run

dist_bin_SCRIPTS = hx-files.sh hx-incs.sh
dist_bin_SCRIPTS = \
hx-files.sh \
hx-incs.sh \
hx-undoc.sh

6 changes: 5 additions & 1 deletion src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,11 @@ AM_CXXFLAGS = -Wall
hx_SOURCES = hx.cpp
hx_LDADD = @CURSES_LIBS@
hx_CPPFLAGS = @CURSES_CFLAGS@
dist_bin_SCRIPTS = hx-files.sh hx-incs.sh
dist_bin_SCRIPTS = \
hx-files.sh \
hx-incs.sh \
hx-undoc.sh

all: all-am

.SUFFIXES:
Expand Down
3 changes: 2 additions & 1 deletion src/hx-files.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

grep '[dD]ef[(]file: ' $* </dev/null | \
FILEs=${*:-index.x}
grep '[dD]ef[(]file: ' $FILEs </dev/null | \
cut '-d(' -f2 | \
cut '-d)' -f1 | \
cut '-d ' -f2 | \
Expand Down
2 changes: 1 addition & 1 deletion src/hx-incs.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

FILES="index.x "
FILES="${*:-index.x} "
NR=1
USED=""

Expand Down
21 changes: 21 additions & 0 deletions src/hx-srcs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

FILES="${*:-index.x} "
USED=""

while [[ "x$FILES" != "x" ]]; do
i=`expr match "${FILES}" '[^ ]* '`
f=${FILES:0:$i}
FILES=${FILES#$f}
j=`expr match "${USED}" '(.* )*$f '`
if [[ "$j" = "0" ]]; then
echo $f
USED="$f $USED"
NEW=`grep '@inc(' $f | cut '-d(' -f2 | cut '-d)' -f1`
TOADD=''
for n in $NEW; do
TOADD="$TOADD$n "
done
FILES="$TOADD$FILES"
fi
done
4 changes: 4 additions & 0 deletions src/hx-undoc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

FILEs=`hx-srcs.sh $*`
grep -lPzo '\n```\n\n' $FILEs

0 comments on commit e1ce864

Please sign in to comment.