1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
|
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
|
tkCmds.c: (char *) NULL) == TCL_OK && interp->result[0] != '\0') {
tkCmds.c: if (interp->result[1] == '\0') {
tkCmds.c: if (interp->result[0] == '1') {
tkCmds.c: } else if (interp->result[0] == '0') {
tkCmds.c: if (interp->result[0] == 'd'
tkCmds.c: && strcmp(interp->result, "disabled") == 0) goto nofocus;
tkCmds.c: if (strstr(interp->result, "Key")) goto focus;
tkCmds.c: if (strstr(interp->result, "Focus")) goto focus;
tkCmds.c: if (strstr(interp->result, "Key")) goto focus;
tkCmds.c: if (strstr(interp->result, "Focus")) goto focus;
tkEvent.c: char *errorMsg; /* The error message (interp->result when
tkEvent.c: errPtr->errorMsg = (char *) ckalloc((unsigned) (strlen(interp->result)
tkEvent.c: strcpy(errPtr->errorMsg, interp->result);
tkEvent.c: if (strcmp(interp->result, "\"tkerror\" is an invalid command name or ambiguous abbreviation") == 0) {
tkEvent.c: fprintf(stderr, " Error in tkerror: %s\n", interp->result);
tkFrame.c: placeArgv[1], interp->result);
tkMain.c: fprintf(stderr, "%s\n", interp->result);
tkMain.c: fprintf(stderr, "%s\n", interp->result);
tkMain.c: fprintf(stderr, "%s\n", interp->result);
tkMain.c: Tcl_Write(errChannel, interp->result, -1);
tkMain.c: Tcl_Write(errChannel, interp->result, -1);
tkMain.c: Tcl_Write(errChannel, interp->result, -1);
tkMain.c: if (*interp->result != 0) {
tkMain.c: puts(interp->result);
tkMain.c: fprintf(stderr, "%s\n", interp->result);
tkText.c: TkTextPrintIndex(&index1, interp->result);
tkText.c: TkTextPrintIndex(&index, interp->result);
|
︙ | | |
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
|
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
|
-
+
-
-
+
+
-
+
|
if (! (winPtr->flags & CTK_DISPLAYED)) goto nofocus;
/*
* Check widget's -takefocus option.
*/
if (Tcl_VarEval(interp, Tk_PathName(winPtr), " cget -takefocus",
(char *) NULL) == TCL_OK && interp->result[0] != '\0') {
(char *) NULL) == TCL_OK && Tcl_GetStringResult(interp)[0] != '\0') {
/*
* Try to interpret option value as simple 1 or 0.
*/
if (interp->result[1] == '\0') {
if (interp->result[0] == '1') {
if (Tcl_GetStringResult(interp)[1] == '\0') {
if (Tcl_GetStringResult(interp)[0] == '1') {
goto focus;
} else if (interp->result[0] == '0') {
} else if (Tcl_GetStringResult(interp)[0] == '0') {
goto nofocus;
}
}
{
/*
* The -takefocus option is not 1 or 0, append window
|
︙ | | |
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
|
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
|
-
-
+
+
-
-
+
+
-
-
+
+
|
/*
* Check widget's -state option. If value is "disaabled",
* don't focus.
*/
if (Tcl_VarEval(interp, Tk_PathName(winPtr), " cget -state",
(char *) NULL) == TCL_OK) {
if (interp->result[0] == 'd'
&& strcmp(interp->result, "disabled") == 0) goto nofocus;
if (Tcl_GetStringResult(interp)[0] == 'd'
&& strcmp(Tcl_GetStringResult(interp), "disabled") == 0) goto nofocus;
}
/*
* Check if widget has any Keyboard related bindings (check
* individual widget tag and its class tag).
*/
if (Tcl_VarEval(interp, "bind ", Tk_PathName(winPtr), (char *) NULL)
!= TCL_OK) return TCL_ERROR;
if (strstr(interp->result, "Key")) goto focus;
if (strstr(interp->result, "Focus")) goto focus;
if (strstr(Tcl_GetStringResult(interp), "Key")) goto focus;
if (strstr(Tcl_GetStringResult(interp), "Focus")) goto focus;
if (Tcl_VarEval(interp, "bind ", Tk_Class(winPtr), (char *) NULL)
!= TCL_OK) return TCL_ERROR;
if (strstr(interp->result, "Key")) goto focus;
if (strstr(interp->result, "Focus")) goto focus;
if (strstr(Tcl_GetStringResult(interp), "Key")) goto focus;
if (strstr(Tcl_GetStringResult(interp), "Focus")) goto focus;
nofocus:
*flagPtr = 0;
return TCL_OK;
focus:
*flagPtr = 1;
|
︙ | | |
︙ | | |
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
-
+
|
if ((argc > 1) && (argv[1][0] != '-')) {
fileName = argv[1];
argc--;
argv++;
}
if (Tk_ParseArgv(interp, (Tk_Window) NULL, &argc, argv, argTable, 0)
!= TCL_OK) {
fprintf(stderr, "%s\n", interp->result);
fprintf(stderr, "%s\n", Tcl_GetStringResult(interp));
exit(1);
}
if (name == NULL) {
if (fileName != NULL) {
p = fileName;
} else {
p = argv[0];
|
︙ | | |
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
|
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
|
-
+
-
+
-
+
|
}
class = (char *) ckalloc((unsigned) (strlen(name) + 1));
strcpy(class, name);
class[0] = toupper((unsigned char) class[0]);
mainWindow = Tk_CreateMainWindow(interp, display, name, class);
ckfree(class);
if (mainWindow == NULL) {
fprintf(stderr, "%s\n", interp->result);
fprintf(stderr, "%s\n", Tcl_GetStringResult(interp));
exit(1);
}
/*
* Set the "tcl_interactive" variable.
*/
tty = isatty(0);
Tcl_SetVar(interp, "tcl_interactive",
((fileName == NULL) && tty) ? "1" : "0", TCL_GLOBAL_ONLY);
/*
* Set the geometry of the main window, if requested. Put the
* requested geometry into the "geometry" variable.
*/
if (geometry != NULL) {
Tcl_SetVar(interp, "geometry", geometry, TCL_GLOBAL_ONLY);
code = Tcl_VarEval(interp, "wm geometry . ", geometry, (char *) NULL);
if (code != TCL_OK) {
fprintf(stderr, "%s\n", interp->result);
fprintf(stderr, "%s\n", Tcl_GetStringResult(interp));
}
}
/*
* Invoke application-specific initialization.
*/
if ((*appInitProc)(interp) != TCL_OK) {
errChannel = Tcl_GetStdChannel(TCL_STDERR);
if (errChannel) {
Tcl_Write(errChannel,
"application-specific initialization failed: ", -1);
Tcl_Write(errChannel, interp->result, -1);
Tcl_Write(errChannel, Tcl_GetStringResult(interp), -1);
Tcl_Write(errChannel, "\n", 1);
}
goto error;
}
/*
|
︙ | | |
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
|
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
|
-
+
-
+
|
Tcl_DString buffer;
char *fullName;
fullName = Tcl_TranslateFileName(interp, fileName, &buffer);
if (fullName == NULL) {
errChannel = Tcl_GetStdChannel(TCL_STDERR);
if (errChannel) {
Tcl_Write(errChannel, interp->result, -1);
Tcl_Write(errChannel, Tcl_GetStringResult(interp), -1);
Tcl_Write(errChannel, "\n", 1);
}
} else {
/*
* NOTE: The following relies on O_RDONLY==0.
*/
chan = Tcl_OpenFileChannel(interp, fullName, "r", 0);
if (chan != (Tcl_Channel) NULL) {
Tcl_Close(NULL, chan);
if (Tcl_EvalFile(interp, fullName) != TCL_OK) {
errChannel = Tcl_GetStdChannel(TCL_STDERR);
if (errChannel) {
Tcl_Write(errChannel, interp->result, -1);
Tcl_Write(errChannel, Tcl_GetStringResult(interp), -1);
Tcl_Write(errChannel, "\n", 1);
}
}
}
}
Tcl_DStringFree(&buffer);
|
︙ | | |
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
|
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
|
-
+
-
+
|
* command being evaluated.
*/
Tcl_CreateFileHandler(chan, 0, StdinProc, (ClientData) chan);
code = Tcl_RecordAndEval(interp, cmd, TCL_EVAL_GLOBAL);
Tcl_CreateChannelHandler(chan, TCL_READABLE, StdinProc, (ClientData) chan);
Tcl_DStringFree(&command);
if (*interp->result != 0) {
if (*(Tcl_GetStringResult(interp)) != 0) {
if ((code != TCL_OK) || (tty)) {
/*
* The statement below used to call "printf", but that resulted
* in core dumps under Solaris 2.3 if the result was very long.
*
* NOTE: This probably will not work under Windows either.
*/
puts(interp->result);
puts(Tcl_GetStringResult(interp));
}
}
/*
* Output a prompt.
*/
|
︙ | | |
499
500
501
502
503
504
505
506
507
508
509
510
511
|
499
500
501
502
503
504
505
506
507
508
509
510
511
|
-
+
|
fputs("% ", stdout);
}
} else {
code = Tcl_Eval(interp, promptCmd);
if (code != TCL_OK) {
Tcl_AddErrorInfo(interp,
"\n (script that generates prompt)");
fprintf(stderr, "%s\n", interp->result);
fprintf(stderr, "%s\n", Tcl_GetStringResult(interp));
goto defaultPrompt;
}
}
fflush(stdout);
}
|
︙ | | |
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
|
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
|
-
+
|
result = TCL_ERROR;
goto done;
}
if (TkTextGetIndex(interp, textPtr, argv[2], &index1) != TCL_OK) {
result = TCL_ERROR;
goto done;
}
TkTextPrintIndex(&index1, interp->result);
TkTextPrintIndex(&index1, Tcl_GetStringResult(interp));
} else if ((c == 'i') && (strncmp(argv[1], "insert", length) == 0)
&& (length >= 3)) {
int i, j, numTags;
char **tagNames;
TkTextTag **oldTagArrayPtr;
if (argc < 4) {
|
︙ | | |
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
|
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
|
-
+
|
sprintf(buffer, "%d", matchLength);
if (Tcl_SetVar(interp, varName, buffer, TCL_LEAVE_ERR_MSG)
== NULL) {
code = TCL_ERROR;
goto done;
}
}
TkTextPrintIndex(&index, interp->result);
TkTextPrintIndex(&index, Tcl_GetStringResult(interp));
goto done;
}
/*
* Go to the next (or previous) line;
*/
|
︙ | | |