#!/usr/bin/tclsh # # This script processes raw documentation source text into its final form # for display. The processing actions are described below. # # Invoke this command as follows: # # tclsh wrap.tcl $(DOC) $(SRC) $(DEST) source1.in source2.in ... # # The $(DOC) and $(SRC) values are the names of directories containing # the documentation source and program source. $(DEST) is the name of # of the directory where generated HTML is written. sourceN.in is the # input file to be processed. The output is sourceN.html in the # local directory. # # Changes made to the source files: # # * An appropriate header is prepended to the file. # # * Any
|
*** DRAFT ***
} } if {$srcfile!=""} { if {[file exists DRAFT]} { set hd(footer) {*** DRAFT ***
} } else { set hd(footer) {} } } else { set hd(enable-main) $saved_enable } } # Insert a bubble syntax diagram into the output. # proc BubbleDiagram {name {anonymous_flag 0}} { global hd #if {!$anonymous_flag} { # hd_resolve "\ \" } if {$hd(enable-aux)} { puts $hd(aux) "
\ \" } } # Record a requirement. This procedure is active only for the first # pass. This procedure becomes a no-op for the second pass. During # the second pass, requirements listing report generators can use the # data accumulated during the first pass to construct their reports. # # If the "verbatim" argument is true, then the requirement text is # rendered as is. In other words, the requirement text is assumed to # be valid HTML with all hyperlinks already resolved. If the "verbatim" # argument is false (the default) then the requirement text is rendered # using hd_render which will find an expand hyperlinks within the text. # # The "comment" argument is non-binding commentary and explanation that # accompanies the requirement. # proc hd_requirement {id text derivedfrom comment} { global ALLREQ ALLREQ_DERIVEDFROM ALLREQ_COM if {[info exists ALLREQ($id)]} { puts stderr "duplicate requirement label: $id" } set ALLREQ_DERIVEDFROM($id) $derivedfrom set ALLREQ($id) $text set ALLREQ_COM($id) $comment } # Read a block of requirements from an ASCII text file. Store the # information obtained in a global variable named by the second parameter. # proc hd_read_requirement_file {filename varname} { global hd_req_rdr hd_reset_requirement_reader set in [open $filename] while {![eof $in]} { set line [gets $in] if {[regexp {^(HLR|UNDEF|SYSREQ) +([LHSU]\d+) *(.*)} $line all type rn df]} { hd_add_one_requirement $varname set hd_req_rdr(rn) $rn set hd_req_rdr(derived) $df } elseif {[string trim $line]==""} { if {$hd_req_rdr(body)==""} { set hd_req_rdr(body) $hd_req_rdr(comment) set hd_req_rdr(comment) {} } else { append hd_req_rdr(comment) \n } } else { append hd_req_rdr(comment) $line\n } } hd_add_one_requirement $varname close $in } proc hd_reset_requirement_reader {} { global hd_req_rdr set hd_req_rdr(rn) {} set hd_req_rdr(comment) {} set hd_req_rdr(body) {} set hd_req_rdr(derived) {} } proc hd_add_one_requirement {varname} { global hd_req_rdr set rn $hd_req_rdr(rn) if {$rn!=""} { if {$hd_req_rdr(body)==""} { set hd_req_rdr(body) $hd_req_rdr(comment) set hd_req_rdr(comment) {} } set b [string trim $hd_req_rdr(body)] set c [string trim $hd_req_rdr(comment)] set ::${varname}($rn) [list $hd_req_rdr(derived) $b $c] lappend ::${varname}(*) $rn } hd_reset_requirement_reader } # First pass. Process all files. But do not render hyperlinks. # Merely collect keyword information so that hyperlinks can be # correctly rendered on the second pass. # foreach infile [lrange $argv 3 end] { cd $HOMEDIR puts "Processing $infile" set fd [open $infile r] set in [read $fd] close $fd set title {No Title} regexp {
Target Page - Which pages reference it.
" hd_puts "Pages matching (news|changes|releaselog|\[0-9]to\[0-9]|^doc_.*_crossref) are skipped.
" hd_puts "