summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey M. Lipaev <heliumflash@mail.ru>2019-06-29 07:59:18 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2019-06-29 07:59:18 +0700
commit377171575bcf191c26a95869e11ff1d4af2d0900 (patch)
treee14f774ddd60bf1245b259775ee13aae1955ee4e
parent96762179b68beac5a71a6657db96796a585d3c34 (diff)
downloadslackbuilds-377171575bcf191c26a95869e11ff1d4af2d0900.tar.gz
graphics/tclblt: Added (Tcl/Tk Extension).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
-rw-r--r--graphics/tclblt/README3
-rw-r--r--graphics/tclblt/patches/02-debian-all.patch99
-rw-r--r--graphics/tclblt/patches/03-fedora-patch-2.patch43
-rw-r--r--graphics/tclblt/patches/04-fedora-tk8.5.6.patch823
-rw-r--r--graphics/tclblt/patches/05-tk8.5-zoomstack.patch38
-rw-r--r--graphics/tclblt/patches/autoreconf.patch41
-rw-r--r--graphics/tclblt/patches/blthash.patch16
-rw-r--r--graphics/tclblt/patches/bltnsutil.patch24
-rw-r--r--graphics/tclblt/patches/const.patch890
-rw-r--r--graphics/tclblt/patches/decls.patch42
-rw-r--r--graphics/tclblt/patches/doc-typos.patch407
-rw-r--r--graphics/tclblt/patches/install.patch166
-rw-r--r--graphics/tclblt/patches/ldflags.patch54
-rw-r--r--graphics/tclblt/patches/pkgindex.patch108
-rw-r--r--graphics/tclblt/patches/pointertoint.patch498
-rw-r--r--graphics/tclblt/patches/series22
-rw-r--r--graphics/tclblt/patches/source.patch85
-rw-r--r--graphics/tclblt/patches/switch.patch15
-rw-r--r--graphics/tclblt/patches/table.patch123
-rw-r--r--graphics/tclblt/patches/tcl8.6.patch91
-rw-r--r--graphics/tclblt/patches/tk8.6.patch29
-rw-r--r--graphics/tclblt/patches/uninitialized.patch278
-rw-r--r--graphics/tclblt/patches/unused.patch899
-rw-r--r--graphics/tclblt/patches/usetclint.patch26
-rw-r--r--graphics/tclblt/patches/usetkint.patch1409
-rw-r--r--graphics/tclblt/slack-desc19
-rw-r--r--graphics/tclblt/tclblt.SlackBuild141
-rw-r--r--graphics/tclblt/tclblt.info10
28 files changed, 6399 insertions, 0 deletions
diff --git a/graphics/tclblt/README b/graphics/tclblt/README
new file mode 100644
index 0000000000..4b9e6b8fe0
--- /dev/null
+++ b/graphics/tclblt/README
@@ -0,0 +1,3 @@
+Tcl BLT is an extension to Tcl/Tk. It adds plotting widgets (X-Y graph,
+barchart, stripchart), a powerful geometry manager, a new canvas
+item, and several new commands to Tk.
diff --git a/graphics/tclblt/patches/02-debian-all.patch b/graphics/tclblt/patches/02-debian-all.patch
new file mode 100644
index 0000000000..73a7ecfcce
--- /dev/null
+++ b/graphics/tclblt/patches/02-debian-all.patch
@@ -0,0 +1,99 @@
+Description: Remaining unsplit changes from previous packager
+ Includes the rest of the changes that were applied to the source code by
+ previous packager.
+Author: Paul E. Johnson (Debian Packaging) <pauljohn32@freefaculty.org>
+
+--- a/configure.in
++++ b/configure.in
+@@ -349,7 +349,7 @@
+ old_flags="$CFLAGS"
+ CFLAGS="-g -lm"
+ AC_MSG_CHECKING([whether DBL_EPSILON can be computed])
+- AC_TRY_RUN_WITH_OUTPUT(blt_cv_dbl_epsilon, [
++ AC_TRY_RUN_WITH_OUTPUT([blt_cv_dbl_epsilon], [
+ main () {
+ double e, u;
+ /*
+--- a/generic/bltTree.c
++++ b/generic/bltTree.c
+@@ -114,16 +114,18 @@
+
+ #define REBUILD_MULTIPLIER 3
+
+-#define START_LOGSIZE 5 /* Initial hash table size is 32. */
+-#define MAX_LIST_VALUES 21 /* Convert to hash table when node
+- * value list gets bigger than this
+- * many values. */
+-
+ #if (SIZEOF_VOID_P == 8)
+ #define RANDOM_INDEX(i) HashOneWord(mask, downshift, i)
+ #define BITSPERWORD 64
++#define START_LOGSIZE 10
++#define MAX_LIST_VALUES 40
+ #else
+
++#define START_LOGSIZE 5 /* Initial hash table size is 32. */
++#define MAX_LIST_VALUES 21 /* Convert to hash table when node
++ * value list gets bigger than this
++ * many values. */
++
+ /*
+ * The following macro takes a preliminary integer hash value and
+ * produces an index into a hash tables bucket list. The idea is
+--- a/generic/bltText.c
++++ b/generic/bltText.c
+@@ -881,6 +881,9 @@
+ Pixmap bitmap;
+ int active;
+
++ if (!textPtr)
++ return;
++
+ display = Tk_Display(tkwin);
+ theta = FMOD(tsPtr->theta, (double)360.0);
+ if (theta < 0.0) {
+--- a/generic/bltNsUtil.h
++++ b/generic/bltNsUtil.h
+@@ -54,7 +54,7 @@
+ #ifndef WIN32
+ #if 0
+ EXTERN Tcl_Command Tcl_FindCommand _ANSI_ARGS_((Tcl_Interp *interp,
+- char *name, Tcl_Namespace *nsPtr, int flags));
++ CONST char *name, Tcl_Namespace *nsPtr, int flags));
+
+
+ /*
+@@ -66,15 +66,15 @@
+
+ #if (TCL_MAJOR_VERSION >= 8)
+ EXTERN Tcl_Namespace *Tcl_CreateNamespace _ANSI_ARGS_((Tcl_Interp *interp,
+- char *name, ClientData clientData, Tcl_NamespaceDeleteProc *nsDelProc));
++ CONST char *name, ClientData clientData, Tcl_NamespaceDeleteProc *nsDelProc));
+
+ EXTERN void Tcl_DeleteNamespace _ANSI_ARGS_((Tcl_Namespace *nsPtr));
+
+ EXTERN Tcl_Namespace *Tcl_FindNamespace _ANSI_ARGS_((Tcl_Interp *interp,
+- char *name, Tcl_Namespace *context, int flags));
++ CONST char *name, Tcl_Namespace *context, int flags));
+
+ EXTERN int Tcl_Export _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Namespace *nsPtr,
+- char *name, int resetFlag));
++ CONST char *name, int resetFlag));
+
+ EXTERN Tcl_Var Tcl_FindNamespaceVar _ANSI_ARGS_((Tcl_Interp *interp, char *name,
+ Tcl_Namespace *contextNsPtr, int flags));
+--- a/demos/scripts/page.tcl
++++ b/demos/scripts/page.tcl
+@@ -1,4 +1,4 @@
+-#!/usr/local/bin/tclsh
++#!/usr/bin/tclsh8.6
+
+ array set page "
+ rows 2
+--- a/demos/scripts/xcolors.tcl
++++ b/demos/scripts/xcolors.tcl
+@@ -1,3 +1,4 @@
++#
+ #!../bltwish
+ #
+ # Tk version of xcolors
diff --git a/graphics/tclblt/patches/03-fedora-patch-2.patch b/graphics/tclblt/patches/03-fedora-patch-2.patch
new file mode 100644
index 0000000000..cc79cb5175
--- /dev/null
+++ b/graphics/tclblt/patches/03-fedora-patch-2.patch
@@ -0,0 +1,43 @@
+ * Apply 3 changes based on revisions developed by the fedora linux team.
+ --> + 03-fedora-patch-2.diff
+ + 04-fedora-tk8.5.6.patch.diff
+ + 05-tk8.5-zoomstack.diff
+ * Those patches are required to solve segmentation faults that are observed
+ when blt is used with tcltk 8.5. We have a substantial amount of
+ experience using this patched version of blt in the Swarm
+ Simulation System (www.swarm.org) and have observed no ill-effects.
+Author: Paul E. Johnson (Debian Packaging) <pauljohn32@freefaculty.org>
+
+--- a/generic/bltGrElem.c
++++ b/generic/bltGrElem.c
+@@ -1664,6 +1664,7 @@
+ ClosestSearch search;
+ int i, x, y;
+ int flags = TCL_LEAVE_ERR_MSG;
++ int found;
+
+ if (graphPtr->flags & RESET_AXES) {
+ Blt_ResetAxes(graphPtr);
+@@ -1708,12 +1709,21 @@
+ search.dist = (double)(search.halo + 1);
+
+ if (i < argc) {
++ Blt_ChainLink *linkPtr;
+
+ for ( /* empty */ ; i < argc; i++) {
+ if (NameToElement(graphPtr, argv[i], &elemPtr) != TCL_OK) {
+ return TCL_ERROR; /* Can't find named element */
+ }
+- if (elemPtr->hidden) {
++ found = FALSE;
++ for (linkPtr = Blt_ChainFirstLink(graphPtr->elements.displayList);
++ linkPtr == NULL; linkPtr = Blt_ChainNextLink(linkPtr)) {
++ if (elemPtr == Blt_ChainGetValue(linkPtr)) {
++ found = TRUE;
++ break;
++ }
++ }
++ if ((!found) || (elemPtr->hidden)) {
+ Tcl_AppendResult(interp, "element \"", argv[i],
+ "\" is hidden", (char *)NULL);
+ return TCL_ERROR; /* Element isn't visible */
diff --git a/graphics/tclblt/patches/04-fedora-tk8.5.6.patch b/graphics/tclblt/patches/04-fedora-tk8.5.6.patch
new file mode 100644
index 0000000000..537c1fb3b9
--- /dev/null
+++ b/graphics/tclblt/patches/04-fedora-tk8.5.6.patch
@@ -0,0 +1,823 @@
+ * Apply 3 changes based on revisions developed by the fedora linux team.
+ + 03-fedora-patch-2.diff
+ --> + 04-fedora-tk8.5.6.patch.diff
+ + 05-tk8.5-zoomstack.diff
+ * Those patches are required to solve segmentation faults that are observed
+ when blt is used with tcltk 8.5. We have a substantial amount of
+ experience using this patched version of blt in the Swarm
+ Simulation System (www.swarm.org) and have observed no ill-effects.
+Author: Paul E. Johnson (Debian Packaging) <pauljohn32@freefaculty.org>
+
+--- a/generic/bltTreeViewEdit.c
++++ b/generic/bltTreeViewEdit.c
+@@ -1177,9 +1177,15 @@
+ rightPos = count;
+ if ((rightPos < tbPtr->selFirst) || (leftPos > tbPtr->selLast)) {
+ /* No part of the text fragment is selected. */
++#ifdef TK_DRAWCHARS_ANGLE
++ Tk_DrawChars(tbPtr->display, drawable, tbPtr->gc,
++ tbPtr->font, fragPtr->text, fragPtr->count,
++ x + fragPtr->x, y + fragPtr->y, 0.);
++#else
+ Tk_DrawChars(tbPtr->display, drawable, tbPtr->gc,
+ tbPtr->font, fragPtr->text, fragPtr->count,
+ x + fragPtr->x, y + fragPtr->y);
++#endif
+ continue;
+ }
+
+@@ -1221,9 +1227,15 @@
+ width, fontMetrics.linespace,
+ tbPtr->selBorderWidth, tbPtr->selRelief);
+ }
++#ifdef TK_DRAWCHARS_ANGLE
++ Tk_DrawChars(Tk_Display(tbPtr->tkwin), drawable, tbPtr->gc,
++ tbPtr->font, fragPtr->text, fragPtr->count,
++ fragPtr->x + x, fragPtr->y + y, 0.);
++#else
+ Tk_DrawChars(Tk_Display(tbPtr->tkwin), drawable, tbPtr->gc,
+ tbPtr->font, fragPtr->text, fragPtr->count,
+ fragPtr->x + x, fragPtr->y + y);
++#endif
+ }
+ if ((tbPtr->flags & TEXTBOX_FOCUS) && (tbPtr->cursorOn)) {
+ int left, top, right, bottom;
+--- a/generic/bltGrPs.c
++++ b/generic/bltGrPs.c
+@@ -418,7 +418,7 @@
+ return Tk_ConfigureInfo(interp, graphPtr->tkwin, configSpecs,
+ (char *)psPtr, argv[3], flags);
+ }
+- if (Tk_ConfigureWidget(interp, graphPtr->tkwin, configSpecs, argc - 3,
++ if (Blt_ConfigureWidget(interp, graphPtr->tkwin, configSpecs, argc - 3,
+ argv + 3, (char *)psPtr, flags) != TCL_OK) {
+ return TCL_ERROR;
+ }
+@@ -1124,7 +1124,7 @@
+ fileName = argv[3]; /* First argument is the file name. */
+ argv++, argc--;
+ }
+- if (Tk_ConfigureWidget(interp, graphPtr->tkwin, configSpecs, argc - 3,
++ if (Blt_ConfigureWidget(interp, graphPtr->tkwin, configSpecs, argc - 3,
+ argv + 3, (char *)psPtr, TK_CONFIG_ARGV_ONLY) != TCL_OK) {
+ return TCL_ERROR;
+ }
+--- a/generic/bltGrPen.c
++++ b/generic/bltGrPen.c
+@@ -215,7 +215,7 @@
+ Tcl_FreeProc **freeProcPtr; /* Not used. */
+ {
+ Pen *penPtr = *(Pen **)(widgRec + offset);
+-
++ if ( ! penPtr ) return NULL;
+ return penPtr->name;
+ }
+
+@@ -510,7 +510,7 @@
+ return Tk_ConfigureInfo(interp, graphPtr->tkwin,
+ penPtr->configSpecs, (char *)penPtr, options[0], flags);
+ }
+- if (Tk_ConfigureWidget(interp, graphPtr->tkwin, penPtr->configSpecs,
++ if (Blt_ConfigureWidget(interp, graphPtr->tkwin, penPtr->configSpecs,
+ nOpts, options, (char *)penPtr, flags) != TCL_OK) {
+ break;
+ }
+--- a/generic/bltGrHairs.c
++++ b/generic/bltGrHairs.c
+@@ -390,7 +390,7 @@
+ return Tk_ConfigureInfo(interp, graphPtr->tkwin, configSpecs,
+ (char *)chPtr, argv[3], 0);
+ }
+- if (Tk_ConfigureWidget(interp, graphPtr->tkwin, configSpecs, argc - 3,
++ if (Blt_ConfigureWidget(interp, graphPtr->tkwin, configSpecs, argc - 3,
+ argv + 3, (char *)chPtr, TK_CONFIG_ARGV_ONLY) != TCL_OK) {
+ return TCL_ERROR;
+ }
+--- a/generic/bltGraph.c
++++ b/generic/bltGraph.c
+@@ -944,7 +944,7 @@
+ if (InitPens(graphPtr) != TCL_OK) {
+ goto error;
+ }
+- if (Tk_ConfigureWidget(interp, tkwin, configSpecs, argc - 2, argv + 2,
++ if (Blt_ConfigureWidget(interp, tkwin, configSpecs, argc - 2, argv + 2,
+ (char *)graphPtr, 0) != TCL_OK) {
+ goto error;
+ }
+@@ -1094,7 +1094,7 @@
+ return Tk_ConfigureInfo(interp, graphPtr->tkwin, configSpecs,
+ (char *)graphPtr, argv[2], flags);
+ } else {
+- if (Tk_ConfigureWidget(interp, graphPtr->tkwin, configSpecs, argc - 2,
++ if (Blt_ConfigureWidget(interp, graphPtr->tkwin, configSpecs, argc - 2,
+ argv + 2, (char *)graphPtr, flags) != TCL_OK) {
+ return TCL_ERROR;
+ }
+--- a/generic/bltUnixDnd.c
++++ b/generic/bltUnixDnd.c
+@@ -1834,7 +1834,7 @@
+ unsigned long gcMask;
+
+ Tk_MakeWindowExist(tokenPtr->tkwin);
+- if (Tk_ConfigureWidget(interp, tokenPtr->tkwin, tokenConfigSpecs, argc,
++ if (Blt_ConfigureWidget(interp, tokenPtr->tkwin, tokenConfigSpecs, argc,
+ argv, (char *)tokenPtr, flags) != TCL_OK) {
+ return TCL_ERROR;
+ }
+@@ -3777,7 +3777,7 @@
+ return Tk_ConfigureInfo(interp, dndPtr->tkwin, configSpecs,
+ (char *)dndPtr, argv[3], flags);
+ }
+- if (Tk_ConfigureWidget(interp, dndPtr->tkwin, configSpecs, argc - 3,
++ if (Blt_ConfigureWidget(interp, dndPtr->tkwin, configSpecs, argc - 3,
+ argv + 3, (char *)dndPtr, flags) != TCL_OK) {
+ return TCL_ERROR;
+ }
+@@ -4440,7 +4440,7 @@
+ dndPtr->hashPtr = hPtr;
+ dndPtr->dataPtr = dataPtr;
+ Blt_SetHashValue(hPtr, dndPtr);
+- if (Tk_ConfigureWidget(interp, dndPtr->tkwin, configSpecs, argc - 3,
++ if (Blt_ConfigureWidget(interp, dndPtr->tkwin, configSpecs, argc - 3,
+ argv + 3, (char *)dndPtr, 0) != TCL_OK) {
+ return TCL_ERROR;
+ }
+--- a/generic/bltCanvEps.c
++++ b/generic/bltCanvEps.c
+@@ -1147,7 +1147,7 @@
+ int width, height;
+
+ tkwin = Tk_CanvasTkwin(canvas);
+- if (Tk_ConfigureWidget(interp, tkwin, configSpecs, argc,
++ if (Blt_ConfigureWidget(interp, tkwin, configSpecs, argc,
+ argv, (char *)epsPtr, flags) != TCL_OK) {
+ return TCL_ERROR;
+ }
+@@ -1974,10 +1974,10 @@
+ {
+ "eps", /* name */
+ sizeof(EpsItem), /* itemSize */
+- CreateEps, /* createProc */
++ (Tk_ItemCreateProc *)CreateEps, /* createProc */
+ configSpecs, /* configSpecs */
+- ConfigureEps, /* configureProc */
+- EpsCoords, /* coordProc */
++ (Tk_ItemConfigureProc *)ConfigureEps, /* configureProc */
++ (Tk_ItemCoordProc *)EpsCoords, /* coordProc */
+ DeleteEps, /* deleteProc */
+ DisplayEps, /* displayProc */
+ #ifdef USE_OLD_CANVAS
+@@ -2005,6 +2005,6 @@
+ {
+ Tk_CreateItemType(&epsItemType);
+ /* Initialize custom canvas option routines. */
+- tagsOption.parseProc = Tk_CanvasTagsParseProc;
+- tagsOption.printProc = Tk_CanvasTagsPrintProc;
++ tagsOption.parseProc = (Tk_OptionParseProc *)Tk_CanvasTagsParseProc;
++ tagsOption.printProc = (Tk_OptionPrintProc *)Tk_CanvasTagsPrintProc;
+ }
+--- a/generic/bltScrollbar.c
++++ b/generic/bltScrollbar.c
+@@ -913,7 +913,7 @@
+ GC new;
+ Tk_Image image;
+
+- if (Tk_ConfigureWidget(interp, scrollPtr->tkwin, configSpecs,
++ if (Blt_ConfigureWidget(interp, scrollPtr->tkwin, configSpecs,
+ argc, argv, (char *)scrollPtr, flags) != TCL_OK) {
+ return TCL_ERROR;
+ }
+--- a/generic/bltTreeViewStyle.c
++++ b/generic/bltTreeViewStyle.c
+@@ -560,6 +560,11 @@
+ }
+
+ /*ARGSUSED*/
++
++int
++Blt_TreeViewTextbox(TreeView *tvPtr,
++ TreeViewEntry *entryPtr,
++ TreeViewColumn *columnPtr);
+ static int
+ FreeIcon(clientData, display, widgRec, offset, oldPtr)
+ ClientData clientData;
+--- a/generic/bltDragdrop.c
++++ b/generic/bltDragdrop.c
+@@ -1065,7 +1065,7 @@
+ Token *tokenPtr;
+
+ tokenPtr = &(srcPtr->token);
+- if (Tk_ConfigureWidget(interp, srcPtr->tkwin, tokenConfigSpecs, argc, argv,
++ if (Blt_ConfigureWidget(interp, srcPtr->tkwin, tokenConfigSpecs, argc, argv,
+ (char *)tokenPtr, TK_CONFIG_ARGV_ONLY) != TCL_OK) {
+ return TCL_ERROR;
+ }
+@@ -1293,7 +1293,7 @@
+ /*
+ * Handle the bulk of the options...
+ */
+- if (Tk_ConfigureWidget(interp, srcPtr->tkwin, configSpecs, argc, argv,
++ if (Blt_ConfigureWidget(interp, srcPtr->tkwin, configSpecs, argc, argv,
+ (char *)srcPtr, flags) != TCL_OK) {
+ return TCL_ERROR;
+ }
+--- a/generic/bltAlloc.c
++++ b/generic/bltAlloc.c
+@@ -40,14 +40,23 @@
+ * Tcl_Alloc/Tcl_Free routines because they don't automatically cause
+ * a panic when not enough memory is available. There are cases (such
+ * as allocating a very large vector) where it's recoverable.
++ *
++ * Using private is dangerous.
++ * Tcl changes mem functions for debug which will conflict then with BLT
++ * stick to public API
+ */
+-EXTERN Blt_MallocProc TclpAlloc;
+-EXTERN Blt_FreeProc TclpFree;
+-EXTERN Blt_ReallocProc TclpRealloc;
++//EXTERN Blt_MallocProc TclpAlloc;
++//EXTERN Blt_FreeProc TclpFree;
++//EXTERN Blt_ReallocProc TclpRealloc;
++
++//Blt_MallocProc *Blt_MallocProcPtr = TclpAlloc;
++//Blt_FreeProc *Blt_FreeProcPtr = TclpFree;
++//Blt_ReallocProc *Blt_ReallocProcPtr = TclpRealloc;
++
++Blt_MallocProc *Blt_MallocProcPtr = (Blt_MallocProc *)Tcl_Alloc;
++Blt_FreeProc *Blt_FreeProcPtr = (Blt_FreeProc *)Tcl_Free;
++Blt_ReallocProc *Blt_ReallocProcPtr = (Blt_ReallocProc *)Tcl_Realloc;
+
+-Blt_MallocProc *Blt_MallocProcPtr = TclpAlloc;
+-Blt_FreeProc *Blt_FreeProcPtr = TclpFree;
+-Blt_ReallocProc *Blt_ReallocProcPtr = TclpRealloc;
+ #else
+
+ Blt_MallocProc *Blt_MallocProcPtr = malloc;
+--- a/generic/bltGrLegd.c
++++ b/generic/bltGrLegd.c
+@@ -1406,7 +1406,7 @@
+ return Tk_ConfigureInfo(interp, graphPtr->tkwin, configSpecs,
+ (char *)legendPtr, argv[3], flags);
+ }
+- if (Tk_ConfigureWidget(interp, graphPtr->tkwin, configSpecs, argc - 3,
++ if (Blt_ConfigureWidget(interp, graphPtr->tkwin, configSpecs, argc - 3,
+ argv + 3, (char *)legendPtr, flags) != TCL_OK) {
+ return TCL_ERROR;
+ }
+--- a/generic/bltHierbox.c
++++ b/generic/bltHierbox.c
+@@ -3321,7 +3321,7 @@
+ XColor *colorPtr;
+
+ hierBox = hboxPtr;
+- if (Tk_ConfigureWidget(hboxPtr->interp, hboxPtr->tkwin, entryConfigSpecs,
++ if (Blt_ConfigureWidget(hboxPtr->interp, hboxPtr->tkwin, entryConfigSpecs,
+ argc, argv, (char *)entryPtr, flags) != TCL_OK) {
+ return TCL_ERROR;
+ }
+@@ -3935,7 +3935,7 @@
+ Tk_Uid nameId;
+ Pixmap bitmap;
+ hierBox = hboxPtr;
+- if (Tk_ConfigureWidget(interp, hboxPtr->tkwin, configSpecs, argc, argv,
++ if (Blt_ConfigureWidget(interp, hboxPtr->tkwin, configSpecs, argc, argv,
+ (char *)hboxPtr, flags) != TCL_OK) {
+ return TCL_ERROR;
+ }
+@@ -4443,7 +4443,7 @@
+ Drawable drawable; /* Pixmap or window to draw into. */
+ {
+ Entry *entryPtr; /* Entry to be drawn. */
+- int x1, y1, x2, y2;
++ int x1, y1i, x2, y2;
+ int height;
+ int x, y;
+
+@@ -4463,22 +4463,22 @@
+ y += (height - hboxPtr->button.height) / 2;
+ x1 = x2 = x + LEVELWIDTH(treePtr->level) +
+ LEVELWIDTH(treePtr->level + 1) / 2;
+- y1 = y + hboxPtr->button.height / 2;
+- y2 = y1 + entryPtr->lineHeight;
++ y1i = y + hboxPtr->button.height / 2;
++ y2 = y1i + entryPtr->lineHeight;
+ if ((treePtr == hboxPtr->rootPtr) && (hboxPtr->hideRoot)) {
+- y1 += entryPtr->height;
++ y1i += entryPtr->height;
+ }
+ /*
+ * Clip the line's Y-coordinates at the window border.
+ */
+- if (y1 < 0) {
+- y1 = 0;
++ if (y1i < 0) {
++ y1i = 0;
+ }
+ if (y2 > Tk_Height(hboxPtr->tkwin)) {
+ y2 = Tk_Height(hboxPtr->tkwin);
+ }
+- if ((y1 < Tk_Height(hboxPtr->tkwin)) && (y2 > 0)) {
+- XDrawLine(hboxPtr->display, drawable, hboxPtr->lineGC, x1, y1,
++ if ((y1i < Tk_Height(hboxPtr->tkwin)) && (y2 > 0)) {
++ XDrawLine(hboxPtr->display, drawable, hboxPtr->lineGC, x1, y1i,
+ x2, y2);
+ }
+ }
+@@ -4788,17 +4788,17 @@
+ x, y);
+ }
+ if ((isFocused) && (hboxPtr->focusEdit) && (editPtr->cursorOn)) {
+- int x1, y1, x2, y2;
++ int x1, y1i, x2, y2;
+
+ GetCursorLocation(hboxPtr, treePtr);
+ x1 = x + editPtr->x;
+ x2 = x1 + 3;
+- y1 = y + editPtr->y - 1;
+- y2 = y1 + editPtr->height - 1;
++ y1i = y + editPtr->y - 1;
++ y2 = y1i + editPtr->height - 1;
+ XDrawLine(hboxPtr->display, drawable, entryPtr->labelGC,
+- x1, y1, x1, y2);
++ x1, y1i, x1, y2);
+ XDrawLine(hboxPtr->display, drawable, entryPtr->labelGC,
+- x1 - 2, y1, x2, y1);
++ x1 - 2, y1i, x2, y1i);
+ XDrawLine(hboxPtr->display, drawable, entryPtr->labelGC,
+ x1 - 2, y2, x2, y2);
+ }
+@@ -4859,7 +4859,7 @@
+ int width, height;
+ int entryHeight;
+ int buttonY;
+- int x1, y1, x2, y2;
++ int x1, y1i, x2, y2;
+ Entry *entryPtr;
+
+ entryPtr = treePtr->entryPtr;
+@@ -4875,7 +4875,7 @@
+ buttonY = y + entryPtr->buttonY;
+
+ x1 = x + (width / 2);
+- y1 = y2 = buttonY + (buttonPtr->height / 2);
++ y1i = y2 = buttonY + (buttonPtr->height / 2);
+ x2 = x1 + (LEVELWIDTH(treePtr->level) + LEVELWIDTH(treePtr->level + 1)) / 2;
+
+ if ((treePtr->parentPtr != NULL) && (hboxPtr->lineWidth > 0)) {
+@@ -4883,17 +4883,17 @@
+ * For every node except root, draw a horizontal line from
+ * the vertical bar to the middle of the icon.
+ */
+- XDrawLine(hboxPtr->display, drawable, hboxPtr->lineGC, x1, y1, x2, y2);
++ XDrawLine(hboxPtr->display, drawable, hboxPtr->lineGC, x1, y1i, x2, y2);
+ }
+ if ((entryPtr->flags & ENTRY_OPEN) && (hboxPtr->lineWidth > 0)) {
+ /*
+ * Entry is open, draw vertical line.
+ */
+- y2 = y1 + entryPtr->lineHeight;
++ y2 = y1i + entryPtr->lineHeight;
+ if (y2 > Tk_Height(hboxPtr->tkwin)) {
+ y2 = Tk_Height(hboxPtr->tkwin); /* Clip line at window border. */
+ }
+- XDrawLine(hboxPtr->display, drawable, hboxPtr->lineGC, x2, y1, x2, y2);
++ XDrawLine(hboxPtr->display, drawable, hboxPtr->lineGC, x2, y1i, x2, y2);
+ }
+ if ((entryPtr->flags & ENTRY_BUTTON) && (treePtr->parentPtr != NULL)) {
+ /*
+@@ -5506,7 +5506,7 @@
+ return Tk_ConfigureInfo(interp, hboxPtr->tkwin, buttonConfigSpecs,
+ (char *)hboxPtr, argv[0], 0);
+ }
+- if (Tk_ConfigureWidget(hboxPtr->interp, hboxPtr->tkwin, buttonConfigSpecs,
++ if (Blt_ConfigureWidget(hboxPtr->interp, hboxPtr->tkwin, buttonConfigSpecs,
+ argc, argv, (char *)hboxPtr, TK_CONFIG_ARGV_ONLY) != TCL_OK) {
+ return TCL_ERROR;
+ }
+--- a/generic/bltBusy.c
++++ b/generic/bltBusy.c
+@@ -418,7 +418,7 @@
+ Tk_Cursor oldCursor;
+
+ oldCursor = busyPtr->cursor;
+- if (Tk_ConfigureWidget(interp, busyPtr->tkRef, configSpecs, argc, argv,
++ if (Blt_ConfigureWidget(interp, busyPtr->tkRef, configSpecs, argc, argv,
+ (char *)busyPtr, 0) != TCL_OK) {
+ return TCL_ERROR;
+ }
+--- a/generic/bltConfig.c
++++ b/generic/bltConfig.c
+@@ -1573,7 +1573,7 @@
+ Blt_Free(tempName);
+
+ Tk_SetClass(tkwin, className);
+- result = Tk_ConfigureWidget(interp, tkwin, specsPtr, argc, argv, widgRec,
++ result = Blt_ConfigureWidget(interp, tkwin, specsPtr, argc, argv, widgRec,
+ flags);
+ if (isTemporary) {
+ Tk_DestroyWindow(tkwin);
+--- a/generic/bltTed.c
++++ b/generic/bltTed.c
+@@ -826,7 +826,7 @@
+ GC newGC;
+ unsigned long gcMask;
+
+- if (Tk_ConfigureWidget(tedPtr->interp, tedPtr->tkwin, configSpecs,
++ if (Blt_ConfigureWidget(tedPtr->interp, tedPtr->tkwin, configSpecs,
+ argc, argv, (char *)tedPtr, flags) != TCL_OK) {
+ return TCL_ERROR;
+ }
+--- a/generic/bltGrAxis.c
++++ b/generic/bltGrAxis.c
+@@ -3448,7 +3448,7 @@
+ return Tk_ConfigureInfo(graphPtr->interp, graphPtr->tkwin, configSpecs,
+ (char *)axisPtr, argv[0], flags);
+ }
+- if (Tk_ConfigureWidget(graphPtr->interp, graphPtr->tkwin, configSpecs,
++ if (Blt_ConfigureWidget(graphPtr->interp, graphPtr->tkwin, configSpecs,
+ argc, argv, (char *)axisPtr, flags) != TCL_OK) {
+ return TCL_ERROR;
+ }
+--- a/generic/bltHtext.c
++++ b/generic/bltHtext.c
+@@ -40,6 +40,13 @@
+ * of the virtual text.
+ */
+
++/*
++ * the htext widget is broken in tk8.5.6 as
++ * Tk_ConfigureWidget no longer supports
++ * queries of changed options. Need to migrate to Tk_SetOptions
++ * instead hack a wrapper Blt_ConfigureWidget
++ */
++
+ #include "bltInt.h"
+
+ #ifndef NO_HTEXT
+@@ -338,7 +345,7 @@
+ TK_CONFIG_DONT_SET_DEFAULT, &heightOption},
+ {TK_CONFIG_CUSTOM, "-linespacing", "lineSpacing", "LineSpacing",
+ DEF_HTEXT_LINE_SPACING, Tk_Offset(HText, leader),
+- TK_CONFIG_DONT_SET_DEFAULT, &bltDistanceOption},
++ TK_CONFIG_DONT_SET_DEFAULT, &bltDistanceOption},
+ {TK_CONFIG_CUSTOM, "-maxheight", "maxHeight", "MaxHeight",
+ DEF_HTEXT_MAX_HEIGHT, Tk_Offset(HText, maxHeight),
+ TK_CONFIG_DONT_SET_DEFAULT, &bltDistanceOption},
+@@ -2841,9 +2848,15 @@
+ Tk_GetFontMetrics(htPtr->font, &fontMetrics);
+ if ((segPtr->textEnd < htPtr->selFirst) ||
+ (segPtr->textStart > htPtr->selLast)) { /* No selected text */
++#ifdef TK_DRAWCHARS_ANLGE
++ Tk_DrawChars(htPtr->display, draw, htPtr->drawGC, htPtr->font,
++ htPtr->charArr + segPtr->textStart, textLength - 1,
++ x, y + linePtr->baseline, 0.);
++#else
+ Tk_DrawChars(htPtr->display, draw, htPtr->drawGC, htPtr->font,
+ htPtr->charArr + segPtr->textStart, textLength - 1,
+ x, y + linePtr->baseline);
++#endif
+ return;
+ }
+ /*
+@@ -2872,9 +2885,15 @@
+ Tk_MeasureChars(htPtr->font, htPtr->charArr + segPtr->textStart,
+ nChars, 10000, DEF_TEXT_FLAGS, &lastX);
+ lastX += x;
++#ifdef TK_DRAWCHARS_ANGLE
++ Tk_DrawChars(htPtr->display, draw, htPtr->drawGC, htPtr->font,
++ htPtr->charArr + segPtr->textStart, nChars, x,
++ y + linePtr->baseline, 0.);
++#else
+ Tk_DrawChars(htPtr->display, draw, htPtr->drawGC, htPtr->font,
+ htPtr->charArr + segPtr->textStart, nChars, x,
+ y + linePtr->baseline);
++#endif
+ curPos = selStart;
+ }
+ if (selLength > 0) { /* The selection itself */
+@@ -2890,16 +2909,28 @@
+ lastX, y + linePtr->baseline - fontMetrics.ascent,
+ width, fontMetrics.linespace, htPtr->selBorderWidth,
+ TK_RELIEF_RAISED);
++#ifdef TK_DRAWCHARS_ANGLE
++ Tk_DrawChars(htPtr->display, draw, htPtr->selectGC,
++ htPtr->font, htPtr->charArr + selStart, selLength,
++ lastX, y + linePtr->baseline, 0.);
++#else
+ Tk_DrawChars(htPtr->display, draw, htPtr->selectGC,
+ htPtr->font, htPtr->charArr + selStart, selLength,
+ lastX, y + linePtr->baseline);
++#endif
+ lastX = nextX;
+ curPos = selStart + selLength;
+ }
+ nChars = segPtr->textEnd - curPos;
+ if (nChars > 0) { /* Text following the selection */
++#ifdef TK_DRAWCHARS_ANGLE
++ Tk_DrawChars(htPtr->display, draw, htPtr->drawGC, htPtr->font,
++ htPtr->charArr + curPos, nChars - 1,
++ lastX, y + linePtr->baseline, 0.);
++#else
+ Tk_DrawChars(htPtr->display, draw, htPtr->drawGC, htPtr->font,
+ htPtr->charArr + curPos, nChars - 1, lastX, y + linePtr->baseline);
++#endif
+ }
+ }
+
+@@ -3055,18 +3086,21 @@
+ XFillRectangle(display, pixmap, htPtr->fillGC, 0, 0, width, height);
+ }
+
+-
+- if (! htPtr->lineArr) return;
+- if (deltaY >= 0) {
++ /* handle null lineArr */
++ if (htPtr->arraySize > 0 && htPtr->nLines > 0) {
++ if (deltaY >= 0) {
+ y += htPtr->lineArr[htPtr->first].offset;
+ lineNum = htPtr->first;
+ lastY = 0;
+- } else {
++ } else {
+ y += htPtr->lineArr[htPtr->last].offset;
+ lineNum = htPtr->last;
+ lastY = height;
++ }
++ forceCopy = 0;
++ } else {
++ htPtr->last = htPtr->first - 1;
+ }
+- forceCopy = 0;
+
+ /* Draw each line */
+ for (i = htPtr->first; i <= htPtr->last; i++) {
+@@ -3365,7 +3399,8 @@
+ * The page is always draw at full width and the viewport will clip
+ * the text.
+ */
+- if ((htPtr->first != oldFirst) || (htPtr->last != oldLast)) {
++ if ((htPtr->first != oldFirst) || (htPtr->last != oldLast)
++ || htPtr->flags & TEXT_DIRTY ) {
+ int offset;
+ int i;
+ int first, last;
+@@ -3383,23 +3418,26 @@
+ }
+ if (! htPtr->lineArr) return;
+
+- for (i = first; i <= last; i++) {
++
++ if (htPtr->arraySize > 0 && htPtr->nLines > 0) {
++ for (i = first; i <= last; i++) {
+ offset = htPtr->lineArr[i].offset;
+ for (linkPtr = Blt_ChainFirstLink(htPtr->lineArr[i].chainPtr);
+- linkPtr != NULL; linkPtr = Blt_ChainNextLink(linkPtr)) {
+- winPtr = Blt_ChainGetValue(linkPtr);
+- if (winPtr->tkwin != NULL) {
+- MoveEmbeddedWidget(winPtr, offset);
+- winPtr->flags &= ~WIDGET_VISIBLE;
+- }
++ linkPtr != NULL; linkPtr = Blt_ChainNextLink(linkPtr)) {
++ winPtr = Blt_ChainGetValue(linkPtr);
++ if (winPtr->tkwin != NULL) {
++ MoveEmbeddedWidget(winPtr, offset);
++ winPtr->flags &= ~WIDGET_VISIBLE;
++ }
+ }
++ }
+ }
+- }
+- DrawPage(htPtr, deltaY);
+- SendBogusEvent(tkwin);
++ DrawPage(htPtr, deltaY);
++ SendBogusEvent(tkwin);
+
+- /* Reset flags */
+- htPtr->flags &= ~TEXT_DIRTY;
++ /* Reset flags */
++ htPtr->flags &= ~TEXT_DIRTY;
++ }
+ }
+
+ /* Selection Procedures */
+@@ -3919,7 +3957,7 @@
+ if (winPtr == NULL) {
+ return TCL_ERROR;
+ }
+- if (Tk_ConfigureWidget(interp, htPtr->tkwin, widgetConfigSpecs,
++ if (Blt_ConfigureWidget(interp, htPtr->tkwin, widgetConfigSpecs,
+ argc - 3, argv + 3, (char *)winPtr, 0) != TCL_OK) {
+ return TCL_ERROR;
+ }
+@@ -4089,8 +4127,13 @@
+ return Tk_ConfigureInfo(interp, htPtr->tkwin, specsPtr, itemPtr,
+ argv[2], 0);
+ }
+- if (Tk_ConfigureWidget(interp, htPtr->tkwin, specsPtr, argc - 2,
+- argv + 2, itemPtr, TK_CONFIG_ARGV_ONLY) != TCL_OK) {
++ if (Blt_ConfigureWidget(interp, htPtr->tkwin, specsPtr, argc - 2,
++ argv + 2, itemPtr, TK_CONFIG_ARGV_ONLY) != TCL_OK) {
++
++ /*
++ * in 8.5 cant tell if in option was modified
++ * supposed to convert to Tk_SetOptions
++ */
+ return TCL_ERROR;
+ }
+ if (itemPtr == (char *)htPtr) {
+@@ -4487,7 +4530,7 @@
+ #ifdef ITCL_NAMESPACES
+ Itk_SetWidgetCommand(htPtr->tkwin, htPtr->cmdToken);
+ #endif
+- if ((Tk_ConfigureWidget(interp, htPtr->tkwin, configSpecs, argc - 2,
++ if ((Blt_ConfigureWidget(interp, htPtr->tkwin, configSpecs, argc - 2,
+ argv + 2, (char *)htPtr, 0) != TCL_OK) ||
+ (ConfigureText(interp, htPtr) != TCL_OK)) {
+ Tk_DestroyWindow(htPtr->tkwin);
+--- a/generic/bltWinDraw.c
++++ b/generic/bltWinDraw.c
+@@ -1647,8 +1647,13 @@
+ if (drawable == None) {
+ return;
+ }
++#ifdef TK_DRAWCHARS_ANGLE
++ Tk_DrawChars(display, drawable, gc, (Tk_Font)gc->font, string, length,
++ x, y, 0.);
++#else
+ Tk_DrawChars(display, drawable, gc, (Tk_Font)gc->font, string, length,
+ x, y);
++#endif
+ }
+
+ static void
+--- a/generic/bltGrMarker.c
++++ b/generic/bltGrMarker.c
+@@ -4313,7 +4313,7 @@
+ /* Save the old marker. */
+ oldName = markerPtr->name;
+ under = markerPtr->drawUnder;
+- if (Tk_ConfigureWidget(interp, graphPtr->tkwin,
++ if (Blt_ConfigureWidget(interp, graphPtr->tkwin,
+ markerPtr->classPtr->configSpecs, nOpts, options,
+ (char *)markerPtr, flags) != TCL_OK) {
+ return TCL_ERROR;
+--- a/generic/bltBitmap.c
++++ b/generic/bltBitmap.c
+@@ -917,7 +917,7 @@
+ info.padLeft = info.padRight = 0;
+ info.padTop = info.padBottom = 0;
+ info.font = (Tk_Font)NULL; /* Initialized by Tk_ConfigureWidget */
+- if (Tk_ConfigureWidget(interp, tkwin, composeConfigSpecs,
++ if (Blt_ConfigureWidget(interp, tkwin, composeConfigSpecs,
+ argc - 4, argv + 4, (char *)&info, 0) != TCL_OK) {
+ return TCL_ERROR;
+ }
+@@ -1027,7 +1027,7 @@
+ /* Initialize info and then process flags */
+ info.rotate = 0.0; /* No rotation by default */
+ info.scale = 1.0; /* No scaling by default */
+- if (Tk_ConfigureWidget(interp, dataPtr->tkwin, defineConfigSpecs,
++ if (Blt_ConfigureWidget(interp, dataPtr->tkwin, defineConfigSpecs,
+ argc - 4, argv + 4, (char *)&info, 0) != TCL_OK) {
+ return TCL_ERROR;
+ }
+--- a/generic/bltTabnotebook.c
++++ b/generic/bltTabnotebook.c
+@@ -2766,7 +2766,7 @@
+ GC newGC;
+
+ lastNotebookInstance = nbPtr;
+- if (Tk_ConfigureWidget(interp, nbPtr->tkwin, configSpecs, argc, argv,
++ if (Blt_ConfigureWidget(interp, nbPtr->tkwin, configSpecs, argc, argv,
+ (char *)nbPtr, flags) != TCL_OK) {
+ return TCL_ERROR;
+ }
+@@ -3691,7 +3691,7 @@
+ }
+ Tcl_Preserve(tabPtr);
+ lastNotebookInstance = nbPtr;
+- result = Tk_ConfigureWidget(interp, nbPtr->tkwin, tabConfigSpecs,
++ result = Blt_ConfigureWidget(interp, nbPtr->tkwin, tabConfigSpecs,
+ nOpts, options, (char *)tabPtr, TK_CONFIG_ARGV_ONLY);
+ if (result == TCL_OK) {
+ result = ConfigureTab(nbPtr, tabPtr);
+--- a/generic/bltContainer.c
++++ b/generic/bltContainer.c
+@@ -1193,7 +1193,7 @@
+ GC newGC;
+ int width, height;
+
+- if (Tk_ConfigureWidget(interp, cntrPtr->tkwin, configSpecs, argc, argv,
++ if (Blt_ConfigureWidget(interp, cntrPtr->tkwin, configSpecs, argc, argv,
+ (char *)cntrPtr, flags) != TCL_OK) {
+ return TCL_ERROR;
+ }
+--- a/generic/bltTabset.c
++++ b/generic/bltTabset.c
+@@ -3163,7 +3163,7 @@
+ XColor *activeColor; /* Active foreground. */
+
+ tabSet = setPtr;
+- if (Tk_ConfigureWidget(interp, setPtr->tkwin, configSpecs, argc, argv,
++ if (Blt_ConfigureWidget(interp, setPtr->tkwin, configSpecs, argc, argv,
+ (char *)setPtr, flags) != TCL_OK) {
+ return TCL_ERROR;
+ }
+@@ -4452,7 +4452,7 @@
+ }
+ tabSet = setPtr;
+ Tcl_Preserve(tabPtr);
+- result = Tk_ConfigureWidget(interp, setPtr->tkwin, tabConfigSpecs,
++ result = Blt_ConfigureWidget(interp, setPtr->tkwin, tabConfigSpecs,
+ nOpts, options, (char *)tabPtr, TK_CONFIG_ARGV_ONLY);
+ if (result == TCL_OK || nOpts>=2) {
+ result = ConfigureTab(setPtr, tabPtr);
+--- a/generic/bltGrGrid.c
++++ b/generic/bltGrGrid.c
+@@ -368,7 +368,7 @@
+ return Tk_ConfigureInfo(interp, graphPtr->tkwin, configSpecs,
+ (char *)gridPtr, argv[3], flags);
+ }
+- if (Tk_ConfigureWidget(graphPtr->interp, graphPtr->tkwin, configSpecs,
++ if (Blt_ConfigureWidget(graphPtr->interp, graphPtr->tkwin, configSpecs,
+ argc - 3, argv + 3, (char *)gridPtr, flags) != TCL_OK) {
+ return TCL_ERROR;
+ }
+--- a/generic/tkButton.c
++++ b/generic/tkButton.c
+@@ -1721,7 +1721,7 @@
+ oldSelVar = (butPtr->selVarName?strdup(butPtr->selVarName):NULL);
+ }
+
+- if (Tk_ConfigureWidget(interp, butPtr->tkwin, configSpecs,
++ if (Blt_ConfigureWidget(interp, butPtr->tkwin, configSpecs,
+ argc, argv, (char *)butPtr, flags) != TCL_OK) {
+ if (oldTextVar) ckfree(oldTextVar);
+ if (oldTextVar) ckfree(oldSelVar);
+--- a/generic/bltGrElem.c
++++ b/generic/bltGrElem.c
+@@ -1699,7 +1699,7 @@
+ search.x = x;
+ search.y = y;
+
+- if (Tk_ConfigureWidget(interp, graphPtr->tkwin, closestSpecs, i - 6,
++ if (Blt_ConfigureWidget(interp, graphPtr->tkwin, closestSpecs, i - 6,
+ argv + 6, (char *)&search, TK_CONFIG_ARGV_ONLY) != TCL_OK) {
+ return TCL_ERROR; /* Error occurred processing an option. */
+ }
+@@ -1854,7 +1854,7 @@
+ return Tk_ConfigureInfo(interp, graphPtr->tkwin,
+ elemPtr->specsPtr, (char *)elemPtr, options[0], flags);
+ }
+- if (Tk_ConfigureWidget(interp, graphPtr->tkwin, elemPtr->specsPtr,
++ if (Blt_ConfigureWidget(interp, graphPtr->tkwin, elemPtr->specsPtr,
+ numOpts, options, (char *)elemPtr, flags) != TCL_OK) {
+ return TCL_ERROR;
+ }
+--- a/generic/bltTable.c
++++ b/generic/bltTable.c
+@@ -1201,7 +1201,7 @@
+ oldRowSpan = entryPtr->row.span;
+ oldColSpan = entryPtr->column.span;
+
+- if (Tk_ConfigureWidget(interp, entryPtr->tkwin, entryConfigSpecs,
++ if (Blt_ConfigureWidget(interp, entryPtr->tkwin, entryConfigSpecs,
+ argc, argv, (char *)entryPtr, TK_CONFIG_ARGV_ONLY) != TCL_OK) {
+ return TCL_ERROR;
+ }
+@@ -1553,7 +1553,7 @@
+ return Tk_ConfigureInfo(tablePtr->interp, tablePtr->tkwin,
+ infoPtr->configSpecs, (char *)rcPtr, argv[0], 0);
+ } else {
+- if (Tk_ConfigureWidget(tablePtr->interp, tablePtr->tkwin,
++ if (Blt_ConfigureWidget(tablePtr->interp, tablePtr->tkwin,
+ infoPtr->configSpecs, argc, argv, (char *)rcPtr,
+ TK_CONFIG_ARGV_ONLY) != TCL_OK) {
+ return TCL_ERROR;
+@@ -1578,7 +1578,7 @@
+ }
+ rcPtr = GetRowColumn(infoPtr, n);
+ assert(rcPtr);
+- if (Tk_ConfigureWidget(tablePtr->interp, tablePtr->tkwin,
++ if (Blt_ConfigureWidget(tablePtr->interp, tablePtr->tkwin,
+ infoPtr->configSpecs, argc, argv, (char *)rcPtr,
+ TK_CONFIG_ARGV_ONLY) != TCL_OK) {
+ return TCL_ERROR;
+@@ -1861,7 +1861,7 @@
+ return Tk_ConfigureInfo(interp, tablePtr->tkwin, tableConfigSpecs,
+ (char *)tablePtr, argv[0], 0);
+ }
+- if (Tk_ConfigureWidget(interp, tablePtr->tkwin, tableConfigSpecs,
++ if (Blt_ConfigureWidget(interp, tablePtr->tkwin, tableConfigSpecs,
+ argc, argv, (char *)tablePtr, TK_CONFIG_ARGV_ONLY) != TCL_OK) {
+ return TCL_ERROR;
+ }
+@@ -2198,7 +2198,7 @@
+ }
+ }
+ if (argc > 0) {
+- result = Tk_ConfigureWidget(tablePtr->interp, entryPtr->tkwin,
++ result = Blt_ConfigureWidget(tablePtr->interp, entryPtr->tkwin,
+ entryConfigSpecs, argc, argv, (char *)entryPtr,
+ TK_CONFIG_ARGV_ONLY);
+ }
diff --git a/graphics/tclblt/patches/05-tk8.5-zoomstack.patch b/graphics/tclblt/patches/05-tk8.5-zoomstack.patch
new file mode 100644
index 0000000000..268e154cda
--- /dev/null
+++ b/graphics/tclblt/patches/05-tk8.5-zoomstack.patch
@@ -0,0 +1,38 @@
+ * Apply 3 changes based on revisions developed by the fedora linux team.
+ + 03-fedora-patch-2.diff
+ + 04-fedora-tk8.5.6.patch.diff
+ --> + 05-tk8.5-zoomstack.diff
+ * Those patches are required to solve segmentation faults that are observed
+ when blt is used with tcltk 8.5. We have a substantial amount of
+ experience using this patched version of blt in the Swarm
+ Simulation System (www.swarm.org) and have observed no ill-effects.
+Author: Paul E. Johnson (Debian Packaging) <pauljohn32@freefaculty.org>
+
+--- a/library/Makefile.in
++++ b/library/Makefile.in
+@@ -29,6 +29,7 @@
+ tabnotebook.tcl \
+ tabset.tcl \
+ treeview.tcl \
++ ZoomStack.itcl \
+ tvutil.tcl \
+ init.tcl \
+ tclIndex \
+--- a/library/ZoomStack.itcl
++++ b/library/ZoomStack.itcl
+@@ -1,4 +1,6 @@
+-import add itcl
++#import add itcl
++package require Itcl
++namespace import itcl::*
+
+ class ZoomStackGraph {
+
+@@ -48,6 +50,7 @@
+ private method SaveCoords { x y }
+ private method Zoom {}
+ private method Unzoom {}
++ private method Empty {}
+ private method Push { cmd }
+ private method Pop {}
+ private method MarkPoint { x y }
diff --git a/graphics/tclblt/patches/autoreconf.patch b/graphics/tclblt/patches/autoreconf.patch
new file mode 100644
index 0000000000..e1ac419bd1
--- /dev/null
+++ b/graphics/tclblt/patches/autoreconf.patch
@@ -0,0 +1,41 @@
+Description: fix autotools input for compatibility with recent autoconf
+ It is not possible to regenerate the blt configure script using current
+ versions of autoconf. Update for recent syntax so that we can get a modern
+ (and cross-build-friendly) configure script at build.
+Author: Helmut Grohne <helmut@subdivi.de>
+Bug-Debian: http://bugs.debian.org/772590
+
+--- a/aclocal.m4
++++ b/aclocal.m4
+@@ -12,7 +12,7 @@
+ cat > conftest.$ac_ext <<EOF
+ [#]line __oline__ "configure"
+ #include "confdefs.h"
+-ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
++AC_LANG_CASE([C++], [#ifdef __cplusplus
+ extern "C" void exit(int);
+ #endif
+ ])dnl
+--- a/configure.in
++++ b/configure.in
+@@ -127,9 +127,9 @@
+ AC_CACHE_VAL(blt_cv_prog_cc, blt_cv_prog_cc=$CC)
+ AC_SUBST(CC)
+ AC_PROG_CPP
+-if test "x${GCC}" != "x" ; then
++AS_IF([test "x${GCC}" != "x"],[
+ blt_have_gcc="yes"
+-else
++],[
+ AC_MSG_CHECKING([if C compiler is really gcc])
+ AC_EGREP_CPP(_cc_is_gcc_, [
+ #ifdef __GNUC__
+@@ -137,7 +137,7 @@
+ #endif
+ ], [blt_have_gcc=yes], [blt_have_gcc=no])
+ AC_MSG_RESULT([$blt_have_gcc])
+-fi
++])
+
+ #
+ # CFLAGS search order
diff --git a/graphics/tclblt/patches/blthash.patch b/graphics/tclblt/patches/blthash.patch
new file mode 100644
index 0000000000..df4c97f9d6
--- /dev/null
+++ b/graphics/tclblt/patches/blthash.patch
@@ -0,0 +1,16 @@
+Description: Patch silences GCC warnings for overflow on implicit constant
+ conversions.
+Author: FreeBSD BLT maintainers
+Last-Modified: Tue, 08 Jul 2014 12:19:13 +0400
+
+--- a/generic/bltHash.h.in
++++ b/generic/bltHash.h.in
+@@ -88,7 +88,7 @@
+ * Acceptable key types for hash tables:
+ */
+ #define BLT_STRING_KEYS 0
+-#define BLT_ONE_WORD_KEYS ((size_t)-1)
++#define BLT_ONE_WORD_KEYS -1
+
+ /*
+ * Forward declaration of Blt_HashTable. Needed by some C++ compilers
diff --git a/graphics/tclblt/patches/bltnsutil.patch b/graphics/tclblt/patches/bltnsutil.patch
new file mode 100644
index 0000000000..1b911a0e9f
--- /dev/null
+++ b/graphics/tclblt/patches/bltnsutil.patch
@@ -0,0 +1,24 @@
+Description: Patch fixes call to Blt_ParseQualifiedName().
+Author: FreeBSD BLT maintainers
+Last-Modified: Tue, 08 Jul 2014 11:51:01 +0400
+
+--- a/generic/bltNsUtil.c
++++ b/generic/bltNsUtil.c
+@@ -64,7 +64,7 @@
+ Tcl_Var varPtr;
+ Tcl_Namespace *nsPtr;
+ Tcl_Obj *objPtr;
+- char *str, *cp;
++ CONST char *str, *cp;
+
+ varPtr = Tcl_FindNamespaceVar(interp, (char *)name,
+ (Tcl_Namespace *)NULL, 0);
+@@ -74,7 +74,7 @@
+ objPtr = Tcl_NewObj();
+ Tcl_GetVariableFullName(interp, varPtr, objPtr);
+ str = Tcl_GetString(objPtr);
+- if (Blt_ParseQualifiedName(interp, str, &nsPtr, &cp) == NULL) {
++ if (Blt_ParseQualifiedName(interp, str, &nsPtr, &cp) != TCL_OK) {
+ nsPtr = NULL;
+ }
+ Tcl_DecrRefCount(objPtr);
diff --git a/graphics/tclblt/patches/const.patch b/graphics/tclblt/patches/const.patch
new file mode 100644
index 0000000000..a82519a3dc
--- /dev/null
+++ b/graphics/tclblt/patches/const.patch
@@ -0,0 +1,890 @@
+Descriptiom: Patch makes explicit casts to silence GCC warnings about
+ incompatible pointer types (mostly adds or removes const modifier).
+Author: Sergei Golovan
+Last-Modified: Wed, 09 Jul 2014 19:22:39 +0400
+
+--- a/generic/bltArrayObj.c
++++ b/generic/bltArrayObj.c
+@@ -55,7 +55,7 @@
+ Blt_HashEntry *hPtr;
+ Blt_HashTable *tablePtr;
+ Tcl_Obj *elemObjPtr, **vobjv;
+- Tcl_ObjType *oldTypePtr;
++ CONST Tcl_ObjType *oldTypePtr;
+ char *string;
+ int isNew;
+ int nElem;
+--- a/generic/bltBgexec.c
++++ b/generic/bltBgexec.c
+@@ -926,7 +926,7 @@
+ Tcl_DStringInit(&dStr);
+ GetSinkData(sinkPtr, &data, &length);
+ Tcl_DStringAppend(&dStr, sinkPtr->command, -1);
+- Tcl_DStringAppendElement(&dStr, data);
++ Tcl_DStringAppendElement(&dStr, (char *)data);
+ Tcl_DStringAppendElement(&dStr, status);
+ if (Tcl_GlobalEval(interp, Tcl_DStringValue(&dStr)) != TCL_OK) {
+ Tcl_BackgroundError(interp);
+--- a/generic/bltTree.c
++++ b/generic/bltTree.c
+@@ -47,7 +47,7 @@
+ if (dictType == NULL) {
+ Tcl_Obj * obj;
+ obj = Tcl_NewDictObj();
+- dictType = obj->typePtr;
++ dictType = (Tcl_ObjType *)obj->typePtr;
+ Tcl_DecrRefCount(obj);
+ }
+ return (objPtr->typePtr == dictType);
+@@ -3320,7 +3320,7 @@
+ if (tPtr->nodeTable.numEntries > 0) {
+ flags |= TREE_TRACE_TAGMULTIPLE;
+ }
+- result = CallTraces(interp, clientPtr, node->treeObject, node, tagName,
++ result = CallTraces(interp, clientPtr, node->treeObject, node, (Blt_TreeKey)tagName,
+ flags, &cnt);
+ if (result == TCL_BREAK) {
+ return TCL_OK;
+@@ -3349,7 +3349,7 @@
+ int cnt;
+
+ if (!(node->flags & TREE_TRACE_ACTIVE)) {
+- return CallTraces(interp, clientPtr, node->treeObject, node, tagName,
++ return CallTraces(interp, clientPtr, node->treeObject, node, (Blt_TreeKey)tagName,
+ (TREE_TRACE_TAGDELETE), &cnt);
+ }
+ return TCL_OK;
+--- a/generic/bltTreeCmd.c
++++ b/generic/bltTreeCmd.c
+@@ -7733,7 +7733,7 @@
+ return TCL_ERROR;
+ }
+ if (valueObjPtr->typePtr != NULL) {
+- Tcl_SetResult(interp, valueObjPtr->typePtr->name, TCL_VOLATILE);
++ Tcl_SetResult(interp, (char *)(valueObjPtr->typePtr->name), TCL_VOLATILE);
+ } else {
+ Tcl_SetResult(interp, "string", TCL_STATIC);
+ }
+--- a/generic/bltVector.c
++++ b/generic/bltVector.c
+@@ -370,7 +370,7 @@
+ *indexPtr = (int)value;
+ cleanup:
+ if (string != zStatic) {
+- Blt_Free( string );
++ Blt_Free( (void *)string );
+ }
+ return result;
+ }
+--- a/generic/bltGrAxis.c
++++ b/generic/bltGrAxis.c
+@@ -3436,7 +3436,7 @@
+ Graph *graphPtr;
+ Axis *axisPtr;
+ int argc;
+- char *argv[];
++ CONST char *argv[];
+ {
+ int flags;
+
+--- a/generic/bltGrElem.c
++++ b/generic/bltGrElem.c
+@@ -1658,7 +1658,7 @@
+ Graph *graphPtr; /* Graph widget */
+ Tcl_Interp *interp; /* Interpreter to report results to */
+ int argc; /* Number of element names */
+- char **argv; /* List of element names */
++ CONST char **argv; /* List of element names */
+ {
+ Element *elemPtr;
+ ClosestSearch search;
+@@ -1821,12 +1821,12 @@
+ Graph *graphPtr;
+ Tcl_Interp *interp;
+ int argc;
+- char *argv[];
++ CONST char *argv[];
+ {
+ Element *elemPtr;
+ int flags;
+ int numNames, numOpts;
+- char **options;
++ CONST char **options;
+ register int i;
+
+ /* Figure out where the option value pairs begin */
+--- a/generic/bltGrGrid.c
++++ b/generic/bltGrGrid.c
+@@ -355,7 +355,7 @@
+ Graph *graphPtr;
+ Tcl_Interp *interp;
+ int argc;
+- char **argv;
++ CONST char **argv;
+ {
+ Grid *gridPtr = (Grid *)graphPtr->gridPtr;
+ int flags;
+--- a/generic/bltGrHairs.c
++++ b/generic/bltGrHairs.c
+@@ -379,7 +379,7 @@
+ Graph *graphPtr;
+ Tcl_Interp *interp;
+ int argc;
+- char **argv;
++ CONST char **argv;
+ {
+ Crosshairs *chPtr = graphPtr->crosshairs;
+
+--- a/generic/bltGrLegd.c
++++ b/generic/bltGrLegd.c
+@@ -1393,7 +1393,7 @@
+ Graph *graphPtr;
+ Tcl_Interp *interp;
+ int argc;
+- char **argv;
++ CONST char **argv;
+ {
+ int flags = TK_CONFIG_ARGV_ONLY;
+ Legend *legendPtr;
+--- a/generic/bltGrMarker.c
++++ b/generic/bltGrMarker.c
+@@ -4274,13 +4274,13 @@
+ Graph *graphPtr;
+ Tcl_Interp *interp;
+ int argc;
+- char **argv;
++ CONST char **argv;
+ {
+ Marker *markerPtr;
+ int flags = TK_CONFIG_ARGV_ONLY;
+ char *oldName;
+ int nNames, nOpts;
+- char **options;
++ CONST char **options;
+ register int i;
+ int under;
+
+--- a/generic/bltGrPen.c
++++ b/generic/bltGrPen.c
+@@ -475,13 +475,13 @@
+ Tcl_Interp *interp;
+ Graph *graphPtr;
+ int argc;
+- char *argv[];
++ CONST char *argv[];
+ {
+ int flags;
+ Pen *penPtr;
+ int nNames, nOpts;
+ int redraw;
+- char **options;
++ CONST char **options;
+ register int i;
+
+ /* Figure out where the option value pairs begin */
+--- a/generic/bltGrPs.c
++++ b/generic/bltGrPs.c
+@@ -406,7 +406,7 @@
+ Graph *graphPtr;
+ Tcl_Interp *interp;
+ int argc; /* Number of options in argv vector */
+- char **argv; /* Option vector */
++ CONST char **argv; /* Option vector */
+ {
+ int flags = TK_CONFIG_ARGV_ONLY;
+ PostScript *psPtr = (PostScript *)graphPtr->postscript;
+@@ -1110,7 +1110,7 @@
+ Graph *graphPtr; /* Graph widget record */
+ Tcl_Interp *interp;
+ int argc; /* Number of options in argv vector */
+- char **argv; /* Option vector */
++ CONST char **argv; /* Option vector */
+ {
+ PostScript *psPtr = (PostScript *)graphPtr->postscript;
+ FILE *f = NULL;
+@@ -1121,7 +1121,7 @@
+ fileName = NULL;
+ if (argc > 3) {
+ if (argv[3][0] != '-') {
+- fileName = argv[3]; /* First argument is the file name. */
++ fileName = (char *)argv[3]; /* First argument is the file name. */
+ argv++, argc--;
+ }
+ if (Blt_ConfigureWidget(interp, graphPtr->tkwin, configSpecs, argc - 3,
+--- a/generic/bltGraph.c
++++ b/generic/bltGraph.c
+@@ -887,7 +887,7 @@
+ CreateGraph(interp, argc, argv, classUid)
+ Tcl_Interp *interp;
+ int argc;
+- char **argv;
++ CONST char **argv;
+ Blt_Uid classUid;
+ {
+ Graph *graphPtr;
+@@ -1082,7 +1082,7 @@
+ Graph *graphPtr;
+ Tcl_Interp *interp;
+ int argc;
+- char **argv;
++ CONST char **argv;
+ {
+ int flags;
+
+--- a/generic/bltBitmap.c
++++ b/generic/bltBitmap.c
+@@ -887,7 +887,7 @@
+ ClientData clientData; /* Thread-specific data for bitmaps. */
+ Tcl_Interp *interp; /* Interpreter to report results to */
+ int argc; /* Number of arguments */
+- char **argv; /* Argument list */
++ CONST char **argv; /* Argument list */
+ {
+ BitmapInterpData *dataPtr = clientData;
+ int width, height; /* Dimensions of bitmap */
+@@ -934,7 +934,7 @@
+ ts.leader = 0;
+ ts.anchor = TK_ANCHOR_CENTER;
+
+- textPtr = Blt_GetTextLayout(argv[3], &ts);
++ textPtr = Blt_GetTextLayout((char *)argv[3], &ts);
+ bitmap = Blt_CreateTextBitmap(tkwin, textPtr, &ts, &width, &height);
+ Blt_Free(textPtr);
+ if (bitmap == None) {
+@@ -1003,7 +1003,7 @@
+ ClientData clientData; /* Thread-specific data for bitmaps. */
+ Tcl_Interp *interp; /* Interpreter to report results to */
+ int argc; /* Number of arguments */
+- char **argv; /* Argument list */
++ CONST char **argv; /* Argument list */
+ {
+ BitmapInterpData *dataPtr = clientData;
+ int width, height; /* Dimensions of bitmap */
+@@ -1032,7 +1032,7 @@
+ return TCL_ERROR;
+ }
+ /* Skip leading spaces. */
+- for (p = argv[3]; isspace(UCHAR(*p)); p++) {
++ for (p = (char *)argv[3]; isspace(UCHAR(*p)); p++) {
+ /*empty*/
+ }
+ defn = Blt_Strdup(p);
+--- a/generic/bltBusy.c
++++ b/generic/bltBusy.c
+@@ -413,7 +413,7 @@
+ Tcl_Interp *interp;
+ Busy *busyPtr;
+ int argc;
+- char **argv;
++ CONST char **argv;
+ {
+ Tk_Cursor oldCursor;
+
+--- a/generic/bltCanvEps.c
++++ b/generic/bltCanvEps.c
+@@ -1136,7 +1136,7 @@
+ Tk_Canvas canvas; /* Canvas containing itemPtr. */
+ Tk_Item *itemPtr; /* EPS item to reconfigure. */
+ int argc; /* Number of elements in argv. */
+- char **argv; /* Arguments describing things to configure. */
++ CONST char **argv; /* Arguments describing things to configure. */
+ int flags; /* Flags to pass to Tk_ConfigureWidget. */
+ {
+ EpsItem *epsPtr = (EpsItem *)itemPtr;
+@@ -1282,10 +1282,10 @@
+ unsigned long gcMask;
+ GC newGC;
+ int width, height, i;
+- char **argv;
++ CONST char **argv;
+
+ tkwin = Tk_CanvasTkwin(canvas);
+- argv = (char**)ckalloc((argc+1)*sizeof(char*));
++ argv = (CONST char **)ckalloc((argc+1)*sizeof(char*));
+ for (i=0; i<argc; i++) {
+ argv[i] = Tcl_GetString(objv[i]);
+ }
+--- a/generic/bltConfig.c
++++ b/generic/bltConfig.c
+@@ -1545,7 +1545,7 @@
+ Tk_Window tkwin;
+ int result;
+ char *tempName;
+- char *oldClass;
++ CONST char *oldClass;
+ int isTemporary = FALSE;
+
+ tempName = Blt_Strdup(resName);
+@@ -1573,7 +1573,7 @@
+ Blt_Free(tempName);
+
+ Tk_SetClass(tkwin, className);
+- result = Blt_ConfigureWidget(interp, tkwin, specsPtr, argc, argv, widgRec,
++ result = Blt_ConfigureWidget(interp, tkwin, specsPtr, argc, (CONST char **)argv, widgRec,
+ flags);
+ if (isTemporary) {
+ Tk_DestroyWindow(tkwin);
+--- a/generic/bltOldConfig.c
++++ b/generic/bltOldConfig.c
+@@ -578,7 +578,7 @@
+ case TK_CONFIG_CUSTOM:
+ if ((*specPtr->customPtr->parseProc)(
+ specPtr->customPtr->clientData, interp, tkwin,
+- value, widgRec, specPtr->offset) != TCL_OK) {
++ (char *)value, widgRec, specPtr->offset) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ break;
+@@ -737,7 +737,7 @@
+ argv[2] = specPtr->dbClass;
+ argv[3] = specPtr->defValue;
+ if (specPtr->type == TK_CONFIG_SYNONYM) {
+- return Tcl_Merge(2, argv);
++ return Tcl_Merge(2, (char * CONST *)argv);
+ }
+ argv[4] = FormatConfigValue(interp, tkwin, specPtr, widgRec, buffer,
+ &freeProc);
+@@ -768,10 +768,10 @@
+
+
+ argv[5] = conftypes[specPtr->type];
+- result = Tcl_Merge(6, argv);
++ result = Tcl_Merge(6, (char * CONST *)argv);
+
+ } else {
+- result = Tcl_Merge(5, argv);
++ result = Tcl_Merge(5, (char * CONST *)argv);
+ }
+ if (freeProc != NULL) {
+ if ((freeProc == TCL_DYNAMIC) || (freeProc == (Tcl_FreeProc *) free)) {
+--- a/generic/bltContainer.c
++++ b/generic/bltContainer.c
+@@ -1185,7 +1185,7 @@
+ * may not already have values for
+ * some fields. */
+ int argc;
+- char **argv;
++ CONST char **argv;
+ int flags;
+ {
+ XGCValues gcValues;
+--- a/generic/bltDragdrop.c
++++ b/generic/bltDragdrop.c
+@@ -452,9 +452,9 @@
+ static void SourceEventProc _ANSI_ARGS_((ClientData clientData,
+ XEvent *eventPtr));
+ static int ConfigureSource _ANSI_ARGS_((Tcl_Interp *interp, Source * srcPtr,
+- int argc, char **argv, int flags));
++ int argc, CONST char **argv, int flags));
+ static int ConfigureToken _ANSI_ARGS_((Tcl_Interp *interp, Source * srcPtr,
+- int argc, char **argv));
++ int argc, CONST char **argv));
+
+ static Target *CreateTarget _ANSI_ARGS_((Tcl_Interp *interp, Tk_Window tkwin));
+ static Target *FindTarget _ANSI_ARGS_((Tk_Window tkwin));
+@@ -1060,7 +1060,7 @@
+ Tcl_Interp *interp;
+ Source *srcPtr;
+ int argc;
+- char **argv;
++ CONST char **argv;
+ {
+ Token *tokenPtr;
+
+@@ -1069,7 +1069,7 @@
+ (char *)tokenPtr, TK_CONFIG_ARGV_ONLY) != TCL_OK) {
+ return TCL_ERROR;
+ }
+- return ConfigureSource(interp, srcPtr, 0, (char **)NULL,
++ return ConfigureSource(interp, srcPtr, 0, (CONST char **)NULL,
+ TK_CONFIG_ARGV_ONLY);
+ }
+
+@@ -1161,7 +1161,7 @@
+ srcPtr->token.borderWidth = srcPtr->token.activeBorderWidth = 3;
+ srcPtr->hashPtr = hPtr;
+ Blt_InitHashTable(&(srcPtr->handlerTable), BLT_STRING_KEYS);
+- if (ConfigureSource(interp, srcPtr, 0, (char **)NULL, 0) != TCL_OK) {
++ if (ConfigureSource(interp, srcPtr, 0, (CONST char **)NULL, 0) != TCL_OK) {
+ DestroySource(srcPtr);
+ return NULL;
+ }
+@@ -1280,7 +1280,7 @@
+ Tcl_Interp *interp; /* current interpreter */
+ register Source *srcPtr; /* drag&drop source widget record */
+ int argc; /* number of arguments */
+- char **argv; /* argument strings */
++ CONST char **argv; /* argument strings */
+ int flags; /* flags controlling interpretation */
+ {
+ unsigned long gcMask;
+@@ -2332,11 +2332,11 @@
+ TokenOp(interp, argc, argv)
+ Tcl_Interp *interp;
+ int argc;
+- char **argv;
++ CONST char **argv;
+ {
+ Source *srcPtr;
+
+- if (GetSource(interp, argv[2], &srcPtr) != TCL_OK) {
++ if (GetSource(interp, (char *)argv[2], &srcPtr) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if ((argc > 3) &&
+@@ -2408,7 +2408,7 @@
+ SourceOp(interp, argc, argv)
+ Tcl_Interp *interp;
+ int argc;
+- char **argv;
++ CONST char **argv;
+ {
+ Source *srcPtr;
+ int isNew;
+@@ -2429,7 +2429,7 @@
+ /*
+ * Find or create source info...
+ */
+- srcPtr = CreateSource(interp, argv[2], &isNew);
++ srcPtr = CreateSource(interp, (char *)argv[2], &isNew);
+ if (srcPtr == NULL) {
+ return TCL_ERROR;
+ }
+--- a/generic/bltHierbox.c
++++ b/generic/bltHierbox.c
+@@ -1088,7 +1088,7 @@
+ static void EventuallyInvokeSelectCmd _ANSI_ARGS_((Hierbox *hboxPtr));
+ static int ComputeVisibleEntries _ANSI_ARGS_((Hierbox *hboxPtr));
+ static int ConfigureEntry _ANSI_ARGS_((Hierbox *hboxPtr, Entry * entryPtr,
+- int argc, char **argv, int flags));
++ int argc, CONST char **argv, int flags));
+ static void ComputeLayout _ANSI_ARGS_((Hierbox *hboxPtr));
+
+ static CompareProc ExactCompare, GlobCompare, RegexpCompare;
+@@ -2064,7 +2064,7 @@
+ }
+ entryPtr->labelText = Blt_Strdup(name);
+
+- if (ConfigureEntry(hboxPtr, entryPtr, 0, (char **)NULL, 0) != TCL_OK) {
++ if (ConfigureEntry(hboxPtr, entryPtr, 0, (CONST char **)NULL, 0) != TCL_OK) {
+ DestroyEntry(entryPtr);
+ return NULL;
+ }
+@@ -3309,7 +3309,7 @@
+ Hierbox *hboxPtr;
+ Entry *entryPtr;
+ int argc;
+- char **argv;
++ CONST char **argv;
+ int flags;
+ {
+ GC newGC;
+@@ -3926,7 +3926,7 @@
+ Hierbox *hboxPtr; /* Information about widget; may or may not
+ * already have values for some fields. */
+ int argc;
+- char **argv;
++ CONST char **argv;
+ int flags;
+ {
+ XGCValues gcValues;
+@@ -5493,7 +5493,7 @@
+ Hierbox *hboxPtr;
+ Tcl_Interp *interp;
+ int argc;
+- char **argv;
++ CONST char **argv;
+ {
+ /* Figure out where the option value pairs begin */
+ argc -= 3;
+@@ -5829,7 +5829,7 @@
+ char **argv;
+ {
+ int nIds, nOpts;
+- char **options;
++ CONST char **options;
+ register int i;
+ Tree *treePtr;
+
+@@ -5847,7 +5847,7 @@
+ }
+ nIds = i; /* Number of element names specified */
+ nOpts = argc - i; /* Number of options specified */
+- options = argv + i; /* Start of options in argv */
++ options = (CONST char **)argv + i; /* Start of options in argv */
+
+ for (i = 0; i < nIds; i++) {
+ StringToNode(hboxPtr, argv[i], &treePtr);
+@@ -7204,7 +7204,7 @@
+ Tcl_DString dString;
+ register int i, l;
+ int nOpts;
+- char **options;
++ CONST char **options;
+ char **nameArr;
+
+ rootPtr = hboxPtr->rootPtr;
+@@ -7230,7 +7230,7 @@
+ }
+ }
+ nOpts = argc - count;
+- options = argv + count;
++ options = (CONST char **)argv + count;
+
+ Tcl_DStringInit(&dString);
+ for (i = 0; i < count; i++) {
+--- a/generic/bltHtext.c
++++ b/generic/bltHtext.c
+@@ -3948,7 +3948,7 @@
+ HText *htPtr; /* Hypertext widget */
+ Tcl_Interp *interp; /* Interpreter associated with widget */
+ int argc; /* Number of arguments. */
+- char **argv; /* Argument strings. */
++ CONST char **argv; /* Argument strings. */
+ {
+ Line *linePtr;
+ EmbeddedWidget *winPtr;
+@@ -4092,7 +4092,7 @@
+ HText *htPtr;
+ Tcl_Interp *interp;
+ int argc;
+- char **argv;
++ CONST char **argv;
+ {
+ char *itemPtr;
+ Tk_ConfigSpec *specsPtr;
+@@ -4531,7 +4531,7 @@
+ Itk_SetWidgetCommand(htPtr->tkwin, htPtr->cmdToken);
+ #endif
+ if ((Blt_ConfigureWidget(interp, htPtr->tkwin, configSpecs, argc - 2,
+- argv + 2, (char *)htPtr, 0) != TCL_OK) ||
++ (CONST char **)argv + 2, (char *)htPtr, 0) != TCL_OK) ||
+ (ConfigureText(interp, htPtr) != TCL_OK)) {
+ Tk_DestroyWindow(htPtr->tkwin);
+ return TCL_ERROR;
+--- a/generic/bltTable.c
++++ b/generic/bltTable.c
+@@ -1181,7 +1181,7 @@
+ Tcl_Interp *interp;
+ Entry *entryPtr;
+ int argc; /* Option-value arguments */
+- char **argv;
++ CONST char **argv;
+ {
+ int oldRowSpan, oldColSpan;
+
+@@ -1533,7 +1533,7 @@
+ PartitionInfo *infoPtr;
+ char *pattern;
+ int argc;
+- char **argv;
++ CONST char **argv;
+ {
+ RowColumn *rcPtr;
+ register Blt_ChainLink *linkPtr;
+@@ -1852,7 +1852,7 @@
+ Table *tablePtr; /* Table to be configured */
+ Tcl_Interp *interp; /* Interpreter to report results back to */
+ int argc;
+- char **argv; /* Option-value pairs */
++ CONST char **argv; /* Option-value pairs */
+ {
+ if (argc == 0) {
+ return Tk_ConfigureInfo(interp, tablePtr->tkwin, tableConfigSpecs,
+@@ -2179,7 +2179,7 @@
+ Tk_Window tkwin;
+ int row, column;
+ int argc;
+- char **argv;
++ CONST char **argv;
+ {
+ Entry *entryPtr;
+ int result = TCL_OK;
+--- a/generic/bltTabnotebook.c
++++ b/generic/bltTabnotebook.c
+@@ -2758,7 +2758,7 @@
+ * may not already have values for
+ * some fields. */
+ int argc;
+- char **argv;
++ CONST char **argv;
+ int flags;
+ {
+ XGCValues gcValues;
+@@ -3155,7 +3155,7 @@
+ Notebook *nbPtr;
+ Tcl_Interp *interp;
+ int argc; /* Not used. */
+- char **argv;
++ CONST char **argv;
+ {
+ Tab *tabPtr;
+ Blt_ChainLink *linkPtr, *beforeLinkPtr;
+@@ -3193,7 +3193,7 @@
+ }
+ lastNotebookInstance = nbPtr;
+ if (Blt_ConfigureWidgetComponent(interp, nbPtr->tkwin, tabPtr->name,
+- "Tab", tabConfigSpecs, argc - 3, argv + 3, (char *)tabPtr, 0)
++ "Tab", tabConfigSpecs, argc - 3, (char **)argv + 3, (char *)tabPtr, 0)
+ != TCL_OK) {
+ DestroyTab(nbPtr, tabPtr);
+ return TCL_ERROR;
+@@ -3658,10 +3658,10 @@
+ Notebook *nbPtr;
+ Tcl_Interp *interp;
+ int argc;
+- char **argv;
++ CONST char **argv;
+ {
+ int nTabs, nOpts, result;
+- char **options;
++ CONST char **options;
+ register int i;
+ Tab *tabPtr;
+
+--- a/generic/bltTabset.c
++++ b/generic/bltTabset.c
+@@ -3154,7 +3154,7 @@
+ * may not already have values for
+ * some fields. */
+ int argc,
+- char **argv,
++ CONST char **argv,
+ int flags)
+ {
+ XGCValues gcValues;
+@@ -3404,7 +3404,7 @@
+ Tabset *setPtr,
+ Tcl_Interp *interp,
+ int argc,
+- char **argv)
++ CONST char **argv)
+ {
+ tabSet = setPtr;
+ if (argc == 2) {
+@@ -3665,7 +3665,7 @@
+ } else {
+ Tab *beforePtr;
+
+- if (GetTabByIndName(setPtr, argv[2], &beforePtr)
++ if (GetTabByIndName(setPtr, (char *)argv[2], &beforePtr)
+ != TCL_OK) {
+ result = TCL_ERROR;
+ goto finish;
+@@ -4415,10 +4415,10 @@
+ Tabset *setPtr;
+ Tcl_Interp *interp;
+ int argc;
+- char **argv;
++ CONST char **argv;
+ {
+ int nTabs, nOpts, result;
+- char **options;
++ CONST char **options;
+ register int i;
+ Tab *tabPtr;
+
+@@ -6844,7 +6844,7 @@
+ return TCL_ERROR;
+ }
+ setPtr = CreateTabset(interp, tkwin);
+- if (ConfigureTabset(interp, setPtr, argc - 2, argv + 2, 0) != TCL_OK) {
++ if (ConfigureTabset(interp, setPtr, argc - 2, (CONST char **)argv + 2, 0) != TCL_OK) {
+ Tk_DestroyWindow(setPtr->tkwin);
+ return TCL_ERROR;
+ }
+--- a/generic/bltTreeViewCmd.c
++++ b/generic/bltTreeViewCmd.c
+@@ -5186,8 +5186,8 @@
+ char *string, *subPath;
+ int nLen, idx, useid, oLen;
+ int sobjc, tobjc;
+- Tcl_Obj *CONST *sobjv;
+- Tcl_Obj *CONST *tobjv;
++ Tcl_Obj **sobjv;
++ Tcl_Obj **tobjv;
+ TreeViewStyle *stylePtr;
+ TreeViewColumn *columnPtr;
+ TreeViewEntry *entryPtr;
+--- a/generic/bltUnixDnd.c
++++ b/generic/bltUnixDnd.c
+@@ -620,7 +620,7 @@
+ static void DestroyDnd _ANSI_ARGS_((DestroyData data));
+ static int DndEventProc _ANSI_ARGS_((ClientData clientData, XEvent *eventPtr));
+ static int ConfigureToken _ANSI_ARGS_((Tcl_Interp *interp, Dnd *dndPtr,
+- int argc, char **argv, int flags));
++ int argc, CONST char **argv, int flags));
+
+ static Winfo *OverTarget _ANSI_ARGS_((Dnd *dndPtr));
+ static void AddTargetProperty _ANSI_ARGS_((Dnd *dndPtr));
+@@ -1825,7 +1825,7 @@
+ Tcl_Interp *interp; /* current interpreter */
+ Dnd *dndPtr; /* Drag&drop source widget record */
+ int argc; /* number of arguments */
+- char **argv; /* argument strings */
++ CONST char **argv; /* argument strings */
+ int flags; /* flags controlling interpretation */
+ {
+ GC newGC;
+@@ -3761,12 +3761,12 @@
+ ClientData clientData; /* Thread-specific data. */
+ Tcl_Interp *interp; /* current interpreter */
+ int argc; /* number of arguments */
+- char **argv; /* argument strings */
++ CONST char **argv; /* argument strings */
+ {
+ Dnd *dndPtr;
+ int flags;
+
+- if (GetDnd(clientData, interp, argv[2], &dndPtr) != TCL_OK) {
++ if (GetDnd(clientData, interp, (char *)argv[2], &dndPtr) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ flags = TK_CONFIG_ARGV_ONLY;
+@@ -4418,7 +4418,7 @@
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+- char **argv;
++ CONST char **argv;
+ {
+ DndInterpData *dataPtr = clientData;
+ Tk_Window tkwin;
+@@ -4462,12 +4462,12 @@
+ ClientData clientData; /* Thread-specific data. */
+ Tcl_Interp *interp;
+ int argc;
+- char **argv;
++ CONST char **argv;
+ {
+ Dnd *dndPtr;
+ int flags;
+
+- if (GetDnd(clientData, interp, argv[3], &dndPtr) != TCL_OK) {
++ if (GetDnd(clientData, interp, (char *)argv[3], &dndPtr) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ flags = 0;
+@@ -4529,13 +4529,13 @@
+ ClientData clientData; /* Thread-specific data. */
+ Tcl_Interp *interp;
+ int argc;
+- char **argv;
++ CONST char **argv;
+ {
+ Token *tokenPtr;
+ Dnd *dndPtr;
+ int flags;
+
+- if (GetDnd(clientData, interp, argv[3], &dndPtr) != TCL_OK) {
++ if (GetDnd(clientData, interp, (char *)argv[3], &dndPtr) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ flags = TK_CONFIG_ARGV_ONLY;
+--- a/generic/tkButton.c
++++ b/generic/tkButton.c
+@@ -855,7 +855,7 @@
+ Tcl_Interp *interp, int argc, char **argv));
+ static void ComputeButtonGeometry _ANSI_ARGS_((Button *butPtr));
+ static int ConfigureButton _ANSI_ARGS_((Tcl_Interp *interp,
+- Button *butPtr, int argc, char **argv,
++ Button *butPtr, int argc, CONST char **argv,
+ int flags));
+ static void DestroyButton _ANSI_ARGS_((Button *butPtr));
+ static void DisplayButton _ANSI_ARGS_((ClientData clientData));
+@@ -1305,7 +1305,7 @@
+ Tk_CreateEventHandler(butPtr->tkwin,
+ ExposureMask | StructureNotifyMask | FocusChangeMask,
+ ButtonEventProc, butPtr);
+- if (ConfigureButton(interp, butPtr, argc - 2, argv + 2,
++ if (ConfigureButton(interp, butPtr, argc - 2, (CONST char **)argv + 2,
+ configFlags[type]) != TCL_OK) {
+ Tk_DestroyWindow(butPtr->tkwin);
+ return TCL_ERROR;
+@@ -1337,7 +1337,7 @@
+ value = Tcl_GetString(valuePtr);
+ }
+ }
+- return value;
++ return (char *)value;
+ }
+
+ static int ButtonSetValue(Button *butPtr, char *value, int warn) {
+@@ -1427,7 +1427,7 @@
+ (char *)butPtr, argv[2],
+ configFlags[butPtr->type]);
+ } else {
+- result = ConfigureButton(interp, butPtr, argc - 2, argv + 2,
++ result = ConfigureButton(interp, butPtr, argc - 2, (CONST char **)argv + 2,
+ configFlags[butPtr->type] | TK_CONFIG_ARGV_ONLY);
+ }
+ } else if ((c == 'd') && (strncmp(argv[1], "deselect", length) == 0)
+@@ -1694,7 +1694,7 @@
+ register Button *butPtr; /* Information about widget; may or may
+ * not already have values for some fields. */
+ int argc; /* Number of valid entries in argv. */
+- char **argv; /* Arguments. */
++ CONST char **argv; /* Arguments. */
+ int flags; /* Flags to pass to Tk_ConfigureWidget. */
+ {
+ XGCValues gcValues;
+--- a/generic/tkFrame.c
++++ b/generic/tkFrame.c
+@@ -734,7 +734,7 @@
+ #endif /* TK_MAJOR_VERSION > 4 */
+
+ if (Tk_ConfigureWidget(interp, framePtr->tkwin, configSpecs,
+- argc, argv, (char *)framePtr, flags | framePtr->mask) != TCL_OK) {
++ argc, (CONST char **)argv, (char *)framePtr, flags | framePtr->mask) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (framePtr->tile != NULL) {
+--- a/generic/bltScrollbar.c
++++ b/generic/bltScrollbar.c
+@@ -301,7 +301,7 @@
+ static void ComputeScrollbarGeometry _ANSI_ARGS_((
+ Scrollbar *scrollPtr));
+ static int ConfigureScrollbar _ANSI_ARGS_((Tcl_Interp *interp,
+- Scrollbar *scrollPtr, int argc, char **argv,
++ Scrollbar *scrollPtr, int argc, CONST char **argv,
+ int flags));
+ static void DestroyScrollbar _ANSI_ARGS_((DestroyData *memPtr));
+ static void DisplayScrollbar _ANSI_ARGS_((ClientData clientData));
+@@ -434,7 +434,7 @@
+ Tk_CreateEventHandler(scrollPtr->tkwin,
+ ExposureMask | StructureNotifyMask | FocusChangeMask,
+ ScrollbarEventProc, (ClientData)scrollPtr);
+- if (ConfigureScrollbar(interp, scrollPtr, argc - 2, argv + 2, 0) != TCL_OK) {
++ if (ConfigureScrollbar(interp, scrollPtr, argc - 2, (CONST char **)argv + 2, 0) != TCL_OK) {
+ goto error;
+ }
+ Tcl_SetResult(interp, Tk_PathName(scrollPtr->tkwin), TCL_VOLATILE);
+@@ -558,7 +558,7 @@
+ result = Tk_ConfigureInfo(interp, scrollPtr->tkwin, configSpecs,
+ (char *)scrollPtr, argv[2], 0);
+ } else {
+- result = ConfigureScrollbar(interp, scrollPtr, argc - 2, argv + 2,
++ result = ConfigureScrollbar(interp, scrollPtr, argc - 2, (CONST char **)argv + 2,
+ TK_CONFIG_ARGV_ONLY);
+ }
+ } else if ((c == 'd') && (strncmp(argv[1], "delta", length) == 0)) {
+@@ -904,7 +904,7 @@
+ * may not already have values for
+ * some fields. */
+ int argc; /* Number of valid entries in argv. */
+- char **argv; /* Arguments. */
++ CONST char **argv; /* Arguments. */
+ int flags; /* Flags to pass to
+ * Tk_ConfigureWidget. */
+ {
+--- a/generic/bltTed.c
++++ b/generic/bltTed.c
+@@ -819,7 +819,7 @@
+ ConfigureTed(tedPtr, argc, argv, flags)
+ Ted *tedPtr;
+ int argc;
+- char **argv; /* Option-value pairs */
++ CONST char **argv; /* Option-value pairs */
+ int flags;
+ {
+ XGCValues gcValues;
diff --git a/graphics/tclblt/patches/decls.patch b/graphics/tclblt/patches/decls.patch
new file mode 100644
index 0000000000..52d4acfe48
--- /dev/null
+++ b/graphics/tclblt/patches/decls.patch
@@ -0,0 +1,42 @@
+Description: Patch fixes BLT stubs declarations.
+Author: FreeBSD BLT port maintainers, modified by Sergei Golovan
+Last-Modified: Tue, 08 Jul 2014 11:28:55 +0400
+
+--- a/generic/bltDecls.h
++++ b/generic/bltDecls.h
+@@ -532,7 +532,7 @@
+
+ Blt_TreeKey (*blt_TreeGetKey) _ANSI_ARGS_((CONST char * string)); /* 0 */
+ Blt_TreeNode (*blt_TreeCreateNode) _ANSI_ARGS_((Blt_Tree tree, Blt_TreeNode parent, CONST char * name, int position)); /* 1 */
+- Blt_TreeNode (*blt_TreeCreateNodeWithId) _ANSI_ARGS_((Blt_Tree tree, Blt_TreeNode parent, CONST char * name, int position, int inode)); /* 2 */
++ Blt_TreeNode (*blt_TreeCreateNodeWithId) _ANSI_ARGS_((Blt_Tree tree, Blt_TreeNode parent, CONST char * name, unsigned int inode, int position)); /* 2 */
+ int (*blt_TreeDeleteNode) _ANSI_ARGS_((Blt_Tree tree, Blt_TreeNode node)); /* 3 */
+ int (*blt_TreeMoveNode) _ANSI_ARGS_((Blt_Tree tree, Blt_TreeNode node, Blt_TreeNode parent, Blt_TreeNode before)); /* 4 */
+ Blt_TreeNode (*blt_TreeGetNode) _ANSI_ARGS_((Blt_Tree tree, unsigned int inode)); /* 5 */
+@@ -558,7 +558,7 @@
+ int (*blt_TreeSetArrayValue) _ANSI_ARGS_((Tcl_Interp * interp, Blt_Tree tree, Blt_TreeNode node, CONST char * arrayName, CONST char * elemName, Tcl_Obj * valueObjPtr)); /* 25 */
+ int (*blt_TreeUnsetArrayValue) _ANSI_ARGS_((Tcl_Interp * interp, Blt_Tree tree, Blt_TreeNode node, CONST char * arrayName, CONST char * elemName)); /* 26 */
+ int (*blt_TreeArrayValueExists) _ANSI_ARGS_((Blt_Tree tree, Blt_TreeNode node, CONST char * arrayName, CONST char * elemName)); /* 27 */
+- int (*blt_TreeArrayNames) _ANSI_ARGS_((Tcl_Interp * interp, Blt_Tree tree, Blt_TreeNode node, CONST char * arrayName, Tcl_Obj * listObjPtr)); /* 28 */
++ int (*blt_TreeArrayNames) _ANSI_ARGS_((Tcl_Interp * interp, Blt_Tree tree, Blt_TreeNode node, CONST char * arrayName, Tcl_Obj * listObjPtr, CONST char * pattern)); /* 28 */
+ int (*blt_TreeGetValueByKey) _ANSI_ARGS_((Tcl_Interp * interp, Blt_Tree tree, Blt_TreeNode node, Blt_TreeKey key, Tcl_Obj ** valuePtr)); /* 29 */
+ int (*blt_TreeSetValueByKey) _ANSI_ARGS_((Tcl_Interp * interp, Blt_Tree tree, Blt_TreeNode node, Blt_TreeKey key, Tcl_Obj * valuePtr)); /* 30 */
+ int (*blt_TreeUnsetValueByKey) _ANSI_ARGS_((Tcl_Interp * interp, Blt_Tree tree, Blt_TreeNode node, Blt_TreeKey key)); /* 31 */
+@@ -578,13 +578,13 @@
+ void (*blt_TreeDeleteTrace) _ANSI_ARGS_((Blt_TreeTrace token)); /* 45 */
+ void (*blt_TreeCreateEventHandler) _ANSI_ARGS_((Blt_Tree tree, unsigned int mask, Blt_TreeNotifyEventProc * proc, ClientData clientData)); /* 46 */
+ void (*blt_TreeDeleteEventHandler) _ANSI_ARGS_((Blt_Tree tree, unsigned int mask, Blt_TreeNotifyEventProc * proc, ClientData clientData)); /* 47 */
+- void (*blt_TreeRelabelNode) _ANSI_ARGS_((Blt_Tree tree, Blt_TreeNode node, CONST char * string)); /* 48 */
+- void (*blt_TreeRelabelNode2) _ANSI_ARGS_((Blt_TreeNode node, CONST char * string)); /* 49 */
++ int (*blt_TreeRelabelNode) _ANSI_ARGS_((Blt_Tree tree, Blt_TreeNode node, CONST char * string)); /* 48 */
++ int (*blt_TreeRelabelNode2) _ANSI_ARGS_((Blt_TreeNode node, CONST char * string)); /* 49 */
+ char * (*blt_TreeNodePath) _ANSI_ARGS_((Blt_TreeNode node, Tcl_DString * resultPtr)); /* 50 */
+ int (*blt_TreeNodePosition) _ANSI_ARGS_((Blt_TreeNode node)); /* 51 */
+ void (*blt_TreeClearTags) _ANSI_ARGS_((Blt_Tree tree, Blt_TreeNode node)); /* 52 */
+- void (*blt_TreeAddTag) _ANSI_ARGS_((Blt_Tree tree, Blt_TreeNode node, CONST char * tagName)); /* 53 */
+- void (*blt_TreeForgetTag) _ANSI_ARGS_((Blt_Tree tree, CONST char * tagName)); /* 54 */
++ int (*blt_TreeAddTag) _ANSI_ARGS_((Blt_Tree tree, Blt_TreeNode node, CONST char * tagName)); /* 53 */
++ int (*blt_TreeForgetTag) _ANSI_ARGS_((Blt_Tree tree, CONST char * tagName)); /* 54 */
+ int (*blt_TreeTagTableIsShared) _ANSI_ARGS_((Blt_Tree tree)); /* 55 */
+ int (*blt_TreeShareTagTable) _ANSI_ARGS_((Blt_Tree src, Blt_Tree target)); /* 56 */
+ Blt_HashEntry * (*blt_TreeFirstTag) _ANSI_ARGS_((Blt_Tree tree, Blt_HashSearch * searchPtr)); /* 57 */
diff --git a/graphics/tclblt/patches/doc-typos.patch b/graphics/tclblt/patches/doc-typos.patch
new file mode 100644
index 0000000000..2f233311f4
--- /dev/null
+++ b/graphics/tclblt/patches/doc-typos.patch
@@ -0,0 +1,407 @@
+Description: Documentation fixes
+ Corrections in spelling in the blt documentation.
+Author: Paul E. Johnson (Debian Packaging) <pauljohn32@freefaculty.org>
+
+--- a/man/barchart.mann
++++ b/man/barchart.mann
+@@ -1954,7 +1954,7 @@
+ .TP
+ \fB\-fill \fIcolor\fR
+ Sets the background color of the line. This color is used with
+-striped lines (see the \fB\-fdashes\R option). If \fIcolor\fR is
++striped lines (see the \fB\-fdashes\fR option). If \fIcolor\fR is
+ the empty string, no background color is drawn (the line will be
+ dashed, not striped). The default background color is \fB""\fR.
+ .TP
+--- a/man/tree.mann
++++ b/man/tree.mann
+@@ -393,7 +393,7 @@
+ Reverse the direction of the copy.
+ .TP
+ \fB\-tags\fR
+-Copy tag inforation. Normally the following node is copied: its
++Copy tag information. Normally the following node is copied: its
+ label and data fields. This indicates to copy tags as well.
+ .RE
+ .TP
+@@ -1804,7 +1804,7 @@
+ set nams {}
+ set vals {}
+ foreach nam $s(*) {
+- lappend vals \$s($nam)
++ lappend vals $s($nam)
+ lappend nams $nam
+ }
+ set vals [join $vals ,]
+--- a/man/bitmap.mann
++++ b/man/bitmap.mann
+@@ -82,9 +82,9 @@
+ Tk will recognize "gray1" as a bitmap which can now be used with any
+ widget that accepts bitmaps.
+ .CS
+-.barchart element configure elem1 -stipple gray1
++\&.barchart element configure elem1 -stipple gray1
+ .CE
+-The bitmap data can be specified in a mulitude of forms.
++The bitmap data can be specified in a multitude of forms.
+ The following commands are all equivalent.
+ .CS
+ bitmap define gray1 {
+--- a/man/eps.mann
++++ b/man/eps.mann
+@@ -55,7 +55,7 @@
+ .DE
+ The \fBeps\fR item creates a new canvas item. \fICanvas\fR is the name
+ of a \fBcanvas\fR widget. You must supply the X-Y coordinate of
+-the new eps item. How the coordinate is exactly interpretered is
++the new eps item. How the coordinate is exactly interpreted is
+ controlled by the \fB\-anchor\fR option (see below).
+ .PP
+ Additional options may be specified on the command line to configure
+--- a/man/tabset.mann
++++ b/man/tabset.mann
+@@ -86,7 +86,7 @@
+ tabs and the sizes of the Tk widgets embedded inside each folder.
+ The widest widget determines the width of the folder. The tallest
+ determines the height. If no folders contain an embedded widget, the
+-size is detemined solely by the size of the tabs.
++size is determined solely by the size of the tabs.
+ .PP
+ You can override either dimension with the tabset's \fB\-width\fR
+ and \fB\-height\fR options.
+@@ -767,7 +767,7 @@
+ \fBcenter\fR.
+ .TP
+ \fB\-background \fIcolor\fR
+-Sets the background color for \fInameOrIndex\fR. Setting this option overides the
++Sets the background color for \fInameOrIndex\fR. Setting this option overrides the
+ widget's \fB\-tabbackground\fR option.
+ .TP
+ \fB\-bindtags \fItagList\fR
+--- a/man/hiertable.mann
++++ b/man/hiertable.mann
+@@ -1395,7 +1395,7 @@
+ The default is \fBsingle\fR.
+ .TP
+ \fB\-separator \fIstring\fR
+-Specifies the character sequence to use when spliting the path components.
++Specifies the character sequence to use when splitting the path components.
+ The separator may be several characters wide (such as "::")
+ Consecutive separators in a pathname are treated as one.
+ If \fIstring\fR is the empty string, the pathnames are Tcl lists.
+--- a/man/treeview.mann
++++ b/man/treeview.mann
+@@ -2037,7 +2037,7 @@
+ Set a tile background image to use for selection.
+ .TP
+ \fB\-separator \fIstring\fR
+-Specifies the character sequence to use when spliting the path components.
++Specifies the character sequence to use when splitting the path components.
+ The separator may be several characters wide (such as "::")
+ Consecutive separators in a pathname are treated as one.
+ If \fIstring\fR is the empty string, the pathnames are Tcl lists.
+--- a/man/hierbox.mann
++++ b/man/hierbox.mann
+@@ -1395,7 +1395,7 @@
+ The default is \fBsingle\fR.
+ .TP
+ \fB\-separator \fIstring\fR
+-Specifies the character sequence to use when spliting the path components.
++Specifies the character sequence to use when splitting the path components.
+ The separator may be several characters wide (such as "::")
+ Consecutive separators in a pathname are treated as one.
+ If \fIstring\fR is the empty string, the pathnames are Tcl lists.
+--- a/man/container.mann
++++ b/man/container.mann
+@@ -187,7 +187,7 @@
+ tabs and the sizes of the Tk widgets embedded inside each folder.
+ The widest widget determines the width of the folder. The tallest
+ determines the height. If no folders contain an embedded widget, the
+-size is detemined solely by the size of the tabs.
++size is determined solely by the size of the tabs.
+ .PP
+ You can override either dimension with the container's \fB\-width\fR
+ and \fB\-height\fR options.
+--- a/html/eps.html
++++ b/html/eps.html
+@@ -15,10 +15,10 @@
+ create eps <I>x y </I></B></I>?<I>option value</I>?...
+ <H2><A NAME="sect2" HREF="#toc2">Description</A></H2>
+ The <B>eps</B> canvas item lets you place
+-encapulated PostScript (EPS) on a canvas, controlling its size and placement.
++encapsulated PostScript (EPS) on a canvas, controlling its size and placement.
+ The EPS item is displayed either as a solid rectangle or a preview image.
+ The preview image is designated in one of two ways: 1) the EPS file contains
+-an ASCII hexidecimal preview, or 2) a Tk photo image. When the canvas generates
++an ASCII hexadecimal preview, or 2) a Tk photo image. When the canvas generates
+ PostScript output, the EPS will be inserted with the proper translation
+ and scaling to match that of the EPS item. So can use the canvas widget
+ as a page layout tool.
+@@ -39,7 +39,7 @@
+ <CODE><I>canvas <B>create eps <I>x y </I></B></I>?<I>option value</I>?...<BR>
+ </CODE><P>The <B>eps</B> item creates a new canvas item. <I>Canvas</I> is the name of a <B>canvas</B> widget.
+ You must supply the X-Y coordinate of the new eps item. How the coordinate
+-is exactly interpretered is controlled by the <B>-anchor</B> option (see below).
++is exactly interpreted is controlled by the <B>-anchor</B> option (see below).
+ <P>
+ Additional options may be specified on the command line to configure aspects
+ of the eps item such as its color, stipple, and font. The following <I>option</I>
+--- a/html/container.html
++++ b/html/container.html
+@@ -136,7 +136,7 @@
+ size of the container window is determined the number of tiers of tabs
+ and the sizes of the Tk widgets embedded inside each folder. The widest
+ widget determines the width of the folder. The tallest determines the height.
+- If no folders contain an embedded widget, the size is detemined solely
++ If no folders contain an embedded widget, the size is determined solely
+ by the size of the tabs. <P>
+ You can override either dimension with the container's
+ <B>-width</B> and <B>-height</B> options.
+--- a/html/hierbox.html
++++ b/html/hierbox.html
+@@ -1446,7 +1446,7 @@
+
+ <DT><B>-separator <I>string</I></B> </DT>
+ <DD>Specifies the character sequence
+-to use when spliting the path components. The separator may be several
++to use when splitting the path components. The separator may be several
+ characters wide (such as "::") Consecutive separators in a pathname are
+ treated as one. If <I>string</I> is the empty string, the pathnames are Tcl lists.
+ Each element is a path component. The default is <I>""</I>. </DD>
+--- a/html/bitmap.html
++++ b/html/bitmap.html
+@@ -58,7 +58,8 @@
+ label .l -bitmap gray1<BR>
+ </CODE><P>Tk will recognize "gray1" as a bitmap which can now be used with any widget
+ that accepts bitmaps. <BR>
+-<CODE></CODE><P>The bitmap data can be specified in a mulitude of forms. The following commands
++<CODE>.barchart element configure elem1 -stipple gray1<BR>
++</CODE><P>The bitmap data can be specified in a multitude of forms. The following commands
+ are all equivalent. <BR>
+ <CODE>bitmap define gray1 {<BR>
+ #define gray1_width 2<BR>
+@@ -128,7 +129,7 @@
+ <DD>Specifies the scale of
+ the bitmap. <I>Value</I> is a real number representing the scale. A scale of 1.0
+ indicates no scaling is necessary, while 2.0 would double the size of the
+-bitmap. There is no way to specify differents scales for the width and
++bitmap. There is no way to specify different scales for the width and
+ height of the bitmap. The default scale is <I>1.0</I>. </DD>
+ </DL>
+ </blockquote>
+@@ -161,7 +162,7 @@
+ <DT><B>-scale <I>value</I></B> </DT>
+ <DD>Specifies how to scale the bitmap. <I>Value</I> is a real number representing
+ the scale. A scale of 1.0 indicates no scaling is necessary, while 2.0 would
+-double the size of the bitmap. There is no way to specify differents scales
++double the size of the bitmap. There is no way to specify different scales
+ for the width and height of the bitmap. The default scale is <I>1.0</I>. </DD>
+ </DL>
+ </blockquote>
+--- a/html/tree.html
++++ b/html/tree.html
+@@ -641,7 +641,7 @@
+ <P><DT><A NAME="M55"><B>-reverse</B></A><DD>
+ Reverse the direction of the copy.
+ <P><DT><A NAME="M56"><B>-tags</B></A><DD>
+-Copy tag inforation. Normally the following node is copied: its
++Copy tag information. Normally the following node is copied: its
+ label and data fields. This indicates to copy tags as well.
+ <P></DL>
+ <P><DT><A NAME="M57"><I>treeName</I> <B>create</B> ?<I>switches</I>?</A><DD>
+@@ -870,7 +870,7 @@
+ <P>
+ <DL class="tree operations">
+ <DT><A NAME="M120"><B>breadthfirst</B></A><DD>
+-Process the node and the subtrees at each sucessive level. Each node
++Process the node and the subtrees at each successive level. Each node
+ on a level is processed before going to the next level.
+ <P><DT><A NAME="M121"><B>inorder</B></A><DD>
+ Recursively process the nodes of the first subtree, the node itself,
+@@ -1587,7 +1587,7 @@
+ indicating the operations that are traced (it's in the same
+ form as <I>ops</I>) and, the command prefix.
+ <P><DT><A NAME="M267"><I>treeName</I> <B>trace names</B></A><DD>
+-Returns a list of identifers for all the current traces.
++Returns a list of identifiers for all the current traces.
+ <P></DL>
+ <H3><A NAME="M268">NOTIFY OPERATIONS</A></H3>
+ Tree objects can be shared among many clients, such as a
+@@ -1672,7 +1672,7 @@
+ It consists of the notify id, a sublist of event flags (it's in the same
+ form as <I>flags</I>) and, the command prefix.
+ <P><DT><A NAME="M283"><I>treeName</I> <B>notify names</B></A><DD>
+-Returns a list of identifers for all the current notifiers.
++Returns a list of identifiers for all the current notifiers.
+
+ <P></DL>
+ <H3><A NAME="M284">TABLE EXAMPLE</A></H3>
+--- a/html/spline.html
++++ b/html/spline.html
+@@ -32,7 +32,7 @@
+ curve. Spline interpolation is the mathematical equivalent. The curves
+ between adjacent knots are piecewise functions such that the resulting
+ spline runs exactly through all the knots. The order and coefficients of
+-the polynominal determine the "looseness" or "tightness" of the curve fit
++the polynomial determine the "looseness" or "tightness" of the curve fit
+ from the line segments formed by the knots. <P>
+ The <B>spline</B> command performs
+ spline interpolation using cubic ("natural") or quadratic polynomial functions.
+@@ -87,7 +87,7 @@
+ .graph element create spline -x sx -y sy -color red<BR>
+ table . .graph<BR>
+ </CODE><P>The <B>natural</B> operation employs a cubic interpolant when forming the spline.
+- In terms of the draftmen's spline, a <I>natural spline</I> requires the least
++ In terms of the draftsmen's spline, a <I>natural spline</I> requires the least
+ amount of energy to bend the spline (strip of wood), while still passing
+ through each knot. In mathematical terms, the second derivatives of the
+ first and last points are zero. <P>
+@@ -139,7 +139,7 @@
+ by D.F.Mcallister &amp; J.A.Roulier
+ Coded by S.L.Dodd &amp; M.Roulier N.C.State University.
+
+-</PRE>The original code for the quadratric spline can be found in TOMS #574.
++</PRE>The original code for the quadratic spline can be found in TOMS #574.
+ <H2><A NAME="sect7" HREF="#toc7">Keywords</A></H2>
+ spline,
+ vector, graph <P>
+--- a/html/bgexec.html
++++ b/html/bgexec.html
+@@ -122,7 +122,7 @@
+ Specifies the encoding of the stderr channel. This affects only data returned
+ to the Tcl interpreter. No translation is done on file redirection. <BR>
+ For example if data is to be converted from Unicode for use in Tcl, you
+-would use the "unicode" encoding. The default is that no tranlation is
++would use the "unicode" encoding. The default is that no translation is
+ performed. </DD>
+
+ <DT><B>-decodeoutput <I>encodingName</I></B> </DT>
+@@ -130,7 +130,7 @@
+ Specifies the encoding of the stdout channels. This affects only data returned
+ to the Tcl interpreter. No translation is done on file redirection. <BR>
+ For example if data is to be converted from Unicode for use in Tcl, you
+-would use the "unicode" encoding. The default is that no tranlation is
++would use the "unicode" encoding. The default is that no translation is
+ performed. </DD>
+
+ <DT><B>-error <I>varName</I></B> </DT>
+@@ -234,7 +234,7 @@
+ <P>
+ </CODE><P>The biggest advantage of <B>bgexec</B> is that, unlike <B>fileevent</B>, it requires
+ no additional Tcl code to run a program. It's simpler and less error prone.
+- You don't have to worry about non-blocking I/O. It's handled tranparently
++ You don't have to worry about non-blocking I/O. It's handled transparently
+ for you. <P>
+ <B>Bgexec</B> runs programs that <B>fileevent</B> can not. <B>Fileevent</B> assumes that
+ the when stdout is closed the program has completed. But some programs,
+--- a/html/table.html
++++ b/html/table.html
+@@ -29,7 +29,7 @@
+ <B>table search <I>container</I></B> ?<I>switch arg</I>?...
+ <H2><A NAME="sect2" HREF="#toc2">Description</A></H2>
+ The <B>table</B> command
+-arranges widgets in a table. The alignment of widgets is detemined by their
++arranges widgets in a table. The alignment of widgets is determined by their
+ row and column positions and the number of rows or columns that they span.
+
+ <H2><A NAME="sect3" HREF="#toc3">Introduction</A></H2>
+@@ -241,7 +241,7 @@
+ of a widget. <I>Item</I> can be in any form describe in the <B>configure</B> operation
+ below. If no <I>item</I> argument is provided, then the configuration option is
+ for the table itself. <I>Option</I> may be any one of the options described in
+-the appropiate section for <I>item</I>. </DD>
++the appropriate section for <I>item</I>. </DD>
+
+ <DT><B>table configure</B> <I>container item</I>... ?<I>option
+ value</I>?... </DT>
+--- a/html/tabset.html
++++ b/html/tabset.html
+@@ -241,7 +241,7 @@
+ tabs and the sizes of the Tk widgets embedded inside each folder.
+ The widest widget determines the width of the folder. The tallest
+ determines the height. If no folders contain an embedded widget, the
+-size is detemined solely by the size of the tabs.
++size is determined solely by the size of the tabs.
+ <P>
+ You can override either dimension with the tabset's <B>-width</B>
+ and <B>-height</B> options.
+@@ -762,7 +762,7 @@
+ be aligned with the leftmost edge of the folder. The default value is
+ <B>center</B>.
+ <P><DT><A NAME="M110"><B>-background </B><I>color</I></A><DD>
+-Sets the background color for <I>nameOrIndex</I>. Setting this option overides the
++Sets the background color for <I>nameOrIndex</I>. Setting this option overrides the
+ widget's <B>-tabbackground</B> option.
+ <P><DT><A NAME="M111"><B>-bindtags </B><I>tagList</I></A><DD>
+ Specifies the binding tags for this tab. <I>TagList</I> is a list of
+--- a/html/barchart.html
++++ b/html/barchart.html
+@@ -332,7 +332,7 @@
+
+ <DT><B>-barwidth <I>value</I></B> </DT>
+ <DD>Specifies the width
+-of the bars. This value can be overrided by the individual elements using
++of the bars. This value can be overridden by the individual elements using
+ their <B>-barwidth</B> configuration option. <I>Value</I> is the width in terms of graph
+ coordinates. The default width is <I>1.0</I>. </DD>
+
+--- a/html/winop.html
++++ b/html/winop.html
+@@ -51,7 +51,7 @@
+ <H2><A NAME="sect2" HREF="#toc2">Description</A></H2>
+ The <B>winop</B> command performs various window
+ and image operations on Tk windows using low-level Xlib function calls to
+-work around window manager pecularities.
++work around window manager peculiarities.
+ <H2><A NAME="sect3" HREF="#toc3">Introduction</A></H2>
+ Tk has several commands
+ for manipulating its windows: <B>raise</B>, <B>lower</B>, <B>wm</B>, etc. These commands ask
+--- a/man/stripchart.mann
++++ b/man/stripchart.mann
+@@ -1,3 +1,4 @@
++'\"
+ '\" Copyright 1991-1997 by Bell Labs Innovations for Lucent Technologies.
+ '\"
+ '\" Permission to use, copy, modify, and distribute this software and its
+@@ -2061,7 +2062,7 @@
+ terminates that script and skips any remaining scripts for the event,
+ just as for the bind command.
+ .sp
+-The \fB\-bindtags\R option for these components controls addition
++The \fB\-bindtags\fR option for these components controls addition
+ tag names which can be matched. Implicitly elements and markers
+ always have tags matching their names. Setting the value of
+ the \fB\-bindtags\fR option doesn't change this.
+@@ -2160,9 +2161,8 @@
+ .CS
+ # Works for now.
+ \&.s legend configure -mapped no
+-
+ # Instead use this.
+ \&.s legend configure -hide yes
+-.CE
++.CE
+ .SH KEYWORDS
+ stripchart, graph, widget
+--- a/man/vector.mann
++++ b/man/vector.mann
+@@ -1277,7 +1277,7 @@
+ .CS
+ #include <tcl.h>
+ #include <blt.h>
+-...
++\&...
+ Blt_Vector *vecPtr;
+ double *newArr;
+ FILE *f;
+--- a/man/Blt_TreeGetNode.man3
++++ b/man/Blt_TreeGetNode.man3
+@@ -58,7 +58,7 @@
+ unsigned int number;
+ Blt_TreeNode node;
+ Blt_TreeToken token;
+-...
++\&...
+ node = Blt_TreeGetNode(token, number);
+ if (node == NULL) {
+ printf("no node with ID %d exists\\n", number);
diff --git a/graphics/tclblt/patches/install.patch b/graphics/tclblt/patches/install.patch
new file mode 100644
index 0000000000..6bb211b024
--- /dev/null
+++ b/graphics/tclblt/patches/install.patch
@@ -0,0 +1,166 @@
+Description: Patch fixes installing directories and copying files under
+ INSTALL_ROOT. Also, it adds bltOldConfig.h to the installable headers
+ list and fixes it to include tk.h.
+Author: Chris Waters and Sergei Golovan
+Author: Steve Langasek <vorlon@debian.org>
+Last-Modified: Mon, 31 Aug 2015 12:37:00 -0700
+
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -47,9 +47,9 @@
+ (cd library; $(MAKE) install)
+ (cd man; $(MAKE) install)
+ (cd demos; $(MAKE) install)
+- $(INSTALL_DATA) $(srcdir)/README $(INSTALL_DIR)$(scriptdir)
+- $(INSTALL_DATA) $(srcdir)/PROBLEMS $(INSTALL_DIR)$(scriptdir)
+- $(INSTALL_DATA) $(srcdir)/NEWS $(INSTALL_DIR)$(scriptdir)
++ $(INSTALL_DATA) $(srcdir)/README $(INSTALL_ROOT)$(scriptdir)
++ $(INSTALL_DATA) $(srcdir)/PROBLEMS $(INSTALL_ROOT)$(scriptdir)
++ $(INSTALL_DATA) $(srcdir)/NEWS $(INSTALL_ROOT)$(scriptdir)
+
+ mkdirs:
+ @for i in $(instdirs) ; do \
+@@ -57,7 +57,7 @@
+ : ; \
+ else \
+ echo " mkdir $(INSTALL_ROOT)$$i" ; \
+- mkdir $(INSTALL_ROOT)$$i ; \
++ mkdir -p $(INSTALL_ROOT)$$i ; \
+ fi ; \
+ done
+
+@@ -66,10 +66,14 @@
+ (cd library; $(MAKE) clean)
+ (cd man; $(MAKE) clean)
+ (cd demos; $(MAKE) clean)
+- $(RM) *.bak *\~ "#"* *pure* .pure*
++ $(RM) *.bak *\~ "#"* .pure*
+
+ GENERATED_FILES = \
+ config.status config.cache config.log Makefile
+
+ distclean: clean
++ (cd generic; $(MAKE) distclean)
++ (cd library; $(MAKE) distclean)
++ (cd man; $(MAKE) distclean)
++ (cd demos; $(MAKE) distclean)
+ $(RM) $(GENERATED_FILES)
+--- a/generic/Makefile.in
++++ b/generic/Makefile.in
+@@ -152,6 +152,7 @@
+ $(srcdir)/bltChain.h \
+ bltHash.h \
+ $(srcdir)/bltList.h \
++ $(srcdir)/bltOldConfig.h \
+ $(srcdir)/bltPool.h \
+ $(srcdir)/bltTree.h \
+ $(srcdir)/bltDecls.h \
+@@ -230,7 +231,7 @@
+ : ; \
+ else \
+ echo " mkdir $(INSTALL_ROOT)$$i" ; \
+- mkdir $(INSTALL_ROOT)$$i ; \
++ mkdir -p $(INSTALL_ROOT)$$i ; \
+ fi ; \
+ done
+
+@@ -262,7 +263,8 @@
+
+ distclean: clean
+ $(RM) $(srcdir)/*.bak $(srcdir)/*\~ $(srcdir)/"#"* Makefile
+- $(RM) bltConfig.h Makefile TAGS
++ $(RM) bltConfig.h bltHash.h Makefile TAGS
++ (cd shared; $(MAKE) distclean)
+
+ .c.o:
+ $(CC) -c $(CC_SWITCHES) $<
+--- a/generic/shared/Makefile.in
++++ b/generic/shared/Makefile.in
+@@ -145,14 +145,20 @@
+ $(srcdir)/bltInit.c
+ $(RM) $@
+ $(SHLIB_LD) $(SHLIB_LD_FLAGS) -o $@ bltInit.o $(OBJS) \
+- $(SHLIB_LIB_SPECS)
++ $(LIBS)
++
++# Line above changed for complete dependency listings - gordon
++# $(SHLIB_LIB_SPECS)
+
+ $(tcl_only_lib_so): $(TCL_ONLY_OBJS)
+ $(CC) -c $(CC_SWITCHES) -DTCL_ONLY -DBLT_LIBRARY=\"$(scriptdir)\" \
+ $(srcdir)/bltInit.c
+ $(RM) $@
+ $(SHLIB_LD) $(SHLIB_LD_FLAGS) -o $@ bltInit.o $(TCL_ONLY_OBJS) \
+- $(SHLIB_TCL_ONLY_LIB_SPECS)
++ $(TCL_ONLY_LIB_SPECS)
++
++# Line above changed for complete dependency listings - gordon
++# $(SHLIB_TCL_ONLY_LIB_SPECS)
+
+ install: mkdirs install-lib install-demo
+
+@@ -175,10 +181,10 @@
+ done
+ clean:
+ $(RM) $(OBJS) $(lib_so) $(tcl_only_lib_so) $(bltwish) $(bltsh) \
+- *pure* .pure*
++ *pure* .pure* bltInit.o
+
+ distclean: clean
+- $(RM) $(srcdir)/*.bak $(srcdir)/*\~ $(srcdir)/"#"*
++ $(RM) $(srcdir)/*.bak $(srcdir)/*\~ $(srcdir)/"#"* Makefile
+
+ # ------------------------------------------------------------------------
+ # in lieu of viewpath-ing...
+--- a/demos/Makefile.in
++++ b/demos/Makefile.in
+@@ -79,7 +79,7 @@
+ : ; \
+ else \
+ echo " mkdir $(INSTALL_ROOT)$$i" ; \
+- mkdir $(INSTALL_ROOT)"$$i" ; \
++ mkdir -p $(INSTALL_ROOT)"$$i" ; \
+ fi ; \
+ done
+
+--- a/man/Makefile.in
++++ b/man/Makefile.in
+@@ -52,7 +52,7 @@
+ : ; \
+ else \
+ echo " mkdir $(INSTALL_ROOT)$$i" ; \
+- mkdir $(INSTALL_ROOT)$$i ; \
++ mkdir -p $(INSTALL_ROOT)$$i ; \
+ fi ; \
+ done
+
+--- a/library/Makefile.in
++++ b/library/Makefile.in
+@@ -61,7 +61,7 @@
+ for i in $(miscFiles) ; do \
+ $(INSTALL_DATA) $(srcdir)/$$i $(INSTALL_ROOT)$(scriptdir) ; \
+ done
+- $(INSTALL_DATA) pkgIndex.tcl $(scriptdir)
++ $(INSTALL_DATA) pkgIndex.tcl $(INSTALL_ROOT)$(scriptdir)
+
+ mkdirs:
+ @for i in $(instdirs) ; do \
+@@ -69,7 +69,7 @@
+ : ; \
+ else \
+ echo " mkdir $(INSTALL_ROOT)$$i" ; \
+- mkdir $(INSTALL_ROOT)$$i ; \
++ mkdir -p $(INSTALL_ROOT)$$i ; \
+ fi ; \
+ done
+
+--- a/generic/bltOldConfig.h
++++ b/generic/bltOldConfig.h
+@@ -1,5 +1,7 @@
+ /* Old config headers. */
+
++#include <tk.h>
++
+ EXTERN int Blt_ConfigureInfo _ANSI_ARGS_((Tcl_Interp * interp,
+ Tk_Window tkwin, Tk_ConfigSpec * specs,
+ char * widgRec, CONST char * argvName,
diff --git a/graphics/tclblt/patches/ldflags.patch b/graphics/tclblt/patches/ldflags.patch
new file mode 100644
index 0000000000..f04a9a78f1
--- /dev/null
+++ b/graphics/tclblt/patches/ldflags.patch
@@ -0,0 +1,54 @@
+Description: Patch adds support for externally set LDFLAGS. It lets
+ passing hardening flags from debian/rules. Also, the rpath
+ definition is removed.
+Author: Sergei Golovan
+Last-Modified: Fri, 04 Jul 2014 09:29:39 +0400
+
+--- a/configure.in
++++ b/configure.in
+@@ -1061,7 +1061,7 @@
+ SHLIB_LIB_SPECS="${JPEG_LIB_SPEC}"
+ SHLIB_TCL_ONLY_LIB_SPECS="${TCL_ONLY_LIB_SPECS}"
+ SHLIB_TCL_ONLY_LIB_SPECS=""
+-LDFLAGS=""
++LDFLAGS="${LDFLAGS}"
+ LD_RUN_PATH=""
+ EXTRA_LIB_SPECS=""
+
+@@ -1197,13 +1197,13 @@
+ fi
+ ;;
+
+- *-linux*)
++ *-linux*|*-gnu*)
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD="${CC}"
+ SHLIB_LD_FLAGS='-rdynamic -shared -Wl,-E -Wl,-soname,$@'
+- LD_RUN_PATH="-Wl,-rpath,${loader_run_path}"
++ LD_RUN_PATH=""
+
+- LDFLAGS=""
++ LDFLAGS="${LDFLAGS}"
+ EXTRA_LIB_SPECS="-ldl"
+ ;;
+
+--- a/generic/shared/Makefile.in
++++ b/generic/shared/Makefile.in
+@@ -144,7 +144,7 @@
+ $(CC) -c $(CC_SWITCHES) -DBLT_LIBRARY=\"$(scriptdir)\" \
+ $(srcdir)/bltInit.c
+ $(RM) $@
+- $(SHLIB_LD) $(SHLIB_LD_FLAGS) -o $@ bltInit.o $(OBJS) \
++ $(SHLIB_LD) $(SHLIB_LD_FLAGS) $(LDFLAGS) -o $@ bltInit.o $(OBJS) \
+ $(LIBS)
+
+ # Line above changed for complete dependency listings - gordon
+@@ -154,7 +154,7 @@
+ $(CC) -c $(CC_SWITCHES) -DTCL_ONLY -DBLT_LIBRARY=\"$(scriptdir)\" \
+ $(srcdir)/bltInit.c
+ $(RM) $@
+- $(SHLIB_LD) $(SHLIB_LD_FLAGS) -o $@ bltInit.o $(TCL_ONLY_OBJS) \
++ $(SHLIB_LD) $(SHLIB_LD_FLAGS) $(LDFLAGS) -o $@ bltInit.o $(TCL_ONLY_OBJS) \
+ $(TCL_ONLY_LIB_SPECS)
+
+ # Line above changed for complete dependency listings - gordon
diff --git a/graphics/tclblt/patches/pkgindex.patch b/graphics/tclblt/patches/pkgindex.patch
new file mode 100644
index 0000000000..26407a32b4
--- /dev/null
+++ b/graphics/tclblt/patches/pkgindex.patch
@@ -0,0 +1,108 @@
+Description: Patch fixes loading the libBLT library from
+ [package require BLT]. Specifically, it provides correct version
+ BLT_PATCH_LEVEL and prevents loading the library twice (once
+ by its real name and onr more time by a symlink if the blt-dev
+ package is installed). Also, it skips initializing widget bindings
+ if Tk isn't present.
+Author: Sergei Golovan
+Author: Steve Langasek <vorlon@debian.org>
+Last-Modified: Wed, 21 Mar 2018 10:53:10 +0300
+
+--- a/library/Makefile.in
++++ b/library/Makefile.in
+@@ -5,6 +5,7 @@
+ prefix = @prefix@
+ exec_prefix = @exec_prefix@
+ version = @BLT_VERSION@
++patchlevel = @BLT_PATCH_LEVEL@
+ lib_prefix = @BLT_LIB_PREFIX@
+ srcdir = @srcdir@
+ libdir = @libdir@
+@@ -49,6 +50,7 @@
+ pkgIndex:
+ rm -f pkgIndex.tcl
+ sed -e 's/%VERSION%/$(version)/' $(srcdir)/pkgIndex.tcl.in | \
++ sed -e 's/%PATCHLEVEL%/$(patchlevel)/' | \
+ sed -e 's/%LIB_PREFIX%/$(lib_prefix)/' | \
+ sed -e 's;%LIB_DIR%;$(libdir);' > pkgIndex.tcl
+
+--- a/library/pkgIndex.tcl.in
++++ b/library/pkgIndex.tcl.in
+@@ -7,23 +7,11 @@
+ regsub {\.} $version {} version_no_dots
+ set versuf $version$suffix
+
++ set taillib ${versuf}.[info tclversion]
++
+ # Determine whether to load the full BLT library or
+ # the "lite" tcl-only version.
+
+- if {[package vcompare [info tclversion] 8.2] < 0} {
+- set taillib ${versuf}.8.0
+- } elseif {[package vcompare [info tclversion] 8.3] < 0} {
+- set taillib ${versuf}.8.2
+- } elseif {[package vcompare [info tclversion] 8.4] < 0} {
+- set taillib ${versuf}.8.3
+- } elseif {[package vcompare [info tclversion] 8.5] < 0} {
+- set taillib ${versuf}.8.4
+- } elseif {[package vcompare [info tclversion] 8.6] < 0} {
+- set taillib ${versuf}.8.5
+- } else {
+- set taillib ${versuf}.8.6
+- }
+-
+ if { [info commands tk] == "tk" } {
+ set name1 ${prefix}BLT.${taillib}
+ set name2 ${prefix}BLT${version_no_dots}${suffix}
+@@ -49,11 +37,13 @@
+ }
+ if { ![file exists $library] } continue
+ load $library BLT
++ break
+ }
+ }
+
+ set version "%VERSION%"
++set patchlevel %PATCHLEVEL%
+
+-package ifneeded BLT $version [list LoadBLT25 $version $dir]
++package ifneeded BLT $patchlevel [list LoadBLT25 $version $dir]
+
+ # End of package index file
+--- a/library/init.tcl
++++ b/library/init.tcl
+@@ -8,7 +8,9 @@
+ }
+ }
+
+- initializeLibrary
++ if {[info commands tk] == "tk"} {
++ initializeLibrary
++ }
+
+ }
+
+--- a/configure.in
++++ b/configure.in
+@@ -977,6 +977,13 @@
+
+ BLT_VERSION=${BLT_MAJOR_VERSION}.${BLT_MINOR_VERSION}
+
++AC_MSG_CHECKING([BLT_PATCH_LEVEL])
++AC_CACHE_VAL(blt_cv_patch_level,
++AC_GREP_SYMBOL(blt_cv_patch_level, BLT_PATCH_LEVEL, ${srcdir}/generic/blt.h)
++)
++AC_MSG_RESULT([$blt_cv_patch_level])
++BLT_PATCH_LEVEL=${blt_cv_patch_level}
++
+ # Add BLT to the run path
+ libdir=${exec_prefix}/lib
+
+@@ -1386,6 +1393,7 @@
+ AC_SUBST(DEFINES)
+ AC_SUBST(BLT_MAJOR_VERSION)
+ AC_SUBST(BLT_MINOR_VERSION)
++AC_SUBST(BLT_PATCH_LEVEL)
+ AC_SUBST(BLT_VERSION)
+ AC_SUBST(AUX_LIBS)
+ AC_SUBST(TCL_LIB_DIR)
diff --git a/graphics/tclblt/patches/pointertoint.patch b/graphics/tclblt/patches/pointertoint.patch
new file mode 100644
index 0000000000..7f12465ca9
--- /dev/null
+++ b/graphics/tclblt/patches/pointertoint.patch
@@ -0,0 +1,498 @@
+Description: Patch adds explicit casts to intptr_t or uintptr_t types
+ to prevent casting to/from pointer from/to integers of different size.
+Author: Sergei Golovan
+Last-Modified: Wed, 09 Jul 2014 19:20:07 +0400
+
+--- a/generic/bltBgexec.c
++++ b/generic/bltBgexec.c
+@@ -668,7 +668,7 @@
+ sinkPtr->name = name;
+ sinkPtr->echo = FALSE;
+ sinkPtr->fd = -1;
+- sinkPtr->file = (Tcl_File)NULL;
++ sinkPtr->file = (Tcl_File)0;
+ sinkPtr->byteArr = sinkPtr->staticSpace;
+ sinkPtr->size = DEF_BUFFER_SIZE;
+ sinkPtr->encoding = encoding;
+@@ -726,7 +726,7 @@
+ Blt_Free(sinkPtr->byteArr);
+ }
+ sinkPtr->fd = -1;
+- sinkPtr->file = (Tcl_File)NULL;
++ sinkPtr->file = (Tcl_File)0;
+ #if (TCL_MAJOR_VERSION >= 8)
+ if (sinkPtr->objv != NULL) {
+ register int i;
+@@ -883,7 +883,7 @@
+ #else
+ Tcl_DeleteFileHandler(sinkPtr->fd);
+ #endif
+- sinkPtr->file = (Tcl_File)NULL;
++ sinkPtr->file = (Tcl_File)0;
+ sinkPtr->fd = -1;
+
+ #if WINDEBUG
+--- a/generic/bltTree.c
++++ b/generic/bltTree.c
+@@ -424,7 +424,7 @@
+ TreeDestroyValues(nodePtr);
+ UnlinkNode(nodePtr);
+ treeObjPtr->nNodes--;
+- hPtr = Blt_FindHashEntry(&treeObjPtr->nodeTable, (char *)nodePtr->inode);
++ hPtr = Blt_FindHashEntry(&treeObjPtr->nodeTable, (char *)(intptr_t)nodePtr->inode);
+ assert(hPtr);
+ Blt_DeleteHashEntry(&treeObjPtr->nodeTable, hPtr);
+ nodePtr->inode = -1;
+@@ -934,7 +934,7 @@
+ /* Generate an unique serial number for this node. */
+ do {
+ inode = treeObjPtr->nextInode++;
+- hPtr = Blt_CreateHashEntry(&treeObjPtr->nodeTable,(char *)inode,
++ hPtr = Blt_CreateHashEntry(&treeObjPtr->nodeTable,(char *)(intptr_t)inode,
+ &isNew);
+ } while (!isNew);
+ nodePtr = NewNode(treeObjPtr, name, inode);
+@@ -1030,7 +1030,7 @@
+ int isNew, result;
+
+ treeObjPtr = parentPtr->treeObject;
+- hPtr = Blt_CreateHashEntry(&treeObjPtr->nodeTable,(char *)inode, &isNew);
++ hPtr = Blt_CreateHashEntry(&treeObjPtr->nodeTable,(char *)(intptr_t)inode, &isNew);
+ if (!isNew) {
+ return NULL;
+ }
+@@ -1166,7 +1166,7 @@
+ TreeObject *treeObjPtr = clientPtr->treeObject;
+ Blt_HashEntry *hPtr;
+
+- hPtr = Blt_FindHashEntry(&treeObjPtr->nodeTable, (char *)inode);
++ hPtr = Blt_FindHashEntry(&treeObjPtr->nodeTable, (char *)(intptr_t)inode);
+ if (hPtr != NULL) {
+ return (Blt_TreeNode)Blt_GetHashValue(hPtr);
+ }
+@@ -1179,7 +1179,7 @@
+ {
+ Blt_HashEntry *hPtr;
+
+- hPtr = Blt_FindHashEntry(&treeObjPtr->nodeTable, (char *)inode);
++ hPtr = Blt_FindHashEntry(&treeObjPtr->nodeTable, (char *)(intptr_t)inode);
+ if (hPtr != NULL) {
+ return (Node*)Blt_GetHashValue(hPtr);
+ }
+--- a/generic/bltTreeCmd.c
++++ b/generic/bltTreeCmd.c
+@@ -1641,7 +1641,7 @@
+ if (parentId == -1) { /* Dump marks root's parent as -1. */
+ node = dataPtr->root;
+ /* Create a mapping between the old id and the new node */
+- hPtr = Blt_CreateHashEntry(&dataPtr->idTable, (char *)nodeId,
++ hPtr = Blt_CreateHashEntry(&dataPtr->idTable, (char *)(intptr_t)nodeId,
+ &isNew);
+ Blt_SetHashValue(hPtr, node);
+ Blt_TreeRelabelNode(cmdPtr->tree, node, names[0]);
+@@ -1651,7 +1651,7 @@
+ * This can happen when there's a id collision with an
+ * existing node.
+ */
+- hPtr = Blt_FindHashEntry(&dataPtr->idTable, (char *)parentId);
++ hPtr = Blt_FindHashEntry(&dataPtr->idTable, (char *)(intptr_t)parentId);
+ if (hPtr != NULL) {
+ parent = Blt_GetHashValue(hPtr);
+ } else {
+@@ -1688,7 +1688,7 @@
+ if (dataPtr->flags & RESTORE_OVERWRITE &&
+ ((node = Blt_TreeFindChild(parent, names[nNames - 1])))) {
+ /* Create a mapping between the old id and the new node */
+- hPtr = Blt_CreateHashEntry(&dataPtr->idTable, (char *)nodeId,
++ hPtr = Blt_CreateHashEntry(&dataPtr->idTable, (char *)(intptr_t)nodeId,
+ &isNew);
+ Blt_SetHashValue(hPtr, node);
+ }
+@@ -1698,7 +1698,7 @@
+ node = Blt_TreeCreateNode(cmdPtr->tree, parent,
+ names[nNames - 1], -1);
+ /* Create a mapping between the old id and the new node */
+- hPtr = Blt_CreateHashEntry(&dataPtr->idTable, (char *)nodeId,
++ hPtr = Blt_CreateHashEntry(&dataPtr->idTable, (char *)(intptr_t)nodeId,
+ &isNew);
+ Blt_SetHashValue(hPtr, node);
+ } else {
+@@ -2196,7 +2196,7 @@
+ for (node = Blt_ListFirstNode(patternList); node != NULL;
+ node = Blt_ListNextNode(node)) {
+
+- type = (int)Blt_ListGetValue(node);
++ type = (intptr_t)Blt_ListGetValue(node);
+ pattern = (char *)Blt_ListGetKey(node);
+ switch (type) {
+ case 0:
+@@ -3654,7 +3654,7 @@
+ for (hPtr = Blt_FirstHashEntry(tablePtr, &cursor);
+ hPtr != NULL; hPtr = Blt_NextHashEntry(&cursor)) {
+ node = Blt_GetHashValue(hPtr);
+- Blt_ChainAppend(chainPtr, (ClientData)Blt_TreeNodeId(node));
++ Blt_ChainAppend(chainPtr, (ClientData)(intptr_t)Blt_TreeNodeId(node));
+ }
+ /*
+ * Iterate through this list to delete the nodes. By
+@@ -3664,7 +3664,7 @@
+ for (linkPtr = Blt_ChainFirstLink(chainPtr); linkPtr != NULL;
+ linkPtr = nextPtr) {
+ nextPtr = Blt_ChainNextLink(linkPtr);
+- inode = (int)Blt_ChainGetValue(linkPtr);
++ inode = (intptr_t)Blt_ChainGetValue(linkPtr);
+ node = Blt_TreeGetNode(cmdPtr->tree, inode);
+ if (node != NULL) {
+ DeleteNode(cmdPtr, node);
+--- a/generic/bltUnixPipe.c
++++ b/generic/bltUnixPipe.c
+@@ -508,7 +508,7 @@
+ * Reap the child process now if an error occurred during its
+ * startup.
+ */
+- Tcl_WaitPid((Tcl_Pid)pid, &status, WNOHANG);
++ Tcl_WaitPid((Tcl_Pid)(intptr_t)pid, &status, WNOHANG);
+ }
+ if (errPipeIn >= 0) {
+ CloseFile(errPipeIn);
+--- a/generic/bltUtil.c
++++ b/generic/bltUtil.c
+@@ -827,10 +827,10 @@
+ if (isNew) {
+ refCount = 0;
+ } else {
+- refCount = (int)Blt_GetHashValue(hPtr);
++ refCount = (intptr_t)Blt_GetHashValue(hPtr);
+ }
+ refCount++;
+- Blt_SetHashValue(hPtr, (ClientData)refCount);
++ Blt_SetHashValue(hPtr, (intptr_t)refCount);
+ return (Blt_Uid)Blt_GetHashKey(&uidTable, hPtr);
+ }
+
+@@ -864,12 +864,12 @@
+ if (hPtr) {
+ int refCount;
+
+- refCount = (int)Blt_GetHashValue(hPtr);
++ refCount = (intptr_t)Blt_GetHashValue(hPtr);
+ refCount--;
+ if (refCount == 0) {
+ Blt_DeleteHashEntry(&uidTable, hPtr);
+ } else {
+- Blt_SetHashValue(hPtr, (ClientData)refCount);
++ Blt_SetHashValue(hPtr, (intptr_t)refCount);
+ }
+ } else {
+ fprintf(stderr, "tried to release unknown identifier \"%s\"\n", uid);
+--- a/generic/bltInit.c
++++ b/generic/bltInit.c
+@@ -514,7 +514,7 @@
+ int dostub = 0;
+ #endif
+
+- flags = (int)Tcl_GetAssocData(interp, BLT_THREAD_KEY, NULL);
++ flags = (intptr_t)Tcl_GetAssocData(interp, BLT_THREAD_KEY, NULL);
+ if ((flags & BLT_TCL_CMDS) == 0) {
+ register Tcl_AppInitProc **p;
+ Tcl_Namespace *nsPtr;
+@@ -573,7 +573,7 @@
+ }
+ #endif
+ Tcl_SetAssocData(interp, BLT_THREAD_KEY, NULL,
+- (ClientData)(flags | BLT_TCL_CMDS));
++ (ClientData)(intptr_t)(flags | BLT_TCL_CMDS));
+ }
+ #ifndef TCL_ONLY
+ if ((flags & BLT_TK_CMDS) == 0) {
+@@ -609,7 +609,7 @@
+ }
+ Blt_InitEpsCanvasItem(interp);
+ Tcl_SetAssocData(interp, BLT_THREAD_KEY, NULL,
+- (ClientData)(flags | BLT_TK_CMDS));
++ (ClientData)(intptr_t)(flags | BLT_TK_CMDS));
+ }
+ #endif
+ return TCL_OK;
+--- a/generic/bltGrAxis.c
++++ b/generic/bltGrAxis.c
+@@ -669,7 +669,7 @@
+ char *widgRec; /* Pointer to structure record. */
+ int offset; /* Offset of field in structure. */
+ {
+- unsigned int mask = (unsigned int)clientData;
++ unsigned int mask = (uintptr_t)clientData;
+ Axis *axisPtr = (Axis *)widgRec;
+ Ticks **ticksPtrPtr = (Ticks **) (widgRec + offset);
+ int nTicks;
+@@ -3687,7 +3687,7 @@
+ int margin;
+
+ /* TODO: fix bug where "$g xaxis x2" leaves x unavailable. */
+- margin = (int)argv[-1];
++ margin = (intptr_t)argv[-1];
+ chainPtr = graphPtr->margins[margin].axes;
+ if (argc == 0) {
+ for (linkPtr = Blt_ChainFirstLink(chainPtr); linkPtr!= NULL;
+@@ -4231,7 +4231,7 @@
+ return TCL_ERROR;
+ }
+ if (proc == UseOp) {
+- argv[2] = (char *)margin; /* Hack. Slide a reference to the margin in
++ argv[2] = (char *)(intptr_t)margin; /* Hack. Slide a reference to the margin in
+ * the argument list. Needed only for UseOp.
+ */
+ result = (*proc)(graphPtr, NULL, argc - 3, argv +3);
+--- a/generic/bltGrBar.c
++++ b/generic/bltGrBar.c
+@@ -2197,13 +2197,13 @@
+ if (isNew) {
+ count = 1;
+ } else {
+- count = (int)Blt_GetHashValue(hPtr);
++ count = (intptr_t)Blt_GetHashValue(hPtr);
+ if (count == 1) {
+ nStacks++;
+ }
+ count++;
+ }
+- Blt_SetHashValue(hPtr, (ClientData)count);
++ Blt_SetHashValue(hPtr, (ClientData)(intptr_t)count);
+ }
+ }
+ if (nSegs == 0) {
+@@ -2219,12 +2219,12 @@
+ infoPtr = graphPtr->freqArr;
+ for (hPtr = Blt_FirstHashEntry(&freqTable, &cursor); hPtr != NULL;
+ hPtr = Blt_NextHashEntry(&cursor)) {
+- count = (int)Blt_GetHashValue(hPtr);
++ count = (intptr_t)Blt_GetHashValue(hPtr);
+ keyPtr = (FreqKey *)Blt_GetHashKey(&freqTable, hPtr);
+ if (count > 1) {
+ h2Ptr = Blt_CreateHashEntry(&(graphPtr->freqTable),
+ (char *)keyPtr, &isNew);
+- count = (int)Blt_GetHashValue(hPtr);
++ count = (intptr_t)Blt_GetHashValue(hPtr);
+ infoPtr->freq = count;
+ infoPtr->axes = keyPtr->axes;
+ Blt_SetHashValue(h2Ptr, infoPtr);
+--- a/generic/bltGrMisc.c
++++ b/generic/bltGrMisc.c
+@@ -260,7 +260,7 @@
+ {
+ ColorPair *pairPtr = (ColorPair *)(widgRec + offset);
+ ColorPair sample;
+- int allowDefault = (int)clientData;
++ int allowDefault = (intptr_t)clientData;
+
+ sample.fgColor = sample.bgColor = NULL;
+ if ((string != NULL) && (*string != '\0')) {
+--- a/generic/bltConfig.c
++++ b/generic/bltConfig.c
+@@ -442,7 +442,7 @@
+ char *widgRec; /* Cubicle structure record */
+ int offset; /* Offset of style in record */
+ {
+- unsigned int mask = (unsigned int)clientData; /* Bit to be tested */
++ unsigned int mask = (uintptr_t)clientData; /* Bit to be tested */
+ int *flagPtr = (int *)(widgRec + offset);
+ int bool;
+
+@@ -478,7 +478,7 @@
+ int offset; /* Offset of fill in widget record */
+ Tcl_FreeProc **freeProcPtr; /* Not Used. */
+ {
+- unsigned int mask = (unsigned int)clientData; /* Bit to be tested */
++ unsigned int mask = (uintptr_t)clientData; /* Bit to be tested */
+ unsigned int bool = *(unsigned int *)(widgRec + offset);
+
+ return (bool & mask) ? "1" : "0";
+@@ -559,7 +559,7 @@
+ int offset; /* Offset of pixel size in record */
+ {
+ int *valuePtr = (int *)(widgRec + offset);
+- return Blt_GetPixels(interp, tkwin, string, (int)clientData, valuePtr);
++ return Blt_GetPixels(interp, tkwin, string, (intptr_t)clientData, valuePtr);
+ }
+
+ /*
+@@ -648,7 +648,7 @@
+ int offset; /* Offset of pixel size in record */
+ {
+ int *valuePtr = (int *)(widgRec + offset);
+- return Blt_GetInt(interp, string, (int)clientData, valuePtr);
++ return Blt_GetInt(interp, string, (intptr_t)clientData, valuePtr);
+ }
+
+ /*
+--- a/generic/bltContainer.c
++++ b/generic/bltContainer.c
+@@ -822,7 +822,7 @@
+ char *widgRec; /* Widget record */
+ int offset; /* Offset to field in structure */
+ {
+- unsigned int flags = (int)clientData;
++ unsigned int flags = (uintptr_t)clientData;
+ Container *cntrPtr = (Container *)widgRec;
+ Window *winPtr = (Window *) (widgRec + offset);
+ Tk_Window tkAdopted;
+--- a/generic/bltHierbox.c
++++ b/generic/bltHierbox.c
+@@ -2077,7 +2077,7 @@
+ /* Generate a unique node serial number. */
+ do {
+ serial = hboxPtr->nextSerial++;
+- hPtr = Blt_CreateHashEntry(&(hboxPtr->nodeTable), (char *)serial,
++ hPtr = Blt_CreateHashEntry(&(hboxPtr->nodeTable), (char *)(intptr_t)serial,
+ &isNew);
+ } while (!isNew);
+ Blt_SetHashValue(hPtr, treePtr);
+@@ -2372,7 +2372,7 @@
+ if (Tcl_GetInt(NULL, string, &serial) == TCL_OK) {
+ Blt_HashEntry *hPtr;
+
+- hPtr = Blt_FindHashEntry(&(hboxPtr->nodeTable), (char *)serial);
++ hPtr = Blt_FindHashEntry(&(hboxPtr->nodeTable), (char *)(intptr_t)serial);
+ if (hPtr != NULL) {
+ return (Tree *) Blt_GetHashValue(hPtr);
+ }
+@@ -2406,7 +2406,7 @@
+ int serial;
+
+ /* Node table keys are integers. Convert them to strings. */
+- serial = (int)Blt_GetHashKey(&(hboxPtr->nodeTable),
++ serial = (intptr_t)Blt_GetHashKey(&(hboxPtr->nodeTable),
+ nodePtr->entryPtr->hashPtr);
+ sprintf(string, "%d", serial);
+
+--- a/generic/bltUnixImage.c
++++ b/generic/bltUnixImage.c
+@@ -574,7 +574,7 @@
+ destPtr = Blt_ColorImageBits(image);
+ endPtr = destPtr + nPixels;
+ for (/* empty */; destPtr < endPtr; destPtr++) {
+- hPtr = Blt_FindHashEntry(&pixelTable, (char *)destPtr->value);
++ hPtr = Blt_FindHashEntry(&pixelTable, (char *)(intptr_t)destPtr->value);
+ colorPtr = (XColor *)Blt_GetHashValue(hPtr);
+ destPtr->Red = lut[colorPtr->red >> 8];
+ destPtr->Green = lut[colorPtr->green >> 8];
+--- a/generic/bltTable.c
++++ b/generic/bltTable.c
+@@ -2034,7 +2034,7 @@
+ key = 0; /* Initialize key to bogus span */
+ for (node = Blt_ListFirstNode(list); node != NULL;
+ node = Blt_ListNextNode(node)) {
+- key = (int)Blt_ListGetKey(node);
++ key = (intptr_t)Blt_ListGetKey(node);
+ if (entryPtr->row.span <= key) {
+ break;
+ }
+@@ -2046,7 +2046,7 @@
+ * Create a new list (bucket) to hold entries of that size
+ * span and and link it into the list of buckets.
+ */
+- newNode = Blt_ListCreateNode(list, (char *)entryPtr->row.span);
++ newNode = Blt_ListCreateNode(list, (char *)(intptr_t)entryPtr->row.span);
+ Blt_ListSetValue(newNode, (char *)Blt_ChainCreate());
+ Blt_ListLinkBefore(list, newNode, node);
+ node = newNode;
+@@ -2063,7 +2063,7 @@
+ key = 0;
+ for (node = Blt_ListFirstNode(list); node != NULL;
+ node = Blt_ListNextNode(node)) {
+- key = (int)Blt_ListGetKey(node);
++ key = (intptr_t)Blt_ListGetKey(node);
+ if (entryPtr->column.span <= key) {
+ break;
+ }
+@@ -2075,7 +2075,7 @@
+ * Create a new list (bucket) to hold entries of that size
+ * span and and link it into the list of buckets.
+ */
+- newNode = Blt_ListCreateNode(list, (char *)entryPtr->column.span);
++ newNode = Blt_ListCreateNode(list, (char *)(intptr_t)entryPtr->column.span);
+ Blt_ListSetValue(newNode, (char *)Blt_ChainCreate());
+ Blt_ListLinkBefore(list, newNode, node);
+ node = newNode;
+--- a/generic/bltTreeView.c
++++ b/generic/bltTreeView.c
+@@ -1314,10 +1314,10 @@
+ if (isNew) {
+ refCount = 1;
+ } else {
+- refCount = (int)Blt_GetHashValue(hPtr);
++ refCount = (intptr_t)Blt_GetHashValue(hPtr);
+ refCount++;
+ }
+- Blt_SetHashValue(hPtr, (ClientData)refCount);
++ Blt_SetHashValue(hPtr, (ClientData)(intptr_t)refCount);
+ return Blt_GetHashKey(&tvPtr->uidTable, hPtr);
+ }
+
+@@ -1343,10 +1343,10 @@
+
+ hPtr = Blt_FindHashEntry(&tvPtr->uidTable, uid);
+ assert(hPtr != NULL);
+- refCount = (int)Blt_GetHashValue(hPtr);
++ refCount = (intptr_t)Blt_GetHashValue(hPtr);
+ refCount--;
+ if (refCount > 0) {
+- Blt_SetHashValue(hPtr, (ClientData)refCount);
++ Blt_SetHashValue(hPtr, (ClientData)(intptr_t)refCount);
+ } else {
+ Blt_DeleteHashEntry(&tvPtr->uidTable, hPtr);
+ }
+--- a/generic/bltTreeViewCmd.c
++++ b/generic/bltTreeViewCmd.c
+@@ -516,7 +516,7 @@
+
+ if ((context == ITEM_ENTRY) ||
+ (context == ITEM_ENTRY_BUTTON) ||
+- ((unsigned int)context >= (unsigned int)ITEM_STYLE)) {
++ ((uintptr_t)context >= (uintptr_t)ITEM_STYLE)) {
+ entryPtr = Blt_GetCurrentItem(tvPtr->bindTable);
+ }
+ }
+--- a/generic/bltWinop.c
++++ b/generic/bltWinop.c
+@@ -980,9 +980,9 @@
+ if (isNew) {
+ Blt_SetHashValue(hPtr, 1);
+ } else {
+- cnt = (int)Blt_GetHashValue(hPtr);
++ cnt = (intptr_t)Blt_GetHashValue(hPtr);
+ cnt++;
+- Blt_SetHashValue(hPtr, cnt);
++ Blt_SetHashValue(hPtr, (intptr_t)cnt);
+ }
+ srcPtr++;
+ }
+@@ -994,7 +994,7 @@
+ Tcl_Obj *objPtr = Tcl_NewStringObj(Blt_GetHashKey(&hTbl, hPtr), -1);
+ Tcl_ListObjAppendElement(interp, listPtr, objPtr);
+ if (iscnt) {
+- cnt = (int)Blt_GetHashValue(hPtr);
++ cnt = (intptr_t)Blt_GetHashValue(hPtr);
+ sprintf(buf, "%d", cnt);
+ objPtr = Tcl_NewStringObj(buf, -1);
+ Tcl_ListObjAppendElement(interp, listPtr, objPtr);
+--- a/generic/bltObjConfig.c
++++ b/generic/bltObjConfig.c
+@@ -1338,7 +1338,7 @@
+ if (Tcl_GetBooleanFromObj(interp, objPtr, &bool) != TCL_OK) {
+ return TCL_ERROR;
+ }
+- flag = (unsigned int)specPtr->customPtr;
++ flag = (uintptr_t)specPtr->customPtr;
+ *(int *)ptr &= ~flag;
+ if (bool) {
+ *(int *)ptr |= flag;
+@@ -1639,7 +1639,7 @@
+ {
+ unsigned int flag;
+
+- flag = (*(int *)ptr) & (unsigned int)specPtr->customPtr;
++ flag = (*(unsigned int *)ptr) & (uintptr_t)specPtr->customPtr;
+ return Tcl_NewBooleanObj((flag != 0));
+ }
+
diff --git a/graphics/tclblt/patches/series b/graphics/tclblt/patches/series
new file mode 100644
index 0000000000..186b9b9cc9
--- /dev/null
+++ b/graphics/tclblt/patches/series
@@ -0,0 +1,22 @@
+02-debian-all.patch
+03-fedora-patch-2.patch
+04-fedora-tk8.5.6.patch
+05-tk8.5-zoomstack.patch
+doc-typos.patch
+tcl8.6.patch
+tk8.6.patch
+install.patch
+usetclint.patch
+usetkint.patch
+table.patch
+ldflags.patch
+pkgindex.patch
+decls.patch
+bltnsutil.patch
+blthash.patch
+const.patch
+uninitialized.patch
+unused.patch
+pointertoint.patch
+autoreconf.patch
+switch.patch
diff --git a/graphics/tclblt/patches/source.patch b/graphics/tclblt/patches/source.patch
new file mode 100644
index 0000000000..b94e1fa3f3
--- /dev/null
+++ b/graphics/tclblt/patches/source.patch
@@ -0,0 +1,85 @@
+This patch removes references to non-free dd_protocol/* files from makefiles.
+It's a part of code which makes the original tarball DFSG-compliant. The rest
+is in debian/rules (get-orig-source target).
+
+--- a/library/Makefile.in
++++ b/library/Makefile.in
+@@ -34,14 +34,14 @@
+ tclIndex \
+ $(cursors)
+
+-ddFiles = dd-color.tcl \
+- dd-file.tcl \
+- dd-number.tcl \
+- dd-text.tcl \
+- tclIndex
++#ddFiles = dd-color.tcl \
++# dd-file.tcl \
++# dd-number.tcl \
++# dd-text.tcl \
++# tclIndex
+
+ instdirs = $(prefix) $(exec_prefix) \
+- $(libdir) $(prefix)/lib $(scriptdir) $(scriptdir)/dd_protocols
++ $(libdir) $(prefix)/lib $(scriptdir) #$(scriptdir)/dd_protocols
+
+ all: pkgIndex
+
+@@ -53,10 +53,10 @@
+
+
+ install: mkdirs pkgIndex
+- for i in $(ddFiles) ; do \
+- $(INSTALL_DATA) $(srcdir)/dd_protocols/$$i \
+- $(INSTALL_ROOT)$(scriptdir)/dd_protocols ; \
+- done
++ #for i in $(ddFiles) ; do \
++ # $(INSTALL_DATA) $(srcdir)/dd_protocols/$$i \
++ # $(INSTALL_ROOT)$(scriptdir)/dd_protocols ; \
++ #done
+ for i in $(miscFiles) ; do \
+ $(INSTALL_DATA) $(srcdir)/$$i $(INSTALL_ROOT)$(scriptdir) ; \
+ done
+--- a/library/Makefile.vc
++++ b/library/Makefile.vc
+@@ -24,11 +24,11 @@
+ tclIndex \
+ $(cursors)
+
+-ddFiles = dd-color.tcl \
+- dd-file.tcl \
+- dd-number.tcl \
+- dd-text.tcl \
+- tclIndex
++#ddFiles = dd-color.tcl \
++# dd-file.tcl \
++# dd-number.tcl \
++# dd-text.tcl \
++# tclIndex
+
+ instdirs = $(prefix) $(exec_prefix) $(libdir) \
+ $(scriptdir) $(scriptdir)/dd_protocols $(libdir)/tcl$(v1) \
+@@ -44,9 +44,9 @@
+ done
+
+ install-ddfiles: install-dirs
+- for i in $(ddFiles) ; do \
+- $(INSTALL_DATA) $(srcdir)/dd_protocols/$$i $(scriptdir)/dd_protocols ; \
+- done
++ #for i in $(ddFiles) ; do \
++ # $(INSTALL_DATA) $(srcdir)/dd_protocols/$$i $(scriptdir)/dd_protocols ; \
++ #done
+
+ install-files: install-dirs
+ for i in $(miscFiles) ; do \
+--- a/win/install.tcl
++++ b/win/install.tcl
+@@ -78,7 +78,7 @@
+ -pattern *.pro \
+ -file tclIndex \
+ $scriptdir
+- Add ${srcdir}/library/dd_protocols \
++ #Add ${srcdir}/library/dd_protocols \
+ -pattern *.tcl \
+ -file tclIndex \
+ $scriptdir/dd_protocols
diff --git a/graphics/tclblt/patches/switch.patch b/graphics/tclblt/patches/switch.patch
new file mode 100644
index 0000000000..e24589f0c8
--- /dev/null
+++ b/graphics/tclblt/patches/switch.patch
@@ -0,0 +1,15 @@
+Author: Sergei Golovan
+Description: Patch fixes a typo in -- switch processing.
+Last-Modified: Wed, 21 Mar 2018 11:04:36 +0300
+
+--- a/generic/bltSwitch.c
++++ b/generic/bltSwitch.c
+@@ -322,7 +322,7 @@
+ for (count = 0; count < argc; count++) {
+ arg = argv[count];
+ if (flags & BLT_SWITCH_OBJV_PARTIAL) {
+- if ((arg[0] != '-') || ((arg[1] == '-') && (argv[2] == '\0'))) {
++ if ((arg[0] != '-') || ((arg[1] == '-') && (arg[2] == '\0'))) {
+ /*
+ * If the argument doesn't start with a '-' (not a switch)
+ * or is '--', stop processing and return the number of
diff --git a/graphics/tclblt/patches/table.patch b/graphics/tclblt/patches/table.patch
new file mode 100644
index 0000000000..ca4e451ec7
--- /dev/null
+++ b/graphics/tclblt/patches/table.patch
@@ -0,0 +1,123 @@
+Description: Patch restores blt::table command which was renamed to
+ blt::blttable in 2.5.3.
+ TODO: Make the blttable alias if necessary.
+Author: Sergei Golovan
+Last-Modified: Fri, 04 Jul 2014 09:22:10 +0400
+
+--- a/demos/tour.tcl
++++ b/demos/tour.tcl
+@@ -22,7 +22,7 @@
+ # --------------------------------------------------------------------------
+ if { $tcl_version >= 8.0 } {
+ namespace import -force blt::*
+- interp alias {} table {} blttable
++ #interp alias {} table {} blttable
+ #namespace import -force blt::tile::*
+ }
+ source scripts/demo.tcl
+--- a/generic/bltTable.c
++++ b/generic/bltTable.c
+@@ -24,7 +24,7 @@
+ * out of or in connection with the use or performance of this
+ * software.
+ *
+- * The "blttable" geometry manager was created by George Howlett.
++ * The "table" geometry manager was created by George Howlett.
+ */
+
+ /*
+@@ -85,7 +85,7 @@
+
+ static Tk_GeomMgr tableMgrInfo =
+ {
+- "blttable", /* Name of geometry manager used by winfo */
++ "table", /* Name of geometry manager used by winfo */
+ WidgetGeometryProc, /* Procedure to for new geometry requests */
+ WidgetCustodyProc, /* Procedure when widget is taken away */
+ };
+@@ -4955,7 +4955,7 @@
+ Blt_TableInit(interp)
+ Tcl_Interp *interp;
+ {
+- static Blt_CmdSpec cmdSpec = {"blttable", TableCmd, };
++ static Blt_CmdSpec cmdSpec = {"table", TableCmd, };
+ TableInterpData *dataPtr;
+
+ dataPtr = GetTableInterpData(interp);
+--- a/library/graph.tcl
++++ b/library/graph.tcl
+@@ -434,50 +434,50 @@
+ set row 1
+ set col 0
+ label $top.title -text "PostScript Options"
+- blttable $top $top.title -cspan 7
++ blt::table $top $top.title -cspan 7
+ foreach bool { center landscape maxpect preview decorations } {
+ set w $top.$bool-label
+ label $w -text "-$bool" -font *courier*-r-*12*
+- blttable $top $row,$col $w -anchor e -pady { 2 0 } -padx { 0 4 }
++ blt::table $top $row,$col $w -anchor e -pady { 2 0 } -padx { 0 4 }
+ set w $top.$bool-yes
+ global $graph.$bool
+ radiobutton $w -text "yes" -variable $graph.$bool -value 1
+- blttable $top $row,$col+1 $w -anchor w
++ blt::table $top $row,$col+1 $w -anchor w
+ set w $top.$bool-no
+ radiobutton $w -text "no" -variable $graph.$bool -value 0
+- blttable $top $row,$col+2 $w -anchor w
++ blt::table $top $row,$col+2 $w -anchor w
+ incr row
+ }
+ label $top.modes -text "-colormode" -font *courier*-r-*12*
+- blttable $top $row,0 $top.modes -anchor e -pady { 2 0 } -padx { 0 4 }
++ blt::table $top $row,0 $top.modes -anchor e -pady { 2 0 } -padx { 0 4 }
+ set col 1
+ foreach m { color greyscale } {
+ set w $top.$m
+ radiobutton $w -text $m -variable $graph.colormode -value $m
+- blttable $top $row,$col $w -anchor w
++ blt::table $top $row,$col $w -anchor w
+ incr col
+ }
+ set row 1
+ frame $top.sep -width 2 -bd 1 -relief sunken
+- blttable $top $row,3 $top.sep -fill y -rspan 6
++ blt::table $top $row,3 $top.sep -fill y -rspan 6
+ set col 4
+ foreach value { padx pady paperwidth paperheight width height } {
+ set w $top.$value-label
+ label $w -text "-$value" -font *courier*-r-*12*
+- blttable $top $row,$col $w -anchor e -pady { 2 0 } -padx { 0 4 }
++ blt::table $top $row,$col $w -anchor e -pady { 2 0 } -padx { 0 4 }
+ set w $top.$value-entry
+ global $graph.$value
+ entry $w -textvariable $graph.$value -width 8
+- blttable $top $row,$col+1 $w -cspan 2 -anchor w -padx 8
++ blt::table $top $row,$col+1 $w -cspan 2 -anchor w -padx 8
+ incr row
+ }
+- blttable configure $top c3 -width .125i
++ blt::table configure $top c3 -width .125i
+ button $top.cancel -text "Cancel" -command "destroy $top"
+- blttable $top $row,0 $top.cancel -width 1i -pady 2 -cspan 3
++ blt::table $top $row,0 $top.cancel -width 1i -pady 2 -cspan 3
+ button $top.reset -text "Reset" -command "destroy $top"
+- #blttable $top $row,1 $top.reset -width 1i
++ #blt::table $top $row,1 $top.reset -width 1i
+ button $top.print -text "Print" -command "blt::ResetPostScript $graph"
+- blttable $top $row,4 $top.print -width 1i -pady 2 -cspan 2
++ blt::table $top $row,4 $top.print -width 1i -pady 2 -cspan 2
+ }
+
+ proc blt::ResetPostScript { graph } {
+--- a/library/tabnotebook.tcl
++++ b/library/tabnotebook.tcl
+@@ -215,7 +215,7 @@
+ set top "$widget.toplevel-$id"
+ toplevel $top
+ $widget tab tearoff $tab $top.container
+- blttable $top $top.container -fill both
++ table $top $top.container -fill both
+
+ incr rootX 10 ; incr rootY 10
+ wm geometry $top +$rootX+$rootY
diff --git a/graphics/tclblt/patches/tcl8.6.patch b/graphics/tclblt/patches/tcl8.6.patch
new file mode 100644
index 0000000000..e760a7a448
--- /dev/null
+++ b/graphics/tclblt/patches/tcl8.6.patch
@@ -0,0 +1,91 @@
+Description: Patch replaces the direct usage of deprecated interp->result
+ by Tcl_SetResult() and Tcl_GetStringResult() calls making it possible
+ to build using Tcl/Tk 8.6.
+Last-Modified: Fri, 04 Jul 2014 09:20:48 +0400
+
+--- a/generic/bltScrollbar.c
++++ b/generic/bltScrollbar.c
+@@ -588,7 +588,7 @@
+ } else {
+ fraction = ((double)pixels / (double)barWidth);
+ }
+- sprintf(interp->result, "%g", fraction);
++ sprintf(Tcl_GetStringResult(interp), "%g", fraction);
+ } else if ((c == 'f') && (strncmp(argv[1], "fraction", length) == 0)) {
+ int x, y, pos, barWidth;
+ double fraction;
+--- a/generic/bltTed.c
++++ b/generic/bltTed.c
+@@ -1504,7 +1504,7 @@
+ tablePtr->flags |= ARRANGE_PENDING;
+ Tcl_DoWhenIdle(tablePtr->arrangeProc, tablePtr);
+ }
+- interp->result = Tk_PathName(tedPtr->tkwin);
++ Tcl_SetResult(interp, (char*)Tk_PathName(tedPtr->tkwin), TCL_VOLATILE);
+ tedPtr->flags |= LAYOUT_PENDING;
+ EventuallyRedraw(tedPtr);
+ return TCL_OK;
+@@ -1678,7 +1678,7 @@
+ tedPtr->activeRectArr[4].width = grip - 1;
+ tedPtr->activeRectArr[4].height = grip - 1;
+
+- interp->result = Tk_PathName(entryPtr->tkwin);
++ Tcl_SetResult(interp, (char*)Tk_PathName(entryPtr->tkwin), TCL_VOLATILE);
+ active = 1;
+ break;
+ }
+@@ -1751,7 +1751,7 @@
+ tablePtr->flags |= ARRANGE_PENDING;
+ Tcl_DoWhenIdle(tablePtr->arrangeProc, tablePtr);
+ }
+- interp->result = Tk_PathName(tedPtr->tkwin);
++ Tcl_SetResult(interp, (char*)Tk_PathName(tedPtr->tkwin), TCL_VOLATILE);
+ tedPtr->flags |= LAYOUT_PENDING;
+ EventuallyRedraw(tedPtr);
+ return TCL_OK;
+--- a/generic/bltVecMath.c
++++ b/generic/bltVecMath.c
+@@ -834,20 +834,20 @@
+ if ((errno == EDOM) || (value != value)) {
+ Tcl_AppendResult(interp, "domain error: argument not in valid range",
+ (char *)NULL);
+- Tcl_SetErrorCode(interp, "ARITH", "DOMAIN", interp->result,
++ Tcl_SetErrorCode(interp, "ARITH", "DOMAIN", Tcl_GetStringResult(interp),
+ (char *)NULL);
+ } else if ((errno == ERANGE) || IS_INF(value)) {
+ if (value == 0.0) {
+ Tcl_AppendResult(interp,
+ "floating-point value too small to represent",
+ (char *)NULL);
+- Tcl_SetErrorCode(interp, "ARITH", "UNDERFLOW", interp->result,
++ Tcl_SetErrorCode(interp, "ARITH", "UNDERFLOW", Tcl_GetStringResult(interp),
+ (char *)NULL);
+ } else {
+ Tcl_AppendResult(interp,
+ "floating-point value too large to represent",
+ (char *)NULL);
+- Tcl_SetErrorCode(interp, "ARITH", "OVERFLOW", interp->result,
++ Tcl_SetErrorCode(interp, "ARITH", "OVERFLOW", Tcl_GetStringResult(interp),
+ (char *)NULL);
+ }
+ } else {
+@@ -856,7 +856,7 @@
+ sprintf(buf, "%d", errno);
+ Tcl_AppendResult(interp, "unknown floating-point error, ",
+ "errno = ", buf, (char *)NULL);
+- Tcl_SetErrorCode(interp, "ARITH", "UNKNOWN", interp->result,
++ Tcl_SetErrorCode(interp, "ARITH", "UNKNOWN", Tcl_GetStringResult(interp),
+ (char *)NULL);
+ }
+ }
+--- a/generic/bltTreeCmd.c
++++ b/generic/bltTreeCmd.c
+@@ -8560,7 +8560,7 @@
+ if (result == TCL_CONTINUE ) continue;
+ if (result == TCL_ERROR) {
+ Tcl_AppendResult(interp,
+- "\n (\"tree foreach\" body line ", Blt_Itoa(interp->errorLine), ")\n", 0);
++ "\n (\"tree foreach\" body line ", Blt_Itoa(Tcl_GetErrorLine(interp)), ")\n", 0);
+ break;
+ }
+ if (result != TCL_OK) {
diff --git a/graphics/tclblt/patches/tk8.6.patch b/graphics/tclblt/patches/tk8.6.patch
new file mode 100644
index 0000000000..3de6c0ed15
--- /dev/null
+++ b/graphics/tclblt/patches/tk8.6.patch
@@ -0,0 +1,29 @@
+Description: Patch replaces call to TkCopyAndGlobalEval by a call to
+ Tcl_EvalObjEx because the former function has been dropped in Tk 8.6.
+Last-Modified: Fri, 04 Jul 2014 09:18:32 +0400
+
+--- a/generic/tkButton.c
++++ b/generic/tkButton.c
+@@ -864,8 +864,6 @@
+ static Blt_TileChangedProc TileChangedProc;
+ static Tcl_CmdProc ButtonCmd, LabelCmd, CheckbuttonCmd, RadiobuttonCmd;
+
+-EXTERN int TkCopyAndGlobalEval _ANSI_ARGS_((Tcl_Interp *interp, char *script));
+-
+ #if (TK_MAJOR_VERSION > 4)
+ EXTERN void TkComputeAnchor _ANSI_ARGS_((Tk_Anchor anchor, Tk_Window tkwin,
+ int padX, int padY, int innerWidth, int innerHeight, int *xPtr,
+@@ -3292,7 +3290,12 @@
+ }
+ }
+ if ((butPtr->type > TYPE_LABEL) && (butPtr->command != NULL)) {
+- return TkCopyAndGlobalEval(butPtr->interp, butPtr->command);
++ Tcl_DString buf;
++ Tcl_DStringInit(&buf);
++ Tcl_DStringAppend(&buf, butPtr->command, -1);
++ int code = Tcl_EvalEx(butPtr->interp, Tcl_DStringValue(&buf), Tcl_DStringLength(&buf), TCL_EVAL_GLOBAL);
++ Tcl_DStringFree(&buf);
++ return code;
+ }
+ return TCL_OK;
+ }
diff --git a/graphics/tclblt/patches/uninitialized.patch b/graphics/tclblt/patches/uninitialized.patch
new file mode 100644
index 0000000000..241473dc29
--- /dev/null
+++ b/graphics/tclblt/patches/uninitialized.patch
@@ -0,0 +1,278 @@
+Description: Patch initializes all variables for which GCC gave warnings
+ about uninitialized or maybe uninitialized variables.
+Author: Sergei Golovan
+Last-Modified: Wed, 09 Jul 2014 19:17:02 +0400
+
+--- a/generic/bltArrayObj.c
++++ b/generic/bltArrayObj.c
+@@ -69,6 +69,7 @@
+ }
+ if (nElem%2) {
+ if (interp != NULL) {
++ string = Tcl_GetString(objPtr);
+ Tcl_AppendResult(interp, "odd length: ", string, 0);
+ }
+ return TCL_ERROR;
+--- a/generic/bltBgexec.c
++++ b/generic/bltBgexec.c
+@@ -559,6 +559,7 @@
+ *lengthPtr = length;
+ return string;
+ }
++ *lengthPtr = length;
+ return NULL;
+ }
+
+@@ -603,6 +604,7 @@
+ return string;
+ }
+ }
++ *lengthPtr = 0;
+ return NULL;
+ }
+ /*
+--- a/generic/bltTreeCmd.c
++++ b/generic/bltTreeCmd.c
+@@ -8086,7 +8086,7 @@
+ Blt_TreeKeySearch keyIter;
+ int vobjc, kobjc, i, result = TCL_OK, len, cnt = 0, isar;
+ int nobreak = 0, noupdate = 0, unset = 0, init = 0, aLen;
+- char *var, *string, *aName, *aPat = NULL;
++ char *var, *string, *aName = NULL, *aPat = NULL;
+ int klen, kl, j;
+ int *keySet = NULL;
+ unsigned int inode;
+--- a/generic/bltVector.c
++++ b/generic/bltVector.c
+@@ -1896,7 +1896,7 @@
+ return TCL_OK;
+ }
+ for (i=2; i<objc; i+=2) {
+- int option, *ovar;
++ int option, *ovar = NULL;
+ if (Tcl_GetIndexFromObj(interp, objv[i], optionArr, "option",
+ 0, &option) != TCL_OK) {
+ return TCL_OK;
+--- a/generic/bltGrAxis.c
++++ b/generic/bltGrAxis.c
+@@ -1426,7 +1426,15 @@
+
+ nMajor = nMinor = 0;
+ majorStep = minorStep = 0.0;
+- if (min < max) {
++ if (min > max) {
++ double m;
++ m = min;
++ min = max;
++ max = m;
++ } else if (min == max) {
++ max = min + 1.0;
++ }
++ /* if (min < max) { */
+ min = (min != 0.0) ? log10(FABS(min)) : 0.0;
+ max = (max != 0.0) ? log10(FABS(max)) : 1.0;
+
+@@ -1474,7 +1482,7 @@
+ (DEFINED(axisPtr->reqMax)))) {
+ tickMax = max;
+ }
+- }
++ /* } */
+ axisPtr->majorSweep.step = majorStep;
+ axisPtr->majorSweep.initial = floor(tickMin);
+ axisPtr->majorSweep.nSteps = nMajor;
+@@ -1556,7 +1564,15 @@
+
+ nTicks = 0;
+ tickMin = tickMax = 0.0;
+- if (min < max) {
++ if (min > max) {
++ double m;
++ m = min;
++ min = max;
++ max = m;
++ } else if (min == max) {
++ max = min + 1.0;
++ }
++ /* if (min < max) { */
+ range = max - min;
+
+ /* Calculate the major tick stepping. */
+@@ -1578,7 +1594,7 @@
+ axisMax = tickMax = ceil(max / step) * step + 0.0;
+
+ nTicks = Round((tickMax - tickMin) / step) + 1;
+- }
++ /* } */
+ axisPtr->majorSweep.step = step;
+ axisPtr->majorSweep.initial = tickMin;
+ axisPtr->majorSweep.nSteps = nTicks;
+--- a/generic/bltGrLine.c
++++ b/generic/bltGrLine.c
+@@ -3085,8 +3085,9 @@
+ register Point2D *pointPtr, *endPtr;
+ int i;
+
+- i = -1; /* Suppress compiler warning. */
++ i = searchPtr->index;
+ minDist = searchPtr->dist;
++ closest = searchPtr->point;
+ for (linkPtr = Blt_ChainFirstLink(linePtr->traces); linkPtr != NULL;
+ linkPtr = Blt_ChainNextLink(linkPtr)) {
+ tracePtr = Blt_ChainGetValue(linkPtr);
+@@ -3140,8 +3141,9 @@
+ int i;
+ register Segment2D *s;
+
+- i = 0;
++ i = searchPtr->index;
+ minDist = searchPtr->dist;
++ closest = searchPtr->point;
+ s = linePtr->strips;
+ for (count = 0; count < linePtr->nStrips; count++, s++) {
+ dist = (*distProc)(searchPtr->x, searchPtr->y, &(s->p), &(s->q), &b);
+--- a/generic/bltBeep.c
++++ b/generic/bltBeep.c
+@@ -58,9 +58,7 @@
+ argv[0], " ?volumePercent?\"", (char *)NULL);
+ return TCL_ERROR;
+ }
+- if (argc == 1) {
+- percent = 50; /* Default setting */
+- } else if (argc == 2) {
++ if (argc == 2) {
+ if (Tcl_GetInt(interp, argv[1], &percent) != TCL_OK) {
+ return TCL_ERROR;
+ }
+@@ -69,6 +67,8 @@
+ argv[1], "\"", (char *)NULL);
+ return TCL_ERROR;
+ }
++ } else {
++ percent = 50; /* Default setting */
+ }
+ XBell(Tk_Display(Tk_MainWindow(interp)), percent);
+ return TCL_OK;
+--- a/generic/bltConfig.c
++++ b/generic/bltConfig.c
+@@ -977,6 +977,7 @@
+ int dropOffset;
+
+ colorPtr = NULL;
++ color2Ptr = NULL;
+ dropOffset = 0;
+ if ((string != NULL) && (string[0] != '\0')) {
+ int nElem;
+--- a/generic/bltHtext.c
++++ b/generic/bltHtext.c
+@@ -3100,6 +3100,8 @@
+ forceCopy = 0;
+ } else {
+ htPtr->last = htPtr->first - 1;
++ lineNum = htPtr->first;
++ lastY = 0;
+ }
+
+ /* Draw each line */
+--- a/generic/bltImage.c
++++ b/generic/bltImage.c
+@@ -2738,7 +2738,7 @@
+ if (opacity2<0.0) {
+ a1 = (1.0 - a2);
+ } else {
+- a2 = (opacity2<0.0 ? 0.0 : (opacity2>1.0?1.0:opacity2));
++ a1 = (opacity2<0.0 ? 0.0 : (opacity2>1.0?1.0:opacity2));
+ }
+
+ for (endPtr = destPtr + count; destPtr < endPtr; srcPtr++, src2Ptr++, destPtr++) {
+--- a/generic/bltTabnotebook.c
++++ b/generic/bltTabnotebook.c
+@@ -2430,7 +2430,7 @@
+ int cavityWidth, cavityHeight;
+ int width, height;
+ int dx, dy;
+- int x, y;
++ int x = 0, y = 0;
+
+ nbPtr = tabPtr->nbPtr;
+ pad = nbPtr->inset + nbPtr->inset2;
+--- a/generic/bltTabset.c
++++ b/generic/bltTabset.c
+@@ -5771,14 +5771,6 @@
+ * side when correcting for left/right slants.
+ */
+ switch (setPtr->side) {
+- case SIDE_TOP:
+- case SIDE_BOTTOM:
+- if (setPtr->slant == SLANT_LEFT) {
+- x += setPtr->overlap;
+- } else if (setPtr->slant == SLANT_RIGHT) {
+- x -= setPtr->overlap;
+- }
+- break;
+ case SIDE_LEFT:
+ case SIDE_RIGHT:
+ if (setPtr->slant == SLANT_LEFT) {
+@@ -5787,6 +5779,15 @@
+ y -= setPtr->overlap;
+ }
+ break;
++ case SIDE_TOP:
++ case SIDE_BOTTOM:
++ default:
++ if (setPtr->slant == SLANT_LEFT) {
++ x += setPtr->overlap;
++ } else if (setPtr->slant == SLANT_RIGHT) {
++ x -= setPtr->overlap;
++ }
++ break;
+ }
+
+ /*
+@@ -5817,7 +5818,7 @@
+ iw = imgWidth = ImageWidth(image);
+ ih = imgHeight = ImageHeight(image);
+ }
+- img2Width = img2Height = 0;
++ iw2 = ih2 = img2Width = img2Height = 0;
+ if (image2 != NULL) {
+ iw2 = img2Width = ImageWidth(image2);
+ ih2 = img2Height = ImageHeight(image2);
+@@ -5847,6 +5848,7 @@
+ tx = x + (tabPtr->screenWidth - tabPtr->textWidth) / 2;
+ break;
+ case SIDE_TOP:
++ default:
+ tx = x + (tabPtr->screenWidth - tabPtr->textWidth) / 2;
+ ty = y + dy + tabPtr->iPadY.side1 + IMAGE_PAD;
+ ix = x + (tabPtr->screenWidth - iw) / 2;
+@@ -5915,6 +5917,7 @@
+ i2x = x + (tabPtr->screenWidth - iw2) / 2;
+ break;
+ case SIDE_TOP:
++ default:
+ i2y = iy + imgHeight + IMAGE_PAD + setPtr->gapLeft;
+ i2x = x + (tabPtr->screenWidth - iw2) / 2;
+ break;
+--- a/generic/tkButton.c
++++ b/generic/tkButton.c
+@@ -1701,7 +1701,7 @@
+ GC newGC;
+ unsigned long mask;
+ Tk_Image image;
+- char *oldTextVar, *oldSelVar;
++ char *oldTextVar = NULL, *oldSelVar = NULL;
+ Blt_Tree oldTree;
+ int oldNode, result = TCL_OK;
+ char * oldABdStr = butPtr->activeBdImageString;
+@@ -1721,8 +1721,8 @@
+
+ if (Blt_ConfigureWidget(interp, butPtr->tkwin, configSpecs,
+ argc, argv, (char *)butPtr, flags) != TCL_OK) {
+- if (oldTextVar) ckfree(oldTextVar);
+- if (oldTextVar) ckfree(oldSelVar);
++ if (oldTextVar != NULL) ckfree(oldTextVar);
++ if (oldSelVar != NULL) ckfree(oldSelVar);
+ return TCL_ERROR;
+ }
+ /*
diff --git a/graphics/tclblt/patches/unused.patch b/graphics/tclblt/patches/unused.patch
new file mode 100644
index 0000000000..4cf7366b1b
--- /dev/null
+++ b/graphics/tclblt/patches/unused.patch
@@ -0,0 +1,899 @@
+Description: Patch deletes or comments out all unused variables.
+Author: Sergei Golovan
+Last-Modified: Wed, 09 Jul 2014 19:18:23 +0400
+
+--- a/generic/bltTree.c
++++ b/generic/bltTree.c
+@@ -1234,7 +1234,7 @@
+ int
+ Blt_TreeRelabelNode(TreeClient *clientPtr, Node *nodePtr, CONST char *string)
+ {
+- int result, inode;
++ int result;
+ if ((result=NotifyClients(clientPtr, clientPtr->treeObject, nodePtr,
+ TREE_NOTIFY_RELABEL)) != TCL_OK) {
+ return result;
+@@ -1245,7 +1245,6 @@
+ * been created.
+ */
+ SetModified(nodePtr);
+- inode = nodePtr->inode;
+ result = NotifyClients(clientPtr, clientPtr->treeObject, nodePtr,
+ TREE_NOTIFY_RELABELPOST);
+ return result;
+--- a/generic/bltTreeCmd.c
++++ b/generic/bltTreeCmd.c
+@@ -2078,10 +2078,8 @@
+ SetValues(TreeCmd *cmdPtr, Blt_TreeNode node, int objc, Tcl_Obj *CONST *objv)
+ {
+ register int i;
+- int inode;
+ char *string;
+
+- inode = node->inode;
+ for (i = 0; i < objc; i += 2) {
+ string = Tcl_GetString(objv[i]);
+ if ((i + 1) == objc) {
+@@ -2108,11 +2106,10 @@
+ {
+ register int i;
+ char *string;
+- int result = TCL_OK, inode;
++ int result = TCL_OK;
+ Tcl_DString dStr;
+ Tcl_Interp *interp = cmdPtr->interp;
+
+- inode = node->inode;
+ if (objc % 2) {
+ Tcl_AppendResult(interp, "odd # values", (char *)NULL);
+ return TCL_ERROR;
+@@ -4552,7 +4549,7 @@
+ Blt_TreeNode parent = NULL, child = NULL;
+ int cnt = 0, i, n, m, vobjc, tobjc, dobjc, pobjc, optInd, iPos = -1, incr = 0;
+ int hasoffs = 0, seqlabel = 0, seqVal = 0, hasstart = 0, start;
+- int fixed = 0, hasnum = 0, hcnt = 0;
++ int fixed = 0, hcnt = 0;
+ char *prefix = NULL, *string;
+ Tcl_Obj **vobjv = NULL;
+ Tcl_Obj **tobjv = NULL;
+@@ -4628,7 +4625,6 @@
+ if (Tcl_GetIntFromObj(interp, objv[3], &cnt) != TCL_OK) {
+ return TCL_ERROR;
+ }
+- hasnum = 1;
+ hcnt++;
+ if (cnt<0 || cnt>10000000) {
+ Tcl_AppendResult(interp, "count must be >= 0 and <= 10M", (char *)NULL);
+@@ -4982,13 +4978,13 @@
+ Tcl_Obj *listObjPtr, *objPtr;
+ register int i;
+ int isNew, len;
+- char *string;
++ /*char *string;*/
+ TagSearch tagIter = {0};
+
+ Blt_InitHashTableWithPool(&keyTable, BLT_ONE_WORD_KEYS);
+ listObjPtr = Tcl_NewListObj(0, (Tcl_Obj **) NULL);
+ for (i = 2; i < objc; i++) {
+- string = Tcl_GetStringFromObj(objv[i],&len);
++ /*string =*/ Tcl_GetStringFromObj(objv[i],&len);
+ if (len == 0) continue;
+ if (FindTaggedNodes(interp, cmdPtr, objv[i], &tagIter) != TCL_OK) {
+ Blt_DeleteHashTable(&keyTable);
+@@ -6525,7 +6521,7 @@
+ Blt_TreeNode node;
+ char *string;
+ Tcl_Obj *valuePtr;
+- int i, result = TCL_OK, inode;
++ int i, result = TCL_OK;
+ Tcl_DString dStr;
+
+ if (GetNode(cmdPtr, objv[2], &node) != TCL_OK) {
+@@ -6540,7 +6536,6 @@
+ cmdPtr->updTyp = 0;
+ }
+ Tcl_DStringInit(&dStr);
+- inode = node->inode;
+ for (i=3; i<objc; i+=2) {
+ string = Tcl_GetString(objv[i]);
+ if (Blt_TreeGetValue(interp, cmdPtr->tree, node, string,
+@@ -6599,11 +6594,11 @@
+ Tcl_Obj *CONST *objv)
+ {
+ Blt_TreeNode node;
+- char *string;
++ /*char *string;*/
+ int count = 0, len;
+ TagSearch cursor = {0};
+
+- string = Tcl_GetStringFromObj(objv[2],&len);
++ /*string =*/ Tcl_GetStringFromObj(objv[2],&len);
+ if (len == 0) {
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(0));
+ return TCL_OK;
+@@ -6834,7 +6829,7 @@
+ Tcl_Obj *CONST *objv)
+ {
+ Blt_TreeNode node;
+- char *string;
++ /*char *string;*/
+ int count = 0, result = TCL_OK, len;
+ Tcl_DString dStr;
+ TagSearch cursor = {0};
+@@ -6844,7 +6839,7 @@
+ return TCL_ERROR;
+ }
+ if (objc<=3) return TCL_OK;
+- string = Tcl_GetStringFromObj(objv[2], &len);
++ /*string =*/ Tcl_GetStringFromObj(objv[2], &len);
+ if (len == 0) {
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(0));
+ return TCL_OK;
+@@ -7169,7 +7164,6 @@
+ Blt_TreeNode node;
+ Tcl_Obj *listObjPtr;
+ Tcl_Obj *objPtr;
+- char *string;
+ int isNew;
+ register int i;
+
+@@ -7177,7 +7171,6 @@
+ for (i = 3; i < objc; i++) {
+ TagSearch tcursor = {0};
+
+- string = Tcl_GetString(objv[i]);
+ if (FindTaggedNodes(interp, cmdPtr, objv[i], &tcursor) != TCL_OK) {
+ Tcl_ResetResult(interp);
+ DoneTaggedNodes(&tcursor);
+@@ -7756,12 +7749,9 @@
+ Tcl_Obj *CONST *objv)
+ {
+ Blt_TreeNode node;
+- char *string;
+ int count = 0;
+ TagSearch cursor = {0};
+
+- string = Tcl_GetString(objv[2]);
+-
+ if (FindTaggedNodes(interp, cmdPtr, objv[2], &cursor) != TCL_OK) {
+ return TCL_ERROR;
+ }
+@@ -8084,7 +8074,7 @@
+ Tcl_Obj *valuePtr, *varObj, *nullObj = NULL, *nodeObj = NULL;
+ Tcl_Obj *hashObj = NULL, *starObj = NULL;
+ Blt_TreeKeySearch keyIter;
+- int vobjc, kobjc, i, result = TCL_OK, len, cnt = 0, isar;
++ int vobjc, kobjc, i, result = TCL_OK, len, cnt = 0/*, isar */;
+ int nobreak = 0, noupdate = 0, unset = 0, init = 0, aLen;
+ char *var, *string, *aName = NULL, *aPat = NULL;
+ int klen, kl, j;
+@@ -8251,7 +8241,7 @@
+ }
+ }
+
+- isar = 0;
++ /* isar = 0; */
+ if (arrName != NULL) {
+ kl = strlen(aName);
+
+@@ -8526,7 +8516,7 @@
+ {
+ Blt_TreeNode node;
+ int len, result;
+- char *var, *string;
++ char *var/*, *string*/;
+ TagSearch cursor = {0};
+
+ var = Tcl_GetString(objv[2]);
+@@ -8535,7 +8525,7 @@
+ Tcl_AppendResult(interp, "wrong number of args ", 0);
+ return TCL_ERROR;
+ }
+- string = Tcl_GetStringFromObj(objv[3],&len);
++ /*string =*/ Tcl_GetStringFromObj(objv[3],&len);
+ if (len == 0) {
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(0));
+ return TCL_OK;
+@@ -8894,6 +8884,7 @@
+ * Obj Callback for sqlload.
+ *
+ */
++#if 0
+ static int SqlCallbackObj(SqlData *sqlPtr, int argc, Tcl_Obj **objv, Tcl_Obj **azColName)
+ {
+ int i, j, rid, lid, n, tcid, vobjc, tobjc;
+@@ -9122,6 +9113,7 @@
+ return 1;
+ }
+ #endif
++#endif
+
+ #ifndef OMIT_SQLITE3_LOAD
+ /* #include <sqlite3.h> */
+--- a/generic/bltInit.c
++++ b/generic/bltInit.c
+@@ -438,9 +438,9 @@
+ {
+ Tcl_DString dString;
+ CONST char *value;
++#ifndef TCL_ONLY
+ static int tkisinit = 0;
+
+-#ifndef TCL_ONLY
+ if (!tkisinit) {
+ struct TileHandlers *thPtr;
+
+@@ -510,7 +510,9 @@
+ Tcl_Interp *interp; /* Interpreter to add extra commands */
+ {
+ int flags;
++#ifdef USE_BLT_STUBS
+ int dostub = 0;
++#endif
+
+ flags = (int)Tcl_GetAssocData(interp, BLT_THREAD_KEY, NULL);
+ if ((flags & BLT_TCL_CMDS) == 0) {
+--- a/generic/bltColor.c
++++ b/generic/bltColor.c
+@@ -77,7 +77,7 @@
+
+ #define NCOLORS 256
+
+-
++#if 0
+ static void
+ GetPaletteSizes(nColors, nRedsPtr, nGreensPtr, nBluesPtr)
+ int nColors; /* Number of colors requested. */
+@@ -129,6 +129,7 @@
+ }
+
+ }
++#endif
+
+ /*
+ *----------------------------------------------------------------------
+@@ -200,6 +201,7 @@
+ return numAvail;
+ }
+
++#if 0
+ static void
+ FindClosestColor(colorPtr, mapColors, numMapColors)
+ ColorInfo *colorPtr;
+@@ -342,6 +344,7 @@
+ colorTabPtr->nPixels = nImageColors;
+ return 1;
+ }
++#endif
+
+ ColorTable
+ Blt_CreateColorTable(tkwin)
+@@ -510,6 +513,7 @@
+ return colorTabPtr;
+ }
+
++#if 0
+ /*
+ * First attempt:
+ * Allocate colors all the colors in the image (up to NCOLORS). Bail out
+@@ -548,6 +552,7 @@
+ Blt_DeleteHashTable(&colorTable);
+ return nColors;
+ }
++#endif
+
+ #define Blt_DefaultColormap(tkwin) \
+ DefaultColormap(Tk_Display(tkwin), Tk_ScreenNumber(tkwin))
+@@ -563,11 +568,11 @@
+ int keepColors = 0;
+ register int i;
+ XColor usedColors[NCOLORS];
+- int nFreeColors, nUsedColors;
++ int nUsedColors;
+ Colormap colorMap;
+ int inUse[NCOLORS];
+ XColor *colorPtr;
+- XColor *imageColors;
++ /* XColor *imageColors; */
+
+ /*
+ * Create a private colormap if one doesn't already exist for the
+@@ -582,7 +587,7 @@
+ XFreeColors(colorTabPtr->display, colorTabPtr->colorMap,
+ colorTabPtr->pixelValues, colorTabPtr->nPixels, 0);
+ }
+- nFreeColors = QueryColormap(colorTabPtr->display, colorMap, usedColors,
++ QueryColormap(colorTabPtr->display, colorMap, usedColors,
+ &nUsedColors);
+ memset((char *)inUse, 0, sizeof(int) * NCOLORS);
+ if ((nUsedColors == 0) && (keepColors > 0)) {
+@@ -592,7 +597,7 @@
+ * have been used in the default colormap.
+ */
+
+- nFreeColors = QueryColormap(colorTabPtr->display,
++ QueryColormap(colorTabPtr->display,
+ Blt_DefaultColormap(tkwin), usedColors, &nUsedColors);
+
+ /*
+@@ -622,7 +627,7 @@
+ * image as we can fit. If necessary, we'll cheat and reduce the number
+ * of colors by quantizing.
+ */
+- imageColors = usedColors + nUsedColors;
++ /* imageColors = usedColors + nUsedColors; */
+
+ Tk_SetWindowColormap(tkwin, colorMap);
+ }
+--- a/generic/bltTabset.c
++++ b/generic/bltTabset.c
+@@ -3916,12 +3916,9 @@
+ {
+ int x, y; /* Screen coordinates of the test point. */
+ Tab *tabPtr;
+- int dw, dh;
+ char coords[200];
+
+ coords[0] = 0;
+- dw = Tk_Width(setPtr->tkwin);
+- dh = Tk_Height(setPtr->tkwin);
+ tabPtr = NULL;
+ if ((Tk_GetPixels(interp, setPtr->tkwin, argv[2], &x) != TCL_OK) ||
+ (Tk_GetPixels(interp, setPtr->tkwin, argv[3], &y) != TCL_OK)) {
+@@ -5247,18 +5244,14 @@
+ Tab *startPtr, *nextPtr;
+ Blt_ChainLink *linkPtr;
+ register Tab *tabPtr;
+- int x, maxWidth, sImg, eImg;
++ int x, maxWidth, sImg;
+ int vert = (setPtr->side & SIDE_VERTICAL);
+
+ sImg = 0;
+- eImg = 0;
+
+ if (setPtr->startImage) {
+ sImg = (vert?setPtr->startImage->height:setPtr->startImage->width);
+ }
+- if (setPtr->endImage) {
+- eImg = (vert?setPtr->endImage->height:setPtr->endImage->width);
+- }
+
+ tabsPerTier = (nTabs + (setPtr->nTiers - 1)) / setPtr->nTiers;
+ x = sImg;
+--- a/generic/bltTile.c
++++ b/generic/bltTile.c
+@@ -1176,10 +1176,7 @@
+ }
+ if (clientPtr->tilePtr->mask != None) {
+ Pixmap mask;
+- int xm, ym;
+
+- xm = clientPtr->xOrigin;
+- ym = clientPtr->yOrigin;
+ mask = RectangleMask(display, drawable, x, y, width, height,
+ tilePtr->mask, clientPtr->xOrigin, clientPtr->yOrigin);
+ XSetClipMask(display, tilePtr->gc, mask);
+--- a/generic/bltTreeView.c
++++ b/generic/bltTreeView.c
+@@ -5042,7 +5042,7 @@
+ && strlen(Tcl_GetString(tvPtr->imageCmd))) {
+ Tcl_DString cmdString;
+ char *string;
+- int result, rcnt;
++ int /*result,*/ rcnt;
+ Tcl_Interp *interp = tvPtr->interp;
+
+ string = Blt_GetHashKey(&tvPtr->iconTable, icon->hashPtr);
+@@ -5052,7 +5052,7 @@
+ if (entryPtr) Tcl_Preserve(entryPtr);
+ if (columnPtr) Tcl_Preserve(columnPtr);
+ Blt_TreeViewPercentSubst(tvPtr, entryPtr, columnPtr, Tcl_GetString(tvPtr->imageCmd), string, &cmdString);
+- result = Tcl_GlobalEval(interp, Tcl_DStringValue(&cmdString));
++ /* result = */ Tcl_GlobalEval(interp, Tcl_DStringValue(&cmdString));
+ rcnt = icon->refCount;
+ Blt_TreeViewFreeIcon(tvPtr, icon);
+ if ((tvPtr->flags & TV_DELETED)
+@@ -5286,10 +5286,10 @@
+ TreeViewIcon *icons;
+ TreeViewIcon icon;
+
+- int isActive, hasFocus;
++ int isActive/*, hasFocus*/;
+
+ isActive = (entryPtr == tvPtr->activePtr);
+- hasFocus = (entryPtr == tvPtr->focusPtr);
++ /*hasFocus = (entryPtr == tvPtr->focusPtr);*/
+ icons = NULL;
+ if (tvPtr->flags & TV_HIDE_ICONS) {
+ return NULL;
+@@ -5879,9 +5879,9 @@
+ int x0, cx, xOffset;
+ TreeViewStyle *sPtr;
+ TreeViewIcon icon;
+- int mw, mh;
++ int mw/*, mh*/;
+ mw = Tk_Width(tvPtr->tkwin) - tvPtr->padX;
+- mh = Tk_Height(tvPtr->tkwin) - tvPtr->padY;
++ /* mh = Tk_Height(tvPtr->tkwin) - tvPtr->padY; */
+
+ if (tvPtr->titleHeight < 1) {
+ return;
+--- a/generic/bltTreeViewCmd.c
++++ b/generic/bltTreeViewCmd.c
+@@ -668,10 +668,8 @@
+ hPtr = Blt_FirstHashEntry(tablePtr, &infoPtr->cursor);
+ if (hPtr != NULL) {
+ Blt_TreeNode node;
+- int inode;
+
+ node = Blt_GetHashValue(hPtr);
+- inode = node->inode;
+ infoPtr->entryPtr = Blt_NodeToEntry(tvPtr, node);
+ if (infoPtr->entryPtr == NULL && cnt++ == 0) {
+ /* fprintf(stderr, "Dangling node: %d\n", node->inode); */
+@@ -1689,13 +1687,11 @@
+ TreeViewEntry *entryPtr;
+ TreeViewColumn *columnPtr;
+ int n, result;
+- Blt_TreeNode node;
+ char *left, *string;
+
+ if (GetEntryFromObj(tvPtr, objv[3], &entryPtr) != TCL_OK) {
+ return TCL_ERROR;
+ }
+- node = entryPtr->node;
+ string = Tcl_GetString(objv[4]);
+ if (Blt_TreeViewGetColumnKey(interp, tvPtr, objv[4], &columnPtr, &left)
+ != TCL_OK || columnPtr == NULL) {
+@@ -1777,7 +1773,6 @@
+ {
+ TreeViewEntry *entryPtr;
+ TreeViewColumn *columnPtr;
+- Blt_TreeNode node;
+ double dVal, dIncr = 1.0;
+ int iVal, iIncr = 1, isInt = 0;
+ Tcl_Obj *objPtr, *valueObjPtr;
+@@ -1786,7 +1781,6 @@
+ if (GetEntryFromObj(tvPtr, objv[3], &entryPtr) != TCL_OK) {
+ return TCL_ERROR;
+ }
+- node = entryPtr->node;
+ string = Tcl_GetString(objv[4]);
+ if (Blt_TreeViewGetColumnKey(interp, tvPtr, objv[4], &columnPtr, &left)
+ != TCL_OK || columnPtr == NULL) {
+@@ -1841,7 +1835,6 @@
+ Tcl_Obj *CONST *objv;
+ {
+ TreeViewEntry *entryPtr;
+- Blt_TreeNode node;
+ char *key;
+ Tcl_Obj *objPtr;
+
+@@ -1877,7 +1870,6 @@
+ return TCL_OK;
+ }
+ key = Tcl_GetString(objv[4]);
+- node = entryPtr->node;
+ Tcl_Release(entryPtr);
+ if (Blt_TreeGetValue(tvPtr->interp, tvPtr->tree, entryPtr->node,
+ key, &objPtr) != TCL_OK) {
+@@ -2656,7 +2648,7 @@
+ TreeViewEntry *entryPtr;
+ char *string;
+ int isRoot, isTest;
+- int x, y, wx, wy;
++ int x, y;
+ int rootX, rootY;
+
+ Tk_GetRootCoords(tvPtr->tkwin, &rootX, &rootY);
+@@ -2693,8 +2685,6 @@
+ (Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK)) {
+ return TCL_ERROR;
+ }
+- wx = x;
+- wy = y;
+ if (isRoot) {
+ x -= rootX;
+ y -= rootY;
+@@ -3768,7 +3758,7 @@
+ int nMatches, maxMatches, result, length, ocnt, useformat,userow, isvis;
+ int depth, maxdepth, mindepth, mask, istree, isleaf, invis, ismap, uselabel;
+ int isopen, isclosed, notop, nocase, isfull, cmdLen, docount, optInd, reldepth;
+- int isnull, retLabel, isret, cmdValue;
++ int isnull, retLabel, isret;
+ char *colStr, *keysub;
+ Tcl_Obj *cmdObj, *cmdArgs;
+ Tcl_Obj **aobjv;
+@@ -3815,7 +3805,6 @@
+ reldepth = notop = 0;
+ nocase = 0, isfull = 0, useformat = 0;
+ keysub = colStr = NULL;
+- cmdValue = 0;
+ curValue = NULL;
+ cmdObj = NULL;
+ cmdArgs = NULL;
+@@ -4663,7 +4652,7 @@
+ register int i;
+ int length, depth = -1, maxdepth = -1, mindepth = -1, noArgs, usefull = 0;
+ int result, nocase, uselabel = 0, optInd, ocnt;
+- char *pattern, *curValue;
++ char *curValue;
+ Blt_List options;
+ TreeViewEntry *entryPtr;
+ register Blt_ListNode node;
+@@ -4918,7 +4907,6 @@
+ != TCL_OK) {
+ goto error; /* This shouldn't happen. */
+ }
+- pattern = Blt_ListGetValue(node);
+ objPtr = Tcl_GetObjResult(interp);
+ result = (*compareProc)(interp, Tcl_GetString(objPtr), kPtr, nocase);
+ if (result == invertMatch) {
+@@ -5192,10 +5180,10 @@
+ TreeViewColumn *columnPtr;
+ TreeViewEntry *entryPtr;
+ Tcl_DString dStr;
+- int optSkips, i, m, start, nOptions, inode;
++ int optSkips, i, m, start, nOptions/*, inode*/;
+
+ useid = -1;
+- inode = -1;
++ /*inode = -1;*/
+ optSkips = 0;
+ sobjc = 0;
+ tobjc = 0;
+@@ -5289,7 +5277,7 @@
+ }
+ addpath:
+ node = NULL;
+- inode = -1;
++ /*inode = -1;*/
+ if (oLen == 5
+ && (tvPtr->pathSep == SEPARATOR_NONE || tvPtr->pathSep == NULL)
+ && path[0] == '#' && strcmp(path, "#auto") == 0) {
+@@ -5420,7 +5408,7 @@
+ goto error;
+ }
+ makeent:
+- inode = node->inode;
++ /*inode = node->inode;*/
+ if (Blt_TreeViewCreateEntry(tvPtr, node, 0, options, BLT_CONFIG_OBJV_ONLY) != TCL_OK) {
+ goto opterror;
+ }
+--- a/generic/bltTreeViewColumn.c
++++ b/generic/bltTreeViewColumn.c
+@@ -413,7 +413,6 @@
+ char *string;
+ int objc;
+ register int i;
+- Blt_TreeNode node;
+ TreeView *tvPtr;
+
+ string = Tcl_GetString(objPtr);
+@@ -431,7 +430,6 @@
+ "\" must be in even name-value pairs", (char *)NULL);
+ return TCL_ERROR;
+ }
+- node = entryPtr->node;
+ tvPtr = entryPtr->tvPtr;
+ for (i = 0; i < objc; i += 2) {
+ int result;
+@@ -709,11 +707,9 @@
+ {
+ int n = 0;
+ Blt_ChainLink *linkPtr;
+- TreeViewColumn *columnPtr;
+
+ for (linkPtr = Blt_ChainFirstLink(tvPtr->colChainPtr); linkPtr != NULL;
+ linkPtr = Blt_ChainNextLink(linkPtr)) {
+- columnPtr = Blt_ChainGetValue(linkPtr);
+ n++;
+ }
+ return n;
+@@ -2477,7 +2473,7 @@
+ Tcl_Obj *CONST *objv;
+ {
+ TreeViewColumn *colPtr;
+- int width, height;
++ int width;
+ Tk_Anchor anchor;
+ int left, right;
+ char *string;
+@@ -2508,7 +2504,6 @@
+ return TCL_OK;
+ }
+ width = VPORTWIDTH(tvPtr);
+- height = VPORTHEIGHT(tvPtr);
+
+ left = tvPtr->xOffset;
+ right = tvPtr->xOffset + width;
+@@ -3342,11 +3337,11 @@
+ Tcl_IncrRefCount(entryPtr->dataObjPtr);
+ }
+ } else {
+- Blt_TreeKey key;
++ /*Blt_TreeKey key;*/
+ Tcl_Obj *objPtr;
+ int isFmt;
+
+- key = tvPtr->sortColumnPtr->key;
++ /*key = tvPtr->sortColumnPtr->key;*/
+ isFmt = Blt_TreeViewStyleIsFmt(tvPtr, tvPtr->sortColumnPtr->stylePtr);
+ for(p = tvPtr->flatArr; *p != NULL; p++) {
+ TreeViewValue *valuePtr;
+--- a/generic/bltTreeViewStyle.c
++++ b/generic/bltTreeViewStyle.c
+@@ -1600,15 +1600,13 @@
+ int textX, textY, textHeight;
+ int gap, columnWidth, ttlWidth;
+ int bool;
+- int borderWidth, relief;
++ /* int borderWidth, relief; */
+ TextLayout *textPtr;
+ int boxX, boxY, boxWidth, boxHeight;
+ TreeViewStyle *csPtr, sRec = *stylePtr;
+ int valWidth = (valuePtr->textPtr?valuePtr->width:(icon?TreeViewIconWidth(icon):0));
+- TextLayout *layPtr;
+ int showValue;
+
+- layPtr = (tvPtr->hideStyleText?NULL:valuePtr->textPtr);
+ showValue = (tvPtr->hideStyleText ? 0 : cbPtr->showValue);
+
+ columnPtr = valuePtr->columnPtr;
+@@ -1617,13 +1615,13 @@
+ drawTextBox(tvPtr, drawable, entryPtr, valuePtr, stylePtr, icon, x, y, &sRec);
+ gc = sRec.gc;
+
+- if (gc != stylePtr->activeGC) {
++ /* if (gc != stylePtr->activeGC) {
+ borderWidth = 0;
+ relief = TK_RELIEF_FLAT;
+ } else {
+ borderWidth = 1;
+ relief = TK_RELIEF_RAISED;
+- }
++ } */
+
+ columnWidth = columnPtr->width - PADDING(columnPtr->pad);
+ if (!valuePtr->string) {
+@@ -2629,15 +2627,10 @@
+ TreeViewStyle *csPtr, sRec = *stylePtr;
+ int valWidth = (valuePtr->textPtr?valuePtr->width:(icon?TreeViewIconWidth(icon):0));
+ double curValue;
+- char *string;
+ TextStyle ts;
+ XColor *color;
+- TextLayout *layPtr;
+ int showValue = (tvPtr->hideStyleText ? 0 : cbPtr->showValue);
+
+- layPtr = (tvPtr->hideStyleText?NULL:valuePtr->textPtr);
+-
+- string = NULL;
+ textPtr = NULL;
+ columnPtr = valuePtr->columnPtr;
+ csPtr = columnPtr->stylePtr;
+@@ -3417,7 +3410,6 @@
+ {
+ TreeViewColumn *columnPtr;
+ TreeViewWindowBox *tbPtr = (TreeViewWindowBox *)stylePtr;
+- Tk_Window tkwin;
+ int width, height, diff;
+ WindowCell *wcPtr;
+ TreeViewStyle sRec = *stylePtr;
+@@ -3438,7 +3430,6 @@
+ int columnWidth = columnPtr->width -
+ (2 * columnPtr->borderWidth + PADDING(columnPtr->pad));
+
+- tkwin = wcPtr->tkwin;
+ width = columnWidth;
+ height = entryPtr->height-1;
+ if ((diff = (y-tvPtr->titleHeight- tvPtr->insetY))<0) {
+--- a/generic/bltUnixDnd.c
++++ b/generic/bltUnixDnd.c
+@@ -1459,6 +1459,7 @@
+ *
+ * ------------------------------------------------------------------------
+ */
++#if 0
+ static void
+ MorphToken(dndPtr)
+ Dnd *dndPtr; /* Drag-and-drop manager (source). */
+@@ -1511,6 +1512,7 @@
+ }
+ RaiseToken(dndPtr);
+ }
++#endif
+
+ static void
+ GetTokenPosition(dndPtr, x, y)
+--- a/generic/bltWinop.c
++++ b/generic/bltWinop.c
+@@ -913,7 +913,7 @@
+ Tk_PhotoHandle srcPhoto;
+ Tk_PhotoImageBlock src;
+ Blt_ColorImage srcImage;
+- int top, x, y, isalph, iscnt, isNew, cnt;
++ int x, y, isalph, iscnt, isNew, cnt;
+ int i, rng[4], from = 0;
+ register Pix32 *srcPtr;
+ Tcl_Obj *listPtr;
+@@ -922,7 +922,6 @@
+ Blt_HashTable hTbl;
+ Blt_HashSearch cursor;
+
+- top = 0;
+ isalph = 0;
+ iscnt = 0;
+ while (argc > 3) {
+@@ -1524,7 +1523,7 @@
+ {
+ double range[3];
+ double left[3];
+- int x, y, width;
++ int x, width;
+ double t;
+ XColor C;
+ XColor *leftPtr, *rightPtr;
+@@ -1554,7 +1553,6 @@
+ range[1] = (double)((rightPtr->green - leftPtr->green) / 257.0);
+ range[2] = (double)((rightPtr->blue - leftPtr->blue) / 257.0);
+
+- y =0;
+ for (x = 0; x < width; x++) {
+ char cbuf[100];
+ t = ((double)( sin(M_PI_2 * (double)x / (double)width)));
+@@ -1574,7 +1572,7 @@
+ XColor *leftPtr, *rightPtr;
+ double range[3];
+ double left[3];
+- int x, y, width;
++ int x, width;
+ double t;
+ XColor **destPtr, C;
+
+@@ -1587,7 +1585,6 @@
+ range[1] = (double)((rightPtr->green - leftPtr->green) / 257.0);
+ range[2] = (double)((rightPtr->blue - leftPtr->blue) / 257.0);
+
+- y =0;
+ width = gradPtr->width;
+ if (gradPtr->grads) {
+ Blt_FreeGradient(gradPtr);
+--- a/generic/tkButton.c
++++ b/generic/tkButton.c
+@@ -352,11 +352,9 @@
+ char *string, char *widgRec, int offset, char *strList[], char *label )
+ {
+ int *namePtr = (int *)(widgRec + offset);
+- char c;
+ int i;
+
+ for (i=0; strList[i]; i++) {
+- c = string[0];
+ if (strcmp(string, strList[i]) == 0) {
+ *namePtr = i;
+ return TCL_OK;
+@@ -898,11 +896,10 @@
+ {
+ Button *butPtr = (Button*)widgRec;;
+ int argc = 0;
+- int result, i;
++ int i;
+ char **argv;
+ Tk_Image imgs[9], image;
+
+- result = TCL_OK;
+ if (string && Tcl_SplitList(interp, string, &argc, &argv) != TCL_OK) {
+ return TCL_ERROR;
+ }
+@@ -1703,7 +1700,7 @@
+ Tk_Image image;
+ char *oldTextVar = NULL, *oldSelVar = NULL;
+ Blt_Tree oldTree;
+- int oldNode, result = TCL_OK;
++ int result = TCL_OK;
+ char * oldABdStr = butPtr->activeBdImageString;
+ char * oldDBStr = butPtr->disabledBdImageString;
+ char * oldBDStr = butPtr->bdImageString;
+@@ -1712,7 +1709,6 @@
+
+ winPtr = (Tk_FakeWin *) (butPtr->tkwin);
+ oldTree = butPtr->tree;
+- oldNode = butPtr->node;
+
+ if (oldTree == NULL) {
+ oldTextVar = (butPtr->textVarName?strdup(butPtr->textVarName):NULL);
+@@ -2219,7 +2215,7 @@
+ * the text to make the button appear to
+ * move up and down as the relief changes. */
+ Blt_Tile tile, bgTile, inTile;
+- int borderWidth, drawBorder;
++ int drawBorder;
+ int textXOffset, textYOffset;
+ int haveImage = 0, haveText = 0;
+ int imageWidth, imageHeight;
+@@ -2305,7 +2301,6 @@
+ bgTile = TILECHOOSE(bgTile,butPtr->innerTile);
+ }
+ border = butPtr->normalBorder;
+- borderWidth = butPtr->borderWidth;
+
+ gc = butPtr->normalTextGC;
+
+--- a/generic/bltScrollbar.c
++++ b/generic/bltScrollbar.c
+@@ -1017,7 +1017,9 @@
+ {
+ register Scrollbar *scrollPtr = clientData;
+ register Tk_Window tkwin = scrollPtr->tkwin;
++#ifdef notdef
+ XPoint points[7];
++#endif
+ Tk_3DBorder border;
+ int relief, width, elementBorderWidth;
+ Pixmap pixmap;
+--- a/generic/bltTed.c
++++ b/generic/bltTed.c
+@@ -306,10 +306,14 @@
+ static void DisplayTed _ANSI_ARGS_((ClientData clientData));
+ static void DestroyTed _ANSI_ARGS_((DestroyData destroyData));
+ static void DisplayEntry _ANSI_ARGS_((ClientData clientData));
++#if 0
+ static void DestroyEntry _ANSI_ARGS_((DestroyData destoryData));
++#endif
+
+ static Tcl_CmdProc TedCmd;
++#if 0
+ static Tk_EventProc EntryEventProc;
++#endif
+ static Tk_EventProc TedEventProc;
+
+ /*
+@@ -360,6 +364,7 @@
+ *
+ *----------------------------------------------------------------------
+ */
++#if 0
+ static void
+ EventuallyRedrawEntry(repPtr)
+ EntryRep *repPtr; /* Information about editor. */
+@@ -369,6 +374,7 @@
+ Tcl_DoWhenIdle(DisplayEntry, repPtr);
+ }
+ }
++#endif
+
+ /*
+ * --------------------------------------------------------------
+@@ -387,6 +393,7 @@
+ *
+ * --------------------------------------------------------------
+ */
++#if 0
+ static void
+ EntryEventProc(clientData, eventPtr)
+ ClientData clientData; /* Information about window. */
+@@ -408,6 +415,7 @@
+ Tcl_EventuallyFree(repPtr, DestroyEntry);
+ }
+ }
++#endif
+
+ /*
+ * --------------------------------------------------------------
+@@ -548,6 +556,7 @@
+ *
+ * ----------------------------------------------------------------------------
+ */
++#if 0
+ static int
+ CreateEntry(tedPtr, entryPtr)
+ Ted *tedPtr;
+@@ -614,6 +623,7 @@
+ }
+ }
+ }
++#endif
+
+ /*
+ * ----------------------------------------------------------------------------
diff --git a/graphics/tclblt/patches/usetclint.patch b/graphics/tclblt/patches/usetclint.patch
new file mode 100644
index 0000000000..fb51b11b84
--- /dev/null
+++ b/graphics/tclblt/patches/usetclint.patch
@@ -0,0 +1,26 @@
+Description: Patch adds missing headers which helps building BLT on
+ 64-bit architectures.
+Author: Matthias Klose
+Last-Modified: Sun, 06 Jul 2014 07:28:14 +0400
+
+--- a/generic/bltNsUtil.c
++++ b/generic/bltNsUtil.c
+@@ -27,6 +27,8 @@
+
+ #include "bltInt.h"
+ #include "bltList.h"
++#include "bltNsUtil.h"
++#include "tclInt.h"
+
+ /* Namespace related routines */
+
+--- a/configure.in
++++ b/configure.in
+@@ -825,6 +825,7 @@
+ "${TCL_INC_DIR}" != "${TK_INC_DIR}" ; then
+ INC_SPECS="${INC_SPECS} -I${TCL_INC_DIR}"
+ fi
++INC_SPECS="${INC_SPECS} -I${TCL_SRC_DIR}/generic -I${TCL_SRC_DIR}/unix"
+
+
+ # On Windows, override the default include directory with our own.
diff --git a/graphics/tclblt/patches/usetkint.patch b/graphics/tclblt/patches/usetkint.patch
new file mode 100644
index 0000000000..deb67e4461
--- /dev/null
+++ b/graphics/tclblt/patches/usetkint.patch
@@ -0,0 +1,1409 @@
+Description: Patch removes internal definitions of the main Tk structures.
+ Since they have been changed since Tcl/Tk 8.4 it's much better to
+ include tkInt.h and other few headers. They are internal Tk headers,
+ so the BLT library built with Tcl/Tk 8.6 won't work with Tcl/Tk 8.5.
+Author: FreeBSD BLT port maintainers
+Last-Modified: Fri, 04 Jul 2014 09:13:24 +0400
+
+--- a/generic/bltTkInt.h
++++ b/generic/bltTkInt.h
+@@ -27,214 +27,8 @@
+ #ifndef _BLT_TKINT_H
+ #define _BLT_TKINT_H
+
+-typedef struct {
+- Tk_Uid family; /* Font family. The most important field. */
+- int pointsize; /* Pointsize of font, 0 for default size, or
+- * negative number meaning pixel size. */
+- int weight; /* Weight flag; see below for def'n. */
+- int slant; /* Slant flag; see below for def'n. */
+- int underline; /* Non-zero for underline font. */
+- int overstrike; /* Non-zero for overstrike font. */
+-} TkFontAttributes;
+-
+-typedef struct {
+- int ascent; /* From baseline to top of font. */
+- int descent; /* From baseline to bottom of font. */
+- int maxWidth; /* Width of widest character in font. */
+- int fixed; /* Non-zero if this is a fixed-width font,
+- * 0 otherwise. */
+-} TkFontMetrics;
+-
+-
+-typedef struct TkFontStruct {
+- /*
+- * Fields used and maintained exclusively by generic code.
+- */
+-#if (TK_VERSION_NUMBER >= _VERSION(8,1,0))
+- int resourceRefCount; /* Number of active uses of this font (each
+- * active use corresponds to a call to
+- * Tk_AllocFontFromTable or Tk_GetFont).
+- * If this count is 0, then this TkFont
+- * structure is no longer valid and it isn't
+- * present in a hash table: it is being
+- * kept around only because there are objects
+- * referring to it. The structure is freed
+- * when resourceRefCount and objRefCount
+- * are both 0. */
+- int objRefCount; /* The number of Tcl objects that reference
+- * this structure. */
+-#else
+- int refCount; /* Number of users of the TkFont. */
+-#endif
+- Tcl_HashEntry *cacheHashPtr;/* Entry in font cache for this structure,
+- * used when deleting it. */
+- Tcl_HashEntry *namedHashPtr;/* Pointer to hash table entry that
+- * corresponds to the named font that the
+- * tkfont was based on, or NULL if the tkfont
+- * was not based on a named font. */
+-#if (TK_VERSION_NUMBER >= _VERSION(8,1,0))
+- Screen *screen; /* The screen where this font is valid. */
+-#endif /* TK_VERSION_NUMBER >= 8.1.0 */
+- int tabWidth; /* Width of tabs in this font (pixels). */
+- int underlinePos; /* Offset from baseline to origin of
+- * underline bar (used for drawing underlines
+- * on a non-underlined font). */
+- int underlineHeight; /* Height of underline bar (used for drawing
+- * underlines on a non-underlined font). */
+-
+- /*
+- * Fields in the generic font structure that are filled in by
+- * platform-specific code.
+- */
+-
+- Font fid; /* For backwards compatibility with XGCValues
+- * structures. Remove when TkGCValues is
+- * implemented. */
+- TkFontAttributes fa; /* Actual font attributes obtained when the
+- * the font was created, as opposed to the
+- * desired attributes passed in to
+- * TkpGetFontFromAttributes(). The desired
+- * metrics can be determined from the string
+- * that was used to create this font. */
+- TkFontMetrics fm; /* Font metrics determined when font was
+- * created. */
+-#if (TK_VERSION_NUMBER >= _VERSION(8,1,0))
+- struct TkFontStruct *nextPtr; /* Points to the next TkFont structure with
+- * the same name. All fonts with the
+- * same name (but different displays) are
+- * chained together off a single entry in
+- * a hash table. */
+-#endif /* TK_VERSION_NUMBER >= 8.1.0 */
+-} TkFont;
+-
+-/*
+- * This structure is used by the Mac and Window porting layers as
+- * the internal representation of a clip_mask in a GC.
+- */
+-typedef struct TkRegionStruct *TkRegion;
+-
+-typedef struct {
+- int type; /* One of TKP_CLIP_PIXMAP or TKP_CLIP_REGION */
+- union {
+- Pixmap pixmap;
+- TkRegion region;
+- } value;
+-} TkpClipMask;
+-
+-#define TKP_CLIP_PIXMAP 0
+-#define TKP_CLIP_REGION 1
+-
+-#ifdef WIN32
+-/*
+- * The TkWinDrawable is the internal implementation of an X Drawable (either
+- * a Window or a Pixmap). The following constants define the valid Drawable
+- * types.
+- */
+-
+-#define TWD_BITMAP 1
+-#define TWD_WINDOW 2
+-#define TWD_WINDC 3
+-
+-typedef struct TkWindowStruct TkWindow;
+-
+-typedef struct {
+- int type;
+- HWND handle;
+- TkWindow *winPtr;
+-} TkWinWindow;
+-
+-typedef struct {
+- int type;
+- HBITMAP handle;
+- Colormap colormap;
+- int depth;
+-} TkWinBitmap;
+-
+-typedef struct {
+- int type;
+- HDC hdc;
+-} TkWinDC;
+-
+-typedef union {
+- int type;
+- TkWinWindow window;
+- TkWinBitmap bitmap;
+- TkWinDC winDC;
+-} TkWinDrawable;
+-
+-/*
+- * The TkWinDCState is used to save the state of a device context
+- * so that it can be restored later.
+- */
+-
+-typedef struct {
+- HPALETTE palette;
+- int bkmode; /* This field was added in Tk
+- * 8.3.1. Be careful that you don't
+- * use this structure in a context
+- * where its size is important. */
+-} TkWinDCState;
+-
+-extern HDC TkWinGetDrawableDC(Display *display, Drawable drawable,
+- TkWinDCState * state);
+-extern HDC TkWinReleaseDrawableDC(Drawable drawable, HDC dc,
+- TkWinDCState * state);
+-
+-extern HWND Tk_GetHWND _ANSI_ARGS_((Window window));
+-
+-extern HINSTANCE Tk_GetHINSTANCE _ANSI_ARGS_((void));
+-
+-extern Window Tk_AttachHWND _ANSI_ARGS_((Tk_Window tkwin, HWND hWnd));
+-
+-#endif /* WIN32 */
+-
+-/*
+- * The Border structure used internally by the Tk_3D* routines.
+- * The following is a copy of it from tk3d.c.
+- */
+-
+-typedef struct TkBorderStruct {
+- Screen *screen; /* Screen on which the border will be used. */
+- Visual *visual; /* Visual for all windows and pixmaps using
+- * the border. */
+- int depth; /* Number of bits per pixel of drawables where
+- * the border will be used. */
+- Colormap colormap; /* Colormap out of which pixels are
+- * allocated. */
+- int refCount; /* Number of different users of
+- * this border. */
+-#if (TK_VERSION_NUMBER >= _VERSION(8,1,0))
+- int objRefCount; /* The number of Tcl objects that reference
+- * this structure. */
+-#endif /* TK_VERSION_NUMBER >= 8.1.0 */
+- XColor *bgColor; /* Background color (intensity between
+- * lightColorPtr and darkColorPtr). */
+- XColor *darkColor; /* Color for darker areas (must free when
+- * deleting structure). NULL means shadows
+- * haven't been allocated yet.*/
+- XColor *lightColor; /* Color used for lighter areas of border
+- * (must free this when deleting structure).
+- * NULL means shadows haven't been allocated
+- * yet. */
+- Pixmap shadow; /* Stipple pattern to use for drawing
+- * shadows areas. Used for displays with
+- * <= 64 colors or where colormap has filled
+- * up. */
+- GC bgGC; /* Used (if necessary) to draw areas in
+- * the background color. */
+- GC darkGC; /* Used to draw darker parts of the
+- * border. None means the shadow colors
+- * haven't been allocated yet.*/
+- GC lightGC; /* Used to draw lighter parts of
+- * the border. None means the shadow colors
+- * haven't been allocated yet. */
+- Tcl_HashEntry *hashPtr; /* Entry in borderTable (needed in
+- * order to delete structure). */
+- struct TkBorderStruct *nextPtr; /* Points to the next TkBorder structure with
+- * the same color name. Borders with the
+- * same name but different screens or
+- * colormaps are chained together off a
+- * single entry in borderTable. */
+-} TkBorder;
++#include <tkInt.h>
++#include <tk3d.h>
++#include <tkFont.h>
+
+ #endif /* BLT_TKINT_H */
+--- a/generic/bltWindow.c
++++ b/generic/bltWindow.c
+@@ -33,25 +33,7 @@
+ #include <X11/Xproto.h>
+ #endif
+
+-typedef struct TkIdStackStruct TkIdStack;
+-typedef struct TkErrorHandlerStruct TkErrorHandler;
+-typedef struct TkSelectionInfoStruct TkSelectionInfo;
+-typedef struct TkClipboardTargetStruct TkClipboardTarget;
+-
+-#ifndef WIN32
+-typedef struct TkWindowStruct TkWindow;
+-#endif
+-typedef struct TkWindowEventStruct TkWindowEvent;
+-typedef struct TkMainInfoStruct TkMainInfo;
+-typedef struct TkEventHandlerStruct TkEventHandler;
+-typedef struct TkSelHandlerStruct TkSelHandler;
+-typedef struct TkWinInfoStruct TkWinInfo;
+-typedef struct TkClassProcsStruct TkClassProcs;
+-typedef struct TkWindowPrivateStruct TkWindowPrivate;
+-typedef struct TkGrabEventStruct TkGrabEvent;
+-typedef struct TkColormapStruct TkColormap;
+-typedef struct TkStressedCmapStruct TkStressedCmap;
+-typedef struct TkWmInfoStruct TkWmInfo;
++#include <tkInt.h>
+
+ #ifdef XNQueryInputStyle
+ #define TK_USE_INPUT_METHODS
+@@ -70,766 +52,6 @@
+ #define TK_REPARENTED 0
+ #endif
+
+-#if (TK_VERSION_NUMBER >= _VERSION(8,1,0))
+-
+-typedef struct TkCaret {
+- struct TkWindow *winPtr; /* the window on which we requested caret
+- * placement */
+- int x; /* relative x coord of the caret */
+- int y; /* relative y coord of the caret */
+- int height; /* specified height of the window */
+-} TkCaret;
+-
+-/*
+- * One of the following structures is maintained for each display
+- * containing a window managed by Tk. In part, the structure is
+- * used to store thread-specific data, since each thread will have
+- * its own TkDisplay structure.
+- */
+-
+-typedef struct TkDisplayStruct {
+- Display *display; /* Xlib's info about display. */
+- struct TkDisplayStruct *nextPtr; /* Next in list of all displays. */
+- char *name; /* Name of display (with any screen
+- * identifier removed). Malloc-ed. */
+- Time lastEventTime; /* Time of last event received for this
+- * display. */
+-
+- /*
+- * Information used primarily by tk3d.c:
+- */
+-
+- int borderInit; /* 0 means borderTable needs initializing. */
+- Tcl_HashTable borderTable; /* Maps from color name to TkBorder
+- * structure. */
+-
+- /*
+- * Information used by tkAtom.c only:
+- */
+-
+- int atomInit; /* 0 means stuff below hasn't been
+- * initialized yet. */
+- Tcl_HashTable nameTable; /* Maps from names to Atom's. */
+- Tcl_HashTable atomTable; /* Maps from Atom's back to names. */
+-
+- /*
+- * Information used primarily by tkBind.c:
+- */
+-
+- int bindInfoStale; /* Non-zero means the variables in this
+- * part of the structure are potentially
+- * incorrect and should be recomputed. */
+- unsigned int modeModMask; /* Has one bit set to indicate the modifier
+- * corresponding to "mode shift". If no
+- * such modifier, than this is zero. */
+- unsigned int metaModMask; /* Has one bit set to indicate the modifier
+- * corresponding to the "Meta" key. If no
+- * such modifier, then this is zero. */
+- unsigned int altModMask; /* Has one bit set to indicate the modifier
+- * corresponding to the "Meta" key. If no
+- * such modifier, then this is zero. */
+- enum {
+- LU_IGNORE, LU_CAPS, LU_SHIFT
+- } lockUsage; /* Indicates how to interpret lock modifier. */
+- int numModKeyCodes; /* Number of entries in modKeyCodes array
+- * below. */
+- KeyCode *modKeyCodes; /* Pointer to an array giving keycodes for
+- * all of the keys that have modifiers
+- * associated with them. Malloc'ed, but
+- * may be NULL. */
+-
+- /*
+- * Information used by tkBitmap.c only:
+- */
+-
+- int bitmapInit; /* 0 means tables above need initializing. */
+- int bitmapAutoNumber; /* Used to number bitmaps. */
+- Tcl_HashTable bitmapNameTable;
+- /* Maps from name of bitmap to the first
+- * TkBitmap record for that name. */
+- Tcl_HashTable bitmapIdTable;/* Maps from bitmap id to the TkBitmap
+- * structure for the bitmap. */
+- Tcl_HashTable bitmapDataTable;
+- /* Used by Tk_GetBitmapFromData to map from
+- * a collection of in-core data about a
+- * bitmap to a reference giving an auto-
+- * matically-generated name for the bitmap. */
+-
+- /*
+- * Information used by tkCanvas.c only:
+- */
+-
+- int numIdSearches;
+- int numSlowSearches;
+-
+- /*
+- * Used by tkColor.c only:
+- */
+-
+- int colorInit; /* 0 means color module needs initializing. */
+- TkStressedCmap *stressPtr; /* First in list of colormaps that have
+- * filled up, so we have to pick an
+- * approximate color. */
+- Tcl_HashTable colorNameTable;
+- /* Maps from color name to TkColor structure
+- * for that color. */
+- Tcl_HashTable colorValueTable;
+- /* Maps from integer RGB values to TkColor
+- * structures. */
+-
+- /*
+- * Used by tkCursor.c only:
+- */
+-
+- int cursorInit; /* 0 means cursor module need initializing. */
+- Tcl_HashTable cursorNameTable;
+- /* Maps from a string name to a cursor to the
+- * TkCursor record for the cursor. */
+- Tcl_HashTable cursorDataTable;
+- /* Maps from a collection of in-core data
+- * about a cursor to a TkCursor structure. */
+- Tcl_HashTable cursorIdTable;
+- /* Maps from a cursor id to the TkCursor
+- * structure for the cursor. */
+- char cursorString[20]; /* Used to store a cursor id string. */
+- Font cursorFont; /* Font to use for standard cursors.
+- * None means font not loaded yet. */
+-
+- /*
+- * Information used by tkError.c only:
+- */
+-
+- struct TkErrorHandler *errorPtr;
+- /* First in list of error handlers
+- * for this display. NULL means
+- * no handlers exist at present. */
+- int deleteCount; /* Counts # of handlers deleted since
+- * last time inactive handlers were
+- * garbage-collected. When this number
+- * gets big, handlers get cleaned up. */
+-
+- /*
+- * Used by tkEvent.c only:
+- */
+-
+- struct TkWindowEvent *delayedMotionPtr;
+- /* Points to a malloc-ed motion event
+- * whose processing has been delayed in
+- * the hopes that another motion event
+- * will come along right away and we can
+- * merge the two of them together. NULL
+- * means that there is no delayed motion
+- * event. */
+-
+- /*
+- * Information used by tkFocus.c only:
+- */
+-
+- int focusDebug; /* 1 means collect focus debugging
+- * statistics. */
+- struct TkWindow *implicitWinPtr;
+- /* If the focus arrived at a toplevel window
+- * implicitly via an Enter event (rather
+- * than via a FocusIn event), this points
+- * to the toplevel window. Otherwise it is
+- * NULL. */
+- struct TkWindow *focusPtr; /* Points to the window on this display that
+- * should be receiving keyboard events. When
+- * multiple applications on the display have
+- * the focus, this will refer to the
+- * innermost window in the innermost
+- * application. This information isn't used
+- * under Unix or Windows, but it's needed on
+- * the Macintosh. */
+-
+- /*
+- * Information used by tkGC.c only:
+- */
+-
+- Tcl_HashTable gcValueTable; /* Maps from a GC's values to a TkGC structure
+- * describing a GC with those values. */
+- Tcl_HashTable gcIdTable; /* Maps from a GC to a TkGC. */
+- int gcInit; /* 0 means the tables below need
+- * initializing. */
+-
+- /*
+- * Information used by tkGeometry.c only:
+- */
+-
+- Tcl_HashTable maintainHashTable;
+- /* Hash table that maps from a master's
+- * Tk_Window token to a list of slaves
+- * managed by that master. */
+- int geomInit;
+-
+- /*
+- * Information used by tkGet.c only:
+- */
+-
+- Tcl_HashTable uidTable; /* Stores all Tk_Uids used in a thread. */
+- int uidInit; /* 0 means uidTable needs initializing. */
+-
+- /*
+- * Information used by tkGrab.c only:
+- */
+-
+- struct TkWindow *grabWinPtr;
+- /* Window in which the pointer is currently
+- * grabbed, or NULL if none. */
+- struct TkWindow *eventualGrabWinPtr;
+- /* Value that grabWinPtr will have once the
+- * grab event queue (below) has been
+- * completely emptied. */
+- struct TkWindow *buttonWinPtr;
+- /* Window in which first mouse button was
+- * pressed while grab was in effect, or NULL
+- * if no such press in effect. */
+- struct TkWindow *serverWinPtr;
+- /* If no application contains the pointer then
+- * this is NULL. Otherwise it contains the
+- * last window for which we've gotten an
+- * Enter or Leave event from the server (i.e.
+- * the last window known to have contained
+- * the pointer). Doesn't reflect events
+- * that were synthesized in tkGrab.c. */
+- TkGrabEvent *firstGrabEventPtr;
+- /* First in list of enter/leave events
+- * synthesized by grab code. These events
+- * must be processed in order before any other
+- * events are processed. NULL means no such
+- * events. */
+- TkGrabEvent *lastGrabEventPtr;
+- /* Last in list of synthesized events, or NULL
+- * if list is empty. */
+- int grabFlags; /* Miscellaneous flag values. See definitions
+- * in tkGrab.c. */
+-
+- /*
+- * Information used by tkGrid.c only:
+- */
+-
+- int gridInit; /* 0 means table below needs initializing. */
+- Tcl_HashTable gridHashTable;/* Maps from Tk_Window tokens to
+- * corresponding Grid structures. */
+-
+- /*
+- * Information used by tkImage.c only:
+- */
+-
+- int imageId; /* Value used to number image ids. */
+-
+- /*
+- * Information used by tkMacWinMenu.c only:
+- */
+-
+- int postCommandGeneration;
+-
+- /*
+- * Information used by tkOption.c only.
+- */
+-
+-
+-
+- /*
+- * Information used by tkPack.c only.
+- */
+-
+- int packInit; /* 0 means table below needs initializing. */
+- Tcl_HashTable packerHashTable;
+- /* Maps from Tk_Window tokens to
+- * corresponding Packer structures. */
+-
+-
+- /*
+- * Information used by tkPlace.c only.
+- */
+-
+- int placeInit; /* 0 means tables below need initializing. */
+- Tcl_HashTable masterTable; /* Maps from Tk_Window toke to the Master
+- * structure for the window, if it exists. */
+- Tcl_HashTable slaveTable; /* Maps from Tk_Window toke to the Slave
+- * structure for the window, if it exists. */
+-
+- /*
+- * Information used by tkSelect.c and tkClipboard.c only:
+- */
+-
+-
+- struct TkSelectionInfo *selectionInfoPtr;
+- /* First in list of selection information
+- * records. Each entry contains information
+- * about the current owner of a particular
+- * selection on this display. */
+- Atom multipleAtom; /* Atom for MULTIPLE. None means
+- * selection stuff isn't initialized. */
+- Atom incrAtom; /* Atom for INCR. */
+- Atom targetsAtom; /* Atom for TARGETS. */
+- Atom timestampAtom; /* Atom for TIMESTAMP. */
+- Atom textAtom; /* Atom for TEXT. */
+- Atom compoundTextAtom; /* Atom for COMPOUND_TEXT. */
+- Atom applicationAtom; /* Atom for TK_APPLICATION. */
+- Atom windowAtom; /* Atom for TK_WINDOW. */
+- Atom clipboardAtom; /* Atom for CLIPBOARD. */
+-#if (TK_VERSION_NUMBER >= _VERSION(8,4,0))
+- Atom utf8Atom;
+-#endif
+- Tk_Window clipWindow; /* Window used for clipboard ownership and to
+- * retrieve selections between processes. NULL
+- * means clipboard info hasn't been
+- * initialized. */
+- int clipboardActive; /* 1 means we currently own the clipboard
+- * selection, 0 means we don't. */
+- struct TkMainInfo *clipboardAppPtr;
+- /* Last application that owned clipboard. */
+- struct TkClipboardTarget *clipTargetPtr;
+- /* First in list of clipboard type information
+- * records. Each entry contains information
+- * about the buffers for a given selection
+- * target. */
+-
+- /*
+- * Information used by tkSend.c only:
+- */
+-
+- Tk_Window commTkwin; /* Window used for communication
+- * between interpreters during "send"
+- * commands. NULL means send info hasn't
+- * been initialized yet. */
+- Atom commProperty; /* X's name for comm property. */
+- Atom registryProperty; /* X's name for property containing
+- * registry of interpreter names. */
+- Atom appNameProperty; /* X's name for property used to hold the
+- * application name on each comm window. */
+-
+- /*
+- * Information used by tkXId.c only:
+- */
+-
+- struct TkIdStack *idStackPtr;
+- /* First in list of chunks of free resource
+- * identifiers, or NULL if there are no free
+- * resources. */
+- XID(*defaultAllocProc) _ANSI_ARGS_((Display *display));
+- /* Default resource allocator for display. */
+- struct TkIdStack *windowStackPtr;
+- /* First in list of chunks of window
+- * identifers that can't be reused right
+- * now. */
+-#if (TK_VERSION_NUMBER < _VERSION(8,4,0))
+- int idCleanupScheduled; /* 1 means a call to WindowIdCleanup has
+- * already been scheduled, 0 means it
+- * hasn't. */
+-#else
+- Tcl_TimerToken idCleanupScheduled;
+- /* If set, it means a call to WindowIdCleanup
+- * has already been scheduled, 0 means it
+- * hasn't. */
+-#endif
+- /*
+- * Information used by tkUnixWm.c and tkWinWm.c only:
+- */
+-
+-#if (TK_VERSION_NUMBER < _VERSION(8,4,0))
+- int wmTracing; /* Used to enable or disable tracing in
+- * this module. If tracing is enabled,
+- * then information is printed on
+- * standard output about interesting
+- * interactions with the window manager. */
+-#endif
+- struct TkWmInfo *firstWmPtr; /* Points to first top-level window. */
+- struct TkWmInfo *foregroundWmPtr;
+- /* Points to the foreground window. */
+-
+- /*
+- * Information maintained by tkWindow.c for use later on by tkXId.c:
+- */
+-
+-
+- int destroyCount; /* Number of Tk_DestroyWindow operations
+- * in progress. */
+- unsigned long lastDestroyRequest;
+- /* Id of most recent XDestroyWindow request;
+- * can re-use ids in windowStackPtr when
+- * server has seen this request and event
+- * queue is empty. */
+-
+- /*
+- * Information used by tkVisual.c only:
+- */
+-
+- TkColormap *cmapPtr; /* First in list of all non-default colormaps
+- * allocated for this display. */
+-
+- /*
+- * Miscellaneous information:
+- */
+-
+-#ifdef TK_USE_INPUT_METHODS
+- XIM inputMethod; /* Input method for this display */
+- XIMStyle inputStyle; /* Input style selected for this display. */
+-#if (TK_VERSION_NUMBER >= _VERSION(8,4,0))
+-#if TK_XIM_SPOT
+- XFontSet inputXfs; /* XFontSet cached for over-the-spot XIM. */
+-#endif /* TK_XIM_SPOT */
+-#endif /* TK_VERSION_NUMBER >= 8.4 */
+-#endif /* TK_USE_INPUT_METHODS */
+- Tcl_HashTable winTable; /* Maps from X window ids to TkWindow ptrs. */
+- int refCount; /* Reference count of how many Tk applications
+- * are using this display. Used to clean up
+- * the display when we no longer have any
+- * Tk applications using it.
+- */
+- /*
+- * The following field were all added for Tk8.3
+- */
+- int mouseButtonState; /* current mouse button state for this
+- * display */
+- Window mouseButtonWindow; /* Window the button state was set in, added
+- * in Tk 8.4. */
+-#if (TK_VERSION_NUMBER < _VERSION(8,4,0))
+- int warpInProgress;
+-#endif
+- Window warpWindow;
+- int warpX;
+- int warpY;
+-#if (TK_VERSION_NUMBER < _VERSION(8,4,0))
+- int useInputMethods; /* Whether to use input methods */
+-#else
+- /*
+- * The following field(s) were all added for Tk8.4
+- */
+-/* long deletionEpoch; * Incremented by window deletions */
+- unsigned int flags; /* Various flag values: these are all
+- * defined in below. */
+- TkCaret caret; /* information about the caret for this
+- * display. This is not a pointer. */
+-
+- int iconDataSize; /* Size of default iconphoto image data. */
+- unsigned char *iconDataPtr; /* Default iconphoto image data, if set. */
+-
+-#endif
+-} TkDisplay;
+-
+-#else
+-
+-/*
+- * One of the following structures is maintained for each display
+- * containing a window managed by Tk:
+- */
+-typedef struct TkDisplayStruct {
+- Display *display; /* Xlib's info about display. */
+- struct TkDisplayStruct *nextPtr; /* Next in list of all displays. */
+- char *name; /* Name of display (with any screen
+- * identifier removed). Malloc-ed. */
+- Time lastEventTime; /* Time of last event received for this
+- * display. */
+-
+- /*
+- * Information used primarily by tkBind.c:
+- */
+-
+- int bindInfoStale; /* Non-zero means the variables in this
+- * part of the structure are potentially
+- * incorrect and should be recomputed. */
+- unsigned int modeModMask; /* Has one bit set to indicate the modifier
+- * corresponding to "mode shift". If no
+- * such modifier, than this is zero. */
+- unsigned int metaModMask; /* Has one bit set to indicate the modifier
+- * corresponding to the "Meta" key. If no
+- * such modifier, then this is zero. */
+- unsigned int altModMask; /* Has one bit set to indicate the modifier
+- * corresponding to the "Meta" key. If no
+- * such modifier, then this is zero. */
+- enum {
+- LU_IGNORE, LU_CAPS, LU_SHIFT
+- } lockUsage;
+- /* Indicates how to interpret lock modifier. */
+- int numModKeyCodes; /* Number of entries in modKeyCodes array
+- * below. */
+- KeyCode *modKeyCodes; /* Pointer to an array giving keycodes for
+- * all of the keys that have modifiers
+- * associated with them. Malloc'ed, but
+- * may be NULL. */
+-
+- /*
+- * Information used by tkError.c only:
+- */
+-
+- TkErrorHandler *errorPtr;
+- /* First in list of error handlers
+- * for this display. NULL means
+- * no handlers exist at present. */
+- int deleteCount; /* Counts # of handlers deleted since
+- * last time inactive handlers were
+- * garbage-collected. When this number
+- * gets big, handlers get cleaned up. */
+-
+- /*
+- * Information used by tkSend.c only:
+- */
+-
+- Tk_Window commTkwin; /* Window used for communication
+- * between interpreters during "send"
+- * commands. NULL means send info hasn't
+- * been initialized yet. */
+- Atom commProperty; /* X's name for comm property. */
+- Atom registryProperty; /* X's name for property containing
+- * registry of interpreter names. */
+- Atom appNameProperty; /* X's name for property used to hold the
+- * application name on each comm window. */
+-
+- /*
+- * Information used by tkSelect.c and tkClipboard.c only:
+- */
+-
+- TkSelectionInfo *selectionInfoPtr;
+- /* First in list of selection information
+- * records. Each entry contains information
+- * about the current owner of a particular
+- * selection on this display. */
+- Atom multipleAtom; /* Atom for MULTIPLE. None means
+- * selection stuff isn't initialized. */
+- Atom incrAtom; /* Atom for INCR. */
+- Atom targetsAtom; /* Atom for TARGETS. */
+- Atom timestampAtom; /* Atom for TIMESTAMP. */
+- Atom textAtom; /* Atom for TEXT. */
+- Atom compoundTextAtom; /* Atom for COMPOUND_TEXT. */
+- Atom applicationAtom; /* Atom for TK_APPLICATION. */
+- Atom windowAtom; /* Atom for TK_WINDOW. */
+- Atom clipboardAtom; /* Atom for CLIPBOARD. */
+-
+- Tk_Window clipWindow; /* Window used for clipboard ownership and to
+- * retrieve selections between processes. NULL
+- * means clipboard info hasn't been
+- * initialized. */
+- int clipboardActive; /* 1 means we currently own the clipboard
+- * selection, 0 means we don't. */
+- TkMainInfo *clipboardAppPtr;
+- /* Last application that owned clipboard. */
+- TkClipboardTarget *clipTargetPtr;
+- /* First in list of clipboard type information
+- * records. Each entry contains information
+- * about the buffers for a given selection
+- * target. */
+-
+- /*
+- * Information used by tkAtom.c only:
+- */
+-
+- int atomInit; /* 0 means stuff below hasn't been
+- * initialized yet. */
+- Tcl_HashTable nameTable; /* Maps from names to Atom's. */
+- Tcl_HashTable atomTable; /* Maps from Atom's back to names. */
+-
+- /*
+- * Information used by tkCursor.c only:
+- */
+-
+- Font cursorFont; /* Font to use for standard cursors.
+- * None means font not loaded yet. */
+-
+- /*
+- * Information used by tkGrab.c only:
+- */
+-
+- TkWindow *grabWinPtr;
+- /* Window in which the pointer is currently
+- * grabbed, or NULL if none. */
+- TkWindow *eventualGrabWinPtr;
+- /* Value that grabWinPtr will have once the
+- * grab event queue (below) has been
+- * completely emptied. */
+- TkWindow *buttonWinPtr;
+- /* Window in which first mouse button was
+- * pressed while grab was in effect, or NULL
+- * if no such press in effect. */
+- TkWindow *serverWinPtr;
+- /* If no application contains the pointer then
+- * this is NULL. Otherwise it contains the
+- * last window for which we've gotten an
+- * Enter or Leave event from the server (i.e.
+- * the last window known to have contained
+- * the pointer). Doesn't reflect events
+- * that were synthesized in tkGrab.c. */
+- TkGrabEvent *firstGrabEventPtr;
+- /* First in list of enter/leave events
+- * synthesized by grab code. These events
+- * must be processed in order before any other
+- * events are processed. NULL means no such
+- * events. */
+- TkGrabEvent *lastGrabEventPtr;
+- /* Last in list of synthesized events, or NULL
+- * if list is empty. */
+- int grabFlags; /* Miscellaneous flag values. See definitions
+- * in tkGrab.c. */
+-
+- /*
+- * Information used by tkXId.c only:
+- */
+-
+- TkIdStack *idStackPtr;
+- /* First in list of chunks of free resource
+- * identifiers, or NULL if there are no free
+- * resources. */
+- XID(*defaultAllocProc) _ANSI_ARGS_((Display *display));
+- /* Default resource allocator for display. */
+- TkIdStack *windowStackPtr;
+- /* First in list of chunks of window
+- * identifers that can't be reused right
+- * now. */
+- int idCleanupScheduled; /* 1 means a call to WindowIdCleanup has
+- * already been scheduled, 0 means it
+- * hasn't. */
+-
+- /*
+- * Information maintained by tkWindow.c for use later on by tkXId.c:
+- */
+-
+-
+- int destroyCount; /* Number of Tk_DestroyWindow operations
+- * in progress. */
+- unsigned long lastDestroyRequest;
+- /* Id of most recent XDestroyWindow request;
+- * can re-use ids in windowStackPtr when
+- * server has seen this request and event
+- * queue is empty. */
+-
+- /*
+- * Information used by tkVisual.c only:
+- */
+-
+- TkColormap *cmapPtr; /* First in list of all non-default colormaps
+- * allocated for this display. */
+-
+- /*
+- * Information used by tkFocus.c only:
+- */
+-#if (TK_MAJOR_VERSION == 4)
+-
+- TkWindow *focusWinPtr;
+- /* Window that currently has the focus for
+- * this display, or NULL if none. */
+- TkWindow *implicitWinPtr;
+- /* If the focus arrived at a toplevel window
+- * implicitly via an Enter event (rather
+- * than via a FocusIn event), this points
+- * to the toplevel window. Otherwise it is
+- * NULL. */
+- TkWindow *focusOnMapPtr;
+- /* This points to a toplevel window that is
+- * supposed to receive the X input focus as
+- * soon as it is mapped (needed to handle the
+- * fact that X won't allow the focus on an
+- * unmapped window). NULL means no delayed
+- * focus op in progress. */
+- int forceFocus; /* Associated with focusOnMapPtr: non-zero
+- * means claim the focus even if some other
+- * application currently has it. */
+-#else
+- TkWindow *implicitWinPtr;
+- /* If the focus arrived at a toplevel window
+- * implicitly via an Enter event (rather
+- * than via a FocusIn event), this points
+- * to the toplevel window. Otherwise it is
+- * NULL. */
+- TkWindow *focusPtr; /* Points to the window on this display that
+- * should be receiving keyboard events. When
+- * multiple applications on the display have
+- * the focus, this will refer to the
+- * innermost window in the innermost
+- * application. This information isn't used
+- * under Unix or Windows, but it's needed on
+- * the Macintosh. */
+-#endif /* TK_MAJOR_VERSION == 4 */
+-
+- /*
+- * Used by tkColor.c only:
+- */
+-
+- TkStressedCmap *stressPtr; /* First in list of colormaps that have
+- * filled up, so we have to pick an
+- * approximate color. */
+-
+- /*
+- * Used by tkEvent.c only:
+- */
+-
+- TkWindowEvent *delayedMotionPtr;
+- /* Points to a malloc-ed motion event
+- * whose processing has been delayed in
+- * the hopes that another motion event
+- * will come along right away and we can
+- * merge the two of them together. NULL
+- * means that there is no delayed motion
+- * event. */
+- /*
+- * Miscellaneous information:
+- */
+-
+-#ifdef TK_USE_INPUT_METHODS
+- XIM inputMethod; /* Input method for this display */
+-#endif /* TK_USE_INPUT_METHODS */
+- Tcl_HashTable winTable; /* Maps from X window ids to TkWindow ptrs. */
+-#if (TK_MAJOR_VERSION > 4)
+- int refCount; /* Reference count of how many Tk applications
+- * are using this display. Used to clean up
+- * the display when we no longer have any
+- * Tk applications using it.
+- */
+-#endif /* TK_MAJOR_VERSION > 4 */
+-
+-} TkDisplay;
+-
+-#endif /* TK_VERSION_NUMBER >= _VERSION(8,1,0) */
+-
+-
+-struct TkWindowStruct {
+- Display *display;
+- TkDisplay *dispPtr;
+- int screenNum;
+- Visual *visual;
+- int depth;
+- Window window;
+- TkWindow *childList;
+- TkWindow *lastChildPtr;
+- TkWindow *parentPtr;
+- TkWindow *nextPtr;
+- TkMainInfo *infoPtr;
+- char *pathName;
+- Tk_Uid nameUid;
+- Tk_Uid classUid;
+- XWindowChanges changes;
+- unsigned int dirtyChanges;
+- XSetWindowAttributes atts;
+- unsigned long dirtyAtts;
+- unsigned int flags;
+- TkEventHandler *handlerList;
+-#ifdef TK_USE_INPUT_METHODS
+- XIC inputContext;
+-#endif /* TK_USE_INPUT_METHODS */
+- ClientData *tagPtr;
+- int nTags;
+- int optionLevel;
+- TkSelHandler *selHandlerList;
+- Tk_GeomMgr *geomMgrPtr;
+- ClientData geomData;
+- int reqWidth, reqHeight;
+- int internalBorderWidth;
+- TkWinInfo *wmInfoPtr;
+-#if (TK_MAJOR_VERSION > 4)
+- TkClassProcs *classProcsPtr;
+- ClientData instanceData;
+-#endif
+- TkWindowPrivate *privatePtr;
+- int internalBorderRight;
+- int internalBorderTop;
+- int internalBorderBottom;
+-
+- int minReqWidth;
+- int minReqHeight;
+-
+-};
+-
+ #ifdef WIN32
+ /*
+ *----------------------------------------------------------------------
+--- a/generic/bltPs.c
++++ b/generic/bltPs.c
+@@ -895,7 +895,7 @@
+ return;
+ }
+ if ((relief == TK_RELIEF_SOLID) ||
+- (borderPtr->lightColor == NULL) || (borderPtr->darkColor == NULL)) {
++ (borderPtr->lightColorPtr == NULL) || (borderPtr->darkColorPtr == NULL)) {
+ if (relief == TK_RELIEF_SOLID) {
+ darkColor.red = darkColor.blue = darkColor.green = 0x00;
+ lightColor.red = lightColor.blue = lightColor.green = 0x00;
+@@ -903,7 +903,7 @@
+ } else {
+ Screen *screenPtr;
+
+- lightColor = *borderPtr->bgColor;
++ lightColor = *borderPtr->bgColorPtr;
+ screenPtr = Tk_Screen(tokenPtr->tkwin);
+ if (lightColor.pixel == WhitePixelOfScreen(screenPtr)) {
+ darkColor.red = darkColor.blue = darkColor.green = 0x00;
+@@ -914,8 +914,8 @@
+ lightColorPtr = &lightColor;
+ darkColorPtr = &darkColor;
+ } else {
+- lightColorPtr = borderPtr->lightColor;
+- darkColorPtr = borderPtr->darkColor;
++ lightColorPtr = borderPtr->lightColorPtr;
++ darkColorPtr = borderPtr->darkColorPtr;
+ }
+
+
+@@ -944,7 +944,7 @@
+ topColor = darkColorPtr;
+ bottomColor = lightColorPtr;
+ } else {
+- topColor = bottomColor = borderPtr->bgColor;
++ topColor = bottomColor = borderPtr->bgColorPtr;
+ }
+ Blt_BackgroundToPostScript(tokenPtr, bottomColor);
+ Blt_RectangleToPostScript(tokenPtr, x, y + height - borderWidth, width,
+@@ -984,7 +984,7 @@
+ * Setting the pen color as foreground or background only affects
+ * the plot when the colormode option is "monochrome".
+ */
+- Blt_BackgroundToPostScript(tokenPtr, borderPtr->bgColor);
++ Blt_BackgroundToPostScript(tokenPtr, borderPtr->bgColorPtr);
+ Blt_RectangleToPostScript(tokenPtr, x, y, width, height);
+ Blt_Draw3DRectangleToPostScript(tokenPtr, border, x, y, width, height,
+ borderWidth, relief);
+--- a/generic/bltText.c
++++ b/generic/bltText.c
+@@ -903,7 +903,7 @@
+ TkBorder *borderPtr = (TkBorder *) tsPtr->border;
+ XColor *color1, *color2;
+
+- color1 = borderPtr->lightColor, color2 = borderPtr->darkColor;
++ color1 = borderPtr->lightColorPtr, color2 = borderPtr->darkColorPtr;
+ if (tsPtr->state & STATE_EMPHASIS) {
+ XColor *hold;
+
+@@ -968,7 +968,7 @@
+ TkBorder *borderPtr = (TkBorder *) tsPtr->border;
+ XColor *color1, *color2;
+
+- color1 = borderPtr->lightColor, color2 = borderPtr->darkColor;
++ color1 = borderPtr->lightColorPtr, color2 = borderPtr->darkColorPtr;
+ if (tsPtr->state & STATE_EMPHASIS) {
+ XColor *hold;
+
+--- a/generic/tkFrame.c
++++ b/generic/tkFrame.c
+@@ -116,7 +116,7 @@
+ int flags; /* Various flags; see below for
+ * definitions. */
+ Blt_Tile tile;
+-} Frame;
++} bltFrame;
+
+ /*
+ * Flag bits for frames:
+@@ -143,65 +143,65 @@
+ static Tk_ConfigSpec configSpecs[] =
+ {
+ {TK_CONFIG_BORDER, "-background", "background", "Background",
+- DEF_FRAME_BACKGROUND, Tk_Offset(Frame, border),
++ DEF_FRAME_BACKGROUND, Tk_Offset(bltFrame, border),
+ BOTH | TK_CONFIG_COLOR_ONLY | TK_CONFIG_NULL_OK},
+ {TK_CONFIG_BORDER, "-background", "background", "Background",
+- DEF_FRAME_BG_MONO, Tk_Offset(Frame, border),
++ DEF_FRAME_BG_MONO, Tk_Offset(bltFrame, border),
+ BOTH | TK_CONFIG_MONO_ONLY | TK_CONFIG_NULL_OK},
+ {TK_CONFIG_SYNONYM, "-bd", "borderWidth", (char *)NULL,
+ (char *)NULL, 0, BOTH},
+ {TK_CONFIG_SYNONYM, "-bg", "background", (char *)NULL,
+ (char *)NULL, 0, BOTH},
+ {TK_CONFIG_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
+- DEF_FRAME_BORDERWIDTH, Tk_Offset(Frame, borderWidth), BOTH},
++ DEF_FRAME_BORDERWIDTH, Tk_Offset(bltFrame, borderWidth), BOTH},
+ {TK_CONFIG_STRING, "-class", "class", "Class",
+- DEF_FRAME_CLASS, Tk_Offset(Frame, className), FRAME},
++ DEF_FRAME_CLASS, Tk_Offset(bltFrame, className), FRAME},
+ {TK_CONFIG_STRING, "-class", "class", "Class",
+- DEF_TOPLEVEL_CLASS, Tk_Offset(Frame, className), TOPLEVEL},
++ DEF_TOPLEVEL_CLASS, Tk_Offset(bltFrame, className), TOPLEVEL},
+ {TK_CONFIG_STRING, "-colormap", "colormap", "Colormap",
+- DEF_FRAME_COLORMAP, Tk_Offset(Frame, colormapName),
++ DEF_FRAME_COLORMAP, Tk_Offset(bltFrame, colormapName),
+ BOTH | TK_CONFIG_NULL_OK},
+ #if (TK_MAJOR_VERSION > 4)
+ {TK_CONFIG_BOOLEAN, "-container", "container", "Container",
+- DEF_FRAME_CONTAINER, Tk_Offset(Frame, isContainer), BOTH},
++ DEF_FRAME_CONTAINER, Tk_Offset(bltFrame, isContainer), BOTH},
+ #endif /* TK_MAJOR_VERSION > 4 */
+ {TK_CONFIG_ACTIVE_CURSOR, "-cursor", "cursor", "Cursor",
+- DEF_FRAME_CURSOR, Tk_Offset(Frame, cursor), BOTH | TK_CONFIG_NULL_OK},
++ DEF_FRAME_CURSOR, Tk_Offset(bltFrame, cursor), BOTH | TK_CONFIG_NULL_OK},
+ {TK_CONFIG_PIXELS, "-height", "height", "Height",
+- DEF_FRAME_HEIGHT, Tk_Offset(Frame, height), BOTH},
++ DEF_FRAME_HEIGHT, Tk_Offset(bltFrame, height), BOTH},
+ {TK_CONFIG_COLOR, "-highlightbackground", "highlightBackground",
+ "HighlightBackground", DEF_FRAME_HIGHLIGHT_BG,
+- Tk_Offset(Frame, highlightBgColorPtr), BOTH},
++ Tk_Offset(bltFrame, highlightBgColorPtr), BOTH},
+ {TK_CONFIG_COLOR, "-highlightcolor", "highlightColor", "HighlightColor",
+- DEF_FRAME_HIGHLIGHT, Tk_Offset(Frame, highlightColorPtr), BOTH},
++ DEF_FRAME_HIGHLIGHT, Tk_Offset(bltFrame, highlightColorPtr), BOTH},
+ {TK_CONFIG_PIXELS, "-highlightthickness", "highlightThickness",
+ "HighlightThickness",
+- DEF_FRAME_HIGHLIGHT_WIDTH, Tk_Offset(Frame, highlightWidth), BOTH},
++ DEF_FRAME_HIGHLIGHT_WIDTH, Tk_Offset(bltFrame, highlightWidth), BOTH},
+ #if (TK_MAJOR_VERSION > 4)
+ {TK_CONFIG_STRING, "-menu", "menu", "Menu",
+- DEF_TOPLEVEL_MENU, Tk_Offset(Frame, menuName),
++ DEF_TOPLEVEL_MENU, Tk_Offset(bltFrame, menuName),
+ TOPLEVEL | TK_CONFIG_NULL_OK},
+ #endif /* TK_MAJOR_VERSION > 4 */
+ {TK_CONFIG_RELIEF, "-relief", "relief", "Relief",
+- DEF_FRAME_RELIEF, Tk_Offset(Frame, relief), BOTH},
++ DEF_FRAME_RELIEF, Tk_Offset(bltFrame, relief), BOTH},
+ {TK_CONFIG_STRING, "-screen", "screen", "Screen",
+- DEF_TOPLEVEL_SCREEN, Tk_Offset(Frame, screenName),
++ DEF_TOPLEVEL_SCREEN, Tk_Offset(bltFrame, screenName),
+ TOPLEVEL | TK_CONFIG_NULL_OK},
+ {TK_CONFIG_STRING, "-takefocus", "takeFocus", "TakeFocus",
+- DEF_FRAME_TAKE_FOCUS, Tk_Offset(Frame, takeFocus),
++ DEF_FRAME_TAKE_FOCUS, Tk_Offset(bltFrame, takeFocus),
+ BOTH | TK_CONFIG_NULL_OK},
+ {TK_CONFIG_CUSTOM, "-tile", "tile", "Tile",
+- (char *)NULL, Tk_Offset(Frame, tile), BOTH | TK_CONFIG_NULL_OK,
++ (char *)NULL, Tk_Offset(bltFrame, tile), BOTH | TK_CONFIG_NULL_OK,
+ &bltTileOption},
+ #if (TK_MAJOR_VERSION > 4)
+ {TK_CONFIG_STRING, "-use", "use", "Use",
+- DEF_FRAME_USE, Tk_Offset(Frame, useThis), TOPLEVEL|TK_CONFIG_NULL_OK},
++ DEF_FRAME_USE, Tk_Offset(bltFrame, useThis), TOPLEVEL|TK_CONFIG_NULL_OK},
+ #endif
+ {TK_CONFIG_STRING, "-visual", "visual", "Visual",
+- DEF_FRAME_VISUAL, Tk_Offset(Frame, visualName),
++ DEF_FRAME_VISUAL, Tk_Offset(bltFrame, visualName),
+ BOTH | TK_CONFIG_NULL_OK},
+ {TK_CONFIG_PIXELS, "-width", "width", "Width",
+- DEF_FRAME_WIDTH, Tk_Offset(Frame, width), BOTH},
++ DEF_FRAME_WIDTH, Tk_Offset(bltFrame, width), BOTH},
+ {TK_CONFIG_END, (char *)NULL, (char *)NULL, (char *)NULL,
+ (char *)NULL, 0, 0}
+ };
+@@ -211,7 +211,7 @@
+ */
+
+ static int ConfigureFrame _ANSI_ARGS_((Tcl_Interp *interp,
+- Frame * framePtr, int argc, char **argv,
++ bltFrame * framePtr, int argc, CONST84 char **argv,
+ int flags));
+ static void DestroyFrame _ANSI_ARGS_((DestroyData *memPtr));
+ static void DisplayFrame _ANSI_ARGS_((ClientData clientData));
+@@ -219,27 +219,16 @@
+ ClientData clientData));
+ static void FrameEventProc _ANSI_ARGS_((ClientData clientData,
+ XEvent *eventPtr));
+-static int FrameWidgetCmd _ANSI_ARGS_((ClientData clientData,
+- Tcl_Interp *interp, int argc, char **argv));
+ static void MapFrame _ANSI_ARGS_((ClientData clientData));
+
+ static Blt_TileChangedProc TileChangedProc;
+-static Tcl_CmdProc FrameCmd, ToplevelCmd;
++static Tcl_CmdProc FrameCmd, ToplevelCmd, FrameWidgetCmd;
+
+-#ifdef TILE_MAINWINDOW
+-EXTERN
+-#else
+ static
+-#endif
+-int TkCreateFrame _ANSI_ARGS_((ClientData clientData,
+- Tcl_Interp *interp, int argc, char **argv,
++int BltCreateFrame _ANSI_ARGS_((ClientData clientData,
++ Tcl_Interp *interp, int argc, CONST84 char **argv,
+ int toplevel, char *appName));
+
+-EXTERN void TkSetWindowMenuBar _ANSI_ARGS_((Tcl_Interp *interp, Tk_Window tkwin,
+- char *oldMenuName, char *menuName));
+-
+-EXTERN Tk_Window TkCreateMainWindow _ANSI_ARGS_((Tcl_Interp * interp,
+- char * screenName, char * baseName));
+ #if (TK_MAJOR_VERSION == 8) && (TK_MINOR_VERSION > 3)
+ #define TkSetClassProcs Tk_SetClassProcs
+ #else
+@@ -247,10 +236,10 @@
+ ClientData instanceData));
+ #endif /* TK_MAJOR_VERSION == 8 && TK_MINOR_VERSION > 3 */
+
++#if (TCL_VERSION_NUMBER < _VERSION(8,6,0))
+ EXTERN void TkpSetMainMenubar _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin,
+ char * menuName));
+-EXTERN int TkpUseWindow _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin,
+- char * string));
++#endif
+ EXTERN void TkpMakeContainer _ANSI_ARGS_((Tk_Window tkwin));
+
+
+@@ -279,9 +268,9 @@
+ * interpreter. */
+ Tcl_Interp *interp; /* Current interpreter. */
+ int argc; /* Number of arguments. */
+- char **argv; /* Argument strings. */
++ CONST84 char **argv; /* Argument strings. */
+ {
+- return TkCreateFrame(clientData, interp, argc, argv, 0, (char *)NULL);
++ return BltCreateFrame(clientData, interp, argc, argv, 0, (char *)NULL);
+ }
+
+ static int
+@@ -290,9 +279,9 @@
+ * interpreter. */
+ Tcl_Interp *interp; /* Current interpreter. */
+ int argc; /* Number of arguments. */
+- char **argv; /* Argument strings. */
++ CONST84 char **argv; /* Argument strings. */
+ {
+- return TkCreateFrame(clientData, interp, argc, argv, 1, (char *)NULL);
++ return BltCreateFrame(clientData, interp, argc, argv, 1, (char *)NULL);
+ }
+
+ /*
+@@ -319,20 +308,20 @@
+ static
+ #endif /* TILE_MAINWINDOW */
+ int
+-TkCreateFrame(clientData, interp, argc, argv, toplevel, appName)
++BltCreateFrame(clientData, interp, argc, argv, toplevel, appName)
+ ClientData clientData; /* Main window associated with interpreter.
+ * If we're called by Tk_Init to create a
+ * new application, then this is NULL. */
+ Tcl_Interp *interp; /* Current interpreter. */
+ int argc; /* Number of arguments. */
+- char **argv; /* Argument strings. */
++ CONST84 char *argv[]; /* Argument strings. */
+ int toplevel; /* Non-zero means create a toplevel window,
+ * zero means create a frame. */
+ char *appName; /* Should only be non-NULL if clientData is
+ * NULL: gives the base name to use for the
+ * new application. */
+ {
+- Frame *framePtr;
++ bltFrame *framePtr;
+ Tk_Window new;
+ char *className, *screenName, *visualName, *colormapName, *arg, *useOption;
+ int i, c, length, depth;
+@@ -407,7 +396,7 @@
+ */
+
+ if (appName == NULL) {
+- panic("TkCreateFrame didn't get application name");
++ panic("BltCreateFrame didn't get application name");
+ }
+ new = (Tk_Window)TkCreateMainWindow(interp, screenName, appName);
+ }
+@@ -467,7 +456,7 @@
+ * in the widget record from the special options.
+ */
+
+- framePtr = Blt_Malloc(sizeof(Frame));
++ framePtr = Blt_Malloc(sizeof(bltFrame));
+ framePtr->tkwin = new;
+ framePtr->display = Tk_Display(new);
+ framePtr->interp = interp;
+@@ -558,9 +547,9 @@
+ ClientData clientData; /* Information about frame widget. */
+ Tcl_Interp *interp; /* Current interpreter. */
+ int argc; /* Number of arguments. */
+- char **argv; /* Argument strings. */
++ CONST84 char *argv[]; /* Argument strings. */
+ {
+- register Frame *framePtr = (Frame *) clientData;
++ register bltFrame *framePtr = (bltFrame *) clientData;
+ int result;
+ size_t length;
+ int c, i;
+@@ -660,7 +649,7 @@
+ DestroyFrame(memPtr)
+ DestroyData *memPtr; /* Info about frame widget. */
+ {
+- register Frame *framePtr = (Frame *) memPtr;
++ register bltFrame *framePtr = (bltFrame *) memPtr;
+
+ Tk_FreeOptions(configSpecs, (char *)framePtr, framePtr->display,
+ framePtr->mask);
+@@ -689,7 +678,7 @@
+ ClientData clientData;
+ Blt_Tile tile;
+ {
+- Frame *framePtr = (Frame *) clientData;
++ bltFrame *framePtr = (bltFrame *) clientData;
+
+ if (framePtr->tkwin != NULL) {
+ if (!(framePtr->flags & REDRAW_PENDING)) {
+@@ -723,10 +712,10 @@
+ static int
+ ConfigureFrame(interp, framePtr, argc, argv, flags)
+ Tcl_Interp *interp; /* Used for error reporting. */
+- register Frame *framePtr; /* Information about widget; may or may
++ register bltFrame *framePtr; /* Information about widget; may or may
+ * not already have values for some fields. */
+ int argc; /* Number of valid entries in argv. */
+- char **argv; /* Arguments. */
++ CONST84 char **argv; /* Arguments. */
+ int flags; /* Flags to pass to Tk_ConfigureWidget. */
+ {
+ #if (TK_MAJOR_VERSION > 4)
+@@ -810,7 +799,7 @@
+ DisplayFrame(clientData)
+ ClientData clientData; /* Information about widget. */
+ {
+- register Frame *framePtr = (Frame *) clientData;
++ register bltFrame *framePtr = (bltFrame *) clientData;
+ register Tk_Window tkwin = framePtr->tkwin;
+ GC gc;
+
+@@ -877,7 +866,7 @@
+ ClientData clientData; /* Information about window. */
+ register XEvent *eventPtr; /* Information about event. */
+ {
+- register Frame *framePtr = (Frame *) clientData;
++ register bltFrame *framePtr = (bltFrame *) clientData;
+
+ if (((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0))
+ || (eventPtr->type == ConfigureNotify)) {
+@@ -964,7 +953,7 @@
+ FrameCmdDeletedProc(clientData)
+ ClientData clientData; /* Pointer to widget record for widget. */
+ {
+- Frame *framePtr = (Frame *) clientData;
++ bltFrame *framePtr = (bltFrame *) clientData;
+ Tk_Window tkwin = framePtr->tkwin;
+
+ #if (TK_MAJOR_VERSION > 4)
+@@ -1010,7 +999,7 @@
+ MapFrame(clientData)
+ ClientData clientData; /* Pointer to frame structure. */
+ {
+- Frame *framePtr = (Frame *) clientData;
++ bltFrame *framePtr = (bltFrame *) clientData;
+
+ /*
+ * Wait for all other background events to be processed before
+@@ -1067,9 +1056,9 @@
+ #define Tk_InstanceData(tkwin) (((Tk_FakeWin *)(tkwin))->dummy18)
+ #define Tk_MainPtr(tkwin) (((Tk_FakeWin *)(tkwin))->dummy5)
+ if (Tk_MainPtr(tkwin) != NULL) {
+- Frame *framePtr;
++ bltFrame *framePtr;
+
+- framePtr = (Frame *) Tk_InstanceData(tkwin);
++ framePtr = (bltFrame *) Tk_InstanceData(tkwin);
+ TkpMenuNotifyToplevelCreate(framePtr->interp, framePtr->menuName);
+ }
+ #endif /* TK_MAJOR_VERSION > 4 */
+--- a/configure.in
++++ b/configure.in
+@@ -816,6 +816,7 @@
+ if test "${TK_INC_DIR}" != "/usr/include" ; then
+ INC_SPECS="${INC_SPECS} -I${TK_INC_DIR}"
+ fi
++INC_SPECS="${INC_SPECS} -I${TK_SRC_DIR}/generic -I${TK_SRC_DIR}/unix"
+
+ # Tcl include files
+ #
diff --git a/graphics/tclblt/slack-desc b/graphics/tclblt/slack-desc
new file mode 100644
index 0000000000..2bb6fa483b
--- /dev/null
+++ b/graphics/tclblt/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+tclblt: tclblt (Tcl/Tk Extension)
+tclblt:
+tclblt: Tcl blt is an extension to Tcl/Tk. It adds plotting widgets (X-Y
+tclblt: graph, barchart, stripchart), a powerful geometry manager, a new
+tclblt: canvas item, and several new commands to Tk.
+tclblt:
+tclblt:
+tclblt:
+tclblt:
+tclblt:
+tclblt:
diff --git a/graphics/tclblt/tclblt.SlackBuild b/graphics/tclblt/tclblt.SlackBuild
new file mode 100644
index 0000000000..ccb159e6c7
--- /dev/null
+++ b/graphics/tclblt/tclblt.SlackBuild
@@ -0,0 +1,141 @@
+#!/bin/sh
+
+# Slackware build script for tclblt
+
+# Copyright 2019 Andrey Lipaev Moscow
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+PRGNAM=tclblt
+VERSION=${VERSION:-2.5.3}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+SRC="blt-src-2.5.3.zip"
+SRC_HOME="blt2.5"
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i586 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $SRC_HOME
+unzip $CWD/$SRC
+cd $SRC_HOME
+chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+#Here we will apply the patches from Debian project
+rm -rv library/dd_protocols && patch -p1 < $CWD/patches/source.patch && sed -i -e 's/\$$(ddFiles)//' library/Makefile.in
+PATCHLIST=" 02-debian-all.patch \
+ 03-fedora-patch-2.patch \
+ 04-fedora-tk8.5.6.patch \
+ 05-tk8.5-zoomstack.patch \
+ doc-typos.patch \
+ tcl8.6.patch \
+ tk8.6.patch \
+ install.patch \
+ usetclint.patch \
+ table.patch \
+ ldflags.patch \
+ pkgindex.patch \
+ decls.patch \
+ bltnsutil.patch \
+ blthash.patch \
+ const.patch \
+ uninitialized.patch \
+ unused.patch \
+ pointertoint.patch \
+ autoreconf.patch \
+ switch.patch"
+# usetkint.patch \
+
+for PATCH in $PATCHLIST ; do echo $CWD/patches/$PATCH ; patch -p1 < $CWD/patches/$PATCH ; done
+
+CFLAGS="$SLKCFLAGS" \
+CXXFLAGS="$SLKCFLAGS" \
+./configure \
+ --prefix=/usr \
+ --libdir=/usr/lib${LIBDIRSUFFIX} \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --mandir=/usr/man \
+ --build=$ARCH-slackware-linux \
+ --with-tcl=/usr/lib${LIBDIRSUFFIX} \
+ --with-blt=/usr/lib${LIBDIRSUFFIX} \
+ --with-tcllibs=/usr/lib${LIBDIRSUFFIX}
+
+make
+make install INSTALL_ROOT=$PKG
+
+find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
+ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+
+find $PKG/usr/man -type f -exec gzip -9 {} \;
+for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
+
+find $PKG -name perllocal.pod \
+ -o -name ".packlist" \
+ -o -name "*.bs" \
+ | xargs rm -f
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a html $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a examples $PKG/usr/doc/$PRGNAM-$VERSION
+DOCLIST="README PROBLEMS NEWS demos"
+for DOCNAME in $DOCLIST ; do mv $PKG/usr/lib/blt2.5/$DOCNAME $PKG/usr/doc/$PRGNAM-$VERSION ; done
+rmdir $PKG/usr/lib/blt2.5
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+find $PKG/usr/doc/$PRGNAM-$VERSION/ -type f -exec chmod 644 {} \;
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
diff --git a/graphics/tclblt/tclblt.info b/graphics/tclblt/tclblt.info
new file mode 100644
index 0000000000..f4a28dcd85
--- /dev/null
+++ b/graphics/tclblt/tclblt.info
@@ -0,0 +1,10 @@
+PRGNAM="tclblt"
+VERSION="2.5.3"
+HOMEPAGE="http://blt.sourceforge.net/"
+DOWNLOAD="http://downloads.sourceforge.net/wize/blt-src-2.5.3.zip"
+MD5SUM="1cfa4ff086e7b7e1751a3ef44b209401"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES=""
+MAINTAINER="Andrey M. Lipaev"
+EMAIL="heliumflash@mail.ru"