Overview
| Comment: | More work on wrapping Tcl for consumption by C |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
a88c66196aaab7b2acf8671271cc4556 |
| User & Date: | rkeene on 2014-07-16 04:13:20.232 |
| Other Links: | manifest | tags |
Context
|
2014-07-16
| ||
| 04:14 | Added comments check-in: 79f4d09e57 user: rkeene tags: trunk | |
| 04:13 | More work on wrapping Tcl for consumption by C check-in: a88c66196a user: rkeene tags: trunk | |
| 04:09 | Corrected floating point error value check-in: 56023a368d user: rkeene tags: trunk | |
Changes
Modified tcc4tcl.tcl
from [49f61e4dc3]
to [990ffbcf98].
| ︙ | ︙ | |||
169 170 171 172 173 174 175 |
if {$type == "Tcl_Interp*"} {
continue
}
lappend args $var
}
| > > > | > | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
if {$type == "Tcl_Interp*"} {
continue
}
lappend args $var
}
if {[llength $adefs_c] == 0} {
set adefs_c "void"
} else {
set adefs_c [join $adefs_c {, }]
}
# Determine how to return in failure
if {$rtype != "void"} {
if {[info exists returnErrorValue]} {
set return_failure "return(${returnErrorValue})"
} else {
switch -- $rtype {
|
| ︙ | ︙ |
Modified test.tcl
from [98300662c0]
to [20cd200abf].
| ︙ | ︙ | |||
149 150 151 152 153 154 155 |
set handle [tcc4tcl::new]
$handle proc callToTcl {Tcl_Interp* ip int a int b} int {
set retval [expr {$a + $b}]
return $retval
}
$handle cwrap callToTcl {Tcl_Interp* ip int a int b} int
| < > > > > > > > > | 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
set handle [tcc4tcl::new]
$handle proc callToTcl {Tcl_Interp* ip int a int b} int {
set retval [expr {$a + $b}]
return $retval
}
$handle cwrap callToTcl {Tcl_Interp* ip int a int b} int
$handle go
if {[callToTcl 3 5] != 8} {
error "3 + 5 is 8, not [callToTcl 3 5]"
}
set handle [tcc4tcl::new]
$handle proc callToTcl1 {} float {
return 0.1
}
$handle cwrap callToTcl1 {} float
$handle go
puts [callToTcl1]
|