Check-in [6641266e0b]
Overview
Comment:Fixed typo and added test for process_command_line
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:6641266e0b4078b6a3efda9e93647bda56894035
User & Date: rkeene on 2017-10-13 19:59:57
Other Links: manifest | tags
Context
2017-10-13
20:34
Added enough critcl to be handle tcllib check-in: f6d387c96c user: rkeene tags: trunk
19:59
Fixed typo and added test for process_command_line check-in: 6641266e0b user: rkeene tags: trunk
19:56
Updated to support very basic processing of the command-line check-in: dbb450841d user: rkeene tags: trunk
Changes

Modified tcc4tcl.tcl from [98a17dca0c] to [895fa80a76].

   161    161   
   162    162   	proc _process_command_line {handle cmdStr} {
   163    163   		# XXX:TODO: This needs to handle shell-quoted arguments
   164    164   		upvar #0 $handle state
   165    165   		set cmdStr [regsub -all {   *} $cmdStr { }]
   166    166   		set work [split $cmdStr " "]
   167    167   
   168         -		foreach arg $work {
   169         -			switch -glob -- $arg {
          168  +		foreach cmd $work {
          169  +			switch -glob -- $cmd {
   170    170   				"-I*" {
   171    171   					set dir [string range $cmd 2 end]
   172    172   					_add_include_path $handle $dir
   173    173   				}
   174    174   				"-D*" {
   175    175   					set symbolval [string range $cmd 2 end]
   176    176   					set symbolval [split $symbolval =]

Modified test.tcl from [bf545477a0] to [3226475418].

    59     59   	set v 1
    60     60   } err
    61     61   if {$err != "" || $v == 1} {
    62     62   	error "\[test4\] did not return the expected error"
    63     63   }
    64     64   
    65     65   # New API
           66  +## Test processing the commandline
           67  +set handle [tcc4tcl::new]
           68  +$handle process_command_line -Dx=1234
           69  +$handle cproc test13 {int i} int {
           70  +	return(i+x);
           71  +}
           72  +$handle go
           73  +puts "[test13 1] = 1235"
           74  +
    66     75   ## Simple test
    67     76   set handle [tcc4tcl::new]
    68     77   $handle cproc test5 {int i} int { return(i + 42); }
    69     78   if {[$handle code] == ""} {
    70     79   	error "[list $handle code] did not give code output"
    71     80   }
    72     81   $handle cproc test6 {int i} int { return(i + 42); }