Eskil

Check-in [44c31b0e2b]
Login

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

Overview
Comment:Allow plugin to know file names. Use source file with pdftotext in PDF plugin since stdin is not reliable there.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 44c31b0e2b6333730bd768f9c54e993769d66857
User & Date: peter 2016-04-13 14:09:12.335
Context
2016-04-13
21:44
Repaired Makefile check-in: 9589f9abfc user: peter tags: trunk
14:09
Allow plugin to know file names. Use source file with pdftotext in PDF plugin since stdin is not reliable there. check-in: 44c31b0e2b user: peter tags: trunk
2016-04-12
22:22
When displaying a patch, detect a file with no changed chunks. check-in: 98179537eb user: peter tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to Changes.




1
2
3
4
5
6
7




2016-04-13
 When displaying a patch, detect a file with no changed chunks.
 E.g. svn diff lists changed binary files like that.

2016-04-08
 Allow GUI to set privilege for plugins.
 Better search for pdftotext in pdf plugin.
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
2016-04-13
 Allow plugin to know file names. Use source file with pdftotext in PDF plugin
 since stdin is not reliable there.

2016-04-13
 When displaying a patch, detect a file with no changed chunks.
 E.g. svn diff lists changed binary files like that.

2016-04-08
 Allow GUI to set privilege for plugins.
 Better search for pdftotext in pdf plugin.
Changes to Makefile.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#----------------------------------------------------------------------
# Make file for Eskil
#----------------------------------------------------------------------

VERSION = 271

# Path to the TclKits used for creating StarPacks.
TCLKIT = /home/peter/tclkit/v85
TCLKIT_LINUX   = $(TCLKIT)/tclkit-linux
TCLKIT_SOLARIS = $(TCLKIT)/tclkit-solaris-sparc
TCLKIT_WIN     = $(TCLKIT)/tclkit-win32.upx.exe
TCLKIT_MAC     = $(TCLKIT)/tclkit-mac-864

# Paths to the libraries used.
# If you do not have access to all these, you can get them from an Eskil kit
# as explained below.
TEXTSEARCH = /home/peter/src/textsearch
DIFFUTIL   = /home/peter/src/DiffUtilTcl/lib.vfs/DiffUtil







|
|

|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#----------------------------------------------------------------------
# Make file for Eskil
#----------------------------------------------------------------------

VERSION = 271

# Path to the TclKits used for creating StarPacks.
TCLKIT = /user/asic/scripts/tclkit
TCLKIT_LINUX   = $(TCLKIT)/tclkit-8.6.1-rhel5-x86_64
TCLKIT_SOLARIS = $(TCLKIT)/tclkit-solaris-sparc
TCLKIT_WIN     = $(TCLKIT)/tclkit-gui-8.6.2.exe
TCLKIT_MAC     = $(TCLKIT)/tclkit-mac-864

# Paths to the libraries used.
# If you do not have access to all these, you can get them from an Eskil kit
# as explained below.
TEXTSEARCH = /home/peter/src/textsearch
DIFFUTIL   = /home/peter/src/DiffUtilTcl/lib.vfs/DiffUtil
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
	@rm -f $(LOGFILES) $(IFILES) $(MFILES)

#----------------------------------------------------------------
# Packaging/Releasing
#----------------------------------------------------------------

wrap:
	sdx wrap eskil.kit

wrapexe:
	@\rm -f eskil.linux eskil.exe eskil.solaris
	sdx wrap eskil.linux   -runtime $(TCLKIT_LINUX)
	sdx wrap eskil.mac     -runtime $(TCLKIT_MAC)
#	sdx wrap eskil.solaris -runtime $(TCLKIT_SOLARIS)
	cd eskil.vfs/lib ; ln -s $(TWAPI) twapi
	sdx wrap eskil.exe     -runtime $(TCLKIT_WIN)
	rm eskil.vfs/lib/twapi

release: setup wrap wrapexe
	@cp eskil.kit eskil`date +%Y%m%d`.kit
	@cp eskil.kit eskil$(VERSION).kit
	@gzip eskil.linux
	@mv eskil.linux.gz eskil$(VERSION).linux.gz
	@gzip eskil.mac
	@mv eskil.mac.gz eskil$(VERSION).mac.gz
#	@gzip eskil.solaris
#	@mv eskil.solaris.gz eskil$(VERSION).solaris.gz
	@zip eskil$(VERSION).win.zip eskil.exe
	@zip eskil`date +%Y%m%d`.win.zip eskil.exe







|




|

|

|












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
	@rm -f $(LOGFILES) $(IFILES) $(MFILES)

#----------------------------------------------------------------
# Packaging/Releasing
#----------------------------------------------------------------

wrap:
	sdx wrap eskil.kit -interp tclsh

wrapexe:
	@\rm -f eskil.linux eskil.exe eskil.solaris
	sdx wrap eskil.linux   -runtime $(TCLKIT_LINUX)
#	sdx wrap eskil.mac     -runtime $(TCLKIT_MAC)
#	sdx wrap eskil.solaris -runtime $(TCLKIT_SOLARIS)
#	cd eskil.vfs/lib ; ln -s $(TWAPI) twapi
	sdx wrap eskil.exe     -runtime $(TCLKIT_WIN)
#	rm eskil.vfs/lib/twapi

release: setup wrap wrapexe
	@cp eskil.kit eskil`date +%Y%m%d`.kit
	@cp eskil.kit eskil$(VERSION).kit
	@gzip eskil.linux
	@mv eskil.linux.gz eskil$(VERSION).linux.gz
	@gzip eskil.mac
	@mv eskil.mac.gz eskil$(VERSION).mac.gz
#	@gzip eskil.solaris
#	@mv eskil.solaris.gz eskil$(VERSION).solaris.gz
	@zip eskil$(VERSION).win.zip eskil.exe
	@zip eskil`date +%Y%m%d`.win.zip eskil.exe
Changes to doc/plugins.txt.
15
16
17
18
19
20
21


22
23
24
25
26
27
28
damage. You can turn this safety off with -pluginallow.

A plugin is set up with these global variables filled in:
::WhoAmI     : The name of the plugin
::WhoAmIFull : The full path to the plugin source
::Info       : The contents of -plugininfo parameter
::Pref       : A copy if Eskil's internal preferences array.


::argv       : A copy of the command line from Eskil's invocation

Example plugins are included in the kit.

A plugin may give a result that has a line-by-line correspondence to
the original, in which case the preprocessed data is used for comparing
while the original is used for displaying.  The main plugin procedure







>
>







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
damage. You can turn this safety off with -pluginallow.

A plugin is set up with these global variables filled in:
::WhoAmI     : The name of the plugin
::WhoAmIFull : The full path to the plugin source
::Info       : The contents of -plugininfo parameter
::Pref       : A copy if Eskil's internal preferences array.
::File(left) : The name of the left file processed
::File(right): The name of the right file processed
::argv       : A copy of the command line from Eskil's invocation

Example plugins are included in the kit.

A plugin may give a result that has a line-by-line correspondence to
the original, in which case the preprocessed data is used for comparing
while the original is used for displaying.  The main plugin procedure
Changes to htdocs/plugins.wiki.
40
41
42
43
44
45
46


47
48
49
50
51
52
53
external tools.

A plugin is set up with these global variables filled in:
  *  ::WhoAmI     : The name of the plugin
  *  ::WhoAmIFull : The full path to the plugin source
  *  ::Info       : The contents of -plugininfo parameter
  *  ::Pref       : A copy if Eskil's internal preferences array.


  *  ::argv       : A copy of the command line from Eskil's invocation

<h2>Additional options</h2>
A plugin can declare command line options that should be accepted by Eskil.
They will be passed on to the plugin through the ::argv list.
If the initial "##Eskil" line is followed by comments formatted as below,
it adds options. Any empty line will end parsing for such lines.







>
>







40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
external tools.

A plugin is set up with these global variables filled in:
  *  ::WhoAmI     : The name of the plugin
  *  ::WhoAmIFull : The full path to the plugin source
  *  ::Info       : The contents of -plugininfo parameter
  *  ::Pref       : A copy if Eskil's internal preferences array.
  *  ::File(left) : The name of the left file processed
  *  ::File(right): The name of the right file processed
  *  ::argv       : A copy of the command line from Eskil's invocation

<h2>Additional options</h2>
A plugin can declare command line options that should be accepted by Eskil.
They will be passed on to the plugin through the ::argv list.
If the initial "##Eskil" line is followed by comments formatted as below,
it adds options. Any empty line will end parsing for such lines.
Changes to plugins/pdf.tcl.
39
40
41
42
43
44
45

46
47
48
49
50
51
52
53
        puts $cho "PDF plugin needs external tool 'pdftotext' to run"
        return 1
    }
    if {[catch {llength $::Info}]} {
        puts $cho "PDF plugin needs -plugininfo parameter to be a list"
        return 1
    }

    if {[catch {exec $cand {*}$::Info - - <@ $chi >&@ $cho}]} {
        puts $cho "**************************************"
        puts $cho "PDF plugin got an error from pdftotext"
    }

    # Signal that the file after processing should be used both
    # for comparison and for displaying.
    return 1







>
|







39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
        puts $cho "PDF plugin needs external tool 'pdftotext' to run"
        return 1
    }
    if {[catch {llength $::Info}]} {
        puts $cho "PDF plugin needs -plugininfo parameter to be a list"
        return 1
    }
    # Use source file with pdftotext since stdin is not reliable on e.g Windows
    if {[catch {exec $cand {*}$::Info $::File($side) - >&@ $cho}]} {
        puts $cho "**************************************"
        puts $cho "PDF plugin got an error from pdftotext"
    }

    # Signal that the file after processing should be used both
    # for comparison and for displaying.
    return 1
Changes to src/plugin.tcl.
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
    if {$src eq ""} {
        return ""
    }

    # Create interpreter and load source
    if {$allow} {
        set pi [interp create]
        $pi eval source $src
    } else {
        set pi [interp create -safe]
        $pi invokehidden -global source $src
    }

    # Setup info
    $pi eval [list set ::WhoAmI [file rootname [file tail $src]]]







|







64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
    if {$src eq ""} {
        return ""
    }

    # Create interpreter and load source
    if {$allow} {
        set pi [interp create]
        $pi eval [list source $src]
    } else {
        set pi [interp create -safe]
        $pi invokehidden -global source $src
    }

    # Setup info
    $pi eval [list set ::WhoAmI [file rootname [file tail $src]]]
173
174
175
176
177
178
179



180
181
182
183
184
185
186
proc preparePlugin {top} {
    disallowEdit $top
    set allow [dict get $::eskil($top,pluginpinfo) allow]
    # Pass ::argv to plugin
    $::eskil($top,plugin) eval [list set ::argv $::eskil(argv)]
    # Pass ::Pref to plugin
    $::eskil($top,plugin) eval [list array set ::Pref [array get ::Pref]]



    set out1 [tmpFile]
    set out2 [tmpFile]

    set chi [open $::eskil($top,leftFile) r]
    set cho [open $out1 w]
    set chi2 [open $::eskil($top,rightFile) r]
    set cho2 [open $out2 w]







>
>
>







173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
proc preparePlugin {top} {
    disallowEdit $top
    set allow [dict get $::eskil($top,pluginpinfo) allow]
    # Pass ::argv to plugin
    $::eskil($top,plugin) eval [list set ::argv $::eskil(argv)]
    # Pass ::Pref to plugin
    $::eskil($top,plugin) eval [list array set ::Pref [array get ::Pref]]
    # Pass File info to plugin
    $::eskil($top,plugin) eval [list set ::File(left)  $::eskil($top,leftFile)]
    $::eskil($top,plugin) eval [list set ::File(right) $::eskil($top,rightFile)]
    set out1 [tmpFile]
    set out2 [tmpFile]

    set chi [open $::eskil($top,leftFile) r]
    set cho [open $out1 w]
    set chi2 [open $::eskil($top,rightFile) r]
    set cho2 [open $out2 w]