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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176

	proc _process_command_line {handle cmdStr} {
		# XXX:TODO: This needs to handle shell-quoted arguments
		upvar #0 $handle state
		set cmdStr [regsub -all {   *} $cmdStr { }]
		set work [split $cmdStr " "]

		foreach arg $work {
			switch -glob -- $arg {
				"-I*" {
					set dir [string range $cmd 2 end]
					_add_include_path $handle $dir
				}
				"-D*" {
					set symbolval [string range $cmd 2 end]
					set symbolval [split $symbolval =]







|
|







161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176

	proc _process_command_line {handle cmdStr} {
		# XXX:TODO: This needs to handle shell-quoted arguments
		upvar #0 $handle state
		set cmdStr [regsub -all {   *} $cmdStr { }]
		set work [split $cmdStr " "]

		foreach cmd $work {
			switch -glob -- $cmd {
				"-I*" {
					set dir [string range $cmd 2 end]
					_add_include_path $handle $dir
				}
				"-D*" {
					set symbolval [string range $cmd 2 end]
					set symbolval [split $symbolval =]

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

59
60
61
62
63
64
65









66
67
68
69
70
71
72
	set v 1
} err
if {$err != "" || $v == 1} {
	error "\[test4\] did not return the expected error"
}

# New API









## Simple test
set handle [tcc4tcl::new]
$handle cproc test5 {int i} int { return(i + 42); }
if {[$handle code] == ""} {
	error "[list $handle code] did not give code output"
}
$handle cproc test6 {int i} int { return(i + 42); }







>
>
>
>
>
>
>
>
>







59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
	set v 1
} err
if {$err != "" || $v == 1} {
	error "\[test4\] did not return the expected error"
}

# New API
## Test processing the commandline
set handle [tcc4tcl::new]
$handle process_command_line -Dx=1234
$handle cproc test13 {int i} int {
	return(i+x);
}
$handle go
puts "[test13 1] = 1235"

## Simple test
set handle [tcc4tcl::new]
$handle cproc test5 {int i} int { return(i + 42); }
if {[$handle code] == ""} {
	error "[list $handle code] did not give code output"
}
$handle cproc test6 {int i} int { return(i + 42); }