#! /opt/bin/dash # .zip files # while read name desc do if [ ! -d "$name" ]; then continue; fi zip="$name/$name.zip" x="1" if [ -r "$zip" ]; then x=$(find "$name" -type f -newer "$zip" -print) fi if [ -n "$x" ]; then echo "Creating $zip" rm -f "$zip" zip -rq tmp.zip "$name" mv tmp.zip "$zip" fi done < LIST # single file format # while read name desc do if [ ! -d "$name" ]; then f="vecr/$name" if [ ! -r "$f" ]; then echo "Creating link $f"; ln -s "../$name" "$f"; fi continue fi f="vecr/$name.cc" x="1" if [ -r "$f" ]; then x=$(find "$name" -type f -newer "$f" -print | egrep -v 'Makefile|\.zip|output\.txt') fi if [ -n "$x" ]; then echo "Creating $f" NAME=$(echo "$name" | tr '[:lower:]' '[:upper:]') case "$name" in LL) extra="$name/Node.h"; zz="Node"; ZZ="NODE";; Tree) extra="$name/Node.h"; zz="Node"; ZZ="NODE";; *) extra=""; zz="_zz_"; ZZ="_ZZ_";; esac for c in "$extra" "$name/$name.h" "$name/$name.cc" "$name/main.cc" do if [ -r "$c" ]; then sed -e "s;^#endif;// &;" \ -e "s;^#ifndef $NAME;// &;" -e "s;^#define $NAME;// &;" \ -e "s;^#include \"$name;// &;" \ -e "s;^#ifndef $ZZ;// &;" -e "s;^#define $ZZ;// &;" \ -e "s;^#include \"$zz;// &;" "$c" fi done > "$f" fi done < LIST # examples.html # f="examples.html" x=$(find "LIST" make.sh -newer "$f" -print) if [ -n "$x" ]; then echo "Creating $f" title="C++ Examples" echo "$title

$title

" > "$f" br="" while read name desc do slash=""; if [ -d "$name" ]; then slash="/"; fi echo "$br$name $desc" br="
" done < LIST >> "$f" echo "

vecr - single file format

zyb - zyBooks examples " >> "$f" echo "weblint $f" weblint "$f" fi # vecr/cpp.list # find ../c* -name 'z*.cc' | awk -F/ '{ print $2, $3 }' | while read c z do if [ ! -r "zyb/$z" ]; then echo "Creating link zyb/$z" ln -s "../../$c/$z" "zyb/$z" fi done f="vecr/cpp.list" x=$(find "LIST" zyb -newer "$f" -print | head -1) if [ -n "$x" ]; then echo "Creating $f" while read name desc do if [ ! -d "$name" ]; then echo "cpp/${name} $desc" else echo "cpp/${name}.cc $desc" fi done < LIST > "$f" find zyb -name '*.cc' -print | sed 's;^zyb/z;;' | sort -t. -k1,1n -k2,2n | sed 's;^;zyb/z;' >> "$f" fi