425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
|
/*
* The Tcl_FindSymbol calls may have left a spurious error message in
* the interpreter result.
*/
Tcl_ResetResult(interp);
}
/*
* Invoke the package's initialization function (either the normal one or
* the safe one, depending on whether or not the interpreter is safe).
*/
if (Tcl_IsSafe(target)) {
if (pkgPtr->safeInitProc == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't use package in a safe interpreter: no"
" %s_SafeInit procedure", pkgPtr->packageName));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LOAD", "UNSAFE",
NULL);
code = TCL_ERROR;
goto done;
}
code = pkgPtr->safeInitProc(target);
} else {
if (pkgPtr->initProc == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't attach package to interpreter: no %s_Init procedure",
pkgPtr->packageName));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LOAD", "ENTRYPOINT",
NULL);
code = TCL_ERROR;
goto done;
}
code = pkgPtr->initProc(target);
}
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
|
/*
* The Tcl_FindSymbol calls may have left a spurious error message in
* the interpreter result.
*/
Tcl_ResetResult(interp);
} else {
Tcl_DStringAppend(&initName, pkgPtr->packageName, -1);
Tcl_DStringSetLength(&initName,
Tcl_UtfToTitle(Tcl_DStringValue(&initName)));
while (strchr(Tcl_DStringValue(&initName), ':') != NULL) {
char *r;
p = Tcl_DStringValue(&initName);
r = strchr((char *)p, ':');
if ((r != NULL) && (r[1] == ':')) {
memmove(r, r+2, strlen(r+1));
}
Tcl_DStringSetLength(&initName, strlen(p));
}
TclDStringAppendDString(&safeInitName, &initName);
TclDStringAppendLiteral(&safeInitName, "_SafeInit");
TclDStringAppendLiteral(&initName, "_Init");
}
/*
* Invoke the package's initialization function (either the normal one or
* the safe one, depending on whether or not the interpreter is safe).
*/
if (Tcl_IsSafe(target)) {
if (pkgPtr->safeInitProc == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't use package in a safe interpreter: no"
" %s procedure", Tcl_DStringValue(&safeInitName)));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LOAD", "UNSAFE",
NULL);
code = TCL_ERROR;
goto done;
}
code = pkgPtr->safeInitProc(target);
} else {
if (pkgPtr->initProc == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't attach package to interpreter: no %s procedure",
Tcl_DStringValue(&initName)));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LOAD", "ENTRYPOINT",
NULL);
code = TCL_ERROR;
goto done;
}
code = pkgPtr->initProc(target);
}
|