Hogwarts Wand Docs: ../web/do_doc

File: ../web/do_doc

#!/bin/bash
# Copyright (C) 2004,2006 by Nathan (Acorn) Pooley
#
# do_doc
#
#@DOC@ script for creating documentation files in html format
#

#
# wand_src_dirs = source dirs for wand code
#
wand_src_dirs="../sw"
src_dirs="$wand_src_dirs ../server"
all_dirs="$src_dirs ../web"

ddir="website"

docstr='@DO'"C@"

do_code=1
if [[ $1 = '-nosource' ]] ; then
    do_code=0
fi

_abort() {
    if [[ -n $1 ]] ; then
        echo "$*" >&2
    fi
    echo "Aborting" >&2
    exit 1
}

_verb() {
    echo "do_doc: $*" >&2
}

if [[ ! -d $ddir ]] ; then
    mkdir $ddir
fi
if [[ ! -d $ddir ]] ; then
    _abort "Could not create directory '$ddir'"
fi
if [[ ! -a Docs ]] ; then
    ln -s $ddir Docs
fi

if (( do_code )) ; then
    _verb "deleting old documents"
    for i in $ddir/*
    do
        if [[ -f "$i" ]] ; then
            echo "<html><body><h1>DELETED</h1></body></html>" > $i
        fi
    done
fi

_verb "making documents in '$ddir'"

_docname() {
    echo -n "$1" |              \
        sed \
            -e 's|^../||g'      \
            -e 's|\.|_|g'       \
            -e 's|/|_|g'        \
            -e 's|_htm$||'      \
            -e 's|_html$||' \
            -e 's|$|.html|'
}

_html_begin() {
    typeset title=""
    typeset title2=""
    if [[ -n $1 ]] ; then
        title="Hogwarts Wand Docs: $*"
        title2="<a href=\"index.html\">Hogwarts Wand Docs:</a> $*"
    else
        title="Hogwarts Wand Documentation"
        title2="$title"
    fi
    echo "<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">"
    echo "<html>"
    echo "<head>"
    echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">"
    echo "<meta name=\"Author\" content=\"do_doc by Acorn\">"
    echo "<title>$title</title>"
    echo "</head>"
    echo "<body text=\"#330000\" bgcolor=\"#FFCC00\" link=\"#CC0000\" vlink=\"#660066\" alink=\"#660066\">"

    echo "<h1>$title2</h1>"
}

_html_end() {
    echo "<center>"
    echo "<hr WIDTH=\"100%\"></center>"
    echo "<p>"
    echo "This file Copyright (C) 2006 by Nathan (Acorn) Pooley<br>"
    echo "<a href=\"index.html\">Go to TOP Wand page</a><br>"
    echo "<a href=\"http://www.rawbw.com/~acorn\">Go to Acorn's personal webpage</a><br>"
    echo "<a href=\"http://www.gotohogwarts.com\">Go to Hogwarts website: www.gotohogwarts.com</a><br>"
    echo "<a href=\"http://www.snout.org/game\">Snout: www.snout.org/game</a><br>"
    echo "<a href=\"http://www.rawbw.com/~acorn/ju\">Gadgets of Justice Unlimited</a><br>"
    echo "<a href=\"http://www.snout.org/gc\">Snout GC (Wiki)</a><br>"
    echo "<a href=\"http://www.malum-iter.com/wiki/index.php?title=Main_Page\">Snout Wiki</a><br>"
    echo "File created by do_doc at `date`"
    echo "</p>"

    echo "</body>"
    echo "</html>"
}

_html_code_begin() {
    typeset title="$1"
    typeset color="$2"

    if [[ -z $color ]] ; then
        color='#FFCCFF'
    fi

    echo "<table CELLSPACING=5 CELLPADDING=0 WIDTH=\"100%\">"
    if [[ -n $title ]] ; then
        echo "<caption>"
        echo "<h1>$title</h1>"
        echo "</caption>"
    fi
    echo "<tr>"
    echo "<td BGCOLOR=\"$color\">"
    echo "<PRE>"
}

_html_code_end() {
    echo "</PRE>"
    echo "</td></tr></table>"
}


_filter_inc() {
    typeset dn=`_docname "$1"`
    _html_begin "$1"
    _html_code_begin "Wand Sourcecode: $1" "#FFCCFF"
    sed -f source.seds \
        -e "s|<a href=\"$dn\">\([^<]*\)</a>|\1|g"
    _html_code_end
    _html_end
}

_filter_asm() {
    typeset dn=`_docname "$1"`
    _html_begin "$1"
    _html_code_begin "Wand Sourcecode: $1" "#FFCCFF"
    sed -f source.seds \
        -e "s|<a href=\"$dn\">\([^<]*\)</a>|\1|g"
    _html_code_end
    _html_end
}

_filter_c() {
    typeset dn=`_docname "$1"`
    _html_begin "$1"
    _html_code_begin "Wand Sourcecode: $1" "#COCOCO"
    sed -f source.seds \
        -e "s|<a href=\"$dn\">\([^<]*\)</a>|\1|g"
    _html_code_end
    _html_end
}

_filter_txt() {
    typeset dn=`_docname "$1"`
    _html_begin "$1"
    _html_code_begin "File: $1" "#33CCFF"
    cat
    _html_code_end
    _html_end
}
#   sed -f source.seds \
#       -e "s|<a href=\"$dn\">\([^<]*\)</a>|\1|g"

_filter_str() {
    typeset dn=`_docname "$1"`
    _html_begin "$1"
    _html_code_begin "File: $1" "#66FF99"
    sed -f source.seds \
        -e "s|<a href=\"$dn\">\([^<]*\)</a>|\1|g"
    _html_code_end
    _html_end
}

_filter_script() {
    typeset dn=`_docname "$1"`
    _html_begin  "$1"
    _html_code_begin "File: $1" "#C0C0C0"
    sed -f source.seds \
        -e "s|<a href=\"$dn\">\([^<]*\)</a>|\1|g"
    _html_code_end
    _html_end
}

_filter_secret() {
    typeset dn=`_docname "$1"`
    _html_begin "$1"
    _html_code_begin "File: $1" "#FFFFFF"
    echo "<h2>This file is confidential</h2>"
    _html_code_end
    _html_end
}


#
# build sed script
#
_tohtml() {
    sed     \
    -e 's|&|\&amp;|g'       \
    -e 's|<|\&lt;|g'        \
    -e 's|>|\&gt;|g'        \
    -e 's|"|\&quot;|g'
}

_ignore_file() {
    typeset rv=0
    case "$1" in
        *.o)        rv=1 ;;
        *.d)        rv=1 ;;
        *.hex)      rv=1 ;;
        *.cod)      rv=1 ;;
        *.lst)      rv=1 ;;
        .cvsignore) rv=1 ;;
        *.mcp)      rv=1 ;;
        *.mcs)      rv=1 ;;
        *.mcw)      rv=1 ;;
        *.old)      rv=1 ;;
        *.works*)   rv=1 ;;
        *.swp)      rv=1 ;;
        *.bak*)     rv=1 ;;
        */tags)     rv=1 ;;
        tags)       rv=1 ;;
        */puke*)    rv=1 ;;
        puke*)      rv=1 ;;
        */wwlog.txt)    rv=1 ;;
        */dummy.html)   rv=1 ;;
    esac
    echo $rv
}

if (( do_code )) ; then


\rm -f source.seds

echo 's|&|\&amp;|g' >> source.seds
echo 's|<|\&lt;|g' >> source.seds
echo 's|>|\&gt;|g' >> source.seds
echo 's|"|\&quot;|g' >> source.seds

for sdir in $src_dirs
do
    for i in $sdir/*.*
    do
        ign=`_ignore_file $i`
        if [[ -f $i && $ign != 1 ]] ; then
            j=`_docname $i`
            k="${i##*/}"
            echo 's|\<'"$k"'\>|<a href="'"$j"'">&</a>|g' >> source.seds
        fi
    done
done

get_def='^[     ]*#*[   ]*define[   ]\+\([a-zA-Z_][a-zA-Z0-9_]*\)[  ].*'
get_sdf='^define[   ]\+\([a-zA-Z_][a-zA-Z0-9_]*\)[  ].*'
get_equ='^\([a-zA-Z_][a-zA-Z0-9_]*\)[   ]*[Ee][Qq][Uu].*'
get_lab='^\([a-zA-Z_][a-zA-Z0-9_]*\):.*'
get_str='^\(str_[a-zA-Z0-9_]\+\)[   ].*'
get_menu='^MENU[    ]\+\(mode_[a-zA-Z0-9_]\+\)[     ].*'
get_text='^TEXT[    ]\+\(mode_[a-zA-Z0-9_]\+\)[     ].*'
get_entry='^ENTRY[  ]\+\(mode_[a-zA-Z0-9_]\+\)[     ].*'
get_func='^FPTR[    ]\+\([a-zA-Z_][a-zA-Z0-9_]*\)[  ].*'
to_link1='s:\\<\1\\>:<a href="'
to_link2='doctarget_\1">\&</a>:g'

to_link1func='s:\\<func_\1\\>:<a href="'

_filter_tosed() {
    typeset fn="$1"
    typeset dfn=`_docname "$1"`
    if [[ $fn != gstrings.inc && $fn != gfuncs.inc ]] ; then
        sed -n  \
            -e "s|$get_def|$to_link1$dfn#d$to_link2|p" \
            $fn >> source.seds
    fi
    sed -n  \
        -e "s|$get_equ|$to_link1$dfn#e$to_link2|p" \
        $fn >> source.seds
    sed -n  \
        -e "s|$get_lab|$to_link1$dfn#l$to_link2|p" \
        $fn >> source.seds
}

_filter_tosed_str() {
    typeset fn="$1"
    typeset dfn=`_docname "$1"`
    sed -n  \
        -e "s|$get_sdf|$to_link1$dfn#sd$to_link2|p" \
            $fn >> source.seds
    sed -n  \
        -e "s|$get_str|$to_link1$dfn#ss$to_link2|p" \
        $fn >> source.seds
    sed -n  \
        -e "s|$get_menu|$to_link1$dfn#sm$to_link2|p" \
        $fn >> source.seds
    sed -n  \
        -e "s|$get_text|$to_link1$dfn#st$to_link2|p" \
        $fn >> source.seds
    sed -n  \
        -e "s|$get_entry|$to_link1$dfn#se$to_link2|p" \
        $fn >> source.seds
    sed -n  \
        -e "s|$get_func|$to_link1func$dfn#l$to_link2|p" \
        $fn >> source.seds
}


echo "s|$get_def|<a name=\"ddoctarget_\\1\"></a>&|" >> source.seds
echo "s|$get_equ|<a name=\"edoctarget_\\1\"></a>&|" >> source.seds
echo "s|$get_lab|<a name=\"ldoctarget_\\1\"></a>&|" >> source.seds
echo "s|$get_sdf|<a name=\"sddoctarget_\\1\"></a>&|" >> source.seds
echo "s|$get_str|<a name=\"ssdoctarget_\\1\"></a>&|" >> source.seds
echo "s|$get_menu|<a name=\"smdoctarget_\\1\"></a>&|" >> source.seds
echo "s|$get_text|<a name=\"stdoctarget_\\1\"></a>&|" >> source.seds
echo "s|$get_entry|<a name=\"sedoctarget_\\1\"></a>&|" >> source.seds

for sdir in $wand_src_dirs
do
    for i in $sdir/*.asm
    do
        if [[ -f $i ]] ; then
            _verb "Checking for symbols in '$i'"
            _filter_tosed $i
        fi
    done

    for i in $sdir/*.inc
    do
        if [[ $i != gstrings.inc ]] ; then
            if [[ -f $i ]] ; then
                _verb "Checking for symbols in '$i'"
                _filter_tosed $i
            fi
        fi
    done

    for i in $sdir/*.str $sdir/*.sstr
    do
        if [[ -f $i ]] ; then
            _verb "Checking for symbols in '$i'"
            _filter_tosed_str $i
        fi
    done
done

#
# turn off links to self (3x in case there are nested instances)
#           1          1 2                      2 3         3                    4      4
dbl_link='^\(<a name="\)\([lde]doctarget_[^"]\+\)\("></a>.*\)<a href="[^"]*#\2">\([^<]*\)</a>'
to_unlink='\1\2\3\4'
echo "s|$dbl_link|$to_unlink|g" >> source.seds
echo "s|$dbl_link|$to_unlink|g" >> source.seds
echo "s|$dbl_link|$to_unlink|g" >> source.seds

opcodes="addwf addwfc andwf clrf comf cpfseq cpfsgt cpfslt decf decfsz dcfsnz incf"
opcodes="$opcodes incfsz infsnz iorwf movf movff movwf mulwf negf rlcf rlncf rrcf rrncf setf"
opcodes="$opcodes subfwb subwf subwfb swapf tstfsz xorwf bcf bsf btfsc btfss btg bc bn bnc"
opcodes="$opcodes bnn bnov bnz bov bra bz call clrwdt daw goto nop pop push rcall reset retfie"
opcodes="$opcodes retlw return sleep addlw andlw iorlw lfsr movlb movlw mullw retlw sublw xorlw"
opcodes="$opcodes tblrd tblwt"
opcodes="$opcodes equ org radix end __config include define if else endif ifdef ifndef"
opcodes="$opcodes ADDWF ADDWFC ANDWF CLRF COMF CPFSEQ CPFSGT CPFSLT DECF DECFSZ DCFSNZ INCF"
opcodes="$opcodes INCFSZ INFSNZ IORWF MOVF MOVFF MOVWF MULWF NEGF RLCF RLNCF RRCF RRNCF SETF"
opcodes="$opcodes SUBFWB SUBWF SUBWFB SWAPF TSTFSZ XORWF BCF BSF BTFSC BTFSS BTG BC BN BNC"
opcodes="$opcodes BNN BNOV BNZ BOV BRA BZ CALL CLRWDT DAW GOTO NOP POP PUSH RCALL RESET RETFIE"
opcodes="$opcodes RETLW RETURN SLEEP ADDLW ANDLW IORLW LFSR MOVLB MOVLW MULLW RETLW SUBLW XORLW"
opcodes="$opcodes TBLRD TBLWT"
opcodes="$opcodes EQU ORG RADIX END __CONFIG"

for i in $opcodes
do
    echo "s|^\\([   a-zA-Z0-9_:]*\\)\\(\\<$i\\>\\)|\1<B>\2</B>|g" >> source.seds
done

clist="website/tmp_convert_list.txt"
\rm -f $clist

#
# convert files to html
#
for sdir in $all_dirs
do

    if (( do_code )) ; then
        for i in $sdir/*.asm
        do
            if [[ -f $i ]] ; then
                _verb "Converting '$i'"
                cat "$i" | detab -t4 | _filter_asm $i > $ddir/`_docname $i`
                echo "$i" >> $clist
            fi
        done

        for i in $sdir/*.inc
        do
            if [[ -f $i ]] ; then
                _verb "Converting '$i'"
                cat "$i" | detab -t4 | _filter_inc $i > $ddir/`_docname $i`
                echo "$i" >> $clist
            fi
        done

        for i in $sdir/*.c
        do
            if [[ -f $i ]] ; then
                _verb "Converting '$i'"
                cat "$i" | detab -t4 | _filter_c $i > $ddir/`_docname $i`
                echo "$i" >> $clist
            fi
        done

        for i in $sdir/*.h
        do
            if [[ -f $i ]] ; then
                _verb "Converting '$i'"
                cat "$i" | detab -t4 | _filter_c $i > $ddir/`_docname $i`
                echo "$i" >> $clist
            fi
        done

        for i in $sdir/*.str
        do
            if [[ -f $i ]] ; then
                _verb "Converting '$i'"
                cat "$i" | detab -t4 | _filter_str $i > $ddir/`_docname $i`
                echo "$i" >> $clist
            fi
        done

        for i in $sdir/*.sstr
        do
            if [[ -f $i ]] ; then
                _verb "Converting '$i' (secret)"
                echo "xxx" | _filter_secret $i > $ddir/`_docname $i`
                echo "$i" >> $clist
            fi
        done

        for i in $sdir/Make*
        do
            if [[ -f $i ]] ; then
                _verb "Converting '$i'"
                cat "$i" | detab -t4 | _filter_script $i > $ddir/`_docname $i`
                echo "$i" >> $clist
            fi
        done

    fi

    for i in $sdir/*.txt
    do
        if [[ -f $i ]] ; then
            if [[ $i != *wpic* && $i != *wwlog.txt ]] ; then
                _verb "Converting '$i'"
                cat "$i" | detab -t4 | _filter_txt $i > $ddir/`_docname $i`
            fi
            echo "$i" >> $clist
        fi
    done

    for i in $sdir/*.seds
    do
        if [[ -f $i ]] ; then
            if [[ $i != source.seds ]] ; then
                _verb "Converting '$i'"
                cat "$i" | detab -t4 | _filter_txt $i > $ddir/`_docname $i`
            fi
            echo "$i" >> $clist
        fi
    done

    for i in $sdir/*.html
    do
        if [[ -f $i && $i != *pic_chart* ]] ; then
            _verb "Converting '$i'"
            cat "$i" > $ddir/`_docname $i`
            echo "$i" >> $clist
        fi
    done

    for i in `grep -n -H 'bin/bash' $sdir/* | sed -n -e 's|:1:.*||p' | sort -u`
    do
        if [[ -f $i ]] ; then
            _verb "Converting '$i'"
            cat "$i" | detab -t4 | _filter_script $i > $ddir/`_docname $i`
            echo "$i" >> $clist
        fi
    done

    #
    # ignore these files
    #
    for i in $sdir/*
    do
        ign=`_ignore_file $i`
        if [[ -f $i && $ign = 1 ]] ; then
            echo "$i" >> $clist
        fi
    done

done

#
# convert some special cases
#
for i in ../server/picsim2pic.seds ../server/fff ../server/ss
do
    if [[ -f $i ]] ; then
        _verb "Converting '$i'"
        cat "$i" | detab -t4 | _filter_script $i > $ddir/`_docname $i`
        echo "$i" >> $clist
    fi
done


#
# convert pic_chart.html
#
cat ../sw/pic_chart.html | \
    sed -e 's|pic_chart_files/|pic_chart_files_|g' \
    > $ddir/`_docname $i`

for i in ../sw/pic_chart_files/*
do
    if [[ -f $i ]] ; then
        cp "$i" "$ddir/pic_chart_files_${i##*/}"
    fi
done


#
# ignore these files - they are used specially
#
echo "../web/dummy.html" >> $clist
echo "../web/feedback.html" >> $clist
echo "../web/source.seds" >> $clist

for i in ../Make*
do
    if [[ -f $i ]] ; then
        _verb "Converting '$i'"
        cat "$i" | detab -t4 | _filter_script $i > $ddir/`_docname $i`
        echo "$i" >> $clist
    fi
done

for sdir in $all_dirs
do
    for i in $sdir/*
    do
        if [[ -f $i ]] ; then
            already2=0
            grep "$i" $clist >/dev/null && already2=1
            if (( ! already2 )) ; then
                _verb "SKIPPING CONVERTING '$i'"
            fi
        fi
    done
done

fi

#
# create index file
#
_add_file() {
    typeset pfx="$1"
    typeset fn="$2"
    typeset title="$3"
    if [[ -z $title ]] ; then
        title=`grep "$docstr" "$fn" | sed "s|.*$docstr||"`
    fi
    if [[ -z $title ]] ; then
        title=""
    else
        title=" --- `echo \"$title\" | _tohtml`"
    fi
    typeset dfn=`_docname "$fn"`
    fn="${fn#../}"
    if [[ -f $ddir/$dfn ]] ; then
        echo "<li><a href=\"$pfx$dfn\">$fn</a>$title<br></li>"
    fi
}

_add_file_check() {
    typeset sofar="$1"
    typeset pfx="$2"
    typeset fn="$3"
    typeset title="$4"
    typeset already=0
    typeset dfn=`_docname "$fn"`
    grep "href=\"$pfx$dfn" "$sofar" > /dev/null && already=1
    if (( ! already )) ; then
        _add_file "$2" "$3" "$4"
    fi
}

_add_link() {
    typeset targ="$1"
    typeset title="$2"
    if [[ -z $title ]] ; then
        title="$targ"
    fi
    echo "<li><a href=\"$targ\">$title</a><br></li>"
}

_add_image() {
    typeset targ="$1"
    typeset title="$2"
    if [[ -z $title ]] ; then
        title="$targ"
    fi
    echo "<p><table>"
    echo "<tr><td align=CENTER>$title</td></tr>"
    echo "<tr><td align=CENTER><img src=\"$targ\"></td></tr>"
    echo "</table><br></p>"
}

_make_pics() {
    idx="$1"
    pfx="$2"

    _html_begin

    echo "<h2>No pictures yet...</h2>"

    #
    # Wand PICS
    #
    #echo "<h2>Pictures of Wand</h2>"
    #_add_image "gadgetv3.jpg" "Version 3 of gadget with ZIF socket"
    #_add_image "gadget_vac1a.jpg" "First completed vacuum molded case (vacform attempt 2) (front)"
    #_add_image "gadget_vac2a.jpg" "First completed vacuum molded case (vacform attempt 2) (end)"
    #_add_image "gadget_vac3a.jpg" "First completed vacuum molded case (vacform attempt 2) (closeup)"


    #
    # VACUUM FORMING PICS
    #
    #echo "<h2>Pictures of vacuum forming</h2>"
    #_add_image "vacform1.jpg" "First attempt at vacuum forming"
    #_add_image "vacform2.jpg" "Second attempt at vacuum forming"
    #_add_image "vacform2_back.jpg" "Back of second attempt"
    #_add_image "vacform_table.jpg" "Vacuum forming table built by Jeff and Acorn"
    #_add_image "vacform_table3.jpg" "Second attempt still on table"
    #_add_image "vacform_table2.jpg" "Top view of second attempt on table"


    _html_end
}

_make_swpage() {
    idx="$1"
    pfx="$2"

    _html_begin

    doc_files=""

    #
    # PRIMARY TEXT FILES
    #
    echo "<h2>Wand Goals and Design</h2>"
    echo "<ul>"
    for i in ../sw/todo.txt ../sw/notes.txt
    do
        if [[ -f $i ]] ; then
            _add_file_check "$idx" "$pfx" "$i"
        fi
    done
    #_add_link "pictures.html" "Pictures"
#   _add_link   "http://www.malum-iter.com/wiki/index.php?title=Wand/song_format" \
#               "How to describe a song-spell (rythm-spell)"
    echo "</ul>"

    #
    # CONTACT INFO
    #
    echo "<h2>contact info</h2>"
    echo "<p>"
    echo "Please feel free to send any ideas, comments, suggestions, questions, etc to Acorn."
    echo "Contact Acorn at:"
    echo "<ul>"
    echo "<li><a href=\"feedback.html\">Wand Feedback Page</a></li>"
    #echo "<li>408-739-2269</li>"
    echo "</ul>"
    echo "</p>"

    #
    # STRINGS FILES
    #
    echo "<h2>Files Defining all Spells, Menus, Screens, and Strings</h2>"
    echo "<ul>"
    for sdir in $all_dirs
    do
        for i in $sdir/*.str $sdir/*.sstr $sdir/wchars.sh $sdir/rspells.inc $sdir/wmspells.inc $sdir/wmspells2.inc $sdir/wspell_info.inc $sdir/wspell_str.inc $sdir/wstrings.inc
        do
            if [[ -f $i ]] ; then
                _add_file "$pfx" "$i"
            fi
        done
    done
    echo "</ul>"


    #
    # WAND SOURCE
    #
    echo "<h2>Sourcecode for the Wand</h2>"

    echo "<ul>"
    for sdir in $wand_src_dirs
    do
        for i in $sdir/*.asm
        do
            if [[ -f $i ]] ; then
                _add_file "$pfx" "$i"
            fi
        done
        for i in $sdir/*.inc
        do
            if [[ -f $i ]] ; then
                _add_file "$pfx" "$i"
            fi
        done
    done
    echo "</ul>"

    #
    # SERVER SOURCE
    #
    echo "<h2>Sourcecode for ww - the program that talks to the wand</h2>"

    ww_src_list="ww.c  \
            wandio.c  \
            graph.c  \
            ac_serialio.c  \
            ac_fdio.c  \
            ac_time.c  \
            ac_hexfile.c  \
            ac_log.c  \
            ww.h  \
            wandio.h  \
            graph.h  \
            ac_serialio.h  \
            ac_fdio.h  \
            ac_time.h  \
            ac_hexfile.h  \
            ac_log.h  \
            Makefile"

    echo "<ul>"
    for i in  $ww_src_list
    do
        if [[ -f ../server/$i ]] ; then
            _add_file_check "$idx" "$pfx" "../server/$i"
        fi
    done
    echo "</ul>"

    #
    # OTHER SOURCE
    #
    echo "<h2>Other files & utilities used to create the Wand</h2>"
    echo "<ul>"

    for i in ../Make* ../server/picsim2pic.seds ../server/fff ../server/ss
    do
        if [[ -f $i ]] ; then
            _add_file_check "$idx" "$pfx" "$i"
        fi
    done

    for sdir in $all_dirs
    do
        for i in $sdir/*.asm $sdir/*.inc $sdir/*.c $sdir/*.h $sdir/Makef*
        do
            if [[ -f $i ]] ; then
                _add_file_check "$idx" "$pfx" "$i"
            fi
        done
        for i in `grep -n -H 'bin/bash' $sdir/* | sed -n -e 's|:1:.*||p' | sort -u`
        do
            if [[ -f $i ]] ; then
                _add_file_check "$idx" "$pfx" "$i"
            fi
        done
    done
    echo "</ul>"

    #
    # TEXT FILES
    #
    echo "<h2>Other Files</h2>"
    echo "<ul>"
    for sdir in $all_dirs
    do
        for i in $sdir/*.txt $sdir/*.html
        do
            if [[ -f $i ]] ; then
                _add_file_check "$idx" "$pfx" "$i"
            fi
        done
    done
    echo "</ul>"

    #
    # Missing files
    #
    for sdir in $all_dirs
    do
        for i in $sdir/*
        do
            ign=`_ignore_file $i`
            if [[ -f $i && $ign != 1 ]] ; then
                already2=0
                grep "${i#../}" "$idx" >/dev/null && already2=1
_verb "grep \"${i#../}\" \"$idx\""
                if (( ! already2 )) ; then
                    _verb "SKIPPING ADDING LINK TO '$i'"
                fi
            fi
        done
    done


    #
    # TAR
    #
    if (( 0 )) ; then
        echo "<h2>Get Sourcecode</h2>"
        echo "<p>"
        echo "Download all files needed to build the Wand (except for confidential files)"
        echo "<ul>"
        #echo "<li><a href="ju_gadget.tgz">ju_gadget.tgz</a></li>"
        echo "<li>TO BE ADDED</li>"
        echo "</ul>"
        echo "</p>"
    fi

    

    #
    # PARTS LINKS
    #
    echo "<h2>Parts Links</h2>"
    echo "<ul>"
    _add_link   "http://ww1.microchip.com/downloads/en/DeviceDoc/39626b.pdf" \
                "Pic 18F2620 microcontroller datasheet - Used in game Wands"
    _add_link   "http://ww1.microchip.com/downloads/en/DeviceDoc/39626b.pdf" \
                "Pic 18F2525 microcontroller datasheet - Used in prototype Wand"
    _add_link   "http://ww1.microchip.com/downloads/en/DeviceDoc/39631a.pdf" \
                "Pic 18F2520 microcontroller datasheet"
    _add_link   "http://rocky.digikey.com/WebLib/Microchip/Web%20Data/PIC18Fxx2.pdf" \
                "Pic 18F252 microcontroller datasheet (Used in DRUID)"
    _add_link   "http://rocky.digikey.com/WebLib/Panasonic/Web%20data/AN80xx,AN80xxM%20Series.pdf" \
                "Voltage regulator 'AN8005'"
    _add_link   "http://rocky.digikey.com/WebLib/Fairchild/Web%20Data/2N3906_MMBT3906_PZT3906.pdf" \
                "2N 3906 - general purpose PNP transistor"
    _add_link   "http://www.freescale.com/files/sensors/doc/data_sheet/MMA6231Q.pdf" \
                "MMA6231Q +/- 10g 2 axis 300Hz accelerometer (USED IN PROTOTYPE and GAME WAND)"
    _add_link   "http://www.freescale.com/files/sensors/doc/data_sheet/MMA6231Q.pdf" \
                "MMA6233Q +/- 10g 2 axis 900Hz accelerometer (same data sheet)"
    echo "</ul>"

    #
    # PARTS COMPANY LINKS
    #
    echo "<h2>Parts Company Links</h2>"
    echo "<ul>"
    _add_link   "http://www.freescale.com" \
                "Freescale - accelerometers"
    _add_link   "http://www.microchip.com" \
                "Microchip - PIC microcontrollers"
    _add_link   "http://www.superbrightleds.com" \
                "SuperBrightLeds.com - mail order LEDs"
    _add_link   "http://www.digikey.com" \
                "Digikey - mail order parts store"
    _add_link   "http://www.newark.com" \
                "Newark - mail order parts store"
    _add_link   "http://www.mouser.com" \
                "Mouser - mail order parts store"
    echo "</ul>"

    #
    # OTHER LINKS
    #
    echo "<h2>Other Links</h2>"
    echo "<ul>"
    _add_link   "http://gotohogwarts.com" \
                "Hogwarts website"
#   _add_link   "http://bitsy.sub-atomic.com/~sparckl/Report.html" \
#               "Hogwarts website report"
    _add_link   "http://www.rawbw.com/~acorn" \
                "Acorn's personal webpage"
    _add_link   "http://www.snout.org/game" \
                "Snout: www.snout.org/game"
#   _add_link   "http://www.snout.org/gc" \
#               "Snout GC (Wiki)"
    _add_link   "http://www.malum-iter.com/wiki/index.php?title=Main_Page" \
                "Snout Wiki"
    _add_link   "http://www.rawbw.com/~acorn/ju" \
                "Gadgets of Justice Unlimited"
    _add_link   "wand-1.2.tgz" \
                "Download wand-1.2.tgz (complete sourcecode)"
    _add_link   "wand-1.1.tgz" \
                "Download wand-1.1.tgz (old version)"
    _add_link   "wand-1.1-data.tgz" \
                "Download wand-1.1-data.tgz (instructions)"
    echo "</ul>"

    _html_end
}

_verb "Creating swpage.html"
_make_swpage "$ddir/swpage.html" "" > "$ddir/swpage.html"

#_verb "Creating docs.html"
#_make_index "docs.html" "$ddir/" > "docs.html"

_verb "Creating pictures.html"
_make_pics "$ddir/pictures.html" "" > "$ddir/pictures.html"


#
# empty confidential files
#
#for i in *.sstr gstrings.inc
#do
#   if [[ -f $i ]] ; then
#       _verb "Hiding '$i' (secret)"
#       echo "xxx" | _filter_secret $i > $ddir/`_docname $i`
#   fi
#done



This file Copyright (C) 2006 by Nathan (Acorn) Pooley
Go to TOP Wand page
Go to Acorn's personal webpage
Go to Hogwarts website: www.gotohogwarts.com
Snout: www.snout.org/game
Gadgets of Justice Unlimited
Snout GC (Wiki)
Snout Wiki
File created by do_doc at Wed May 30 03:31:07 PDT 2007