# This file contains TCL procedures used to generate standard parts of
# web pages.
#
proc header {txt} {
  puts "
$txt"
  puts \
{
}
}
proc footer {{rcsid {}}} {
  puts {
}
  set date [lrange $rcsid 3 4]
  if {$date!=""} {
    puts "This page last modified on $date"
  }
  puts {}
}
# The following proc is used to ensure consistent formatting in the 
# HTML generated by lang.tcl and pragma.tcl.
#
proc Syntax {args} {
  puts {}
  foreach {rule body} $args {
    puts "| "
    puts "$rule ::="
    regsub -all < $body {%LT} body
    regsub -all > $body {%GT} body
    regsub -all %LT $body {} body
    regsub -all %GT $body {} body
    regsub -all {[]|[*?]} $body {&} body
    regsub -all "\n" [string trim $body] " | 
\n" body
    regsub -all "\n  *" $body "\n\\ \\ \\ \\ " body
    regsub -all {[|,.*()]} $body {&} body
    regsub -all { = } $body { = } body
    regsub -all {STAR} $body {*} body
    ## These metacharacters must be handled to undo being
    ## treated as SQL punctuation characters above.
    regsub -all {RPPLUS} $body {)+} body
    regsub -all {LP} $body {(} body
    regsub -all {RP} $body {)} body
    ## Place the left-hand side of the rule in the 2nd table column.
    puts "$body | 
"
  }
  puts {
}
}