gcode

#!/usr/bin/ksh ### ### gcode.sh ### ### Generate hyperlinked versions of 4GL code ### date if test $# -lt 1 then echo >&2 echo "\tUsage: To generate hyperlinked code" >&2 echo "\tSyntax: $0 prodline" >&2 echo >&2 echo "\tEx: gcode.sh cfinsys7 " >&2 echo >&2 exit 1 fi typeset -l prodline prodline=$1 if [ ! -d $LAWDIR/$prodline ] then echo "error - cannot find source for $pold" exit 1 fi ### ### Generate generic html files for all $LAWDIR/prodline/pdlib files ### for i in `echo acsrc masrc apsrc cbsrc tesrc pdlib glsrc ifsrc` do if [ ! -d $i ] then mkdir $i fi done for i in `echo acsrc apsrc cbsrc tesrc masrc pdlib glsrc ifsrc` do for z in `ls $LAWDIR/$prodline/$i/*PD` do x=`basename $z` echo "<html>" > $i/$x.html echo "<head>" >> $i/$x.html echo "<title>$prodline $i<title>" >> $i/$x.html echo "<link href=\"../rstyle.css\" rel=stylesheet type=text/css>" >> $i/$x.html echo "<head>" >> $i/$x.html echo "<body>" >> $i/$x.html echo "<center><h1>$prodline $i<h1><center>" >> $i/$x.html echo "<pre>" >> $i/$x.html cat $z >> $i/$x.html echo "<pre>" >> $i/$x.html echo "<body>" >> $i/$x.html echo "<html>" >> $i/$x.html done done ### ### For every internal PARAGRAPH definition in every PD file, ### create "a href" link ### for y in `echo pdlib acsrc masrc apsrc cbsrc tesrc glsrc ifsrc` do for z in `ls $y/*.html` do echo $z cut -c8-88 $z > tmp1.out grep "^[1-9][0-9][0-9]*\-" tmp1.out | grep -v "\-START\." | \ grep -v "\-NEXT\." | \ grep -v "\-END\." | \ grep -v "\-CONTINUE\." | \ grep -v "href" | \ grep -v name | \ cut -d" " -f1 | \ sed "s/\.$//g" > tmp.out sort -r tmp.out > paragraphs.out for i in `cat paragraphs.out` do x=`basename $z .html` sed "s/PERFORM $i/PERFORM <a href=\"$x.html\#$i\">$i<a>/g" $z > tmp4.out if [ -s tmp4.out ] then mv tmp4.out $z fi done done done ### ### For every PARAGRAPH definition in every pdlib/*PD file, ### create "a href" link in every *src/*PD file that calls it... ### for pdlib in `ls pdlib` do echo $pdlib cut -c8-88 pdlib/$pdlib > tmp1.out grep "^[1-9][0-9][0-9]*\-" tmp1.out | grep -v "\-START\." | \ grep -v "\-NEXT\." | \ grep -v "\-END\." | \ grep -v "\-CONTINUE\." | \ grep -v name | \ cut -d" " -f1 | \ sed "s/\.$//g" > tmp.out sort -r tmp.out > paragraphs.out for para in `cat paragraphs.out` do for i in `echo acsrc masrc apsrc cbsrc tesrc glsrc ifsrc` do echo $para $i fgrep $para $i/*PD.html | \ cut -d: -f1 | \ sort | \ uniq > found.out for z in `cat found.out` do echo " " echo "Found: $z" echo " " sed "s/PERFORM $para/PERFORM <a href=\"..\/pdlib\/$pdlib#$para\">$para<a>/g" $z > tmp19.out if [ -s tmp19.out ] then mv tmp19.out $z fi done done done done ### ### For every internal PARAGRAPH definition in every PD file, ### create "a name" link ### for y in `echo pdlib acsrc masrc apsrc cbsrc tesrc glsrc ifsrc` do for x in `ls $y/*PD.html` do echo $x cut -c8-88 $x > tmp1.out grep "^[1-9][0-9][0-9]*\-" tmp1.out | grep -v "\-END\." | \ grep -v "\-START\." | \ grep -v "\-NEXT\." | \ grep -v "\-CONTINUE\." | \ grep -v name | \ cut -d" " -f1 | \ sed "s/\.$//g" | \ sort -r > tmp2.out for i in `cat tmp2.out` do sed "s/ $i/ <a name=\"$i\">$i<a>/g" $x > tmp5.out if [ -s tmp5.out ] then mv tmp5.out $x fi done done done date