144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
|
-
-
-
+
+
+
+
+
+
+
+
|
# Argument definitions (in C style) initialization
set adefs_c [list]
# Names of all arguments initialization
set args [list]
# If we aren't creating a new interp, it must be the first argument
# If the definition of this proc already includes the interp
# argument, use it -- otherwise add one
# Determine if one of the arguments is a Tcl_Interp*, if not
# then we will need to create our own Tcl interpreter for
# local use
set newInterp 1
foreach {type var} $adefs {
if {$type == "Tcl_Interp*"} {
set newInterp 0
set interp_name $var
break
}
}
# Create the C-style argument definition
foreach {type var} $adefs {
# Update definition of types
lappend adefs_c [list $type $var]
# Note the type for this variable
set types($var) $type
# The Tcl interpreter is not added to the list of Tcl arguments
if {$type == "Tcl_Interp*"} {
continue
}
# Update the list of arguments to pass to Tcl
lappend args $var
}
if {[llength $adefs_c] == 0} {
set adefs_c "void"
} else {
set adefs_c [join $adefs_c {, }]
|