File: dotfile.tcl

package info (click to toggle)
dotfile 2.2-1
  • links: PTS
  • area: main
  • in suites: hamm, slink
  • size: 4,596 kB
  • ctags: 456
  • sloc: tcl: 11,732; sh: 965; makefile: 304; csh: 13; ansic: 7
file content (194 lines) | stat: -rw-r--r-- 6,683 bytes parent folder | download
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
### Copyright (C) 1995-1997 Jesper K. Pedersen
### 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., 675 Mass Ave, Cambridge, MA 02139, USA.

set __hash "\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#"
if {[info commands DEBUG] == ""} {
  proc DEBUG {args} {}
}
############################################################
# First of all check for the right version of wish
############################################################
if {[info exists tk_version] && [string index $tk_version 0] <  4} {
  puts {!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    WARNING
    
    The Dotfile Generator requires at least Tcl 7.4 / Tk4.0}
  puts "    Your version of Tk is $tk_version"
  puts {!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!}
}
if {[info exists tk_version]} {
  wm title . "Dotfile Generator"
  wm withdraw .
}

############################################################
#                     Sourceing function files
############################################################
foreach __file {parse types menus help functions util save bytecompile
  setup generate fillouts edit versionUpdate dialog color combo import export
  setPages details load system browser mail} {
  source [lindex $argv 0]/$__file.tcl
}

############################################################
#                   sourcing the module
############################################################
proc import {file} {
  global argv __files
  source [lindex $argv 1]/$file
  lappend __files $file
}

############################################################
#           and now for the copyright notice
############################################################
if {[lindex $argv 2] != "bytecompile"} {
  puts "The Dotfile Generator version 2.2 Copyright (C) 1995-1997 Jesper K. Pedersen"
  puts "The Dotfile Generator comes with ABSOLUTELY NO WARRANTY; for details"
  puts "see the \"Help\" menu. This is free software, and you are welcome to"
  puts "redistribute it under certain conditions; see the \"Help\" menu"
  puts "for details."
}
if {$argv == ""} {
  puts "To start this program, type wish <template file> <dotfile path> <module path>"
  exit -1
}

set __changed 0
set __fillOutCounter 0    ;# just to avoid testing existens
set __editInfo(trace) 0
set __editInfo(menuload) 0
set __clipboardName ""    ;# just to avoid testing existens
set __editInfo(version) "2.2"
set __editInfo(releaseDate) "Sun Dec 21"
set __editInfo(name) ""   ;# just to avoid testing existens
set __busy {}
set __editInfo(loadFile) ""
set __clean(dummy) 1
set __widgetArgs(scrollbar) scrollbar
set __BASEDIR [file dirname [lindex $argv 0]]
set __BITMAPDIR [lindex $argv 0]/bitmaps
set loadingExports 0
############################################################
#   loading the modules or the byte compile file
############################################################
set __bc [byteCompile?]

if {$__bc == "loadedBCFile"} {
  set loadedByteCompileFile 1
} else {
  set loadedByteCompileFile 0
}

source [lindex $argv 1]/main.template
parseFile
if {$__bc != "loadedBCFile"} {
  loadFiles
}

if {[file exists [lindex $argv 1]/local.template] && !$loadedByteCompileFile} {
  import local.template
}

if {$__bc == "doByteCompile"} {
  byteCompileFile
}
if {$__bc == "loadedBCFile"} {
  testBCVersion
}
############################################################
#                    General initializion
############################################################
if {![info exists setup(dotfile)]} {
  set setup(dotfile) {{file1 Dotfile output.dot "\#"}}
}
foreach elm $setup(dotfile) {
  if {![regexp {^[a-z0-9]+$} [lindex $elm 0]]} {
    error "File handle \"[lindex $elm 0]\" is illegal, it may only contain letters and numbers"
  }
}
foreach __elm $setup(dotfile) {
  set __fileHandles([lindex $__elm 0]) [lindex $__elm 2]
}
if {![info exists setup(file)]} {
  set setup(file) 1
}
if {![info exists setup(print)]} {
  set setup(print) 1
}
if {![info exists setup(whatToGenerate)]} {
  set setup(whatToGenerate) all
}
if {![info exists setup(generateDefault)]} {
  set setup(generateDefault) 0
}
if {![info exists setup(placeWindows)]} {
  set setup(placeWindows) 1
}
if {![info exists setup(preventBytecompile)]} {
  set setup(preventBytecompile) 0
}
if {![info exists setup(saveOnGenerate)]} {
  set setup(saveOnGenerate) 0
}
if {![info exists module(overAllDesc)]} {
  set module(overAllDesc) "This file has been auto generated\nby the $module(name) module for the Dotfile Generator\non \[exec date\]"
}
set __pathProgsNames(pre_generate) "/Pre commands"
set __pathProgsNames(post_generate) "/Post commands"
############################################################
#                loading the save file
############################################################
wm withdraw .

if {[lindex $argv 2] == "convertExports"} {
  ### initialize all the pages to a default value
  foreach page $__progList {
    setBasic $page
  }
  set __loadOverWrite $__progList
  import-file [lindex $argv 3]
  createDir [file dirname [lindex $argv 4]]

  saveFile  [lindex $argv 4]
  exit
} else {

  initialize_and_load
}
############################################################
# linking all variable globaly as func@var
############################################################
foreach __function $__progList {
  set __editInfo(name) $__function
  linkVars $__function __$__function top $__function
}
set __editInfo(name) ""   ;# just to avoid testing existens

############################################################
#                      Menu WINDOW
############################################################
createMenu


############################################################
#               global bindings for entry's
############################################################
bind Entry <Double-ButtonPress-3> {%W delete sel.first sel.last}
bind . <Control-s> generate
if {$setup(placeWindows)} {
  wm geometry . +0+0
}
wm deiconify .