home *** CD-ROM | disk | FTP | other *** search
/ Practical Programming in Tcl & Tk (4th Edition) / TCLBOOK4.BIN / mac / extensions / blt / blt2_4z_patch1.txt < prev    next >
Text File  |  2003-04-01  |  19KB  |  617 lines

  1. This patch fixes the following problems with BLT 2.4z
  2.  
  3.   1) BLT won't load into more than one interpreter.
  4.  
  5.   2) Hiding an element 
  6.      
  7.         .graph element configure "e0" -hide yes
  8.  
  9.     also hides the legend entry.
  10.  
  11. Apply this patch from the top of the blt2.4z source tree (i.e.
  12. the directory that contains "blt2.4z").
  13.  
  14.   --gah
  15.  
  16. diff -cr blt2.4z-old/src/bltGrAxis.c blt2.4z/src/bltGrAxis.c
  17. *** blt2.4z-old/src/bltGrAxis.c    2002-09-18 17:30:51.000000000 -0500
  18. --- blt2.4z/src/bltGrAxis.c    2002-12-02 22:39:26.000000000 -0600
  19. ***************
  20. *** 1424,1482 ****
  21.       double majorStep, minorStep;
  22.       int nMajor, nMinor;
  23.   
  24. !     min = (min != 0.0) ? log10(FABS(min)) : 0.0;
  25. !     max = (max != 0.0) ? log10(FABS(max)) : 1.0;
  26. !     tickMin = floor(min);
  27. !     tickMax = ceil(max);
  28. !     range = tickMax - tickMin;
  29. !     if (range > 10) {
  30. !     /* There are too many decades to display a major tick at every
  31. !      * decade.  Instead, treat the axis as a linear scale.  */
  32. !     range = NiceNum(range, 0);
  33. !     majorStep = NiceNum(range / DEF_NUM_TICKS, 1);
  34. !     tickMin = UFLOOR(tickMin, majorStep);
  35. !     tickMax = UCEIL(tickMax, majorStep);
  36. !     nMajor = (int)((tickMax - tickMin) / majorStep) + 1;
  37. !     minorStep = EXP10(floor(log10(majorStep)));
  38. !     if (minorStep == majorStep) {
  39. !         nMinor = 4, minorStep = 0.2;
  40.       } else {
  41. !         nMinor = Round(majorStep / minorStep) - 1;
  42. !     }
  43. !     } else {
  44. !     if (tickMin == tickMax) {
  45. !         tickMax++;
  46. !     }
  47. !     majorStep = 1.0;
  48. !     nMajor = (int)(tickMax - tickMin + 1); /* FIXME: Check this. */
  49. !     minorStep = 0.0;    /* This is a special hack to pass
  50.                    * information to the GenerateTicks
  51.                    * routine. An interval of 0.0 tells
  52.                    *    1) this is a minor sweep and 
  53.                    *    2) the axis is log scale.  
  54.                    */
  55. !     nMinor = 10;
  56. !     }
  57. !     if ((axisPtr->looseMin == TICK_RANGE_TIGHT) ||
  58. !     ((axisPtr->looseMin == TICK_RANGE_LOOSE) && 
  59. !      (DEFINED(axisPtr->reqMin)))) {
  60. !     tickMin = min;
  61. !     nMajor++;
  62. !     }
  63. !     if ((axisPtr->looseMax == TICK_RANGE_TIGHT) ||
  64. !     ((axisPtr->looseMax == TICK_RANGE_LOOSE) &&
  65. !      (DEFINED(axisPtr->reqMax)))) {
  66. !     tickMax = max;
  67.       }
  68.       axisPtr->majorSweep.step = majorStep;
  69.       axisPtr->majorSweep.initial = floor(tickMin);
  70.       axisPtr->majorSweep.nSteps = nMajor;
  71.       axisPtr->minorSweep.initial = axisPtr->minorSweep.step = minorStep;
  72.       axisPtr->minorSweep.nSteps = nMinor;
  73.       SetAxisRange(&axisPtr->axisRange, tickMin, tickMax);
  74.   }
  75.   
  76. --- 1424,1485 ----
  77.       double majorStep, minorStep;
  78.       int nMajor, nMinor;
  79.   
  80. !     nMajor = nMinor = 0;
  81. !     majorStep = minorStep = 0.0;
  82. !     if (min < max) {
  83. !     min = (min != 0.0) ? log10(FABS(min)) : 0.0;
  84. !     max = (max != 0.0) ? log10(FABS(max)) : 1.0;
  85. !     
  86. !     tickMin = floor(min);
  87. !     tickMax = ceil(max);
  88. !     range = tickMax - tickMin;
  89. !     
  90. !     if (range > 10) {
  91. !         /* There are too many decades to display a major tick at every
  92. !          * decade.  Instead, treat the axis as a linear scale.  */
  93. !         range = NiceNum(range, 0);
  94. !         majorStep = NiceNum(range / DEF_NUM_TICKS, 1);
  95. !         tickMin = UFLOOR(tickMin, majorStep);
  96. !         tickMax = UCEIL(tickMax, majorStep);
  97. !         nMajor = (int)((tickMax - tickMin) / majorStep) + 1;
  98. !         minorStep = EXP10(floor(log10(majorStep)));
  99. !         if (minorStep == majorStep) {
  100. !         nMinor = 4, minorStep = 0.2;
  101. !         } else {
  102. !         nMinor = Round(majorStep / minorStep) - 1;
  103. !         }
  104.       } else {
  105. !         if (tickMin == tickMax) {
  106. !         tickMax++;
  107. !         }
  108. !         majorStep = 1.0;
  109. !         nMajor = (int)(tickMax - tickMin + 1); /* FIXME: Check this. */
  110. !         
  111. !         minorStep = 0.0;    /* This is a special hack to pass
  112.                    * information to the GenerateTicks
  113.                    * routine. An interval of 0.0 tells
  114.                    *    1) this is a minor sweep and 
  115.                    *    2) the axis is log scale.  
  116.                    */
  117. !         nMinor = 10;
  118. !     }
  119. !     if ((axisPtr->looseMin == TICK_RANGE_TIGHT) ||
  120. !         ((axisPtr->looseMin == TICK_RANGE_LOOSE) && 
  121. !          (DEFINED(axisPtr->reqMin)))) {
  122. !         tickMin = min;
  123. !         nMajor++;
  124. !     }
  125. !     if ((axisPtr->looseMax == TICK_RANGE_TIGHT) ||
  126. !         ((axisPtr->looseMax == TICK_RANGE_LOOSE) &&
  127. !          (DEFINED(axisPtr->reqMax)))) {
  128. !         tickMax = max;
  129. !     }
  130.       }
  131.       axisPtr->majorSweep.step = majorStep;
  132.       axisPtr->majorSweep.initial = floor(tickMin);
  133.       axisPtr->majorSweep.nSteps = nMajor;
  134.       axisPtr->minorSweep.initial = axisPtr->minorSweep.step = minorStep;
  135.       axisPtr->minorSweep.nSteps = nMinor;
  136.       SetAxisRange(&axisPtr->axisRange, tickMin, tickMax);
  137.   }
  138.   
  139. ***************
  140. *** 1551,1581 ****
  141.       double axisMin, axisMax;
  142.       int nTicks;
  143.   
  144. !     range = max - min;
  145. !     /* Calculate the major tick stepping. */
  146. !     if (axisPtr->reqStep > 0.0) {
  147. !     /* An interval was designated by the user.  Keep scaling it
  148. !      * until it fits comfortably within the current range of the
  149. !      * axis.  */
  150. !     step = axisPtr->reqStep;
  151. !     while ((2 * step) >= range) {
  152. !         step *= 0.5;
  153.       }
  154. !     } else {
  155. !     range = NiceNum(range, 0);
  156. !     step = NiceNum(range / DEF_NUM_TICKS, 1);
  157.       }
  158. -     /* Find the outer tick values. Add 0.0 to prevent getting -0.0. */
  159. -     axisMin = tickMin = floor(min / step) * step + 0.0;
  160. -     axisMax = tickMax = ceil(max / step) * step + 0.0;
  161. -     nTicks = Round((tickMax - tickMin) / step) + 1;
  162.       axisPtr->majorSweep.step = step;
  163.       axisPtr->majorSweep.initial = tickMin;
  164.       axisPtr->majorSweep.nSteps = nTicks;
  165.       /*
  166.        * The limits of the axis are either the range of the data
  167.        * ("tight") or at the next outer tick interval ("loose").  The
  168. --- 1554,1588 ----
  169.       double axisMin, axisMax;
  170.       int nTicks;
  171.   
  172. !     nTicks = 0;
  173. !     tickMin = tickMax = 0.0;
  174. !     if (min < max) {
  175. !     range = max - min;
  176. !     
  177. !     /* Calculate the major tick stepping. */
  178. !     if (axisPtr->reqStep > 0.0) {
  179. !         /* An interval was designated by the user.  Keep scaling it
  180. !          * until it fits comfortably within the current range of the
  181. !          * axis.  */
  182. !         step = axisPtr->reqStep;
  183. !         while ((2 * step) >= range) {
  184. !         step *= 0.5;
  185. !         }
  186. !     } else {
  187. !         range = NiceNum(range, 0);
  188. !         step = NiceNum(range / DEF_NUM_TICKS, 1);
  189.       }
  190. !     
  191. !     /* Find the outer tick values. Add 0.0 to prevent getting -0.0. */
  192. !     axisMin = tickMin = floor(min / step) * step + 0.0;
  193. !     axisMax = tickMax = ceil(max / step) * step + 0.0;
  194. !     
  195. !     nTicks = Round((tickMax - tickMin) / step) + 1;
  196.       }
  197.       axisPtr->majorSweep.step = step;
  198.       axisPtr->majorSweep.initial = tickMin;
  199.       axisPtr->majorSweep.nSteps = nTicks;
  200. !     
  201.       /*
  202.        * The limits of the axis are either the range of the data
  203.        * ("tight") or at the next outer tick interval ("loose").  The
  204. ***************
  205. *** 1596,1604 ****
  206.       axisMax = max;
  207.       }
  208.       SetAxisRange(&axisPtr->axisRange, axisMin, axisMax);
  209.       /* Now calculate the minor tick step and number. */
  210.       if ((axisPtr->reqNumMinorTicks > 0) && 
  211.       ((axisPtr->flags & AXIS_CONFIG_MAJOR) == 0)) {
  212.       nTicks = axisPtr->reqNumMinorTicks - 1;
  213. --- 1603,1611 ----
  214.       axisMax = max;
  215.       }
  216.       SetAxisRange(&axisPtr->axisRange, axisMin, axisMax);
  217. !     
  218.       /* Now calculate the minor tick step and number. */
  219. !     
  220.       if ((axisPtr->reqNumMinorTicks > 0) && 
  221.       ((axisPtr->flags & AXIS_CONFIG_MAJOR) == 0)) {
  222.       nTicks = axisPtr->reqNumMinorTicks - 1;
  223. ***************
  224. *** 1614,1620 ****
  225.       axisPtr->minorSweep.nSteps = nTicks;
  226.   }
  227.   
  228.   static void
  229.   SweepTicks(axisPtr)
  230.       Axis *axisPtr;
  231. --- 1621,1626 ----
  232. ***************
  233. *** 1684,1692 ****
  234.       for (linkPtr = Blt_ChainFirstLink(graphPtr->elements.displayList);
  235.       linkPtr != NULL; linkPtr = Blt_ChainNextLink(linkPtr)) {
  236.       elemPtr = Blt_ChainGetValue(linkPtr);
  237. !     (*elemPtr->procsPtr->extentsProc) (elemPtr, &exts);
  238. !     GetDataLimits(elemPtr->axes.x, exts.left, exts.right);
  239. !     GetDataLimits(elemPtr->axes.y, exts.top, exts.bottom);
  240.       }
  241.       /*
  242.        * Step 3:  Now that we know the range of data values for each axis,
  243. --- 1690,1700 ----
  244.       for (linkPtr = Blt_ChainFirstLink(graphPtr->elements.displayList);
  245.       linkPtr != NULL; linkPtr = Blt_ChainNextLink(linkPtr)) {
  246.       elemPtr = Blt_ChainGetValue(linkPtr);
  247. !     if (!elemPtr->hidden) {
  248. !         (*elemPtr->procsPtr->extentsProc) (elemPtr, &exts);
  249. !         GetDataLimits(elemPtr->axes.x, exts.left, exts.right);
  250. !         GetDataLimits(elemPtr->axes.y, exts.top, exts.bottom);
  251. !     }
  252.       }
  253.       /*
  254.        * Step 3:  Now that we know the range of data values for each axis,
  255. diff -cr blt2.4z-old/src/bltGrElem.c blt2.4z/src/bltGrElem.c
  256. *** blt2.4z-old/src/bltGrElem.c    2002-09-18 17:30:51.000000000 -0500
  257. --- blt2.4z/src/bltGrElem.c    2002-12-02 22:42:31.000000000 -0600
  258. ***************
  259. *** 1215,1223 ****
  260.   {
  261.       int nNames;            /* Number of names found in Tcl name list */
  262.       char **nameArr;        /* Broken out array of element names */
  263. -     Blt_HashSearch cursor;
  264.       register int i;
  265. -     register Blt_HashEntry *hPtr;
  266.       Element *elemPtr;        /* Element information record */
  267.   
  268.       if (Tcl_SplitList(graphPtr->interp, newList, &nNames, &nameArr) != TCL_OK) {
  269. --- 1215,1221 ----
  270. ***************
  271. *** 1227,1243 ****
  272.       }
  273.       /* Clear the display list and mark all elements as hidden.  */
  274.       Blt_ChainReset(graphPtr->elements.displayList);
  275. -     for (hPtr = Blt_FirstHashEntry(&graphPtr->elements.table, &cursor);
  276. -     hPtr != NULL; hPtr = Blt_NextHashEntry(&cursor)) {
  277. -     elemPtr = (Element *)Blt_GetHashValue(hPtr);
  278. -     elemPtr->hidden = TRUE;
  279. -     }
  280.   
  281.       /* Rebuild the display list, checking that each name it exists
  282.        * (currently ignoring invalid element names).  */
  283.       for (i = 0; i < nNames; i++) {
  284.       if (NameToElement(graphPtr, nameArr[i], &elemPtr) == TCL_OK) {
  285. -         elemPtr->hidden = FALSE;
  286.           Blt_ChainAppend(graphPtr->elements.displayList, elemPtr);
  287.       }
  288.       }
  289. --- 1225,1235 ----
  290. ***************
  291. *** 1399,1406 ****
  292.           /* Comment the PostScript to indicate the start of the element */
  293.           Blt_FormatToPostScript(psToken, "\n%% Element \"%s\"\n\n", 
  294.           elemPtr->name);
  295. !         (*elemPtr->procsPtr->printNormalProc) (graphPtr, psToken, 
  296. !         elemPtr);
  297.       }
  298.       }
  299.   }
  300. --- 1391,1397 ----
  301.           /* Comment the PostScript to indicate the start of the element */
  302.           Blt_FormatToPostScript(psToken, "\n%% Element \"%s\"\n\n", 
  303.           elemPtr->name);
  304. !         (*elemPtr->procsPtr->printNormalProc) (graphPtr, psToken, elemPtr);
  305.       }
  306.       }
  307.   }
  308. ***************
  309. *** 1426,1433 ****
  310.       if ((!elemPtr->hidden) && (elemPtr->flags & ELEM_ACTIVE)) {
  311.           Blt_FormatToPostScript(psToken, "\n%% Active Element \"%s\"\n\n",
  312.           elemPtr->name);
  313. !         (*elemPtr->procsPtr->printActiveProc) (graphPtr, psToken, 
  314. !                            elemPtr);
  315.       }
  316.       }
  317.   }
  318. --- 1417,1423 ----
  319.       if ((!elemPtr->hidden) && (elemPtr->flags & ELEM_ACTIVE)) {
  320.           Blt_FormatToPostScript(psToken, "\n%% Active Element \"%s\"\n\n",
  321.           elemPtr->name);
  322. !         (*elemPtr->procsPtr->printActiveProc) (graphPtr, psToken, elemPtr);
  323.       }
  324.       }
  325.   }
  326. ***************
  327. *** 1671,1676 ****
  328. --- 1661,1667 ----
  329.       ClosestSearch search;
  330.       int i, x, y;
  331.       int flags = TCL_LEAVE_ERR_MSG;
  332. +     int found;
  333.   
  334.       if (graphPtr->flags & RESET_AXES) {
  335.       Blt_ResetAxes(graphPtr);
  336. ***************
  337. *** 1715,1727 ****
  338.       search.dist = (double)(search.halo + 1);
  339.   
  340.       if (i < argc) {
  341.       for ( /* empty */ ; i < argc; i++) {
  342.           if (NameToElement(graphPtr, argv[i], &elemPtr) != TCL_OK) {
  343.           return TCL_ERROR;    /* Can't find named element */
  344.           }
  345. !         if (elemPtr->hidden) {
  346.           Tcl_AppendResult(interp, "element \"", argv[i], "\" is hidden",
  347. !             (char *)NULL);
  348.           return TCL_ERROR;    /* Element isn't visible */
  349.           }
  350.           /* Check if the X or Y vectors have notifications pending */
  351. --- 1706,1728 ----
  352.       search.dist = (double)(search.halo + 1);
  353.   
  354.       if (i < argc) {
  355. +     Blt_ChainLink *linkPtr;
  356.       for ( /* empty */ ; i < argc; i++) {
  357.           if (NameToElement(graphPtr, argv[i], &elemPtr) != TCL_OK) {
  358.           return TCL_ERROR;    /* Can't find named element */
  359.           }
  360. !         found = FALSE;
  361. !         for (linkPtr = Blt_ChainFirstLink(graphPtr->elements.displayList);
  362. !          linkPtr == NULL; linkPtr = Blt_ChainNextLink(linkPtr)) {
  363. !         if (elemPtr == Blt_ChainGetValue(linkPtr)) {
  364. !             found = TRUE;
  365. !             break;
  366. !         }
  367. !         }
  368. !         if ((!found) || (elemPtr->hidden)) {
  369.           Tcl_AppendResult(interp, "element \"", argv[i], "\" is hidden",
  370. !             (char *)NULL);
  371.           return TCL_ERROR;    /* Element isn't visible */
  372.           }
  373.           /* Check if the X or Y vectors have notifications pending */
  374. ***************
  375. *** 1744,1759 ****
  376.       for (linkPtr = Blt_ChainLastLink(graphPtr->elements.displayList);
  377.           linkPtr != NULL; linkPtr = Blt_ChainPrevLink(linkPtr)) {
  378.           elemPtr = Blt_ChainGetValue(linkPtr);
  379.           /* Check if the X or Y vectors have notifications pending */
  380. !         if ((elemPtr->flags & MAP_ITEM) ||
  381.           (Blt_VectorNotifyPending(elemPtr->x.clientId)) ||
  382.           (Blt_VectorNotifyPending(elemPtr->y.clientId))) {
  383.           continue;
  384.           }
  385. !         if (!elemPtr->hidden) {
  386. !         (*elemPtr->procsPtr->closestProc) (graphPtr, elemPtr, &search);
  387. !         }
  388.       }
  389.   
  390.       }
  391. --- 1745,1758 ----
  392.       for (linkPtr = Blt_ChainLastLink(graphPtr->elements.displayList);
  393.           linkPtr != NULL; linkPtr = Blt_ChainPrevLink(linkPtr)) {
  394.           elemPtr = Blt_ChainGetValue(linkPtr);
  395.           /* Check if the X or Y vectors have notifications pending */
  396. !         if ((elemPtr->hidden) || 
  397. !         (elemPtr->flags & MAP_ITEM) ||
  398.           (Blt_VectorNotifyPending(elemPtr->x.clientId)) ||
  399.           (Blt_VectorNotifyPending(elemPtr->y.clientId))) {
  400.           continue;
  401.           }
  402. !         (*elemPtr->procsPtr->closestProc)(graphPtr, elemPtr, &search);
  403.       }
  404.   
  405.       }
  406. ***************
  407. *** 1859,1888 ****
  408.           return TCL_ERROR;    /* Failed to configure element */
  409.       }
  410.       if (Blt_ConfigModified(elemPtr->specsPtr, "-hide", (char *)NULL)) {
  411. -         Blt_ChainLink *linkPtr;
  412. -         for (linkPtr = Blt_ChainFirstLink(graphPtr->elements.displayList);
  413. -         linkPtr != NULL; linkPtr = Blt_ChainNextLink(linkPtr)) {
  414. -         if (elemPtr == Blt_ChainGetValue(linkPtr)) {
  415. -             break;
  416. -         }
  417. -         }
  418. -         if ((elemPtr->hidden) != (linkPtr == NULL)) {
  419. -         /* The element's "hidden" variable is out of sync with
  420. -          * the display list. [That's what you get for having
  421. -          * two ways to do the same thing.]  This affects what
  422. -          * elements are considered for axis ranges and
  423. -          * displayed in the legend. Update the display list by
  424. -          * either by adding or removing the element.  */
  425. -         if (linkPtr == NULL) {
  426. -             Blt_ChainPrepend(graphPtr->elements.displayList, elemPtr);
  427. -         } else {
  428. -             Blt_ChainDeleteLink(graphPtr->elements.displayList, 
  429. -                     linkPtr);
  430. -         }
  431. -         }
  432.           graphPtr->flags |= RESET_AXES;
  433.           elemPtr->flags |= MAP_ITEM;
  434.       }
  435. --- 1858,1863 ----
  436. diff -cr blt2.4z-old/src/bltInit.c blt2.4z/src/bltInit.c
  437. *** blt2.4z-old/src/bltInit.c    2002-09-10 00:12:33.000000000 -0500
  438. --- blt2.4z/src/bltInit.c    2002-12-02 22:25:33.000000000 -0600
  439. ***************
  440. *** 38,54 ****
  441.   #endif
  442.   #endif
  443.   
  444.   double bltNaN;
  445.   #if (TCL_MAJOR_VERSION > 7)
  446.   Tcl_Obj *bltEmptyStringObjPtr;
  447.   #endif
  448.   
  449.   static Tcl_MathProc MinMathProc, MaxMathProc;
  450. - static int tclLoaded = FALSE;
  451. - #ifndef TCL_ONLY
  452. - static int tkLoaded = FALSE;
  453. - #endif
  454.   static char libPath[1024] =
  455.   {
  456.       BLT_LIBRARY
  457. --- 38,53 ----
  458.   #endif
  459.   #endif
  460.   
  461. + #define BLT_THREAD_KEY        "BLT Initialized"
  462. + #define BLT_TCL_CMDS        (1<<0)
  463. + #define BLT_TK_CMDS        (1<<1)
  464.   double bltNaN;
  465.   #if (TCL_MAJOR_VERSION > 7)
  466.   Tcl_Obj *bltEmptyStringObjPtr;
  467.   #endif
  468.   
  469.   static Tcl_MathProc MinMathProc, MaxMathProc;
  470.   static char libPath[1024] =
  471.   {
  472.       BLT_LIBRARY
  473. ***************
  474. *** 404,410 ****
  475.   Blt_Init(interp)
  476.       Tcl_Interp *interp;        /* Interpreter to add extra commands */
  477.   {
  478. !     if (!tclLoaded) {
  479.       register Tcl_AppInitProc **p;
  480.       Tcl_Namespace *nsPtr;
  481.       Tcl_ValueType args[2];
  482. --- 403,412 ----
  483.   Blt_Init(interp)
  484.       Tcl_Interp *interp;        /* Interpreter to add extra commands */
  485.   {
  486. !     int flags;
  487. !     flags = (int)Tcl_GetAssocData(interp, BLT_THREAD_KEY, NULL);
  488. !     if ((flags & BLT_TCL_CMDS) == 0) {
  489.       register Tcl_AppInitProc **p;
  490.       Tcl_Namespace *nsPtr;
  491.       Tcl_ValueType args[2];
  492. ***************
  493. *** 451,460 ****
  494.       if (Tcl_PkgProvide(interp, "BLT", BLT_VERSION) != TCL_OK) {
  495.           return TCL_ERROR;
  496.       }
  497. !     tclLoaded = TRUE;
  498.       }
  499.   #ifndef TCL_ONLY
  500. !     if (!tkLoaded) {
  501.       register Tcl_AppInitProc **p;
  502.       Tcl_Namespace *nsPtr;
  503.   
  504. --- 453,463 ----
  505.       if (Tcl_PkgProvide(interp, "BLT", BLT_VERSION) != TCL_OK) {
  506.           return TCL_ERROR;
  507.       }
  508. !     Tcl_SetAssocData(interp, BLT_THREAD_KEY, NULL, 
  509. !         (ClientData)(flags | BLT_TCL_CMDS));
  510.       }
  511.   #ifndef TCL_ONLY
  512. !     if ((flags & BLT_TK_CMDS) == 0) {
  513.       register Tcl_AppInitProc **p;
  514.       Tcl_Namespace *nsPtr;
  515.   
  516. ***************
  517. *** 486,492 ****
  518.           }
  519.       }
  520.       Blt_InitEpsCanvasItem(interp);
  521. !     tkLoaded = TRUE;
  522.       }
  523.   #endif
  524.       return TCL_OK;
  525. --- 489,496 ----
  526.           }
  527.       }
  528.       Blt_InitEpsCanvasItem(interp);
  529. !     Tcl_SetAssocData(interp, BLT_THREAD_KEY, NULL, 
  530. !         (ClientData)(flags | BLT_TK_CMDS));
  531.       }
  532.   #endif
  533.       return TCL_OK;
  534. ***************
  535. *** 499,505 ****
  536.   Blt_Init(interp)
  537.       Tcl_Interp *interp;        /* Interpreter to add extra commands */
  538.   {
  539. !     if (!tclLoaded) {
  540.       register Tcl_AppInitProc **p;
  541.       Tcl_ValueType args[2];
  542.   
  543. --- 503,512 ----
  544.   Blt_Init(interp)
  545.       Tcl_Interp *interp;        /* Interpreter to add extra commands */
  546.   {
  547. !     int flags;
  548. !     flags = (int)Tcl_GetAssocData(interp, BLT_THREAD_KEY, NULL);
  549. !     if ((flags & BLT_TCL_CMDS) == 0) {
  550.       register Tcl_AppInitProc **p;
  551.       Tcl_ValueType args[2];
  552.   
  553. ***************
  554. *** 537,546 ****
  555.       if (Tcl_PkgProvide(interp, "BLT", BLT_VERSION) != TCL_OK) {
  556.           return TCL_ERROR;
  557.       }
  558. !     tclLoaded = TRUE;
  559.       }
  560.   #ifndef TCL_ONLY
  561. !     if (!tkLoaded) {
  562.       register Tcl_AppInitProc **p;
  563.   
  564.   #if (TCL_VERSION_NUMBER >= _VERSION(8,1,0)) 
  565. --- 544,554 ----
  566.       if (Tcl_PkgProvide(interp, "BLT", BLT_VERSION) != TCL_OK) {
  567.           return TCL_ERROR;
  568.       }
  569. !     Tcl_SetAssocData(interp, BLT_THREAD_KEY, NULL, 
  570. !         (ClientData)(flags | BLT_TCL_CMDS));
  571.       }
  572.   #ifndef TCL_ONLY
  573. !     if ((flags & BLT_TK_CMDS) == 0) {
  574.       register Tcl_AppInitProc **p;
  575.   
  576.   #if (TCL_VERSION_NUMBER >= _VERSION(8,1,0)) 
  577. ***************
  578. *** 560,566 ****
  579.           }
  580.       }
  581.       Blt_InitEpsCanvasItem(interp);
  582. !     tkLoaded = TRUE;
  583.       }
  584.   #endif
  585.       return TCL_OK;
  586. --- 568,575 ----
  587.           }
  588.       }
  589.       Blt_InitEpsCanvasItem(interp);
  590. !     Tcl_SetAssocData(interp, BLT_THREAD_KEY, NULL, 
  591. !         (ClientData)(flags | BLT_TK_CMDS));
  592.       }
  593.   #endif
  594.       return TCL_OK;
  595.  
  596.  
  597.