#!/bin/sh # \ exec tclsh "$0" ${1+"$@"} # Change the following path to reflect the installation path set toolDirectory /class/sce/rcpp[lindex [array get env RCPPVERSION] 1]/tools ## /*--------------------------------------------------------*\ ## | generate-catalog: generate HTML version of RCPP catalog ## |*--------------------------------------------------------*| ## | Date: Sep 1, 1998 ## | Author: Paolo Bucci ## | ## | Brief User's Manual: ## | This tcl script converts a RESOLVE/C++ catalog (i.e., ## | a directory containing AI/AT/CI/CT directories with ## | the usual structure) into the HTML version. ## | ## | Call it as follows: ## | ## | generate-catalog source destination catalog_name ## | ## | where: ## | ## | source is the RESOLVE/C++ catalog directory, ## | e.g., /class/sce/rcpp/RESOLVE_Catalog ## | ## | destination is the directory where you want the ## | HTML catalog directory to be (the script creates ## | a directory with the name of the RCPP catalog ## | directory followed by "-HTML", e.g., ## | destination/RESOLVE_Catalog-HTML) ## | ## | catalog_name is the string you want to be displayed ## | in all HTML pages as the name of the catalog, ## | e.g., "RESOLVE Catalog" ## | ## | Example call: ## | ## | generate-catalog /class/sce/rcpp/RESOLVE_Catalog \ ## | /class/sce/rcpp "Resolve/C++ Catalog" ## | ## | Note 0: The quotes in the example are necessary!! ## | ## | Note 1: a file called RCPP2HTML-LOG is also created ## | in the destination directory. It contains a record of ## | all the RCPP files that have been converted and any ## | error messages that might have been generated. It can ## | be removed. ## | ## | Note 2: generate-catalog uses the Perl script rcpp2html ## | to convert the RCPP files into HTML, and the tcl script ## | generate-index to generate the HTML index pages. ## | ## | Note 3: generate-catalog handles in special ways files ## | that have "_PLAIN" or "_Part" in their name. "_PLAIN" ## | files are those we don't want students to read, and for ## | which we have "disguised" versions in the RCPP catalog. ## | The script gets rid of the disguised versions, and ## | makes the plain version non-readable to the students. ## | "_Part" files are those that are only partially filled ## | up (students are asked to complete them). The script ## | makes the partially filled files accessible though the ## | HTML catalog, while it renames the completed ones by ## | adding "_COMPLETE" to the file name (but does not link ## | these in the HTML indices, so an instructor can view the ## | complete files by opening them directly in the browser). ## | ## | Note 4: all the generated HTML files have the same access ## | privileges of the original RCPP files (well, with the ## | exceptions in Note 3). The script changes the group of ## | all the HTML files to cisSCE-dir. ## | ## \*--------------------------------------------------------*/ if {$argc != 3} { puts "Usage: generate-catalog source destination catalog_name" exit -1 } set sourceDirectory [lindex $argv 0] set destinationDirectory [lindex $argv 1] set catalogName [lindex $argv 2] set htmlDirectory "[file tail $sourceDirectory]-HTML" puts "Start HTML catalog generation..." puts "cd $destinationDirectory" cd $destinationDirectory file delete -force $htmlDirectory file delete -force RCPP2HTML-LOG puts "generating HTML catalog..." if [catch {exec ${toolDirectory}/rcpp2html -c "$catalogName" -d $htmlDirectory $sourceDirectory >> RCPP2HTML-LOG} result] { puts "$result" } puts "...HTML catalog generated" puts "testing for PLAIN files..." foreach f [exec find $htmlDirectory -name "*_PLAIN.*" -print] { regsub {_PLAIN\.} $f . name puts "...$f --> $name..." file rename -force $f $name } puts "...testing for PLAIN files done" puts "testing for Part files..." foreach f [exec find $htmlDirectory -name "*_Part.*" -print] { regsub {_Part\.} $f . name1 if {[file exists $name1]} { regsub {_Part\.} $f {_COMPLETE.} name2 puts "...$name1 --> $name2..." file rename -force $name1 $name2 } puts "...$f --> $name1..." file rename -force $f $name1 } puts "...testing for Part files done" puts "generating HTML indices..." exec ${toolDirectory}/generate-index $htmlDirectory $catalogName puts "...HTML indices generated" puts "copy necessary gif files to $htmlDirectory" file copy -force ${toolDirectory}/gc-files/rsrg-logo.gif $htmlDirectory file attributes $htmlDirectory/rsrg-logo.gif -permissions 00664 file copy -force ${toolDirectory}/gc-files/help.gif $htmlDirectory file attributes $htmlDirectory/help.gif -permissions 00664 file copy -force ${toolDirectory}/gc-files/std.gif $htmlDirectory file attributes $htmlDirectory/std.gif -permissions 00664 puts "copy help file to $htmlDirectory" file copy -force ${toolDirectory}/gc-files/help.html $htmlDirectory file attributes $htmlDirectory/help.html -permissions 00664 puts "chgrp -R cisSCE-dir $htmlDirectory" exec /bin/chgrp -R cisSCE-dir $htmlDirectory puts "...all done generating HTML catalog!"