Posted to tcl by schelte at Wed Oct 25 11:06:26 GMT 2023view raw

  1. Index: src/htmlcmd.c
  2. ==================================================================
  3. --- src/htmlcmd.c
  4. +++ src/htmlcmd.c
  5. @@ -378,13 +378,15 @@
  6. ClientData clientData; /* The HTML widget */
  7. Tcl_Interp *interp; /* The interpreter */
  8. int argc; /* Number of arguments */
  9. const char **argv; /* List of all arguments */
  10. {
  11. + char buf[32];
  12. HtmlWidget *htmlPtr = (HtmlWidget *) clientData;
  13. if (argc == 2) {
  14. - HtmlComputeHorizontalPosition(htmlPtr, interp->result);
  15. + HtmlComputeHorizontalPosition(htmlPtr, buf);
  16. + Tcl_SetResult(interp, buf, TCL_VOLATILE);
  17. }
  18. else {
  19. int count;
  20. double fraction;
  21. int maxX = htmlPtr->maxX;
  22. @@ -434,12 +436,14 @@
  23. Tcl_Interp *interp; /* The interpreter */
  24. int argc; /* Number of arguments */
  25. const char **argv; /* List of all arguments */
  26. {
  27. HtmlWidget *htmlPtr = (HtmlWidget *) clientData;
  28. + char buf[32];
  29. if (argc == 2) {
  30. - HtmlComputeVerticalPosition(htmlPtr, interp->result);
  31. + HtmlComputeVerticalPosition(htmlPtr, buf);
  32. + Tcl_SetResult(interp, buf, TCL_VOLATILE);
  33. }
  34. else if (argc == 3) {
  35. HtmlElement *p = HtmlAttrElem(htmlPtr, "name", argv[2]);
  36. if (p && p->anchor.y == 0) {
  37. HtmlLock(htmlPtr);
  38. @@ -746,11 +750,11 @@
  39. Tcl_AppendResult(interp, "unknown tag: \"", argv[3], "\"", 0);
  40. return TCL_ERROR;
  41. }
  42. if (argc == 4) {
  43. if (htmlPtr->zHandler[type] != 0) {
  44. - interp->result = htmlPtr->zHandler[type];
  45. + Tcl_SetResult(interp, htmlPtr->zHandler[type], TCL_STATIC);
  46. }
  47. }
  48. else {
  49. if (htmlPtr->zHandler[type] != 0) {
  50. HtmlFree(htmlPtr->zHandler[type]);
  51. @@ -783,11 +787,11 @@
  52. Tcl_AppendResult(interp, "malformed index: \"", argv[2], "\"", 0);
  53. }
  54. return TCL_ERROR;
  55. }
  56. if (!HtmlUnlock(htmlPtr) && p) {
  57. - sprintf(interp->result, "%d.%d", HtmlTokenNumber(p), i);
  58. + Tcl_SetObjResult(interp, Tcl_ObjPrintf("%d.%d", HtmlTokenNumber(p), i));
  59. }
  60. else {
  61. }
  62. return TCL_OK;
  63. }
  64.  
  65. Index: src/htmlimage.c
  66. ==================================================================
  67. --- src/htmlimage.c
  68. +++ src/htmlimage.c
  69. @@ -307,11 +307,11 @@
  70. Tcl_DStringFree(&cmd);
  71. if (HtmlUnlock(htmlPtr)) {
  72. HtmlFree(zSrc);
  73. return 0;
  74. }
  75. - zImageName = htmlPtr->interp->result;
  76. + zImageName = Tcl_GetStringResult(htmlPtr->interp);
  77. lenSrc = strlen(zSrc);
  78. lenW = strlen(zWidth);
  79. lenH = strlen(zHeight);
  80. pImage = HtmlAlloc(sizeof(HtmlImage) + lenSrc + lenW + lenH + 3);
  81. memset(pImage, 0, sizeof(HtmlImage));
  82. @@ -324,11 +324,11 @@
  83. pImage->zHeight = &pImage->zWidth[lenW + 1];
  84. strcpy(pImage->zHeight, zHeight);
  85. pImage->w = 0;
  86. pImage->h = 0;
  87. if (result == TCL_OK) {
  88. - HtmlAddImages(htmlPtr, p, pImage, htmlPtr->interp->result, 0);
  89. + HtmlAddImages(htmlPtr, p, pImage, Tcl_GetStringResult(htmlPtr->interp), 0);
  90. }
  91. else {
  92. Tcl_AddErrorInfo(htmlPtr->interp,
  93. "\n (\"-imagecommand\" command executed by html widget)");
  94. Tcl_BackgroundError(htmlPtr->interp);
  95.  
  96. Index: src/htmlsizer.c
  97. ==================================================================
  98. --- src/htmlsizer.c
  99. +++ src/htmlsizer.c
  100. @@ -300,12 +300,12 @@
  101. return COLOR_Unvisited;
  102. }
  103. if (result != TCL_OK) {
  104. goto errorOut;
  105. }
  106. - result = Tcl_GetBoolean(htmlPtr->interp, htmlPtr->interp->result,
  107. - &isVisited);
  108. + result = Tcl_GetBoolean(htmlPtr->interp,
  109. + Tcl_GetStringResult(htmlPtr->interp), &isVisited);
  110. if (result != TCL_OK) {
  111. goto errorOut;
  112. }
  113. return isVisited ? COLOR_Visited : COLOR_Unvisited;
  114.  
  115. @@ -924,11 +924,11 @@
  116. htmlPtr->inParse--;
  117. Tcl_DStringFree(&cmd);
  118. if (HtmlUnlock(htmlPtr))
  119. return;
  120. resstr = Tcl_GetByteArrayObj(Tcl_GetObjResult
  121. - (htmlPtr->interp->result),
  122. + (htmlPtr->interp),
  123. &reslen);
  124. if (result == 0 && resstr && reslen) {
  125. HtmlElement *b2 = p->pNext, *b3, *ps, *e1 = p, *e2 =
  126. b2, *e3;
  127. if (e2)
  128. @@ -1218,11 +1218,11 @@
  129. htmlPtr->inParse--;
  130. Tcl_DStringFree(&cmd);
  131. if (HtmlUnlock(htmlPtr))
  132. return;
  133. if (result == TCL_OK)
  134. - HtmlSetImageBg(htmlPtr, htmlPtr->interp, htmlPtr->interp->result, p);
  135. + HtmlSetImageBg(htmlPtr, htmlPtr->interp, Tcl_GetStringResult(htmlPtr->interp), p);
  136. Tcl_ResetResult(htmlPtr->interp);
  137. #endif
  138. }
  139.  
  140. /*
  141.  
  142. Index: src/htmlurl.c
  143. ==================================================================
  144. --- src/htmlurl.c
  145. +++ src/htmlurl.c
  146. @@ -252,11 +252,11 @@
  147. return zNew;
  148. }
  149.  
  150. /*
  151. ** The input azSeries[] is a sequence of URIs. This command must
  152. -** resolve them all and put the result in the interp->result field
  153. +** resolve them all and put the result in the result value
  154. ** of the interpreter associated with the HTML widget. Return
  155. ** TCL_OK on success and TCL_ERROR if there is a failure.
  156. **
  157. ** This function can cause the HTML widget to be deleted or changed
  158. ** arbitrarily.
  159. @@ -427,12 +427,12 @@
  160. HtmlLock(htmlPtr);
  161. result = HtmlCallResolver(htmlPtr, azSeq);
  162. if (HtmlUnlock(htmlPtr))
  163. return 0;
  164. if (result == TCL_OK) {
  165. - zSrc = HtmlAlloc(strlen(htmlPtr->interp->result) + 1);
  166. + zSrc = HtmlAlloc(strlen(Tcl_GetStringResult(htmlPtr->interp)) + 1);
  167. if (zSrc)
  168. - strcpy(zSrc, htmlPtr->interp->result);
  169. + strcpy(zSrc, Tcl_GetStringResult(htmlPtr->interp));
  170. }
  171. Tcl_ResetResult(htmlPtr->interp);
  172. return zSrc;
  173. }
  174.  
  175. Index: src/htmlwidget.c
  176. ==================================================================
  177. --- src/htmlwidget.c
  178. +++ src/htmlwidget.c
  179. @@ -1488,11 +1488,11 @@
  180. Tcl_AddErrorInfo(htmlPtr->interp,
  181. "\n (-fontcommand callback of HTML widget)");
  182. Tcl_BackgroundError(htmlPtr->interp);
  183. }
  184. else {
  185. - sprintf(name, "%.100s", htmlPtr->interp->result);
  186. + sprintf(name, "%.100s", Tcl_GetStringResult(htmlPtr->interp));
  187. }
  188. Tcl_ResetResult(htmlPtr->interp);
  189. }
  190.  
  191. /*
  192. @@ -2290,13 +2290,13 @@
  193. }
  194.  
  195. Tcl_InitHashTable(&htmlPtr->tokenHash, TCL_STRING_KEYS);
  196. htmlPtr->tokenCnt = Html_TypeCount;
  197. #ifdef _TCLHTML_
  198. - interp->result = arg1;
  199. + Tcl_SetResult(interp, arg1, TCL_VOLATILE);
  200. #else
  201. - interp->result = Tk_PathName(htmlPtr->tkwin);
  202. + Tcl_SetResult(interp, Tk_PathName(htmlPtr->tkwin), TCL_VOLATILE);
  203. #endif
  204. return TCL_OK;
  205.  
  206. error:
  207. #ifndef _TCLHTML_
  208.  
  209.