32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#endif /* MB_TASKMODAL */
#include "tclInt.h"
#if defined(HAVE_TCL_GETENCODINGNAMEFROMENVIRONMENT) && defined(HAVE_TCL_SETSYSTEMENCODING)
# define TCLKIT_CAN_SET_ENCODING 1
#endif
#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION < 85
# define KIT_INCLUDES_PWB 1
#endif
#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION < 86
# define KIT_INCLUDES_ZLIB 1
#endif
|
>
>
>
>
|
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#endif /* MB_TASKMODAL */
#include "tclInt.h"
#if defined(HAVE_TCL_GETENCODINGNAMEFROMENVIRONMENT) && defined(HAVE_TCL_SETSYSTEMENCODING)
# define TCLKIT_CAN_SET_ENCODING 1
#endif
#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION < 85
# define TCLKIT_REQUIRE_TCLEXECUTABLENAME 1
#endif
#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION < 85
# define KIT_INCLUDES_PWB 1
#endif
#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION < 86
# define KIT_INCLUDES_ZLIB 1
#endif
|
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# ifdef KIT_INCLUDES_MK4TCL
# define KIT_STORAGE_MK4 1
# else
# define KIT_STORAGE_ZIP 1
# endif
#endif
char *tclExecutableName;
/*
* Attempt to load a "boot.tcl" entry from the embedded MetaKit file.
* If there isn't one, try to open a regular "setup.tcl" file instead.
* If that fails, this code will throw an error, using a message box.
*/
|
>
>
|
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
# ifdef KIT_INCLUDES_MK4TCL
# define KIT_STORAGE_MK4 1
# else
# define KIT_STORAGE_ZIP 1
# endif
#endif
#ifdef TCLKIT_REQUIRE_TCLEXECUTABLENAME
char *tclExecutableName;
#endif
/*
* Attempt to load a "boot.tcl" entry from the embedded MetaKit file.
* If there isn't one, try to open a regular "setup.tcl" file instead.
* If that fails, this code will throw an error, using a message box.
*/
|
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
|
"set argv0 [file join [info nameofexe] main.tcl]\n"
"} else continue\n";
/* SetExecName --
Hack to get around Tcl bug 1224888.
*/
void SetExecName(Tcl_Interp *interp) {
#if defined(HAVE_READLINK)
if (tclExecutableName == NULL) {
ssize_t readlink_ret;
char procpath[PATH_MAX + 1];
char exe_buf[PATH_MAX + 1];
int snprintf_ret;
snprintf_ret = snprintf(procpath, sizeof(procpath), "/proc/%lu/exe", (unsigned long) getpid());
if (snprintf_ret < sizeof(procpath)) {
readlink_ret = readlink(procpath, exe_buf, sizeof(exe_buf) - 1);
if (readlink_ret > 0 && readlink_ret < (sizeof(exe_buf) - 1)) {
exe_buf[readlink_ret] = '\0';
tclExecutableName = strdup(exe_buf);
return;
}
}
}
#endif
if (tclExecutableName == NULL) {
int len = 0;
Tcl_Obj *execNameObj;
Tcl_Obj *lobjv[1];
lobjv[0] = Tcl_GetVar2Ex(interp, "argv0", NULL, TCL_GLOBAL_ONLY);
execNameObj = Tcl_FSJoinToPath(Tcl_FSGetCwd(interp), 1, lobjv);
tclExecutableName = strdup(Tcl_GetStringFromObj(execNameObj, &len));
return;
}
return;
}
|
>
>
>
>
>
>
>
>
>
|
>
>
>
<
|
|
|
|
>
|
<
<
<
<
|
|
|
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
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
209
210
211
212
213
214
215
|
"set argv0 [file join [info nameofexe] main.tcl]\n"
"} else continue\n";
/* SetExecName --
Hack to get around Tcl bug 1224888.
*/
static void SetExecName(Tcl_Interp *interp, const char *path) {
#ifdef TCLKIT_REQUIRE_TCLEXECUTABLENAME
tclExecutableName = strdup(path);
#endif
Tcl_FindExecutable(path);
return;
}
static void FindAndSetExecName(Tcl_Interp *interp) {
int len = 0;
Tcl_Obj *execNameObj;
Tcl_Obj *lobjv[1];
#if defined(HAVE_READLINK)
ssize_t readlink_ret;
char procpath[PATH_MAX + 1];
char exe_buf[PATH_MAX + 1];
int snprintf_ret;
if (Tcl_GetNameOfExecutable() == NULL) {
snprintf_ret = snprintf(procpath, sizeof(procpath), "/proc/%lu/exe", (unsigned long) getpid());
if (snprintf_ret < sizeof(procpath)) {
readlink_ret = readlink(procpath, exe_buf, sizeof(exe_buf) - 1);
if (readlink_ret > 0 && readlink_ret < (sizeof(exe_buf) - 1)) {
exe_buf[readlink_ret] = '\0';
SetExecName(interp, exe_buf);
return;
}
}
}
#endif
if (Tcl_GetNameOfExecutable() == NULL) {
lobjv[0] = Tcl_GetVar2Ex(interp, "argv0", NULL, TCL_GLOBAL_ONLY);
execNameObj = Tcl_FSJoinToPath(Tcl_FSGetCwd(interp), 1, lobjv);
SetExecName(interp, Tcl_GetStringFromObj(execNameObj, &len));
return;
}
return;
}
|
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
|
Tcl_SetVar(interp, "tclkit_system_encoding", Tcl_DStringValue(&encodingName), 0);
Tcl_DStringFree(&encodingName);
#endif
/* Hack to get around Tcl bug 1224888. This must be run here and
* in LibraryPathObjCmd because this information is needed both
* before and after that command is run. */
SetExecName(interp);
TclSetPreInitScript(preInitCmd);
if (Tcl_Init(interp) == TCL_ERROR) {
goto error;
}
#ifdef KIT_INCLUDES_TK
|
|
|
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
|
Tcl_SetVar(interp, "tclkit_system_encoding", Tcl_DStringValue(&encodingName), 0);
Tcl_DStringFree(&encodingName);
#endif
/* Hack to get around Tcl bug 1224888. This must be run here and
* in LibraryPathObjCmd because this information is needed both
* before and after that command is run. */
FindAndSetExecName(interp);
TclSetPreInitScript(preInitCmd);
if (Tcl_Init(interp) == TCL_ERROR) {
goto error;
}
#ifdef KIT_INCLUDES_TK
|