xvfs-create at [f09ab16ca1]

File xvfs-create artifact fbd06cba28 part of check-in f09ab16ca1


#! /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]

package require minirivet

set mode "run"
if {[lindex $argv 0] == "--dump-tcl"} {
	set mode "dump-tcl"
}

switch -- $mode {
	"run" {
		::minirivet::parse $template
	}
	"dump-tcl" {
		set xvfs_tcl [file join $sourceDirectory lib xvfs xvfs.tcl]

		puts "#! /usr/bin/env tclsh"
		puts ""
		puts [read [open $xvfs_tcl]]
		puts ""
		puts [::minirivet::parseStringToCode [read [open $template]]]
	}
	default {
		puts stderr "error: Invalid mode: $mode"
		exit 1
	}
}