Diff

Differences From Artifact [36eddd8d96]:

To Artifact [ef2102737b]:


1
2
3
4
5
6
7

8
9
10
11
12
13
14
1
2
3
4
5
6

7
8
9
10
11
12
13
14






-
+







#! /usr/bin/env tclsh

set sourceDirectory [file dirname [file normalize [info script]]]

lappend auto_path [file join $sourceDirectory lib]

set template [file join $sourceDirectory xvfs.c.rvt]
set template [file join $sourceDirectory lib xvfs xvfs.c.rvt]

package require minirivet

set mode "run"
if {[lindex $argv 0] == "--dump-tcl"} {
	set mode "dump-tcl"
}
44
45
46
47
48
49
50


51

52
53
54
55
56
57
58
44
45
46
47
48
49
50
51
52

53
54
55
56
57
58
59
60







+
+
-
+







switch -- $mode {
	"run" {
		if {[info exists outputFile]} {
			set fd [open $outputFile w]
			::minirivet::setOutputChannel $fd
		}

		package require xvfs
		set ::xvfs::argv $argv
		::minirivet::parse $template
		::xvfs::run

		if {[info exists fd]} {
			close $fd
		}
	}
	"dump-tcl" {
		set xvfs_tcl [file join $sourceDirectory lib xvfs xvfs.tcl]
73
74
75
76
77
78
79

80
81











82



83
84
85
86
87
88
89
90
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







+


+
+
+
+
+
+
+
+
+
+
+
-
+
+
+








		}

		puts "#! /usr/bin/env tclsh"
		puts ""
		puts [list namespace eval ::minirivet {}]
		puts [list set ::minirivet::_outputChannel stdout]
		puts [list proc ::minirivet::_emitOutput [info args ::minirivet::_emitOutput] [info body ::minirivet::_emitOutput]]
		puts ""
		puts [read [open $xvfs_tcl]]
		puts ""
		puts {set ::xvfs::argv $::argv}
		puts {
			foreach {arg val} $argv {
				switch -exact -- $arg {
					"--output" {
						set ::minirivet::_outputChannel [open $val w]
					}
				}
			}
		}
		puts ""
		puts [list puts -nonewline $core_header_data]
		puts [list ::minirivet::_emitOutput $core_header_data]
		puts ""

		puts ""
		puts [string map $cleanup [::minirivet::parseStringToCode [read [open $template]]]]
	}
	default {
		puts stderr "error: Invalid mode: $mode"
		exit 1
	}
}