20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
set handle ::tcc4tcl::tcc_[incr count]
set tcc_handle ::tcc4tcl::tcc_[incr count]
if {$output == ""} {
set type "memory"
} else {
set type "dll"
}
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@@}
uplevel 1 [list ::tcc4tcl::_$cmd $handle {*}$args]
|
>
>
>
|
>
|
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
set handle ::tcc4tcl::tcc_[incr count]
set tcc_handle ::tcc4tcl::tcc_[incr count]
if {$output == ""} {
set type "memory"
} else {
if {$pkgName == ""} {
set type "exe"
} else {
set type "dll"
}
}
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@@}
uplevel 1 [list ::tcc4tcl::_$cmd $handle {*}$args]
|
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
"memory" {
tcc compile $state(code)
foreach {procname cname} $state(procs) {
tcc command $procname $cname
}
}
"dll" {
append state(code) "int [string totitle $state(package)]_Init(Tcl_Interp *interp) \{\n"
append state(code) "#ifdef USE_TCL_STUBS\n"
append state(code) " if (Tcl_InitStubs(interp, \"8.4\" , 0) == 0L) \{\n"
append state(code) " return TCL_ERROR;\n"
append state(code) " \}\n"
append state(code) "#endif\n"
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
"memory" {
tcc compile $state(code)
foreach {procname cname} $state(procs) {
tcc command $procname $cname
}
}
"exe" {
if {[info exists state(procs)] && [llength $state(procs)] > 0} {
append state(code) "int _initProcs(Tcl_Interp *interp) \{\n"
foreach {procname cname} $state(procs) {
append state(code) " Tcl_CreateObjCommand(interp, \"$procname\", $cname, NULL, NULL);"
}
append state(code) "\}"
}
tcc compile $state(code)
tcc output_file $state(filename)
}
"dll" {
append state(code) "int [string totitle $state(package)]_Init(Tcl_Interp *interp) \{\n"
append state(code) "#ifdef USE_TCL_STUBS\n"
append state(code) " if (Tcl_InitStubs(interp, \"8.4\" , 0) == 0L) \{\n"
append state(code) " return TCL_ERROR;\n"
append state(code) " \}\n"
append state(code) "#endif\n"
|