diff options
Diffstat (limited to 'support/xtexshell/help/convhelp')
-rwxr-xr-x | support/xtexshell/help/convhelp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/support/xtexshell/help/convhelp b/support/xtexshell/help/convhelp new file mode 100755 index 0000000000..a043298006 --- /dev/null +++ b/support/xtexshell/help/convhelp @@ -0,0 +1,54 @@ +#!/usr/bin/tclsh + +#*** Main Program + + if {$argc != 2} { + puts stdout "\nConvHelp \nGenerate Index File for Help System\nUsage: conv infile outfile\n" + return; + } + + set inname [lindex $argv 0] + set outname [lindex $argv 1] + + set infile [open $inname "r"] + set outfile [open $outname "w"] + +#*** Skip file Header and read the x- and y-length + + puts stdout "Converting..." + +#*** Write Header for new file + + set rowcount 0 + set entry 0 + + while {[eof $infile] == 0} { + set filepos [tell $infile] + gets $infile inbuf + if {$entry == 0} { # *** Start of entry was not found so far.. + if {[string first ":entry" $inbuf] >= 0} { + set entry 1 + set commandlist {} + if {![expr $rowcount%10]} { # *** Inform User + puts -nonewline stdout "\[$rowcount\] " + flush stdout + } + incr rowcount + } + } else { # *** Ok, we are processing an entry + if {[string first ":" $inbuf] < 0} { # *** Another entry + foreach word "$inbuf" { + lappend commandlist "$word" + } + } else { + foreach command "$commandlist" { # *** End of entries reached + puts $outfile "$command $inname $filepos" + } + set entry 0 + } + } + } + + close $outfile + close $infile + puts stdout "\[$rowcount\] " |