83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
-
+
|
lappend state(add_lib) {*}$args
}
proc _cproc {handle name adefs rtype {body "#"}} {
upvar #0 $handle state
set wrap [::tcc4tcl::wrap $name $adefs $rtype $body]
set wrap [uplevel 1 [list ::tcc4tcl::wrap $name $adefs $rtype $body]]
set wrapped [lindex $wrap 0]
set wrapper [lindex $wrap 1]
set tclname [lindex $wrap 2]
append state(code) $wrapped "\n"
append state(code) $wrapper "\n"
|
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
|
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
|
-
+
|
# Create wrapped function
if {$body ne "#"} {
append code "static $rtype2 ${cname}([join $cargs {, }]) \{\n"
append code $body
append code "\}\n"
} else {
append code "#define $cname $name" "\n"
append code "#define $cname [namespace tail $name]" "\n"
}
# Create wrapper function
## Supported input types
## Tcl_Interp*
## int
## long
|