Check-in [d7b387c82f]
Overview
Comment:Updated to give a useful error if an invalid subcommand is given
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d7b387c82f880f9b408e91295d11501bf07c9f78
User & Date: rkeene on 2014-06-21 21:17:01
Other Links: manifest | tags
Context
2014-06-21
21:18
Corrected typo in previous commit check-in: c951d6608a user: rkeene tags: trunk
21:17
Updated to give a useful error if an invalid subcommand is given check-in: d7b387c82f user: rkeene tags: trunk
19:04
Added a "linktclcommand" subcommand to create a Tcl command that references a C symbol check-in: a520862b78 user: rkeene tags: trunk
Changes

Modified tcc4tcl.tcl from [e17b60411a] to [47b77bc722].

34
35
36
37
38
39
40

41
42
43
44
45
46
47
48
49






50
51
52
53
54
55
56
57
			}
		}

		array set $handle [list tcc $tcc_handle code "" type $type filename $output package $pkgName]

		proc $handle {cmd args} [string map [list @@HANDLE@@ $handle] {
			set handle {@@HANDLE@@}

			if {$cmd == "go"} {
				set args [list 0 {*}$args]
			}

			if {$cmd == "code"} {
				set cmd "go"
				set args [list 1 {*}$args]
			}







			uplevel 1 [list ::tcc4tcl::_$cmd $handle {*}$args]
		}]

		return $handle
	}

	proc _linktclcommand {cSymbol tclCommand} {
		upvar #0 $handle state







>









>
>
>
>
>
>
|







34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
			}
		}

		array set $handle [list tcc $tcc_handle code "" type $type filename $output package $pkgName]

		proc $handle {cmd args} [string map [list @@HANDLE@@ $handle] {
			set handle {@@HANDLE@@}

			if {$cmd == "go"} {
				set args [list 0 {*}$args]
			}

			if {$cmd == "code"} {
				set cmd "go"
				set args [list 1 {*}$args]
			}

			set callcmd ::tcc4tcl::_$cmd

			if {![info command $callcmd]} {
				return -code error "unknown or ambiguous subcommand \"$cmd\": must be cproc, linktclcommand, code, tk, or go"
			}

			uplevel 1 [list $callcmd $handle {*}$args]
		}]

		return $handle
	}

	proc _linktclcommand {cSymbol tclCommand} {
		upvar #0 $handle state