Check-in [f09ab16ca1]
Overview
Comment:Added a mode to dump template script as an independent script
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: f09ab16ca14bef0dd97ea96b6069a46aa31db5f52eacdd326e26c5599cb5e934
User & Date: rkeene on 2019-05-08 17:08:28
Other Links: manifest | tags
Context
2019-05-08
17:25
For --dump-tcl mode dump all dependency C files as well check-in: 7664854ef9 user: rkeene tags: trunk
17:08
Added a mode to dump template script as an independent script check-in: f09ab16ca1 user: rkeene tags: trunk
16:52
More cleanup check-in: 9d3052c6f1 user: rkeene tags: trunk
Changes

Modified lib/minirivet/minirivet.tcl from [88a3db5d6b] to [4c17a6eef0].

1
2
3
4
5
6
7
8
9
10
11
12
13
#! /usr/bin/env tclsh

namespace eval ::minirivet {}

proc ::minirivet::parseString {string} {

	set fixMap [list]
	foreach char [list "\{" "\}" "\\"] {
		lappend fixMap $char "\}; puts -nonewline \"\\$char\"; puts -nonewline \{"
	}

	set code ""
	while {$string ne ""} {




|
<







1
2
3
4
5

6
7
8
9
10
11
12
#! /usr/bin/env tclsh

namespace eval ::minirivet {}

proc ::minirivet::parseStringToCode {string} {

	set fixMap [list]
	foreach char [list "\{" "\}" "\\"] {
		lappend fixMap $char "\}; puts -nonewline \"\\$char\"; puts -nonewline \{"
	}

	set code ""
	while {$string ne ""} {
33
34
35
36
37
38
39





40
41
42
43
44
45
46
47
48
49
50
		}

		set string [string range $string $endIndex+2 end]


	}






	tailcall namespace eval ::request $code
}

proc ::minirivet::parse {file} {
	set fd [open $file]
	set data [read $fd]
	close $fd
	tailcall parseString $data
}

package provide minirivet 1







>
>
>
>
>











32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
		}

		set string [string range $string $endIndex+2 end]


	}

	return $code
}

proc ::minirivet::parseString {string} {
	set code [parseStringToCode $string]
	tailcall namespace eval ::request $code
}

proc ::minirivet::parse {file} {
	set fd [open $file]
	set data [read $fd]
	close $fd
	tailcall parseString $data
}

package provide minirivet 1

Modified xvfs-create from [d4bcdb5bcc] to [fbd06cba28].

1
2
3

4

5
6
7
8







9















#! /usr/bin/env tclsh

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

lappend auto_path [file join $sourceDirectory lib]

set template [file join xvfs.c.rvt]

package require minirivet








minirivet::parse $template


















>

>
|



>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#! /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
	}
}