Rev 1919 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
#!/bin/sh##--- NEW: ----------#### Given a list of files of the form .../.../<name>.R,#### Produce one large file, i.e. write to stdout## 'cat'ting the files together with## 1) Putting a HEADER in front## 2) EDITing a few of the files## 3) appending a FOOTER ...## Should work WHEREVER this is called from :(cd `dirname $0`/..RHOME=`pwd`; export RHOME)RHOME=`cd ${RHOME}; pwd` # absoluteFILES="$@"#Dbg> echo "RHOME=$RHOME"; echo#Dbg> echo "FILES=$FILES"; echo ; echo; exit## 1) ---- Header ----cat <<_EOF_.ptime <- proc.time()postscript('All-Examples.ps').pp <- par().par.postscript <- .pp[-match(c("cin","cra","csi","din"),names(.pp))]iter <- 0; eigenval <- 1e-12_EOF_## 2) ---- edit a few of these files:for file in $FILESdobf=`basename $file .R`if [ -n "`grep '_ Examples _' $file`" ]thenecho '.Random.seed <- rep(7654,3)'elseif [ "$USER" = local -o "$USER" = maechler ];then## Remind certain people to upgrade the online helpecho "'$bf' has no Examples.." >& 2fifi#Dbg: echo $bf >&2if [ $bf = 'on.exit' ]; then sed -e '$s/$/par(opar)/' $fileelif [ $bf = 'alias' ]; then sed -e '/^library(/s/^/##Test: /' $fileelif [ $bf = 'help' ]; then sed -e '/^help(topi/s/^/##Test: /' $fileelif [ $bf = 'help.start' ]; then sed -e '/^help/s/^/##Test: /' $fileelif [ $bf = 'match.arg' ]; then sed -e '/^cent.*Error/s/^/##Test: /' $fileelif [ $bf = 'menu' ]; then sed -e '6,$s/^/##INTERACTIVE> /' $fileelif [ $bf = 'na.fail' ]; then sed -e '/^na\.fail/s/^/##Test: /' $fileelif [ $bf = 'pictex' ]; then sed -e '11,$s/^/##LaTex /' $fileelif [ $bf = 'postscript' ]; then sed -e '/^postscript(/s/^/## /' $fileelif [ $bf = 'Random' ]; then sed -e '$s/$/.Random.seed <- 9:7/' $fileelif [ $bf = 'solve' ]; then sed -e '/error:.*singular/s/^/## /' $fileelif [ $bf = 'traceback' ]; then sed -e '/^[a-z]*(/s/^/##Test: /' $fileelif [ $bf = 'dataentry' ]; thensed -e '/^data/s/^/##INTERACTIVE> /' $fileelif [ $bf = 'edit' ]; thensed -e '/edit(/s/^/##INTERACTIVE> /; /^vi(/s/^/##INTERACTIVE> /' $fileelse cat $filefiif [ -n "`grep 'par(' $file`" ]thenecho 'par(.par.postscript)'fidone## 3) ---- Footer ----cat <<_EOF_cat("Time elapsed:\t", proc.time() - .ptime,"\n")dev.off(); quit('no')_EOF_