Lines of
xvfs-create
from check-in d80c88cee0
that are changed by the sequence of edits moving toward
check-in 0bdbe4333e:
1: #! /usr/bin/env tclsh
2:
3: set sourceDirectory [file dirname [file normalize [info script]]]
4:
5: lappend auto_path [file join $sourceDirectory lib]
6:
7: set template [file join $sourceDirectory xvfs.c.rvt]
8:
9: package require minirivet
10:
11: set mode "run"
12: if {[lindex $argv 0] == "--dump-tcl"} {
13: set mode "dump-tcl"
14: }
15:
16: proc remove_debug {input} {
17: set output [list]
18:
19: set lastLine -
20: foreach line [split $input "\n"] {
21: if {[string match -nocase "*XVFS_DEBUG*" $line]} {
22: continue
23: }
24:
25: if {$lastLine eq "" && $line eq ""} {
26: continue
27: }
28:
29: set lastLine $line
30: lappend output $line
31: }
32:
33: return [join $output "\n"]
34: }
35:
36: switch -- $mode {
37: "run" {
38: ::minirivet::parse $template
39: }
40: "dump-tcl" {
41: set xvfs_tcl [file join $sourceDirectory lib xvfs xvfs.tcl]
42: set xvfs_core_h [file join $sourceDirectory xvfs-core.h]
43: set xvfs_core_c [file join $sourceDirectory xvfs-core.c]
44:
45: set cleanup {
46: "#include <xvfs-core.h>" ""
47: "#include <xvfs-core.c>" ""
48: }
49:
50: set core_header_data ""
51: append core_header_data [string map $cleanup [read [open $xvfs_core_h]]] "\n"
52: append core_header_data [string map $cleanup [read [open $xvfs_core_c]]] "\n"
53:
54: if {[lsearch -exact $argv "--remove-debug"] != -1} {
55: set core_header_data [remove_debug $core_header_data]
56: }
57:
58: puts "#! /usr/bin/env tclsh"
59: puts ""
60: puts [read [open $xvfs_tcl]]
61: puts ""
62: puts [list puts -nonewline $core_header_data]
63: puts ""
64: puts [string map $cleanup [::minirivet::parseStringToCode [read [open $template]]]]
65: }
66: default {
67: puts stderr "error: Invalid mode: $mode"
68: exit 1
69: }
70: }