Check-in [a88c66196a]
Overview
Comment:More work on wrapping Tcl for consumption by C
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:a88c66196aaab7b2acf8671271cc4556e600399d
User & Date: rkeene on 2014-07-16 04:13:20
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    169   			if {$type == "Tcl_Interp*"} {
   170    170   				continue
   171    171   			}
   172    172   
   173    173   			lappend args $var
   174    174   		}
   175    175   
   176         -		set adefs_c [join $adefs_c {, }]
          176  +		if {[llength $adefs_c] == 0} {
          177  +			set adefs_c "void"
          178  +		} else {
          179  +			set adefs_c [join $adefs_c {, }]
          180  +		}
   177    181   
   178    182   		# Determine how to return in failure
   179    183   		if {$rtype != "void"} {
   180    184   			if {[info exists returnErrorValue]} {
   181    185   				set return_failure "return(${returnErrorValue})"
   182    186   			} else {
   183    187   				switch -- $rtype {

Modified test.tcl from [98300662c0] to [20cd200abf].

   149    149   set handle [tcc4tcl::new]
   150    150   $handle proc callToTcl {Tcl_Interp* ip int a int b} int {
   151    151   	set retval [expr {$a + $b}]
   152    152   
   153    153   	return $retval
   154    154   }
   155    155   $handle cwrap callToTcl {Tcl_Interp* ip int a int b} int
   156         -puts [$handle code]
   157    156   $handle go
   158    157   if {[callToTcl 3 5] != 8} {
   159    158   	error "3 + 5 is 8, not [callToTcl 3 5]"
   160    159   }
          160  +
          161  +set handle [tcc4tcl::new]
          162  +$handle proc callToTcl1 {} float {
          163  +	return 0.1
          164  +}
          165  +$handle cwrap callToTcl1 {} float
          166  +$handle go
          167  +puts [callToTcl1]