summaryrefslogtreecommitdiff
path: root/support/tcltexed/bin/makehelp.tcl
blob: 320ce97ddf5f5a31c34d5780f6cf8efa4cfeeaa2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/wish8.0
# Tcltexed | Version 2.3 | 1. Feb. 1999 | Martin Strauss
set Tcltexed_Version 2.3 
# A plaintext-editor for LaTeX based on scriptlanguage tcl/tk (8.x) 
#
# Copyright (C) 1998 - Martin Strauss -
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
# My email-adress : mys@phi.faveve.uni-stuttgart.de
#######################################################################
# Begin of Tcltexed
#######################################################################
set basepath "[file dirname [info script]]/.."
#######################################################################
# If it doesn't work by it's own please enter here the right
# installationpath to the base of tcltexed (not to the executable)
# and uncommend the next line
# set basepath /usr/local/app/tcltexed-2.2
#######################################################################
# You propably aren't interested to mix my files locations ???
set hlppath $basepath/hlp
#######################################################################
# a short test looking if you set your mainpath right
if {![file exists $basepath/bin/tcltexed.tcl]} {
 wm withdraw .
 tk_messageBox -icon error -message "[info script] Tcltexed\nWrong path configuration !\nPlease read the INSTALL file !\n Currently the basepath is set to\n $basepath\nbut I can't find my data there."
 exit
}



##########################################################################
##########################################################################
# You won't believe it what happens if you ... so leave it the way it is #
##########################################################################
label .l -text "This program produces\n the index of help issues" 
label .echo
button .b -text "do it !" -command {DOIT} 
proc DOIT {} {
 global hlppath
 cd $hlppath
 set FILES [glob */*.txt]
 set file ""
 foreach file $FILES {
  .echo configure -text $file
  update
  set f [open $file r]
  set Text [read $f]
  close $f
  set pos [string first "::" $Text]
  while {$pos!=-1} {
   set Text [string range $Text [expr $pos + 2] end]
   set pos [string first "::" $Text]
   set posn [string first "\n" $Text]
   if {$posn>$pos} {
    if {[string length [string range $Text 0 [expr $pos -1]]] > 0} {
     lappend L([string range $Text 0 [expr $pos -1]]) $file
  }}}
 }
 set f [open $hlppath/index w]
 puts $f [array get L]
 close $f
  .echo configure -text Done
}

pack .l .echo .b