Eskil

Check-in [f6e6a1dde6]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Experiment with worker thread.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | thread
Files: files | file ages | folders
SHA1: f6e6a1dde636d97dfe7e1b8f93ce486d7b7a0779
User & Date: peter 2016-07-05 22:37:46.209
Context
2016-08-03
17:44
Added ability to transfer mounts to another thread. check-in: e650f1067c user: peter tags: thread
2016-07-05
22:37
Experiment with worker thread. check-in: f6e6a1dde6 user: peter tags: thread
22:29
Moved startup code to its own source file. check-in: 393bb7a948 user: peter tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/eskil.syntax.
39
40
41
42
43
44
45







46
47
48
49
50
51
52
##nagelfar subcmd vfs::filesystem mount posixerror
##nagelfar syntax vfs::filesystem\ mount x x
##nagelfar syntax vfs::filesystem\ posixerror x
##nagelfar syntax vfs::matchDirectories x
##nagelfar syntax vfs::matchFiles x
##nagelfar syntax vfs::accessMode x
##nagelfar package known vfs








##nagelfar syntax pdf4tcl::getPaperSize x
##nagelfar syntax pdf4tcl::getPaperSizeList
##nagelfar syntax pdf4tcl::loadBaseType1Font 3
##nagelfar syntax pdf4tcl::loadBaseTrueTypeFont r 2 3
##nagelfar syntax pdf4tcl::createFont 3
##nagelfar package known pdf4tcl







>
>
>
>
>
>
>







39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
##nagelfar subcmd vfs::filesystem mount posixerror
##nagelfar syntax vfs::filesystem\ mount x x
##nagelfar syntax vfs::filesystem\ posixerror x
##nagelfar syntax vfs::matchDirectories x
##nagelfar syntax vfs::matchFiles x
##nagelfar syntax vfs::accessMode x
##nagelfar package known vfs

##nagelfar syntax thread::create o*
##nagelfar syntax thread::send x x*
##nagelfar package known Thread

##nagelfar syntax starkit::startup 0
##nagelfar package known starkit

##nagelfar syntax pdf4tcl::getPaperSize x
##nagelfar syntax pdf4tcl::getPaperSizeList
##nagelfar syntax pdf4tcl::loadBaseType1Font 3
##nagelfar syntax pdf4tcl::loadBaseTrueTypeFont r 2 3
##nagelfar syntax pdf4tcl::createFont 3
##nagelfar package known pdf4tcl
Changes to src/eskil.tcl.
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
    }
    if {[info exists ::eskil($top,rightFileDiff)]} {
        set dFile2 $::eskil($top,rightFileDiff)
    } else {
        set dFile2 $::eskil($top,rightFile)
    }

    set differr [catch {DiffUtil::diffFiles {*}$opts \
            $dFile1 $dFile2} diffres]

    # In conflict mode we can use the diff information collected when
    # parsing the conflict file. This makes sure the blocks in the conflict
    # file become change-blocks during merge.
    if {$::eskil($top,mode) eq "conflict" && $::eskil($top,modetype) eq "Pure"} {
        set diffres $::eskil($top,conflictDiff)
    }







|
|







1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
    }
    if {[info exists ::eskil($top,rightFileDiff)]} {
        set dFile2 $::eskil($top,rightFileDiff)
    } else {
        set dFile2 $::eskil($top,rightFile)
    }

    set cmd [list DiffUtil::diffFiles {*}$opts $dFile1 $dFile2]
    set differr [catch {SubEval $cmd} diffres]

    # In conflict mode we can use the diff information collected when
    # parsing the conflict file. This makes sure the blocks in the conflict
    # file become change-blocks during merge.
    if {$::eskil($top,mode) eq "conflict" && $::eskil($top,modetype) eq "Pure"} {
        set diffres $::eskil($top,conflictDiff)
    }
2943
2944
2945
2946
2947
2948
2949

2950
2951
2952
2953
2954
2955
2956
        AddDebugMenu $top
    }
}

# Runtime disable of C version of DiffUtil
proc DisableDiffUtilC {} {
    uplevel \#0 [list source $::eskil(thisDir)/../lib/diffutil/tcl/diffutil.tcl]

}

# Add a debug menu to a toplevel window
proc AddDebugMenu {top} {
    set dMenu [DebugMenu $top.m]
    $dMenu add checkbutton -label "Wrap" -variable wrapstate \
        -onvalue char -offvalue none -command \







>







2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
        AddDebugMenu $top
    }
}

# Runtime disable of C version of DiffUtil
proc DisableDiffUtilC {} {
    uplevel \#0 [list source $::eskil(thisDir)/../lib/diffutil/tcl/diffutil.tcl]
    SubEval [list source $::eskil(thisDir)/../lib/diffutil/tcl/diffutil.tcl]
}

# Add a debug menu to a toplevel window
proc AddDebugMenu {top} {
    set dMenu [DebugMenu $top.m]
    $dMenu add checkbutton -label "Wrap" -variable wrapstate \
        -onvalue char -offvalue none -command \
Changes to src/help.tcl.
54
55
56
57
58
59
60




61
62
63
64
65
66
67
    $w.t insert end "E-Mail: peter.spjuth@gmail.com\n"
    $w.t insert end "\nURL: http://eskil.tcl.tk\n"
    $w.t insert end "\nTcl version: [info patchlevel]\n"

    set du $::DiffUtil::version
    append du " ($::DiffUtil::implementation)"
    $w.t insert end "DiffUtil version: $du\n"





    # Provide debug info to help when DiffUtil does not load.
    if {[info exists ::DiffUtil::DebugLibFile]} {
        set lf $::DiffUtil::DebugLibFile
        set exist [file exists $lf]
        set lf [file join {*}[lrange [file split $lf] end-1 end]]
        if {$exist} {







>
>
>
>







54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
    $w.t insert end "E-Mail: peter.spjuth@gmail.com\n"
    $w.t insert end "\nURL: http://eskil.tcl.tk\n"
    $w.t insert end "\nTcl version: [info patchlevel]\n"

    set du $::DiffUtil::version
    append du " ($::DiffUtil::implementation)"
    $w.t insert end "DiffUtil version: $du\n"
 
    set du [SubEval {set ::DiffUtil::version}]
    append du " ([SubEval {set ::DiffUtil::implementation}])"
    $w.t insert end "(sub) DiffUtil version: $du\n"

    # Provide debug info to help when DiffUtil does not load.
    if {[info exists ::DiffUtil::DebugLibFile]} {
        set lf $::DiffUtil::DebugLibFile
        set exist [file exists $lf]
        set lf [file join {*}[lrange [file split $lf] end-1 end]]
        if {$exist} {
Changes to src/rev.tcl.
1189
1190
1191
1192
1193
1194
1195








1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
    }
    set gitmsg [string trim $gitmsg]
    if {$sts} {
        tk_messageBox -icon error -title "GIT revert error" -message $gitmsg \
                -parent $top
    }
}









# Mount a directory revision as a VFS, and return the mount point
proc eskil::rev::FOSSIL::mount {dir rev} {
    return [vcsvfs::fossil::mount $dir $rev]
}

# Mount a directory revision as a VFS, and return the mount point
proc eskil::rev::SVN::mount {dir rev} {
    return [vcsvfs::svn::mount $dir $rev]
}

# Mount a directory revision as a VFS, and return the mount point
proc eskil::rev::HG::mount {dir rev} {
    return [vcsvfs::hg::mount $dir $rev]
}

# Mount a directory revision as a VFS, and return the mount point
proc eskil::rev::GIT::mount {dir rev} {
    return [vcsvfs::git::mount $dir $rev]
}

# View log between displayed versions
proc eskil::rev::CVS::viewLog {top filename revs} {
    set cmd [list exec cvs -q log -N]
    if {[llength $revs] > 1} {
        lappend cmd -r[join $revs ":"]







>
>
>
>
>
>
>
>



|




|




|




|







1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
    }
    set gitmsg [string trim $gitmsg]
    if {$sts} {
        tk_messageBox -icon error -title "GIT revert error" -message $gitmsg \
                -parent $top
    }
}

# Common helper function to handle the mount command
proc eskil::rev::mount {args} {
    set res [{*}$args]
    # Also mount it in the sub interpreter, unless it is already there
    SubEval [list if "!\[[list file isdir $res]\]" $args]
    return $res
}

# Mount a directory revision as a VFS, and return the mount point
proc eskil::rev::FOSSIL::mount {dir rev} {
    return [eskil::rev::mount vcsvfs::fossil::mount $dir $rev]
}

# Mount a directory revision as a VFS, and return the mount point
proc eskil::rev::SVN::mount {dir rev} {
    return [eskil::rev::mount vcsvfs::svn::mount $dir $rev]
}

# Mount a directory revision as a VFS, and return the mount point
proc eskil::rev::HG::mount {dir rev} {
    return [eskil::rev::mount vcsvfs::hg::mount $dir $rev]
}

# Mount a directory revision as a VFS, and return the mount point
proc eskil::rev::GIT::mount {dir rev} {
    return [eskil::rev::mount vcsvfs::git::mount $dir $rev]
}

# View log between displayed versions
proc eskil::rev::CVS::viewLog {top filename revs} {
    set cmd [list exec cvs -q log -N]
    if {[llength $revs] > 1} {
        lappend cmd -r[join $revs ":"]
Changes to src/startup.tcl.
77
78
79
80
81
82
83





















84
85
86
87
88
89

90
91

92
93
94
95
96
97
98
    }

    if {[file exists $::eskil(thisDir)/../version.txt]} {
        set ch [open $::eskil(thisDir)/../version.txt]
        set ::eskil(diffver) [string trim [read $ch 100]]
        close $ch
    }






















    # Get all other source files
    InitReSource

    # Diff functionality is in the DiffUtil package.
    package require DiffUtil

    # Help DiffUtil to find a diff executable, if needed
    catch {DiffUtil::LocateDiffExe $::eskil(thisScript)}


    # Create font for PDF
    if {$::Pref(printFont) eq ""} {
        set fontfile $::eskil(thisDir)/embedfont.ttf
    } else {
        set fontfile $::Pref(printFont)
    }







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>






>


>







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
    }

    if {[file exists $::eskil(thisDir)/../version.txt]} {
        set ch [open $::eskil(thisDir)/../version.txt]
        set ::eskil(diffver) [string trim [read $ch 100]]
        close $ch
    }

    ##nagelfar syntax SubEval c
    if {[catch {package require Thread}]} {
        interp create _tinterp_
        interp alias {} SubEval _tinterp_ eval
    } else {
        set tid [thread::create -preserved]
        interp alias {} SubEval {} thread::send $tid
    }
    SubEval [list set ::auto_path $::auto_path]
    SubEval [list set ::argv0 $::argv0]
    SubEval [list set ::starkit::topdir $::starkit::topdir]
    SubEval {
        if {![file isdir $::starkit::topdir]} {
            vfs::mk4::Mount $::starkit::topdir $::starkit::topdir
        }
    }
    SubEval [list array set ::eskil [array get ::eskil]]
    SubEval [list proc InitReSource {} [info body InitReSource]]
    SubEval {package require snit}
    SubEval {InitReSource}

    # Get all other source files
    InitReSource

    # Diff functionality is in the DiffUtil package.
    package require DiffUtil
    SubEval {package require DiffUtil}
    # Help DiffUtil to find a diff executable, if needed
    catch {DiffUtil::LocateDiffExe $::eskil(thisScript)}
    SubEval [list catch [list DiffUtil::LocateDiffExe $::eskil(thisScript)]]

    # Create font for PDF
    if {$::Pref(printFont) eq ""} {
        set fontfile $::eskil(thisDir)/embedfont.ttf
    } else {
        set fontfile $::Pref(printFont)
    }