30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
if {$pkgName == ""} {
set type "exe"
} else {
set type "package"
}
}
array set $handle [list tcc $tcc_handle code "" type $type filename $output package $pkgName]
proc $handle {cmd args} [string map [list @@HANDLE@@ $handle] {
set handle {@@HANDLE@@}
if {$cmd == "go"} {
set args [list 0 {*}$args]
}
|
|
|
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
if {$pkgName == ""} {
set type "exe"
} else {
set type "package"
}
}
array set $handle [list tcc $tcc_handle code "" type $type filename $output package $pkgName add_inc_path "" add_lib_path "" add_lib ""]
proc $handle {cmd args} [string map [list @@HANDLE@@ $handle] {
set handle {@@HANDLE@@}
if {$cmd == "go"} {
set args [list 0 {*}$args]
}
|
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
}
proc _linktclcommand {cSymbol tclCommand} {
upvar #0 $handle state
lappend state(procs) $cSymbol $tclCommand
}
proc _cproc {handle name adefs rtype {body "#"}} {
upvar #0 $handle state
set wrap [::tcc4tcl::wrap $name $adefs $rtype $body]
set wrapped [lindex $wrap 0]
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
}
proc _linktclcommand {cSymbol tclCommand} {
upvar #0 $handle state
lappend state(procs) $cSymbol $tclCommand
}
proc _add_include_path {args} {
upvar #0 $handle state
lappend state(add_inc_path) {*}$args
}
proc _add_library_path {args} {
upvar #0 $handle state
lappend state(add_lib_path) {*}$args
}
proc _add_library {args} {
upvar #0 $handle state
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 wrapped [lindex $wrap 0]
|
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
}
default {
set tcc_type $state(type)
}
}
tcc4tcl $dir $tcc_type tcc
switch -- $state(type) {
"memory" {
tcc compile $code
if {[info exists state(procs)] && [llength $state(procs)] > 0} {
foreach {procname cname} $state(procs) {
|
>
>
>
>
>
>
>
>
>
>
>
>
|
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
|
}
default {
set tcc_type $state(type)
}
}
tcc4tcl $dir $tcc_type tcc
foreach dir $state(add_inc_path) {
tcc add_include_path $dir
}
foreach dir $state(add_lib_path) {
tcc add_library_path $dir
}
foreach lib $state(add_lib) {
tcc add_library $lib
}
switch -- $state(type) {
"memory" {
tcc compile $code
if {[info exists state(procs)] && [llength $state(procs)] > 0} {
foreach {procname cname} $state(procs) {
|