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     34   			}
    35     35   		}
    36     36   
    37     37   		array set $handle [list tcc $tcc_handle code "" type $type filename $output package $pkgName]
    38     38   
    39     39   		proc $handle {cmd args} [string map [list @@HANDLE@@ $handle] {
    40     40   			set handle {@@HANDLE@@}
           41  +
    41     42   			if {$cmd == "go"} {
    42     43   				set args [list 0 {*}$args]
    43     44   			}
    44     45   
    45     46   			if {$cmd == "code"} {
    46     47   				set cmd "go"
    47     48   				set args [list 1 {*}$args]
    48     49   			}
    49     50   
    50         -			uplevel 1 [list ::tcc4tcl::_$cmd $handle {*}$args]
           51  +			set callcmd ::tcc4tcl::_$cmd
           52  +
           53  +			if {![info command $callcmd]} {
           54  +				return -code error "unknown or ambiguous subcommand \"$cmd\": must be cproc, linktclcommand, code, tk, or go"
           55  +			}
           56  +
           57  +			uplevel 1 [list $callcmd $handle {*}$args]
    51     58   		}]
    52     59   
    53     60   		return $handle
    54     61   	}
    55     62   
    56     63   	proc _linktclcommand {cSymbol tclCommand} {
    57     64   		upvar #0 $handle state