Check-in [e592c85e70]
Overview
Comment:Cleanup to callbacks
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: e592c85e70b2dcd8407d1b3f7b994ea9f9b85daa2a446ae646d915b2b838d2f2
User & Date: rkeene on 2019-09-20 16:39:20
Other Links: manifest | tags
Context
2019-09-20
16:39
Added example of a synthetic filesystem creation check-in: c8742de968 user: rkeene tags: trunk
16:39
Cleanup to callbacks check-in: e592c85e70 user: rkeene tags: trunk
16:18
Support adding additional output files from callbacks check-in: d8e00cd4a3 user: rkeene tags: trunk
Changes

Modified lib/xvfs/xvfs.tcl from [5164175ffc] to [13bdfa17c6].

167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
		}

		set inputFile [file join $workingDirectory $file]
		set outputFile [file join $outputDirectory [encoding convertto utf-8 $file]]

		if {[info command ::xvfs::callback::setOutputFileName] ne ""} {
			set outputFile [::xvfs::callback::setOutputFileName $file $workingDirectory $inputFile $outputDirectory $outputFile]
			if {$outputFile eq ""} {
				continue
			}
		}

		unset -nocomplain fileInfo
		catch {
			file lstat $inputFile fileInfo







|







167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
		}

		set inputFile [file join $workingDirectory $file]
		set outputFile [file join $outputDirectory [encoding convertto utf-8 $file]]

		if {[info command ::xvfs::callback::setOutputFileName] ne ""} {
			set outputFile [::xvfs::callback::setOutputFileName $file $workingDirectory $inputFile $outputDirectory $outputFile]
			if {$outputFile eq "/"} {
				continue
			}
		}

		unset -nocomplain fileInfo
		catch {
			file lstat $inputFile fileInfo
197
198
199
200
201
202
203





204
205
206
207
208
209

210
211
212
213
214
215
216
217
218
219
220

	foreach subDirectory $subDirectories {
		lappend outputFiles {*}[processDirectory $fsName $directory $subDirectory]
	}
	
	set inputFile $directory
	set outputFile $outputDirectory





	unset -nocomplain fileInfo
	file stat $inputFile fileInfo
	set fileInfo(children) $children

	processFile $fsName $inputFile $outputFile [array get fileInfo]
	lappend outputFiles $outputFile


	if {$isTopLevel} {
		if {[info command ::xvfs::callback::addOutputFiles] ne ""} {
			lappend outputFiles {*}[::xvfs::callback::addOutputFiles]
		}

		::xvfs::_emitLine "\};"
	}

	return $outputFiles
}







>
>
>
>
>
|
|
|

|
|
>



|







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

	foreach subDirectory $subDirectories {
		lappend outputFiles {*}[processDirectory $fsName $directory $subDirectory]
	}
	
	set inputFile $directory
	set outputFile $outputDirectory
	if {[info command ::xvfs::callback::setOutputFileName] ne ""} {
		set outputFile [::xvfs::callback::setOutputFileName $directory $directory $inputFile $outputDirectory $outputFile]
	}

	if {$outputFile ne "/"} {
		unset -nocomplain fileInfo
		file stat $inputFile fileInfo
		set fileInfo(children) $children

		processFile $fsName $inputFile $outputFile [array get fileInfo]
		lappend outputFiles $outputFile
	}

	if {$isTopLevel} {
		if {[info command ::xvfs::callback::addOutputFiles] ne ""} {
			lappend outputFiles {*}[::xvfs::callback::addOutputFiles $fsName]
		}

		::xvfs::_emitLine "\};"
	}

	return $outputFiles
}
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
	## 3. Start processing directory and producing initial output
	set ::xvfs::outputFiles [processDirectory $fsName $rootDirectory]

	set ::xvfs::fsName $fsName
	set ::xvfs::rootDirectory $rootDirectory
}

proc ::xvfs::run {argv} {
	uplevel #0 { package require minirivet }

	set ::xvfs::argv $argv
	::minirivet::parse [file join $::xvfs::_xvfsDir xvfs.c.rvt]
}

proc ::xvfs::setOutputChannel {channel} {
	uplevel #0 { package require minirivet }
	tailcall ::minirivet::setOutputChannel $channel
}







|


|







271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
	## 3. Start processing directory and producing initial output
	set ::xvfs::outputFiles [processDirectory $fsName $rootDirectory]

	set ::xvfs::fsName $fsName
	set ::xvfs::rootDirectory $rootDirectory
}

proc ::xvfs::run {args} {
	uplevel #0 { package require minirivet }

	set ::xvfs::argv $args
	::minirivet::parse [file join $::xvfs::_xvfsDir xvfs.c.rvt]
}

proc ::xvfs::setOutputChannel {channel} {
	uplevel #0 { package require minirivet }
	tailcall ::minirivet::setOutputChannel $channel
}

Modified xvfs-create from [1d3473f00d] to [9613c501f1].

52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
			set fd [open $outputFile w]
			::xvfs::setOutputChannel $fd
		}

		if {[info exists headerFile]} {
			::xvfs::staticIncludeHeader $headerFile
		}
		::xvfs::run $argv

		if {[info exists fd]} {
			close $fd
		}
	}
	"dump-tcl" {
		set xvfs_tcl [file join $sourceDirectory lib xvfs xvfs.tcl]







|







52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
			set fd [open $outputFile w]
			::xvfs::setOutputChannel $fd
		}

		if {[info exists headerFile]} {
			::xvfs::staticIncludeHeader $headerFile
		}
		::xvfs::run {*}$argv

		if {[info exists fd]} {
			close $fd
		}
	}
	"dump-tcl" {
		set xvfs_tcl [file join $sourceDirectory lib xvfs xvfs.tcl]