Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Moved preprocess code to separate source file |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
eb19798847a10134b49d9c4acada05c9 |
User & Date: | peter 2017-02-04 21:38:21.652 |
Context
2017-02-05
| ||
16:38 | Move all preprocess usage to preprocess source file check-in: e805b0132e user: peter tags: trunk | |
2017-02-04
| ||
21:38 | Moved preprocess code to separate source file check-in: eb19798847 user: peter tags: trunk | |
20:18 | Support more areas for file drop. check-in: 4267fcad4a user: peter tags: trunk | |
Changes
Changes to Makefile.
︙ | ︙ | |||
31 32 33 34 35 36 37 | NAGELFAR = nagelfar all: setup SRCFILES = src/eskil.tcl src/clip.tcl src/dirdiff.tcl src/help.tcl src/map.tcl \ src/print.tcl src/registry.tcl src/rev.tcl src/debug.tcl \ src/compare.tcl src/merge.tcl src/printobj.tcl src/plugin.tcl \ | | | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | NAGELFAR = nagelfar all: setup SRCFILES = src/eskil.tcl src/clip.tcl src/dirdiff.tcl src/help.tcl src/map.tcl \ src/print.tcl src/registry.tcl src/rev.tcl src/debug.tcl \ src/compare.tcl src/merge.tcl src/printobj.tcl src/plugin.tcl \ src/vcsvfs.tcl src/preprocess.tcl src/startup.tcl #---------------------------------------------------------------- # Build a dependency tree to other libs needed. # This is made in a parallell VFS structure, mimicking Eskil's. # Thus deps.vfs can also be created by downloading an Eskil kit, # rename it to "deps" and unwrap it with sdx. #---------------------------------------------------------------- |
︙ | ︙ |
Changes to src/eskil.tcl.
︙ | ︙ | |||
3709 3710 3711 3712 3713 3714 3715 | grid .fo.le - -sticky nwe -padx 3 -pady 3 grid .fo.lf -sticky news -rowspan 5 grid columnconfigure .fo 0 -weight 1 grid rowconfigure .fo 1 -weight 1 exampleFont $lb } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 3709 3710 3711 3712 3713 3714 3715 | grid .fo.le - -sticky nwe -padx 3 -pady 3 grid .fo.lf -sticky news -rowspan 5 grid columnconfigure .fo 0 -weight 1 grid rowconfigure .fo 1 -weight 1 exampleFont $lb } |
Added src/preprocess.tcl.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | #---------------------------------------------------------- -*- tcl -*- # Eskil, Preprocess dialog # # Copyright (c) 2004-2017, Peter Spjuth (peter.spjuth@gmail.com) # # 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; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # #---------------------------------------------------------------------- # This is called when Ok or Apply is pressed. # Update preference from dialog contents. proc EditPrefRegsubOk {top w {keep 0}} { set exa $::eskil($top,prefregexa) set result {} for {set t 1} {[info exists ::eskil($top,prefregexp$t)]} {incr t} { set RE $::eskil($top,prefregexp$t) set Sub $::eskil($top,prefregsub$t) set l $::eskil($top,prefregleft$t) set r $::eskil($top,prefregright$t) set side "" if {$l && !$r} { set side left } if {!$l && $r} { set side right } if {!$l && !$r} { continue } if {$RE eq ""} continue if {[catch {regsub -all -- $RE $exa $Sub _} err]} { return } lappend result $RE $Sub $side } set ::Pref(preprocess) $result if {$keep} return destroy $w array unset ::eskil $top,prefregexp* array unset ::eskil $top,prefregsub* array unset ::eskil $top,prefregleft* array unset ::eskil $top,prefregright* } # Update the example in the preprocess dialog proc EditPrefRegsubUpdate {top args} { set exal $::eskil($top,prefregexa) set exar $::eskil($top,prefregexa) set exal2 $::eskil($top,prefregexa2) set exar2 $::eskil($top,prefregexa2) set ok $::widgets($top,prefRegsubOk) set app $::widgets($top,prefRegsubApply) for {set t 1} {[info exists ::eskil($top,prefregexp$t)]} {incr t} { set RE $::eskil($top,prefregexp$t) set Sub $::eskil($top,prefregsub$t) set l $::eskil($top,prefregleft$t) set r $::eskil($top,prefregright$t) if {$RE eq ""} continue if {$l} { if {[catch {regsub -all -- $RE $exal $Sub result} err]} { set ::eskil($top,prefregresultl) "$t ERROR: $err" $ok configure -state disabled $app configure -state disabled return } else { set exal $result } if {[catch {regsub -all -- $RE $exal2 $Sub result} err]} { set ::eskil($top,prefregresultl2) "$t ERROR: $err" $ok configure -state disabled $app configure -state disabled return } else { set exal2 $result } } if {$r} { if {[catch {regsub -all -- $RE $exar $Sub result} err]} { set ::eskil($top,prefregresultr) "$t ERROR: $err" $ok configure -state disabled $app configure -state disabled return } else { set exar $result } if {[catch {regsub -all -- $RE $exar2 $Sub result} err]} { set ::eskil($top,prefregresultr2) "$t ERROR: $err" $ok configure -state disabled $app configure -state disabled return } else { set exar2 $result } } } set ::eskil($top,prefregresultl2) $exal2 set ::eskil($top,prefregresultr2) $exar2 set ::eskil($top,prefregresultl) $exal set ::eskil($top,prefregresultr) $exar $ok configure -state normal $app configure -state normal } # Add a new entry in the preprocess dialog proc AddPrefRegsub {top parent} { # Figure out next number to use for {set t 1} {[winfo exists $parent.fr$t]} {incr t} { #Empty } # Default values if {![info exists ::eskil($top,prefregexp$t)]} { set ::eskil($top,prefregexp$t) "" set ::eskil($top,prefregsub$t) "" set ::eskil($top,prefregleft$t) 1 set ::eskil($top,prefregright$t) 1 } set w [ttk::frame $parent.fr$t -borderwidth 2 -relief groove -padding 3] ttk::label $w.l1 -text "Regexp:" -anchor "w" ttk::entryX $w.e1 -textvariable ::eskil($top,prefregexp$t) -width 60 ttk::label $w.l2 -text "Subst:" -anchor "w" ttk::entryX $w.e2 -textvariable ::eskil($top,prefregsub$t) ttk::checkbutton $w.cb1 -text "Left" -variable ::eskil($top,prefregleft$t) ttk::checkbutton $w.cb2 -text "Right" -variable ::eskil($top,prefregright$t) addBalloon $w.cb1 "Apply to left file" addBalloon $w.cb2 "Apply to right file" grid $w.l1 $w.e1 $w.cb1 -sticky we -padx 3 -pady 3 grid $w.l2 $w.e2 $w.cb2 -sticky we -padx 3 -pady 3 grid columnconfigure $w 1 -weight 1 pack $w -side "top" -fill x -padx 3 -pady 3 trace add variable ::eskil($top,prefregexp$t) write \ [list EditPrefRegsubUpdate $top] trace add variable ::eskil($top,prefregsub$t) write \ [list EditPrefRegsubUpdate $top] trace add variable ::eskil($top,prefregleft$t) write \ [list EditPrefRegsubUpdate $top] trace add variable ::eskil($top,prefregright$t) write \ [list EditPrefRegsubUpdate $top] } # Editor for ::Pref(preprocess) proc EditPrefRegsub {top} { set w $top.prefregsub if {[winfo exists $w] && [winfo toplevel $w] eq $w} { wm deiconify $w raise $w focus $w } else { toplevel $w -padx 3 -pady 3 wm title $w "Preferences: Preprocess" } ttk::button $w.b -text "Add" -command [list AddPrefRegsub $top $w] # Result example part if {![info exists ::eskil($top,prefregexa)]} { set ::eskil($top,prefregexa) \ "An example TextString FOR_REGSUB /* Comment */" set ::eskil($top,prefregexa2) \ "An example TextString FOR_REGSUB /* Comment */" } ttk::labelframe $w.res -text "Preprocessing result" -padding 3 ttk::label $w.res.l3 -text "Example 1:" -anchor "w" ttk::entryX $w.res.e3 -textvariable ::eskil($top,prefregexa) -width 60 ttk::label $w.res.l4 -text "Result 1:" -anchor "w" ttk::label $w.res.e4l -textvariable ::eskil($top,prefregresultl) \ -anchor "w" -width 10 ttk::label $w.res.e4r -textvariable ::eskil($top,prefregresultr) \ -anchor "w" -width 10 ttk::label $w.res.l5 -text "Example 2:" -anchor "w" ttk::entryX $w.res.e5 -textvariable ::eskil($top,prefregexa2) ttk::label $w.res.l6 -text "Result 2:" -anchor "w" ttk::label $w.res.e6l -textvariable ::eskil($top,prefregresultl2) \ -anchor "w" -width 10 ttk::label $w.res.e6r -textvariable ::eskil($top,prefregresultr2) \ -anchor "w" -width 10 grid $w.res.l3 $w.res.e3 -sticky we -padx 3 -pady 3 grid $w.res.l4 $w.res.e4l -sticky we -padx 3 -pady 3 grid x $w.res.e4r -sticky we -padx 3 -pady 3 grid $w.res.l5 $w.res.e5 -sticky we -padx 3 -pady 3 grid $w.res.l6 $w.res.e6l -sticky we -padx 3 -pady 3 grid x $w.res.e6r -sticky we -padx 3 -pady 3 grid columnconfigure $w.res 1 -weight 1 # Buttons ttk::frame $w.fb -padding 3 ttk::button $w.fb.b1 -text "Ok" -command [list EditPrefRegsubOk $top $w] ttk::button $w.fb.b2 -text "Apply" -command [list EditPrefRegsubOk $top $w 1] ttk::button $w.fb.b3 -text "Cancel" -command [list destroy $w] set ::widgets($top,prefRegsubOk) $w.fb.b1 set ::widgets($top,prefRegsubApply) $w.fb.b2 grid $w.fb.b1 x $w.fb.b2 x $w.fb.b3 -sticky we grid columnconfigure $w.fb {0 2 4} -uniform a grid columnconfigure $w.fb {1 3} -weight 1 # Top layout pack $w.b -side "top" -anchor "w" -padx 3 -pady 3 -ipadx 15 pack $w.fb $w.res -side bottom -fill x -padx 3 -pady 3 # Fill in existing or an empty line if {[llength $::Pref(preprocess)] == 0} { AddPrefRegsub $top $w } else { set t 1 foreach {RE Sub side} $::Pref(preprocess) { set ::eskil($top,prefregexp$t) $RE set ::eskil($top,prefregsub$t) $Sub set ::eskil($top,prefregleft$t) 0 set ::eskil($top,prefregright$t) 0 if {$side eq "" || $side eq "left"} { set ::eskil($top,prefregleft$t) 1 } if {$side eq "" || $side eq "right"} { set ::eskil($top,prefregright$t) 1 } AddPrefRegsub $top $w incr t } } trace add variable ::eskil($top,prefregexa) write \ [list EditPrefRegsubUpdate $top] trace add variable ::eskil($top,prefregexa2) write \ [list EditPrefRegsubUpdate $top] EditPrefRegsubUpdate $top } |