Diff

Differences From Artifact [9613c501f1]:

To Artifact [6fae2b3ce8]:


14
15
16
17
18
19
20







21
22
23
24
25
26
27
}

foreach {arg val} $argv {
	switch -exact -- $arg {
		"--output" {
			set outputFile $val
		}







		"--header" {
			set headerFile $val
		}
	}
}

proc remove_debug {input} {







>
>
>
>
>
>
>







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
}

foreach {arg val} $argv {
	switch -exact -- $arg {
		"--output" {
			set outputFile $val
		}
		"--set-mode" {
			if {$mode ne "run"} {
				error "--set-mode may not be used with --dump-tcl"
			}

			set emitSpecificMode $val
		}
		"--header" {
			set headerFile $val
		}
	}
}

proc remove_debug {input} {
48
49
50
51
52
53
54




55
56
57
58

59
60
61
62
63
64
65
	"run" {
		package require xvfs

		if {[info exists outputFile]} {
			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" {







>
>
>
>




>







55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
	"run" {
		package require xvfs

		if {[info exists outputFile]} {
			set fd [open $outputFile w]
			::xvfs::setOutputChannel $fd
		}

		if {[info exists emitSpecificMode]} {
			::xvfs::setSpecificMode $emitSpecificMode
		}

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

		::xvfs::run {*}$argv

		if {[info exists fd]} {
			close $fd
		}
	}
	"dump-tcl" {
91
92
93
94
95
96
97


98
99





100
101
102
103
104
105
106
107
108
109
110
111
112
		puts {set ::xvfs::argv $::argv}
		puts {
			foreach {arg val} $argv {
				switch -exact -- $arg {
					"--output" {
						set ::minirivet::_outputChannel [open $val w]
					}


				}
			}





		}
		puts ""
		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
	}
}







>
>
|
|
>
>
>
>
>













103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
		puts {set ::xvfs::argv $::argv}
		puts {
			foreach {arg val} $argv {
				switch -exact -- $arg {
					"--output" {
						set ::minirivet::_outputChannel [open $val w]
					}
					"--set-mode" {
						set emitSpecificMode $val
					}
				}
			}
			if {[info exists emitSpecificMode]} {
				::xvfs::setSpecificMode $emitSpecificMode
			}

		}
		puts ""
		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
	}
}