diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-02-08 15:25:55 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-02-08 15:25:55 (GMT) |
commit | b142586b211b0e3b339168b0227baa42d975a7f2 (patch) | |
tree | 12d28cd100f5ba1a21f1f7dbff745091bcbd8d6b | |
parent | 32dc9b67a9abfee0ac46d6fb2eeb10e229612723 (diff) | |
download | tcl-b142586b211b0e3b339168b0227baa42d975a7f2.zip tcl-b142586b211b0e3b339168b0227baa42d975a7f2.tar.gz tcl-b142586b211b0e3b339168b0227baa42d975a7f2.tar.bz2 |
Fix "auto.tcl" indenting
-rw-r--r-- | library/auto.tcl | 196 |
1 files changed, 99 insertions, 97 deletions
diff --git a/library/auto.tcl b/library/auto.tcl index 5f86c93..db7952a 100644 --- a/library/auto.tcl +++ b/library/auto.tcl @@ -70,60 +70,62 @@ proc tcl_findLibrary {basename version patch initScript enVarName varName} { # gives the end-user ultimate control to work-around any bugs, or # to customize. - if {[info exists env($enVarName)]} { - lappend dirs $env($enVarName) - } + if {[info exists env($enVarName)]} { + lappend dirs $env($enVarName) + } catch { - set found 0 + set found 0 set root [zipfs root] set mountpoint [file join $root lib [string tolower $basename]] - lappend dirs [file join $root app ${basename}_library] - lappend dirs [file join $root lib $mountpoint ${basename}_library] - lappend dirs [file join $root lib $mountpoint] + lappend dirs [file join $root app ${basename}_library] + lappend dirs [file join $root lib $mountpoint ${basename}_library] + lappend dirs [file join $root lib $mountpoint] if {![zipfs exists [file join $root app ${basename}_library]] \ - && ![zipfs exists $mountpoint]} { - set found 0 - foreach pkgdat [info loaded] { - lassign $pkgdat dllfile dllpkg - if {[string tolower $dllpkg] ne [string tolower $basename]} continue - if {$dllfile eq {}} { - # Loaded statically - break - } - set found 1 - zipfs mount $mountpoint $dllfile - break - } - if {!$found} { - set paths {} - lappend paths [file join $root app] - lappend paths [::${basename}::pkgconfig get libdir,runtime] - lappend paths [::${basename}::pkgconfig get bindir,runtime] - if {[catch {::${basename}::pkgconfig get zipfile,runtime} zipfile]} { - set zipfile [string tolower \ - "lib${basename}_[join [list {*}[split $version .] {*}$patch] _].zip"] - } - lappend paths [file dirname [file join [pwd] [info nameofexecutable]]] - foreach path $paths { - set archive [file join $path $zipfile] - if {![file exists $archive]} continue - zipfs mount $mountpoint $archive - if {[zipfs exists [file join $mountpoint ${basename}_library $initScript]]} { - lappend dirs [file join $mountpoint ${basename}_library] - set found 1 - break - } elseif {[zipfs exists [file join $mountpoint $initScript]]} { - lappend dirs [file join $mountpoint $initScript] - set found 1 - break - } else { - catch {zipfs unmount $archive} - } - } - } - } - } + && ![zipfs exists $mountpoint]} { + set found 0 + foreach pkgdat [info loaded] { + lassign $pkgdat dllfile dllpkg + if {[string tolower $dllpkg] ne [string tolower $basename]} continue + if {$dllfile eq {}} { + # Loaded statically + break + } + set found 1 + zipfs mount $mountpoint $dllfile + break + } + if {!$found} { + set paths {} + lappend paths [file join $root app] + lappend paths [::${basename}::pkgconfig get libdir,runtime] + lappend paths [::${basename}::pkgconfig get bindir,runtime] + if {[catch {::${basename}::pkgconfig get zipfile,runtime} zipfile]} { + set zipfile [string tolower \ + "lib${basename}_[join [list {*}[split $version .] {*}$patch] _].zip"] + } + lappend paths [file dirname [file join [pwd] [info nameofexecutable]]] + foreach path $paths { + set archive [file join $path $zipfile] + if {![file exists $archive]} { + continue + } + zipfs mount $mountpoint $archive + if {[zipfs exists [file join $mountpoint ${basename}_library $initScript]]} { + lappend dirs [file join $mountpoint ${basename}_library] + set found 1 + break + } elseif {[zipfs exists [file join $mountpoint $initScript]]} { + lappend dirs [file join $mountpoint $initScript] + set found 1 + break + } else { + catch {zipfs unmount $archive} + } + } + } + } + } # 2. In the package script directory registered within the # configuration of the package itself. @@ -158,11 +160,11 @@ proc tcl_findLibrary {basename version patch initScript enVarName varName} { # ../../../foo1.0.1/library # (From unix/arch directory in parallel build hierarchy) - set parentDir [file dirname [file dirname [info nameofexecutable]]] - set grandParentDir [file dirname $parentDir] - lappend dirs [file join $parentDir lib $basename$version] - lappend dirs [file join $grandParentDir lib $basename$version] - lappend dirs [file join $parentDir library] + set parentDir [file dirname [file dirname [info nameofexecutable]]] + set grandParentDir [file dirname $parentDir] + lappend dirs [file join $parentDir lib $basename$version] + lappend dirs [file join $grandParentDir lib $basename$version] + lappend dirs [file join $parentDir library] if {0} { lappend dirs [file join $grandParentDir library] lappend dirs [file join $grandParentDir $basename$patch library] @@ -185,19 +187,19 @@ proc tcl_findLibrary {basename version patch initScript enVarName varName} { } set seen($norm) {} - set the_library $i - set file [file join $i $initScript] + set the_library $i + set file [file join $i $initScript] # source everything when in a safe interpreter because we have a # source command, but no file exists command - if {[interp issafe] || [file exists $file]} { - if {![catch {uplevel #0 [list source $file]} msg opts]} { - return - } + if {[interp issafe] || [file exists $file]} { + if {![catch {uplevel #0 [list source $file]} msg opts]} { + return + } append errors "$file: $msg\n" append errors [dict get $opts -errorinfo]\n - } + } } unset -nocomplain the_library set msg "Can't find a usable $initScript in the following directories: \n" @@ -236,7 +238,7 @@ if {[interp issafe]} { proc auto_mkindex {dir args} { if {[interp issafe]} { - error "can't generate index within safe interpreter" + error "can't generate index within safe interpreter" } set oldDir [pwd] @@ -424,7 +426,7 @@ proc auto_mkindex_parser::mkindex {file} { $parser eval $contents foreach name $imports { - catch {$parser eval [list _%@namespace forget $name]} + catch {$parser eval [list _%@namespace forget $name]} } return $index } @@ -494,9 +496,9 @@ proc auto_mkindex_parser::commandInit {name arglist body} { set ns [namespace qualifiers $name] set tail [namespace tail $name] if {$ns eq ""} { - set fakeName [namespace current]::_%@fake_$tail + set fakeName [namespace current]::_%@fake_$tail } else { - set fakeName [namespace current]::[string map {:: _} _%@fake_$name] + set fakeName [namespace current]::[string map {:: _} _%@fake_$name] } proc $fakeName $arglist $body @@ -505,8 +507,8 @@ proc auto_mkindex_parser::commandInit {name arglist body} { # the fully qualified names, and have the procs point to the aliases. if {[string match *::* $name]} { - set exportCmd [list _%@namespace export [namespace tail $name]] - $parser eval [list _%@namespace eval $ns $exportCmd] + set exportCmd [list _%@namespace export [namespace tail $name]] + $parser eval [list _%@namespace eval $ns $exportCmd] # The following proc definition does not work if you want to tolerate # space or something else diabolical in the procedure name, (i.e., @@ -518,11 +520,11 @@ proc auto_mkindex_parser::commandInit {name arglist body} { # A gold star to someone that can make test autoMkindex-3.3 work # properly - set alias [namespace tail $fakeName] - $parser invokehidden proc $name {args} "_%@eval {$alias} \$args" - $parser alias $alias $fakeName + set alias [namespace tail $fakeName] + $parser invokehidden proc $name {args} "_%@eval {$alias} \$args" + $parser alias $alias $fakeName } else { - $parser alias $name $fakeName + $parser alias $name $fakeName } return } @@ -544,18 +546,18 @@ proc auto_mkindex_parser::fullname {name} { variable contextStack if {![string match ::* $name]} { - foreach ns $contextStack { - set name "${ns}::$name" - if {[string match ::* $name]} { - break - } - } + foreach ns $contextStack { + set name "${ns}::$name" + if {[string match ::* $name]} { + break + } + } } if {[namespace qualifiers $name] eq ""} { - set name [namespace tail $name] + set name [namespace tail $name] } elseif {![string match ::* $name]} { - set name "::$name" + set name "::$name" } # Earlier, mkindex replaced all $'s with \0. Now, we have to reverse that @@ -645,27 +647,27 @@ auto_mkindex_parser::hook { auto_mkindex_parser::command namespace {op args} { switch -- $op { - eval { - variable parser - variable contextStack + eval { + variable parser + variable contextStack - set name [lindex $args 0] - set args [lrange $args 1 end] + set name [lindex $args 0] + set args [lrange $args 1 end] - set contextStack [linsert $contextStack 0 $name] + set contextStack [linsert $contextStack 0 $name] $parser eval [list _%@namespace eval $name] $args - set contextStack [lrange $contextStack 1 end] - } - import { - variable parser - variable imports - foreach pattern $args { - if {$pattern ne "-force"} { - lappend imports $pattern - } - } - catch {$parser eval "_%@namespace import $args"} - } + set contextStack [lrange $contextStack 1 end] + } + import { + variable parser + variable imports + foreach pattern $args { + if {$pattern ne "-force"} { + lappend imports $pattern + } + } + catch {$parser eval "_%@namespace import $args"} + } ensemble { variable parser variable contextStack |