Ticket #40203: patch-tcltk86_internals

File patch-tcltk86_internals, 344.0 KB (added by howarth@…, 11 years ago)

patch-tcltk86_internals to address multiple changes in internal tcl/tk calls that blt uses

Line 
1--- src/bltTkInt.h      2001-12-06 00:30:15.000000000 -0500
2+++ src/bltTkInt.h      2010-01-25 18:57:52.000000000 -0500
3@@ -28,213 +28,7 @@
4 #define _BLT_TKINT_H
5 
6-typedef struct {
7-    Tk_Uid family;             /* Font family. The most important field. */
8-    int pointsize;             /* Pointsize of font, 0 for default size, or
9-                                * negative number meaning pixel size. */
10-    int weight;                        /* Weight flag; see below for def'n. */
11-    int slant;                 /* Slant flag; see below for def'n. */
12-    int underline;             /* Non-zero for underline font. */
13-    int overstrike;            /* Non-zero for overstrike font. */
14-} TkFontAttributes;
15-
16-typedef struct {
17-    int ascent;                        /* From baseline to top of font. */
18-    int descent;               /* From baseline to bottom of font. */
19-    int maxWidth;              /* Width of widest character in font. */
20-    int fixed;                 /* Non-zero if this is a fixed-width font,
21-                                * 0 otherwise. */
22-} TkFontMetrics;
23-
24-
25-typedef struct TkFontStruct {
26-    /*
27-     * Fields used and maintained exclusively by generic code.
28-     */
29-#if (TK_VERSION_NUMBER >= _VERSION(8,1,0))
30-    int resourceRefCount;      /* Number of active uses of this font (each
31-                                * active use corresponds to a call to
32-                                * Tk_AllocFontFromTable or Tk_GetFont).
33-                                * If this count is 0, then this TkFont
34-                                * structure is no longer valid and it isn't
35-                                * present in a hash table: it is being
36-                                * kept around only because there are objects
37-                                * referring to it.  The structure is freed
38-                                * when resourceRefCount and objRefCount
39-                                * are both 0. */
40-    int objRefCount;           /* The number of Tcl objects that reference
41-                                * this structure. */
42-#else
43-    int refCount;              /* Number of users of the TkFont. */
44-#endif
45-    Tcl_HashEntry *cacheHashPtr;/* Entry in font cache for this structure,
46-                                * used when deleting it. */
47-    Tcl_HashEntry *namedHashPtr;/* Pointer to hash table entry that
48-                                * corresponds to the named font that the
49-                                * tkfont was based on, or NULL if the tkfont
50-                                * was not based on a named font. */
51-#if (TK_VERSION_NUMBER >= _VERSION(8,1,0))
52-    Screen *screen;            /* The screen where this font is valid. */
53-#endif /* TK_VERSION_NUMBER >= 8.1.0 */
54-    int tabWidth;              /* Width of tabs in this font (pixels). */
55-    int underlinePos;          /* Offset from baseline to origin of
56-                                * underline bar (used for drawing underlines
57-                                * on a non-underlined font). */
58-    int underlineHeight;       /* Height of underline bar (used for drawing
59-                                * underlines on a non-underlined font). */
60-
61-    /*
62-     * Fields in the generic font structure that are filled in by
63-     * platform-specific code.
64-     */
65-
66-    Font fid;                  /* For backwards compatibility with XGCValues
67-                                * structures.  Remove when TkGCValues is
68-                                * implemented.  */
69-    TkFontAttributes fa;       /* Actual font attributes obtained when the
70-                                * the font was created, as opposed to the
71-                                * desired attributes passed in to
72-                                * TkpGetFontFromAttributes().  The desired
73-                                * metrics can be determined from the string
74-                                * that was used to create this font. */
75-    TkFontMetrics fm;          /* Font metrics determined when font was
76-                                * created. */
77-#if (TK_VERSION_NUMBER >= _VERSION(8,1,0))
78-    struct TkFontStruct *nextPtr;      /* Points to the next TkFont structure with
79-                                * the same name.  All fonts with the
80-                                * same name (but different displays) are
81-                                * chained together off a single entry in
82-                                * a hash table. */
83-#endif /* TK_VERSION_NUMBER >= 8.1.0 */
84-} TkFont;
85-
86-/*
87- * This structure is used by the Mac and Window porting layers as
88- * the internal representation of a clip_mask in a GC.
89- */
90-typedef struct TkRegionStruct *TkRegion;
91-
92-typedef struct {
93-    int type;                  /* One of TKP_CLIP_PIXMAP or TKP_CLIP_REGION */
94-    union {
95-       Pixmap pixmap;
96-       TkRegion region;
97-    } value;
98-} TkpClipMask;
99-
100-#define TKP_CLIP_PIXMAP 0
101-#define TKP_CLIP_REGION 1
102-
103-#ifdef WIN32
104-/*
105- * The TkWinDrawable is the internal implementation of an X Drawable (either
106- * a Window or a Pixmap).  The following constants define the valid Drawable
107- * types.
108- */
109-
110-#define TWD_BITMAP     1
111-#define TWD_WINDOW     2
112-#define TWD_WINDC      3
113-
114-typedef struct TkWindowStruct TkWindow;
115-
116-typedef struct {
117-    int type;
118-    HWND handle;
119-    TkWindow *winPtr;
120-} TkWinWindow;
121-
122-typedef struct {
123-    int type;
124-    HBITMAP handle;
125-    Colormap colormap;
126-    int depth;
127-} TkWinBitmap;
128-
129-typedef struct {
130-    int type;
131-    HDC hdc;
132-} TkWinDC;
133-
134-typedef union {
135-    int type;
136-    TkWinWindow window;
137-    TkWinBitmap bitmap;
138-    TkWinDC winDC;
139-} TkWinDrawable;
140-
141-/*
142- * The TkWinDCState is used to save the state of a device context
143- * so that it can be restored later.
144- */
145-
146-typedef struct {
147-    HPALETTE palette;
148-    int bkmode;                        /* This field was added in Tk
149-                                * 8.3.1. Be careful that you don't
150-                                * use this structure in a context
151-                                * where its size is important.  */
152-} TkWinDCState;
153-
154-extern HDC TkWinGetDrawableDC(Display *display, Drawable drawable,
155-    TkWinDCState * state);
156-extern HDC TkWinReleaseDrawableDC(Drawable drawable, HDC dc,
157-    TkWinDCState * state);
158-
159-extern HWND Tk_GetHWND _ANSI_ARGS_((Window window));
160-
161-extern HINSTANCE Tk_GetHINSTANCE _ANSI_ARGS_((void));
162-
163-extern Window Tk_AttachHWND _ANSI_ARGS_((Tk_Window tkwin, HWND hWnd));
164-
165-#endif /* WIN32 */
166-
167-/*
168- * The Border structure used internally by the Tk_3D* routines.
169- * The following is a copy of it from tk3d.c.
170- */
171-
172-typedef struct TkBorderStruct {
173-    Screen *screen;            /* Screen on which the border will be used. */
174-    Visual *visual;            /* Visual for all windows and pixmaps using
175-                                * the border. */
176-    int depth;                 /* Number of bits per pixel of drawables where
177-                                * the border will be used. */
178-    Colormap colormap;         /* Colormap out of which pixels are
179-                                * allocated. */
180-    int refCount;              /* Number of different users of
181-                                * this border.  */
182-#if (TK_VERSION_NUMBER >= _VERSION(8,1,0))
183-    int objRefCount;           /* The number of Tcl objects that reference
184-                                * this structure. */
185-#endif /* TK_VERSION_NUMBER >= 8.1.0 */
186-    XColor *bgColor;           /* Background color (intensity between
187-                                * lightColorPtr and darkColorPtr). */
188-    XColor *darkColor;         /* Color for darker areas (must free when
189-                                * deleting structure). NULL means shadows
190-                                * haven't been allocated yet.*/
191-    XColor *lightColor;                /* Color used for lighter areas of border
192-                                * (must free this when deleting structure).
193-                                * NULL means shadows haven't been allocated
194-                                * yet. */
195-    Pixmap shadow;             /* Stipple pattern to use for drawing
196-                                * shadows areas.  Used for displays with
197-                                * <= 64 colors or where colormap has filled
198-                                * up. */
199-    GC bgGC;                   /* Used (if necessary) to draw areas in
200-                                * the background color. */
201-    GC darkGC;                 /* Used to draw darker parts of the
202-                                * border. None means the shadow colors
203-                                * haven't been allocated yet.*/
204-    GC lightGC;                        /* Used to draw lighter parts of
205-                                * the border. None means the shadow colors
206-                                * haven't been allocated yet. */
207-    Tcl_HashEntry *hashPtr;    /* Entry in borderTable (needed in
208-                                * order to delete structure). */
209-    struct TkBorderStruct *nextPtr; /* Points to the next TkBorder structure with
210-                                * the same color name.  Borders with the
211-                                * same name but different screens or
212-                                * colormaps are chained together off a
213-                                * single entry in borderTable. */
214-} TkBorder;
215+#include <tkInt.h>
216+#include <tk3d.h>
217+#include <tkFont.h>
218 
219 #endif /* BLT_TKINT_H */
220--- src/bltWindow.c     2002-09-18 23:02:09.000000000 -0400
221+++ src/bltWindow.c     2010-01-25 18:47:25.000000000 -0500
222@@ -34,23 +34,5 @@
223 #endif
224 
225-typedef struct TkIdStackStruct TkIdStack;
226-typedef struct TkErrorHandlerStruct TkErrorHandler;
227-typedef struct TkSelectionInfoStruct TkSelectionInfo;
228-typedef struct TkClipboardTargetStruct TkClipboardTarget;
229-
230-#ifndef WIN32
231-typedef struct TkWindowStruct TkWindow;
232-#endif
233-typedef struct TkWindowEventStruct TkWindowEvent;
234-typedef struct TkMainInfoStruct TkMainInfo;
235-typedef struct TkEventHandlerStruct TkEventHandler;
236-typedef struct TkSelHandlerStruct TkSelHandler;
237-typedef struct TkWinInfoStruct TkWinInfo;
238-typedef struct TkClassProcsStruct TkClassProcs;
239-typedef struct TkWindowPrivateStruct TkWindowPrivate;
240-typedef struct TkGrabEventStruct TkGrabEvent;
241-typedef struct TkColormapStruct TkColormap;
242-typedef struct TkStressedCmapStruct TkStressedCmap;
243-typedef struct TkWmInfoStruct TkWmInfo;
244+#include <tkInt.h>
245 
246 #ifdef XNQueryInputStyle
247@@ -71,750 +53,4 @@
248 #endif
249 
250-#if (TK_VERSION_NUMBER >= _VERSION(8,1,0))
251-
252-typedef struct TkCaret {
253-    struct TkWindow *winPtr;   /* the window on which we requested caret
254-                                * placement */
255-    int x;                     /* relative x coord of the caret */
256-    int y;                     /* relative y coord of the caret */
257-    int height;                        /* specified height of the window */
258-} TkCaret;
259-
260-/*
261- * One of the following structures is maintained for each display
262- * containing a window managed by Tk.  In part, the structure is
263- * used to store thread-specific data, since each thread will have
264- * its own TkDisplay structure.
265- */
266-
267-typedef struct TkDisplayStruct {
268-    Display *display;          /* Xlib's info about display. */
269-    struct TkDisplayStruct *nextPtr; /* Next in list of all displays. */
270-    char *name;                        /* Name of display (with any screen
271-                                * identifier removed).  Malloc-ed. */
272-    Time lastEventTime;                /* Time of last event received for this
273-                                * display. */
274-
275-    /*
276-     * Information used primarily by tk3d.c:
277-     */
278-
279-    int borderInit;            /* 0 means borderTable needs initializing. */
280-    Tcl_HashTable borderTable; /* Maps from color name to TkBorder
281-                                * structure. */
282-
283-    /*
284-     * Information used by tkAtom.c only:
285-     */
286-
287-    int atomInit;              /* 0 means stuff below hasn't been
288-                                * initialized yet. */
289-    Tcl_HashTable nameTable;   /* Maps from names to Atom's. */
290-    Tcl_HashTable atomTable;   /* Maps from Atom's back to names. */
291-
292-    /*
293-     * Information used primarily by tkBind.c:
294-     */
295-
296-    int bindInfoStale;         /* Non-zero means the variables in this
297-                                * part of the structure are potentially
298-                                * incorrect and should be recomputed. */
299-    unsigned int modeModMask;  /* Has one bit set to indicate the modifier
300-                                * corresponding to "mode shift".  If no
301-                                * such modifier, than this is zero. */
302-    unsigned int metaModMask;  /* Has one bit set to indicate the modifier
303-                                * corresponding to the "Meta" key.  If no
304-                                * such modifier, then this is zero. */
305-    unsigned int altModMask;   /* Has one bit set to indicate the modifier
306-                                * corresponding to the "Meta" key.  If no
307-                                * such modifier, then this is zero. */
308-    enum {
309-       LU_IGNORE, LU_CAPS, LU_SHIFT
310-    } lockUsage;               /* Indicates how to interpret lock modifier. */
311-    int numModKeyCodes;                /* Number of entries in modKeyCodes array
312-                                * below. */
313-    KeyCode *modKeyCodes;      /* Pointer to an array giving keycodes for
314-                                * all of the keys that have modifiers
315-                                * associated with them.  Malloc'ed, but
316-                                * may be NULL. */
317-
318-    /*
319-     * Information used by tkBitmap.c only:
320-     */
321-
322-    int bitmapInit;            /* 0 means tables above need initializing. */
323-    int bitmapAutoNumber;      /* Used to number bitmaps. */
324-    Tcl_HashTable bitmapNameTable;
325-                               /* Maps from name of bitmap to the first
326-                                * TkBitmap record for that name. */
327-    Tcl_HashTable bitmapIdTable;/* Maps from bitmap id to the TkBitmap
328-                                * structure for the bitmap. */
329-    Tcl_HashTable bitmapDataTable;
330-                               /* Used by Tk_GetBitmapFromData to map from
331-                                * a collection of in-core data about a
332-                                * bitmap to a reference giving an auto-
333-                                * matically-generated name for the bitmap. */
334-
335-    /*
336-     * Information used by tkCanvas.c only:
337-     */
338-
339-    int numIdSearches;
340-    int numSlowSearches;
341-
342-    /*
343-     * Used by tkColor.c only:
344-     */
345-
346-    int colorInit;             /* 0 means color module needs initializing. */
347-    TkStressedCmap *stressPtr; /* First in list of colormaps that have
348-                                * filled up, so we have to pick an
349-                                * approximate color. */
350-    Tcl_HashTable colorNameTable;
351-                               /* Maps from color name to TkColor structure
352-                                * for that color. */
353-    Tcl_HashTable colorValueTable;
354-                               /* Maps from integer RGB values to TkColor
355-                                * structures. */
356-
357-    /*
358-     * Used by tkCursor.c only:
359-     */
360-
361-    int cursorInit;            /* 0 means cursor module need initializing. */
362-    Tcl_HashTable cursorNameTable;
363-                               /* Maps from a string name to a cursor to the
364-                                * TkCursor record for the cursor. */
365-    Tcl_HashTable cursorDataTable;
366-                               /* Maps from a collection of in-core data
367-                                * about a cursor to a TkCursor structure. */
368-    Tcl_HashTable cursorIdTable;
369-                               /* Maps from a cursor id to the TkCursor
370-                                * structure for the cursor. */
371-    char cursorString[20];     /* Used to store a cursor id string. */
372-    Font cursorFont;           /* Font to use for standard cursors.
373-                                * None means font not loaded yet. */
374-
375-    /*
376-     * Information used by tkError.c only:
377-     */
378-
379-    struct TkErrorHandler *errorPtr;
380-                               /* First in list of error handlers
381-                                * for this display.  NULL means
382-                                * no handlers exist at present. */
383-    int deleteCount;           /* Counts # of handlers deleted since
384-                                * last time inactive handlers were
385-                                * garbage-collected.  When this number
386-                                * gets big, handlers get cleaned up. */
387-
388-    /*
389-     * Used by tkEvent.c only:
390-     */
391-
392-    struct TkWindowEvent *delayedMotionPtr;
393-                               /* Points to a malloc-ed motion event
394-                                * whose processing has been delayed in
395-                                * the hopes that another motion event
396-                                * will come along right away and we can
397-                                * merge the two of them together.  NULL
398-                                * means that there is no delayed motion
399-                                * event. */
400-
401-    /*
402-     * Information used by tkFocus.c only:
403-     */
404-
405-    int focusDebug;            /* 1 means collect focus debugging
406-                                * statistics. */
407-    struct TkWindow *implicitWinPtr;
408-                               /* If the focus arrived at a toplevel window
409-                                * implicitly via an Enter event (rather
410-                                * than via a FocusIn event), this points
411-                                * to the toplevel window.  Otherwise it is
412-                                * NULL. */
413-    struct TkWindow *focusPtr; /* Points to the window on this display that
414-                                * should be receiving keyboard events.  When
415-                                * multiple applications on the display have
416-                                * the focus, this will refer to the
417-                                * innermost window in the innermost
418-                                * application.  This information isn't used
419-                                * under Unix or Windows, but it's needed on
420-                                * the Macintosh. */
421-
422-    /*
423-     * Information used by tkGC.c only:
424-     */
425-
426-    Tcl_HashTable gcValueTable;        /* Maps from a GC's values to a TkGC structure
427-                                * describing a GC with those values. */
428-    Tcl_HashTable gcIdTable;   /* Maps from a GC to a TkGC. */
429-    int gcInit;                        /* 0 means the tables below need
430-                                * initializing. */
431-
432-    /*
433-     * Information used by tkGeometry.c only:
434-     */
435-
436-    Tcl_HashTable maintainHashTable;
437-                               /* Hash table that maps from a master's
438-                                * Tk_Window token to a list of slaves
439-                                * managed by that master. */
440-    int geomInit;
441-
442-    /*
443-     * Information used by tkGet.c only:
444-     */
445-
446-    Tcl_HashTable uidTable;    /* Stores all Tk_Uids used in a thread. */
447-    int uidInit;               /* 0 means uidTable needs initializing. */
448-
449-    /*
450-     * Information used by tkGrab.c only:
451-     */
452-
453-    struct TkWindow *grabWinPtr;
454-                               /* Window in which the pointer is currently
455-                                * grabbed, or NULL if none. */
456-    struct TkWindow *eventualGrabWinPtr;
457-                               /* Value that grabWinPtr will have once the
458-                                * grab event queue (below) has been
459-                                * completely emptied. */
460-    struct TkWindow *buttonWinPtr;
461-                               /* Window in which first mouse button was
462-                                * pressed while grab was in effect, or NULL
463-                                * if no such press in effect. */
464-    struct TkWindow *serverWinPtr;
465-                               /* If no application contains the pointer then
466-                                * this is NULL.  Otherwise it contains the
467-                                * last window for which we've gotten an
468-                                * Enter or Leave event from the server (i.e.
469-                                * the last window known to have contained
470-                                * the pointer).  Doesn't reflect events
471-                                * that were synthesized in tkGrab.c. */
472-    TkGrabEvent *firstGrabEventPtr;
473-                               /* First in list of enter/leave events
474-                                * synthesized by grab code.  These events
475-                                * must be processed in order before any other
476-                                * events are processed.  NULL means no such
477-                                * events. */
478-    TkGrabEvent *lastGrabEventPtr;
479-                               /* Last in list of synthesized events, or NULL
480-                                * if list is empty. */
481-    int grabFlags;             /* Miscellaneous flag values.  See definitions
482-                                * in tkGrab.c. */
483-
484-    /*
485-     * Information used by tkGrid.c only:
486-     */
487-
488-    int gridInit;              /* 0 means table below needs initializing. */
489-    Tcl_HashTable gridHashTable;/* Maps from Tk_Window tokens to
490-                                * corresponding Grid structures. */
491-
492-    /*
493-     * Information used by tkImage.c only:
494-     */
495-
496-    int imageId;               /* Value used to number image ids. */
497-
498-    /*
499-     * Information used by tkMacWinMenu.c only:
500-     */
501-
502-    int postCommandGeneration;
503-
504-    /*
505-     * Information used by tkOption.c only.
506-     */
507-
508-
509-
510-    /*
511-     * Information used by tkPack.c only.
512-     */
513-
514-    int packInit;              /* 0 means table below needs initializing. */
515-    Tcl_HashTable packerHashTable;
516-                               /* Maps from Tk_Window tokens to
517-                                * corresponding Packer structures. */
518-
519-
520-    /*
521-     * Information used by tkPlace.c only.
522-     */
523-
524-    int placeInit;             /* 0 means tables below need initializing. */
525-    Tcl_HashTable masterTable; /* Maps from Tk_Window toke to the Master
526-                                * structure for the window, if it exists. */
527-    Tcl_HashTable slaveTable;  /* Maps from Tk_Window toke to the Slave
528-                                * structure for the window, if it exists. */
529-
530-    /*
531-     * Information used by tkSelect.c and tkClipboard.c only:
532-     */
533-
534-
535-    struct TkSelectionInfo *selectionInfoPtr;
536-    /* First in list of selection information
537-                                * records.  Each entry contains information
538-                                * about the current owner of a particular
539-                                * selection on this display. */
540-    Atom multipleAtom;         /* Atom for MULTIPLE.  None means
541-                                * selection stuff isn't initialized. */
542-    Atom incrAtom;             /* Atom for INCR. */
543-    Atom targetsAtom;          /* Atom for TARGETS. */
544-    Atom timestampAtom;                /* Atom for TIMESTAMP. */
545-    Atom textAtom;             /* Atom for TEXT. */
546-    Atom compoundTextAtom;     /* Atom for COMPOUND_TEXT. */
547-    Atom applicationAtom;      /* Atom for TK_APPLICATION. */
548-    Atom windowAtom;           /* Atom for TK_WINDOW. */
549-    Atom clipboardAtom;                /* Atom for CLIPBOARD. */
550-#if (TK_VERSION_NUMBER >= _VERSION(8,4,0))
551-    Atom utf8Atom;
552-#endif
553-    Tk_Window clipWindow;      /* Window used for clipboard ownership and to
554-                                * retrieve selections between processes. NULL
555-                                * means clipboard info hasn't been
556-                                * initialized. */
557-    int clipboardActive;       /* 1 means we currently own the clipboard
558-                                * selection, 0 means we don't. */
559-    struct TkMainInfo *clipboardAppPtr;
560-                               /* Last application that owned clipboard. */
561-    struct TkClipboardTarget *clipTargetPtr;
562-                               /* First in list of clipboard type information
563-                                * records.  Each entry contains information
564-                                * about the buffers for a given selection
565-                                * target. */
566-
567-    /*
568-     * Information used by tkSend.c only:
569-     */
570-
571-    Tk_Window commTkwin;       /* Window used for communication
572-                                * between interpreters during "send"
573-                                * commands.  NULL means send info hasn't
574-                                * been initialized yet. */
575-    Atom commProperty;         /* X's name for comm property. */
576-    Atom registryProperty;     /* X's name for property containing
577-                                * registry of interpreter names. */
578-    Atom appNameProperty;      /* X's name for property used to hold the
579-                                * application name on each comm window. */
580-
581-    /*
582-     * Information used by tkXId.c only:
583-     */
584-
585-    struct TkIdStack *idStackPtr;
586-                               /* First in list of chunks of free resource
587-                                * identifiers, or NULL if there are no free
588-                                * resources. */
589-    XID(*defaultAllocProc) _ANSI_ARGS_((Display *display));
590-                               /* Default resource allocator for display. */
591-    struct TkIdStack *windowStackPtr;
592-                               /* First in list of chunks of window
593-                                * identifers that can't be reused right
594-                                * now. */
595-#if (TK_VERSION_NUMBER < _VERSION(8,4,0))
596-    int idCleanupScheduled;    /* 1 means a call to WindowIdCleanup has
597-                                * already been scheduled, 0 means it
598-                                * hasn't. */
599-#else
600-    Tcl_TimerToken idCleanupScheduled;
601-                               /* If set, it means a call to WindowIdCleanup
602-                                * has already been scheduled, 0 means it
603-                                * hasn't. */
604-#endif
605-    /*
606-     * Information used by tkUnixWm.c and tkWinWm.c only:
607-     */
608-
609-#if (TK_VERSION_NUMBER < _VERSION(8,4,0))
610-    int wmTracing;             /* Used to enable or disable tracing in
611-                                * this module.  If tracing is enabled,
612-                                * then information is printed on
613-                                * standard output about interesting
614-                                * interactions with the window manager. */
615-#endif
616-    struct TkWmInfo *firstWmPtr; /* Points to first top-level window. */
617-    struct TkWmInfo *foregroundWmPtr;
618-                               /* Points to the foreground window. */
619-
620-    /*
621-     * Information maintained by tkWindow.c for use later on by tkXId.c:
622-     */
623-
624-
625-    int destroyCount;          /* Number of Tk_DestroyWindow operations
626-                                * in progress. */
627-    unsigned long lastDestroyRequest;
628-                               /* Id of most recent XDestroyWindow request;
629-                                * can re-use ids in windowStackPtr when
630-                                * server has seen this request and event
631-                                * queue is empty. */
632-
633-    /*
634-     * Information used by tkVisual.c only:
635-     */
636-
637-    TkColormap *cmapPtr;       /* First in list of all non-default colormaps
638-                                * allocated for this display. */
639-
640-    /*
641-     * Miscellaneous information:
642-     */
643-
644-#ifdef TK_USE_INPUT_METHODS
645-    XIM inputMethod;           /* Input method for this display */
646-#if (TK_VERSION_NUMBER >= _VERSION(8,4,0))
647-#if TK_XIM_SPOT
648-    XFontSet inputXfs;         /* XFontSet cached for over-the-spot XIM. */
649-#endif /* TK_XIM_SPOT */
650-#endif /* TK_VERSION_NUMBER >= 8.4 */
651-#endif /* TK_USE_INPUT_METHODS */
652-    Tcl_HashTable winTable;    /* Maps from X window ids to TkWindow ptrs. */
653-    int refCount;              /* Reference count of how many Tk applications
654-                                 * are using this display. Used to clean up
655-                                 * the display when we no longer have any
656-                                 * Tk applications using it.
657-                                 */
658-    /*
659-     * The following field were all added for Tk8.3
660-     */
661-    int mouseButtonState;       /* current mouse button state for this
662-                                 * display */
663-#if (TK_VERSION_NUMBER < _VERSION(8,4,0))
664-    int warpInProgress;
665-#endif
666-    Window warpWindow;
667-    int warpX;
668-    int warpY;
669-#if (TK_VERSION_NUMBER < _VERSION(8,4,0))
670-    int useInputMethods;        /* Whether to use input methods */
671-#else
672-    /*
673-     * The following field(s) were all added for Tk8.4
674-     */
675-    long deletionEpoch;                /* Incremented by window deletions */
676-    unsigned int flags;                /* Various flag values:  these are all
677-                                * defined in below. */
678-    TkCaret caret;             /* information about the caret for this
679-                                * display.  This is not a pointer. */
680-#endif
681-} TkDisplay;
682-
683-#else
684-
685-/*
686- * One of the following structures is maintained for each display
687- * containing a window managed by Tk:
688- */
689-typedef struct TkDisplayStruct {
690-    Display *display;          /* Xlib's info about display. */
691-    struct TkDisplayStruct *nextPtr; /* Next in list of all displays. */
692-    char *name;                        /* Name of display (with any screen
693-                                * identifier removed).  Malloc-ed. */
694-    Time lastEventTime;                /* Time of last event received for this
695-                                * display. */
696-
697-    /*
698-     * Information used primarily by tkBind.c:
699-     */
700-
701-    int bindInfoStale;         /* Non-zero means the variables in this
702-                                * part of the structure are potentially
703-                                * incorrect and should be recomputed. */
704-    unsigned int modeModMask;  /* Has one bit set to indicate the modifier
705-                                * corresponding to "mode shift".  If no
706-                                * such modifier, than this is zero. */
707-    unsigned int metaModMask;  /* Has one bit set to indicate the modifier
708-                                * corresponding to the "Meta" key.  If no
709-                                * such modifier, then this is zero. */
710-    unsigned int altModMask;   /* Has one bit set to indicate the modifier
711-                                * corresponding to the "Meta" key.  If no
712-                                * such modifier, then this is zero. */
713-    enum {
714-       LU_IGNORE, LU_CAPS, LU_SHIFT
715-    } lockUsage;
716-    /* Indicates how to interpret lock modifier. */
717-    int numModKeyCodes;                /* Number of entries in modKeyCodes array
718-                                * below. */
719-    KeyCode *modKeyCodes;      /* Pointer to an array giving keycodes for
720-                                * all of the keys that have modifiers
721-                                * associated with them.  Malloc'ed, but
722-                                * may be NULL. */
723-
724-    /*
725-     * Information used by tkError.c only:
726-     */
727-
728-    TkErrorHandler *errorPtr;
729-    /* First in list of error handlers
730-                                * for this display.  NULL means
731-                                * no handlers exist at present. */
732-     int deleteCount;          /* Counts # of handlers deleted since
733-                                * last time inactive handlers were
734-                                * garbage-collected.  When this number
735-                                * gets big, handlers get cleaned up. */
736-
737-    /*
738-     * Information used by tkSend.c only:
739-     */
740-
741-    Tk_Window commTkwin;       /* Window used for communication
742-                                * between interpreters during "send"
743-                                * commands.  NULL means send info hasn't
744-                                * been initialized yet. */
745-    Atom commProperty;         /* X's name for comm property. */
746-    Atom registryProperty;     /* X's name for property containing
747-                                * registry of interpreter names. */
748-    Atom appNameProperty;      /* X's name for property used to hold the
749-                                * application name on each comm window. */
750-
751-    /*
752-     * Information used by tkSelect.c and tkClipboard.c only:
753-     */
754-
755-     TkSelectionInfo *selectionInfoPtr;
756-    /* First in list of selection information
757-                                * records.  Each entry contains information
758-                                * about the current owner of a particular
759-                                * selection on this display. */
760-    Atom multipleAtom;         /* Atom for MULTIPLE.  None means
761-                                * selection stuff isn't initialized. */
762-    Atom incrAtom;             /* Atom for INCR. */
763-    Atom targetsAtom;          /* Atom for TARGETS. */
764-    Atom timestampAtom;                /* Atom for TIMESTAMP. */
765-    Atom textAtom;             /* Atom for TEXT. */
766-    Atom compoundTextAtom;     /* Atom for COMPOUND_TEXT. */
767-    Atom applicationAtom;      /* Atom for TK_APPLICATION. */
768-    Atom windowAtom;           /* Atom for TK_WINDOW. */
769-    Atom clipboardAtom;                /* Atom for CLIPBOARD. */
770-
771-    Tk_Window clipWindow;      /* Window used for clipboard ownership and to
772-                                * retrieve selections between processes. NULL
773-                                * means clipboard info hasn't been
774-                                * initialized. */
775-    int clipboardActive;       /* 1 means we currently own the clipboard
776-                                * selection, 0 means we don't. */
777-     TkMainInfo *clipboardAppPtr;
778-     /* Last application that owned clipboard. */
779-     TkClipboardTarget *clipTargetPtr;
780-     /* First in list of clipboard type information
781-                                * records.  Each entry contains information
782-                                * about the buffers for a given selection
783-                                * target. */
784-
785-    /*
786-     * Information used by tkAtom.c only:
787-     */
788-
789-    int atomInit;              /* 0 means stuff below hasn't been
790-                                * initialized yet. */
791-    Tcl_HashTable nameTable;   /* Maps from names to Atom's. */
792-    Tcl_HashTable atomTable;   /* Maps from Atom's back to names. */
793-
794-    /*
795-     * Information used by tkCursor.c only:
796-     */
797-
798-    Font cursorFont;           /* Font to use for standard cursors.
799-                                * None means font not loaded yet. */
800-
801-    /*
802-     * Information used by tkGrab.c only:
803-     */
804-
805-     TkWindow *grabWinPtr;
806-    /* Window in which the pointer is currently
807-                                * grabbed, or NULL if none. */
808-     TkWindow *eventualGrabWinPtr;
809-    /* Value that grabWinPtr will have once the
810-                                * grab event queue (below) has been
811-                                * completely emptied. */
812-     TkWindow *buttonWinPtr;
813-    /* Window in which first mouse button was
814-                                * pressed while grab was in effect, or NULL
815-                                * if no such press in effect. */
816-     TkWindow *serverWinPtr;
817-    /* If no application contains the pointer then
818-                                * this is NULL.  Otherwise it contains the
819-                                * last window for which we've gotten an
820-                                * Enter or Leave event from the server (i.e.
821-                                * the last window known to have contained
822-                                * the pointer).  Doesn't reflect events
823-                                * that were synthesized in tkGrab.c. */
824-    TkGrabEvent *firstGrabEventPtr;
825-    /* First in list of enter/leave events
826-                                * synthesized by grab code.  These events
827-                                * must be processed in order before any other
828-                                * events are processed.  NULL means no such
829-                                * events. */
830-    TkGrabEvent *lastGrabEventPtr;
831-    /* Last in list of synthesized events, or NULL
832-                                * if list is empty. */
833-    int grabFlags;             /* Miscellaneous flag values.  See definitions
834-                                * in tkGrab.c. */
835-
836-    /*
837-     * Information used by tkXId.c only:
838-     */
839-
840-     TkIdStack *idStackPtr;
841-    /* First in list of chunks of free resource
842-                                * identifiers, or NULL if there are no free
843-                                * resources. */
844-              XID(*defaultAllocProc) _ANSI_ARGS_((Display *display));
845-    /* Default resource allocator for display. */
846-     TkIdStack *windowStackPtr;
847-    /* First in list of chunks of window
848-                                * identifers that can't be reused right
849-                                * now. */
850-    int idCleanupScheduled;    /* 1 means a call to WindowIdCleanup has
851-                                * already been scheduled, 0 means it
852-                                * hasn't. */
853-
854-    /*
855-     * Information maintained by tkWindow.c for use later on by tkXId.c:
856-     */
857-
858-
859-    int destroyCount;          /* Number of Tk_DestroyWindow operations
860-                                * in progress. */
861-    unsigned long lastDestroyRequest;
862-    /* Id of most recent XDestroyWindow request;
863-                                * can re-use ids in windowStackPtr when
864-                                * server has seen this request and event
865-                                * queue is empty. */
866-
867-    /*
868-     * Information used by tkVisual.c only:
869-     */
870-
871-    TkColormap *cmapPtr;       /* First in list of all non-default colormaps
872-                                * allocated for this display. */
873-
874-    /*
875-     * Information used by tkFocus.c only:
876-     */
877-#if (TK_MAJOR_VERSION == 4)
878-
879-     TkWindow *focusWinPtr;
880-                               /* Window that currently has the focus for
881-                                * this display, or NULL if none. */
882-     TkWindow *implicitWinPtr;
883-                               /* If the focus arrived at a toplevel window
884-                                * implicitly via an Enter event (rather
885-                                * than via a FocusIn event), this points
886-                                * to the toplevel window.  Otherwise it is
887-                                * NULL. */
888-     TkWindow *focusOnMapPtr;
889-                               /* This points to a toplevel window that is
890-                                * supposed to receive the X input focus as
891-                                * soon as it is mapped (needed to handle the
892-                                * fact that X won't allow the focus on an
893-                                * unmapped window).  NULL means no delayed
894-                                * focus op in progress. */
895-    int forceFocus;            /* Associated with focusOnMapPtr:  non-zero
896-                                * means claim the focus even if some other
897-                                * application currently has it. */
898-#else
899-     TkWindow *implicitWinPtr;
900-                               /* If the focus arrived at a toplevel window
901-                                * implicitly via an Enter event (rather
902-                                * than via a FocusIn event), this points
903-                                * to the toplevel window.  Otherwise it is
904-                                * NULL. */
905-     TkWindow *focusPtr;       /* Points to the window on this display that
906-                                * should be receiving keyboard events.  When
907-                                * multiple applications on the display have
908-                                * the focus, this will refer to the
909-                                * innermost window in the innermost
910-                                * application.  This information isn't used
911-                                * under Unix or Windows, but it's needed on
912-                                * the Macintosh. */
913-#endif /* TK_MAJOR_VERSION == 4 */
914-
915-    /*
916-     * Used by tkColor.c only:
917-     */
918-
919-    TkStressedCmap *stressPtr; /* First in list of colormaps that have
920-                                * filled up, so we have to pick an
921-                                * approximate color. */
922-
923-    /*
924-     * Used by tkEvent.c only:
925-     */
926-
927-     TkWindowEvent *delayedMotionPtr;
928-                               /* Points to a malloc-ed motion event
929-                                * whose processing has been delayed in
930-                                * the hopes that another motion event
931-                                * will come along right away and we can
932-                                * merge the two of them together.  NULL
933-                                * means that there is no delayed motion
934-                                * event. */
935-    /*
936-     * Miscellaneous information:
937-     */
938-
939-#ifdef TK_USE_INPUT_METHODS
940-    XIM inputMethod;           /* Input method for this display */
941-#endif /* TK_USE_INPUT_METHODS */
942-    Tcl_HashTable winTable;    /* Maps from X window ids to TkWindow ptrs. */
943-#if (TK_MAJOR_VERSION > 4)
944-    int refCount;              /* Reference count of how many Tk applications
945-                                 * are using this display. Used to clean up
946-                                 * the display when we no longer have any
947-                                 * Tk applications using it.
948-                                 */
949-#endif /* TK_MAJOR_VERSION > 4 */
950-
951-} TkDisplay;
952-
953-#endif /* TK_VERSION_NUMBER >= _VERSION(8,1,0) */
954-
955-
956-struct TkWindowStruct {
957-    Display *display;
958-    TkDisplay *dispPtr;
959-    int screenNum;
960-    Visual *visual;
961-    int depth;
962-    Window window;
963-    TkWindow *childList;
964-    TkWindow *lastChildPtr;
965-    TkWindow *parentPtr;
966-    TkWindow *nextPtr;
967-    TkMainInfo *infoPtr;
968-    char *pathName;
969-    Tk_Uid nameUid;
970-    Tk_Uid classUid;
971-    XWindowChanges changes;
972-    unsigned int dirtyChanges;
973-    XSetWindowAttributes atts;
974-    unsigned long dirtyAtts;
975-    unsigned int flags;
976-    TkEventHandler *handlerList;
977-#ifdef TK_USE_INPUT_METHODS
978-    XIC inputContext;
979-#endif /* TK_USE_INPUT_METHODS */
980-    ClientData *tagPtr;
981-    int nTags;
982-    int optionLevel;
983-    TkSelHandler *selHandlerList;
984-    Tk_GeomMgr *geomMgrPtr;
985-    ClientData geomData;
986-    int reqWidth, reqHeight;
987-    int internalBorderWidth;
988-    TkWinInfo *wmInfoPtr;
989-#if (TK_MAJOR_VERSION > 4)
990-    TkClassProcs *classProcsPtr;
991-    ClientData instanceData;
992-#endif
993-    TkWindowPrivate *privatePtr;
994-};
995-
996 #ifdef WIN32
997 /*
998--- src/bltPs.c 2002-09-18 18:30:51.000000000 -0400
999+++ src/bltPs.c 2010-01-25 19:04:13.000000000 -0500
1000@@ -894,5 +894,5 @@
1001     }
1002     if ((relief == TK_RELIEF_SOLID) ||
1003-       (borderPtr->lightColor == NULL) || (borderPtr->darkColor == NULL)) {
1004+       (borderPtr->lightColorPtr == NULL) || (borderPtr->darkColorPtr == NULL)) {
1005        if (relief == TK_RELIEF_SOLID) {
1006            darkColor.red = darkColor.blue = darkColor.green = 0x00;
1007@@ -902,5 +902,5 @@
1008            Screen *screenPtr;
1009 
1010-           lightColor = *borderPtr->bgColor;
1011+           lightColor = *borderPtr->bgColorPtr;
1012            screenPtr = Tk_Screen(tokenPtr->tkwin);
1013            if (lightColor.pixel == WhitePixelOfScreen(screenPtr)) {
1014@@ -913,6 +913,6 @@
1015        darkColorPtr = &darkColor;
1016     } else {
1017-       lightColorPtr = borderPtr->lightColor;
1018-       darkColorPtr = borderPtr->darkColor;
1019+       lightColorPtr = borderPtr->lightColorPtr;
1020+       darkColorPtr = borderPtr->darkColorPtr;
1021     }
1022 
1023@@ -943,5 +943,5 @@
1024        bottomColor = lightColorPtr;
1025     } else {
1026-       topColor = bottomColor = borderPtr->bgColor;
1027+       topColor = bottomColor = borderPtr->bgColorPtr;
1028     }
1029     Blt_BackgroundToPostScript(tokenPtr, bottomColor);
1030@@ -983,5 +983,5 @@
1031      * the plot when the colormode option is "monochrome".
1032      */
1033-    Blt_BackgroundToPostScript(tokenPtr, borderPtr->bgColor);
1034+    Blt_BackgroundToPostScript(tokenPtr, borderPtr->bgColorPtr);
1035     Blt_RectangleToPostScript(tokenPtr, x, y, width, height);
1036     Blt_Draw3DRectangleToPostScript(tokenPtr, border, x, y, width, height,
1037--- src/bltText.c       2002-08-13 15:45:20.000000000 -0400
1038+++ src/bltText.c       2010-01-25 20:08:01.000000000 -0500
1039@@ -691,5 +691,5 @@
1040            XColor *color1, *color2;
1041 
1042-           color1 = borderPtr->lightColor, color2 = borderPtr->darkColor;
1043+           color1 = borderPtr->lightColorPtr, color2 = borderPtr->darkColorPtr;
1044            if (tsPtr->state & STATE_EMPHASIS) {
1045                XColor *hold;
1046@@ -755,5 +755,5 @@
1047        XColor *color1, *color2;
1048 
1049-       color1 = borderPtr->lightColor, color2 = borderPtr->darkColor;
1050+       color1 = borderPtr->lightColorPtr, color2 = borderPtr->darkColorPtr;
1051        if (tsPtr->state & STATE_EMPHASIS) {
1052            XColor *hold;
1053--- src/tkFrame.c       2002-10-16 01:33:53.000000000 -0400
1054+++ src/tkFrame.c       2010-01-25 21:36:58.000000000 -0500
1055@@ -117,5 +117,5 @@
1056                                 * definitions. */
1057     Blt_Tile tile;
1058-} Frame;
1059+} bltFrame;
1060 
1061 /*
1062@@ -144,8 +144,8 @@
1063 {
1064     {TK_CONFIG_BORDER, "-background", "background", "Background",
1065-       DEF_FRAME_BACKGROUND, Tk_Offset(Frame, border),
1066+       DEF_FRAME_BACKGROUND, Tk_Offset(bltFrame, border),
1067        BOTH | TK_CONFIG_COLOR_ONLY | TK_CONFIG_NULL_OK},
1068     {TK_CONFIG_BORDER, "-background", "background", "Background",
1069-       DEF_FRAME_BG_MONO, Tk_Offset(Frame, border),
1070+       DEF_FRAME_BG_MONO, Tk_Offset(bltFrame, border),
1071        BOTH | TK_CONFIG_MONO_ONLY | TK_CONFIG_NULL_OK},
1072     {TK_CONFIG_SYNONYM, "-bd", "borderWidth", (char *)NULL,
1073@@ -154,53 +154,53 @@
1074        (char *)NULL, 0, BOTH},
1075     {TK_CONFIG_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
1076-       DEF_FRAME_BORDERWIDTH, Tk_Offset(Frame, borderWidth), BOTH},
1077+       DEF_FRAME_BORDERWIDTH, Tk_Offset(bltFrame, borderWidth), BOTH},
1078     {TK_CONFIG_STRING, "-class", "class", "Class",
1079-       DEF_FRAME_CLASS, Tk_Offset(Frame, className), FRAME},
1080+       DEF_FRAME_CLASS, Tk_Offset(bltFrame, className), FRAME},
1081     {TK_CONFIG_STRING, "-class", "class", "Class",
1082-       DEF_TOPLEVEL_CLASS, Tk_Offset(Frame, className), TOPLEVEL},
1083+       DEF_TOPLEVEL_CLASS, Tk_Offset(bltFrame, className), TOPLEVEL},
1084     {TK_CONFIG_STRING, "-colormap", "colormap", "Colormap",
1085-       DEF_FRAME_COLORMAP, Tk_Offset(Frame, colormapName),
1086+       DEF_FRAME_COLORMAP, Tk_Offset(bltFrame, colormapName),
1087        BOTH | TK_CONFIG_NULL_OK},
1088 #if (TK_MAJOR_VERSION > 4)
1089     {TK_CONFIG_BOOLEAN, "-container", "container", "Container",
1090-       DEF_FRAME_CONTAINER, Tk_Offset(Frame, isContainer), BOTH},
1091+       DEF_FRAME_CONTAINER, Tk_Offset(bltFrame, isContainer), BOTH},
1092 #endif /* TK_MAJOR_VERSION > 4 */
1093     {TK_CONFIG_ACTIVE_CURSOR, "-cursor", "cursor", "Cursor",
1094-       DEF_FRAME_CURSOR, Tk_Offset(Frame, cursor), BOTH | TK_CONFIG_NULL_OK},
1095+       DEF_FRAME_CURSOR, Tk_Offset(bltFrame, cursor), BOTH | TK_CONFIG_NULL_OK},
1096     {TK_CONFIG_PIXELS, "-height", "height", "Height",
1097-       DEF_FRAME_HEIGHT, Tk_Offset(Frame, height), BOTH},
1098+       DEF_FRAME_HEIGHT, Tk_Offset(bltFrame, height), BOTH},
1099     {TK_CONFIG_COLOR, "-highlightbackground", "highlightBackground",
1100        "HighlightBackground", DEF_FRAME_HIGHLIGHT_BG,
1101-       Tk_Offset(Frame, highlightBgColorPtr), BOTH},
1102+       Tk_Offset(bltFrame, highlightBgColorPtr), BOTH},
1103     {TK_CONFIG_COLOR, "-highlightcolor", "highlightColor", "HighlightColor",
1104-       DEF_FRAME_HIGHLIGHT, Tk_Offset(Frame, highlightColorPtr), BOTH},
1105+       DEF_FRAME_HIGHLIGHT, Tk_Offset(bltFrame, highlightColorPtr), BOTH},
1106     {TK_CONFIG_PIXELS, "-highlightthickness", "highlightThickness",
1107        "HighlightThickness",
1108-       DEF_FRAME_HIGHLIGHT_WIDTH, Tk_Offset(Frame, highlightWidth), BOTH},
1109+       DEF_FRAME_HIGHLIGHT_WIDTH, Tk_Offset(bltFrame, highlightWidth), BOTH},
1110 #if (TK_MAJOR_VERSION > 4)
1111     {TK_CONFIG_STRING, "-menu", "menu", "Menu",
1112-       DEF_TOPLEVEL_MENU, Tk_Offset(Frame, menuName),
1113+       DEF_TOPLEVEL_MENU, Tk_Offset(bltFrame, menuName),
1114        TOPLEVEL | TK_CONFIG_NULL_OK},
1115 #endif /* TK_MAJOR_VERSION > 4 */
1116     {TK_CONFIG_RELIEF, "-relief", "relief", "Relief",
1117-       DEF_FRAME_RELIEF, Tk_Offset(Frame, relief), BOTH},
1118+       DEF_FRAME_RELIEF, Tk_Offset(bltFrame, relief), BOTH},
1119     {TK_CONFIG_STRING, "-screen", "screen", "Screen",
1120-       DEF_TOPLEVEL_SCREEN, Tk_Offset(Frame, screenName),
1121+       DEF_TOPLEVEL_SCREEN, Tk_Offset(bltFrame, screenName),
1122        TOPLEVEL | TK_CONFIG_NULL_OK},
1123     {TK_CONFIG_STRING, "-takefocus", "takeFocus", "TakeFocus",
1124-       DEF_FRAME_TAKE_FOCUS, Tk_Offset(Frame, takeFocus),
1125+       DEF_FRAME_TAKE_FOCUS, Tk_Offset(bltFrame, takeFocus),
1126        BOTH | TK_CONFIG_NULL_OK},
1127     {TK_CONFIG_CUSTOM, "-tile", "tile", "Tile",
1128-       (char *)NULL, Tk_Offset(Frame, tile), BOTH | TK_CONFIG_NULL_OK,
1129+       (char *)NULL, Tk_Offset(bltFrame, tile), BOTH | TK_CONFIG_NULL_OK,
1130        &bltTileOption},
1131 #if (TK_MAJOR_VERSION > 4)
1132     {TK_CONFIG_STRING, "-use", "use", "Use",
1133-       DEF_FRAME_USE, Tk_Offset(Frame, useThis), TOPLEVEL|TK_CONFIG_NULL_OK},
1134+       DEF_FRAME_USE, Tk_Offset(bltFrame, useThis), TOPLEVEL|TK_CONFIG_NULL_OK},
1135 #endif
1136     {TK_CONFIG_STRING, "-visual", "visual", "Visual",
1137-       DEF_FRAME_VISUAL, Tk_Offset(Frame, visualName),
1138+       DEF_FRAME_VISUAL, Tk_Offset(bltFrame, visualName),
1139        BOTH | TK_CONFIG_NULL_OK},
1140     {TK_CONFIG_PIXELS, "-width", "width", "Width",
1141-       DEF_FRAME_WIDTH, Tk_Offset(Frame, width), BOTH},
1142+       DEF_FRAME_WIDTH, Tk_Offset(bltFrame, width), BOTH},
1143     {TK_CONFIG_END, (char *)NULL, (char *)NULL, (char *)NULL,
1144        (char *)NULL, 0, 0}
1145@@ -212,5 +212,5 @@
1146 
1147 static int ConfigureFrame _ANSI_ARGS_((Tcl_Interp *interp,
1148-       Frame * framePtr, int argc, char **argv,
1149+       bltFrame * framePtr, int argc, CONST84 char **argv,
1150        int flags));
1151 static void DestroyFrame _ANSI_ARGS_((DestroyData *memPtr));
1152@@ -220,25 +220,14 @@
1153 static void FrameEventProc _ANSI_ARGS_((ClientData clientData,
1154        XEvent *eventPtr));
1155-static int FrameWidgetCmd _ANSI_ARGS_((ClientData clientData,
1156-       Tcl_Interp *interp, int argc, char **argv));
1157 static void MapFrame _ANSI_ARGS_((ClientData clientData));
1158 
1159 static Blt_TileChangedProc TileChangedProc;
1160-static Tcl_CmdProc FrameCmd, ToplevelCmd;
1161+static Tcl_CmdProc FrameCmd, ToplevelCmd, FrameWidgetCmd;
1162 
1163-#ifdef TILE_MAINWINDOW
1164-EXTERN
1165-#else
1166 static
1167-#endif
1168-int TkCreateFrame _ANSI_ARGS_((ClientData clientData,
1169-       Tcl_Interp *interp, int argc, char **argv,
1170+int BltCreateFrame _ANSI_ARGS_((ClientData clientData,
1171+       Tcl_Interp *interp, int argc, CONST84 char **argv,
1172        int toplevel, char *appName));
1173 
1174-EXTERN void TkSetWindowMenuBar _ANSI_ARGS_((Tcl_Interp *interp, Tk_Window tkwin,
1175-        char *oldMenuName, char *menuName));
1176-
1177-EXTERN Tk_Window TkCreateMainWindow _ANSI_ARGS_((Tcl_Interp * interp,
1178-       char * screenName, char * baseName));
1179 #if (TK_MAJOR_VERSION == 8) && (TK_MINOR_VERSION > 3)
1180 #define TkSetClassProcs        Tk_SetClassProcs
1181@@ -250,6 +239,4 @@
1182 EXTERN void TkpSetMainMenubar _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin,
1183        char * menuName));
1184-EXTERN int TkpUseWindow _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin,
1185-       char * string));
1186 EXTERN void TkpMakeContainer _ANSI_ARGS_((Tk_Window tkwin));
1187 
1188@@ -280,7 +267,7 @@
1189     Tcl_Interp *interp;                /* Current interpreter. */
1190     int argc;                  /* Number of arguments. */
1191-    char **argv;               /* Argument strings. */
1192+    CONST84 char **argv;               /* Argument strings. */
1193 {
1194-    return TkCreateFrame(clientData, interp, argc, argv, 0, (char *)NULL);
1195+    return BltCreateFrame(clientData, interp, argc, argv, 0, (char *)NULL);
1196 }
1197 
1198@@ -291,7 +278,7 @@
1199     Tcl_Interp *interp;                /* Current interpreter. */
1200     int argc;                  /* Number of arguments. */
1201-    char **argv;               /* Argument strings. */
1202+    CONST84 char **argv;               /* Argument strings. */
1203 {
1204-    return TkCreateFrame(clientData, interp, argc, argv, 1, (char *)NULL);
1205+    return BltCreateFrame(clientData, interp, argc, argv, 1, (char *)NULL);
1206 }
1207 
1208@@ -320,5 +307,5 @@
1209 #endif /* TILE_MAINWINDOW */
1210 int
1211-TkCreateFrame(clientData, interp, argc, argv, toplevel, appName)
1212+BltCreateFrame(clientData, interp, argc, argv, toplevel, appName)
1213     ClientData clientData;     /* Main window associated with interpreter.
1214                                 * If we're called by Tk_Init to create a
1215@@ -326,5 +313,5 @@
1216     Tcl_Interp *interp;                /* Current interpreter. */
1217     int argc;                  /* Number of arguments. */
1218-    char **argv;               /* Argument strings. */
1219+    CONST84 char *argv[];      /* Argument strings. */
1220     int toplevel;              /* Non-zero means create a toplevel window,
1221                                 * zero means create a frame. */
1222@@ -333,5 +320,5 @@
1223                                 * new application. */
1224 {
1225-    Frame *framePtr;
1226+    bltFrame *framePtr;
1227     Tk_Window new;
1228     char *className, *screenName, *visualName, *colormapName, *arg, *useOption;
1229@@ -408,5 +395,5 @@
1230 
1231        if (appName == NULL) {
1232-           panic("TkCreateFrame didn't get application name");
1233+           panic("BltCreateFrame didn't get application name");
1234        }
1235        new = (Tk_Window)TkCreateMainWindow(interp, screenName, appName);
1236@@ -468,5 +455,5 @@
1237      */
1238 
1239-    framePtr = Blt_Malloc(sizeof(Frame));
1240+    framePtr = Blt_Malloc(sizeof(bltFrame));
1241     framePtr->tkwin = new;
1242     framePtr->display = Tk_Display(new);
1243@@ -559,7 +546,7 @@
1244     Tcl_Interp *interp;                /* Current interpreter. */
1245     int argc;                  /* Number of arguments. */
1246-    char **argv;               /* Argument strings. */
1247+    CONST84 char *argv[];              /* Argument strings. */
1248 {
1249-    register Frame *framePtr = (Frame *) clientData;
1250+    register bltFrame *framePtr = (bltFrame *) clientData;
1251     int result;
1252     size_t length;
1253@@ -661,5 +648,5 @@
1254     DestroyData *memPtr;       /* Info about frame widget. */
1255 {
1256-    register Frame *framePtr = (Frame *) memPtr;
1257+    register bltFrame *framePtr = (bltFrame *) memPtr;
1258     
1259     Tk_FreeOptions(configSpecs, (char *)framePtr, framePtr->display,
1260@@ -690,5 +677,5 @@
1261     Blt_Tile tile;
1262 {
1263-    Frame *framePtr = (Frame *) clientData;
1264+    bltFrame *framePtr = (bltFrame *) clientData;
1265 
1266     if (framePtr->tkwin != NULL) {
1267@@ -724,8 +711,8 @@
1268 ConfigureFrame(interp, framePtr, argc, argv, flags)
1269     Tcl_Interp *interp;                /* Used for error reporting. */
1270-    register Frame *framePtr;  /* Information about widget;  may or may
1271+    register bltFrame *framePtr;       /* Information about widget;  may or may
1272                                 * not already have values for some fields. */
1273     int argc;                  /* Number of valid entries in argv. */
1274-    char **argv;               /* Arguments. */
1275+    CONST84 char **argv;               /* Arguments. */
1276     int flags;                 /* Flags to pass to Tk_ConfigureWidget. */
1277 {
1278@@ -811,5 +798,5 @@
1279     ClientData clientData;     /* Information about widget. */
1280 {
1281-    register Frame *framePtr = (Frame *) clientData;
1282+    register bltFrame *framePtr = (bltFrame *) clientData;
1283     register Tk_Window tkwin = framePtr->tkwin;
1284     GC gc;
1285@@ -878,5 +865,5 @@
1286     register XEvent *eventPtr; /* Information about event. */
1287 {
1288-    register Frame *framePtr = (Frame *) clientData;
1289+    register bltFrame *framePtr = (bltFrame *) clientData;
1290 
1291     if (((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0))
1292@@ -965,5 +952,5 @@
1293     ClientData clientData;     /* Pointer to widget record for widget. */
1294 {
1295-    Frame *framePtr = (Frame *) clientData;
1296+    bltFrame *framePtr = (bltFrame *) clientData;
1297     Tk_Window tkwin = framePtr->tkwin;
1298 
1299@@ -1011,5 +998,5 @@
1300     ClientData clientData;     /* Pointer to frame structure. */
1301 {
1302-    Frame *framePtr = (Frame *) clientData;
1303+    bltFrame *framePtr = (bltFrame *) clientData;
1304 
1305     /*
1306@@ -1068,7 +1055,7 @@
1307 #define Tk_MainPtr(tkwin)      (((Tk_FakeWin *)(tkwin))->dummy5)
1308     if (Tk_MainPtr(tkwin) != NULL) {
1309-       Frame *framePtr;
1310+       bltFrame *framePtr;
1311 
1312-       framePtr = (Frame *) Tk_InstanceData(tkwin);
1313+       framePtr = (bltFrame *) Tk_InstanceData(tkwin);
1314        TkpMenuNotifyToplevelCreate(framePtr->interp, framePtr->menuName);
1315     }
1316--- src/tclInt.h        1969-12-31 19:00:00.000000000 -0500
1317+++ src/tclInt.h        2013-08-20 11:44:17.000000000 -0400
1318@@ -0,0 +1,4837 @@
1319+/*
1320+ * tclInt.h --
1321+ *
1322+ *     Declarations of things used internally by the Tcl interpreter.
1323+ *
1324+ * Copyright (c) 1987-1993 The Regents of the University of California.
1325+ * Copyright (c) 1993-1997 Lucent Technologies.
1326+ * Copyright (c) 1994-1998 Sun Microsystems, Inc.
1327+ * Copyright (c) 1998-1999 by Scriptics Corporation.
1328+ * Copyright (c) 2001, 2002 by Kevin B. Kenny.  All rights reserved.
1329+ * Copyright (c) 2007 Daniel A. Steffen <das@users.sourceforge.net>
1330+ * Copyright (c) 2006-2008 by Joe Mistachkin.  All rights reserved.
1331+ * Copyright (c) 2008 by Miguel Sofer. All rights reserved.
1332+ *
1333+ * See the file "license.terms" for information on usage and redistribution of
1334+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
1335+ */
1336+
1337+#ifndef _TCLINT
1338+#define _TCLINT
1339+
1340+/*
1341+ * Some numerics configuration options.
1342+ */
1343+
1344+#undef NO_WIDE_TYPE
1345+#undef ACCEPT_NAN
1346+
1347+/*
1348+ * Common include files needed by most of the Tcl source files are included
1349+ * here, so that system-dependent personalizations for the include files only
1350+ * have to be made in once place. This results in a few extra includes, but
1351+ * greater modularity. The order of the three groups of #includes is
1352+ * important. For example, stdio.h is needed by tcl.h, and the _ANSI_ARGS_
1353+ * declaration in tcl.h is needed by stdlib.h in some configurations.
1354+ */
1355+
1356+#include "tclPort.h"
1357+
1358+#include <stdio.h>
1359+
1360+#include <ctype.h>
1361+#ifdef NO_STDLIB_H
1362+#   include "../compat/stdlib.h"
1363+#else
1364+#   include <stdlib.h>
1365+#endif
1366+#ifdef NO_STRING_H
1367+#include "../compat/string.h"
1368+#else
1369+#include <string.h>
1370+#endif
1371+#ifdef STDC_HEADERS
1372+#include <stddef.h>
1373+#else
1374+typedef int ptrdiff_t;
1375+#endif
1376+
1377+/*
1378+ * Ensure WORDS_BIGENDIAN is defined correctly:
1379+ * Needs to happen here in addition to configure to work with fat compiles on
1380+ * Darwin (where configure runs only once for multiple architectures).
1381+ */
1382+
1383+#ifdef HAVE_SYS_TYPES_H
1384+#    include <sys/types.h>
1385+#endif
1386+#ifdef HAVE_SYS_PARAM_H
1387+#    include <sys/param.h>
1388+#endif
1389+#ifdef BYTE_ORDER
1390+#    ifdef BIG_ENDIAN
1391+#       if BYTE_ORDER == BIG_ENDIAN
1392+#           undef WORDS_BIGENDIAN
1393+#           define WORDS_BIGENDIAN 1
1394+#       endif
1395+#    endif
1396+#    ifdef LITTLE_ENDIAN
1397+#       if BYTE_ORDER == LITTLE_ENDIAN
1398+#           undef WORDS_BIGENDIAN
1399+#       endif
1400+#    endif
1401+#endif
1402+
1403+/*
1404+ * Used to tag functions that are only to be visible within the module being
1405+ * built and not outside it (where this is supported by the linker).
1406+ */
1407+
1408+#ifndef MODULE_SCOPE
1409+#   ifdef __cplusplus
1410+#      define MODULE_SCOPE extern "C"
1411+#   else
1412+#      define MODULE_SCOPE extern
1413+#   endif
1414+#endif
1415+
1416+/*
1417+ * When Tcl_WideInt and long are the same type, there's no value in
1418+ * having a tclWideIntType separate from the tclIntType.
1419+ */
1420+#ifdef TCL_WIDE_INT_IS_LONG
1421+#define NO_WIDE_TYPE
1422+#endif
1423+
1424+/*
1425+ * Macros used to cast between pointers and integers (e.g. when storing an int
1426+ * in ClientData), on 64-bit architectures they avoid gcc warning about "cast
1427+ * to/from pointer from/to integer of different size".
1428+ */
1429+
1430+#if !defined(INT2PTR) && !defined(PTR2INT)
1431+#   if defined(HAVE_INTPTR_T) || defined(intptr_t)
1432+#      define INT2PTR(p) ((void *)(intptr_t)(p))
1433+#      define PTR2INT(p) ((int)(intptr_t)(p))
1434+#   else
1435+#      define INT2PTR(p) ((void *)(p))
1436+#      define PTR2INT(p) ((int)(p))
1437+#   endif
1438+#endif
1439+#if !defined(UINT2PTR) && !defined(PTR2UINT)
1440+#   if defined(HAVE_UINTPTR_T) || defined(uintptr_t)
1441+#      define UINT2PTR(p) ((void *)(uintptr_t)(p))
1442+#      define PTR2UINT(p) ((unsigned int)(uintptr_t)(p))
1443+#   else
1444+#      define UINT2PTR(p) ((void *)(p))
1445+#      define PTR2UINT(p) ((unsigned int)(p))
1446+#   endif
1447+#endif
1448+
1449+/*
1450+ * The following procedures allow namespaces to be customized to support
1451+ * special name resolution rules for commands/variables.
1452+ */
1453+
1454+struct Tcl_ResolvedVarInfo;
1455+
1456+typedef Tcl_Var (Tcl_ResolveRuntimeVarProc)(Tcl_Interp *interp,
1457+       struct Tcl_ResolvedVarInfo *vinfoPtr);
1458+
1459+typedef void (Tcl_ResolveVarDeleteProc)(struct Tcl_ResolvedVarInfo *vinfoPtr);
1460+
1461+/*
1462+ * The following structure encapsulates the routines needed to resolve a
1463+ * variable reference at runtime. Any variable specific state will typically
1464+ * be appended to this structure.
1465+ */
1466+
1467+typedef struct Tcl_ResolvedVarInfo {
1468+    Tcl_ResolveRuntimeVarProc *fetchProc;
1469+    Tcl_ResolveVarDeleteProc *deleteProc;
1470+} Tcl_ResolvedVarInfo;
1471+
1472+typedef int (Tcl_ResolveCompiledVarProc)(Tcl_Interp *interp,
1473+       CONST84 char *name, int length, Tcl_Namespace *context,
1474+       Tcl_ResolvedVarInfo **rPtr);
1475+
1476+typedef int (Tcl_ResolveVarProc)(Tcl_Interp *interp, CONST84 char *name,
1477+       Tcl_Namespace *context, int flags, Tcl_Var *rPtr);
1478+
1479+typedef int (Tcl_ResolveCmdProc)(Tcl_Interp *interp, CONST84 char *name,
1480+       Tcl_Namespace *context, int flags, Tcl_Command *rPtr);
1481+
1482+typedef struct Tcl_ResolverInfo {
1483+    Tcl_ResolveCmdProc *cmdResProc;
1484+                               /* Procedure handling command name
1485+                                * resolution. */
1486+    Tcl_ResolveVarProc *varResProc;
1487+                               /* Procedure handling variable name resolution
1488+                                * for variables that can only be handled at
1489+                                * runtime. */
1490+    Tcl_ResolveCompiledVarProc *compiledVarResProc;
1491+                               /* Procedure handling variable name resolution
1492+                                * at compile time. */
1493+} Tcl_ResolverInfo;
1494+
1495+/*
1496+ *----------------------------------------------------------------
1497+ * Data structures related to namespaces.
1498+ *----------------------------------------------------------------
1499+ */
1500+
1501+typedef struct Tcl_Ensemble Tcl_Ensemble;
1502+typedef struct NamespacePathEntry NamespacePathEntry;
1503+
1504+/*
1505+ * Special hashtable for variables: this is just a Tcl_HashTable with an nsPtr
1506+ * field added at the end: in this way variables can find their namespace
1507+ * without having to copy a pointer in their struct: they can access it via
1508+ * their hPtr->tablePtr.
1509+ */
1510+
1511+typedef struct TclVarHashTable {
1512+    Tcl_HashTable table;
1513+    struct Namespace *nsPtr;
1514+} TclVarHashTable;
1515+
1516+/*
1517+ * This is for itcl - it likes to search our varTables directly :(
1518+ */
1519+
1520+#define TclVarHashFindVar(tablePtr, key) \
1521+    TclVarHashCreateVar((tablePtr), (key), NULL)
1522+
1523+/*
1524+ * Define this to reduce the amount of space that the average namespace
1525+ * consumes by only allocating the table of child namespaces when necessary.
1526+ * Defining it breaks compatibility for Tcl extensions (e.g., itcl) which
1527+ * reach directly into the Namespace structure.
1528+ */
1529+
1530+#undef BREAK_NAMESPACE_COMPAT
1531+
1532+/*
1533+ * The structure below defines a namespace.
1534+ * Note: the first five fields must match exactly the fields in a
1535+ * Tcl_Namespace structure (see tcl.h). If you change one, be sure to change
1536+ * the other.
1537+ */
1538+
1539+typedef struct Namespace {
1540+    char *name;                        /* The namespace's simple (unqualified) name.
1541+                                * This contains no ::'s. The name of the
1542+                                * global namespace is "" although "::" is an
1543+                                * synonym. */
1544+    char *fullName;            /* The namespace's fully qualified name. This
1545+                                * starts with ::. */
1546+    ClientData clientData;     /* An arbitrary value associated with this
1547+                                * namespace. */
1548+    Tcl_NamespaceDeleteProc *deleteProc;
1549+                               /* Procedure invoked when deleting the
1550+                                * namespace to, e.g., free clientData. */
1551+    struct Namespace *parentPtr;/* Points to the namespace that contains this
1552+                                * one. NULL if this is the global
1553+                                * namespace. */
1554+#ifndef BREAK_NAMESPACE_COMPAT
1555+    Tcl_HashTable childTable;  /* Contains any child namespaces. Indexed by
1556+                                * strings; values have type (Namespace *). */
1557+#else
1558+    Tcl_HashTable *childTablePtr;
1559+                               /* Contains any child namespaces. Indexed by
1560+                                * strings; values have type (Namespace *). If
1561+                                * NULL, there are no children. */
1562+#endif
1563+    long nsId;                 /* Unique id for the namespace. */
1564+    Tcl_Interp *interp;                /* The interpreter containing this
1565+                                * namespace. */
1566+    int flags;                 /* OR-ed combination of the namespace status
1567+                                * flags NS_DYING and NS_DEAD listed below. */
1568+    int activationCount;       /* Number of "activations" or active call
1569+                                * frames for this namespace that are on the
1570+                                * Tcl call stack. The namespace won't be
1571+                                * freed until activationCount becomes zero. */
1572+    int refCount;              /* Count of references by namespaceName
1573+                                * objects. The namespace can't be freed until
1574+                                * refCount becomes zero. */
1575+    Tcl_HashTable cmdTable;    /* Contains all the commands currently
1576+                                * registered in the namespace. Indexed by
1577+                                * strings; values have type (Command *).
1578+                                * Commands imported by Tcl_Import have
1579+                                * Command structures that point (via an
1580+                                * ImportedCmdRef structure) to the Command
1581+                                * structure in the source namespace's command
1582+                                * table. */
1583+    TclVarHashTable varTable;  /* Contains all the (global) variables
1584+                                * currently in this namespace. Indexed by
1585+                                * strings; values have type (Var *). */
1586+    char **exportArrayPtr;     /* Points to an array of string patterns
1587+                                * specifying which commands are exported. A
1588+                                * pattern may include "string match" style
1589+                                * wildcard characters to specify multiple
1590+                                * commands; however, no namespace qualifiers
1591+                                * are allowed. NULL if no export patterns are
1592+                                * registered. */
1593+    int numExportPatterns;     /* Number of export patterns currently
1594+                                * registered using "namespace export". */
1595+    int maxExportPatterns;     /* Mumber of export patterns for which space
1596+                                * is currently allocated. */
1597+    int cmdRefEpoch;           /* Incremented if a newly added command
1598+                                * shadows a command for which this namespace
1599+                                * has already cached a Command* pointer; this
1600+                                * causes all its cached Command* pointers to
1601+                                * be invalidated. */
1602+    int resolverEpoch;         /* Incremented whenever (a) the name
1603+                                * resolution rules change for this namespace
1604+                                * or (b) a newly added command shadows a
1605+                                * command that is compiled to bytecodes. This
1606+                                * invalidates all byte codes compiled in the
1607+                                * namespace, causing the code to be
1608+                                * recompiled under the new rules.*/
1609+    Tcl_ResolveCmdProc *cmdResProc;
1610+                               /* If non-null, this procedure overrides the
1611+                                * usual command resolution mechanism in Tcl.
1612+                                * This procedure is invoked within
1613+                                * Tcl_FindCommand to resolve all command
1614+                                * references within the namespace. */
1615+    Tcl_ResolveVarProc *varResProc;
1616+                               /* If non-null, this procedure overrides the
1617+                                * usual variable resolution mechanism in Tcl.
1618+                                * This procedure is invoked within
1619+                                * Tcl_FindNamespaceVar to resolve all
1620+                                * variable references within the namespace at
1621+                                * runtime. */
1622+    Tcl_ResolveCompiledVarProc *compiledVarResProc;
1623+                               /* If non-null, this procedure overrides the
1624+                                * usual variable resolution mechanism in Tcl.
1625+                                * This procedure is invoked within
1626+                                * LookupCompiledLocal to resolve variable
1627+                                * references within the namespace at compile
1628+                                * time. */
1629+    int exportLookupEpoch;     /* Incremented whenever a command is added to
1630+                                * a namespace, removed from a namespace or
1631+                                * the exports of a namespace are changed.
1632+                                * Allows TIP#112-driven command lists to be
1633+                                * validated efficiently. */
1634+    Tcl_Ensemble *ensembles;   /* List of structures that contain the details
1635+                                * of the ensembles that are implemented on
1636+                                * top of this namespace. */
1637+    Tcl_Obj *unknownHandlerPtr;        /* A script fragment to be used when command
1638+                                * resolution in this namespace fails. TIP
1639+                                * 181. */
1640+    int commandPathLength;     /* The length of the explicit path. */
1641+    NamespacePathEntry *commandPathArray;
1642+                               /* The explicit path of the namespace as an
1643+                                * array. */
1644+    NamespacePathEntry *commandPathSourceList;
1645+                               /* Linked list of path entries that point to
1646+                                * this namespace. */
1647+    Tcl_NamespaceDeleteProc *earlyDeleteProc;
1648+                               /* Just like the deleteProc field (and called
1649+                                * with the same clientData) but called at the
1650+                                * start of the deletion process, so there is
1651+                                * a chance for code to do stuff inside the
1652+                                * namespace before deletion completes. */
1653+} Namespace;
1654+
1655+/*
1656+ * An entry on a namespace's command resolution path.
1657+ */
1658+
1659+struct NamespacePathEntry {
1660+    Namespace *nsPtr;          /* What does this path entry point to? If it
1661+                                * is NULL, this path entry points is
1662+                                * redundant and should be skipped. */
1663+    Namespace *creatorNsPtr;   /* Where does this path entry point from? This
1664+                                * allows for efficient invalidation of
1665+                                * references when the path entry's target
1666+                                * updates its current list of defined
1667+                                * commands. */
1668+    NamespacePathEntry *prevPtr, *nextPtr;
1669+                               /* Linked list pointers or NULL at either end
1670+                                * of the list that hangs off Namespace's
1671+                                * commandPathSourceList field. */
1672+};
1673+
1674+/*
1675+ * Flags used to represent the status of a namespace:
1676+ *
1677+ * NS_DYING -  1 means Tcl_DeleteNamespace has been called to delete the
1678+ *             namespace but there are still active call frames on the Tcl
1679+ *             stack that refer to the namespace. When the last call frame
1680+ *             referring to it has been popped, it's variables and command
1681+ *             will be destroyed and it will be marked "dead" (NS_DEAD). The
1682+ *             namespace can no longer be looked up by name.
1683+ * NS_DEAD -   1 means Tcl_DeleteNamespace has been called to delete the
1684+ *             namespace and no call frames still refer to it. Its variables
1685+ *             and command have already been destroyed. This bit allows the
1686+ *             namespace resolution code to recognize that the namespace is
1687+ *             "deleted". When the last namespaceName object in any byte code
1688+ *             unit that refers to the namespace has been freed (i.e., when
1689+ *             the namespace's refCount is 0), the namespace's storage will
1690+ *             be freed.
1691+ * NS_KILLED - 1 means that TclTeardownNamespace has already been called on
1692+ *             this namespace and it should not be called again [Bug 1355942]
1693+ * NS_SUPPRESS_COMPILATION -
1694+ *             Marks the commands in this namespace for not being compiled,
1695+ *             forcing them to be looked up every time.
1696+ */
1697+
1698+#define NS_DYING       0x01
1699+#define NS_DEAD                0x02
1700+#define NS_KILLED      0x04
1701+#define NS_SUPPRESS_COMPILATION        0x08
1702+
1703+/*
1704+ * Flags passed to TclGetNamespaceForQualName:
1705+ *
1706+ * TCL_GLOBAL_ONLY             - (see tcl.h) Look only in the global ns.
1707+ * TCL_NAMESPACE_ONLY          - (see tcl.h) Look only in the context ns.
1708+ * TCL_CREATE_NS_IF_UNKNOWN    - Create unknown namespaces.
1709+ * TCL_FIND_ONLY_NS            - The name sought is a namespace name.
1710+ */
1711+
1712+#define TCL_CREATE_NS_IF_UNKNOWN       0x800
1713+#define TCL_FIND_ONLY_NS               0x1000
1714+
1715+/*
1716+ * The data cached in an ensemble subcommand's Tcl_Obj rep (reference in
1717+ * otherValuePtr field). This structure is not shared between Tcl_Objs
1718+ * referring to the same subcommand, even where one is a duplicate of another.
1719+ */
1720+
1721+typedef struct {
1722+    Namespace *nsPtr;          /* The namespace backing the ensemble which
1723+                                * this is a subcommand of. */
1724+    int epoch;                 /* Used to confirm when the data in this
1725+                                * really structure matches up with the
1726+                                * ensemble. */
1727+    Tcl_Command token;         /* Reference to the comamnd for which this
1728+                                * structure is a cache of the resolution. */
1729+    char *fullSubcmdName;      /* The full (local) name of the subcommand,
1730+                                * allocated with ckalloc(). */
1731+    Tcl_Obj *realPrefixObj;    /* Object containing the prefix words of the
1732+                                * command that implements this ensemble
1733+                                * subcommand. */
1734+} EnsembleCmdRep;
1735+
1736+/*
1737+ * The client data for an ensemble command. This consists of the table of
1738+ * commands that are actually exported by the namespace, and an epoch counter
1739+ * that, combined with the exportLookupEpoch field of the namespace structure,
1740+ * defines whether the table contains valid data or will need to be recomputed
1741+ * next time the ensemble command is called.
1742+ */
1743+
1744+typedef struct EnsembleConfig {
1745+    Namespace *nsPtr;          /* The namspace backing this ensemble up. */
1746+    Tcl_Command token;         /* The token for the command that provides
1747+                                * ensemble support for the namespace, or NULL
1748+                                * if the command has been deleted (or never
1749+                                * existed; the global namespace never has an
1750+                                * ensemble command.) */
1751+    int epoch;                 /* The epoch at which this ensemble's table of
1752+                                * exported commands is valid. */
1753+    char **subcommandArrayPtr; /* Array of ensemble subcommand names. At all
1754+                                * consistent points, this will have the same
1755+                                * number of entries as there are entries in
1756+                                * the subcommandTable hash. */
1757+    Tcl_HashTable subcommandTable;
1758+                               /* Hash table of ensemble subcommand names,
1759+                                * which are its keys so this also provides
1760+                                * the storage management for those subcommand
1761+                                * names. The contents of the entry values are
1762+                                * object version the prefix lists to use when
1763+                                * substituting for the command/subcommand to
1764+                                * build the ensemble implementation command.
1765+                                * Has to be stored here as well as in
1766+                                * subcommandDict because that field is NULL
1767+                                * when we are deriving the ensemble from the
1768+                                * namespace exports list. FUTURE WORK: use
1769+                                * object hash table here. */
1770+    struct EnsembleConfig *next;/* The next ensemble in the linked list of
1771+                                * ensembles associated with a namespace. If
1772+                                * this field points to this ensemble, the
1773+                                * structure has already been unlinked from
1774+                                * all lists, and cannot be found by scanning
1775+                                * the list from the namespace's ensemble
1776+                                * field. */
1777+    int flags;                 /* ORed combo of TCL_ENSEMBLE_PREFIX,
1778+                                * ENSEMBLE_DEAD and ENSEMBLE_COMPILE. */
1779+
1780+    /* OBJECT FIELDS FOR ENSEMBLE CONFIGURATION */
1781+
1782+    Tcl_Obj *subcommandDict;   /* Dictionary providing mapping from
1783+                                * subcommands to their implementing command
1784+                                * prefixes, or NULL if we are to build the
1785+                                * map automatically from the namespace
1786+                                * exports. */
1787+    Tcl_Obj *subcmdList;       /* List of commands that this ensemble
1788+                                * actually provides, and whose implementation
1789+                                * will be built using the subcommandDict (if
1790+                                * present and defined) and by simple mapping
1791+                                * to the namespace otherwise. If NULL,
1792+                                * indicates that we are using the (dynamic)
1793+                                * list of currently exported commands. */
1794+    Tcl_Obj *unknownHandler;   /* Script prefix used to handle the case when
1795+                                * no match is found (according to the rule
1796+                                * defined by flag bit TCL_ENSEMBLE_PREFIX) or
1797+                                * NULL to use the default error-generating
1798+                                * behaviour. The script execution gets all
1799+                                * the arguments to the ensemble command
1800+                                * (including objv[0]) and will have the
1801+                                * results passed directly back to the caller
1802+                                * (including the error code) unless the code
1803+                                * is TCL_CONTINUE in which case the
1804+                                * subcommand will be reparsed by the ensemble
1805+                                * core, presumably because the ensemble
1806+                                * itself has been updated. */
1807+    Tcl_Obj *parameterList;    /* List of ensemble parameter names. */
1808+    int numParameters;         /* Cached number of parameters. This is either
1809+                                * 0 (if the parameterList field is NULL) or
1810+                                * the length of the list in the parameterList
1811+                                * field. */
1812+} EnsembleConfig;
1813+
1814+/*
1815+ * Various bits for the EnsembleConfig.flags field.
1816+ */
1817+
1818+#define ENSEMBLE_DEAD  0x1     /* Flag value to say that the ensemble is dead
1819+                                * and on its way out. */
1820+#define ENSEMBLE_COMPILE 0x4   /* Flag to enable bytecode compilation of an
1821+                                * ensemble. */
1822+
1823+/*
1824+ *----------------------------------------------------------------
1825+ * Data structures related to variables. These are used primarily in tclVar.c
1826+ *----------------------------------------------------------------
1827+ */
1828+
1829+/*
1830+ * The following structure defines a variable trace, which is used to invoke a
1831+ * specific C procedure whenever certain operations are performed on a
1832+ * variable.
1833+ */
1834+
1835+typedef struct VarTrace {
1836+    Tcl_VarTraceProc *traceProc;/* Procedure to call when operations given by
1837+                                * flags are performed on variable. */
1838+    ClientData clientData;     /* Argument to pass to proc. */
1839+    int flags;                 /* What events the trace procedure is
1840+                                * interested in: OR-ed combination of
1841+                                * TCL_TRACE_READS, TCL_TRACE_WRITES,
1842+                                * TCL_TRACE_UNSETS and TCL_TRACE_ARRAY. */
1843+    struct VarTrace *nextPtr;  /* Next in list of traces associated with a
1844+                                * particular variable. */
1845+} VarTrace;
1846+
1847+/*
1848+ * The following structure defines a command trace, which is used to invoke a
1849+ * specific C procedure whenever certain operations are performed on a
1850+ * command.
1851+ */
1852+
1853+typedef struct CommandTrace {
1854+    Tcl_CommandTraceProc *traceProc;
1855+                               /* Procedure to call when operations given by
1856+                                * flags are performed on command. */
1857+    ClientData clientData;     /* Argument to pass to proc. */
1858+    int flags;                 /* What events the trace procedure is
1859+                                * interested in: OR-ed combination of
1860+                                * TCL_TRACE_RENAME, TCL_TRACE_DELETE. */
1861+    struct CommandTrace *nextPtr;
1862+                               /* Next in list of traces associated with a
1863+                                * particular command. */
1864+    int refCount;              /* Used to ensure this structure is not
1865+                                * deleted too early. Keeps track of how many
1866+                                * pieces of code have a pointer to this
1867+                                * structure. */
1868+} CommandTrace;
1869+
1870+/*
1871+ * When a command trace is active (i.e. its associated procedure is executing)
1872+ * one of the following structures is linked into a list associated with the
1873+ * command's interpreter. The information in the structure is needed in order
1874+ * for Tcl to behave reasonably if traces are deleted while traces are active.
1875+ */
1876+
1877+typedef struct ActiveCommandTrace {
1878+    struct Command *cmdPtr;    /* Command that's being traced. */
1879+    struct ActiveCommandTrace *nextPtr;
1880+                               /* Next in list of all active command traces
1881+                                * for the interpreter, or NULL if no more. */
1882+    CommandTrace *nextTracePtr;        /* Next trace to check after current trace
1883+                                * procedure returns; if this trace gets
1884+                                * deleted, must update pointer to avoid using
1885+                                * free'd memory. */
1886+    int reverseScan;           /* Boolean set true when traces are scanning
1887+                                * in reverse order. */
1888+} ActiveCommandTrace;
1889+
1890+/*
1891+ * When a variable trace is active (i.e. its associated procedure is
1892+ * executing) one of the following structures is linked into a list associated
1893+ * with the variable's interpreter. The information in the structure is needed
1894+ * in order for Tcl to behave reasonably if traces are deleted while traces
1895+ * are active.
1896+ */
1897+
1898+typedef struct ActiveVarTrace {
1899+    struct Var *varPtr;                /* Variable that's being traced. */
1900+    struct ActiveVarTrace *nextPtr;
1901+                               /* Next in list of all active variable traces
1902+                                * for the interpreter, or NULL if no more. */
1903+    VarTrace *nextTracePtr;    /* Next trace to check after current trace
1904+                                * procedure returns; if this trace gets
1905+                                * deleted, must update pointer to avoid using
1906+                                * free'd memory. */
1907+} ActiveVarTrace;
1908+
1909+/*
1910+ * The following structure describes an enumerative search in progress on an
1911+ * array variable; this are invoked with options to the "array" command.
1912+ */
1913+
1914+typedef struct ArraySearch {
1915+    int id;                    /* Integer id used to distinguish among
1916+                                * multiple concurrent searches for the same
1917+                                * array. */
1918+    struct Var *varPtr;                /* Pointer to array variable that's being
1919+                                * searched. */
1920+    Tcl_HashSearch search;     /* Info kept by the hash module about progress
1921+                                * through the array. */
1922+    Tcl_HashEntry *nextEntry;  /* Non-null means this is the next element to
1923+                                * be enumerated (it's leftover from the
1924+                                * Tcl_FirstHashEntry call or from an "array
1925+                                * anymore" command). NULL means must call
1926+                                * Tcl_NextHashEntry to get value to
1927+                                * return. */
1928+    struct ArraySearch *nextPtr;/* Next in list of all active searches for
1929+                                * this variable, or NULL if this is the last
1930+                                * one. */
1931+} ArraySearch;
1932+
1933+/*
1934+ * The structure below defines a variable, which associates a string name with
1935+ * a Tcl_Obj value. These structures are kept in procedure call frames (for
1936+ * local variables recognized by the compiler) or in the heap (for global
1937+ * variables and any variable not known to the compiler). For each Var
1938+ * structure in the heap, a hash table entry holds the variable name and a
1939+ * pointer to the Var structure.
1940+ */
1941+
1942+typedef struct Var {
1943+    int flags;                 /* Miscellaneous bits of information about
1944+                                * variable. See below for definitions. */
1945+    union {
1946+       Tcl_Obj *objPtr;        /* The variable's object value. Used for
1947+                                * scalar variables and array elements. */
1948+       TclVarHashTable *tablePtr;/* For array variables, this points to
1949+                                * information about the hash table used to
1950+                                * implement the associative array. Points to
1951+                                * ckalloc-ed data. */
1952+       struct Var *linkPtr;    /* If this is a global variable being referred
1953+                                * to in a procedure, or a variable created by
1954+                                * "upvar", this field points to the
1955+                                * referenced variable's Var struct. */
1956+    } value;
1957+} Var;
1958+
1959+typedef struct VarInHash {
1960+    Var var;
1961+    int refCount;              /* Counts number of active uses of this
1962+                                * variable: 1 for the entry in the hash
1963+                                * table, 1 for each additional variable whose
1964+                                * linkPtr points here, 1 for each nested
1965+                                * trace active on variable, and 1 if the
1966+                                * variable is a namespace variable. This
1967+                                * record can't be deleted until refCount
1968+                                * becomes 0. */
1969+    Tcl_HashEntry entry;       /* The hash table entry that refers to this
1970+                                * variable. This is used to find the name of
1971+                                * the variable and to delete it from its
1972+                                * hashtable if it is no longer needed. It
1973+                                * also holds the variable's name. */
1974+} VarInHash;
1975+
1976+/*
1977+ * Flag bits for variables. The first two (VAR_ARRAY and VAR_LINK) are
1978+ * mutually exclusive and give the "type" of the variable. If none is set,
1979+ * this is a scalar variable.
1980+ *
1981+ * VAR_ARRAY -                 1 means this is an array variable rather than
1982+ *                             a scalar variable or link. The "tablePtr"
1983+ *                             field points to the array's hashtable for its
1984+ *                             elements.
1985+ * VAR_LINK -                  1 means this Var structure contains a pointer
1986+ *                             to another Var structure that either has the
1987+ *                             real value or is itself another VAR_LINK
1988+ *                             pointer. Variables like this come about
1989+ *                             through "upvar" and "global" commands, or
1990+ *                             through references to variables in enclosing
1991+ *                             namespaces.
1992+ *
1993+ * Flags that indicate the type and status of storage; none is set for
1994+ * compiled local variables (Var structs).
1995+ *
1996+ * VAR_IN_HASHTABLE -          1 means this variable is in a hashtable and
1997+ *                             the Var structure is malloced. 0 if it is a
1998+ *                             local variable that was assigned a slot in a
1999+ *                             procedure frame by the compiler so the Var
2000+ *                             storage is part of the call frame.
2001+ * VAR_DEAD_HASH               1 means that this var's entry in the hashtable
2002+ *                             has already been deleted.
2003+ * VAR_ARRAY_ELEMENT -         1 means that this variable is an array
2004+ *                             element, so it is not legal for it to be an
2005+ *                             array itself (the VAR_ARRAY flag had better
2006+ *                             not be set).
2007+ * VAR_NAMESPACE_VAR -         1 means that this variable was declared as a
2008+ *                             namespace variable. This flag ensures it
2009+ *                             persists until its namespace is destroyed or
2010+ *                             until the variable is unset; it will persist
2011+ *                             even if it has not been initialized and is
2012+ *                             marked undefined. The variable's refCount is
2013+ *                             incremented to reflect the "reference" from
2014+ *                             its namespace.
2015+ *
2016+ * Flag values relating to the variable's trace and search status.
2017+ *
2018+ * VAR_TRACED_READ
2019+ * VAR_TRACED_WRITE
2020+ * VAR_TRACED_UNSET
2021+ * VAR_TRACED_ARRAY
2022+ * VAR_TRACE_ACTIVE -          1 means that trace processing is currently
2023+ *                             underway for a read or write access, so new
2024+ *                             read or write accesses should not cause trace
2025+ *                             procedures to be called and the variable can't
2026+ *                             be deleted.
2027+ * VAR_SEARCH_ACTIVE
2028+ *
2029+ * The following additional flags are used with the CompiledLocal type defined
2030+ * below:
2031+ *
2032+ * VAR_ARGUMENT -              1 means that this variable holds a procedure
2033+ *                             argument.
2034+ * VAR_TEMPORARY -             1 if the local variable is an anonymous
2035+ *                             temporary variable. Temporaries have a NULL
2036+ *                             name.
2037+ * VAR_RESOLVED -              1 if name resolution has been done for this
2038+ *                             variable.
2039+ * VAR_IS_ARGS                 1 if this variable is the last argument and is
2040+ *                             named "args".
2041+ */
2042+
2043+/*
2044+ * FLAGS RENUMBERED: everything breaks already, make things simpler.
2045+ *
2046+ * IMPORTANT: skip the values 0x10, 0x20, 0x40, 0x800 corresponding to
2047+ * TCL_TRACE_(READS/WRITES/UNSETS/ARRAY): makes code simpler in tclTrace.c
2048+ *
2049+ * Keep the flag values for VAR_ARGUMENT and VAR_TEMPORARY so that old values
2050+ * in precompiled scripts keep working.
2051+ */
2052+
2053+/* Type of value (0 is scalar) */
2054+#define VAR_ARRAY              0x1
2055+#define VAR_LINK               0x2
2056+
2057+/* Type of storage (0 is compiled local) */
2058+#define VAR_IN_HASHTABLE       0x4
2059+#define VAR_DEAD_HASH          0x8
2060+#define VAR_ARRAY_ELEMENT      0x1000
2061+#define VAR_NAMESPACE_VAR      0x80    /* KEEP OLD VALUE for Itcl */
2062+
2063+#define VAR_ALL_HASH \
2064+       (VAR_IN_HASHTABLE|VAR_DEAD_HASH|VAR_NAMESPACE_VAR|VAR_ARRAY_ELEMENT)
2065+
2066+/* Trace and search state. */
2067+
2068+#define VAR_TRACED_READ                0x10    /* TCL_TRACE_READS */
2069+#define VAR_TRACED_WRITE       0x20    /* TCL_TRACE_WRITES */
2070+#define VAR_TRACED_UNSET       0x40    /* TCL_TRACE_UNSETS */
2071+#define VAR_TRACED_ARRAY       0x800   /* TCL_TRACE_ARRAY */
2072+#define VAR_TRACE_ACTIVE       0x2000
2073+#define VAR_SEARCH_ACTIVE      0x4000
2074+#define VAR_ALL_TRACES \
2075+       (VAR_TRACED_READ|VAR_TRACED_WRITE|VAR_TRACED_ARRAY|VAR_TRACED_UNSET)
2076+
2077+/* Special handling on initialisation (only CompiledLocal). */
2078+#define VAR_ARGUMENT           0x100   /* KEEP OLD VALUE! See tclProc.c */
2079+#define VAR_TEMPORARY          0x200   /* KEEP OLD VALUE! See tclProc.c */
2080+#define VAR_IS_ARGS            0x400
2081+#define VAR_RESOLVED           0x8000
2082+
2083+/*
2084+ * Macros to ensure that various flag bits are set properly for variables.
2085+ * The ANSI C "prototypes" for these macros are:
2086+ *
2087+ * MODULE_SCOPE void   TclSetVarScalar(Var *varPtr);
2088+ * MODULE_SCOPE void   TclSetVarArray(Var *varPtr);
2089+ * MODULE_SCOPE void   TclSetVarLink(Var *varPtr);
2090+ * MODULE_SCOPE void   TclSetVarArrayElement(Var *varPtr);
2091+ * MODULE_SCOPE void   TclSetVarUndefined(Var *varPtr);
2092+ * MODULE_SCOPE void   TclClearVarUndefined(Var *varPtr);
2093+ */
2094+
2095+#define TclSetVarScalar(varPtr) \
2096+    (varPtr)->flags &= ~(VAR_ARRAY|VAR_LINK)
2097+
2098+#define TclSetVarArray(varPtr) \
2099+    (varPtr)->flags = ((varPtr)->flags & ~VAR_LINK) | VAR_ARRAY
2100+
2101+#define TclSetVarLink(varPtr) \
2102+    (varPtr)->flags = ((varPtr)->flags & ~VAR_ARRAY) | VAR_LINK
2103+
2104+#define TclSetVarArrayElement(varPtr) \
2105+    (varPtr)->flags = ((varPtr)->flags & ~VAR_ARRAY) | VAR_ARRAY_ELEMENT
2106+
2107+#define TclSetVarUndefined(varPtr) \
2108+    (varPtr)->flags &= ~(VAR_ARRAY|VAR_LINK);\
2109+    (varPtr)->value.objPtr = NULL
2110+
2111+#define TclClearVarUndefined(varPtr)
2112+
2113+#define TclSetVarTraceActive(varPtr) \
2114+    (varPtr)->flags |= VAR_TRACE_ACTIVE
2115+
2116+#define TclClearVarTraceActive(varPtr) \
2117+    (varPtr)->flags &= ~VAR_TRACE_ACTIVE
2118+
2119+#define TclSetVarNamespaceVar(varPtr) \
2120+    if (!TclIsVarNamespaceVar(varPtr)) {\
2121+       (varPtr)->flags |= VAR_NAMESPACE_VAR;\
2122+       if (TclIsVarInHash(varPtr)) {\
2123+           ((VarInHash *)(varPtr))->refCount++;\
2124+       }\
2125+    }
2126+
2127+#define TclClearVarNamespaceVar(varPtr) \
2128+    if (TclIsVarNamespaceVar(varPtr)) {\
2129+       (varPtr)->flags &= ~VAR_NAMESPACE_VAR;\
2130+       if (TclIsVarInHash(varPtr)) {\
2131+           ((VarInHash *)(varPtr))->refCount--;\
2132+       }\
2133+    }
2134+
2135+/*
2136+ * Macros to read various flag bits of variables.
2137+ * The ANSI C "prototypes" for these macros are:
2138+ *
2139+ * MODULE_SCOPE int    TclIsVarScalar(Var *varPtr);
2140+ * MODULE_SCOPE int    TclIsVarLink(Var *varPtr);
2141+ * MODULE_SCOPE int    TclIsVarArray(Var *varPtr);
2142+ * MODULE_SCOPE int    TclIsVarUndefined(Var *varPtr);
2143+ * MODULE_SCOPE int    TclIsVarArrayElement(Var *varPtr);
2144+ * MODULE_SCOPE int    TclIsVarTemporary(Var *varPtr);
2145+ * MODULE_SCOPE int    TclIsVarArgument(Var *varPtr);
2146+ * MODULE_SCOPE int    TclIsVarResolved(Var *varPtr);
2147+ */
2148+
2149+#define TclIsVarScalar(varPtr) \
2150+    !((varPtr)->flags & (VAR_ARRAY|VAR_LINK))
2151+
2152+#define TclIsVarLink(varPtr) \
2153+    ((varPtr)->flags & VAR_LINK)
2154+
2155+#define TclIsVarArray(varPtr) \
2156+    ((varPtr)->flags & VAR_ARRAY)
2157+
2158+#define TclIsVarUndefined(varPtr) \
2159+    ((varPtr)->value.objPtr == NULL)
2160+
2161+#define TclIsVarArrayElement(varPtr) \
2162+    ((varPtr)->flags & VAR_ARRAY_ELEMENT)
2163+
2164+#define TclIsVarNamespaceVar(varPtr) \
2165+    ((varPtr)->flags & VAR_NAMESPACE_VAR)
2166+
2167+#define TclIsVarTemporary(varPtr) \
2168+    ((varPtr)->flags & VAR_TEMPORARY)
2169+
2170+#define TclIsVarArgument(varPtr) \
2171+    ((varPtr)->flags & VAR_ARGUMENT)
2172+
2173+#define TclIsVarResolved(varPtr) \
2174+    ((varPtr)->flags & VAR_RESOLVED)
2175+
2176+#define TclIsVarTraceActive(varPtr) \
2177+    ((varPtr)->flags & VAR_TRACE_ACTIVE)
2178+
2179+#define TclIsVarTraced(varPtr) \
2180+    ((varPtr)->flags & VAR_ALL_TRACES)
2181+
2182+#define TclIsVarInHash(varPtr) \
2183+    ((varPtr)->flags & VAR_IN_HASHTABLE)
2184+
2185+#define TclIsVarDeadHash(varPtr) \
2186+    ((varPtr)->flags & VAR_DEAD_HASH)
2187+
2188+#define TclGetVarNsPtr(varPtr) \
2189+    (TclIsVarInHash(varPtr) \
2190+       ? ((TclVarHashTable *) ((((VarInHash *) (varPtr))->entry.tablePtr)))->nsPtr \
2191+       : NULL)
2192+
2193+#define VarHashRefCount(varPtr) \
2194+    ((VarInHash *) (varPtr))->refCount
2195+
2196+/*
2197+ * Macros for direct variable access by TEBC.
2198+ */
2199+
2200+#define TclIsVarDirectReadable(varPtr) \
2201+    (   !((varPtr)->flags & (VAR_ARRAY|VAR_LINK|VAR_TRACED_READ)) \
2202+    &&  (varPtr)->value.objPtr)
2203+
2204+#define TclIsVarDirectWritable(varPtr) \
2205+    !((varPtr)->flags & (VAR_ARRAY|VAR_LINK|VAR_TRACED_WRITE|VAR_DEAD_HASH))
2206+
2207+#define TclIsVarDirectUnsettable(varPtr) \
2208+    !((varPtr)->flags & (VAR_ARRAY|VAR_LINK|VAR_TRACED_READ|VAR_TRACED_WRITE|VAR_TRACED_UNSET|VAR_DEAD_HASH))
2209+
2210+#define TclIsVarDirectModifyable(varPtr) \
2211+    (   !((varPtr)->flags & (VAR_ARRAY|VAR_LINK|VAR_TRACED_READ|VAR_TRACED_WRITE)) \
2212+    &&  (varPtr)->value.objPtr)
2213+
2214+#define TclIsVarDirectReadable2(varPtr, arrayPtr) \
2215+    (TclIsVarDirectReadable(varPtr) &&\
2216+       (!(arrayPtr) || !((arrayPtr)->flags & VAR_TRACED_READ)))
2217+
2218+#define TclIsVarDirectWritable2(varPtr, arrayPtr) \
2219+    (TclIsVarDirectWritable(varPtr) &&\
2220+       (!(arrayPtr) || !((arrayPtr)->flags & VAR_TRACED_WRITE)))
2221+
2222+#define TclIsVarDirectModifyable2(varPtr, arrayPtr) \
2223+    (TclIsVarDirectModifyable(varPtr) &&\
2224+       (!(arrayPtr) || !((arrayPtr)->flags & (VAR_TRACED_READ|VAR_TRACED_WRITE))))
2225+
2226+/*
2227+ *----------------------------------------------------------------
2228+ * Data structures related to procedures. These are used primarily in
2229+ * tclProc.c, tclCompile.c, and tclExecute.c.
2230+ *----------------------------------------------------------------
2231+ */
2232+
2233+/*
2234+ * Forward declaration to prevent an error when the forward reference to
2235+ * Command is encountered in the Proc and ImportRef types declared below.
2236+ */
2237+
2238+struct Command;
2239+
2240+/*
2241+ * The variable-length structure below describes a local variable of a
2242+ * procedure that was recognized by the compiler. These variables have a name,
2243+ * an element in the array of compiler-assigned local variables in the
2244+ * procedure's call frame, and various other items of information. If the
2245+ * local variable is a formal argument, it may also have a default value. The
2246+ * compiler can't recognize local variables whose names are expressions (these
2247+ * names are only known at runtime when the expressions are evaluated) or
2248+ * local variables that are created as a result of an "upvar" or "uplevel"
2249+ * command. These other local variables are kept separately in a hash table in
2250+ * the call frame.
2251+ */
2252+
2253+typedef struct CompiledLocal {
2254+    struct CompiledLocal *nextPtr;
2255+                               /* Next compiler-recognized local variable for
2256+                                * this procedure, or NULL if this is the last
2257+                                * local. */
2258+    int nameLength;            /* The number of characters in local
2259+                                * variable's name. Used to speed up variable
2260+                                * lookups. */
2261+    int frameIndex;            /* Index in the array of compiler-assigned
2262+                                * variables in the procedure call frame. */
2263+    int flags;                 /* Flag bits for the local variable. Same as
2264+                                * the flags for the Var structure above,
2265+                                * although only VAR_ARGUMENT, VAR_TEMPORARY,
2266+                                * and VAR_RESOLVED make sense. */
2267+    Tcl_Obj *defValuePtr;      /* Pointer to the default value of an
2268+                                * argument, if any. NULL if not an argument
2269+                                * or, if an argument, no default value. */
2270+    Tcl_ResolvedVarInfo *resolveInfo;
2271+                               /* Customized variable resolution info
2272+                                * supplied by the Tcl_ResolveCompiledVarProc
2273+                                * associated with a namespace. Each variable
2274+                                * is marked by a unique ClientData tag during
2275+                                * compilation, and that same tag is used to
2276+                                * find the variable at runtime. */
2277+    char name[1];              /* Name of the local variable starts here. If
2278+                                * the name is NULL, this will just be '\0'.
2279+                                * The actual size of this field will be large
2280+                                * enough to hold the name. MUST BE THE LAST
2281+                                * FIELD IN THE STRUCTURE! */
2282+} CompiledLocal;
2283+
2284+/*
2285+ * The structure below defines a command procedure, which consists of a
2286+ * collection of Tcl commands plus information about arguments and other local
2287+ * variables recognized at compile time.
2288+ */
2289+
2290+typedef struct Proc {
2291+    struct Interp *iPtr;       /* Interpreter for which this command is
2292+                                * defined. */
2293+    int refCount;              /* Reference count: 1 if still present in
2294+                                * command table plus 1 for each call to the
2295+                                * procedure that is currently active. This
2296+                                * structure can be freed when refCount
2297+                                * becomes zero. */
2298+    struct Command *cmdPtr;    /* Points to the Command structure for this
2299+                                * procedure. This is used to get the
2300+                                * namespace in which to execute the
2301+                                * procedure. */
2302+    Tcl_Obj *bodyPtr;          /* Points to the ByteCode object for
2303+                                * procedure's body command. */
2304+    int numArgs;               /* Number of formal parameters. */
2305+    int numCompiledLocals;     /* Count of local variables recognized by the
2306+                                * compiler including arguments and
2307+                                * temporaries. */
2308+    CompiledLocal *firstLocalPtr;
2309+                               /* Pointer to first of the procedure's
2310+                                * compiler-allocated local variables, or NULL
2311+                                * if none. The first numArgs entries in this
2312+                                * list describe the procedure's formal
2313+                                * arguments. */
2314+    CompiledLocal *lastLocalPtr;/* Pointer to the last allocated local
2315+                                * variable or NULL if none. This has frame
2316+                                * index (numCompiledLocals-1). */
2317+} Proc;
2318+
2319+/*
2320+ * The type of functions called to process errors found during the execution
2321+ * of a procedure (or lambda term or ...).
2322+ */
2323+
2324+typedef void (ProcErrorProc)(Tcl_Interp *interp, Tcl_Obj *procNameObj);
2325+
2326+/*
2327+ * The structure below defines a command trace. This is used to allow Tcl
2328+ * clients to find out whenever a command is about to be executed.
2329+ */
2330+
2331+typedef struct Trace {
2332+    int level;                 /* Only trace commands at nesting level less
2333+                                * than or equal to this. */
2334+    Tcl_CmdObjTraceProc *proc; /* Procedure to call to trace command. */
2335+    ClientData clientData;     /* Arbitrary value to pass to proc. */
2336+    struct Trace *nextPtr;     /* Next in list of traces for this interp. */
2337+    int flags;                 /* Flags governing the trace - see
2338+                                * Tcl_CreateObjTrace for details. */
2339+    Tcl_CmdObjTraceDeleteProc *delProc;
2340+                               /* Procedure to call when trace is deleted. */
2341+} Trace;
2342+
2343+/*
2344+ * When an interpreter trace is active (i.e. its associated procedure is
2345+ * executing), one of the following structures is linked into a list
2346+ * associated with the interpreter. The information in the structure is needed
2347+ * in order for Tcl to behave reasonably if traces are deleted while traces
2348+ * are active.
2349+ */
2350+
2351+typedef struct ActiveInterpTrace {
2352+    struct ActiveInterpTrace *nextPtr;
2353+                               /* Next in list of all active command traces
2354+                                * for the interpreter, or NULL if no more. */
2355+    Trace *nextTracePtr;       /* Next trace to check after current trace
2356+                                * procedure returns; if this trace gets
2357+                                * deleted, must update pointer to avoid using
2358+                                * free'd memory. */
2359+    int reverseScan;           /* Boolean set true when traces are scanning
2360+                                * in reverse order. */
2361+} ActiveInterpTrace;
2362+
2363+/*
2364+ * Flag values designating types of execution traces. See tclTrace.c for
2365+ * related flag values.
2366+ *
2367+ * TCL_TRACE_ENTER_EXEC                - triggers enter/enterstep traces.
2368+ *                             - passed to Tcl_CreateObjTrace to set up
2369+ *                               "enterstep" traces.
2370+ * TCL_TRACE_LEAVE_EXEC                - triggers leave/leavestep traces.
2371+ *                             - passed to Tcl_CreateObjTrace to set up
2372+ *                               "leavestep" traces.
2373+ */
2374+
2375+#define TCL_TRACE_ENTER_EXEC   1
2376+#define TCL_TRACE_LEAVE_EXEC   2
2377+
2378+/*
2379+ * The structure below defines an entry in the assocData hash table which is
2380+ * associated with an interpreter. The entry contains a pointer to a function
2381+ * to call when the interpreter is deleted, and a pointer to a user-defined
2382+ * piece of data.
2383+ */
2384+
2385+typedef struct AssocData {
2386+    Tcl_InterpDeleteProc *proc;        /* Proc to call when deleting. */
2387+    ClientData clientData;     /* Value to pass to proc. */
2388+} AssocData;
2389+
2390+/*
2391+ * The structure below defines a call frame. A call frame defines a naming
2392+ * context for a procedure call: its local naming scope (for local variables)
2393+ * and its global naming scope (a namespace, perhaps the global :: namespace).
2394+ * A call frame can also define the naming context for a namespace eval or
2395+ * namespace inscope command: the namespace in which the command's code should
2396+ * execute. The Tcl_CallFrame structures exist only while procedures or
2397+ * namespace eval/inscope's are being executed, and provide a kind of Tcl call
2398+ * stack.
2399+ *
2400+ * WARNING!! The structure definition must be kept consistent with the
2401+ * Tcl_CallFrame structure in tcl.h. If you change one, change the other.
2402+ */
2403+
2404+/*
2405+ * Will be grown to contain: pointers to the varnames (allocated at the end),
2406+ * plus the init values for each variable (suitable to be memcopied on init)
2407+ */
2408+
2409+typedef struct LocalCache {
2410+    int refCount;
2411+    int numVars;
2412+    Tcl_Obj *varName0;
2413+} LocalCache;
2414+
2415+#define localName(framePtr, i) \
2416+    ((&((framePtr)->localCachePtr->varName0))[(i)])
2417+
2418+MODULE_SCOPE void      TclFreeLocalCache(Tcl_Interp *interp,
2419+                           LocalCache *localCachePtr);
2420+
2421+typedef struct CallFrame {
2422+    Namespace *nsPtr;          /* Points to the namespace used to resolve
2423+                                * commands and global variables. */
2424+    int isProcCallFrame;       /* If 0, the frame was pushed to execute a
2425+                                * namespace command and var references are
2426+                                * treated as references to namespace vars;
2427+                                * varTablePtr and compiledLocals are ignored.
2428+                                * If FRAME_IS_PROC is set, the frame was
2429+                                * pushed to execute a Tcl procedure and may
2430+                                * have local vars. */
2431+    int objc;                  /* This and objv below describe the arguments
2432+                                * for this procedure call. */
2433+    Tcl_Obj *const *objv;      /* Array of argument objects. */
2434+    struct CallFrame *callerPtr;
2435+                               /* Value of interp->framePtr when this
2436+                                * procedure was invoked (i.e. next higher in
2437+                                * stack of all active procedures). */
2438+    struct CallFrame *callerVarPtr;
2439+                               /* Value of interp->varFramePtr when this
2440+                                * procedure was invoked (i.e. determines
2441+                                * variable scoping within caller). Same as
2442+                                * callerPtr unless an "uplevel" command or
2443+                                * something equivalent was active in the
2444+                                * caller). */
2445+    int level;                 /* Level of this procedure, for "uplevel"
2446+                                * purposes (i.e. corresponds to nesting of
2447+                                * callerVarPtr's, not callerPtr's). 1 for
2448+                                * outermost procedure, 0 for top-level. */
2449+    Proc *procPtr;             /* Points to the structure defining the called
2450+                                * procedure. Used to get information such as
2451+                                * the number of compiled local variables
2452+                                * (local variables assigned entries ["slots"]
2453+                                * in the compiledLocals array below). */
2454+    TclVarHashTable *varTablePtr;
2455+                               /* Hash table containing local variables not
2456+                                * recognized by the compiler, or created at
2457+                                * execution time through, e.g., upvar.
2458+                                * Initially NULL and created if needed. */
2459+    int numCompiledLocals;     /* Count of local variables recognized by the
2460+                                * compiler including arguments. */
2461+    Var *compiledLocals;       /* Points to the array of local variables
2462+                                * recognized by the compiler. The compiler
2463+                                * emits code that refers to these variables
2464+                                * using an index into this array. */
2465+    ClientData clientData;     /* Pointer to some context that is used by
2466+                                * object systems. The meaning of the contents
2467+                                * of this field is defined by the code that
2468+                                * sets it, and it should only ever be set by
2469+                                * the code that is pushing the frame. In that
2470+                                * case, the code that sets it should also
2471+                                * have some means of discovering what the
2472+                                * meaning of the value is, which we do not
2473+                                * specify. */
2474+    LocalCache *localCachePtr;
2475+    struct NRE_callback *tailcallPtr;
2476+                               /* NULL if no tailcall is scheduled */
2477+} CallFrame;
2478+
2479+#define FRAME_IS_PROC  0x1
2480+#define FRAME_IS_LAMBDA 0x2
2481+#define FRAME_IS_METHOD        0x4     /* The frame is a method body, and the frame's
2482+                                * clientData field contains a CallContext
2483+                                * reference. Part of TIP#257. */
2484+#define FRAME_IS_OO_DEFINE 0x8 /* The frame is part of the inside workings of
2485+                                * the [oo::define] command; the clientData
2486+                                * field contains an Object reference that has
2487+                                * been confirmed to refer to a class. Part of
2488+                                * TIP#257. */
2489+
2490+/*
2491+ * TIP #280
2492+ * The structure below defines a command frame. A command frame provides
2493+ * location information for all commands executing a tcl script (source, eval,
2494+ * uplevel, procedure bodies, ...). The runtime structure essentially contains
2495+ * the stack trace as it would be if the currently executing command were to
2496+ * throw an error.
2497+ *
2498+ * For commands where it makes sense it refers to the associated CallFrame as
2499+ * well.
2500+ *
2501+ * The structures are chained in a single list, with the top of the stack
2502+ * anchored in the Interp structure.
2503+ *
2504+ * Instances can be allocated on the C stack, or the heap, the former making
2505+ * cleanup a bit simpler.
2506+ */
2507+
2508+typedef struct CmdFrame {
2509+    /*
2510+     * General data. Always available.
2511+     */
2512+
2513+    int type;                  /* Values see below. */
2514+    int level;                 /* Number of frames in stack, prevent O(n)
2515+                                * scan of list. */
2516+    int *line;                 /* Lines the words of the command start on. */
2517+    int nline;
2518+    CallFrame *framePtr;       /* Procedure activation record, may be
2519+                                * NULL. */
2520+    struct CmdFrame *nextPtr;  /* Link to calling frame. */
2521+    /*
2522+     * Data needed for Eval vs TEBC
2523+     *
2524+     * EXECUTION CONTEXTS and usage of CmdFrame
2525+     *
2526+     * Field     TEBC            EvalEx          EvalObjEx
2527+     * =======   ====            ======          =========
2528+     * level     yes             yes             yes
2529+     * type      BC/PREBC        SRC/EVAL        EVAL_LIST
2530+     * line0     yes             yes             yes
2531+     * framePtr          yes             yes             yes
2532+     * =======   ====            ======          =========
2533+     *
2534+     * =======   ====            ======          ========= union data
2535+     * line1     -               yes             -
2536+     * line3     -               yes             -
2537+     * path      -               yes             -
2538+     * -------   ----            ------          ---------
2539+     * codePtr   yes             -               -
2540+     * pc        yes             -               -
2541+     * =======   ====            ======          =========
2542+     *
2543+     * =======   ====            ======          ========= | union cmd
2544+     * listPtr   -               -               yes       |
2545+     * -------   ----            ------          --------- |
2546+     * cmd       yes             yes             -         |
2547+     * cmdlen    yes             yes             -         |
2548+     * -------   ----            ------          --------- |
2549+     */
2550+
2551+    union {
2552+       struct {
2553+           Tcl_Obj *path;      /* Path of the sourced file the command is
2554+                                * in. */
2555+       } eval;
2556+       struct {
2557+           const void *codePtr;/* Byte code currently executed... */
2558+           const char *pc;     /* ... and instruction pointer. */
2559+       } tebc;
2560+    } data;
2561+    union {
2562+       struct {
2563+           const char *cmd;    /* The executed command, if possible... */
2564+           int len;            /* ... and its length. */
2565+       } str;
2566+       Tcl_Obj *listPtr;       /* Tcl_EvalObjEx, cmd list. */
2567+    } cmd;
2568+    int numLevels;             /* Value of interp's numLevels when the frame
2569+                                * was pushed. */
2570+    const struct CFWordBC *litarg;
2571+                               /* Link to set of literal arguments which have
2572+                                * ben pushed on the lineLABCPtr stack by
2573+                                * TclArgumentBCEnter(). These will be removed
2574+                                * by TclArgumentBCRelease. */
2575+} CmdFrame;
2576+
2577+typedef struct CFWord {
2578+    CmdFrame *framePtr;                /* CmdFrame to access. */
2579+    int word;                  /* Index of the word in the command. */
2580+    int refCount;              /* Number of times the word is on the
2581+                                * stack. */
2582+} CFWord;
2583+
2584+typedef struct CFWordBC {
2585+    CmdFrame *framePtr;                /* CmdFrame to access. */
2586+    int pc;                    /* Instruction pointer of a command in
2587+                                * ExtCmdLoc.loc[.] */
2588+    int word;                  /* Index of word in
2589+                                * ExtCmdLoc.loc[cmd]->line[.] */
2590+    struct CFWordBC *prevPtr;  /* Previous entry in stack for same Tcl_Obj. */
2591+    struct CFWordBC *nextPtr;  /* Next entry for same command call. See
2592+                                * CmdFrame litarg field for the list start. */
2593+    Tcl_Obj *obj;              /* Back reference to hashtable key */
2594+} CFWordBC;
2595+
2596+/*
2597+ * Structure to record the locations of invisible continuation lines in
2598+ * literal scripts, as character offset from the beginning of the script. Both
2599+ * compiler and direct evaluator use this information to adjust their line
2600+ * counters when tracking through the script, because when it is invoked the
2601+ * continuation line marker as a whole has been removed already, meaning that
2602+ * the \n which was part of it is gone as well, breaking regular line
2603+ * tracking.
2604+ *
2605+ * These structures are allocated and filled by both the function
2606+ * TclSubstTokens() in the file "tclParse.c" and its caller TclEvalEx() in the
2607+ * file "tclBasic.c", and stored in the thread-global hashtable "lineCLPtr" in
2608+ * file "tclObj.c". They are used by the functions TclSetByteCodeFromAny() and
2609+ * TclCompileScript(), both found in the file "tclCompile.c". Their memory is
2610+ * released by the function TclFreeObj(), in the file "tclObj.c", and also by
2611+ * the function TclThreadFinalizeObjects(), in the same file.
2612+ */
2613+
2614+#define CLL_END                (-1)
2615+
2616+typedef struct ContLineLoc {
2617+    int num;                   /* Number of entries in loc, not counting the
2618+                                * final -1 marker entry. */
2619+    int loc[1];                        /* Table of locations, as character offsets.
2620+                                * The table is allocated as part of the
2621+                                * structure, extending behind the nominal end
2622+                                * of the structure. An entry containing the
2623+                                * value -1 is put after the last location, as
2624+                                * end-marker/sentinel. */
2625+} ContLineLoc;
2626+
2627+/*
2628+ * The following macros define the allowed values for the type field of the
2629+ * CmdFrame structure above. Some of the values occur only in the extended
2630+ * location data referenced via the 'baseLocPtr'.
2631+ *
2632+ * TCL_LOCATION_EVAL     : Frame is for a script evaluated by EvalEx.
2633+ * TCL_LOCATION_EVAL_LIST : Frame is for a script evaluated by the list
2634+ *                         optimization path of EvalObjEx.
2635+ * TCL_LOCATION_BC       : Frame is for bytecode.
2636+ * TCL_LOCATION_PREBC    : Frame is for precompiled bytecode.
2637+ * TCL_LOCATION_SOURCE   : Frame is for a script evaluated by EvalEx, from a
2638+ *                         sourced file.
2639+ * TCL_LOCATION_PROC     : Frame is for bytecode of a procedure.
2640+ *
2641+ * A TCL_LOCATION_BC type in a frame can be overridden by _SOURCE and _PROC
2642+ * types, per the context of the byte code in execution.
2643+ */
2644+
2645+#define TCL_LOCATION_EVAL      (0) /* Location in a dynamic eval script. */
2646+#define TCL_LOCATION_EVAL_LIST (1) /* Location in a dynamic eval script,
2647+                                    * list-path. */
2648+#define TCL_LOCATION_BC                (2) /* Location in byte code. */
2649+#define TCL_LOCATION_PREBC     (3) /* Location in precompiled byte code, no
2650+                                    * location. */
2651+#define TCL_LOCATION_SOURCE    (4) /* Location in a file. */
2652+#define TCL_LOCATION_PROC      (5) /* Location in a dynamic proc. */
2653+#define TCL_LOCATION_LAST      (6) /* Number of values in the enum. */
2654+
2655+/*
2656+ * Structure passed to describe procedure-like "procedures" that are not
2657+ * procedures (e.g. a lambda) so that their details can be reported correctly
2658+ * by [info frame]. Contains a sub-structure for each extra field.
2659+ */
2660+
2661+typedef Tcl_Obj * (GetFrameInfoValueProc)(ClientData clientData);
2662+typedef struct {
2663+    const char *name;          /* Name of this field. */
2664+    GetFrameInfoValueProc *proc;       /* Function to generate a Tcl_Obj* from the
2665+                                * clientData, or just use the clientData
2666+                                * directly (after casting) if NULL. */
2667+    ClientData clientData;     /* Context for above function, or Tcl_Obj* if
2668+                                * proc field is NULL. */
2669+} ExtraFrameInfoField;
2670+typedef struct {
2671+    int length;                        /* Length of array. */
2672+    ExtraFrameInfoField fields[2];
2673+                               /* Really as long as necessary, but this is
2674+                                * long enough for nearly anything. */
2675+} ExtraFrameInfo;
2676+
2677+/*
2678+ *----------------------------------------------------------------
2679+ * Data structures and procedures related to TclHandles, which are a very
2680+ * lightweight method of preserving enough information to determine if an
2681+ * arbitrary malloc'd block has been deleted.
2682+ *----------------------------------------------------------------
2683+ */
2684+
2685+typedef void **TclHandle;
2686+
2687+/*
2688+ *----------------------------------------------------------------
2689+ * Experimental flag value passed to Tcl_GetRegExpFromObj. Intended for use
2690+ * only by Expect. It will probably go away in a later release.
2691+ *----------------------------------------------------------------
2692+ */
2693+
2694+#define TCL_REG_BOSONLY 002000 /* Prepend \A to pattern so it only matches at
2695+                                * the beginning of the string. */
2696+
2697+/*
2698+ * These are a thin layer over TclpThreadKeyDataGet and TclpThreadKeyDataSet
2699+ * when threads are used, or an emulation if there are no threads. These are
2700+ * really internal and Tcl clients should use Tcl_GetThreadData.
2701+ */
2702+
2703+MODULE_SCOPE void *    TclThreadDataKeyGet(Tcl_ThreadDataKey *keyPtr);
2704+MODULE_SCOPE void      TclThreadDataKeySet(Tcl_ThreadDataKey *keyPtr,
2705+                           void *data);
2706+
2707+/*
2708+ * This is a convenience macro used to initialize a thread local storage ptr.
2709+ */
2710+
2711+#define TCL_TSD_INIT(keyPtr) \
2712+  (ThreadSpecificData *)Tcl_GetThreadData((keyPtr), sizeof(ThreadSpecificData))
2713+
2714+/*
2715+ *----------------------------------------------------------------
2716+ * Data structures related to bytecode compilation and execution. These are
2717+ * used primarily in tclCompile.c, tclExecute.c, and tclBasic.c.
2718+ *----------------------------------------------------------------
2719+ */
2720+
2721+/*
2722+ * Forward declaration to prevent errors when the forward references to
2723+ * Tcl_Parse and CompileEnv are encountered in the procedure type CompileProc
2724+ * declared below.
2725+ */
2726+
2727+struct CompileEnv;
2728+
2729+/*
2730+ * The type of procedures called by the Tcl bytecode compiler to compile
2731+ * commands. Pointers to these procedures are kept in the Command structure
2732+ * describing each command. The integer value returned by a CompileProc must
2733+ * be one of the following:
2734+ *
2735+ * TCL_OK              Compilation completed normally.
2736+ * TCL_ERROR           Compilation could not be completed. This can be just a
2737+ *                     judgment by the CompileProc that the command is too
2738+ *                     complex to compile effectively, or it can indicate
2739+ *                     that in the current state of the interp, the command
2740+ *                     would raise an error. The bytecode compiler will not
2741+ *                     do any error reporting at compiler time. Error
2742+ *                     reporting is deferred until the actual runtime,
2743+ *                     because by then changes in the interp state may allow
2744+ *                     the command to be successfully evaluated.
2745+ * TCL_OUT_LINE_COMPILE        A source-compatible alias for TCL_ERROR, kept for the
2746+ *                     sake of old code only.
2747+ */
2748+
2749+#define TCL_OUT_LINE_COMPILE   TCL_ERROR
2750+
2751+typedef int (CompileProc)(Tcl_Interp *interp, Tcl_Parse *parsePtr,
2752+       struct Command *cmdPtr, struct CompileEnv *compEnvPtr);
2753+
2754+/*
2755+ * The type of procedure called from the compilation hook point in
2756+ * SetByteCodeFromAny.
2757+ */
2758+
2759+typedef int (CompileHookProc)(Tcl_Interp *interp,
2760+       struct CompileEnv *compEnvPtr, ClientData clientData);
2761+
2762+/*
2763+ * The data structure for a (linked list of) execution stacks.
2764+ */
2765+
2766+typedef struct ExecStack {
2767+    struct ExecStack *prevPtr;
2768+    struct ExecStack *nextPtr;
2769+    Tcl_Obj **markerPtr;
2770+    Tcl_Obj **endPtr;
2771+    Tcl_Obj **tosPtr;
2772+    Tcl_Obj *stackWords[1];
2773+} ExecStack;
2774+
2775+/*
2776+ * The data structure defining the execution environment for ByteCode's.
2777+ * There is one ExecEnv structure per Tcl interpreter. It holds the evaluation
2778+ * stack that holds command operands and results. The stack grows towards
2779+ * increasing addresses. The member stackPtr points to the stackItems of the
2780+ * currently active execution stack.
2781+ */
2782+
2783+typedef struct CorContext {
2784+    struct CallFrame *framePtr;
2785+    struct CallFrame *varFramePtr;
2786+    struct CmdFrame *cmdFramePtr;  /* See Interp.cmdFramePtr */
2787+    Tcl_HashTable *lineLABCPtr;    /* See Interp.lineLABCPtr */
2788+} CorContext;
2789+
2790+typedef struct CoroutineData {
2791+    struct Command *cmdPtr;    /* The command handle for the coroutine. */
2792+    struct ExecEnv *eePtr;     /* The special execution environment (stacks,
2793+                                * etc.) for the coroutine. */
2794+    struct ExecEnv *callerEEPtr;/* The execution environment for the caller of
2795+                                * the coroutine, which might be the
2796+                                * interpreter global environment or another
2797+                                * coroutine. */
2798+    CorContext caller;
2799+    CorContext running;
2800+    Tcl_HashTable *lineLABCPtr;    /* See Interp.lineLABCPtr */
2801+    void *stackLevel;
2802+    int auxNumLevels;          /* While the coroutine is running the
2803+                                * numLevels of the create/resume command is
2804+                                * stored here; for suspended coroutines it
2805+                                * holds the nesting numLevels at yield. */
2806+    int nargs;                  /* Number of args required for resuming this
2807+                                * coroutine; -2 means "0 or 1" (default), -1
2808+                                * means "any" */
2809+} CoroutineData;
2810+
2811+typedef struct ExecEnv {
2812+    ExecStack *execStackPtr;   /* Points to the first item in the evaluation
2813+                                * stack on the heap. */
2814+    Tcl_Obj *constants[2];     /* Pointers to constant "0" and "1" objs. */
2815+    struct Tcl_Interp *interp;
2816+    struct NRE_callback *callbackPtr;
2817+                               /* Top callback in NRE's stack. */
2818+    struct CoroutineData *corPtr;
2819+    int rewind;
2820+} ExecEnv;
2821+
2822+#define COR_IS_SUSPENDED(corPtr) \
2823+    ((corPtr)->stackLevel == NULL)
2824+
2825+/*
2826+ * The definitions for the LiteralTable and LiteralEntry structures. Each
2827+ * interpreter contains a LiteralTable. It is used to reduce the storage
2828+ * needed for all the Tcl objects that hold the literals of scripts compiled
2829+ * by the interpreter. A literal's object is shared by all the ByteCodes that
2830+ * refer to the literal. Each distinct literal has one LiteralEntry entry in
2831+ * the LiteralTable. A literal table is a specialized hash table that is
2832+ * indexed by the literal's string representation, which may contain null
2833+ * characters.
2834+ *
2835+ * Note that we reduce the space needed for literals by sharing literal
2836+ * objects both within a ByteCode (each ByteCode contains a local
2837+ * LiteralTable) and across all an interpreter's ByteCodes (with the
2838+ * interpreter's global LiteralTable).
2839+ */
2840+
2841+typedef struct LiteralEntry {
2842+    struct LiteralEntry *nextPtr;
2843+                               /* Points to next entry in this hash bucket or
2844+                                * NULL if end of chain. */
2845+    Tcl_Obj *objPtr;           /* Points to Tcl object that holds the
2846+                                * literal's bytes and length. */
2847+    int refCount;              /* If in an interpreter's global literal
2848+                                * table, the number of ByteCode structures
2849+                                * that share the literal object; the literal
2850+                                * entry can be freed when refCount drops to
2851+                                * 0. If in a local literal table, -1. */
2852+    Namespace *nsPtr;          /* Namespace in which this literal is used. We
2853+                                * try to avoid sharing literal non-FQ command
2854+                                * names among different namespaces to reduce
2855+                                * shimmering. */
2856+} LiteralEntry;
2857+
2858+typedef struct LiteralTable {
2859+    LiteralEntry **buckets;    /* Pointer to bucket array. Each element
2860+                                * points to first entry in bucket's hash
2861+                                * chain, or NULL. */
2862+    LiteralEntry *staticBuckets[TCL_SMALL_HASH_TABLE];
2863+                               /* Bucket array used for small tables to avoid
2864+                                * mallocs and frees. */
2865+    int numBuckets;            /* Total number of buckets allocated at
2866+                                * **buckets. */
2867+    int numEntries;            /* Total number of entries present in
2868+                                * table. */
2869+    int rebuildSize;           /* Enlarge table when numEntries gets to be
2870+                                * this large. */
2871+    int mask;                  /* Mask value used in hashing function. */
2872+} LiteralTable;
2873+
2874+/*
2875+ * The following structure defines for each Tcl interpreter various
2876+ * statistics-related information about the bytecode compiler and
2877+ * interpreter's operation in that interpreter.
2878+ */
2879+
2880+#ifdef TCL_COMPILE_STATS
2881+typedef struct ByteCodeStats {
2882+    long numExecutions;                /* Number of ByteCodes executed. */
2883+    long numCompilations;      /* Number of ByteCodes created. */
2884+    long numByteCodesFreed;    /* Number of ByteCodes destroyed. */
2885+    long instructionCount[256];        /* Number of times each instruction was
2886+                                * executed. */
2887+
2888+    double totalSrcBytes;      /* Total source bytes ever compiled. */
2889+    double totalByteCodeBytes; /* Total bytes for all ByteCodes. */
2890+    double currentSrcBytes;    /* Src bytes for all current ByteCodes. */
2891+    double currentByteCodeBytes;/* Code bytes in all current ByteCodes. */
2892+
2893+    long srcCount[32];         /* Source size distribution: # of srcs of
2894+                                * size [2**(n-1)..2**n), n in [0..32). */
2895+    long byteCodeCount[32];    /* ByteCode size distribution. */
2896+    long lifetimeCount[32];    /* ByteCode lifetime distribution (ms). */
2897+
2898+    double currentInstBytes;   /* Instruction bytes-current ByteCodes. */
2899+    double currentLitBytes;    /* Current literal bytes. */
2900+    double currentExceptBytes; /* Current exception table bytes. */
2901+    double currentAuxBytes;    /* Current auxiliary information bytes. */
2902+    double currentCmdMapBytes; /* Current src<->code map bytes. */
2903+
2904+    long numLiteralsCreated;   /* Total literal objects ever compiled. */
2905+    double totalLitStringBytes;        /* Total string bytes in all literals. */
2906+    double currentLitStringBytes;
2907+                               /* String bytes in current literals. */
2908+    long literalCount[32];     /* Distribution of literal string sizes. */
2909+} ByteCodeStats;
2910+#endif /* TCL_COMPILE_STATS */
2911+
2912+/*
2913+ * Structure used in implementation of those core ensembles which are
2914+ * partially compiled. Used as an array of these, with a terminating field
2915+ * whose 'name' is NULL.
2916+ */
2917+
2918+typedef struct {
2919+    const char *name;          /* The name of the subcommand. */
2920+    Tcl_ObjCmdProc *proc;      /* The implementation of the subcommand. */
2921+    CompileProc *compileProc;  /* The compiler for the subcommand. */
2922+    Tcl_ObjCmdProc *nreProc;   /* NRE implementation of this command. */
2923+    ClientData clientData;     /* Any clientData to give the command. */
2924+    int unsafe;                        /* Whether this command is to be hidden by
2925+                                * default in a safe interpreter. */
2926+} EnsembleImplMap;
2927+
2928+/*
2929+ *----------------------------------------------------------------
2930+ * Data structures related to commands.
2931+ *----------------------------------------------------------------
2932+ */
2933+
2934+/*
2935+ * An imported command is created in an namespace when it imports a "real"
2936+ * command from another namespace. An imported command has a Command structure
2937+ * that points (via its ClientData value) to the "real" Command structure in
2938+ * the source namespace's command table. The real command records all the
2939+ * imported commands that refer to it in a list of ImportRef structures so
2940+ * that they can be deleted when the real command is deleted.
2941+ */
2942+
2943+typedef struct ImportRef {
2944+    struct Command *importedCmdPtr;
2945+                               /* Points to the imported command created in
2946+                                * an importing namespace; this command
2947+                                * redirects its invocations to the "real"
2948+                                * command. */
2949+    struct ImportRef *nextPtr; /* Next element on the linked list of imported
2950+                                * commands that refer to the "real" command.
2951+                                * The real command deletes these imported
2952+                                * commands on this list when it is
2953+                                * deleted. */
2954+} ImportRef;
2955+
2956+/*
2957+ * Data structure used as the ClientData of imported commands: commands
2958+ * created in an namespace when it imports a "real" command from another
2959+ * namespace.
2960+ */
2961+
2962+typedef struct ImportedCmdData {
2963+    struct Command *realCmdPtr;        /* "Real" command that this imported command
2964+                                * refers to. */
2965+    struct Command *selfPtr;   /* Pointer to this imported command. Needed
2966+                                * only when deleting it in order to remove it
2967+                                * from the real command's linked list of
2968+                                * imported commands that refer to it. */
2969+} ImportedCmdData;
2970+
2971+/*
2972+ * A Command structure exists for each command in a namespace. The Tcl_Command
2973+ * opaque type actually refers to these structures.
2974+ */
2975+
2976+typedef struct Command {
2977+    Tcl_HashEntry *hPtr;       /* Pointer to the hash table entry that refers
2978+                                * to this command. The hash table is either a
2979+                                * namespace's command table or an
2980+                                * interpreter's hidden command table. This
2981+                                * pointer is used to get a command's name
2982+                                * from its Tcl_Command handle. NULL means
2983+                                * that the hash table entry has been removed
2984+                                * already (this can happen if deleteProc
2985+                                * causes the command to be deleted or
2986+                                * recreated). */
2987+    Namespace *nsPtr;          /* Points to the namespace containing this
2988+                                * command. */
2989+    int refCount;              /* 1 if in command hashtable plus 1 for each
2990+                                * reference from a CmdName Tcl object
2991+                                * representing a command's name in a ByteCode
2992+                                * instruction sequence. This structure can be
2993+                                * freed when refCount becomes zero. */
2994+    int cmdEpoch;              /* Incremented to invalidate any references
2995+                                * that point to this command when it is
2996+                                * renamed, deleted, hidden, or exposed. */
2997+    CompileProc *compileProc;  /* Procedure called to compile command. NULL
2998+                                * if no compile proc exists for command. */
2999+    Tcl_ObjCmdProc *objProc;   /* Object-based command procedure. */
3000+    ClientData objClientData;  /* Arbitrary value passed to object proc. */
3001+    Tcl_CmdProc *proc;         /* String-based command procedure. */
3002+    ClientData clientData;     /* Arbitrary value passed to string proc. */
3003+    Tcl_CmdDeleteProc *deleteProc;
3004+                               /* Procedure invoked when deleting command to,
3005+                                * e.g., free all client data. */
3006+    ClientData deleteData;     /* Arbitrary value passed to deleteProc. */
3007+    int flags;                 /* Miscellaneous bits of information about
3008+                                * command. See below for definitions. */
3009+    ImportRef *importRefPtr;   /* List of each imported Command created in
3010+                                * another namespace when this command is
3011+                                * imported. These imported commands redirect
3012+                                * invocations back to this command. The list
3013+                                * is used to remove all those imported
3014+                                * commands when deleting this "real"
3015+                                * command. */
3016+    CommandTrace *tracePtr;    /* First in list of all traces set for this
3017+                                * command. */
3018+    Tcl_ObjCmdProc *nreProc;   /* NRE implementation of this command. */
3019+} Command;
3020+
3021+/*
3022+ * Flag bits for commands.
3023+ *
3024+ * CMD_IS_DELETED -            Means that the command is in the process of
3025+ *                             being deleted (its deleteProc is currently
3026+ *                             executing). Other attempts to delete the
3027+ *                             command should be ignored.
3028+ * CMD_TRACE_ACTIVE -          1 means that trace processing is currently
3029+ *                             underway for a rename/delete change. See the
3030+ *                             two flags below for which is currently being
3031+ *                             processed.
3032+ * CMD_HAS_EXEC_TRACES -       1 means that this command has at least one
3033+ *                             execution trace (as opposed to simple
3034+ *                             delete/rename traces) in its tracePtr list.
3035+ * TCL_TRACE_RENAME -          A rename trace is in progress. Further
3036+ *                             recursive renames will not be traced.
3037+ * TCL_TRACE_DELETE -          A delete trace is in progress. Further
3038+ *                             recursive deletes will not be traced.
3039+ * (these last two flags are defined in tcl.h)
3040+ */
3041+
3042+#define CMD_IS_DELETED             0x1
3043+#define CMD_TRACE_ACTIVE           0x2
3044+#define CMD_HAS_EXEC_TRACES        0x4
3045+
3046+/*
3047+ *----------------------------------------------------------------
3048+ * Data structures related to name resolution procedures.
3049+ *----------------------------------------------------------------
3050+ */
3051+
3052+/*
3053+ * The interpreter keeps a linked list of name resolution schemes. The scheme
3054+ * for a namespace is consulted first, followed by the list of schemes in an
3055+ * interpreter, followed by the default name resolution in Tcl. Schemes are
3056+ * added/removed from the interpreter's list by calling Tcl_AddInterpResolver
3057+ * and Tcl_RemoveInterpResolver.
3058+ */
3059+
3060+typedef struct ResolverScheme {
3061+    char *name;                        /* Name identifying this scheme. */
3062+    Tcl_ResolveCmdProc *cmdResProc;
3063+                               /* Procedure handling command name
3064+                                * resolution. */
3065+    Tcl_ResolveVarProc *varResProc;
3066+                               /* Procedure handling variable name resolution
3067+                                * for variables that can only be handled at
3068+                                * runtime. */
3069+    Tcl_ResolveCompiledVarProc *compiledVarResProc;
3070+                               /* Procedure handling variable name resolution
3071+                                * at compile time. */
3072+
3073+    struct ResolverScheme *nextPtr;
3074+                               /* Pointer to next record in linked list. */
3075+} ResolverScheme;
3076+
3077+/*
3078+ * Forward declaration of the TIP#143 limit handler structure.
3079+ */
3080+
3081+typedef struct LimitHandler LimitHandler;
3082+
3083+/*
3084+ * TIP #268.
3085+ * Values for the selection mode, i.e the package require preferences.
3086+ */
3087+
3088+enum PkgPreferOptions {
3089+    PKG_PREFER_LATEST, PKG_PREFER_STABLE
3090+};
3091+
3092+/*
3093+ *----------------------------------------------------------------
3094+ * This structure shadows the first few fields of the memory cache for the
3095+ * allocator defined in tclThreadAlloc.c; it has to be kept in sync with the
3096+ * definition there.
3097+ * Some macros require knowledge of some fields in the struct in order to
3098+ * avoid hitting the TSD unnecessarily. In order to facilitate this, a pointer
3099+ * to the relevant fields is kept in the objCache field in struct Interp.
3100+ *----------------------------------------------------------------
3101+ */
3102+
3103+typedef struct AllocCache {
3104+    struct Cache *nextPtr;     /* Linked list of cache entries. */
3105+    Tcl_ThreadId owner;                /* Which thread's cache is this? */
3106+    Tcl_Obj *firstObjPtr;      /* List of free objects for thread. */
3107+    int numObjects;            /* Number of objects for thread. */
3108+} AllocCache;
3109+
3110+/*
3111+ *----------------------------------------------------------------
3112+ * This structure defines an interpreter, which is a collection of commands
3113+ * plus other state information related to interpreting commands, such as
3114+ * variable storage. Primary responsibility for this data structure is in
3115+ * tclBasic.c, but almost every Tcl source file uses something in here.
3116+ *----------------------------------------------------------------
3117+ */
3118+
3119+typedef struct Interp {
3120+    /*
3121+     * Note: the first three fields must match exactly the fields in a
3122+     * Tcl_Interp struct (see tcl.h). If you change one, be sure to change the
3123+     * other.
3124+     *
3125+     * The interpreter's result is held in both the string and the
3126+     * objResultPtr fields. These fields hold, respectively, the result's
3127+     * string or object value. The interpreter's result is always in the
3128+     * result field if that is non-empty, otherwise it is in objResultPtr.
3129+     * The two fields are kept consistent unless some C code sets
3130+     * interp->result directly. Programs should not access result and
3131+     * objResultPtr directly; instead, they should always get and set the
3132+     * result using procedures such as Tcl_SetObjResult, Tcl_GetObjResult, and
3133+     * Tcl_GetStringResult. See the SetResult man page for details.
3134+     */
3135+
3136+    char *result;              /* If the last command returned a string
3137+                                * result, this points to it. Should not be
3138+                                * accessed directly; see comment above. */
3139+    Tcl_FreeProc *freeProc;    /* Zero means a string result is statically
3140+                                * allocated. TCL_DYNAMIC means string result
3141+                                * was allocated with ckalloc and should be
3142+                                * freed with ckfree. Other values give
3143+                                * address of procedure to invoke to free the
3144+                                * string result. Tcl_Eval must free it before
3145+                                * executing next command. */
3146+    int errorLine;             /* When TCL_ERROR is returned, this gives the
3147+                                * line number in the command where the error
3148+                                * occurred (1 means first line). */
3149+    const struct TclStubs *stubTable;
3150+                               /* Pointer to the exported Tcl stub table. On
3151+                                * previous versions of Tcl this is a pointer
3152+                                * to the objResultPtr or a pointer to a
3153+                                * buckets array in a hash table. We therefore
3154+                                * have to do some careful checking before we
3155+                                * can use this. */
3156+
3157+    TclHandle handle;          /* Handle used to keep track of when this
3158+                                * interp is deleted. */
3159+
3160+    Namespace *globalNsPtr;    /* The interpreter's global namespace. */
3161+    Tcl_HashTable *hiddenCmdTablePtr;
3162+                               /* Hash table used by tclBasic.c to keep track
3163+                                * of hidden commands on a per-interp
3164+                                * basis. */
3165+    ClientData interpInfo;     /* Information used by tclInterp.c to keep
3166+                                * track of master/slave interps on a
3167+                                * per-interp basis. */
3168+    Tcl_HashTable unused2;     /* No longer used (was mathFuncTable) */
3169+
3170+    /*
3171+     * Information related to procedures and variables. See tclProc.c and
3172+     * tclVar.c for usage.
3173+     */
3174+
3175+    int numLevels;             /* Keeps track of how many nested calls to
3176+                                * Tcl_Eval are in progress for this
3177+                                * interpreter. It's used to delay deletion of
3178+                                * the table until all Tcl_Eval invocations
3179+                                * are completed. */
3180+    int maxNestingDepth;       /* If numLevels exceeds this value then Tcl
3181+                                * assumes that infinite recursion has
3182+                                * occurred and it generates an error. */
3183+    CallFrame *framePtr;       /* Points to top-most in stack of all nested
3184+                                * procedure invocations. */
3185+    CallFrame *varFramePtr;    /* Points to the call frame whose variables
3186+                                * are currently in use (same as framePtr
3187+                                * unless an "uplevel" command is
3188+                                * executing). */
3189+    ActiveVarTrace *activeVarTracePtr;
3190+                               /* First in list of active traces for interp,
3191+                                * or NULL if no active traces. */
3192+    int returnCode;            /* [return -code] parameter. */
3193+    CallFrame *rootFramePtr;   /* Global frame pointer for this
3194+                                * interpreter. */
3195+    Namespace *lookupNsPtr;    /* Namespace to use ONLY on the next
3196+                                * TCL_EVAL_INVOKE call to Tcl_EvalObjv. */
3197+
3198+    /*
3199+     * Information used by Tcl_AppendResult to keep track of partial results.
3200+     * See Tcl_AppendResult code for details.
3201+     */
3202+
3203+    char *appendResult;                /* Storage space for results generated by
3204+                                * Tcl_AppendResult. Ckalloc-ed. NULL means
3205+                                * not yet allocated. */
3206+    int appendAvl;             /* Total amount of space available at
3207+                                * partialResult. */
3208+    int appendUsed;            /* Number of non-null bytes currently stored
3209+                                * at partialResult. */
3210+
3211+    /*
3212+     * Information about packages. Used only in tclPkg.c.
3213+     */
3214+
3215+    Tcl_HashTable packageTable;        /* Describes all of the packages loaded in or
3216+                                * available to this interpreter. Keys are
3217+                                * package names, values are (Package *)
3218+                                * pointers. */
3219+    char *packageUnknown;      /* Command to invoke during "package require"
3220+                                * commands for packages that aren't described
3221+                                * in packageTable. Ckalloc'ed, may be
3222+                                * NULL. */
3223+    /*
3224+     * Miscellaneous information:
3225+     */
3226+
3227+    int cmdCount;              /* Total number of times a command procedure
3228+                                * has been called for this interpreter. */
3229+    int evalFlags;             /* Flags to control next call to Tcl_Eval.
3230+                                * Normally zero, but may be set before
3231+                                * calling Tcl_Eval. See below for valid
3232+                                * values. */
3233+    int unused1;               /* No longer used (was termOffset) */
3234+    LiteralTable literalTable; /* Contains LiteralEntry's describing all Tcl
3235+                                * objects holding literals of scripts
3236+                                * compiled by the interpreter. Indexed by the
3237+                                * string representations of literals. Used to
3238+                                * avoid creating duplicate objects. */
3239+    int compileEpoch;          /* Holds the current "compilation epoch" for
3240+                                * this interpreter. This is incremented to
3241+                                * invalidate existing ByteCodes when, e.g., a
3242+                                * command with a compile procedure is
3243+                                * redefined. */
3244+    Proc *compiledProcPtr;     /* If a procedure is being compiled, a pointer
3245+                                * to its Proc structure; otherwise, this is
3246+                                * NULL. Set by ObjInterpProc in tclProc.c and
3247+                                * used by tclCompile.c to process local
3248+                                * variables appropriately. */
3249+    ResolverScheme *resolverPtr;
3250+                               /* Linked list of name resolution schemes
3251+                                * added to this interpreter. Schemes are
3252+                                * added and removed by calling
3253+                                * Tcl_AddInterpResolvers and
3254+                                * Tcl_RemoveInterpResolver respectively. */
3255+    Tcl_Obj *scriptFile;       /* NULL means there is no nested source
3256+                                * command active; otherwise this points to
3257+                                * pathPtr of the file being sourced. */
3258+    int flags;                 /* Various flag bits. See below. */
3259+    long randSeed;             /* Seed used for rand() function. */
3260+    Trace *tracePtr;           /* List of traces for this interpreter. */
3261+    Tcl_HashTable *assocData;  /* Hash table for associating data with this
3262+                                * interpreter. Cleaned up when this
3263+                                * interpreter is deleted. */
3264+    struct ExecEnv *execEnvPtr;        /* Execution environment for Tcl bytecode
3265+                                * execution. Contains a pointer to the Tcl
3266+                                * evaluation stack. */
3267+    Tcl_Obj *emptyObjPtr;      /* Points to an object holding an empty
3268+                                * string. Returned by Tcl_ObjSetVar2 when
3269+                                * variable traces change a variable in a
3270+                                * gross way. */
3271+    char resultSpace[TCL_RESULT_SIZE+1];
3272+                               /* Static space holding small results. */
3273+    Tcl_Obj *objResultPtr;     /* If the last command returned an object
3274+                                * result, this points to it. Should not be
3275+                                * accessed directly; see comment above. */
3276+    Tcl_ThreadId threadId;     /* ID of thread that owns the interpreter. */
3277+
3278+    ActiveCommandTrace *activeCmdTracePtr;
3279+                               /* First in list of active command traces for
3280+                                * interp, or NULL if no active traces. */
3281+    ActiveInterpTrace *activeInterpTracePtr;
3282+                               /* First in list of active traces for interp,
3283+                                * or NULL if no active traces. */
3284+
3285+    int tracesForbiddingInline;        /* Count of traces (in the list headed by
3286+                                * tracePtr) that forbid inline bytecode
3287+                                * compilation. */
3288+
3289+    /*
3290+     * Fields used to manage extensible return options (TIP 90).
3291+     */
3292+
3293+    Tcl_Obj *returnOpts;       /* A dictionary holding the options to the
3294+                                * last [return] command. */
3295+
3296+    Tcl_Obj *errorInfo;                /* errorInfo value (now as a Tcl_Obj). */
3297+    Tcl_Obj *eiVar;            /* cached ref to ::errorInfo variable. */
3298+    Tcl_Obj *errorCode;                /* errorCode value (now as a Tcl_Obj). */
3299+    Tcl_Obj *ecVar;            /* cached ref to ::errorInfo variable. */
3300+    int returnLevel;           /* [return -level] parameter. */
3301+
3302+    /*
3303+     * Resource limiting framework support (TIP#143).
3304+     */
3305+
3306+    struct {
3307+       int active;             /* Flag values defining which limits have been
3308+                                * set. */
3309+       int granularityTicker;  /* Counter used to determine how often to
3310+                                * check the limits. */
3311+       int exceeded;           /* Which limits have been exceeded, described
3312+                                * as flag values the same as the 'active'
3313+                                * field. */
3314+
3315+       int cmdCount;           /* Limit for how many commands to execute in
3316+                                * the interpreter. */
3317+       LimitHandler *cmdHandlers;
3318+                               /* Handlers to execute when the limit is
3319+                                * reached. */
3320+       int cmdGranularity;     /* Mod factor used to determine how often to
3321+                                * evaluate the limit check. */
3322+
3323+       Tcl_Time time;          /* Time limit for execution within the
3324+                                * interpreter. */
3325+       LimitHandler *timeHandlers;
3326+                               /* Handlers to execute when the limit is
3327+                                * reached. */
3328+       int timeGranularity;    /* Mod factor used to determine how often to
3329+                                * evaluate the limit check. */
3330+       Tcl_TimerToken timeEvent;
3331+                               /* Handle for a timer callback that will occur
3332+                                * when the time-limit is exceeded. */
3333+
3334+       Tcl_HashTable callbacks;/* Mapping from (interp,type) pair to data
3335+                                * used to install a limit handler callback to
3336+                                * run in _this_ interp when the limit is
3337+                                * exceeded. */
3338+    } limit;
3339+
3340+    /*
3341+     * Information for improved default error generation from ensembles
3342+     * (TIP#112).
3343+     */
3344+
3345+    struct {
3346+       Tcl_Obj *const *sourceObjs;
3347+                               /* What arguments were actually input into the
3348+                                * *root* ensemble command? (Nested ensembles
3349+                                * don't rewrite this.) NULL if we're not
3350+                                * processing an ensemble. */
3351+       int numRemovedObjs;     /* How many arguments have been stripped off
3352+                                * because of ensemble processing. */
3353+       int numInsertedObjs;    /* How many of the current arguments were
3354+                                * inserted by an ensemble. */
3355+    } ensembleRewrite;
3356+
3357+    /*
3358+     * TIP #219: Global info for the I/O system.
3359+     */
3360+
3361+    Tcl_Obj *chanMsg;          /* Error message set by channel drivers, for
3362+                                * the propagation of arbitrary Tcl errors.
3363+                                * This information, if present (chanMsg not
3364+                                * NULL), takes precedence over a POSIX error
3365+                                * code returned by a channel operation. */
3366+
3367+    /*
3368+     * Source code origin information (TIP #280).
3369+     */
3370+
3371+    CmdFrame *cmdFramePtr;     /* Points to the command frame containing the
3372+                                * location information for the current
3373+                                * command. */
3374+    const CmdFrame *invokeCmdFramePtr;
3375+                               /* Points to the command frame which is the
3376+                                * invoking context of the bytecode compiler.
3377+                                * NULL when the byte code compiler is not
3378+                                * active. */
3379+    int invokeWord;            /* Index of the word in the command which
3380+                                * is getting compiled. */
3381+    Tcl_HashTable *linePBodyPtr;/* This table remembers for each statically
3382+                                * defined procedure the location information
3383+                                * for its body. It is keyed by the address of
3384+                                * the Proc structure for a procedure. The
3385+                                * values are "struct CmdFrame*". */
3386+    Tcl_HashTable *lineBCPtr;  /* This table remembers for each ByteCode
3387+                                * object the location information for its
3388+                                * body. It is keyed by the address of the
3389+                                * Proc structure for a procedure. The values
3390+                                * are "struct ExtCmdLoc*". (See
3391+                                * tclCompile.h) */
3392+    Tcl_HashTable *lineLABCPtr;
3393+    Tcl_HashTable *lineLAPtr;  /* This table remembers for each argument of a
3394+                                * command on the execution stack the index of
3395+                                * the argument in the command, and the
3396+                                * location data of the command. It is keyed
3397+                                * by the address of the Tcl_Obj containing
3398+                                * the argument. The values are "struct
3399+                                * CFWord*" (See tclBasic.c). This allows
3400+                                * commands like uplevel, eval, etc. to find
3401+                                * location information for their arguments,
3402+                                * if they are a proper literal argument to an
3403+                                * invoking command. Alt view: An index to the
3404+                                * CmdFrame stack keyed by command argument
3405+                                * holders. */
3406+    ContLineLoc *scriptCLLocPtr;/* This table points to the location data for
3407+                                * invisible continuation lines in the script,
3408+                                * if any. This pointer is set by the function
3409+                                * TclEvalObjEx() in file "tclBasic.c", and
3410+                                * used by function ...() in the same file.
3411+                                * It does for the eval/direct path of script
3412+                                * execution what CompileEnv.clLoc does for
3413+                                * the bytecode compiler.
3414+                                */
3415+    /*
3416+     * TIP #268. The currently active selection mode, i.e. the package require
3417+     * preferences.
3418+     */
3419+
3420+    int packagePrefer;         /* Current package selection mode. */
3421+
3422+    /*
3423+     * Hashtables for variable traces and searches.
3424+     */
3425+
3426+    Tcl_HashTable varTraces;   /* Hashtable holding the start of a variable's
3427+                                * active trace list; varPtr is the key. */
3428+    Tcl_HashTable varSearches; /* Hashtable holding the start of a variable's
3429+                                * active searches list; varPtr is the key. */
3430+    /*
3431+     * The thread-specific data ekeko: cache pointers or values that
3432+     *  (a) do not change during the thread's lifetime
3433+     *  (b) require access to TSD to determine at runtime
3434+     *  (c) are accessed very often (e.g., at each command call)
3435+     *
3436+     * Note that these are the same for all interps in the same thread. They
3437+     * just have to be initialised for the thread's master interp, slaves
3438+     * inherit the value.
3439+     *
3440+     * They are used by the macros defined below.
3441+     */
3442+
3443+    AllocCache *allocCache;
3444+    void *pendingObjDataPtr;   /* Pointer to the Cache and PendingObjData
3445+                                * structs for this interp's thread; see
3446+                                * tclObj.c and tclThreadAlloc.c */
3447+    int *asyncReadyPtr;                /* Pointer to the asyncReady indicator for
3448+                                * this interp's thread; see tclAsync.c */
3449+    /*
3450+     * The pointer to the object system root ekeko. c.f. TIP #257.
3451+     */
3452+    void *objectFoundation;    /* Pointer to the Foundation structure of the
3453+                                * object system, which contains things like
3454+                                * references to key namespaces. See
3455+                                * tclOOInt.h and tclOO.c for real definition
3456+                                * and setup. */
3457+
3458+    struct NRE_callback *deferredCallbacks;
3459+                               /* Callbacks that are set previous to a call
3460+                                * to some Eval function but that actually
3461+                                * belong to the command that is about to be
3462+                                * called - i.e., they should be run *before*
3463+                                * any tailcall is invoked. */
3464+
3465+    /*
3466+     * TIP #285, Script cancellation support.
3467+     */
3468+
3469+    Tcl_AsyncHandler asyncCancel;
3470+                               /* Async handler token for Tcl_CancelEval. */
3471+    Tcl_Obj *asyncCancelMsg;   /* Error message set by async cancel handler
3472+                                * for the propagation of arbitrary Tcl
3473+                                * errors. This information, if present
3474+                                * (asyncCancelMsg not NULL), takes precedence
3475+                                * over the default error messages returned by
3476+                                * a script cancellation operation. */
3477+
3478+       /*
3479+        * TIP #348 IMPLEMENTATION  -  Substituted error stack
3480+        */
3481+    Tcl_Obj *errorStack;       /* [info errorstack] value (as a Tcl_Obj). */
3482+    Tcl_Obj *upLiteral;                /* "UP" literal for [info errorstack] */
3483+    Tcl_Obj *callLiteral;      /* "CALL" literal for [info errorstack] */
3484+    Tcl_Obj *innerLiteral;     /* "INNER" literal for [info errorstack] */
3485+    Tcl_Obj *innerContext;     /* cached list for fast reallocation */
3486+    int resetErrorStack;        /* controls cleaning up of ::errorStack */
3487+
3488+#ifdef TCL_COMPILE_STATS
3489+    /*
3490+     * Statistical information about the bytecode compiler and interpreter's
3491+     * operation. This should be the last field of Interp.
3492+     */
3493+
3494+    ByteCodeStats stats;       /* Holds compilation and execution statistics
3495+                                * for this interpreter. */
3496+#endif /* TCL_COMPILE_STATS */
3497+} Interp;
3498+
3499+/*
3500+ * Macros that use the TSD-ekeko.
3501+ */
3502+
3503+#define TclAsyncReady(iPtr) \
3504+    *((iPtr)->asyncReadyPtr)
3505+
3506+/*
3507+ * Macros for script cancellation support (TIP #285).
3508+ */
3509+
3510+#define TclCanceled(iPtr) \
3511+    (((iPtr)->flags & CANCELED) || ((iPtr)->flags & TCL_CANCEL_UNWIND))
3512+
3513+#define TclSetCancelFlags(iPtr, cancelFlags)   \
3514+    (iPtr)->flags |= CANCELED;                 \
3515+    if ((cancelFlags) & TCL_CANCEL_UNWIND) {   \
3516+        (iPtr)->flags |= TCL_CANCEL_UNWIND;    \
3517+    }
3518+
3519+#define TclUnsetCancelFlags(iPtr) \
3520+    (iPtr)->flags &= (~(CANCELED | TCL_CANCEL_UNWIND))
3521+
3522+/*
3523+ * General list of interpreters. Doubly linked for easier removal of items
3524+ * deep in the list.
3525+ */
3526+
3527+typedef struct InterpList {
3528+    Interp *interpPtr;
3529+    struct InterpList *prevPtr;
3530+    struct InterpList *nextPtr;
3531+} InterpList;
3532+
3533+/*
3534+ * Macros for splicing into and out of doubly linked lists. They assume
3535+ * existence of struct items 'prevPtr' and 'nextPtr'.
3536+ *
3537+ * a = element to add or remove.
3538+ * b = list head.
3539+ *
3540+ * TclSpliceIn adds to the head of the list.
3541+ */
3542+
3543+#define TclSpliceIn(a,b)                       \
3544+    (a)->nextPtr = (b);                                \
3545+    if ((b) != NULL) {                         \
3546+       (b)->prevPtr = (a);                     \
3547+    }                                          \
3548+    (a)->prevPtr = NULL, (b) = (a);
3549+
3550+#define TclSpliceOut(a,b)                      \
3551+    if ((a)->prevPtr != NULL) {                        \
3552+       (a)->prevPtr->nextPtr = (a)->nextPtr;   \
3553+    } else {                                   \
3554+       (b) = (a)->nextPtr;                     \
3555+    }                                          \
3556+    if ((a)->nextPtr != NULL) {                        \
3557+       (a)->nextPtr->prevPtr = (a)->prevPtr;   \
3558+    }
3559+
3560+/*
3561+ * EvalFlag bits for Interp structures:
3562+ *
3563+ * TCL_ALLOW_EXCEPTIONS        1 means it's OK for the script to terminate with a
3564+ *                     code other than TCL_OK or TCL_ERROR; 0 means codes
3565+ *                     other than these should be turned into errors.
3566+ */
3567+
3568+#define TCL_ALLOW_EXCEPTIONS   4
3569+#define TCL_EVAL_FILE          2
3570+#define TCL_EVAL_CTX           8
3571+#define TCL_EVAL_REDIRECT      16
3572+
3573+/*
3574+ * Flag bits for Interp structures:
3575+ *
3576+ * DELETED:            Non-zero means the interpreter has been deleted:
3577+ *                     don't process any more commands for it, and destroy
3578+ *                     the structure as soon as all nested invocations of
3579+ *                     Tcl_Eval are done.
3580+ * ERR_ALREADY_LOGGED: Non-zero means information has already been logged in
3581+ *                     iPtr->errorInfo for the current Tcl_Eval instance, so
3582+ *                     Tcl_Eval needn't log it (used to implement the "error
3583+ *                     message log" command).
3584+ * DONT_COMPILE_CMDS_INLINE: Non-zero means that the bytecode compiler should
3585+ *                     not compile any commands into an inline sequence of
3586+ *                     instructions. This is set 1, for example, when command
3587+ *                     traces are requested.
3588+ * RAND_SEED_INITIALIZED: Non-zero means that the randSeed value of the interp
3589+ *                     has not be initialized. This is set 1 when we first
3590+ *                     use the rand() or srand() functions.
3591+ * SAFE_INTERP:                Non zero means that the current interp is a safe
3592+ *                     interp (i.e. it has only the safe commands installed,
3593+ *                     less priviledge than a regular interp).
3594+ * INTERP_DEBUG_FRAME: Used for switching on various extra interpreter
3595+ *                     debug/info mechanisms (e.g. info frame eval/uplevel
3596+ *                     tracing) which are performance intensive.
3597+ * INTERP_TRACE_IN_PROGRESS: Non-zero means that an interp trace is currently
3598+ *                     active; so no further trace callbacks should be
3599+ *                     invoked.
3600+ * INTERP_ALTERNATE_WRONG_ARGS: Used for listing second and subsequent forms
3601+ *                     of the wrong-num-args string in Tcl_WrongNumArgs.
3602+ *                     Makes it append instead of replacing and uses
3603+ *                     different intermediate text.
3604+ * CANCELED:           Non-zero means that the script in progress should be
3605+ *                     canceled as soon as possible. This can be checked by
3606+ *                     extensions (and the core itself) by calling
3607+ *                     Tcl_Canceled and checking if TCL_ERROR is returned.
3608+ *                     This is a one-shot flag that is reset immediately upon
3609+ *                     being detected; however, if the TCL_CANCEL_UNWIND flag
3610+ *                     is set Tcl_Canceled will continue to report that the
3611+ *                     script in progress has been canceled thereby allowing
3612+ *                     the evaluation stack for the interp to be fully
3613+ *                     unwound.
3614+ *
3615+ * WARNING: For the sake of some extensions that have made use of former
3616+ * internal values, do not re-use the flag values 2 (formerly ERR_IN_PROGRESS)
3617+ * or 8 (formerly ERROR_CODE_SET).
3618+ */
3619+
3620+#define DELETED                                     1
3621+#define ERR_ALREADY_LOGGED                  4
3622+#define INTERP_DEBUG_FRAME               0x10
3623+#define DONT_COMPILE_CMDS_INLINE         0x20
3624+#define RAND_SEED_INITIALIZED            0x40
3625+#define SAFE_INTERP                      0x80
3626+#define INTERP_TRACE_IN_PROGRESS        0x200
3627+#define INTERP_ALTERNATE_WRONG_ARGS     0x400
3628+#define ERR_LEGACY_COPY                         0x800
3629+#define CANCELED                       0x1000
3630+
3631+/*
3632+ * Maximum number of levels of nesting permitted in Tcl commands (used to
3633+ * catch infinite recursion).
3634+ */
3635+
3636+#define MAX_NESTING_DEPTH      1000
3637+
3638+/*
3639+ * TIP#143 limit handler internal representation.
3640+ */
3641+
3642+struct LimitHandler {
3643+    int flags;                 /* The state of this particular handler. */
3644+    Tcl_LimitHandlerProc *handlerProc;
3645+                               /* The handler callback. */
3646+    ClientData clientData;     /* Opaque argument to the handler callback. */
3647+    Tcl_LimitHandlerDeleteProc *deleteProc;
3648+                               /* How to delete the clientData. */
3649+    LimitHandler *prevPtr;     /* Previous item in linked list of
3650+                                * handlers. */
3651+    LimitHandler *nextPtr;     /* Next item in linked list of handlers. */
3652+};
3653+
3654+/*
3655+ * Values for the LimitHandler flags field.
3656+ *     LIMIT_HANDLER_ACTIVE - Whether the handler is currently being
3657+ *             processed; handlers are never to be entered reentrantly.
3658+ *     LIMIT_HANDLER_DELETED - Whether the handler has been deleted. This
3659+ *             should not normally be observed because when a handler is
3660+ *             deleted it is also spliced out of the list of handlers, but
3661+ *             even so we will be careful.
3662+ */
3663+
3664+#define LIMIT_HANDLER_ACTIVE   0x01
3665+#define LIMIT_HANDLER_DELETED  0x02
3666+
3667+/*
3668+ * The macro below is used to modify a "char" value (e.g. by casting it to an
3669+ * unsigned character) so that it can be used safely with macros such as
3670+ * isspace.
3671+ */
3672+
3673+#define UCHAR(c) ((unsigned char) (c))
3674+
3675+/*
3676+ * This macro is used to properly align the memory allocated by Tcl, giving
3677+ * the same alignment as the native malloc.
3678+ */
3679+
3680+#if defined(__APPLE__)
3681+#define TCL_ALLOCALIGN 16
3682+#else
3683+#define TCL_ALLOCALIGN (2*sizeof(void *))
3684+#endif
3685+
3686+/*
3687+ * This macro is used to determine the offset needed to safely allocate any
3688+ * data structure in memory. Given a starting offset or size, it "rounds up"
3689+ * or "aligns" the offset to the next 8-byte boundary so that any data
3690+ * structure can be placed at the resulting offset without fear of an
3691+ * alignment error.
3692+ *
3693+ * WARNING!! DO NOT USE THIS MACRO TO ALIGN POINTERS: it will produce the
3694+ * wrong result on platforms that allocate addresses that are divisible by 4
3695+ * or 2. Only use it for offsets or sizes.
3696+ *
3697+ * This macro is only used by tclCompile.c in the core (Bug 926445). It
3698+ * however not be made file static, as extensions that touch bytecodes
3699+ * (notably tbcload) require it.
3700+ */
3701+
3702+#define TCL_ALIGN(x) (((int)(x) + 7) & ~7)
3703+
3704+/*
3705+ * The following enum values are used to specify the runtime platform setting
3706+ * of the tclPlatform variable.
3707+ */
3708+
3709+typedef enum {
3710+    TCL_PLATFORM_UNIX = 0,     /* Any Unix-like OS. */
3711+    TCL_PLATFORM_WINDOWS = 2   /* Any Microsoft Windows OS. */
3712+} TclPlatformType;
3713+
3714+/*
3715+ * The following enum values are used to indicate the translation of a Tcl
3716+ * channel. Declared here so that each platform can define
3717+ * TCL_PLATFORM_TRANSLATION to the native translation on that platform.
3718+ */
3719+
3720+typedef enum TclEolTranslation {
3721+    TCL_TRANSLATE_AUTO,                /* Eol == \r, \n and \r\n. */
3722+    TCL_TRANSLATE_CR,          /* Eol == \r. */
3723+    TCL_TRANSLATE_LF,          /* Eol == \n. */
3724+    TCL_TRANSLATE_CRLF         /* Eol == \r\n. */
3725+} TclEolTranslation;
3726+
3727+/*
3728+ * Flags for TclInvoke:
3729+ *
3730+ * TCL_INVOKE_HIDDEN           Invoke a hidden command; if not set, invokes
3731+ *                             an exposed command.
3732+ * TCL_INVOKE_NO_UNKNOWN       If set, "unknown" is not invoked if the
3733+ *                             command to be invoked is not found. Only has
3734+ *                             an effect if invoking an exposed command,
3735+ *                             i.e. if TCL_INVOKE_HIDDEN is not also set.
3736+ * TCL_INVOKE_NO_TRACEBACK     Does not record traceback information if the
3737+ *                             invoked command returns an error. Used if the
3738+ *                             caller plans on recording its own traceback
3739+ *                             information.
3740+ */
3741+
3742+#define        TCL_INVOKE_HIDDEN       (1<<0)
3743+#define TCL_INVOKE_NO_UNKNOWN  (1<<1)
3744+#define TCL_INVOKE_NO_TRACEBACK        (1<<2)
3745+
3746+/*
3747+ * The structure used as the internal representation of Tcl list objects. This
3748+ * struct is grown (reallocated and copied) as necessary to hold all the
3749+ * list's element pointers. The struct might contain more slots than currently
3750+ * used to hold all element pointers. This is done to make append operations
3751+ * faster.
3752+ */
3753+
3754+typedef struct List {
3755+    int refCount;
3756+    int maxElemCount;          /* Total number of element array slots. */
3757+    int elemCount;             /* Current number of list elements. */
3758+    int canonicalFlag;         /* Set if the string representation was
3759+                                * derived from the list representation. May
3760+                                * be ignored if there is no string rep at
3761+                                * all.*/
3762+    Tcl_Obj *elements;         /* First list element; the struct is grown to
3763+                                * accomodate all elements. */
3764+} List;
3765+
3766+#define LIST_MAX \
3767+       (1 + (int)(((size_t)UINT_MAX - sizeof(List))/sizeof(Tcl_Obj *)))
3768+#define LIST_SIZE(numElems) \
3769+       (unsigned)(sizeof(List) + (((numElems) - 1) * sizeof(Tcl_Obj *)))
3770+
3771+/*
3772+ * Macro used to get the elements of a list object.
3773+ */
3774+
3775+#define ListRepPtr(listPtr) \
3776+    ((List *) (listPtr)->internalRep.twoPtrValue.ptr1)
3777+
3778+#define ListSetIntRep(objPtr, listRepPtr) \
3779+    (objPtr)->internalRep.twoPtrValue.ptr1 = (void *)(listRepPtr), \
3780+    (objPtr)->internalRep.twoPtrValue.ptr2 = NULL, \
3781+    (listRepPtr)->refCount++, \
3782+    (objPtr)->typePtr = &tclListType
3783+
3784+#define ListObjGetElements(listPtr, objc, objv) \
3785+    ((objv) = &(ListRepPtr(listPtr)->elements), \
3786+     (objc) = ListRepPtr(listPtr)->elemCount)
3787+
3788+#define ListObjLength(listPtr, len) \
3789+    ((len) = ListRepPtr(listPtr)->elemCount)
3790+
3791+#define ListObjIsCanonical(listPtr) \
3792+    (((listPtr)->bytes == NULL) || ListRepPtr(listPtr)->canonicalFlag)
3793+
3794+#define TclListObjGetElements(interp, listPtr, objcPtr, objvPtr) \
3795+    (((listPtr)->typePtr == &tclListType) \
3796+           ? ((ListObjGetElements((listPtr), *(objcPtr), *(objvPtr))), TCL_OK)\
3797+           : Tcl_ListObjGetElements((interp), (listPtr), (objcPtr), (objvPtr)))
3798+
3799+#define TclListObjLength(interp, listPtr, lenPtr) \
3800+    (((listPtr)->typePtr == &tclListType) \
3801+           ? ((ListObjLength((listPtr), *(lenPtr))), TCL_OK)\
3802+           : Tcl_ListObjLength((interp), (listPtr), (lenPtr)))
3803+
3804+#define TclListObjIsCanonical(listPtr) \
3805+    (((listPtr)->typePtr == &tclListType) ? ListObjIsCanonical((listPtr)) : 0)
3806+
3807+/*
3808+ * Modes for collecting (or not) in the implementations of TclNRForeachCmd,
3809+ * TclNRLmapCmd and their compilations.
3810+ */
3811+
3812+#define TCL_EACH_KEEP_NONE  0  /* Discard iteration result like [foreach] */
3813+#define TCL_EACH_COLLECT    1  /* Collect iteration result like [lmap] */
3814+
3815+/*
3816+ * Macros providing a faster path to integers: Tcl_GetLongFromObj everywhere,
3817+ * Tcl_GetIntFromObj and TclGetIntForIndex on platforms where longs are ints.
3818+ *
3819+ * WARNING: these macros eval their args more than once.
3820+ */
3821+
3822+#define TclGetLongFromObj(interp, objPtr, longPtr) \
3823+    (((objPtr)->typePtr == &tclIntType)        \
3824+           ? ((*(longPtr) = (objPtr)->internalRep.longValue), TCL_OK) \
3825+           : Tcl_GetLongFromObj((interp), (objPtr), (longPtr)))
3826+
3827+#if (LONG_MAX == INT_MAX)
3828+#define TclGetIntFromObj(interp, objPtr, intPtr) \
3829+    (((objPtr)->typePtr == &tclIntType)        \
3830+           ? ((*(intPtr) = (objPtr)->internalRep.longValue), TCL_OK) \
3831+           : Tcl_GetIntFromObj((interp), (objPtr), (intPtr)))
3832+#define TclGetIntForIndexM(interp, objPtr, endValue, idxPtr) \
3833+    (((objPtr)->typePtr == &tclIntType)        \
3834+           ? ((*(idxPtr) = (objPtr)->internalRep.longValue), TCL_OK) \
3835+           : TclGetIntForIndex((interp), (objPtr), (endValue), (idxPtr)))
3836+#else
3837+#define TclGetIntFromObj(interp, objPtr, intPtr) \
3838+    Tcl_GetIntFromObj((interp), (objPtr), (intPtr))
3839+#define TclGetIntForIndexM(interp, objPtr, ignore, idxPtr)     \
3840+    TclGetIntForIndex(interp, objPtr, ignore, idxPtr)
3841+#endif
3842+
3843+/*
3844+ * Flag values for TclTraceDictPath().
3845+ *
3846+ * DICT_PATH_READ indicates that all entries on the path must exist but no
3847+ * updates will be needed.
3848+ *
3849+ * DICT_PATH_UPDATE indicates that we are going to be doing an update at the
3850+ * tip of the path, so duplication of shared objects should be done along the
3851+ * way.
3852+ *
3853+ * DICT_PATH_EXISTS indicates that we are performing an existance test and a
3854+ * lookup failure should therefore not be an error. If (and only if) this flag
3855+ * is set, TclTraceDictPath() will return the special value
3856+ * DICT_PATH_NON_EXISTENT if the path is not traceable.
3857+ *
3858+ * DICT_PATH_CREATE (which also requires the DICT_PATH_UPDATE bit to be set)
3859+ * indicates that we are to create non-existant dictionaries on the path.
3860+ */
3861+
3862+#define DICT_PATH_READ         0
3863+#define DICT_PATH_UPDATE       1
3864+#define DICT_PATH_EXISTS       2
3865+#define DICT_PATH_CREATE       5
3866+
3867+#define DICT_PATH_NON_EXISTENT ((Tcl_Obj *) (void *) 1)
3868+
3869+/*
3870+ *----------------------------------------------------------------
3871+ * Data structures related to the filesystem internals
3872+ *----------------------------------------------------------------
3873+ */
3874+
3875+/*
3876+ * The version_2 filesystem is private to Tcl. As and when these changes have
3877+ * been thoroughly tested and investigated a new public filesystem interface
3878+ * will be released. The aim is more versatile virtual filesystem interfaces,
3879+ * more efficiency in 'path' manipulation and usage, and cleaner filesystem
3880+ * code internally.
3881+ */
3882+
3883+#define TCL_FILESYSTEM_VERSION_2       ((Tcl_FSVersion) 0x2)
3884+typedef ClientData (TclFSGetCwdProc2)(ClientData clientData);
3885+typedef int (Tcl_FSLoadFileProc2) (Tcl_Interp *interp, Tcl_Obj *pathPtr,
3886+       Tcl_LoadHandle *handlePtr, Tcl_FSUnloadFileProc **unloadProcPtr, int flags);
3887+
3888+/*
3889+ * The following types are used for getting and storing platform-specific file
3890+ * attributes in tclFCmd.c and the various platform-versions of that file.
3891+ * This is done to have as much common code as possible in the file attributes
3892+ * code. For more information about the callbacks, see TclFileAttrsCmd in
3893+ * tclFCmd.c.
3894+ */
3895+
3896+typedef int (TclGetFileAttrProc)(Tcl_Interp *interp, int objIndex,
3897+       Tcl_Obj *fileName, Tcl_Obj **attrObjPtrPtr);
3898+typedef int (TclSetFileAttrProc)(Tcl_Interp *interp, int objIndex,
3899+       Tcl_Obj *fileName, Tcl_Obj *attrObjPtr);
3900+
3901+typedef struct TclFileAttrProcs {
3902+    TclGetFileAttrProc *getProc;/* The procedure for getting attrs. */
3903+    TclSetFileAttrProc *setProc;/* The procedure for setting attrs. */
3904+} TclFileAttrProcs;
3905+
3906+/*
3907+ * Opaque handle used in pipeline routines to encapsulate platform-dependent
3908+ * state.
3909+ */
3910+
3911+typedef struct TclFile_ *TclFile;
3912+
3913+/*
3914+ * The "globParameters" argument of the function TclGlob is an or'ed
3915+ * combination of the following values:
3916+ */
3917+
3918+#define TCL_GLOBMODE_NO_COMPLAIN       1
3919+#define TCL_GLOBMODE_JOIN              2
3920+#define TCL_GLOBMODE_DIR               4
3921+#define TCL_GLOBMODE_TAILS             8
3922+
3923+typedef enum Tcl_PathPart {
3924+    TCL_PATH_DIRNAME,
3925+    TCL_PATH_TAIL,
3926+    TCL_PATH_EXTENSION,
3927+    TCL_PATH_ROOT
3928+} Tcl_PathPart;
3929+
3930+/*
3931+ *----------------------------------------------------------------
3932+ * Data structures related to obsolete filesystem hooks
3933+ *----------------------------------------------------------------
3934+ */
3935+
3936+typedef int (TclStatProc_)(const char *path, struct stat *buf);
3937+typedef int (TclAccessProc_)(const char *path, int mode);
3938+typedef Tcl_Channel (TclOpenFileChannelProc_)(Tcl_Interp *interp,
3939+       const char *fileName, const char *modeString, int permissions);
3940+
3941+/*
3942+ *----------------------------------------------------------------
3943+ * Data structures related to procedures
3944+ *----------------------------------------------------------------
3945+ */
3946+
3947+typedef Tcl_CmdProc *TclCmdProcType;
3948+typedef Tcl_ObjCmdProc *TclObjCmdProcType;
3949+
3950+/*
3951+ *----------------------------------------------------------------
3952+ * Data structures for process-global values.
3953+ *----------------------------------------------------------------
3954+ */
3955+
3956+typedef void (TclInitProcessGlobalValueProc)(char **valuePtr, int *lengthPtr,
3957+       Tcl_Encoding *encodingPtr);
3958+
3959+/*
3960+ * A ProcessGlobalValue struct exists for each internal value in Tcl that is
3961+ * to be shared among several threads. Each thread sees a (Tcl_Obj) copy of
3962+ * the value, and the master is kept as a counted string, with epoch and mutex
3963+ * control. Each ProcessGlobalValue struct should be a static variable in some
3964+ * file.
3965+ */
3966+
3967+typedef struct ProcessGlobalValue {
3968+    int epoch;                 /* Epoch counter to detect changes in the
3969+                                * master value. */
3970+    int numBytes;              /* Length of the master string. */
3971+    char *value;               /* The master string value. */
3972+    Tcl_Encoding encoding;     /* system encoding when master string was
3973+                                * initialized. */
3974+    TclInitProcessGlobalValueProc *proc;
3975+                               /* A procedure to initialize the master string
3976+                                * copy when a "get" request comes in before
3977+                                * any "set" request has been received. */
3978+    Tcl_Mutex mutex;           /* Enforce orderly access from multiple
3979+                                * threads. */
3980+    Tcl_ThreadDataKey key;     /* Key for per-thread data holding the
3981+                                * (Tcl_Obj) copy for each thread. */
3982+} ProcessGlobalValue;
3983+
3984+/*
3985+ *----------------------------------------------------------------------
3986+ * Flags for TclParseNumber
3987+ *----------------------------------------------------------------------
3988+ */
3989+
3990+#define TCL_PARSE_DECIMAL_ONLY         1
3991+                               /* Leading zero doesn't denote octal or
3992+                                * hex. */
3993+#define TCL_PARSE_OCTAL_ONLY           2
3994+                               /* Parse octal even without prefix. */
3995+#define TCL_PARSE_HEXADECIMAL_ONLY     4
3996+                               /* Parse hexadecimal even without prefix. */
3997+#define TCL_PARSE_INTEGER_ONLY         8
3998+                               /* Disable floating point parsing. */
3999+#define TCL_PARSE_SCAN_PREFIXES                16
4000+                               /* Use [scan] rules dealing with 0?
4001+                                * prefixes. */
4002+#define TCL_PARSE_NO_WHITESPACE                32
4003+                               /* Reject leading/trailing whitespace. */
4004+#define TCL_PARSE_BINARY_ONLY  64
4005+                               /* Parse binary even without prefix. */
4006+
4007+/*
4008+ *----------------------------------------------------------------------
4009+ * Type values TclGetNumberFromObj
4010+ *----------------------------------------------------------------------
4011+ */
4012+
4013+#define TCL_NUMBER_LONG                1
4014+#define TCL_NUMBER_WIDE                2
4015+#define TCL_NUMBER_BIG         3
4016+#define TCL_NUMBER_DOUBLE      4
4017+#define TCL_NUMBER_NAN         5
4018+
4019+/*
4020+ *----------------------------------------------------------------
4021+ * Variables shared among Tcl modules but not used by the outside world.
4022+ *----------------------------------------------------------------
4023+ */
4024+
4025+MODULE_SCOPE char *tclNativeExecutableName;
4026+MODULE_SCOPE int tclFindExecutableSearchDone;
4027+MODULE_SCOPE char *tclMemDumpFileName;
4028+MODULE_SCOPE TclPlatformType tclPlatform;
4029+MODULE_SCOPE Tcl_NotifierProcs tclNotifierHooks;
4030+
4031+/*
4032+ * TIP #233 (Virtualized Time)
4033+ * Data for the time hooks, if any.
4034+ */
4035+
4036+MODULE_SCOPE Tcl_GetTimeProc *tclGetTimeProcPtr;
4037+MODULE_SCOPE Tcl_ScaleTimeProc *tclScaleTimeProcPtr;
4038+MODULE_SCOPE ClientData tclTimeClientData;
4039+
4040+/*
4041+ * Variables denoting the Tcl object types defined in the core.
4042+ */
4043+
4044+MODULE_SCOPE const Tcl_ObjType tclBignumType;
4045+MODULE_SCOPE const Tcl_ObjType tclBooleanType;
4046+MODULE_SCOPE const Tcl_ObjType tclByteArrayType;
4047+MODULE_SCOPE const Tcl_ObjType tclByteCodeType;
4048+MODULE_SCOPE const Tcl_ObjType tclDoubleType;
4049+MODULE_SCOPE const Tcl_ObjType tclEndOffsetType;
4050+MODULE_SCOPE const Tcl_ObjType tclIntType;
4051+MODULE_SCOPE const Tcl_ObjType tclListType;
4052+MODULE_SCOPE const Tcl_ObjType tclDictType;
4053+MODULE_SCOPE const Tcl_ObjType tclProcBodyType;
4054+MODULE_SCOPE const Tcl_ObjType tclStringType;
4055+MODULE_SCOPE const Tcl_ObjType tclArraySearchType;
4056+MODULE_SCOPE const Tcl_ObjType tclEnsembleCmdType;
4057+#ifndef NO_WIDE_TYPE
4058+MODULE_SCOPE const Tcl_ObjType tclWideIntType;
4059+#endif
4060+MODULE_SCOPE const Tcl_ObjType tclRegexpType;
4061+MODULE_SCOPE Tcl_ObjType tclCmdNameType;
4062+
4063+/*
4064+ * Variables denoting the hash key types defined in the core.
4065+ */
4066+
4067+MODULE_SCOPE const Tcl_HashKeyType tclArrayHashKeyType;
4068+MODULE_SCOPE const Tcl_HashKeyType tclOneWordHashKeyType;
4069+MODULE_SCOPE const Tcl_HashKeyType tclStringHashKeyType;
4070+MODULE_SCOPE const Tcl_HashKeyType tclObjHashKeyType;
4071+
4072+/*
4073+ * The head of the list of free Tcl objects, and the total number of Tcl
4074+ * objects ever allocated and freed.
4075+ */
4076+
4077+MODULE_SCOPE Tcl_Obj * tclFreeObjList;
4078+
4079+#ifdef TCL_COMPILE_STATS
4080+MODULE_SCOPE long      tclObjsAlloced;
4081+MODULE_SCOPE long      tclObjsFreed;
4082+#define TCL_MAX_SHARED_OBJ_STATS 5
4083+MODULE_SCOPE long      tclObjsShared[TCL_MAX_SHARED_OBJ_STATS];
4084+#endif /* TCL_COMPILE_STATS */
4085+
4086+/*
4087+ * Pointer to a heap-allocated string of length zero that the Tcl core uses as
4088+ * the value of an empty string representation for an object. This value is
4089+ * shared by all new objects allocated by Tcl_NewObj.
4090+ */
4091+
4092+MODULE_SCOPE char *    tclEmptyStringRep;
4093+MODULE_SCOPE char      tclEmptyString;
4094+
4095+/*
4096+ *----------------------------------------------------------------
4097+ * Procedures shared among Tcl modules but not used by the outside world,
4098+ * introduced by/for NRE.
4099+ *----------------------------------------------------------------
4100+ */
4101+
4102+MODULE_SCOPE Tcl_ObjCmdProc TclNRApplyObjCmd;
4103+MODULE_SCOPE Tcl_ObjCmdProc TclNREvalObjCmd;
4104+MODULE_SCOPE Tcl_ObjCmdProc TclNRCatchObjCmd;
4105+MODULE_SCOPE Tcl_ObjCmdProc TclNRExprObjCmd;
4106+MODULE_SCOPE Tcl_ObjCmdProc TclNRForObjCmd;
4107+MODULE_SCOPE Tcl_ObjCmdProc TclNRForeachCmd;
4108+MODULE_SCOPE Tcl_ObjCmdProc TclNRIfObjCmd;
4109+MODULE_SCOPE Tcl_ObjCmdProc TclNRLmapCmd;
4110+MODULE_SCOPE Tcl_ObjCmdProc TclNRSourceObjCmd;
4111+MODULE_SCOPE Tcl_ObjCmdProc TclNRSubstObjCmd;
4112+MODULE_SCOPE Tcl_ObjCmdProc TclNRSwitchObjCmd;
4113+MODULE_SCOPE Tcl_ObjCmdProc TclNRTryObjCmd;
4114+MODULE_SCOPE Tcl_ObjCmdProc TclNRUplevelObjCmd;
4115+MODULE_SCOPE Tcl_ObjCmdProc TclNRWhileObjCmd;
4116+
4117+MODULE_SCOPE Tcl_NRPostProc TclNRForIterCallback;
4118+MODULE_SCOPE Tcl_NRPostProc TclNRCoroutineActivateCallback;
4119+MODULE_SCOPE Tcl_ObjCmdProc TclNRTailcallObjCmd;
4120+MODULE_SCOPE Tcl_NRPostProc TclNRTailcallEval;
4121+MODULE_SCOPE Tcl_ObjCmdProc TclNRCoroutineObjCmd;
4122+MODULE_SCOPE Tcl_ObjCmdProc TclNRYieldObjCmd;
4123+MODULE_SCOPE Tcl_ObjCmdProc TclNRYieldmObjCmd;
4124+MODULE_SCOPE Tcl_ObjCmdProc TclNRYieldToObjCmd;
4125+
4126+MODULE_SCOPE void  TclSpliceTailcall(Tcl_Interp *interp,
4127+                      struct NRE_callback *tailcallPtr);
4128+
4129+/*
4130+ * This structure holds the data for the various iteration callbacks used to
4131+ * NRE the 'for' and 'while' commands. We need a separate structure because we
4132+ * have more than the 4 client data entries we can provide directly thorugh
4133+ * the callback API. It is the 'word' information which puts us over the
4134+ * limit. It is needed because the loop body is argument 4 of 'for' and
4135+ * argument 2 of 'while'. Not providing the correct index confuses the #280
4136+ * code. We TclSmallAlloc/Free this.
4137+ */
4138+
4139+typedef struct ForIterData {
4140+    Tcl_Obj *cond;             /* Loop condition expression. */
4141+    Tcl_Obj *body;             /* Loop body. */
4142+    Tcl_Obj *next;             /* Loop step script, NULL for 'while'. */
4143+    const char *msg;           /* Error message part. */
4144+    int word;                  /* Index of the body script in the command */
4145+} ForIterData;
4146+
4147+/* TIP #357 - Structure doing the bookkeeping of handles for Tcl_LoadFile
4148+ *            and Tcl_FindSymbol. This structure corresponds to an opaque
4149+ *            typedef in tcl.h */
4150+
4151+typedef void* TclFindSymbolProc(Tcl_Interp* interp, Tcl_LoadHandle loadHandle,
4152+                               const char* symbol);
4153+struct Tcl_LoadHandle_ {
4154+    ClientData clientData;     /* Client data is the load handle in the
4155+                                * native filesystem if a module was loaded
4156+                                * there, or an opaque pointer to a structure
4157+                                * for further bookkeeping on load-from-VFS
4158+                                * and load-from-memory */
4159+    TclFindSymbolProc* findSymbolProcPtr;
4160+                               /* Procedure that resolves symbols in a
4161+                                * loaded module */
4162+    Tcl_FSUnloadFileProc* unloadFileProcPtr;
4163+                               /* Procedure that unloads a loaded module */
4164+};
4165+
4166+/* Flags for conversion of doubles to digit strings */
4167+
4168+#define TCL_DD_SHORTEST                0x4
4169+                               /* Use the shortest possible string */
4170+#define TCL_DD_STEELE                  0x5
4171+                               /* Use the original Steele&White algorithm */
4172+#define TCL_DD_E_FORMAT                0x2
4173+                               /* Use a fixed-length string of digits,
4174+                                * suitable for E format*/
4175+#define TCL_DD_F_FORMAT                0x3
4176+                               /* Use a fixed number of digits after the
4177+                                * decimal point, suitable for F format */
4178+
4179+#define TCL_DD_SHORTEN_FLAG            0x4
4180+                               /* Allow return of a shorter digit string
4181+                                * if it converts losslessly */
4182+#define TCL_DD_NO_QUICK                0x8
4183+                               /* Debug flag: forbid quick FP conversion */
4184+
4185+#define TCL_DD_CONVERSION_TYPE_MASK    0x3
4186+                               /* Mask to isolate the conversion type */
4187+#define TCL_DD_STEELE0                         0x1
4188+                               /* 'Steele&White' after masking */
4189+#define TCL_DD_SHORTEST0               0x0
4190+                               /* 'Shortest possible' after masking */
4191+
4192+/*
4193+ *----------------------------------------------------------------
4194+ * Procedures shared among Tcl modules but not used by the outside world:
4195+ *----------------------------------------------------------------
4196+ */
4197+
4198+MODULE_SCOPE void      TclAppendBytesToByteArray(Tcl_Obj *objPtr,
4199+                           const unsigned char *bytes, int len);
4200+MODULE_SCOPE int       TclNREvalCmd(Tcl_Interp *interp, Tcl_Obj *objPtr,
4201+                           int flags);
4202+MODULE_SCOPE void      TclPushTailcallPoint(Tcl_Interp *interp);
4203+MODULE_SCOPE void      TclAdvanceContinuations(int *line, int **next,
4204+                           int loc);
4205+MODULE_SCOPE void      TclAdvanceLines(int *line, const char *start,
4206+                           const char *end);
4207+MODULE_SCOPE void      TclArgumentEnter(Tcl_Interp *interp,
4208+                           Tcl_Obj *objv[], int objc, CmdFrame *cf);
4209+MODULE_SCOPE void      TclArgumentRelease(Tcl_Interp *interp,
4210+                           Tcl_Obj *objv[], int objc);
4211+MODULE_SCOPE void      TclArgumentBCEnter(Tcl_Interp *interp,
4212+                           Tcl_Obj *objv[], int objc,
4213+                           void *codePtr, CmdFrame *cfPtr, int pc);
4214+MODULE_SCOPE void      TclArgumentBCRelease(Tcl_Interp *interp,
4215+                           CmdFrame *cfPtr);
4216+MODULE_SCOPE void      TclArgumentGet(Tcl_Interp *interp, Tcl_Obj *obj,
4217+                           CmdFrame **cfPtrPtr, int *wordPtr);
4218+MODULE_SCOPE int       TclArraySet(Tcl_Interp *interp,
4219+                           Tcl_Obj *arrayNameObj, Tcl_Obj *arrayElemObj);
4220+MODULE_SCOPE double    TclBignumToDouble(const mp_int *bignum);
4221+MODULE_SCOPE int       TclByteArrayMatch(const unsigned char *string,
4222+                           int strLen, const unsigned char *pattern,
4223+                           int ptnLen, int flags);
4224+MODULE_SCOPE double    TclCeil(const mp_int *a);
4225+MODULE_SCOPE int       TclCheckBadOctal(Tcl_Interp *interp,
4226+                           const char *value);
4227+MODULE_SCOPE int       TclChanCaughtErrorBypass(Tcl_Interp *interp,
4228+                           Tcl_Channel chan);
4229+MODULE_SCOPE Tcl_ObjCmdProc TclChannelNamesCmd;
4230+MODULE_SCOPE int       TclClearRootEnsemble(ClientData data[],
4231+                           Tcl_Interp *interp, int result);
4232+MODULE_SCOPE ContLineLoc *TclContinuationsEnter(Tcl_Obj *objPtr, int num,
4233+                           int *loc);
4234+MODULE_SCOPE void      TclContinuationsEnterDerived(Tcl_Obj *objPtr,
4235+                           int start, int *clNext);
4236+MODULE_SCOPE ContLineLoc *TclContinuationsGet(Tcl_Obj *objPtr);
4237+MODULE_SCOPE void      TclContinuationsCopy(Tcl_Obj *objPtr,
4238+                           Tcl_Obj *originObjPtr);
4239+MODULE_SCOPE int       TclConvertElement(const char *src, int length,
4240+                           char *dst, int flags);
4241+MODULE_SCOPE void      TclDeleteNamespaceVars(Namespace *nsPtr);
4242+/* TIP #280 - Modified token based evulation, with line information. */
4243+MODULE_SCOPE int       TclEvalEx(Tcl_Interp *interp, const char *script,
4244+                           int numBytes, int flags, int line,
4245+                           int *clNextOuter, const char *outerScript);
4246+MODULE_SCOPE Tcl_ObjCmdProc TclFileAttrsCmd;
4247+MODULE_SCOPE Tcl_ObjCmdProc TclFileCopyCmd;
4248+MODULE_SCOPE Tcl_ObjCmdProc TclFileDeleteCmd;
4249+MODULE_SCOPE Tcl_ObjCmdProc TclFileLinkCmd;
4250+MODULE_SCOPE Tcl_ObjCmdProc TclFileMakeDirsCmd;
4251+MODULE_SCOPE Tcl_ObjCmdProc TclFileReadLinkCmd;
4252+MODULE_SCOPE Tcl_ObjCmdProc TclFileRenameCmd;
4253+MODULE_SCOPE Tcl_ObjCmdProc TclFileTemporaryCmd;
4254+MODULE_SCOPE void      TclCreateLateExitHandler(Tcl_ExitProc *proc,
4255+                           ClientData clientData);
4256+MODULE_SCOPE void      TclDeleteLateExitHandler(Tcl_ExitProc *proc,
4257+                           ClientData clientData);
4258+MODULE_SCOPE char *    TclDStringAppendObj(Tcl_DString *dsPtr,
4259+                           Tcl_Obj *objPtr);
4260+MODULE_SCOPE char *    TclDStringAppendDString(Tcl_DString *dsPtr,
4261+                           Tcl_DString *toAppendPtr);
4262+MODULE_SCOPE Tcl_Obj * TclDStringToObj(Tcl_DString *dsPtr);
4263+MODULE_SCOPE void      TclFinalizeAllocSubsystem(void);
4264+MODULE_SCOPE void      TclFinalizeAsync(void);
4265+MODULE_SCOPE void      TclFinalizeDoubleConversion(void);
4266+MODULE_SCOPE void      TclFinalizeEncodingSubsystem(void);
4267+MODULE_SCOPE void      TclFinalizeEnvironment(void);
4268+MODULE_SCOPE void      TclFinalizeEvaluation(void);
4269+MODULE_SCOPE void      TclFinalizeExecution(void);
4270+MODULE_SCOPE void      TclFinalizeIOSubsystem(void);
4271+MODULE_SCOPE void      TclFinalizeFilesystem(void);
4272+MODULE_SCOPE void      TclResetFilesystem(void);
4273+MODULE_SCOPE void      TclFinalizeLoad(void);
4274+MODULE_SCOPE void      TclFinalizeLock(void);
4275+MODULE_SCOPE void      TclFinalizeMemorySubsystem(void);
4276+MODULE_SCOPE void      TclFinalizeNotifier(void);
4277+MODULE_SCOPE void      TclFinalizeObjects(void);
4278+MODULE_SCOPE void      TclFinalizePreserve(void);
4279+MODULE_SCOPE void      TclFinalizeSynchronization(void);
4280+MODULE_SCOPE void      TclFinalizeThreadAlloc(void);
4281+MODULE_SCOPE void      TclFinalizeThreadData(void);
4282+MODULE_SCOPE void      TclFinalizeThreadObjects(void);
4283+MODULE_SCOPE double    TclFloor(const mp_int *a);
4284+MODULE_SCOPE void      TclFormatNaN(double value, char *buffer);
4285+MODULE_SCOPE int       TclFSFileAttrIndex(Tcl_Obj *pathPtr,
4286+                           const char *attributeName, int *indexPtr);
4287+MODULE_SCOPE int       TclNREvalFile(Tcl_Interp *interp, Tcl_Obj *pathPtr,
4288+                           const char *encodingName);
4289+MODULE_SCOPE void      TclFSUnloadTempFile(Tcl_LoadHandle loadHandle);
4290+MODULE_SCOPE int *     TclGetAsyncReadyPtr(void);
4291+MODULE_SCOPE Tcl_Obj * TclGetBgErrorHandler(Tcl_Interp *interp);
4292+MODULE_SCOPE int       TclGetChannelFromObj(Tcl_Interp *interp,
4293+                           Tcl_Obj *objPtr, Tcl_Channel *chanPtr,
4294+                           int *modePtr, int flags);
4295+MODULE_SCOPE int TclGetCompletionCodeFromObj(Tcl_Interp *interp,
4296+                           Tcl_Obj *value, int *code);
4297+MODULE_SCOPE int       TclGetNumberFromObj(Tcl_Interp *interp,
4298+                           Tcl_Obj *objPtr, ClientData *clientDataPtr,
4299+                           int *typePtr);
4300+MODULE_SCOPE int       TclGetOpenModeEx(Tcl_Interp *interp,
4301+                           const char *modeString, int *seekFlagPtr,
4302+                           int *binaryPtr);
4303+MODULE_SCOPE Tcl_Obj * TclGetProcessGlobalValue(ProcessGlobalValue *pgvPtr);
4304+MODULE_SCOPE const char *TclGetSrcInfoForCmd(Interp *iPtr, int *lenPtr);
4305+MODULE_SCOPE int       TclGlob(Tcl_Interp *interp, char *pattern,
4306+                           Tcl_Obj *unquotedPrefix, int globFlags,
4307+                           Tcl_GlobTypeData *types);
4308+MODULE_SCOPE int       TclIncrObj(Tcl_Interp *interp, Tcl_Obj *valuePtr,
4309+                           Tcl_Obj *incrPtr);
4310+MODULE_SCOPE Tcl_Obj * TclIncrObjVar2(Tcl_Interp *interp, Tcl_Obj *part1Ptr,
4311+                           Tcl_Obj *part2Ptr, Tcl_Obj *incrPtr, int flags);
4312+MODULE_SCOPE int       TclInfoExistsCmd(ClientData dummy, Tcl_Interp *interp,
4313+                           int objc, Tcl_Obj *const objv[]);
4314+MODULE_SCOPE int       TclInfoCoroutineCmd(ClientData dummy, Tcl_Interp *interp,
4315+                           int objc, Tcl_Obj *const objv[]);
4316+MODULE_SCOPE Tcl_Obj * TclInfoFrame(Tcl_Interp *interp, CmdFrame *framePtr);
4317+MODULE_SCOPE int       TclInfoGlobalsCmd(ClientData dummy, Tcl_Interp *interp,
4318+                           int objc, Tcl_Obj *const objv[]);
4319+MODULE_SCOPE int       TclInfoLocalsCmd(ClientData dummy, Tcl_Interp *interp,
4320+                           int objc, Tcl_Obj *const objv[]);
4321+MODULE_SCOPE int       TclInfoVarsCmd(ClientData dummy, Tcl_Interp *interp,
4322+                           int objc, Tcl_Obj *const objv[]);
4323+MODULE_SCOPE void      TclInitAlloc(void);
4324+MODULE_SCOPE void      TclInitDbCkalloc(void);
4325+MODULE_SCOPE void      TclInitDoubleConversion(void);
4326+MODULE_SCOPE void      TclInitEmbeddedConfigurationInformation(
4327+                           Tcl_Interp *interp);
4328+MODULE_SCOPE void      TclInitEncodingSubsystem(void);
4329+MODULE_SCOPE void      TclInitIOSubsystem(void);
4330+MODULE_SCOPE void      TclInitLimitSupport(Tcl_Interp *interp);
4331+MODULE_SCOPE void      TclInitNamespaceSubsystem(void);
4332+MODULE_SCOPE void      TclInitNotifier(void);
4333+MODULE_SCOPE void      TclInitObjSubsystem(void);
4334+MODULE_SCOPE void      TclInitSubsystems(void);
4335+MODULE_SCOPE int       TclInterpReady(Tcl_Interp *interp);
4336+MODULE_SCOPE int       TclIsLocalScalar(const char *src, int len);
4337+MODULE_SCOPE int       TclIsSpaceProc(char byte);
4338+MODULE_SCOPE Tcl_Obj * TclJoinPath(int elements, Tcl_Obj * const objv[]);
4339+MODULE_SCOPE int       TclJoinThread(Tcl_ThreadId id, int *result);
4340+MODULE_SCOPE void      TclLimitRemoveAllHandlers(Tcl_Interp *interp);
4341+MODULE_SCOPE Tcl_Obj * TclLindexList(Tcl_Interp *interp,
4342+                           Tcl_Obj *listPtr, Tcl_Obj *argPtr);
4343+MODULE_SCOPE Tcl_Obj * TclLindexFlat(Tcl_Interp *interp, Tcl_Obj *listPtr,
4344+                           int indexCount, Tcl_Obj *const indexArray[]);
4345+/* TIP #280 */
4346+MODULE_SCOPE void      TclListLines(Tcl_Obj *listObj, int line, int n,
4347+                           int *lines, Tcl_Obj *const *elems);
4348+MODULE_SCOPE Tcl_Obj * TclListObjCopy(Tcl_Interp *interp, Tcl_Obj *listPtr);
4349+MODULE_SCOPE Tcl_Obj * TclLsetList(Tcl_Interp *interp, Tcl_Obj *listPtr,
4350+                           Tcl_Obj *indexPtr, Tcl_Obj *valuePtr);
4351+MODULE_SCOPE Tcl_Obj * TclLsetFlat(Tcl_Interp *interp, Tcl_Obj *listPtr,
4352+                           int indexCount, Tcl_Obj *const indexArray[],
4353+                           Tcl_Obj *valuePtr);
4354+MODULE_SCOPE Tcl_Command TclMakeEnsemble(Tcl_Interp *interp, const char *name,
4355+                           const EnsembleImplMap map[]);
4356+MODULE_SCOPE int       TclMaxListLength(const char *bytes, int numBytes,
4357+                           const char **endPtr);
4358+MODULE_SCOPE int       TclMergeReturnOptions(Tcl_Interp *interp, int objc,
4359+                           Tcl_Obj *const objv[], Tcl_Obj **optionsPtrPtr,
4360+                           int *codePtr, int *levelPtr);
4361+MODULE_SCOPE Tcl_Obj *  TclNoErrorStack(Tcl_Interp *interp, Tcl_Obj *options);
4362+MODULE_SCOPE int       TclNokia770Doubles(void);
4363+MODULE_SCOPE void      TclNsDecrRefCount(Namespace *nsPtr);
4364+MODULE_SCOPE void      TclObjVarErrMsg(Tcl_Interp *interp, Tcl_Obj *part1Ptr,
4365+                           Tcl_Obj *part2Ptr, const char *operation,
4366+                           const char *reason, int index);
4367+MODULE_SCOPE int       TclObjInvokeNamespace(Tcl_Interp *interp,
4368+                           int objc, Tcl_Obj *const objv[],
4369+                           Tcl_Namespace *nsPtr, int flags);
4370+MODULE_SCOPE int       TclObjUnsetVar2(Tcl_Interp *interp,
4371+                           Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, int flags);
4372+MODULE_SCOPE int       TclParseBackslash(const char *src,
4373+                           int numBytes, int *readPtr, char *dst);
4374+MODULE_SCOPE int       TclParseHex(const char *src, int numBytes,
4375+                           int *resultPtr);
4376+MODULE_SCOPE int       TclParseNumber(Tcl_Interp *interp, Tcl_Obj *objPtr,
4377+                           const char *expected, const char *bytes,
4378+                           int numBytes, const char **endPtrPtr, int flags);
4379+MODULE_SCOPE void      TclParseInit(Tcl_Interp *interp, const char *string,
4380+                           int numBytes, Tcl_Parse *parsePtr);
4381+MODULE_SCOPE int       TclParseAllWhiteSpace(const char *src, int numBytes);
4382+MODULE_SCOPE int       TclProcessReturn(Tcl_Interp *interp,
4383+                           int code, int level, Tcl_Obj *returnOpts);
4384+MODULE_SCOPE int       TclpObjLstat(Tcl_Obj *pathPtr, Tcl_StatBuf *buf);
4385+MODULE_SCOPE Tcl_Obj * TclpTempFileName(void);
4386+MODULE_SCOPE Tcl_Obj *  TclpTempFileNameForLibrary(Tcl_Interp *interp, Tcl_Obj* pathPtr);
4387+MODULE_SCOPE Tcl_Obj * TclNewFSPathObj(Tcl_Obj *dirPtr, const char *addStrRep,
4388+                           int len);
4389+MODULE_SCOPE int       TclpDeleteFile(const void *path);
4390+MODULE_SCOPE void      TclpFinalizeCondition(Tcl_Condition *condPtr);
4391+MODULE_SCOPE void      TclpFinalizeMutex(Tcl_Mutex *mutexPtr);
4392+MODULE_SCOPE void      TclpFinalizePipes(void);
4393+MODULE_SCOPE void      TclpFinalizeSockets(void);
4394+MODULE_SCOPE int       TclCreateSocketAddress(Tcl_Interp *interp,
4395+                           struct addrinfo **addrlist,
4396+                           const char *host, int port, int willBind,
4397+                           const char **errorMsgPtr);
4398+MODULE_SCOPE int       TclpThreadCreate(Tcl_ThreadId *idPtr,
4399+                           Tcl_ThreadCreateProc *proc, ClientData clientData,
4400+                           int stackSize, int flags);
4401+MODULE_SCOPE int       TclpFindVariable(const char *name, int *lengthPtr);
4402+MODULE_SCOPE void      TclpInitLibraryPath(char **valuePtr,
4403+                           int *lengthPtr, Tcl_Encoding *encodingPtr);
4404+MODULE_SCOPE void      TclpInitLock(void);
4405+MODULE_SCOPE void      TclpInitPlatform(void);
4406+MODULE_SCOPE void      TclpInitUnlock(void);
4407+MODULE_SCOPE Tcl_Obj * TclpObjListVolumes(void);
4408+MODULE_SCOPE void      TclpMasterLock(void);
4409+MODULE_SCOPE void      TclpMasterUnlock(void);
4410+MODULE_SCOPE int       TclpMatchFiles(Tcl_Interp *interp, char *separators,
4411+                           Tcl_DString *dirPtr, char *pattern, char *tail);
4412+MODULE_SCOPE int       TclpObjNormalizePath(Tcl_Interp *interp,
4413+                           Tcl_Obj *pathPtr, int nextCheckpoint);
4414+MODULE_SCOPE void      TclpNativeJoinPath(Tcl_Obj *prefix, const char *joining);
4415+MODULE_SCOPE Tcl_Obj * TclpNativeSplitPath(Tcl_Obj *pathPtr, int *lenPtr);
4416+MODULE_SCOPE Tcl_PathType TclpGetNativePathType(Tcl_Obj *pathPtr,
4417+                           int *driveNameLengthPtr, Tcl_Obj **driveNameRef);
4418+MODULE_SCOPE int       TclCrossFilesystemCopy(Tcl_Interp *interp,
4419+                           Tcl_Obj *source, Tcl_Obj *target);
4420+MODULE_SCOPE int       TclpMatchInDirectory(Tcl_Interp *interp,
4421+                           Tcl_Obj *resultPtr, Tcl_Obj *pathPtr,
4422+                           const char *pattern, Tcl_GlobTypeData *types);
4423+MODULE_SCOPE ClientData        TclpGetNativeCwd(ClientData clientData);
4424+MODULE_SCOPE Tcl_FSDupInternalRepProc TclNativeDupInternalRep;
4425+MODULE_SCOPE Tcl_Obj * TclpObjLink(Tcl_Obj *pathPtr, Tcl_Obj *toPtr,
4426+                           int linkType);
4427+MODULE_SCOPE int       TclpObjChdir(Tcl_Obj *pathPtr);
4428+MODULE_SCOPE Tcl_Channel TclpOpenTemporaryFile(Tcl_Obj *dirObj,
4429+                           Tcl_Obj *basenameObj, Tcl_Obj *extensionObj,
4430+                           Tcl_Obj *resultingNameObj);
4431+MODULE_SCOPE Tcl_Obj * TclPathPart(Tcl_Interp *interp, Tcl_Obj *pathPtr,
4432+                           Tcl_PathPart portion);
4433+MODULE_SCOPE char *    TclpReadlink(const char *fileName,
4434+                           Tcl_DString *linkPtr);
4435+MODULE_SCOPE void      TclpSetInterfaces(void);
4436+MODULE_SCOPE void      TclpSetVariables(Tcl_Interp *interp);
4437+MODULE_SCOPE void *    TclThreadStorageKeyGet(Tcl_ThreadDataKey *keyPtr);
4438+MODULE_SCOPE void      TclThreadStorageKeySet(Tcl_ThreadDataKey *keyPtr,
4439+                           void *data);
4440+MODULE_SCOPE void      TclpThreadExit(int status);
4441+MODULE_SCOPE void      TclRememberCondition(Tcl_Condition *mutex);
4442+MODULE_SCOPE void      TclRememberJoinableThread(Tcl_ThreadId id);
4443+MODULE_SCOPE void      TclRememberMutex(Tcl_Mutex *mutex);
4444+MODULE_SCOPE void      TclRemoveScriptLimitCallbacks(Tcl_Interp *interp);
4445+MODULE_SCOPE int       TclReToGlob(Tcl_Interp *interp, const char *reStr,
4446+                           int reStrLen, Tcl_DString *dsPtr, int *flagsPtr);
4447+MODULE_SCOPE int       TclScanElement(const char *string, int length,
4448+                           int *flagPtr);
4449+MODULE_SCOPE void      TclSetBgErrorHandler(Tcl_Interp *interp,
4450+                           Tcl_Obj *cmdPrefix);
4451+MODULE_SCOPE void      TclSetBignumIntRep(Tcl_Obj *objPtr,
4452+                           mp_int *bignumValue);
4453+MODULE_SCOPE void      TclSetCmdNameObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
4454+                           Command *cmdPtr);
4455+MODULE_SCOPE void      TclSetDuplicateObj(Tcl_Obj *dupPtr, Tcl_Obj *objPtr);
4456+MODULE_SCOPE void      TclSetProcessGlobalValue(ProcessGlobalValue *pgvPtr,
4457+                           Tcl_Obj *newValue, Tcl_Encoding encoding);
4458+MODULE_SCOPE void      TclSignalExitThread(Tcl_ThreadId id, int result);
4459+MODULE_SCOPE void *    TclStackRealloc(Tcl_Interp *interp, void *ptr,
4460+                           int numBytes);
4461+MODULE_SCOPE int       TclStringMatch(const char *str, int strLen,
4462+                           const char *pattern, int ptnLen, int flags);
4463+MODULE_SCOPE int       TclStringMatchObj(Tcl_Obj *stringObj,
4464+                           Tcl_Obj *patternObj, int flags);
4465+MODULE_SCOPE Tcl_Obj * TclStringObjReverse(Tcl_Obj *objPtr);
4466+MODULE_SCOPE void      TclSubstCompile(Tcl_Interp *interp, const char *bytes,
4467+                           int numBytes, int flags, int line,
4468+                           struct CompileEnv *envPtr);
4469+MODULE_SCOPE int       TclSubstOptions(Tcl_Interp *interp, int numOpts,
4470+                           Tcl_Obj *const opts[], int *flagPtr);
4471+MODULE_SCOPE void      TclSubstParse(Tcl_Interp *interp, const char *bytes,
4472+                           int numBytes, int flags, Tcl_Parse *parsePtr,
4473+                           Tcl_InterpState *statePtr);
4474+MODULE_SCOPE int       TclSubstTokens(Tcl_Interp *interp, Tcl_Token *tokenPtr,
4475+                           int count, int *tokensLeftPtr, int line,
4476+                           int *clNextOuter, const char *outerScript);
4477+MODULE_SCOPE int       TclTrimLeft(const char *bytes, int numBytes,
4478+                           const char *trim, int numTrim);
4479+MODULE_SCOPE int       TclTrimRight(const char *bytes, int numBytes,
4480+                           const char *trim, int numTrim);
4481+MODULE_SCOPE Tcl_Obj * TclpNativeToNormalized(ClientData clientData);
4482+MODULE_SCOPE Tcl_Obj * TclpFilesystemPathType(Tcl_Obj *pathPtr);
4483+MODULE_SCOPE int       TclpDlopen(Tcl_Interp *interp, Tcl_Obj *pathPtr,
4484+                           Tcl_LoadHandle *loadHandle,
4485+                           Tcl_FSUnloadFileProc **unloadProcPtr, int flags);
4486+MODULE_SCOPE int       TclpUtime(Tcl_Obj *pathPtr, struct utimbuf *tval);
4487+#ifdef TCL_LOAD_FROM_MEMORY
4488+MODULE_SCOPE void *    TclpLoadMemoryGetBuffer(Tcl_Interp *interp, int size);
4489+MODULE_SCOPE int       TclpLoadMemory(Tcl_Interp *interp, void *buffer,
4490+                           int size, int codeSize, Tcl_LoadHandle *loadHandle,
4491+                           Tcl_FSUnloadFileProc **unloadProcPtr, int flags);
4492+#endif
4493+MODULE_SCOPE void      TclInitThreadStorage(void);
4494+MODULE_SCOPE void      TclFinalizeThreadDataThread(void);
4495+MODULE_SCOPE void      TclFinalizeThreadStorage(void);
4496+#ifdef TCL_WIDE_CLICKS
4497+MODULE_SCOPE Tcl_WideInt TclpGetWideClicks(void);
4498+MODULE_SCOPE double    TclpWideClicksToNanoseconds(Tcl_WideInt clicks);
4499+#endif
4500+MODULE_SCOPE Tcl_Obj * TclDisassembleByteCodeObj(Tcl_Obj *objPtr);
4501+MODULE_SCOPE int       TclZlibInit(Tcl_Interp *interp);
4502+MODULE_SCOPE void *    TclpThreadCreateKey(void);
4503+MODULE_SCOPE void      TclpThreadDeleteKey(void *keyPtr);
4504+MODULE_SCOPE void      TclpThreadSetMasterTSD(void *tsdKeyPtr, void *ptr);
4505+MODULE_SCOPE void *    TclpThreadGetMasterTSD(void *tsdKeyPtr);
4506+
4507+MODULE_SCOPE void      TclErrorStackResetIf(Tcl_Interp *interp, const char *msg, int length);
4508+
4509+/*
4510+ *----------------------------------------------------------------
4511+ * Command procedures in the generic core:
4512+ *----------------------------------------------------------------
4513+ */
4514+
4515+MODULE_SCOPE int       Tcl_AfterObjCmd(ClientData clientData,
4516+                           Tcl_Interp *interp, int objc,
4517+                           Tcl_Obj *const objv[]);
4518+MODULE_SCOPE int       Tcl_AppendObjCmd(ClientData clientData,
4519+                           Tcl_Interp *interp, int objc,
4520+                           Tcl_Obj *const objv[]);
4521+MODULE_SCOPE int       Tcl_ApplyObjCmd(ClientData clientData,
4522+                           Tcl_Interp *interp, int objc,
4523+                           Tcl_Obj *const objv[]);
4524+MODULE_SCOPE Tcl_Command TclInitArrayCmd(Tcl_Interp *interp);
4525+MODULE_SCOPE Tcl_Command TclInitBinaryCmd(Tcl_Interp *interp);
4526+MODULE_SCOPE int       Tcl_BreakObjCmd(ClientData clientData,
4527+                           Tcl_Interp *interp, int objc,
4528+                           Tcl_Obj *const objv[]);
4529+MODULE_SCOPE int       Tcl_CaseObjCmd(ClientData clientData,
4530+                           Tcl_Interp *interp, int objc,
4531+                           Tcl_Obj *const objv[]);
4532+MODULE_SCOPE int       Tcl_CatchObjCmd(ClientData clientData,
4533+                           Tcl_Interp *interp, int objc,
4534+                           Tcl_Obj *const objv[]);
4535+MODULE_SCOPE int       Tcl_CdObjCmd(ClientData clientData,
4536+                           Tcl_Interp *interp, int objc,
4537+                           Tcl_Obj *const objv[]);
4538+MODULE_SCOPE Tcl_Command TclInitChanCmd(Tcl_Interp *interp);
4539+MODULE_SCOPE int       TclChanCreateObjCmd(ClientData clientData,
4540+                           Tcl_Interp *interp, int objc,
4541+                           Tcl_Obj *const objv[]);
4542+MODULE_SCOPE int       TclChanPostEventObjCmd(ClientData clientData,
4543+                           Tcl_Interp *interp, int objc,
4544+                           Tcl_Obj *const objv[]);
4545+MODULE_SCOPE int       TclChanPopObjCmd(ClientData clientData,
4546+                           Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]);
4547+MODULE_SCOPE int       TclChanPushObjCmd(ClientData clientData,
4548+                           Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]);
4549+MODULE_SCOPE void      TclClockInit(Tcl_Interp *interp);
4550+MODULE_SCOPE int       TclClockOldscanObjCmd(
4551+                           ClientData clientData, Tcl_Interp *interp,
4552+                           int objc, Tcl_Obj *const objv[]);
4553+extern int     Tcl_CloseObjCmd(ClientData clientData,
4554+                           Tcl_Interp *interp, int objc,
4555+                           Tcl_Obj *const objv[]);
4556+MODULE_SCOPE int       Tcl_ConcatObjCmd(ClientData clientData,
4557+                           Tcl_Interp *interp, int objc,
4558+                           Tcl_Obj *const objv[]);
4559+MODULE_SCOPE int       Tcl_ContinueObjCmd(ClientData clientData,
4560+                           Tcl_Interp *interp, int objc,
4561+                           Tcl_Obj *const objv[]);
4562+MODULE_SCOPE Tcl_TimerToken TclCreateAbsoluteTimerHandler(
4563+                           Tcl_Time *timePtr, Tcl_TimerProc *proc,
4564+                           ClientData clientData);
4565+MODULE_SCOPE int       TclDefaultBgErrorHandlerObjCmd(
4566+                           ClientData clientData, Tcl_Interp *interp,
4567+                           int objc, Tcl_Obj *const objv[]);
4568+MODULE_SCOPE Tcl_Command TclInitDictCmd(Tcl_Interp *interp);
4569+MODULE_SCOPE int       TclDictWithFinish(Tcl_Interp *interp, Var *varPtr,
4570+                           Var *arrayPtr, Tcl_Obj *part1Ptr,
4571+                           Tcl_Obj *part2Ptr, int index, int pathc,
4572+                           Tcl_Obj *const pathv[], Tcl_Obj *keysPtr);
4573+MODULE_SCOPE Tcl_Obj * TclDictWithInit(Tcl_Interp *interp, Tcl_Obj *dictPtr,
4574+                           int pathc, Tcl_Obj *const pathv[]);
4575+MODULE_SCOPE int       Tcl_DisassembleObjCmd(ClientData clientData,
4576+                           Tcl_Interp *interp, int objc,
4577+                           Tcl_Obj *const objv[]);
4578+                           
4579+/* Assemble command function */                           
4580+MODULE_SCOPE int       Tcl_AssembleObjCmd(ClientData clientData,
4581+                           Tcl_Interp *interp, int objc,
4582+                           Tcl_Obj *const objv[]);                         
4583+MODULE_SCOPE int       TclNRAssembleObjCmd(ClientData clientData,
4584+                           Tcl_Interp *interp, int objc,
4585+                           Tcl_Obj *const objv[]);                         
4586+                           
4587+MODULE_SCOPE int       Tcl_EncodingObjCmd(ClientData clientData,
4588+                           Tcl_Interp *interp, int objc,
4589+                           Tcl_Obj *const objv[]);
4590+MODULE_SCOPE int       Tcl_EofObjCmd(ClientData clientData,
4591+                           Tcl_Interp *interp, int objc,
4592+                           Tcl_Obj *const objv[]);
4593+MODULE_SCOPE int       Tcl_ErrorObjCmd(ClientData clientData,
4594+                           Tcl_Interp *interp, int objc,
4595+                           Tcl_Obj *const objv[]);
4596+MODULE_SCOPE int       Tcl_EvalObjCmd(ClientData clientData,
4597+                           Tcl_Interp *interp, int objc,
4598+                           Tcl_Obj *const objv[]);
4599+MODULE_SCOPE int       Tcl_ExecObjCmd(ClientData clientData,
4600+                           Tcl_Interp *interp, int objc,
4601+                           Tcl_Obj *const objv[]);
4602+MODULE_SCOPE int       Tcl_ExitObjCmd(ClientData clientData,
4603+                           Tcl_Interp *interp, int objc,
4604+                           Tcl_Obj *const objv[]);
4605+MODULE_SCOPE int       Tcl_ExprObjCmd(ClientData clientData,
4606+                           Tcl_Interp *interp, int objc,
4607+                           Tcl_Obj *const objv[]);
4608+MODULE_SCOPE int       Tcl_FblockedObjCmd(ClientData clientData,
4609+                           Tcl_Interp *interp, int objc,
4610+                           Tcl_Obj *const objv[]);
4611+MODULE_SCOPE int       Tcl_FconfigureObjCmd(
4612+                           ClientData clientData, Tcl_Interp *interp,
4613+                           int objc, Tcl_Obj *const objv[]);
4614+MODULE_SCOPE int       Tcl_FcopyObjCmd(ClientData dummy,
4615+                           Tcl_Interp *interp, int objc,
4616+                           Tcl_Obj *const objv[]);
4617+MODULE_SCOPE Tcl_Command TclInitFileCmd(Tcl_Interp *interp);
4618+MODULE_SCOPE int       TclMakeFileCommandSafe(Tcl_Interp *interp);
4619+MODULE_SCOPE int       Tcl_FileEventObjCmd(ClientData clientData,
4620+                           Tcl_Interp *interp, int objc,
4621+                           Tcl_Obj *const objv[]);
4622+MODULE_SCOPE int       Tcl_FlushObjCmd(ClientData clientData,
4623+                           Tcl_Interp *interp, int objc,
4624+                           Tcl_Obj *const objv[]);
4625+MODULE_SCOPE int       Tcl_ForObjCmd(ClientData clientData,
4626+                           Tcl_Interp *interp, int objc,
4627+                           Tcl_Obj *const objv[]);
4628+MODULE_SCOPE int       Tcl_ForeachObjCmd(ClientData clientData,
4629+                           Tcl_Interp *interp, int objc,
4630+                           Tcl_Obj *const objv[]);
4631+MODULE_SCOPE int       Tcl_FormatObjCmd(ClientData dummy,
4632+                           Tcl_Interp *interp, int objc,
4633+                           Tcl_Obj *const objv[]);
4634+MODULE_SCOPE int       Tcl_GetsObjCmd(ClientData clientData,
4635+                           Tcl_Interp *interp, int objc,
4636+                           Tcl_Obj *const objv[]);
4637+MODULE_SCOPE int       Tcl_GlobalObjCmd(ClientData clientData,
4638+                           Tcl_Interp *interp, int objc,
4639+                           Tcl_Obj *const objv[]);
4640+MODULE_SCOPE int       Tcl_GlobObjCmd(ClientData clientData,
4641+                           Tcl_Interp *interp, int objc,
4642+                           Tcl_Obj *const objv[]);
4643+MODULE_SCOPE int       Tcl_IfObjCmd(ClientData clientData,
4644+                           Tcl_Interp *interp, int objc,
4645+                           Tcl_Obj *const objv[]);
4646+MODULE_SCOPE int       Tcl_IncrObjCmd(ClientData clientData,
4647+                           Tcl_Interp *interp, int objc,
4648+                           Tcl_Obj *const objv[]);
4649+MODULE_SCOPE Tcl_Command TclInitInfoCmd(Tcl_Interp *interp);
4650+MODULE_SCOPE int       Tcl_InterpObjCmd(ClientData clientData,
4651+                           Tcl_Interp *interp, int argc,
4652+                           Tcl_Obj *const objv[]);
4653+MODULE_SCOPE int       Tcl_JoinObjCmd(ClientData clientData,
4654+                           Tcl_Interp *interp, int objc,
4655+                           Tcl_Obj *const objv[]);
4656+MODULE_SCOPE int       Tcl_LappendObjCmd(ClientData clientData,
4657+                           Tcl_Interp *interp, int objc,
4658+                           Tcl_Obj *const objv[]);
4659+MODULE_SCOPE int       Tcl_LassignObjCmd(ClientData clientData,
4660+                           Tcl_Interp *interp, int objc,
4661+                           Tcl_Obj *const objv[]);
4662+MODULE_SCOPE int       Tcl_LindexObjCmd(ClientData clientData,
4663+                           Tcl_Interp *interp, int objc,
4664+                           Tcl_Obj *const objv[]);
4665+MODULE_SCOPE int       Tcl_LinsertObjCmd(ClientData clientData,
4666+                           Tcl_Interp *interp, int objc,
4667+                           Tcl_Obj *const objv[]);
4668+MODULE_SCOPE int       Tcl_LlengthObjCmd(ClientData clientData,
4669+                           Tcl_Interp *interp, int objc,
4670+                           Tcl_Obj *const objv[]);
4671+MODULE_SCOPE int       Tcl_ListObjCmd(ClientData clientData,
4672+                           Tcl_Interp *interp, int objc,
4673+                           Tcl_Obj *const objv[]);
4674+MODULE_SCOPE int       Tcl_LmapObjCmd(ClientData clientData,
4675+                           Tcl_Interp *interp, int objc,
4676+                           Tcl_Obj *const objv[]);
4677+MODULE_SCOPE int       Tcl_LoadObjCmd(ClientData clientData,
4678+                           Tcl_Interp *interp, int objc,
4679+                           Tcl_Obj *const objv[]);
4680+MODULE_SCOPE int       Tcl_LrangeObjCmd(ClientData clientData,
4681+                           Tcl_Interp *interp, int objc,
4682+                           Tcl_Obj *const objv[]);
4683+MODULE_SCOPE int       Tcl_LrepeatObjCmd(ClientData clientData,
4684+                           Tcl_Interp *interp, int objc,
4685+                           Tcl_Obj *const objv[]);
4686+MODULE_SCOPE int       Tcl_LreplaceObjCmd(ClientData clientData,
4687+                           Tcl_Interp *interp, int objc,
4688+                           Tcl_Obj *const objv[]);
4689+MODULE_SCOPE int       Tcl_LreverseObjCmd(ClientData clientData,
4690+                           Tcl_Interp *interp, int objc,
4691+                           Tcl_Obj *const objv[]);
4692+MODULE_SCOPE int       Tcl_LsearchObjCmd(ClientData clientData,
4693+                           Tcl_Interp *interp, int objc,
4694+                           Tcl_Obj *const objv[]);
4695+MODULE_SCOPE int       Tcl_LsetObjCmd(ClientData clientData,
4696+                           Tcl_Interp *interp, int objc,
4697+                           Tcl_Obj *const objv[]);
4698+MODULE_SCOPE int       Tcl_LsortObjCmd(ClientData clientData,
4699+                           Tcl_Interp *interp, int objc,
4700+                           Tcl_Obj *const objv[]);
4701+MODULE_SCOPE Tcl_Command TclInitNamespaceCmd(Tcl_Interp *interp);
4702+MODULE_SCOPE int       TclNamespaceEnsembleCmd(ClientData dummy,
4703+                           Tcl_Interp *interp, int objc,
4704+                           Tcl_Obj *const objv[]);
4705+MODULE_SCOPE int       Tcl_OpenObjCmd(ClientData clientData,
4706+                           Tcl_Interp *interp, int objc,
4707+                           Tcl_Obj *const objv[]);
4708+MODULE_SCOPE int       Tcl_PackageObjCmd(ClientData clientData,
4709+                           Tcl_Interp *interp, int objc,
4710+                           Tcl_Obj *const objv[]);
4711+MODULE_SCOPE int       Tcl_PidObjCmd(ClientData clientData,
4712+                           Tcl_Interp *interp, int objc,
4713+                           Tcl_Obj *const objv[]);
4714+MODULE_SCOPE Tcl_Command TclInitPrefixCmd(Tcl_Interp *interp);
4715+MODULE_SCOPE int       Tcl_PutsObjCmd(ClientData clientData,
4716+                           Tcl_Interp *interp, int objc,
4717+                           Tcl_Obj *const objv[]);
4718+MODULE_SCOPE int       Tcl_PwdObjCmd(ClientData clientData,
4719+                           Tcl_Interp *interp, int objc,
4720+                           Tcl_Obj *const objv[]);
4721+MODULE_SCOPE int       Tcl_ReadObjCmd(ClientData clientData,
4722+                           Tcl_Interp *interp, int objc,
4723+                           Tcl_Obj *const objv[]);
4724+MODULE_SCOPE int       Tcl_RegexpObjCmd(ClientData clientData,
4725+                           Tcl_Interp *interp, int objc,
4726+                           Tcl_Obj *const objv[]);
4727+MODULE_SCOPE int       Tcl_RegsubObjCmd(ClientData clientData,
4728+                           Tcl_Interp *interp, int objc,
4729+                           Tcl_Obj *const objv[]);
4730+MODULE_SCOPE int       Tcl_RenameObjCmd(ClientData clientData,
4731+                           Tcl_Interp *interp, int objc,
4732+                           Tcl_Obj *const objv[]);
4733+MODULE_SCOPE int       Tcl_RepresentationCmd(ClientData clientData,
4734+                           Tcl_Interp *interp, int objc,
4735+                           Tcl_Obj *const objv[]);
4736+extern int     Tcl_ReturnObjCmd(ClientData clientData,
4737+                           Tcl_Interp *interp, int objc,
4738+                           Tcl_Obj *const objv[]);
4739+MODULE_SCOPE int       Tcl_ScanObjCmd(ClientData clientData,
4740+                           Tcl_Interp *interp, int objc,
4741+                           Tcl_Obj *const objv[]);
4742+MODULE_SCOPE int       Tcl_SeekObjCmd(ClientData clientData,
4743+                           Tcl_Interp *interp, int objc,
4744+                           Tcl_Obj *const objv[]);
4745+MODULE_SCOPE int       Tcl_SetObjCmd(ClientData clientData,
4746+                           Tcl_Interp *interp, int objc,
4747+                           Tcl_Obj *const objv[]);
4748+MODULE_SCOPE int       Tcl_SplitObjCmd(ClientData clientData,
4749+                           Tcl_Interp *interp, int objc,
4750+                           Tcl_Obj *const objv[]);
4751+MODULE_SCOPE int       Tcl_SocketObjCmd(ClientData clientData,
4752+                           Tcl_Interp *interp, int objc,
4753+                           Tcl_Obj *const objv[]);
4754+MODULE_SCOPE int       Tcl_SourceObjCmd(ClientData clientData,
4755+                           Tcl_Interp *interp, int objc,
4756+                           Tcl_Obj *const objv[]);
4757+MODULE_SCOPE Tcl_Command TclInitStringCmd(Tcl_Interp *interp);
4758+MODULE_SCOPE int       Tcl_SubstObjCmd(ClientData clientData,
4759+                           Tcl_Interp *interp, int objc,
4760+                           Tcl_Obj *const objv[]);
4761+MODULE_SCOPE int       Tcl_SwitchObjCmd(ClientData clientData,
4762+                           Tcl_Interp *interp, int objc,
4763+                           Tcl_Obj *const objv[]);
4764+MODULE_SCOPE int       Tcl_TellObjCmd(ClientData clientData,
4765+                           Tcl_Interp *interp, int objc,
4766+                           Tcl_Obj *const objv[]);
4767+MODULE_SCOPE int       Tcl_ThrowObjCmd(ClientData dummy, Tcl_Interp *interp,
4768+                           int objc, Tcl_Obj *const objv[]);
4769+MODULE_SCOPE int       Tcl_TimeObjCmd(ClientData clientData,
4770+                           Tcl_Interp *interp, int objc,
4771+                           Tcl_Obj *const objv[]);
4772+MODULE_SCOPE int       Tcl_TraceObjCmd(ClientData clientData,
4773+                           Tcl_Interp *interp, int objc,
4774+                           Tcl_Obj *const objv[]);
4775+MODULE_SCOPE int       Tcl_TryObjCmd(ClientData clientData,
4776+                           Tcl_Interp *interp, int objc,
4777+                           Tcl_Obj *const objv[]);
4778+MODULE_SCOPE int       Tcl_UnloadObjCmd(ClientData clientData,
4779+                           Tcl_Interp *interp, int objc,
4780+                           Tcl_Obj *const objv[]);
4781+MODULE_SCOPE int       Tcl_UnsetObjCmd(ClientData clientData,
4782+                           Tcl_Interp *interp, int objc,
4783+                           Tcl_Obj *const objv[]);
4784+MODULE_SCOPE int       Tcl_UpdateObjCmd(ClientData clientData,
4785+                           Tcl_Interp *interp, int objc,
4786+                           Tcl_Obj *const objv[]);
4787+MODULE_SCOPE int       Tcl_UplevelObjCmd(ClientData clientData,
4788+                           Tcl_Interp *interp, int objc,
4789+                           Tcl_Obj *const objv[]);
4790+MODULE_SCOPE int       Tcl_UpvarObjCmd(ClientData clientData,
4791+                           Tcl_Interp *interp, int objc,
4792+                           Tcl_Obj *const objv[]);
4793+MODULE_SCOPE int       Tcl_VariableObjCmd(ClientData clientData,
4794+                           Tcl_Interp *interp, int objc,
4795+                           Tcl_Obj *const objv[]);
4796+MODULE_SCOPE int       Tcl_VwaitObjCmd(ClientData clientData,
4797+                           Tcl_Interp *interp, int objc,
4798+                           Tcl_Obj *const objv[]);
4799+MODULE_SCOPE int       Tcl_WhileObjCmd(ClientData clientData,
4800+                           Tcl_Interp *interp, int objc,
4801+                           Tcl_Obj *const objv[]);
4802+
4803+/*
4804+ *----------------------------------------------------------------
4805+ * Compilation procedures for commands in the generic core:
4806+ *----------------------------------------------------------------
4807+ */
4808+
4809+MODULE_SCOPE int       TclCompileAppendCmd(Tcl_Interp *interp,
4810+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4811+                           struct CompileEnv *envPtr);
4812+MODULE_SCOPE int       TclCompileArrayExistsCmd(Tcl_Interp *interp,
4813+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4814+                           struct CompileEnv *envPtr);
4815+MODULE_SCOPE int       TclCompileArraySetCmd(Tcl_Interp *interp,
4816+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4817+                           struct CompileEnv *envPtr);
4818+MODULE_SCOPE int       TclCompileArrayUnsetCmd(Tcl_Interp *interp,
4819+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4820+                           struct CompileEnv *envPtr);
4821+MODULE_SCOPE int       TclCompileBreakCmd(Tcl_Interp *interp,
4822+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4823+                           struct CompileEnv *envPtr);
4824+MODULE_SCOPE int       TclCompileCatchCmd(Tcl_Interp *interp,
4825+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4826+                           struct CompileEnv *envPtr);
4827+MODULE_SCOPE int       TclCompileContinueCmd(Tcl_Interp *interp,
4828+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4829+                           struct CompileEnv *envPtr);
4830+MODULE_SCOPE int       TclCompileDictAppendCmd(Tcl_Interp *interp,
4831+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4832+                           struct CompileEnv *envPtr);
4833+MODULE_SCOPE int       TclCompileDictCreateCmd(Tcl_Interp *interp,
4834+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4835+                           struct CompileEnv *envPtr);
4836+MODULE_SCOPE int       TclCompileDictExistsCmd(Tcl_Interp *interp,
4837+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4838+                           struct CompileEnv *envPtr);
4839+MODULE_SCOPE int       TclCompileDictForCmd(Tcl_Interp *interp,
4840+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4841+                           struct CompileEnv *envPtr);
4842+MODULE_SCOPE int       TclCompileDictGetCmd(Tcl_Interp *interp,
4843+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4844+                           struct CompileEnv *envPtr);
4845+MODULE_SCOPE int       TclCompileDictIncrCmd(Tcl_Interp *interp,
4846+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4847+                           struct CompileEnv *envPtr);
4848+MODULE_SCOPE int       TclCompileDictLappendCmd(Tcl_Interp *interp,
4849+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4850+                           struct CompileEnv *envPtr);
4851+MODULE_SCOPE int       TclCompileDictMapCmd(Tcl_Interp *interp,
4852+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4853+                           struct CompileEnv *envPtr);
4854+MODULE_SCOPE int       TclCompileDictMergeCmd(Tcl_Interp *interp,
4855+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4856+                           struct CompileEnv *envPtr);
4857+MODULE_SCOPE int       TclCompileDictSetCmd(Tcl_Interp *interp,
4858+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4859+                           struct CompileEnv *envPtr);
4860+MODULE_SCOPE int       TclCompileDictUnsetCmd(Tcl_Interp *interp,
4861+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4862+                           struct CompileEnv *envPtr);
4863+MODULE_SCOPE int       TclCompileDictUpdateCmd(Tcl_Interp *interp,
4864+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4865+                           struct CompileEnv *envPtr);
4866+MODULE_SCOPE int       TclCompileDictWithCmd(Tcl_Interp *interp,
4867+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4868+                           struct CompileEnv *envPtr);
4869+MODULE_SCOPE int       TclCompileEnsemble(Tcl_Interp *interp,
4870+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4871+                           struct CompileEnv *envPtr);
4872+MODULE_SCOPE int       TclCompileErrorCmd(Tcl_Interp *interp,
4873+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4874+                           struct CompileEnv *envPtr);
4875+MODULE_SCOPE int       TclCompileExprCmd(Tcl_Interp *interp,
4876+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4877+                           struct CompileEnv *envPtr);
4878+MODULE_SCOPE int       TclCompileForCmd(Tcl_Interp *interp,
4879+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4880+                           struct CompileEnv *envPtr);
4881+MODULE_SCOPE int       TclCompileForeachCmd(Tcl_Interp *interp,
4882+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4883+                           struct CompileEnv *envPtr);
4884+MODULE_SCOPE int       TclCompileFormatCmd(Tcl_Interp *interp,
4885+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4886+                           struct CompileEnv *envPtr);
4887+MODULE_SCOPE int       TclCompileGlobalCmd(Tcl_Interp *interp,
4888+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4889+                           struct CompileEnv *envPtr);
4890+MODULE_SCOPE int       TclCompileIfCmd(Tcl_Interp *interp,
4891+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4892+                           struct CompileEnv *envPtr);
4893+MODULE_SCOPE int       TclCompileInfoCommandsCmd(Tcl_Interp *interp,
4894+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4895+                           struct CompileEnv *envPtr);
4896+MODULE_SCOPE int       TclCompileInfoCoroutineCmd(Tcl_Interp *interp,
4897+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4898+                           struct CompileEnv *envPtr);
4899+MODULE_SCOPE int       TclCompileInfoExistsCmd(Tcl_Interp *interp,
4900+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4901+                           struct CompileEnv *envPtr);
4902+MODULE_SCOPE int       TclCompileInfoLevelCmd(Tcl_Interp *interp,
4903+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4904+                           struct CompileEnv *envPtr);
4905+MODULE_SCOPE int       TclCompileInfoObjectClassCmd(Tcl_Interp *interp,
4906+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4907+                           struct CompileEnv *envPtr);
4908+MODULE_SCOPE int       TclCompileInfoObjectIsACmd(Tcl_Interp *interp,
4909+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4910+                           struct CompileEnv *envPtr);
4911+MODULE_SCOPE int       TclCompileInfoObjectNamespaceCmd(Tcl_Interp *interp,
4912+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4913+                           struct CompileEnv *envPtr);
4914+MODULE_SCOPE int       TclCompileIncrCmd(Tcl_Interp *interp,
4915+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4916+                           struct CompileEnv *envPtr);
4917+MODULE_SCOPE int       TclCompileLappendCmd(Tcl_Interp *interp,
4918+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4919+                           struct CompileEnv *envPtr);
4920+MODULE_SCOPE int       TclCompileLassignCmd(Tcl_Interp *interp,
4921+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4922+                           struct CompileEnv *envPtr);
4923+MODULE_SCOPE int       TclCompileLindexCmd(Tcl_Interp *interp,
4924+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4925+                           struct CompileEnv *envPtr);
4926+MODULE_SCOPE int       TclCompileListCmd(Tcl_Interp *interp,
4927+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4928+                           struct CompileEnv *envPtr);
4929+MODULE_SCOPE int       TclCompileLlengthCmd(Tcl_Interp *interp,
4930+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4931+                           struct CompileEnv *envPtr);
4932+MODULE_SCOPE int       TclCompileLmapCmd(Tcl_Interp *interp,
4933+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4934+                           struct CompileEnv *envPtr);
4935+MODULE_SCOPE int       TclCompileLrangeCmd(Tcl_Interp *interp,
4936+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4937+                           struct CompileEnv *envPtr);
4938+MODULE_SCOPE int       TclCompileLreplaceCmd(Tcl_Interp *interp,
4939+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4940+                           struct CompileEnv *envPtr);
4941+MODULE_SCOPE int       TclCompileLsetCmd(Tcl_Interp *interp,
4942+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4943+                           struct CompileEnv *envPtr);
4944+MODULE_SCOPE int       TclCompileNamespaceCodeCmd(Tcl_Interp *interp,
4945+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4946+                           struct CompileEnv *envPtr);
4947+MODULE_SCOPE int       TclCompileNamespaceCurrentCmd(Tcl_Interp *interp,
4948+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4949+                           struct CompileEnv *envPtr);
4950+MODULE_SCOPE int       TclCompileNamespaceQualifiersCmd(Tcl_Interp *interp,
4951+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4952+                           struct CompileEnv *envPtr);
4953+MODULE_SCOPE int       TclCompileNamespaceTailCmd(Tcl_Interp *interp,
4954+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4955+                           struct CompileEnv *envPtr);
4956+MODULE_SCOPE int       TclCompileNamespaceUpvarCmd(Tcl_Interp *interp,
4957+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4958+                           struct CompileEnv *envPtr);
4959+MODULE_SCOPE int       TclCompileNamespaceWhichCmd(Tcl_Interp *interp,
4960+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4961+                           struct CompileEnv *envPtr);
4962+MODULE_SCOPE int       TclCompileNoOp(Tcl_Interp *interp,
4963+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4964+                           struct CompileEnv *envPtr);
4965+MODULE_SCOPE int       TclCompileObjectSelfCmd(Tcl_Interp *interp,
4966+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4967+                           struct CompileEnv *envPtr);
4968+MODULE_SCOPE int       TclCompileRegexpCmd(Tcl_Interp *interp,
4969+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4970+                           struct CompileEnv *envPtr);
4971+MODULE_SCOPE int       TclCompileRegsubCmd(Tcl_Interp *interp,
4972+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4973+                           struct CompileEnv *envPtr);
4974+MODULE_SCOPE int       TclCompileReturnCmd(Tcl_Interp *interp,
4975+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4976+                           struct CompileEnv *envPtr);
4977+MODULE_SCOPE int       TclCompileSetCmd(Tcl_Interp *interp,
4978+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4979+                           struct CompileEnv *envPtr);
4980+MODULE_SCOPE int       TclCompileStringCmpCmd(Tcl_Interp *interp,
4981+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4982+                           struct CompileEnv *envPtr);
4983+MODULE_SCOPE int       TclCompileStringEqualCmd(Tcl_Interp *interp,
4984+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4985+                           struct CompileEnv *envPtr);
4986+MODULE_SCOPE int       TclCompileStringFirstCmd(Tcl_Interp *interp,
4987+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4988+                           struct CompileEnv *envPtr);
4989+MODULE_SCOPE int       TclCompileStringIndexCmd(Tcl_Interp *interp,
4990+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4991+                           struct CompileEnv *envPtr);
4992+MODULE_SCOPE int       TclCompileStringLastCmd(Tcl_Interp *interp,
4993+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4994+                           struct CompileEnv *envPtr);
4995+MODULE_SCOPE int       TclCompileStringLenCmd(Tcl_Interp *interp,
4996+                           Tcl_Parse *parsePtr, Command *cmdPtr,
4997+                           struct CompileEnv *envPtr);
4998+MODULE_SCOPE int       TclCompileStringMapCmd(Tcl_Interp *interp,
4999+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5000+                           struct CompileEnv *envPtr);
5001+MODULE_SCOPE int       TclCompileStringMatchCmd(Tcl_Interp *interp,
5002+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5003+                           struct CompileEnv *envPtr);
5004+MODULE_SCOPE int       TclCompileStringRangeCmd(Tcl_Interp *interp,
5005+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5006+                           struct CompileEnv *envPtr);
5007+MODULE_SCOPE int       TclCompileSubstCmd(Tcl_Interp *interp,
5008+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5009+                           struct CompileEnv *envPtr);
5010+MODULE_SCOPE int       TclCompileSwitchCmd(Tcl_Interp *interp,
5011+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5012+                           struct CompileEnv *envPtr);
5013+MODULE_SCOPE int       TclCompileTailcallCmd(Tcl_Interp *interp,
5014+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5015+                           struct CompileEnv *envPtr);
5016+MODULE_SCOPE int       TclCompileThrowCmd(Tcl_Interp *interp,
5017+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5018+                           struct CompileEnv *envPtr);
5019+MODULE_SCOPE int       TclCompileTryCmd(Tcl_Interp *interp,
5020+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5021+                           struct CompileEnv *envPtr);
5022+MODULE_SCOPE int       TclCompileUnsetCmd(Tcl_Interp *interp,
5023+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5024+                           struct CompileEnv *envPtr);
5025+MODULE_SCOPE int       TclCompileUpvarCmd(Tcl_Interp *interp,
5026+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5027+                           struct CompileEnv *envPtr);
5028+MODULE_SCOPE int       TclCompileVariableCmd(Tcl_Interp *interp,
5029+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5030+                           struct CompileEnv *envPtr);
5031+MODULE_SCOPE int       TclCompileWhileCmd(Tcl_Interp *interp,
5032+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5033+                           struct CompileEnv *envPtr);
5034+MODULE_SCOPE int       TclCompileYieldCmd(Tcl_Interp *interp,
5035+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5036+                           struct CompileEnv *envPtr);
5037+
5038+MODULE_SCOPE int       TclInvertOpCmd(ClientData clientData,
5039+                           Tcl_Interp *interp, int objc,
5040+                           Tcl_Obj *const objv[]);
5041+MODULE_SCOPE int       TclCompileInvertOpCmd(Tcl_Interp *interp,
5042+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5043+                           struct CompileEnv *envPtr);
5044+MODULE_SCOPE int       TclNotOpCmd(ClientData clientData,
5045+                           Tcl_Interp *interp, int objc,
5046+                           Tcl_Obj *const objv[]);
5047+MODULE_SCOPE int       TclCompileNotOpCmd(Tcl_Interp *interp,
5048+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5049+                           struct CompileEnv *envPtr);
5050+MODULE_SCOPE int       TclAddOpCmd(ClientData clientData,
5051+                           Tcl_Interp *interp, int objc,
5052+                           Tcl_Obj *const objv[]);
5053+MODULE_SCOPE int       TclCompileAddOpCmd(Tcl_Interp *interp,
5054+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5055+                           struct CompileEnv *envPtr);
5056+MODULE_SCOPE int       TclMulOpCmd(ClientData clientData,
5057+                           Tcl_Interp *interp, int objc,
5058+                           Tcl_Obj *const objv[]);
5059+MODULE_SCOPE int       TclCompileMulOpCmd(Tcl_Interp *interp,
5060+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5061+                           struct CompileEnv *envPtr);
5062+MODULE_SCOPE int       TclAndOpCmd(ClientData clientData,
5063+                           Tcl_Interp *interp, int objc,
5064+                           Tcl_Obj *const objv[]);
5065+MODULE_SCOPE int       TclCompileAndOpCmd(Tcl_Interp *interp,
5066+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5067+                           struct CompileEnv *envPtr);
5068+MODULE_SCOPE int       TclOrOpCmd(ClientData clientData,
5069+                           Tcl_Interp *interp, int objc,
5070+                           Tcl_Obj *const objv[]);
5071+MODULE_SCOPE int       TclCompileOrOpCmd(Tcl_Interp *interp,
5072+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5073+                           struct CompileEnv *envPtr);
5074+MODULE_SCOPE int       TclXorOpCmd(ClientData clientData,
5075+                           Tcl_Interp *interp, int objc,
5076+                           Tcl_Obj *const objv[]);
5077+MODULE_SCOPE int       TclCompileXorOpCmd(Tcl_Interp *interp,
5078+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5079+                           struct CompileEnv *envPtr);
5080+MODULE_SCOPE int       TclPowOpCmd(ClientData clientData,
5081+                           Tcl_Interp *interp, int objc,
5082+                           Tcl_Obj *const objv[]);
5083+MODULE_SCOPE int       TclCompilePowOpCmd(Tcl_Interp *interp,
5084+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5085+                           struct CompileEnv *envPtr);
5086+MODULE_SCOPE int       TclLshiftOpCmd(ClientData clientData,
5087+                           Tcl_Interp *interp, int objc,
5088+                           Tcl_Obj *const objv[]);
5089+MODULE_SCOPE int       TclCompileLshiftOpCmd(Tcl_Interp *interp,
5090+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5091+                           struct CompileEnv *envPtr);
5092+MODULE_SCOPE int       TclRshiftOpCmd(ClientData clientData,
5093+                           Tcl_Interp *interp, int objc,
5094+                           Tcl_Obj *const objv[]);
5095+MODULE_SCOPE int       TclCompileRshiftOpCmd(Tcl_Interp *interp,
5096+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5097+                           struct CompileEnv *envPtr);
5098+MODULE_SCOPE int       TclModOpCmd(ClientData clientData,
5099+                           Tcl_Interp *interp, int objc,
5100+                           Tcl_Obj *const objv[]);
5101+MODULE_SCOPE int       TclCompileModOpCmd(Tcl_Interp *interp,
5102+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5103+                           struct CompileEnv *envPtr);
5104+MODULE_SCOPE int       TclNeqOpCmd(ClientData clientData,
5105+                           Tcl_Interp *interp, int objc,
5106+                           Tcl_Obj *const objv[]);
5107+MODULE_SCOPE int       TclCompileNeqOpCmd(Tcl_Interp *interp,
5108+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5109+                           struct CompileEnv *envPtr);
5110+MODULE_SCOPE int       TclStrneqOpCmd(ClientData clientData,
5111+                           Tcl_Interp *interp, int objc,
5112+                           Tcl_Obj *const objv[]);
5113+MODULE_SCOPE int       TclCompileStrneqOpCmd(Tcl_Interp *interp,
5114+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5115+                           struct CompileEnv *envPtr);
5116+MODULE_SCOPE int       TclInOpCmd(ClientData clientData,
5117+                           Tcl_Interp *interp, int objc,
5118+                           Tcl_Obj *const objv[]);
5119+MODULE_SCOPE int       TclCompileInOpCmd(Tcl_Interp *interp,
5120+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5121+                           struct CompileEnv *envPtr);
5122+MODULE_SCOPE int       TclNiOpCmd(ClientData clientData,
5123+                           Tcl_Interp *interp, int objc,
5124+                           Tcl_Obj *const objv[]);
5125+MODULE_SCOPE int       TclCompileNiOpCmd(Tcl_Interp *interp,
5126+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5127+                           struct CompileEnv *envPtr);
5128+MODULE_SCOPE int       TclMinusOpCmd(ClientData clientData,
5129+                           Tcl_Interp *interp, int objc,
5130+                           Tcl_Obj *const objv[]);
5131+MODULE_SCOPE int       TclCompileMinusOpCmd(Tcl_Interp *interp,
5132+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5133+                           struct CompileEnv *envPtr);
5134+MODULE_SCOPE int       TclDivOpCmd(ClientData clientData,
5135+                           Tcl_Interp *interp, int objc,
5136+                           Tcl_Obj *const objv[]);
5137+MODULE_SCOPE int       TclCompileDivOpCmd(Tcl_Interp *interp,
5138+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5139+                           struct CompileEnv *envPtr);
5140+MODULE_SCOPE int       TclLessOpCmd(ClientData clientData,
5141+                           Tcl_Interp *interp, int objc,
5142+                           Tcl_Obj *const objv[]);
5143+MODULE_SCOPE int       TclCompileLessOpCmd(Tcl_Interp *interp,
5144+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5145+                           struct CompileEnv *envPtr);
5146+MODULE_SCOPE int       TclLeqOpCmd(ClientData clientData,
5147+                           Tcl_Interp *interp, int objc,
5148+                           Tcl_Obj *const objv[]);
5149+MODULE_SCOPE int       TclCompileLeqOpCmd(Tcl_Interp *interp,
5150+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5151+                           struct CompileEnv *envPtr);
5152+MODULE_SCOPE int       TclGreaterOpCmd(ClientData clientData,
5153+                           Tcl_Interp *interp, int objc,
5154+                           Tcl_Obj *const objv[]);
5155+MODULE_SCOPE int       TclCompileGreaterOpCmd(Tcl_Interp *interp,
5156+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5157+                           struct CompileEnv *envPtr);
5158+MODULE_SCOPE int       TclGeqOpCmd(ClientData clientData,
5159+                           Tcl_Interp *interp, int objc,
5160+                           Tcl_Obj *const objv[]);
5161+MODULE_SCOPE int       TclCompileGeqOpCmd(Tcl_Interp *interp,
5162+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5163+                           struct CompileEnv *envPtr);
5164+MODULE_SCOPE int       TclEqOpCmd(ClientData clientData,
5165+                           Tcl_Interp *interp, int objc,
5166+                           Tcl_Obj *const objv[]);
5167+MODULE_SCOPE int       TclCompileEqOpCmd(Tcl_Interp *interp,
5168+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5169+                           struct CompileEnv *envPtr);
5170+MODULE_SCOPE int       TclStreqOpCmd(ClientData clientData,
5171+                           Tcl_Interp *interp, int objc,
5172+                           Tcl_Obj *const objv[]);
5173+MODULE_SCOPE int       TclCompileStreqOpCmd(Tcl_Interp *interp,
5174+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5175+                           struct CompileEnv *envPtr);
5176+                           
5177+MODULE_SCOPE int       TclCompileAssembleCmd(Tcl_Interp *interp,
5178+                           Tcl_Parse *parsePtr, Command *cmdPtr,
5179+                           struct CompileEnv *envPtr);
5180+
5181+/*
5182+ * Functions defined in generic/tclVar.c and currenttly exported only for use
5183+ * by the bytecode compiler and engine. Some of these could later be placed in
5184+ * the public interface.
5185+ */
5186+
5187+MODULE_SCOPE Var *     TclObjLookupVarEx(Tcl_Interp * interp,
5188+                           Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, int flags,
5189+                           const char *msg, const int createPart1,
5190+                           const int createPart2, Var **arrayPtrPtr);
5191+MODULE_SCOPE Var *     TclLookupArrayElement(Tcl_Interp *interp,
5192+                           Tcl_Obj *arrayNamePtr, Tcl_Obj *elNamePtr,
5193+                           const int flags, const char *msg,
5194+                           const int createPart1, const int createPart2,
5195+                           Var *arrayPtr, int index);
5196+MODULE_SCOPE Tcl_Obj * TclPtrGetVar(Tcl_Interp *interp,
5197+                           Var *varPtr, Var *arrayPtr, Tcl_Obj *part1Ptr,
5198+                           Tcl_Obj *part2Ptr, const int flags, int index);
5199+MODULE_SCOPE Tcl_Obj * TclPtrSetVar(Tcl_Interp *interp,
5200+                           Var *varPtr, Var *arrayPtr, Tcl_Obj *part1Ptr,
5201+                           Tcl_Obj *part2Ptr, Tcl_Obj *newValuePtr,
5202+                           const int flags, int index);
5203+MODULE_SCOPE Tcl_Obj * TclPtrIncrObjVar(Tcl_Interp *interp,
5204+                           Var *varPtr, Var *arrayPtr, Tcl_Obj *part1Ptr,
5205+                           Tcl_Obj *part2Ptr, Tcl_Obj *incrPtr,
5206+                           const int flags, int index);
5207+MODULE_SCOPE int       TclPtrObjMakeUpvar(Tcl_Interp *interp, Var *otherPtr,
5208+                           Tcl_Obj *myNamePtr, int myFlags, int index);
5209+MODULE_SCOPE int       TclPtrUnsetVar(Tcl_Interp *interp, Var *varPtr,
5210+                           Var *arrayPtr, Tcl_Obj *part1Ptr,
5211+                           Tcl_Obj *part2Ptr, const int flags,
5212+                           int index);
5213+MODULE_SCOPE void      TclInvalidateNsPath(Namespace *nsPtr);
5214+
5215+/*
5216+ * The new extended interface to the variable traces.
5217+ */
5218+
5219+MODULE_SCOPE int       TclObjCallVarTraces(Interp *iPtr, Var *arrayPtr,
5220+                           Var *varPtr, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr,
5221+                           int flags, int leaveErrMsg, int index);
5222+
5223+/*
5224+ * So tclObj.c and tclDictObj.c can share these implementations.
5225+ */
5226+
5227+MODULE_SCOPE int       TclCompareObjKeys(void *keyPtr, Tcl_HashEntry *hPtr);
5228+MODULE_SCOPE void      TclFreeObjEntry(Tcl_HashEntry *hPtr);
5229+MODULE_SCOPE unsigned  TclHashObjKey(Tcl_HashTable *tablePtr, void *keyPtr);
5230+
5231+MODULE_SCOPE int       TclFullFinalizationRequested(void);
5232+
5233+/*
5234+ *----------------------------------------------------------------
5235+ * Macros used by the Tcl core to create and release Tcl objects.
5236+ * TclNewObj(objPtr) creates a new object denoting an empty string.
5237+ * TclDecrRefCount(objPtr) decrements the object's reference count, and frees
5238+ * the object if its reference count is zero. These macros are inline versions
5239+ * of Tcl_NewObj() and Tcl_DecrRefCount(). Notice that the names differ in not
5240+ * having a "_" after the "Tcl". Notice also that these macros reference their
5241+ * argument more than once, so you should avoid calling them with an
5242+ * expression that is expensive to compute or has side effects. The ANSI C
5243+ * "prototypes" for these macros are:
5244+ *
5245+ * MODULE_SCOPE void   TclNewObj(Tcl_Obj *objPtr);
5246+ * MODULE_SCOPE void   TclDecrRefCount(Tcl_Obj *objPtr);
5247+ *
5248+ * These macros are defined in terms of two macros that depend on memory
5249+ * allocator in use: TclAllocObjStorage, TclFreeObjStorage. They are defined
5250+ * below.
5251+ *----------------------------------------------------------------
5252+ */
5253+
5254+/*
5255+ * DTrace object allocation probe macros.
5256+ */
5257+
5258+#ifdef USE_DTRACE
5259+#ifndef _TCLDTRACE_H
5260+typedef const char *TclDTraceStr;
5261+#include "tclDTrace.h"
5262+#endif
5263+#define        TCL_DTRACE_OBJ_CREATE(objPtr)   TCL_OBJ_CREATE(objPtr)
5264+#define        TCL_DTRACE_OBJ_FREE(objPtr)     TCL_OBJ_FREE(objPtr)
5265+#else /* USE_DTRACE */
5266+#define        TCL_DTRACE_OBJ_CREATE(objPtr)   {}
5267+#define        TCL_DTRACE_OBJ_FREE(objPtr)     {}
5268+#endif /* USE_DTRACE */
5269+
5270+#ifdef TCL_COMPILE_STATS
5271+#  define TclIncrObjsAllocated() \
5272+    tclObjsAlloced++
5273+#  define TclIncrObjsFreed() \
5274+    tclObjsFreed++
5275+#else
5276+#  define TclIncrObjsAllocated()
5277+#  define TclIncrObjsFreed()
5278+#endif /* TCL_COMPILE_STATS */
5279+
5280+#  define TclAllocObjStorage(objPtr)           \
5281+       TclAllocObjStorageEx(NULL, (objPtr))
5282+
5283+#  define TclFreeObjStorage(objPtr)            \
5284+       TclFreeObjStorageEx(NULL, (objPtr))
5285+
5286+#ifndef TCL_MEM_DEBUG
5287+# define TclNewObj(objPtr) \
5288+    TclIncrObjsAllocated(); \
5289+    TclAllocObjStorage(objPtr); \
5290+    (objPtr)->refCount = 0; \
5291+    (objPtr)->bytes    = tclEmptyStringRep; \
5292+    (objPtr)->length   = 0; \
5293+    (objPtr)->typePtr  = NULL; \
5294+    TCL_DTRACE_OBJ_CREATE(objPtr)
5295+
5296+/*
5297+ * Invalidate the string rep first so we can use the bytes value for our
5298+ * pointer chain, and signal an obj deletion (as opposed to shimmering) with
5299+ * 'length == -1'.
5300+ * Use empty 'if ; else' to handle use in unbraced outer if/else conditions.
5301+ */
5302+
5303+# define TclDecrRefCount(objPtr) \
5304+    if (--(objPtr)->refCount > 0) ; else { \
5305+       if (!(objPtr)->typePtr || !(objPtr)->typePtr->freeIntRepProc) { \
5306+           TCL_DTRACE_OBJ_FREE(objPtr); \
5307+           if ((objPtr)->bytes \
5308+                   && ((objPtr)->bytes != tclEmptyStringRep)) { \
5309+               ckfree((char *) (objPtr)->bytes); \
5310+           } \
5311+           (objPtr)->length = -1; \
5312+           TclFreeObjStorage(objPtr); \
5313+           TclIncrObjsFreed(); \
5314+       } else { \
5315+           TclFreeObj(objPtr); \
5316+       } \
5317+    }
5318+
5319+#if defined(PURIFY)
5320+
5321+/*
5322+ * The PURIFY mode is like the regular mode, but instead of doing block
5323+ * Tcl_Obj allocation and keeping a freed list for efficiency, it always
5324+ * allocates and frees a single Tcl_Obj so that tools like Purify can better
5325+ * track memory leaks.
5326+ */
5327+
5328+#  define TclAllocObjStorageEx(interp, objPtr) \
5329+       (objPtr) = (Tcl_Obj *) Tcl_Alloc(sizeof(Tcl_Obj))
5330+
5331+#  define TclFreeObjStorageEx(interp, objPtr) \
5332+       ckfree((char *) (objPtr))
5333+
5334+#undef USE_THREAD_ALLOC
5335+#elif defined(TCL_THREADS) && defined(USE_THREAD_ALLOC)
5336+
5337+/*
5338+ * The TCL_THREADS mode is like the regular mode but allocates Tcl_Obj's from
5339+ * per-thread caches.
5340+ */
5341+
5342+MODULE_SCOPE Tcl_Obj * TclThreadAllocObj(void);
5343+MODULE_SCOPE void      TclThreadFreeObj(Tcl_Obj *);
5344+MODULE_SCOPE Tcl_Mutex *TclpNewAllocMutex(void);
5345+MODULE_SCOPE void      TclFreeAllocCache(void *);
5346+MODULE_SCOPE void *    TclpGetAllocCache(void);
5347+MODULE_SCOPE void      TclpSetAllocCache(void *);
5348+MODULE_SCOPE void      TclpFreeAllocMutex(Tcl_Mutex *mutex);
5349+MODULE_SCOPE void      TclpFreeAllocCache(void *);
5350+
5351+/*
5352+ * These macros need to be kept in sync with the code of TclThreadAllocObj()
5353+ * and TclThreadFreeObj().
5354+ *
5355+ * Note that the optimiser should resolve the case (interp==NULL) at compile
5356+ * time.
5357+ */
5358+
5359+#  define ALLOC_NOBJHIGH 1200
5360+
5361+#  define TclAllocObjStorageEx(interp, objPtr)                         \
5362+    do {                                                               \
5363+       AllocCache *cachePtr;                                           \
5364+       if (((interp) == NULL) ||                                       \
5365+               ((cachePtr = ((Interp *)(interp))->allocCache),         \
5366+                       (cachePtr->numObjects == 0))) {                 \
5367+           (objPtr) = TclThreadAllocObj();                             \
5368+       } else {                                                        \
5369+           (objPtr) = cachePtr->firstObjPtr;                           \
5370+           cachePtr->firstObjPtr = (objPtr)->internalRep.otherValuePtr; \
5371+           --cachePtr->numObjects;                                     \
5372+       }                                                               \
5373+    } while (0)
5374+
5375+#  define TclFreeObjStorageEx(interp, objPtr)                          \
5376+    do {                                                               \
5377+       AllocCache *cachePtr;                                           \
5378+       if (((interp) == NULL) ||                                       \
5379+               ((cachePtr = ((Interp *)(interp))->allocCache),         \
5380+                       (cachePtr->numObjects >= ALLOC_NOBJHIGH))) {    \
5381+           TclThreadFreeObj(objPtr);                                   \
5382+       } else {                                                        \
5383+           (objPtr)->internalRep.otherValuePtr = cachePtr->firstObjPtr; \
5384+           cachePtr->firstObjPtr = objPtr;                             \
5385+           ++cachePtr->numObjects;                                     \
5386+       }                                                               \
5387+    } while (0)
5388+
5389+#else /* not PURIFY or USE_THREAD_ALLOC */
5390+
5391+#if defined(USE_TCLALLOC) && USE_TCLALLOC
5392+    MODULE_SCOPE void TclFinalizeAllocSubsystem();
5393+    MODULE_SCOPE void TclInitAlloc();
5394+#else
5395+#   define USE_TCLALLOC 0
5396+#endif
5397+
5398+#ifdef TCL_THREADS
5399+/* declared in tclObj.c */
5400+MODULE_SCOPE Tcl_Mutex tclObjMutex;
5401+#endif
5402+
5403+#  define TclAllocObjStorageEx(interp, objPtr) \
5404+    do {                                                               \
5405+       Tcl_MutexLock(&tclObjMutex);                                    \
5406+       if (tclFreeObjList == NULL) {                                   \
5407+           TclAllocateFreeObjects();                                   \
5408+       }                                                               \
5409+       (objPtr) = tclFreeObjList;                                      \
5410+       tclFreeObjList = (Tcl_Obj *)                                    \
5411+               tclFreeObjList->internalRep.otherValuePtr;              \
5412+       Tcl_MutexUnlock(&tclObjMutex);                                  \
5413+    } while (0)
5414+
5415+#  define TclFreeObjStorageEx(interp, objPtr) \
5416+    do {                                                              \
5417+       Tcl_MutexLock(&tclObjMutex);                                   \
5418+       (objPtr)->internalRep.otherValuePtr = (void *) tclFreeObjList; \
5419+       tclFreeObjList = (objPtr);                                     \
5420+       Tcl_MutexUnlock(&tclObjMutex);                                 \
5421+    } while (0)
5422+#endif
5423+
5424+#else /* TCL_MEM_DEBUG */
5425+MODULE_SCOPE void      TclDbInitNewObj(Tcl_Obj *objPtr, const char *file,
5426+                           int line);
5427+
5428+# define TclDbNewObj(objPtr, file, line) \
5429+    do { \
5430+       TclIncrObjsAllocated();                                         \
5431+       (objPtr) = (Tcl_Obj *)                                          \
5432+               Tcl_DbCkalloc(sizeof(Tcl_Obj), (file), (line));         \
5433+       TclDbInitNewObj((objPtr), (file), (line));                      \
5434+       TCL_DTRACE_OBJ_CREATE(objPtr);                                  \
5435+    } while (0)
5436+
5437+# define TclNewObj(objPtr) \
5438+    TclDbNewObj(objPtr, __FILE__, __LINE__);
5439+
5440+# define TclDecrRefCount(objPtr) \
5441+    Tcl_DbDecrRefCount(objPtr, __FILE__, __LINE__)
5442+
5443+# define TclNewListObjDirect(objc, objv) \
5444+    TclDbNewListObjDirect(objc, objv, __FILE__, __LINE__)
5445+
5446+#undef USE_THREAD_ALLOC
5447+#endif /* TCL_MEM_DEBUG */
5448+
5449+/*
5450+ *----------------------------------------------------------------
5451+ * Macro used by the Tcl core to set a Tcl_Obj's string representation to a
5452+ * copy of the "len" bytes starting at "bytePtr". This code works even if the
5453+ * byte array contains NULLs as long as the length is correct. Because "len"
5454+ * is referenced multiple times, it should be as simple an expression as
5455+ * possible. The ANSI C "prototype" for this macro is:
5456+ *
5457+ * MODULE_SCOPE void TclInitStringRep(Tcl_Obj *objPtr, char *bytePtr, int len);
5458+ *
5459+ * This macro should only be called on an unshared objPtr where
5460+ *  objPtr->typePtr->freeIntRepProc == NULL
5461+ *----------------------------------------------------------------
5462+ */
5463+
5464+#define TclInitStringRep(objPtr, bytePtr, len) \
5465+    if ((len) == 0) { \
5466+       (objPtr)->bytes  = tclEmptyStringRep; \
5467+       (objPtr)->length = 0; \
5468+    } else { \
5469+       (objPtr)->bytes = (char *) ckalloc((unsigned) ((len) + 1)); \
5470+       memcpy((objPtr)->bytes, (bytePtr), (unsigned) (len)); \
5471+       (objPtr)->bytes[len] = '\0'; \
5472+       (objPtr)->length = (len); \
5473+    }
5474+
5475+/*
5476+ *----------------------------------------------------------------
5477+ * Macro used by the Tcl core to get the string representation's byte array
5478+ * pointer from a Tcl_Obj. This is an inline version of Tcl_GetString(). The
5479+ * macro's expression result is the string rep's byte pointer which might be
5480+ * NULL. The bytes referenced by this pointer must not be modified by the
5481+ * caller. The ANSI C "prototype" for this macro is:
5482+ *
5483+ * MODULE_SCOPE char * TclGetString(Tcl_Obj *objPtr);
5484+ *----------------------------------------------------------------
5485+ */
5486+
5487+#define TclGetString(objPtr) \
5488+    ((objPtr)->bytes? (objPtr)->bytes : Tcl_GetString((objPtr)))
5489+
5490+#define TclGetStringFromObj(objPtr, lenPtr) \
5491+    ((objPtr)->bytes \
5492+           ? (*(lenPtr) = (objPtr)->length, (objPtr)->bytes)   \
5493+           : Tcl_GetStringFromObj((objPtr), (lenPtr)))
5494+
5495+/*
5496+ *----------------------------------------------------------------
5497+ * Macro used by the Tcl core to clean out an object's internal
5498+ * representation. Does not actually reset the rep's bytes. The ANSI C
5499+ * "prototype" for this macro is:
5500+ *
5501+ * MODULE_SCOPE void   TclFreeIntRep(Tcl_Obj *objPtr);
5502+ *----------------------------------------------------------------
5503+ */
5504+
5505+#define TclFreeIntRep(objPtr) \
5506+    if ((objPtr)->typePtr != NULL) { \
5507+       if ((objPtr)->typePtr->freeIntRepProc != NULL) { \
5508+           (objPtr)->typePtr->freeIntRepProc(objPtr); \
5509+       } \
5510+       (objPtr)->typePtr = NULL; \
5511+    }
5512+
5513+/*
5514+ *----------------------------------------------------------------
5515+ * Macro used by the Tcl core to clean out an object's string representation.
5516+ * The ANSI C "prototype" for this macro is:
5517+ *
5518+ * MODULE_SCOPE void   TclInvalidateStringRep(Tcl_Obj *objPtr);
5519+ *----------------------------------------------------------------
5520+ */
5521+
5522+#define TclInvalidateStringRep(objPtr) \
5523+    if (objPtr->bytes != NULL) { \
5524+       if (objPtr->bytes != tclEmptyStringRep) { \
5525+           ckfree((char *) objPtr->bytes); \
5526+       } \
5527+       objPtr->bytes = NULL; \
5528+    }
5529+
5530+/*
5531+ *----------------------------------------------------------------
5532+ * Macros used by the Tcl core to grow Tcl_Token arrays. They use the same
5533+ * growth algorithm as used in tclStringObj.c for growing strings. The ANSI C
5534+ * "prototype" for this macro is:
5535+ *
5536+ * MODULE_SCOPE void   TclGrowTokenArray(Tcl_Token *tokenPtr, int used,
5537+ *                             int available, int append,
5538+ *                             Tcl_Token *staticPtr);
5539+ * MODULE_SCOPE void   TclGrowParseTokenArray(Tcl_Parse *parsePtr,
5540+ *                             int append);
5541+ *----------------------------------------------------------------
5542+ */
5543+
5544+/* General tuning for minimum growth in Tcl growth algorithms */
5545+#ifndef TCL_MIN_GROWTH
5546+#  ifdef TCL_GROWTH_MIN_ALLOC
5547+     /* Support for any legacy tuners */
5548+#    define TCL_MIN_GROWTH TCL_GROWTH_MIN_ALLOC
5549+#  else
5550+#    define TCL_MIN_GROWTH 1024
5551+#  endif
5552+#endif
5553+
5554+/* Token growth tuning, default to the general value. */
5555+#ifndef TCL_MIN_TOKEN_GROWTH
5556+#define TCL_MIN_TOKEN_GROWTH TCL_MIN_GROWTH/sizeof(Tcl_Token)
5557+#endif
5558+
5559+#define TCL_MAX_TOKENS (int)(UINT_MAX / sizeof(Tcl_Token))
5560+#define TclGrowTokenArray(tokenPtr, used, available, append, staticPtr)        \
5561+    do {                                                               \
5562+       int needed = (used) + (append);                                 \
5563+       if (needed > TCL_MAX_TOKENS) {                                  \
5564+           Tcl_Panic("max # of tokens for a Tcl parse (%d) exceeded",  \
5565+                   TCL_MAX_TOKENS);                                    \
5566+       }                                                               \
5567+       if (needed > (available)) {                                     \
5568+           int allocated = 2 * needed;                                 \
5569+           Tcl_Token *oldPtr = (tokenPtr);                             \
5570+           Tcl_Token *newPtr;                                          \
5571+           if (oldPtr == (staticPtr)) {                                \
5572+               oldPtr = NULL;                                          \
5573+           }                                                           \
5574+           if (allocated > TCL_MAX_TOKENS) {                           \
5575+               allocated = TCL_MAX_TOKENS;                             \
5576+           }                                                           \
5577+           newPtr = (Tcl_Token *) attemptckrealloc((char *) oldPtr,    \
5578+                   (unsigned int) (allocated * sizeof(Tcl_Token)));    \
5579+           if (newPtr == NULL) {                                       \
5580+               allocated = needed + (append) + TCL_MIN_TOKEN_GROWTH;   \
5581+               if (allocated > TCL_MAX_TOKENS) {                       \
5582+                   allocated = TCL_MAX_TOKENS;                         \
5583+               }                                                       \
5584+               newPtr = (Tcl_Token *) ckrealloc((char *) oldPtr,       \
5585+                       (unsigned int) (allocated * sizeof(Tcl_Token))); \
5586+           }                                                           \
5587+           (available) = allocated;                                    \
5588+           if (oldPtr == NULL) {                                       \
5589+               memcpy(newPtr, staticPtr,                               \
5590+                       (size_t) ((used) * sizeof(Tcl_Token)));         \
5591+           }                                                           \
5592+           (tokenPtr) = newPtr;                                        \
5593+       }                                                               \
5594+    } while (0)
5595+
5596+#define TclGrowParseTokenArray(parsePtr, append)                       \
5597+    TclGrowTokenArray((parsePtr)->tokenPtr, (parsePtr)->numTokens,     \
5598+           (parsePtr)->tokensAvailable, (append),                      \
5599+           (parsePtr)->staticTokens)
5600+
5601+/*
5602+ *----------------------------------------------------------------
5603+ * Macro used by the Tcl core get a unicode char from a utf string. It checks
5604+ * to see if we have a one-byte utf char before calling the real
5605+ * Tcl_UtfToUniChar, as this will save a lot of time for primarily ASCII
5606+ * string handling. The macro's expression result is 1 for the 1-byte case or
5607+ * the result of Tcl_UtfToUniChar. The ANSI C "prototype" for this macro is:
5608+ *
5609+ * MODULE_SCOPE int    TclUtfToUniChar(const char *string, Tcl_UniChar *ch);
5610+ *----------------------------------------------------------------
5611+ */
5612+
5613+#define TclUtfToUniChar(str, chPtr) \
5614+       ((((unsigned char) *(str)) < 0xC0) ?            \
5615+           ((*(chPtr) = (Tcl_UniChar) *(str)), 1)      \
5616+           : Tcl_UtfToUniChar(str, chPtr))
5617+
5618+/*
5619+ *----------------------------------------------------------------
5620+ * Macro counterpart of the Tcl_NumUtfChars() function. To be used in speed-
5621+ * -sensitive points where it pays to avoid a function call in the common case
5622+ * of counting along a string of all one-byte characters.  The ANSI C
5623+ * "prototype" for this macro is:
5624+ *
5625+ * MODULE_SCOPE void   TclNumUtfChars(int numChars, const char *bytes,
5626+ *                             int numBytes);
5627+ *----------------------------------------------------------------
5628+ */
5629+
5630+#define TclNumUtfChars(numChars, bytes, numBytes) \
5631+    do { \
5632+       int count, i = (numBytes); \
5633+       unsigned char *str = (unsigned char *) (bytes); \
5634+       while (i && (*str < 0xC0)) { i--; str++; } \
5635+       count = (numBytes) - i; \
5636+       if (i) { \
5637+           count += Tcl_NumUtfChars((bytes) + count, i); \
5638+       } \
5639+       (numChars) = count; \
5640+    } while (0);
5641+
5642+/*
5643+ *----------------------------------------------------------------
5644+ * Macro that encapsulates the logic that determines when it is safe to
5645+ * interpret a string as a byte array directly. In summary, the object must be
5646+ * a byte array and must not have a string representation (as the operations
5647+ * that it is used in are defined on strings, not byte arrays). Theoretically
5648+ * it is possible to also be efficient in the case where the object's bytes
5649+ * field is filled by generation from the byte array (c.f. list canonicality)
5650+ * but we don't do that at the moment since this is purely about efficiency.
5651+ * The ANSI C "prototype" for this macro is:
5652+ *
5653+ * MODULE_SCOPE int    TclIsPureByteArray(Tcl_Obj *objPtr);
5654+ *----------------------------------------------------------------
5655+ */
5656+
5657+#define TclIsPureByteArray(objPtr) \
5658+       (((objPtr)->typePtr==&tclByteArrayType) && ((objPtr)->bytes==NULL))
5659+
5660+/*
5661+ *----------------------------------------------------------------
5662+ * Macro used by the Tcl core to compare Unicode strings. On big-endian
5663+ * systems we can use the more efficient memcmp, but this would not be
5664+ * lexically correct on little-endian systems. The ANSI C "prototype" for
5665+ * this macro is:
5666+ *
5667+ * MODULE_SCOPE int    TclUniCharNcmp(const Tcl_UniChar *cs,
5668+ *                         const Tcl_UniChar *ct, unsigned long n);
5669+ *----------------------------------------------------------------
5670+ */
5671+
5672+#ifdef WORDS_BIGENDIAN
5673+#   define TclUniCharNcmp(cs,ct,n) memcmp((cs),(ct),(n)*sizeof(Tcl_UniChar))
5674+#else /* !WORDS_BIGENDIAN */
5675+#   define TclUniCharNcmp Tcl_UniCharNcmp
5676+#endif /* WORDS_BIGENDIAN */
5677+
5678+/*
5679+ *----------------------------------------------------------------
5680+ * Macro used by the Tcl core to increment a namespace's export export epoch
5681+ * counter. The ANSI C "prototype" for this macro is:
5682+ *
5683+ * MODULE_SCOPE void   TclInvalidateNsCmdLookup(Namespace *nsPtr);
5684+ *----------------------------------------------------------------
5685+ */
5686+
5687+#define TclInvalidateNsCmdLookup(nsPtr) \
5688+    if ((nsPtr)->numExportPatterns) {          \
5689+       (nsPtr)->exportLookupEpoch++;           \
5690+    }                                          \
5691+    if ((nsPtr)->commandPathLength) {          \
5692+       (nsPtr)->cmdRefEpoch++;                 \
5693+    }
5694+
5695+/*
5696+ *----------------------------------------------------------------------
5697+ *
5698+ * Core procedures added to libtommath for bignum manipulation.
5699+ *
5700+ *----------------------------------------------------------------------
5701+ */
5702+
5703+MODULE_SCOPE Tcl_PackageInitProc TclTommath_Init;
5704+MODULE_SCOPE void      TclBNInitBignumFromLong(mp_int *bignum, long initVal);
5705+MODULE_SCOPE void      TclBNInitBignumFromWideInt(mp_int *bignum,
5706+                           Tcl_WideInt initVal);
5707+MODULE_SCOPE void      TclBNInitBignumFromWideUInt(mp_int *bignum,
5708+                           Tcl_WideUInt initVal);
5709+
5710+/*
5711+ *----------------------------------------------------------------------
5712+ *
5713+ * External (platform specific) initialization routine, these declarations
5714+ * explicitly don't use EXTERN since this code does not get compiled into the
5715+ * library:
5716+ *
5717+ *----------------------------------------------------------------------
5718+ */
5719+
5720+MODULE_SCOPE Tcl_PackageInitProc TclplatformtestInit;
5721+MODULE_SCOPE Tcl_PackageInitProc TclObjTest_Init;
5722+MODULE_SCOPE Tcl_PackageInitProc TclThread_Init;
5723+MODULE_SCOPE Tcl_PackageInitProc Procbodytest_Init;
5724+MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit;
5725+
5726+/*
5727+ *----------------------------------------------------------------
5728+ * Macro used by the Tcl core to check whether a pattern has any characters
5729+ * special to [string match]. The ANSI C "prototype" for this macro is:
5730+ *
5731+ * MODULE_SCOPE int    TclMatchIsTrivial(const char *pattern);
5732+ *----------------------------------------------------------------
5733+ */
5734+
5735+#define TclMatchIsTrivial(pattern) \
5736+    (strpbrk((pattern), "*[?\\") == NULL)
5737+
5738+/*
5739+ *----------------------------------------------------------------
5740+ * Macros used by the Tcl core to set a Tcl_Obj's numeric representation
5741+ * avoiding the corresponding function calls in time critical parts of the
5742+ * core. They should only be called on unshared objects. The ANSI C
5743+ * "prototypes" for these macros are:
5744+ *
5745+ * MODULE_SCOPE void   TclSetIntObj(Tcl_Obj *objPtr, int intValue);
5746+ * MODULE_SCOPE void   TclSetLongObj(Tcl_Obj *objPtr, long longValue);
5747+ * MODULE_SCOPE void   TclSetBooleanObj(Tcl_Obj *objPtr, long boolValue);
5748+ * MODULE_SCOPE void   TclSetWideIntObj(Tcl_Obj *objPtr, Tcl_WideInt w);
5749+ * MODULE_SCOPE void   TclSetDoubleObj(Tcl_Obj *objPtr, double d);
5750+ *----------------------------------------------------------------
5751+ */
5752+
5753+#define TclSetIntObj(objPtr, i) \
5754+    do {                                               \
5755+       TclInvalidateStringRep(objPtr);                 \
5756+       TclFreeIntRep(objPtr);                          \
5757+       (objPtr)->internalRep.longValue = (long)(i);    \
5758+       (objPtr)->typePtr = &tclIntType;                \
5759+    } while (0)
5760+
5761+#define TclSetLongObj(objPtr, l) \
5762+    TclSetIntObj((objPtr), (l))
5763+
5764+/*
5765+ * NOTE: There is to be no such thing as a "pure" boolean. Boolean values set
5766+ * programmatically go straight to being "int" Tcl_Obj's, with value 0 or 1.
5767+ * The only "boolean" Tcl_Obj's shall be those holding the cached boolean
5768+ * value of strings like: "yes", "no", "true", "false", "on", "off".
5769+ */
5770+
5771+#define TclSetBooleanObj(objPtr, b) \
5772+    TclSetIntObj((objPtr), ((b)? 1 : 0));
5773+
5774+#ifndef NO_WIDE_TYPE
5775+#define TclSetWideIntObj(objPtr, w) \
5776+    do {                                                       \
5777+       TclInvalidateStringRep(objPtr);                         \
5778+       TclFreeIntRep(objPtr);                                  \
5779+       (objPtr)->internalRep.wideValue = (Tcl_WideInt)(w);     \
5780+       (objPtr)->typePtr = &tclWideIntType;                    \
5781+    } while (0)
5782+#endif
5783+
5784+#define TclSetDoubleObj(objPtr, d) \
5785+    do {                                                       \
5786+       TclInvalidateStringRep(objPtr);                         \
5787+       TclFreeIntRep(objPtr);                                  \
5788+       (objPtr)->internalRep.doubleValue = (double)(d);        \
5789+       (objPtr)->typePtr = &tclDoubleType;                     \
5790+    } while (0)
5791+
5792+/*
5793+ *----------------------------------------------------------------
5794+ * Macros used by the Tcl core to create and initialise objects of standard
5795+ * types, avoiding the corresponding function calls in time critical parts of
5796+ * the core. The ANSI C "prototypes" for these macros are:
5797+ *
5798+ * MODULE_SCOPE void   TclNewIntObj(Tcl_Obj *objPtr, int i);
5799+ * MODULE_SCOPE void   TclNewLongObj(Tcl_Obj *objPtr, long l);
5800+ * MODULE_SCOPE void   TclNewBooleanObj(Tcl_Obj *objPtr, int b);
5801+ * MODULE_SCOPE void   TclNewWideObj(Tcl_Obj *objPtr, Tcl_WideInt w);
5802+ * MODULE_SCOPE void   TclNewDoubleObj(Tcl_Obj *objPtr, double d);
5803+ * MODULE_SCOPE void   TclNewStringObj(Tcl_Obj *objPtr, char *s, int len);
5804+ * MODULE_SCOPE void   TclNewLiteralStringObj(Tcl_Obj*objPtr, char*sLiteral);
5805+ *
5806+ *----------------------------------------------------------------
5807+ */
5808+
5809+#ifndef TCL_MEM_DEBUG
5810+#define TclNewIntObj(objPtr, i) \
5811+    do {                                               \
5812+       TclIncrObjsAllocated();                         \
5813+       TclAllocObjStorage(objPtr);                     \
5814+       (objPtr)->refCount = 0;                         \
5815+       (objPtr)->bytes = NULL;                         \
5816+       (objPtr)->internalRep.longValue = (long)(i);    \
5817+       (objPtr)->typePtr = &tclIntType;                \
5818+       TCL_DTRACE_OBJ_CREATE(objPtr);                  \
5819+    } while (0)
5820+
5821+#define TclNewLongObj(objPtr, l) \
5822+    TclNewIntObj((objPtr), (l))
5823+
5824+/*
5825+ * NOTE: There is to be no such thing as a "pure" boolean.
5826+ * See comment above TclSetBooleanObj macro above.
5827+ */
5828+#define TclNewBooleanObj(objPtr, b) \
5829+    TclNewIntObj((objPtr), ((b)? 1 : 0))
5830+
5831+#define TclNewDoubleObj(objPtr, d) \
5832+    do {                                                       \
5833+       TclIncrObjsAllocated();                                 \
5834+       TclAllocObjStorage(objPtr);                             \
5835+       (objPtr)->refCount = 0;                                 \
5836+       (objPtr)->bytes = NULL;                                 \
5837+       (objPtr)->internalRep.doubleValue = (double)(d);        \
5838+       (objPtr)->typePtr = &tclDoubleType;                     \
5839+       TCL_DTRACE_OBJ_CREATE(objPtr);                          \
5840+    } while (0)
5841+
5842+#define TclNewStringObj(objPtr, s, len) \
5843+    do {                                                       \
5844+       TclIncrObjsAllocated();                                 \
5845+       TclAllocObjStorage(objPtr);                             \
5846+       (objPtr)->refCount = 0;                                 \
5847+       TclInitStringRep((objPtr), (s), (len));                 \
5848+       (objPtr)->typePtr = NULL;                               \
5849+       TCL_DTRACE_OBJ_CREATE(objPtr);                          \
5850+    } while (0)
5851+
5852+#else /* TCL_MEM_DEBUG */
5853+#define TclNewIntObj(objPtr, i) \
5854+    (objPtr) = Tcl_NewIntObj(i)
5855+
5856+#define TclNewLongObj(objPtr, l) \
5857+    (objPtr) = Tcl_NewLongObj(l)
5858+
5859+#define TclNewBooleanObj(objPtr, b) \
5860+    (objPtr) = Tcl_NewBooleanObj(b)
5861+
5862+#define TclNewDoubleObj(objPtr, d) \
5863+    (objPtr) = Tcl_NewDoubleObj(d)
5864+
5865+#define TclNewStringObj(objPtr, s, len) \
5866+    (objPtr) = Tcl_NewStringObj((s), (len))
5867+#endif /* TCL_MEM_DEBUG */
5868+
5869+/*
5870+ * The sLiteral argument *must* be a string literal; the incantation with
5871+ * sizeof(sLiteral "") will fail to compile otherwise.
5872+ */
5873+#define TclNewLiteralStringObj(objPtr, sLiteral) \
5874+    TclNewStringObj((objPtr), (sLiteral), (int) (sizeof(sLiteral "") - 1))
5875+
5876+/*
5877+ *----------------------------------------------------------------
5878+ * Convenience macros for DStrings.
5879+ * The ANSI C "prototypes" for these macros are:
5880+ *
5881+ * MODULE_SCOPE char * TclDStringAppendLiteral(Tcl_DString *dsPtr,
5882+ *                     const char *sLiteral);
5883+ * MODULE_SCOPE void   TclDStringClear(Tcl_DString *dsPtr);
5884+ */
5885+
5886+#define TclDStringAppendLiteral(dsPtr, sLiteral) \
5887+    Tcl_DStringAppend((dsPtr), (sLiteral), (int) (sizeof(sLiteral "") - 1))
5888+#define TclDStringClear(dsPtr) \
5889+    Tcl_DStringSetLength((dsPtr), 0)
5890+
5891+/*
5892+ *----------------------------------------------------------------
5893+ * Macros used by the Tcl core to test for some special double values.
5894+ * The ANSI C "prototypes" for these macros are:
5895+ *
5896+ * MODULE_SCOPE int    TclIsInfinite(double d);
5897+ * MODULE_SCOPE int    TclIsNaN(double d);
5898+ */
5899+
5900+#ifdef _MSC_VER
5901+#    define TclIsInfinite(d)   (!(_finite((d))))
5902+#    define TclIsNaN(d)                (_isnan((d)))
5903+#else
5904+#    define TclIsInfinite(d)   ((d) > DBL_MAX || (d) < -DBL_MAX)
5905+#    ifdef NO_ISNAN
5906+#       define TclIsNaN(d)     ((d) != (d))
5907+#    else
5908+#       define TclIsNaN(d)     (isnan(d))
5909+#    endif
5910+#endif
5911+
5912+/*
5913+ * ----------------------------------------------------------------------
5914+ * Macro to use to find the offset of a field in a structure. Computes number
5915+ * of bytes from beginning of structure to a given field.
5916+ */
5917+
5918+#ifdef offsetof
5919+#define TclOffset(type, field) ((int) offsetof(type, field))
5920+#else
5921+#define TclOffset(type, field) ((int) ((char *) &((type *) 0)->field))
5922+#endif
5923+
5924+/*
5925+ *----------------------------------------------------------------
5926+ * Inline version of Tcl_GetCurrentNamespace and Tcl_GetGlobalNamespace.
5927+ */
5928+
5929+#define TclGetCurrentNamespace(interp) \
5930+    (Tcl_Namespace *) ((Interp *)(interp))->varFramePtr->nsPtr
5931+
5932+#define TclGetGlobalNamespace(interp) \
5933+    (Tcl_Namespace *) ((Interp *)(interp))->globalNsPtr
5934+
5935+/*
5936+ *----------------------------------------------------------------
5937+ * Inline version of TclCleanupCommand; still need the function as it is in
5938+ * the internal stubs, but the core can use the macro instead.
5939+ */
5940+
5941+#define TclCleanupCommandMacro(cmdPtr) \
5942+    if (--(cmdPtr)->refCount <= 0) { \
5943+       ckfree((char *) (cmdPtr));\
5944+    }
5945+
5946+/*
5947+ *----------------------------------------------------------------
5948+ * Inline versions of Tcl_LimitReady() and Tcl_LimitExceeded to limit number
5949+ * of calls out of the critical path. Note that this code isn't particularly
5950+ * readable; the non-inline version (in tclInterp.c) is much easier to
5951+ * understand. Note also that these macros takes different args (iPtr->limit)
5952+ * to the non-inline version.
5953+ */
5954+
5955+#define TclLimitExceeded(limit) ((limit).exceeded != 0)
5956+
5957+#define TclLimitReady(limit)                                           \
5958+    (((limit).active == 0) ? 0 :                                       \
5959+    (++(limit).granularityTicker,                                      \
5960+    ((((limit).active & TCL_LIMIT_COMMANDS) &&                         \
5961+           (((limit).cmdGranularity == 1) ||                           \
5962+           ((limit).granularityTicker % (limit).cmdGranularity == 0))) \
5963+           ? 1 :                                                       \
5964+    (((limit).active & TCL_LIMIT_TIME) &&                              \
5965+           (((limit).timeGranularity == 1) ||                          \
5966+           ((limit).granularityTicker % (limit).timeGranularity == 0)))\
5967+           ? 1 : 0)))
5968+
5969+/*
5970+ * Compile-time assertions: these produce a compile time error if the
5971+ * expression is not known to be true at compile time. If the assertion is
5972+ * known to be false, the compiler (or optimizer?) will error out with
5973+ * "division by zero". If the assertion cannot be evaluated at compile time,
5974+ * the compiler will error out with "non-static initializer".
5975+ *
5976+ * Adapted with permission from
5977+ * http://www.pixelbeat.org/programming/gcc/static_assert.html
5978+ */
5979+
5980+#define TCL_CT_ASSERT(e) \
5981+    {enum { ct_assert_value = 1/(!!(e)) };}
5982+
5983+/*
5984+ *----------------------------------------------------------------
5985+ * Allocator for small structs (<=sizeof(Tcl_Obj)) using the Tcl_Obj pool.
5986+ * Only checked at compile time.
5987+ *
5988+ * ONLY USE FOR CONSTANT nBytes.
5989+ *
5990+ * DO NOT LET THEM CROSS THREAD BOUNDARIES
5991+ *----------------------------------------------------------------
5992+ */
5993+
5994+#define TclSmallAlloc(nbytes, memPtr) \
5995+    TclSmallAllocEx(NULL, (nbytes), (memPtr))
5996+
5997+#define TclSmallFree(memPtr) \
5998+    TclSmallFreeEx(NULL, (memPtr))
5999+
6000+#ifndef TCL_MEM_DEBUG
6001+#define TclSmallAllocEx(interp, nbytes, memPtr) \
6002+    do {                                                               \
6003+       Tcl_Obj *objPtr;                                                \
6004+       TCL_CT_ASSERT((nbytes)<=sizeof(Tcl_Obj));                       \
6005+       TclIncrObjsAllocated();                                         \
6006+       TclAllocObjStorageEx((interp), (objPtr));                       \
6007+       memPtr = (ClientData) (objPtr);                                 \
6008+    } while (0)
6009+
6010+#define TclSmallFreeEx(interp, memPtr) \
6011+    do {                                                               \
6012+       TclFreeObjStorageEx((interp), (Tcl_Obj *) (memPtr));            \
6013+       TclIncrObjsFreed();                                             \
6014+    } while (0)
6015+
6016+#else    /* TCL_MEM_DEBUG */
6017+#define TclSmallAllocEx(interp, nbytes, memPtr) \
6018+    do {                                                               \
6019+       Tcl_Obj *objPtr;                                                \
6020+       TCL_CT_ASSERT((nbytes)<=sizeof(Tcl_Obj));                       \
6021+       TclNewObj(objPtr);                                              \
6022+       memPtr = (ClientData) objPtr;                                   \
6023+    } while (0)
6024+
6025+#define TclSmallFreeEx(interp, memPtr) \
6026+    do {                                                               \
6027+       Tcl_Obj *objPtr = (Tcl_Obj *) memPtr;                           \
6028+       objPtr->bytes = NULL;                                           \
6029+       objPtr->typePtr = NULL;                                         \
6030+       objPtr->refCount = 1;                                           \
6031+       TclDecrRefCount(objPtr);                                        \
6032+    } while (0)
6033+#endif   /* TCL_MEM_DEBUG */
6034+
6035+/*
6036+ * Support for Clang Static Analyzer <http://clang-analyzer.llvm.org>
6037+ */
6038+
6039+#if defined(PURIFY) && defined(__clang__)
6040+#if __has_feature(attribute_analyzer_noreturn) && \
6041+       !defined(Tcl_Panic) && defined(Tcl_Panic_TCL_DECLARED)
6042+void Tcl_Panic(const char *, ...) __attribute__((analyzer_noreturn));
6043+#endif
6044+#if !defined(CLANG_ASSERT)
6045+#include <assert.h>
6046+#define CLANG_ASSERT(x) assert(x)
6047+#endif
6048+#elif !defined(CLANG_ASSERT)
6049+#define CLANG_ASSERT(x)
6050+#endif /* PURIFY && __clang__ */
6051+
6052+/*
6053+ *----------------------------------------------------------------
6054+ * Parameters, structs and macros for the non-recursive engine (NRE)
6055+ *----------------------------------------------------------------
6056+ */
6057+
6058+#define NRE_USE_SMALL_ALLOC    1  /* Only turn off for debugging purposes. */
6059+#define NRE_ENABLE_ASSERTS     1
6060+
6061+/*
6062+ * This is the main data struct for representing NR commands. It is designed
6063+ * to fit in sizeof(Tcl_Obj) in order to exploit the fastest memory allocator
6064+ * available.
6065+ */
6066+
6067+typedef struct NRE_callback {
6068+    Tcl_NRPostProc *procPtr;
6069+    ClientData data[4];
6070+    struct NRE_callback *nextPtr;
6071+} NRE_callback;
6072+
6073+#define TOP_CB(iPtr) (((Interp *)(iPtr))->execEnvPtr->callbackPtr)
6074+
6075+/*
6076+ * Inline version of Tcl_NRAddCallback.
6077+ */
6078+
6079+#define TclNRAddCallback(interp,postProcPtr,data0,data1,data2,data3) \
6080+    do {                                                               \
6081+       NRE_callback *callbackPtr;                                      \
6082+       TCLNR_ALLOC((interp), (callbackPtr));                           \
6083+       callbackPtr->procPtr = (postProcPtr);                           \
6084+       callbackPtr->data[0] = (ClientData)(data0);                     \
6085+       callbackPtr->data[1] = (ClientData)(data1);                     \
6086+       callbackPtr->data[2] = (ClientData)(data2);                     \
6087+       callbackPtr->data[3] = (ClientData)(data3);                     \
6088+       callbackPtr->nextPtr = TOP_CB(interp);                          \
6089+       TOP_CB(interp) = callbackPtr;                                   \
6090+    } while (0)
6091+
6092+#define TclNRDeferCallback(interp,postProcPtr,data0,data1,data2,data3) \
6093+    do {                                                               \
6094+       NRE_callback *callbackPtr;                                      \
6095+       TCLNR_ALLOC((interp), (callbackPtr));                           \
6096+       callbackPtr->procPtr = (postProcPtr);                           \
6097+       callbackPtr->data[0] = (ClientData)(data0);                     \
6098+       callbackPtr->data[1] = (ClientData)(data1);                     \
6099+       callbackPtr->data[2] = (ClientData)(data2);                     \
6100+       callbackPtr->data[3] = (ClientData)(data3);                     \
6101+       callbackPtr->nextPtr = ((Interp *)interp)->deferredCallbacks;   \
6102+       ((Interp *)interp)->deferredCallbacks = callbackPtr;            \
6103+    } while (0)
6104+
6105+#define TclNRSpliceCallbacks(interp, topPtr) \
6106+    do {                                       \
6107+       NRE_callback *bottomPtr = topPtr;       \
6108+       while (bottomPtr->nextPtr) {            \
6109+           bottomPtr = bottomPtr->nextPtr;     \
6110+       }                                       \
6111+       bottomPtr->nextPtr = TOP_CB(interp);    \
6112+       TOP_CB(interp) = topPtr;                \
6113+    } while (0)
6114+
6115+#define TclNRSpliceDeferred(interp)                                    \
6116+    if (((Interp *)interp)->deferredCallbacks) {                       \
6117+       TclNRSpliceCallbacks(interp, ((Interp *)interp)->deferredCallbacks); \
6118+       ((Interp *)interp)->deferredCallbacks = NULL;                   \
6119+    }
6120+
6121+#if NRE_USE_SMALL_ALLOC
6122+#define TCLNR_ALLOC(interp, ptr) \
6123+    TclSmallAllocEx(interp, sizeof(NRE_callback), (ptr))
6124+#define TCLNR_FREE(interp, ptr)  TclSmallFreeEx((interp), (ptr))
6125+#else
6126+#define TCLNR_ALLOC(interp, ptr) \
6127+    (ptr = ((ClientData) ckalloc(sizeof(NRE_callback))))
6128+#define TCLNR_FREE(interp, ptr)  ckfree((char *) (ptr))
6129+#endif
6130+
6131+#if NRE_ENABLE_ASSERTS
6132+#define NRE_ASSERT(expr) assert((expr))
6133+#else
6134+#define NRE_ASSERT(expr)
6135+#endif
6136+
6137+#include "tclIntDecls.h"
6138+#include "tclIntPlatDecls.h"
6139+#include "tclTomMathDecls.h"
6140+
6141+#if !defined(USE_TCL_STUBS) && !defined(TCL_MEM_DEBUG)
6142+#define Tcl_AttemptAlloc(size)        TclpAlloc(size)
6143+#define Tcl_AttemptRealloc(ptr, size) TclpRealloc((ptr), (size))
6144+#define Tcl_Free(ptr)                 TclpFree(ptr)
6145+#endif
6146+
6147+#endif /* _TCLINT */
6148+
6149+/*
6150+ * Local Variables:
6151+ * mode: c
6152+ * c-basic-offset: 4
6153+ * fill-column: 78
6154+ * End:
6155+ */
6156--- src/tclPort.h       1969-12-31 19:00:00.000000000 -0500
6157+++ src/tclPort.h       2013-08-20 11:44:02.000000000 -0400
6158@@ -0,0 +1,44 @@
6159+/*
6160+ * tclPort.h --
6161+ *
6162+ *     This header file handles porting issues that occur because
6163+ *     of differences between systems.  It reads in platform specific
6164+ *     portability files.
6165+ *
6166+ * Copyright (c) 1994-1995 Sun Microsystems, Inc.
6167+ *
6168+ * See the file "license.terms" for information on usage and redistribution
6169+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
6170+ */
6171+
6172+#ifndef _TCLPORT
6173+#define _TCLPORT
6174+
6175+#ifdef HAVE_TCL_CONFIG_H
6176+#include "tclConfig.h"
6177+#endif
6178+#if defined(_WIN32)
6179+#   include "tclWinPort.h"
6180+#endif
6181+#include "tcl.h"
6182+#if !defined(_WIN32)
6183+#   include "../unix/tclUnixPort.h"
6184+#endif
6185+
6186+#if !defined(LLONG_MIN)
6187+#   ifdef TCL_WIDE_INT_IS_LONG
6188+#      define LLONG_MIN LONG_MIN
6189+#   else
6190+#      ifdef LLONG_BIT
6191+#         define LLONG_MIN ((Tcl_WideInt)(Tcl_LongAsWide(1)<<(LLONG_BIT-1)))
6192+#      else
6193+/* Assume we're on a system with a 64-bit 'long long' type */
6194+#         define LLONG_MIN ((Tcl_WideInt)(Tcl_LongAsWide(1)<<63))
6195+#      endif
6196+#   endif
6197+/* Assume that if LLONG_MIN is undefined, then so is LLONG_MAX */
6198+#   define LLONG_MAX (~LLONG_MIN)
6199+#endif
6200+
6201+
6202+#endif /* _TCLPORT */
6203--- src/tk3d.h  1969-12-31 19:00:00.000000000 -0500
6204+++ src/tk3d.h  2013-08-20 11:45:41.000000000 -0400
6205@@ -0,0 +1,85 @@
6206+/*
6207+ * tk3d.h --
6208+ *
6209+ *     Declarations of types and functions shared by the 3d border module.
6210+ *
6211+ * Copyright (c) 1996-1997 by Sun Microsystems, Inc.
6212+ *
6213+ * See the file "license.terms" for information on usage and redistribution of
6214+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
6215+ */
6216+
6217+#ifndef _TK3D
6218+#define _TK3D
6219+
6220+#include "tkInt.h"
6221+
6222+/*
6223+ * One of the following data structures is allocated for each 3-D border
6224+ * currently in use. Structures of this type are indexed by borderTable, so
6225+ * that a single structure can be shared for several uses.
6226+ */
6227+
6228+typedef struct TkBorder {
6229+    Screen *screen;            /* Screen on which the border will be used. */
6230+    Visual *visual;            /* Visual for all windows and pixmaps using
6231+                                * the border. */
6232+    int depth;                 /* Number of bits per pixel of drawables where
6233+                                * the border will be used. */
6234+    Colormap colormap;         /* Colormap out of which pixels are
6235+                                * allocated. */
6236+    int resourceRefCount;      /* Number of active uses of this color (each
6237+                                * active use corresponds to a call to
6238+                                * Tk_Alloc3DBorderFromObj or Tk_Get3DBorder).
6239+                                * If this count is 0, then this structure is
6240+                                * no longer valid and it isn't present in
6241+                                * borderTable: it is being kept around only
6242+                                * because there are objects referring to it.
6243+                                * The structure is freed when objRefCount and
6244+                                * resourceRefCount are both 0. */
6245+    int objRefCount;           /* The number of Tcl objects that reference
6246+                                * this structure. */
6247+    XColor *bgColorPtr;                /* Background color (intensity between
6248+                                * lightColorPtr and darkColorPtr). */
6249+    XColor *darkColorPtr;      /* Color for darker areas (must free when
6250+                                * deleting structure). NULL means shadows
6251+                                * haven't been allocated yet.*/
6252+    XColor *lightColorPtr;     /* Color used for lighter areas of border
6253+                                * (must free this when deleting structure).
6254+                                * NULL means shadows haven't been allocated
6255+                                * yet. */
6256+    Pixmap shadow;             /* Stipple pattern to use for drawing shadows
6257+                                * areas. Used for displays with <= 64 colors
6258+                                * or where colormap has filled up. */
6259+    GC bgGC;                   /* Used (if necessary) to draw areas in the
6260+                                * background color. */
6261+    GC darkGC;                 /* Used to draw darker parts of the border.
6262+                                * None means the shadow colors haven't been
6263+                                * allocated yet.*/
6264+    GC lightGC;                        /* Used to draw lighter parts of the border.
6265+                                * None means the shadow colors haven't been
6266+                                * allocated yet. */
6267+    Tcl_HashEntry *hashPtr;    /* Entry in borderTable (needed in order to
6268+                                * delete structure). */
6269+    struct TkBorder *nextPtr;  /* Points to the next TkBorder structure with
6270+                                * the same color name. Borders with the same
6271+                                * name but different screens or colormaps are
6272+                                * chained together off a single entry in
6273+                                * borderTable. */
6274+} TkBorder;
6275+
6276+/*
6277+ * Maximum intensity for a color:
6278+ */
6279+
6280+#define MAX_INTENSITY 65535
6281+
6282+/*
6283+ * Declarations for platform specific interfaces used by this module.
6284+ */
6285+
6286+MODULE_SCOPE TkBorder  *TkpGetBorder(void);
6287+MODULE_SCOPE void      TkpGetShadows(TkBorder *borderPtr, Tk_Window tkwin);
6288+MODULE_SCOPE void      TkpFreeBorder(TkBorder *borderPtr);
6289+
6290+#endif /* _TK3D */
6291--- src/tkFont.h        1969-12-31 19:00:00.000000000 -0500
6292+++ src/tkFont.h        2013-08-20 11:45:52.000000000 -0400
6293@@ -0,0 +1,224 @@
6294+/*
6295+ * tkFont.h --
6296+ *
6297+ *     Declarations for interfaces between the generic and platform-specific
6298+ *     parts of the font package. This information is not visible outside of
6299+ *     the font package.
6300+ *
6301+ * Copyright (c) 1996-1997 Sun Microsystems, Inc.
6302+ *
6303+ * See the file "license.terms" for information on usage and redistribution of
6304+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
6305+ */
6306+
6307+#ifndef _TKFONT
6308+#define _TKFONT
6309+
6310+/*
6311+ * The following structure keeps track of the attributes of a font. It can be
6312+ * used to keep track of either the desired attributes or the actual
6313+ * attributes gotten when the font was instantiated.
6314+ */
6315+
6316+struct TkFontAttributes {
6317+    Tk_Uid family;             /* Font family, or NULL to represent plaform-
6318+                                * specific default system font. */
6319+    int size;                  /* Pointsize of font, 0 for default size, or
6320+                                * negative number meaning pixel size. */
6321+    int weight;                        /* Weight flag; see below for def'n. */
6322+    int slant;                 /* Slant flag; see below for def'n. */
6323+    int underline;             /* Non-zero for underline font. */
6324+    int overstrike;            /* Non-zero for overstrike font. */
6325+};
6326+
6327+/*
6328+ * Possible values for the "weight" field in a TkFontAttributes structure.
6329+ * Weight is a subjective term and depends on what the company that created
6330+ * the font considers bold.
6331+ */
6332+
6333+#define TK_FW_NORMAL   0
6334+#define TK_FW_BOLD     1
6335+
6336+#define TK_FW_UNKNOWN  -1      /* Unknown weight. This value is used for
6337+                                * error checking and is never actually stored
6338+                                * in the weight field. */
6339+
6340+/*
6341+ * Possible values for the "slant" field in a TkFontAttributes structure.
6342+ */
6343+
6344+#define TK_FS_ROMAN    0
6345+#define TK_FS_ITALIC   1
6346+#define TK_FS_OBLIQUE  2       /* This value is only used when parsing X font
6347+                                * names to determine the closest match. It is
6348+                                * only stored in the XLFDAttributes
6349+                                * structure, never in the slant field of the
6350+                                * TkFontAttributes. */
6351+
6352+#define TK_FS_UNKNOWN  -1      /* Unknown slant. This value is used for error
6353+                                * checking and is never actually stored in
6354+                                * the slant field. */
6355+
6356+/*
6357+ * The following structure keeps track of the metrics for an instantiated
6358+ * font. The metrics are the physical properties of the font itself.
6359+ */
6360+
6361+typedef struct TkFontMetrics {
6362+    int        ascent;                 /* From baseline to top of font. */
6363+    int        descent;                /* From baseline to bottom of font. */
6364+    int maxWidth;              /* Width of widest character in font. */
6365+    int fixed;                 /* Non-zero if this is a fixed-width font,
6366+                                * 0 otherwise. */
6367+} TkFontMetrics;
6368+
6369+/*
6370+ * The following structure is used to keep track of the generic information
6371+ * about a font. Each platform-specific font is represented by a structure
6372+ * with the following structure at its beginning, plus any platform-specific
6373+ * stuff after that.
6374+ */
6375+
6376+typedef struct TkFont {
6377+    /*
6378+     * Fields used and maintained exclusively by generic code.
6379+     */
6380+
6381+    int resourceRefCount;      /* Number of active uses of this font (each
6382+                                * active use corresponds to a call to
6383+                                * Tk_AllocFontFromTable or Tk_GetFont). If
6384+                                * this count is 0, then this TkFont structure
6385+                                * is no longer valid and it isn't present in
6386+                                * a hash table: it is being kept around only
6387+                                * because there are objects referring to it.
6388+                                * The structure is freed when
6389+                                * resourceRefCount and objRefCount are both
6390+                                * 0. */
6391+    int objRefCount;           /* The number of Tcl objects that reference
6392+                                * this structure. */
6393+    Tcl_HashEntry *cacheHashPtr;/* Entry in font cache for this structure,
6394+                                * used when deleting it. */
6395+    Tcl_HashEntry *namedHashPtr;/* Pointer to hash table entry that
6396+                                * corresponds to the named font that the
6397+                                * tkfont was based on, or NULL if the tkfont
6398+                                * was not based on a named font. */
6399+    Screen *screen;            /* The screen where this font is valid. */
6400+    int tabWidth;              /* Width of tabs in this font (pixels). */
6401+    int        underlinePos;           /* Offset from baseline to origin of underline
6402+                                * bar (used for drawing underlines on a
6403+                                * non-underlined font). */
6404+    int underlineHeight;       /* Height of underline bar (used for drawing
6405+                                * underlines on a non-underlined font). */
6406+
6407+    /*
6408+     * Fields used in the generic code that are filled in by
6409+     * platform-specific code.
6410+     */
6411+
6412+    Font fid;                  /* For backwards compatibility with XGCValues
6413+                                * structures. Remove when TkGCValues is
6414+                                * implemented. */
6415+    TkFontAttributes fa;       /* Actual font attributes obtained when the
6416+                                * the font was created, as opposed to the
6417+                                * desired attributes passed in to
6418+                                * TkpGetFontFromAttributes(). The desired
6419+                                * metrics can be determined from the string
6420+                                * that was used to create this font. */
6421+    TkFontMetrics fm;          /* Font metrics determined when font was
6422+                                * created. */
6423+    struct TkFont *nextPtr;    /* Points to the next TkFont structure with
6424+                                * the same name. All fonts with the same name
6425+                                * (but different displays) are chained
6426+                                * together off a single entry in a hash
6427+                                * table. */
6428+} TkFont;
6429+
6430+/*
6431+ * The following structure is used to return attributes when parsing an XLFD.
6432+ * The extra information is of interest to the Unix-specific code when
6433+ * attempting to find the closest matching font.
6434+ */
6435+
6436+typedef struct TkXLFDAttributes {
6437+    Tk_Uid foundry;            /* The foundry of the font. */
6438+    int slant;                 /* The tristate value for the slant, which is
6439+                                * significant under X. */
6440+    int setwidth;              /* The proportionate width, see below for
6441+                                * definition. */
6442+    Tk_Uid charset;            /* The actual charset string. */
6443+} TkXLFDAttributes;
6444+
6445+/*
6446+ * Possible values for the "setwidth" field in a TkXLFDAttributes structure.
6447+ * The setwidth is whether characters are considered wider or narrower than
6448+ * normal.
6449+ */
6450+
6451+#define TK_SW_NORMAL   0
6452+#define TK_SW_CONDENSE 1
6453+#define TK_SW_EXPAND   2
6454+#define TK_SW_UNKNOWN  3       /* Unknown setwidth. This value may be stored
6455+                                * in the setwidth field. */
6456+
6457+/*
6458+ * The following defines specify the meaning of the fields in a fully
6459+ * qualified XLFD.
6460+ */
6461+
6462+#define XLFD_FOUNDRY       0
6463+#define XLFD_FAMILY        1
6464+#define XLFD_WEIGHT        2
6465+#define XLFD_SLANT         3
6466+#define XLFD_SETWIDTH      4
6467+#define XLFD_ADD_STYLE     5
6468+#define XLFD_PIXEL_SIZE            6
6469+#define XLFD_POINT_SIZE            7
6470+#define XLFD_RESOLUTION_X   8
6471+#define XLFD_RESOLUTION_Y   9
6472+#define XLFD_SPACING       10
6473+#define XLFD_AVERAGE_WIDTH  11
6474+#define XLFD_CHARSET       12
6475+#define XLFD_NUMFIELDS     13  /* Number of fields in XLFD. */
6476+
6477+/*
6478+ * Helper macro. How to correctly round a double to a short.
6479+ */
6480+
6481+#define ROUND16(x)     ((short) floor((x) + 0.5))
6482+
6483+/*
6484+ * Low-level API exported by generic code to platform-specific code.
6485+ */
6486+
6487+#define TkInitFontAttributes(fa)   memset((fa), 0, sizeof(TkFontAttributes));
6488+#define TkInitXLFDAttributes(xa)   memset((xa), 0, sizeof(TkXLFDAttributes));
6489+
6490+MODULE_SCOPE int       TkFontParseXLFD(const char *string,
6491+                           TkFontAttributes *faPtr, TkXLFDAttributes *xaPtr);
6492+MODULE_SCOPE const char *const * TkFontGetAliasList(const char *faceName);
6493+MODULE_SCOPE const char *const *const * TkFontGetFallbacks(void);
6494+MODULE_SCOPE int       TkFontGetPixels(Tk_Window tkwin, int size);
6495+MODULE_SCOPE int       TkFontGetPoints(Tk_Window tkwin, int size);
6496+MODULE_SCOPE const char *const * TkFontGetGlobalClass(void);
6497+MODULE_SCOPE const char *const * TkFontGetSymbolClass(void);
6498+MODULE_SCOPE int       TkCreateNamedFont(Tcl_Interp *interp, Tk_Window tkwin,
6499+                           const char *name, TkFontAttributes *faPtr);
6500+MODULE_SCOPE int       TkDeleteNamedFont(Tcl_Interp *interp,
6501+                           Tk_Window tkwin, const char *name);
6502+MODULE_SCOPE int       TkFontGetFirstTextLayout(Tk_TextLayout layout,
6503+                           Tk_Font *font, char *dst);
6504+
6505+/*
6506+ * Low-level API exported by platform-specific code to generic code.
6507+ */
6508+
6509+MODULE_SCOPE void      TkpDeleteFont(TkFont *tkFontPtr);
6510+MODULE_SCOPE void      TkpFontPkgInit(TkMainInfo *mainPtr);
6511+MODULE_SCOPE TkFont *  TkpGetFontFromAttributes(TkFont *tkFontPtr,
6512+                           Tk_Window tkwin, const TkFontAttributes *faPtr);
6513+MODULE_SCOPE void      TkpGetFontFamilies(Tcl_Interp *interp,
6514+                           Tk_Window tkwin);
6515+MODULE_SCOPE TkFont *  TkpGetNativeFont(Tk_Window tkwin, const char *name);
6516+
6517+#endif /* _TKFONT */
6518--- src/tkInt.h 1969-12-31 19:00:00.000000000 -0500
6519+++ src/tkInt.h 2013-08-20 11:44:59.000000000 -0400
6520@@ -0,0 +1,1256 @@
6521+/*
6522+ * tkInt.h --
6523+ *
6524+ *     Declarations for things used internally by the Tk functions but not
6525+ *     exported outside the module.
6526+ *
6527+ * Copyright (c) 1990-1994 The Regents of the University of California.
6528+ * Copyright (c) 1994-1997 Sun Microsystems, Inc.
6529+ * Copyright (c) 1998 by Scriptics Corporation.
6530+ *
6531+ * See the file "license.terms" for information on usage and redistribution of
6532+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
6533+ */
6534+
6535+#ifndef _TKINT
6536+#define _TKINT
6537+
6538+#ifndef _TKPORT
6539+#include "tkPort.h"
6540+#endif
6541+
6542+/*
6543+ * Ensure WORDS_BIGENDIAN is defined correctly:
6544+ * Needs to happen here in addition to configure to work with fat compiles on
6545+ * Darwin (where configure runs only once for multiple architectures).
6546+ */
6547+
6548+#include <stdio.h>
6549+#ifdef HAVE_SYS_TYPES_H
6550+#    include <sys/types.h>
6551+#endif
6552+#ifdef HAVE_SYS_PARAM_H
6553+#    include <sys/param.h>
6554+#endif
6555+#ifdef BYTE_ORDER
6556+#    ifdef BIG_ENDIAN
6557+#       if BYTE_ORDER == BIG_ENDIAN
6558+#           undef WORDS_BIGENDIAN
6559+#           define WORDS_BIGENDIAN 1
6560+#       endif
6561+#    endif
6562+#    ifdef LITTLE_ENDIAN
6563+#       if BYTE_ORDER == LITTLE_ENDIAN
6564+#           undef WORDS_BIGENDIAN
6565+#       endif
6566+#    endif
6567+#endif
6568+
6569+/*
6570+ * Used to tag functions that are only to be visible within the module being
6571+ * built and not outside it (where this is supported by the linker).
6572+ */
6573+
6574+#ifndef MODULE_SCOPE
6575+#   ifdef __cplusplus
6576+#      define MODULE_SCOPE extern "C"
6577+#   else
6578+#      define MODULE_SCOPE extern
6579+#   endif
6580+#endif
6581+
6582+/*
6583+ * Macros used to cast between pointers and integers (e.g. when storing an int
6584+ * in ClientData), on 64-bit architectures they avoid gcc warning about "cast
6585+ * to/from pointer from/to integer of different size".
6586+ */
6587+
6588+#if !defined(INT2PTR) && !defined(PTR2INT)
6589+#   if defined(HAVE_INTPTR_T) || defined(intptr_t)
6590+#      define INT2PTR(p) ((void*)(intptr_t)(p))
6591+#      define PTR2INT(p) ((int)(intptr_t)(p))
6592+#   else
6593+#      define INT2PTR(p) ((void*)(p))
6594+#      define PTR2INT(p) ((int)(p))
6595+#   endif
6596+#endif
6597+#if !defined(UINT2PTR) && !defined(PTR2UINT)
6598+#   if defined(HAVE_UINTPTR_T) || defined(uintptr_t)
6599+#      define UINT2PTR(p) ((void*)(uintptr_t)(p))
6600+#      define PTR2UINT(p) ((unsigned int)(uintptr_t)(p))
6601+#   else
6602+#      define UINT2PTR(p) ((void*)(p))
6603+#      define PTR2UINT(p) ((unsigned int)(p))
6604+#   endif
6605+#endif
6606+
6607+/*
6608+ * Opaque type declarations:
6609+ */
6610+
6611+typedef struct TkColormap TkColormap;
6612+typedef struct TkFontAttributes TkFontAttributes;
6613+typedef struct TkGrabEvent TkGrabEvent;
6614+typedef struct TkpCursor_ *TkpCursor;
6615+typedef struct TkRegion_ *TkRegion;
6616+typedef struct TkStressedCmap TkStressedCmap;
6617+typedef struct TkBindInfo_ *TkBindInfo;
6618+typedef struct Busy *TkBusy;
6619+
6620+/*
6621+ * One of the following structures is maintained for each cursor in use in the
6622+ * system. This structure is used by tkCursor.c and the various system-
6623+ * specific cursor files.
6624+ */
6625+
6626+typedef struct TkCursor {
6627+    Tk_Cursor cursor;          /* System specific identifier for cursor. */
6628+    Display *display;          /* Display containing cursor. Needed for
6629+                                * disposal and retrieval of cursors. */
6630+    int resourceRefCount;      /* Number of active uses of this cursor (each
6631+                                * active use corresponds to a call to
6632+                                * Tk_AllocPreserveFromObj or Tk_Preserve). If
6633+                                * this count is 0, then this structure is no
6634+                                * longer valid and it isn't present in a hash
6635+                                * table: it is being kept around only because
6636+                                * there are objects referring to it. The
6637+                                * structure is freed when resourceRefCount
6638+                                * and objRefCount are both 0. */
6639+    int objRefCount;           /* Number of Tcl objects that reference this
6640+                                * structure.. */
6641+    Tcl_HashTable *otherTable; /* Second table (other than idTable) used to
6642+                                * index this entry. */
6643+    Tcl_HashEntry *hashPtr;    /* Entry in otherTable for this structure
6644+                                * (needed when deleting). */
6645+    Tcl_HashEntry *idHashPtr;  /* Entry in idTable for this structure (needed
6646+                                * when deleting). */
6647+    struct TkCursor *nextPtr;  /* Points to the next TkCursor structure with
6648+                                * the same name. Cursors with the same name
6649+                                * but different displays are chained together
6650+                                * off a single hash table entry. */
6651+} TkCursor;
6652+
6653+/*
6654+ * The following structure is kept one-per-TkDisplay to maintain information
6655+ * about the caret (cursor location) on this display. This is used to dictate
6656+ * global focus location (Windows Accessibility guidelines) and to position
6657+ * the IME or XIM over-the-spot window.
6658+ */
6659+
6660+typedef struct TkCaret {
6661+    struct TkWindow *winPtr;   /* The window on which we requested caret
6662+                                * placement. */
6663+    int x;                     /* Relative x coord of the caret. */
6664+    int y;                     /* Relative y coord of the caret. */
6665+    int height;                        /* Specified height of the window. */
6666+} TkCaret;
6667+
6668+/*
6669+ * One of the following structures is maintained for each display containing a
6670+ * window managed by Tk. In part, the structure is used to store thread-
6671+ * specific data, since each thread will have its own TkDisplay structure.
6672+ */
6673+
6674+typedef struct TkDisplay {
6675+    Display *display;          /* Xlib's info about display. */
6676+    struct TkDisplay *nextPtr; /* Next in list of all displays. */
6677+    char *name;                        /* Name of display (with any screen identifier
6678+                                * removed). Malloc-ed. */
6679+    Time lastEventTime;                /* Time of last event received for this
6680+                                * display. */
6681+
6682+    /*
6683+     * Information used primarily by tk3d.c:
6684+     */
6685+
6686+    int borderInit;            /* 0 means borderTable needs initializing. */
6687+    Tcl_HashTable borderTable; /* Maps from color name to TkBorder
6688+                                * structure. */
6689+
6690+    /*
6691+     * Information used by tkAtom.c only:
6692+     */
6693+
6694+    int atomInit;              /* 0 means stuff below hasn't been initialized
6695+                                * yet. */
6696+    Tcl_HashTable nameTable;   /* Maps from names to Atom's. */
6697+    Tcl_HashTable atomTable;   /* Maps from Atom's back to names. */
6698+
6699+    /*
6700+     * Information used primarily by tkBind.c:
6701+     */
6702+
6703+    int bindInfoStale;         /* Non-zero means the variables in this part
6704+                                * of the structure are potentially incorrect
6705+                                * and should be recomputed. */
6706+    unsigned int modeModMask;  /* Has one bit set to indicate the modifier
6707+                                * corresponding to "mode shift". If no such
6708+                                * modifier, than this is zero. */
6709+    unsigned int metaModMask;  /* Has one bit set to indicate the modifier
6710+                                * corresponding to the "Meta" key. If no such
6711+                                * modifier, then this is zero. */
6712+    unsigned int altModMask;   /* Has one bit set to indicate the modifier
6713+                                * corresponding to the "Meta" key. If no such
6714+                                * modifier, then this is zero. */
6715+    enum {LU_IGNORE, LU_CAPS, LU_SHIFT} lockUsage;
6716+                               /* Indicates how to interpret lock
6717+                                * modifier. */
6718+    int numModKeyCodes;                /* Number of entries in modKeyCodes array
6719+                                * below. */
6720+    KeyCode *modKeyCodes;      /* Pointer to an array giving keycodes for all
6721+                                * of the keys that have modifiers associated
6722+                                * with them. Malloc'ed, but may be NULL. */
6723+
6724+    /*
6725+     * Information used by tkBitmap.c only:
6726+     */
6727+
6728+    int bitmapInit;            /* 0 means tables above need initializing. */
6729+    int bitmapAutoNumber;      /* Used to number bitmaps. */
6730+    Tcl_HashTable bitmapNameTable;
6731+                               /* Maps from name of bitmap to the first
6732+                                * TkBitmap record for that name. */
6733+    Tcl_HashTable bitmapIdTable;/* Maps from bitmap id to the TkBitmap
6734+                                * structure for the bitmap. */
6735+    Tcl_HashTable bitmapDataTable;
6736+                               /* Used by Tk_GetBitmapFromData to map from a
6737+                                * collection of in-core data about a bitmap
6738+                                * to a reference giving an automatically-
6739+                                * generated name for the bitmap. */
6740+
6741+    /*
6742+     * Information used by tkCanvas.c only:
6743+     */
6744+
6745+    int numIdSearches;
6746+    int numSlowSearches;
6747+
6748+    /*
6749+     * Used by tkColor.c only:
6750+     */
6751+
6752+    int colorInit;             /* 0 means color module needs initializing. */
6753+    TkStressedCmap *stressPtr; /* First in list of colormaps that have filled
6754+                                * up, so we have to pick an approximate
6755+                                * color. */
6756+    Tcl_HashTable colorNameTable;
6757+                               /* Maps from color name to TkColor structure
6758+                                * for that color. */
6759+    Tcl_HashTable colorValueTable;
6760+                               /* Maps from integer RGB values to TkColor
6761+                                * structures. */
6762+
6763+    /*
6764+     * Used by tkCursor.c only:
6765+     */
6766+
6767+    int cursorInit;            /* 0 means cursor module need initializing. */
6768+    Tcl_HashTable cursorNameTable;
6769+                               /* Maps from a string name to a cursor to the
6770+                                * TkCursor record for the cursor. */
6771+    Tcl_HashTable cursorDataTable;
6772+                               /* Maps from a collection of in-core data
6773+                                * about a cursor to a TkCursor structure. */
6774+    Tcl_HashTable cursorIdTable;
6775+                               /* Maps from a cursor id to the TkCursor
6776+                                * structure for the cursor. */
6777+    char cursorString[20];     /* Used to store a cursor id string. */
6778+    Font cursorFont;           /* Font to use for standard cursors. None
6779+                                * means font not loaded yet. */
6780+
6781+    /*
6782+     * Information used by tkError.c only:
6783+     */
6784+
6785+    struct TkErrorHandler *errorPtr;
6786+                               /* First in list of error handlers for this
6787+                                * display. NULL means no handlers exist at
6788+                                * present. */
6789+    int deleteCount;           /* Counts # of handlers deleted since last
6790+                                * time inactive handlers were garbage-
6791+                                * collected. When this number gets big,
6792+                                * handlers get cleaned up. */
6793+
6794+    /*
6795+     * Used by tkEvent.c only:
6796+     */
6797+
6798+    struct TkWindowEvent *delayedMotionPtr;
6799+                               /* Points to a malloc-ed motion event whose
6800+                                * processing has been delayed in the hopes
6801+                                * that another motion event will come along
6802+                                * right away and we can merge the two of them
6803+                                * together. NULL means that there is no
6804+                                * delayed motion event. */
6805+
6806+    /*
6807+     * Information used by tkFocus.c only:
6808+     */
6809+
6810+    int focusDebug;            /* 1 means collect focus debugging
6811+                                * statistics. */
6812+    struct TkWindow *implicitWinPtr;
6813+                               /* If the focus arrived at a toplevel window
6814+                                * implicitly via an Enter event (rather than
6815+                                * via a FocusIn event), this points to the
6816+                                * toplevel window. Otherwise it is NULL. */
6817+    struct TkWindow *focusPtr; /* Points to the window on this display that
6818+                                * should be receiving keyboard events. When
6819+                                * multiple applications on the display have
6820+                                * the focus, this will refer to the innermost
6821+                                * window in the innermost application. This
6822+                                * information isn't used on Windows, but it's
6823+                                * needed on the Mac, and also on X11 when XIM
6824+                                * processing is being done. */
6825+
6826+    /*
6827+     * Information used by tkGC.c only:
6828+     */
6829+
6830+    Tcl_HashTable gcValueTable; /* Maps from a GC's values to a TkGC structure
6831+                                * describing a GC with those values. */
6832+    Tcl_HashTable gcIdTable;    /* Maps from a GC to a TkGC. */
6833+    int gcInit;                        /* 0 means the tables below need
6834+                                * initializing. */
6835+
6836+    /*
6837+     * Information used by tkGeometry.c only:
6838+     */
6839+
6840+    Tcl_HashTable maintainHashTable;
6841+                               /* Hash table that maps from a master's
6842+                                * Tk_Window token to a list of slaves managed
6843+                                * by that master. */
6844+    int geomInit;
6845+
6846+    /*
6847+     * Information used by tkGet.c only:
6848+     */
6849+
6850+    Tcl_HashTable uidTable;    /* Stores all Tk_Uid used in a thread. */
6851+    int uidInit;               /* 0 means uidTable needs initializing. */
6852+
6853+    /*
6854+     * Information used by tkGrab.c only:
6855+     */
6856+
6857+    struct TkWindow *grabWinPtr;/* Window in which the pointer is currently
6858+                                * grabbed, or NULL if none. */
6859+    struct TkWindow *eventualGrabWinPtr;
6860+                               /* Value that grabWinPtr will have once the
6861+                                * grab event queue (below) has been
6862+                                * completely emptied. */
6863+    struct TkWindow *buttonWinPtr;
6864+                               /* Window in which first mouse button was
6865+                                * pressed while grab was in effect, or NULL
6866+                                * if no such press in effect. */
6867+    struct TkWindow *serverWinPtr;
6868+                               /* If no application contains the pointer then
6869+                                * this is NULL. Otherwise it contains the
6870+                                * last window for which we've gotten an Enter
6871+                                * or Leave event from the server (i.e. the
6872+                                * last window known to have contained the
6873+                                * pointer). Doesn't reflect events that were
6874+                                * synthesized in tkGrab.c. */
6875+    TkGrabEvent *firstGrabEventPtr;
6876+                               /* First in list of enter/leave events
6877+                                * synthesized by grab code. These events must
6878+                                * be processed in order before any other
6879+                                * events are processed. NULL means no such
6880+                                * events. */
6881+    TkGrabEvent *lastGrabEventPtr;
6882+                               /* Last in list of synthesized events, or NULL
6883+                                * if list is empty. */
6884+    int grabFlags;             /* Miscellaneous flag values. See definitions
6885+                                * in tkGrab.c. */
6886+
6887+    /*
6888+     * Information used by tkGrid.c only:
6889+     */
6890+
6891+    int gridInit;              /* 0 means table below needs initializing. */
6892+    Tcl_HashTable gridHashTable;/* Maps from Tk_Window tokens to corresponding
6893+                                * Grid structures. */
6894+
6895+    /*
6896+     * Information used by tkImage.c only:
6897+     */
6898+
6899+    int imageId;               /* Value used to number image ids. */
6900+
6901+    /*
6902+     * Information used by tkMacWinMenu.c only:
6903+     */
6904+
6905+    int postCommandGeneration;
6906+
6907+    /*
6908+     * Information used by tkPack.c only.
6909+     */
6910+
6911+    int packInit;              /* 0 means table below needs initializing. */
6912+    Tcl_HashTable packerHashTable;
6913+                               /* Maps from Tk_Window tokens to corresponding
6914+                                * Packer structures. */
6915+
6916+    /*
6917+     * Information used by tkPlace.c only.
6918+     */
6919+
6920+    int placeInit;             /* 0 means tables below need initializing. */
6921+    Tcl_HashTable masterTable; /* Maps from Tk_Window toke to the Master
6922+                                * structure for the window, if it exists. */
6923+    Tcl_HashTable slaveTable;  /* Maps from Tk_Window toke to the Slave
6924+                                * structure for the window, if it exists. */
6925+
6926+    /*
6927+     * Information used by tkSelect.c and tkClipboard.c only:
6928+     */
6929+
6930+    struct TkSelectionInfo *selectionInfoPtr;
6931+                               /* First in list of selection information
6932+                                * records. Each entry contains information
6933+                                * about the current owner of a particular
6934+                                * selection on this display. */
6935+    Atom multipleAtom;         /* Atom for MULTIPLE. None means selection
6936+                                * stuff isn't initialized. */
6937+    Atom incrAtom;             /* Atom for INCR. */
6938+    Atom targetsAtom;          /* Atom for TARGETS. */
6939+    Atom timestampAtom;                /* Atom for TIMESTAMP. */
6940+    Atom textAtom;             /* Atom for TEXT. */
6941+    Atom compoundTextAtom;     /* Atom for COMPOUND_TEXT. */
6942+    Atom applicationAtom;      /* Atom for TK_APPLICATION. */
6943+    Atom windowAtom;           /* Atom for TK_WINDOW. */
6944+    Atom clipboardAtom;                /* Atom for CLIPBOARD. */
6945+    Atom utf8Atom;             /* Atom for UTF8_STRING. */
6946+
6947+    Tk_Window clipWindow;      /* Window used for clipboard ownership and to
6948+                                * retrieve selections between processes. NULL
6949+                                * means clipboard info hasn't been
6950+                                * initialized. */
6951+    int clipboardActive;       /* 1 means we currently own the clipboard
6952+                                * selection, 0 means we don't. */
6953+    struct TkMainInfo *clipboardAppPtr;
6954+                               /* Last application that owned clipboard. */
6955+    struct TkClipboardTarget *clipTargetPtr;
6956+                               /* First in list of clipboard type information
6957+                                * records. Each entry contains information
6958+                                * about the buffers for a given selection
6959+                                * target. */
6960+
6961+    /*
6962+     * Information used by tkSend.c only:
6963+     */
6964+
6965+    Tk_Window commTkwin;       /* Window used for communication between
6966+                                * interpreters during "send" commands. NULL
6967+                                * means send info hasn't been initialized
6968+                                * yet. */
6969+    Atom commProperty;         /* X's name for comm property. */
6970+    Atom registryProperty;     /* X's name for property containing registry
6971+                                * of interpreter names. */
6972+    Atom appNameProperty;      /* X's name for property used to hold the
6973+                                * application name on each comm window. */
6974+
6975+    /*
6976+     * Information used by tkUnixWm.c and tkWinWm.c only:
6977+     */
6978+
6979+    struct TkWmInfo *firstWmPtr;/* Points to first top-level window. */
6980+    struct TkWmInfo *foregroundWmPtr;
6981+                               /* Points to the foreground window. */
6982+
6983+    /*
6984+     * Information used by tkVisual.c only:
6985+     */
6986+
6987+    TkColormap *cmapPtr;       /* First in list of all non-default colormaps
6988+                                * allocated for this display. */
6989+
6990+    /*
6991+     * Miscellaneous information:
6992+     */
6993+
6994+#ifdef TK_USE_INPUT_METHODS
6995+    XIM inputMethod;           /* Input method for this display. */
6996+    XIMStyle inputStyle;       /* Input style selected for this display. */
6997+    XFontSet inputXfs;         /* XFontSet cached for over-the-spot XIM. */
6998+#endif /* TK_USE_INPUT_METHODS */
6999+    Tcl_HashTable winTable;    /* Maps from X window ids to TkWindow ptrs. */
7000+
7001+    int refCount;              /* Reference count of how many Tk applications
7002+                                * are using this display. Used to clean up
7003+                                * the display when we no longer have any Tk
7004+                                * applications using it. */
7005+
7006+    /*
7007+     * The following field were all added for Tk8.3
7008+     */
7009+
7010+    int mouseButtonState;      /* Current mouse button state for this
7011+                                * display. */
7012+    Window mouseButtonWindow;  /* Window the button state was set in, added
7013+                                * in Tk 8.4. */
7014+    Tk_Window warpWindow;
7015+    Tk_Window warpMainwin;     /* For finding the root window for warping
7016+                                * purposes. */
7017+    int warpX;
7018+    int warpY;
7019+
7020+    /*
7021+     * The following field(s) were all added for Tk8.4
7022+     */
7023+
7024+    unsigned int flags;                /* Various flag values: these are all defined
7025+                                * in below. */
7026+    TkCaret caret;             /* Information about the caret for this
7027+                                * display. This is not a pointer. */
7028+
7029+    int iconDataSize;          /* Size of default iconphoto image data. */
7030+    unsigned char *iconDataPtr;        /* Default iconphoto image data, if set. */
7031+} TkDisplay;
7032+
7033+/*
7034+ * Flag values for TkDisplay flags.
7035+ *  TK_DISPLAY_COLLAPSE_MOTION_EVENTS: (default on)
7036+ *     Indicates that we should collapse motion events on this display
7037+ *  TK_DISPLAY_USE_IM:                 (default on, set via tk.tcl)
7038+ *     Whether to use input methods for this display
7039+ *  TK_DISPLAY_WM_TRACING:             (default off)
7040+ *     Whether we should do wm tracing on this display.
7041+ *  TK_DISPLAY_IN_WARP:                        (default off)
7042+ *     Indicates that we are in a pointer warp
7043+ */
7044+
7045+#define TK_DISPLAY_COLLAPSE_MOTION_EVENTS      (1 << 0)
7046+#define TK_DISPLAY_USE_IM                      (1 << 1)
7047+#define TK_DISPLAY_WM_TRACING                  (1 << 3)
7048+#define TK_DISPLAY_IN_WARP                     (1 << 4)
7049+
7050+/*
7051+ * One of the following structures exists for each error handler created by a
7052+ * call to Tk_CreateErrorHandler. The structure is managed by tkError.c.
7053+ */
7054+
7055+typedef struct TkErrorHandler {
7056+    TkDisplay *dispPtr;                /* Display to which handler applies. */
7057+    unsigned long firstRequest;        /* Only errors with serial numbers >= to this
7058+                                * are considered. */
7059+    unsigned long lastRequest; /* Only errors with serial numbers <= to this
7060+                                * are considered. This field is filled in
7061+                                * when XUnhandle is called. -1 means
7062+                                * XUnhandle hasn't been called yet. */
7063+    int error;                 /* Consider only errors with this error_code
7064+                                * (-1 means consider all errors). */
7065+    int request;               /* Consider only errors with this major
7066+                                * request code (-1 means consider all major
7067+                                * codes). */
7068+    int minorCode;             /* Consider only errors with this minor
7069+                                * request code (-1 means consider all minor
7070+                                * codes). */
7071+    Tk_ErrorProc *errorProc;   /* Function to invoke when a matching error
7072+                                * occurs. NULL means just ignore errors. */
7073+    ClientData clientData;     /* Arbitrary value to pass to errorProc. */
7074+    struct TkErrorHandler *nextPtr;
7075+                               /* Pointer to next older handler for this
7076+                                * display, or NULL for end of list. */
7077+} TkErrorHandler;
7078+
7079+/*
7080+ * One of the following structures exists for each event handler created by
7081+ * calling Tk_CreateEventHandler. This information is used by tkEvent.c only.
7082+ */
7083+
7084+typedef struct TkEventHandler {
7085+    unsigned long mask;                /* Events for which to invoke proc. */
7086+    Tk_EventProc *proc;                /* Function to invoke when an event in mask
7087+                                * occurs. */
7088+    ClientData clientData;     /* Argument to pass to proc. */
7089+    struct TkEventHandler *nextPtr;
7090+                               /* Next in list of handlers associated with
7091+                                * window (NULL means end of list). */
7092+} TkEventHandler;
7093+
7094+/*
7095+ * Tk keeps one of the following data structures for each main window (created
7096+ * by a call to TkCreateMainWindow). It stores information that is shared by
7097+ * all of the windows associated with a particular main window.
7098+ */
7099+
7100+typedef struct TkMainInfo {
7101+    int refCount;              /* Number of windows whose "mainPtr" fields
7102+                                * point here. When this becomes zero, can
7103+                                * free up the structure (the reference count
7104+                                * is zero because windows can get deleted in
7105+                                * almost any order; the main window isn't
7106+                                * necessarily the last one deleted). */
7107+    struct TkWindow *winPtr;   /* Pointer to main window. */
7108+    Tcl_Interp *interp;                /* Interpreter associated with application. */
7109+    Tcl_HashTable nameTable;   /* Hash table mapping path names to TkWindow
7110+                                * structs for all windows related to this
7111+                                * main window. Managed by tkWindow.c. */
7112+    long deletionEpoch;                /* Incremented by window deletions. */
7113+    Tk_BindingTable bindingTable;
7114+                               /* Used in conjunction with "bind" command to
7115+                                * bind events to Tcl commands. */
7116+    TkBindInfo bindInfo;       /* Information used by tkBind.c on a per
7117+                                * application basis. */
7118+    struct TkFontInfo *fontInfoPtr;
7119+                               /* Information used by tkFont.c on a per
7120+                                * application basis. */
7121+
7122+    /*
7123+     * Information used only by tkFocus.c and tk*Embed.c:
7124+     */
7125+
7126+    struct TkToplevelFocusInfo *tlFocusPtr;
7127+                               /* First in list of records containing focus
7128+                                * information for each top-level in the
7129+                                * application. Used only by tkFocus.c. */
7130+    struct TkDisplayFocusInfo *displayFocusPtr;
7131+                               /* First in list of records containing focus
7132+                                * information for each display that this
7133+                                * application has ever used. Used only by
7134+                                * tkFocus.c. */
7135+
7136+    struct ElArray *optionRootPtr;
7137+                               /* Top level of option hierarchy for this main
7138+                                * window. NULL means uninitialized. Managed
7139+                                * by tkOption.c. */
7140+    Tcl_HashTable imageTable;  /* Maps from image names to Tk_ImageMaster
7141+                                * structures. Managed by tkImage.c. */
7142+    int strictMotif;           /* This is linked to the tk_strictMotif global
7143+                                * variable. */
7144+    int alwaysShowSelection;   /* This is linked to the
7145+                                * ::tk::AlwaysShowSelection variable. */
7146+    struct TkMainInfo *nextPtr;        /* Next in list of all main windows managed by
7147+                                * this process. */
7148+    Tcl_HashTable busyTable;   /* Information used by [tk busy] command. */
7149+} TkMainInfo;
7150+
7151+/*
7152+ * Tk keeps the following data structure for each of it's builtin bitmaps.
7153+ * This structure is only used by tkBitmap.c and other platform specific
7154+ * bitmap files.
7155+ */
7156+
7157+typedef struct {
7158+    const void *source;                /* Bits for bitmap. */
7159+    int width, height;         /* Dimensions of bitmap. */
7160+    int native;                        /* 0 means generic (X style) bitmap, 1 means
7161+                                * native style bitmap. */
7162+} TkPredefBitmap;
7163+
7164+/*
7165+ * Tk keeps one of the following structures for each window. Some of the
7166+ * information (like size and location) is a shadow of information managed by
7167+ * the X server, and some is special information used here, such as event and
7168+ * geometry management information. This information is (mostly) managed by
7169+ * tkWindow.c. WARNING: the declaration below must be kept consistent with the
7170+ * Tk_FakeWin structure in tk.h. If you change one, be sure to change the
7171+ * other!
7172+ */
7173+
7174+typedef struct TkWindow {
7175+    /*
7176+     * Structural information:
7177+     */
7178+
7179+    Display *display;          /* Display containing window. */
7180+    TkDisplay *dispPtr;                /* Tk's information about display for
7181+                                * window. */
7182+    int screenNum;             /* Index of screen for window, among all those
7183+                                * for dispPtr. */
7184+    Visual *visual;            /* Visual to use for window. If not default,
7185+                                * MUST be set before X window is created. */
7186+    int depth;                 /* Number of bits/pixel. */
7187+    Window window;             /* X's id for window. NULL means window hasn't
7188+                                * actually been created yet, or it's been
7189+                                * deleted. */
7190+    struct TkWindow *childList;        /* First in list of child windows, or NULL if
7191+                                * no children. List is in stacking order,
7192+                                * lowest window first.*/
7193+    struct TkWindow *lastChildPtr;
7194+                               /* Last in list of child windows (highest in
7195+                                * stacking order), or NULL if no children. */
7196+    struct TkWindow *parentPtr;        /* Pointer to parent window (logical parent,
7197+                                * not necessarily X parent). NULL means
7198+                                * either this is the main window, or the
7199+                                * window's parent has already been deleted. */
7200+    struct TkWindow *nextPtr;  /* Next higher sibling (in stacking order) in
7201+                                * list of children with same parent. NULL
7202+                                * means end of list. */
7203+    TkMainInfo *mainPtr;       /* Information shared by all windows
7204+                                * associated with a particular main window.
7205+                                * NULL means this window is a rogue that is
7206+                                * not associated with any application (at
7207+                                * present, this only happens for the dummy
7208+                                * windows used for "send" communication). */
7209+
7210+    /*
7211+     * Name and type information for the window:
7212+     */
7213+
7214+    char *pathName;            /* Path name of window (concatenation of all
7215+                                * names between this window and its top-level
7216+                                * ancestor). This is a pointer into an entry
7217+                                * in mainPtr->nameTable. NULL means that the
7218+                                * window hasn't been completely created
7219+                                * yet. */
7220+    Tk_Uid nameUid;            /* Name of the window within its parent
7221+                                * (unique within the parent). */
7222+    Tk_Uid classUid;           /* Class of the window. NULL means window
7223+                                * hasn't been given a class yet. */
7224+
7225+    /*
7226+     * Geometry and other attributes of window. This information may not be
7227+     * updated on the server immediately; stuff that hasn't been reflected in
7228+     * the server yet is called "dirty". At present, information can be dirty
7229+     * only if the window hasn't yet been created.
7230+     */
7231+
7232+    XWindowChanges changes;    /* Geometry and other info about window. */
7233+    unsigned int dirtyChanges; /* Bits indicate fields of "changes" that are
7234+                                * dirty. */
7235+    XSetWindowAttributes atts; /* Current attributes of window. */
7236+    unsigned long dirtyAtts;   /* Bits indicate fields of "atts" that are
7237+                                * dirty. */
7238+
7239+    unsigned int flags;                /* Various flag values: these are all defined
7240+                                * in tk.h (confusing, but they're needed
7241+                                * there for some query macros). */
7242+
7243+    /*
7244+     * Information kept by the event manager (tkEvent.c):
7245+     */
7246+
7247+    TkEventHandler *handlerList;/* First in list of event handlers declared
7248+                                * for this window, or NULL if none. */
7249+#ifdef TK_USE_INPUT_METHODS
7250+    XIC inputContext;          /* XIM input context. */
7251+#endif /* TK_USE_INPUT_METHODS */
7252+
7253+    /*
7254+     * Information used for event bindings (see "bind" and "bindtags" commands
7255+     * in tkCmds.c):
7256+     */
7257+
7258+    ClientData *tagPtr;                /* Points to array of tags used for bindings
7259+                                * on this window. Each tag is a Tk_Uid.
7260+                                * Malloc'ed. NULL means no tags. */
7261+    int numTags;               /* Number of tags at *tagPtr. */
7262+
7263+    /*
7264+     * Information used by tkOption.c to manage options for the window.
7265+     */
7266+
7267+    int optionLevel;           /* -1 means no option information is currently
7268+                                * cached for this window. Otherwise this
7269+                                * gives the level in the option stack at
7270+                                * which info is cached. */
7271+    /*
7272+     * Information used by tkSelect.c to manage the selection.
7273+     */
7274+
7275+    struct TkSelHandler *selHandlerList;
7276+                               /* First in list of handlers for returning the
7277+                                * selection in various forms. */
7278+
7279+    /*
7280+     * Information used by tkGeometry.c for geometry management.
7281+     */
7282+
7283+    const Tk_GeomMgr *geomMgrPtr;
7284+                               /* Information about geometry manager for this
7285+                                * window. */
7286+    ClientData geomData;       /* Argument for geometry manager functions. */
7287+    int reqWidth, reqHeight;   /* Arguments from last call to
7288+                                * Tk_GeometryRequest, or 0's if
7289+                                * Tk_GeometryRequest hasn't been called. */
7290+    int internalBorderLeft;    /* Width of internal border of window (0 means
7291+                                * no internal border). Geometry managers
7292+                                * should not normally place children on top
7293+                                * of the border. Fields for the other three
7294+                                * sides are found below. */
7295+
7296+    /*
7297+     * Information maintained by tkWm.c for window manager communication.
7298+     */
7299+
7300+    struct TkWmInfo *wmInfoPtr;        /* For top-level windows (and also for special
7301+                                * Unix menubar and wrapper windows), points
7302+                                * to structure with wm-related info (see
7303+                                * tkWm.c). For other windows, this is
7304+                                * NULL. */
7305+
7306+    /*
7307+     * Information used by widget classes.
7308+     */
7309+
7310+    const Tk_ClassProcs *classProcsPtr;
7311+    ClientData instanceData;
7312+
7313+    /*
7314+     * Platform specific information private to each port.
7315+     */
7316+
7317+    struct TkWindowPrivate *privatePtr;
7318+
7319+    /*
7320+     * More information used by tkGeometry.c for geometry management.
7321+     */
7322+
7323+    /* The remaining fields of internal border. */
7324+    int internalBorderRight;
7325+    int internalBorderTop;
7326+    int internalBorderBottom;
7327+
7328+    int minReqWidth;           /* Minimum requested width. */
7329+    int minReqHeight;          /* Minimum requested height. */
7330+    char *geometryMaster;
7331+} TkWindow;
7332+
7333+/*
7334+ * Real definition of some events. Note that these events come from outside
7335+ * but have internally generated pieces added to them.
7336+ */
7337+
7338+typedef struct {
7339+    XKeyEvent keyEvent;                /* The real event from X11. */
7340+    char *charValuePtr;                /* A pointer to a string that holds the key's
7341+                                * %A substitution text (before backslash
7342+                                * adding), or NULL if that has not been
7343+                                * computed yet. If non-NULL, this string was
7344+                                * allocated with ckalloc(). */
7345+    int charValueLen;          /* Length of string in charValuePtr when that
7346+                                * is non-NULL. */
7347+    KeySym keysym;             /* Key symbol computed after input methods
7348+                                * have been invoked */
7349+} TkKeyEvent;
7350+
7351+/*
7352+ * Flags passed to TkpMakeMenuWindow's 'transient' argument.
7353+ */
7354+
7355+#define TK_MAKE_MENU_TEAROFF   0       /* Only non-transient case. */
7356+#define TK_MAKE_MENU_POPUP     1
7357+#define TK_MAKE_MENU_DROPDOWN  2
7358+
7359+/*
7360+ * The following structure is used with TkMakeEnsemble to create ensemble
7361+ * commands and optionally to create sub-ensembles.
7362+ */
7363+
7364+typedef struct TkEnsemble {
7365+    const char *name;
7366+    Tcl_ObjCmdProc *proc;
7367+    const struct TkEnsemble *subensemble;
7368+} TkEnsemble;
7369+
7370+/*
7371+ * The following structure is used as a two way map between integers and
7372+ * strings, usually to map between an internal C representation and the
7373+ * strings used in Tcl.
7374+ */
7375+
7376+typedef struct TkStateMap {
7377+    int numKey;                        /* Integer representation of a value. */
7378+    const char *strKey;                /* String representation of a value. */
7379+} TkStateMap;
7380+
7381+/*
7382+ * This structure is used by the Mac and Window porting layers as the internal
7383+ * representation of a clip_mask in a GC.
7384+ */
7385+
7386+typedef struct TkpClipMask {
7387+    int type;                  /* TKP_CLIP_PIXMAP or TKP_CLIP_REGION. */
7388+    union {
7389+       Pixmap pixmap;
7390+       TkRegion region;
7391+    } value;
7392+} TkpClipMask;
7393+
7394+#define TKP_CLIP_PIXMAP 0
7395+#define TKP_CLIP_REGION 1
7396+
7397+/*
7398+ * Return values from TkGrabState:
7399+ */
7400+
7401+#define TK_GRAB_NONE           0
7402+#define TK_GRAB_IN_TREE                1
7403+#define TK_GRAB_ANCESTOR       2
7404+#define TK_GRAB_EXCLUDED       3
7405+
7406+/*
7407+ * Additional flag for TkpMeasureCharsInContext. Coordinate with other flags
7408+ * for this routine, but don't make public until TkpMeasureCharsInContext is
7409+ * made public, too.
7410+ */
7411+
7412+#define TK_ISOLATE_END         32
7413+
7414+/*
7415+ * The macro below is used to modify a "char" value (e.g. by casting it to an
7416+ * unsigned character) so that it can be used safely with macros such as
7417+ * isspace().
7418+ */
7419+
7420+#define UCHAR(c) ((unsigned char) (c))
7421+
7422+/*
7423+ * The following symbol is used in the mode field of FocusIn events generated
7424+ * by an embedded application to request the input focus from its container.
7425+ */
7426+
7427+#define EMBEDDED_APP_WANTS_FOCUS (NotifyNormal + 20)
7428+
7429+/*
7430+ * The following special modifier mask bits are defined, to indicate logical
7431+ * modifiers such as Meta and Alt that may float among the actual modifier
7432+ * bits.
7433+ */
7434+
7435+#define META_MASK      (AnyModifier<<1)
7436+#define ALT_MASK       (AnyModifier<<2)
7437+#define EXTENDED_MASK  (AnyModifier<<3)
7438+
7439+/*
7440+ * Object types not declared in tkObj.c need to be mentioned here so they can
7441+ * be properly registered with Tcl:
7442+ */
7443+
7444+MODULE_SCOPE const Tcl_ObjType tkBorderObjType;
7445+MODULE_SCOPE const Tcl_ObjType tkBitmapObjType;
7446+MODULE_SCOPE const Tcl_ObjType tkColorObjType;
7447+MODULE_SCOPE const Tcl_ObjType tkCursorObjType;
7448+MODULE_SCOPE const Tcl_ObjType tkFontObjType;
7449+MODULE_SCOPE const Tcl_ObjType tkStateKeyObjType;
7450+MODULE_SCOPE const Tcl_ObjType tkTextIndexType;
7451+
7452+/*
7453+ * Miscellaneous variables shared among Tk modules but not exported to the
7454+ * outside world:
7455+ */
7456+
7457+MODULE_SCOPE const Tk_SmoothMethod tkBezierSmoothMethod;
7458+MODULE_SCOPE Tk_ImageType      tkBitmapImageType;
7459+MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtGIF;
7460+MODULE_SCOPE void              (*tkHandleEventProc) (XEvent* eventPtr);
7461+MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtPNG;
7462+MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtPPM;
7463+MODULE_SCOPE TkMainInfo                *tkMainWindowList;
7464+MODULE_SCOPE Tk_ImageType      tkPhotoImageType;
7465+MODULE_SCOPE Tcl_HashTable     tkPredefBitmapTable;
7466+
7467+MODULE_SCOPE const char *const tkWebColors[20];
7468+
7469+/*
7470+ * The definition of pi, at least from the perspective of double-precision
7471+ * floats.
7472+ */
7473+
7474+#ifndef PI
7475+#ifdef M_PI
7476+#define PI     M_PI
7477+#else
7478+#define PI     3.14159265358979323846
7479+#endif
7480+#endif
7481+
7482+/*
7483+ * Support for Clang Static Analyzer <http://clang-analyzer.llvm.org>
7484+ */
7485+
7486+#if defined(PURIFY) && defined(__clang__)
7487+#if __has_feature(attribute_analyzer_noreturn) && \
7488+       !defined(Tcl_Panic) && defined(Tcl_Panic_TCL_DECLARED)
7489+void Tcl_Panic(const char *, ...) __attribute__((analyzer_noreturn));
7490+#endif
7491+#if !defined(CLANG_ASSERT)
7492+#include <assert.h>
7493+#define CLANG_ASSERT(x) assert(x)
7494+#endif
7495+#elif !defined(CLANG_ASSERT)
7496+#define CLANG_ASSERT(x)
7497+#endif /* PURIFY && __clang__ */
7498+
7499+/*
7500+ * The following magic value is stored in the "send_event" field of FocusIn
7501+ * and FocusOut events. This allows us to separate "real" events coming from
7502+ * the server from those that we generated.
7503+ */
7504+
7505+#define GENERATED_FOCUS_EVENT_MAGIC    ((Bool) 0x547321ac)
7506+
7507+/*
7508+ * Exported internals.
7509+ */
7510+
7511+#include "tkIntDecls.h"
7512+
7513+/*
7514+ * Themed widget set init function:
7515+ */
7516+
7517+MODULE_SCOPE int       Ttk_Init(Tcl_Interp *interp);
7518+
7519+/*
7520+ * Internal functions shared among Tk modules but not exported to the outside
7521+ * world:
7522+ */
7523+
7524+MODULE_SCOPE int       Tk_BellObjCmd(ClientData clientData,
7525+                           Tcl_Interp *interp, int objc,
7526+                           Tcl_Obj *const objv[]);
7527+MODULE_SCOPE int       Tk_BindObjCmd(ClientData clientData,
7528+                           Tcl_Interp *interp, int objc,
7529+                           Tcl_Obj *const objv[]);
7530+MODULE_SCOPE int       Tk_BindtagsObjCmd(ClientData clientData,
7531+                           Tcl_Interp *interp, int objc,
7532+                           Tcl_Obj *const objv[]);
7533+MODULE_SCOPE int       Tk_BusyObjCmd(ClientData clientData,
7534+                           Tcl_Interp *interp, int objc,
7535+                           Tcl_Obj *const objv[]);
7536+MODULE_SCOPE int       Tk_ButtonObjCmd(ClientData clientData,
7537+                           Tcl_Interp *interp, int objc,
7538+                           Tcl_Obj *const objv[]);
7539+MODULE_SCOPE int       Tk_CanvasObjCmd(ClientData clientData,
7540+                           Tcl_Interp *interp, int argc,
7541+                           Tcl_Obj *const objv[]);
7542+MODULE_SCOPE int       Tk_CheckbuttonObjCmd(ClientData clientData,
7543+                           Tcl_Interp *interp, int objc,
7544+                           Tcl_Obj *const objv[]);
7545+MODULE_SCOPE int       Tk_ClipboardObjCmd(ClientData clientData,
7546+                           Tcl_Interp *interp, int objc,
7547+                           Tcl_Obj *const objv[]);
7548+MODULE_SCOPE int       Tk_ChooseColorObjCmd(ClientData clientData,
7549+                           Tcl_Interp *interp, int objc,
7550+                           Tcl_Obj *const objv[]);
7551+MODULE_SCOPE int       Tk_ChooseDirectoryObjCmd(ClientData clientData,
7552+                           Tcl_Interp *interp, int objc,
7553+                           Tcl_Obj *const objv[]);
7554+MODULE_SCOPE int       Tk_DestroyObjCmd(ClientData clientData,
7555+                           Tcl_Interp *interp, int objc,
7556+                           Tcl_Obj *const objv[]);
7557+MODULE_SCOPE int       Tk_EntryObjCmd(ClientData clientData,
7558+                           Tcl_Interp *interp, int objc,
7559+                           Tcl_Obj *const objv[]);
7560+MODULE_SCOPE int       Tk_EventObjCmd(ClientData clientData,
7561+                           Tcl_Interp *interp, int objc,
7562+                           Tcl_Obj *const objv[]);
7563+MODULE_SCOPE int       Tk_FrameObjCmd(ClientData clientData,
7564+                           Tcl_Interp *interp, int objc,
7565+                           Tcl_Obj *const objv[]);
7566+MODULE_SCOPE int       Tk_FocusObjCmd(ClientData clientData,
7567+                           Tcl_Interp *interp, int objc,
7568+                           Tcl_Obj *const objv[]);
7569+MODULE_SCOPE int       Tk_FontObjCmd(ClientData clientData,
7570+                           Tcl_Interp *interp, int objc,
7571+                           Tcl_Obj *const objv[]);
7572+MODULE_SCOPE int       Tk_GetOpenFileObjCmd(ClientData clientData,
7573+                           Tcl_Interp *interp, int objc,
7574+                           Tcl_Obj *const objv[]);
7575+MODULE_SCOPE int       Tk_GetSaveFileObjCmd(ClientData clientData,
7576+                           Tcl_Interp *interp, int objc,
7577+                           Tcl_Obj *const objv[]);
7578+MODULE_SCOPE int       Tk_GrabObjCmd(ClientData clientData,
7579+                           Tcl_Interp *interp, int objc,
7580+                           Tcl_Obj *const objv[]);
7581+MODULE_SCOPE int       Tk_GridObjCmd(ClientData clientData,
7582+                           Tcl_Interp *interp, int objc,
7583+                           Tcl_Obj *const objv[]);
7584+MODULE_SCOPE int       Tk_ImageObjCmd(ClientData clientData,
7585+                           Tcl_Interp *interp, int objc,
7586+                           Tcl_Obj *const objv[]);
7587+MODULE_SCOPE int       Tk_LabelObjCmd(ClientData clientData,
7588+                           Tcl_Interp *interp, int objc,
7589+                           Tcl_Obj *const objv[]);
7590+MODULE_SCOPE int       Tk_LabelframeObjCmd(ClientData clientData,
7591+                           Tcl_Interp *interp, int objc,
7592+                           Tcl_Obj *const objv[]);
7593+MODULE_SCOPE int       Tk_ListboxObjCmd(ClientData clientData,
7594+                           Tcl_Interp *interp, int objc,
7595+                           Tcl_Obj *const objv[]);
7596+MODULE_SCOPE int       Tk_LowerObjCmd(ClientData clientData,
7597+                           Tcl_Interp *interp, int objc,
7598+                           Tcl_Obj *const objv[]);
7599+MODULE_SCOPE int       Tk_MenubuttonObjCmd(ClientData clientData,
7600+                           Tcl_Interp *interp, int objc,
7601+                           Tcl_Obj *const objv[]);
7602+MODULE_SCOPE int       Tk_MessageBoxObjCmd(ClientData clientData,
7603+                           Tcl_Interp *interp, int objc,
7604+                           Tcl_Obj *const objv[]);
7605+MODULE_SCOPE int       Tk_MessageObjCmd(ClientData clientData,
7606+                           Tcl_Interp *interp, int objc,
7607+                           Tcl_Obj *const objv[]);
7608+MODULE_SCOPE int       Tk_PanedWindowObjCmd(ClientData clientData,
7609+                           Tcl_Interp *interp, int objc,
7610+                           Tcl_Obj *const objv[]);
7611+MODULE_SCOPE int       Tk_OptionObjCmd(ClientData clientData,
7612+                           Tcl_Interp *interp, int objc,
7613+                           Tcl_Obj *const objv[]);
7614+MODULE_SCOPE int       Tk_PackObjCmd(ClientData clientData,
7615+                           Tcl_Interp *interp, int objc,
7616+                           Tcl_Obj *const objv[]);
7617+MODULE_SCOPE int       Tk_PlaceObjCmd(ClientData clientData,
7618+                           Tcl_Interp *interp, int objc,
7619+                           Tcl_Obj *const objv[]);
7620+MODULE_SCOPE int       Tk_RadiobuttonObjCmd(ClientData clientData,
7621+                           Tcl_Interp *interp, int objc,
7622+                           Tcl_Obj *const objv[]);
7623+MODULE_SCOPE int       Tk_RaiseObjCmd(ClientData clientData,
7624+                           Tcl_Interp *interp, int objc,
7625+                           Tcl_Obj *const objv[]);
7626+MODULE_SCOPE int       Tk_ScaleObjCmd(ClientData clientData,
7627+                           Tcl_Interp *interp, int objc,
7628+                           Tcl_Obj *const objv[]);
7629+MODULE_SCOPE int       Tk_ScrollbarCmd(ClientData clientData,
7630+                           Tcl_Interp *interp, int argc, const char **argv);
7631+MODULE_SCOPE int       Tk_SelectionObjCmd(ClientData clientData,
7632+                           Tcl_Interp *interp, int objc,
7633+                           Tcl_Obj *const objv[]);
7634+MODULE_SCOPE int       Tk_SendCmd(ClientData clientData,
7635+                           Tcl_Interp *interp, int argc, const char **argv);
7636+MODULE_SCOPE int       Tk_SendObjCmd(ClientData clientData,
7637+                           Tcl_Interp *interp, int objc,
7638+                           Tcl_Obj *const objv[]);
7639+MODULE_SCOPE int       Tk_SpinboxObjCmd(ClientData clientData,
7640+                           Tcl_Interp *interp, int objc,
7641+                           Tcl_Obj *const objv[]);
7642+MODULE_SCOPE int       Tk_TextObjCmd(ClientData clientData,
7643+                           Tcl_Interp *interp, int objc,
7644+                           Tcl_Obj *const objv[]);
7645+MODULE_SCOPE int       Tk_TkwaitObjCmd(ClientData clientData,
7646+                           Tcl_Interp *interp, int objc,
7647+                           Tcl_Obj *const objv[]);
7648+MODULE_SCOPE int       Tk_ToplevelObjCmd(ClientData clientData,
7649+                           Tcl_Interp *interp, int objc,
7650+                           Tcl_Obj *const objv[]);
7651+MODULE_SCOPE int       Tk_UpdateObjCmd(ClientData clientData,
7652+                           Tcl_Interp *interp, int objc,
7653+                           Tcl_Obj *const objv[]);
7654+MODULE_SCOPE int       Tk_WinfoObjCmd(ClientData clientData,
7655+                           Tcl_Interp *interp, int objc,
7656+                           Tcl_Obj *const objv[]);
7657+MODULE_SCOPE int       Tk_WmObjCmd(ClientData clientData, Tcl_Interp *interp,
7658+                           int objc, Tcl_Obj *const objv[]);
7659+
7660+MODULE_SCOPE int       Tk_GetDoublePixelsFromObj(Tcl_Interp *interp,
7661+                           Tk_Window tkwin, Tcl_Obj *objPtr,
7662+                           double *doublePtr);
7663+MODULE_SCOPE int       TkSetGeometryMaster(Tcl_Interp *interp,
7664+                           Tk_Window tkwin, const char *master);
7665+MODULE_SCOPE void      TkFreeGeometryMaster(Tk_Window tkwin,
7666+                           const char *master);
7667+
7668+MODULE_SCOPE void      TkEventInit(void);
7669+MODULE_SCOPE void      TkRegisterObjTypes(void);
7670+MODULE_SCOPE int       TkCreateMenuCmd(Tcl_Interp *interp);
7671+MODULE_SCOPE int       TkDeadAppCmd(ClientData clientData,
7672+                           Tcl_Interp *interp, int argc, const char **argv);
7673+MODULE_SCOPE int       TkCanvasGetCoordObj(Tcl_Interp *interp,
7674+                           Tk_Canvas canvas, Tcl_Obj *obj,
7675+                           double *doublePtr);
7676+MODULE_SCOPE int       TkGetDoublePixels(Tcl_Interp *interp, Tk_Window tkwin,
7677+                           const char *string, double *doublePtr);
7678+MODULE_SCOPE int       TkPostscriptImage(Tcl_Interp *interp, Tk_Window tkwin,
7679+                           Tk_PostscriptInfo psInfo, XImage *ximage,
7680+                           int x, int y, int width, int height);
7681+MODULE_SCOPE void       TkMapTopFrame(Tk_Window tkwin);
7682+MODULE_SCOPE XEvent *  TkpGetBindingXEvent(Tcl_Interp *interp);
7683+MODULE_SCOPE void      TkCreateExitHandler(Tcl_ExitProc *proc,
7684+                           ClientData clientData);
7685+MODULE_SCOPE void      TkDeleteExitHandler(Tcl_ExitProc *proc,
7686+                           ClientData clientData);
7687+MODULE_SCOPE Tcl_ExitProc      TkFinalize;
7688+MODULE_SCOPE Tcl_ExitProc      TkFinalizeThread;
7689+MODULE_SCOPE void      TkpBuildRegionFromAlphaData(TkRegion region,
7690+                           unsigned x, unsigned y, unsigned width,
7691+                           unsigned height, unsigned char *dataPtr,
7692+                           unsigned pixelStride, unsigned lineStride);
7693+MODULE_SCOPE void      TkAppendPadAmount(Tcl_Obj *bufferObj,
7694+                           const char *buffer, int pad1, int pad2);
7695+MODULE_SCOPE int       TkParsePadAmount(Tcl_Interp *interp,
7696+                           Tk_Window tkwin, Tcl_Obj *objPtr,
7697+                           int *pad1Ptr, int *pad2Ptr);
7698+MODULE_SCOPE void       TkFocusSplit(TkWindow *winPtr);
7699+MODULE_SCOPE void       TkFocusJoin(TkWindow *winPtr);
7700+MODULE_SCOPE int       TkpAlwaysShowSelection(Tk_Window tkwin);
7701+MODULE_SCOPE void      TkpDrawCharsInContext(Display * display,
7702+                           Drawable drawable, GC gc, Tk_Font tkfont,
7703+                           const char *source, int numBytes, int rangeStart,
7704+                           int rangeLength, int x, int y);
7705+MODULE_SCOPE int       TkpMeasureCharsInContext(Tk_Font tkfont,
7706+                           const char *source, int numBytes, int rangeStart,
7707+                           int rangeLength, int maxLength, int flags,
7708+                           int *lengthPtr);
7709+MODULE_SCOPE void      TkUnderlineCharsInContext(Display *display,
7710+                           Drawable drawable, GC gc, Tk_Font tkfont,
7711+                           const char *string, int numBytes, int x, int y,
7712+                           int firstByte, int lastByte);
7713+MODULE_SCOPE void      TkpGetFontAttrsForChar(Tk_Window tkwin, Tk_Font tkfont,
7714+                           Tcl_UniChar c, struct TkFontAttributes *faPtr);
7715+MODULE_SCOPE Tcl_Obj * TkNewWindowObj(Tk_Window tkwin);
7716+MODULE_SCOPE void      TkpShowBusyWindow(TkBusy busy);
7717+MODULE_SCOPE void      TkpHideBusyWindow(TkBusy busy);
7718+MODULE_SCOPE void      TkpMakeTransparentWindowExist(Tk_Window tkwin,
7719+                           Window parent);
7720+MODULE_SCOPE void      TkpCreateBusy(Tk_FakeWin *winPtr, Tk_Window tkRef,
7721+                           Window *parentPtr, Tk_Window tkParent,
7722+                           TkBusy busy);
7723+MODULE_SCOPE int       TkBackgroundEvalObjv(Tcl_Interp *interp,
7724+                           int objc, Tcl_Obj *const *objv, int flags);
7725+MODULE_SCOPE void      TkSendVirtualEvent(Tk_Window tgtWin,
7726+                           const char *eventName);
7727+MODULE_SCOPE Tcl_Command TkMakeEnsemble(Tcl_Interp *interp,
7728+                           const char *nsname, const char *name,
7729+                           ClientData clientData, const TkEnsemble *map);
7730+MODULE_SCOPE int       TkInitTkCmd(Tcl_Interp *interp,
7731+                           ClientData clientData);
7732+MODULE_SCOPE int       TkInitFontchooser(Tcl_Interp *interp,
7733+                           ClientData clientData);
7734+MODULE_SCOPE void      TkpWarpPointer(TkDisplay *dispPtr);
7735+
7736+#ifdef __WIN32__
7737+#define TkParseColor XParseColor
7738+#else
7739+MODULE_SCOPE Status TkParseColor (Display * display,
7740+                               Colormap map, const char* spec,
7741+                               XColor * colorPtr);
7742+#endif
7743+#ifdef HAVE_XFT
7744+MODULE_SCOPE void      TkUnixSetXftClipRegion(TkRegion clipRegion);
7745+#endif
7746+
7747+/*
7748+ * Unsupported commands.
7749+ */
7750+
7751+MODULE_SCOPE int       TkUnsupported1ObjCmd(ClientData clientData,
7752+                           Tcl_Interp *interp, int objc,
7753+                           Tcl_Obj *const objv[]);
7754+
7755+/*
7756+ * For Tktest.
7757+ */
7758+MODULE_SCOPE int SquareObjCmd(ClientData clientData,
7759+                           Tcl_Interp *interp, int objc,
7760+                           Tcl_Obj * const objv[]);
7761+MODULE_SCOPE int       TkOldTestInit(Tcl_Interp *interp);
7762+#if !(defined(__WIN32__) || defined(MAC_OSX_TK))
7763+#define TkplatformtestInit(x) TCL_OK
7764+#else
7765+MODULE_SCOPE int       TkplatformtestInit(Tcl_Interp *interp);
7766+#endif
7767+
7768+#endif /* _TKINT */
7769+
7770+/*
7771+ * Local Variables:
7772+ * mode: c
7773+ * c-basic-offset: 4
7774+ * fill-column: 78
7775+ * End:
7776+ */
7777--- src/tkIntDecls.h    1969-12-31 19:00:00.000000000 -0500
7778+++ src/tkIntDecls.h    2013-08-20 11:45:27.000000000 -0400
7779@@ -0,0 +1,1177 @@
7780+/*
7781+ * tkIntDecls.h --
7782+ *
7783+ *     This file contains the declarations for all unsupported
7784+ *     functions that are exported by the Tk library.  These
7785+ *     interfaces are not guaranteed to remain the same between
7786+ *     versions.  Use at your own risk.
7787+ *
7788+ * Copyright (c) 1998-1999 by Scriptics Corporation.
7789+ *
7790+ * See the file "license.terms" for information on usage and redistribution
7791+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
7792+ */
7793+
7794+#ifndef _TKINTDECLS
7795+#define _TKINTDECLS
7796+
7797+#ifdef BUILD_tk
7798+#undef TCL_STORAGE_CLASS
7799+#define TCL_STORAGE_CLASS DLLEXPORT
7800+#endif
7801+
7802+struct TkText;
7803+typedef struct TkTextBTree_ *TkTextBTree;
7804+struct TkTextDispChunk;
7805+struct TkTextIndex;
7806+struct TkTextSegment;
7807+struct TkSharedText;
7808+
7809+/*
7810+ * WARNING: This file is automatically generated by the tools/genStubs.tcl
7811+ * script.  Any modifications to the function declarations below should be made
7812+ * in the generic/tkInt.decls script.
7813+ */
7814+
7815+/* !BEGIN!: Do not edit below this line. */
7816+
7817+/*
7818+ * Exported function declarations:
7819+ */
7820+
7821+/* 0 */
7822+EXTERN TkWindow *      TkAllocWindow(TkDisplay *dispPtr, int screenNum,
7823+                               TkWindow *parentPtr);
7824+/* 1 */
7825+EXTERN void            TkBezierPoints(double control[], int numSteps,
7826+                               double *coordPtr);
7827+/* 2 */
7828+EXTERN void            TkBezierScreenPoints(Tk_Canvas canvas,
7829+                               double control[], int numSteps,
7830+                               XPoint *xPointPtr);
7831+/* Slot 3 is reserved */
7832+/* 4 */
7833+EXTERN void            TkBindEventProc(TkWindow *winPtr, XEvent *eventPtr);
7834+/* 5 */
7835+EXTERN void            TkBindFree(TkMainInfo *mainPtr);
7836+/* 6 */
7837+EXTERN void            TkBindInit(TkMainInfo *mainPtr);
7838+/* 7 */
7839+EXTERN void            TkChangeEventWindow(XEvent *eventPtr,
7840+                               TkWindow *winPtr);
7841+/* 8 */
7842+EXTERN int             TkClipInit(Tcl_Interp *interp, TkDisplay *dispPtr);
7843+/* 9 */
7844+EXTERN void            TkComputeAnchor(Tk_Anchor anchor, Tk_Window tkwin,
7845+                               int padX, int padY, int innerWidth,
7846+                               int innerHeight, int *xPtr, int *yPtr);
7847+/* Slot 10 is reserved */
7848+/* Slot 11 is reserved */
7849+/* 12 */
7850+EXTERN TkCursor *      TkCreateCursorFromData(Tk_Window tkwin,
7851+                               const char *source, const char *mask,
7852+                               int width, int height, int xHot, int yHot,
7853+                               XColor fg, XColor bg);
7854+/* 13 */
7855+EXTERN int             TkCreateFrame(ClientData clientData,
7856+                               Tcl_Interp *interp, int argc,
7857+                               const char *const *argv, int toplevel,
7858+                               const char *appName);
7859+/* 14 */
7860+EXTERN Tk_Window       TkCreateMainWindow(Tcl_Interp *interp,
7861+                               const char *screenName, const char *baseName);
7862+/* 15 */
7863+EXTERN Time            TkCurrentTime(TkDisplay *dispPtr);
7864+/* 16 */
7865+EXTERN void            TkDeleteAllImages(TkMainInfo *mainPtr);
7866+/* 17 */
7867+EXTERN void            TkDoConfigureNotify(TkWindow *winPtr);
7868+/* 18 */
7869+EXTERN void            TkDrawInsetFocusHighlight(Tk_Window tkwin, GC gc,
7870+                               int width, Drawable drawable, int padding);
7871+/* 19 */
7872+EXTERN void            TkEventDeadWindow(TkWindow *winPtr);
7873+/* 20 */
7874+EXTERN void            TkFillPolygon(Tk_Canvas canvas, double *coordPtr,
7875+                               int numPoints, Display *display,
7876+                               Drawable drawable, GC gc, GC outlineGC);
7877+/* 21 */
7878+EXTERN int             TkFindStateNum(Tcl_Interp *interp,
7879+                               const char *option, const TkStateMap *mapPtr,
7880+                               const char *strKey);
7881+/* 22 */
7882+EXTERN CONST86 char *  TkFindStateString(const TkStateMap *mapPtr,
7883+                               int numKey);
7884+/* 23 */
7885+EXTERN void            TkFocusDeadWindow(TkWindow *winPtr);
7886+/* 24 */
7887+EXTERN int             TkFocusFilterEvent(TkWindow *winPtr,
7888+                               XEvent *eventPtr);
7889+/* 25 */
7890+EXTERN TkWindow *      TkFocusKeyEvent(TkWindow *winPtr, XEvent *eventPtr);
7891+/* 26 */
7892+EXTERN void            TkFontPkgInit(TkMainInfo *mainPtr);
7893+/* 27 */
7894+EXTERN void            TkFontPkgFree(TkMainInfo *mainPtr);
7895+/* 28 */
7896+EXTERN void            TkFreeBindingTags(TkWindow *winPtr);
7897+/* 29 */
7898+EXTERN void            TkpFreeCursor(TkCursor *cursorPtr);
7899+/* 30 */
7900+EXTERN char *          TkGetBitmapData(Tcl_Interp *interp,
7901+                               const char *string, const char *fileName,
7902+                               int *widthPtr, int *heightPtr, int *hotXPtr,
7903+                               int *hotYPtr);
7904+/* 31 */
7905+EXTERN void            TkGetButtPoints(double p1[], double p2[],
7906+                               double width, int project, double m1[],
7907+                               double m2[]);
7908+/* 32 */
7909+EXTERN TkCursor *      TkGetCursorByName(Tcl_Interp *interp,
7910+                               Tk_Window tkwin, Tk_Uid string);
7911+/* 33 */
7912+EXTERN const char *    TkGetDefaultScreenName(Tcl_Interp *interp,
7913+                               const char *screenName);
7914+/* 34 */
7915+EXTERN TkDisplay *     TkGetDisplay(Display *display);
7916+/* 35 */
7917+EXTERN int             TkGetDisplayOf(Tcl_Interp *interp, int objc,
7918+                               Tcl_Obj *const objv[], Tk_Window *tkwinPtr);
7919+/* 36 */
7920+EXTERN TkWindow *      TkGetFocusWin(TkWindow *winPtr);
7921+/* 37 */
7922+EXTERN int             TkGetInterpNames(Tcl_Interp *interp, Tk_Window tkwin);
7923+/* 38 */
7924+EXTERN int             TkGetMiterPoints(double p1[], double p2[],
7925+                               double p3[], double width, double m1[],
7926+                               double m2[]);
7927+/* 39 */
7928+EXTERN void            TkGetPointerCoords(Tk_Window tkwin, int *xPtr,
7929+                               int *yPtr);
7930+/* 40 */
7931+EXTERN void            TkGetServerInfo(Tcl_Interp *interp, Tk_Window tkwin);
7932+/* 41 */
7933+EXTERN void            TkGrabDeadWindow(TkWindow *winPtr);
7934+/* 42 */
7935+EXTERN int             TkGrabState(TkWindow *winPtr);
7936+/* 43 */
7937+EXTERN void            TkIncludePoint(Tk_Item *itemPtr, double *pointPtr);
7938+/* 44 */
7939+EXTERN void            TkInOutEvents(XEvent *eventPtr, TkWindow *sourcePtr,
7940+                               TkWindow *destPtr, int leaveType,
7941+                               int enterType, Tcl_QueuePosition position);
7942+/* 45 */
7943+EXTERN void            TkInstallFrameMenu(Tk_Window tkwin);
7944+/* 46 */
7945+EXTERN CONST86 char *  TkKeysymToString(KeySym keysym);
7946+/* 47 */
7947+EXTERN int             TkLineToArea(double end1Ptr[], double end2Ptr[],
7948+                               double rectPtr[]);
7949+/* 48 */
7950+EXTERN double          TkLineToPoint(double end1Ptr[], double end2Ptr[],
7951+                               double pointPtr[]);
7952+/* 49 */
7953+EXTERN int             TkMakeBezierCurve(Tk_Canvas canvas, double *pointPtr,
7954+                               int numPoints, int numSteps,
7955+                               XPoint xPoints[], double dblPoints[]);
7956+/* 50 */
7957+EXTERN void            TkMakeBezierPostscript(Tcl_Interp *interp,
7958+                               Tk_Canvas canvas, double *pointPtr,
7959+                               int numPoints);
7960+/* 51 */
7961+EXTERN void            TkOptionClassChanged(TkWindow *winPtr);
7962+/* 52 */
7963+EXTERN void            TkOptionDeadWindow(TkWindow *winPtr);
7964+/* 53 */
7965+EXTERN int             TkOvalToArea(double *ovalPtr, double *rectPtr);
7966+/* 54 */
7967+EXTERN double          TkOvalToPoint(double ovalPtr[], double width,
7968+                               int filled, double pointPtr[]);
7969+/* 55 */
7970+EXTERN int             TkpChangeFocus(TkWindow *winPtr, int force);
7971+/* 56 */
7972+EXTERN void            TkpCloseDisplay(TkDisplay *dispPtr);
7973+/* 57 */
7974+EXTERN void            TkpClaimFocus(TkWindow *topLevelPtr, int force);
7975+/* 58 */
7976+EXTERN void            TkpDisplayWarning(const char *msg, const char *title);
7977+/* 59 */
7978+EXTERN void            TkpGetAppName(Tcl_Interp *interp, Tcl_DString *name);
7979+/* 60 */
7980+EXTERN TkWindow *      TkpGetOtherWindow(TkWindow *winPtr);
7981+/* 61 */
7982+EXTERN TkWindow *      TkpGetWrapperWindow(TkWindow *winPtr);
7983+/* 62 */
7984+EXTERN int             TkpInit(Tcl_Interp *interp);
7985+/* 63 */
7986+EXTERN void            TkpInitializeMenuBindings(Tcl_Interp *interp,
7987+                               Tk_BindingTable bindingTable);
7988+/* 64 */
7989+EXTERN void            TkpMakeContainer(Tk_Window tkwin);
7990+/* 65 */
7991+EXTERN void            TkpMakeMenuWindow(Tk_Window tkwin, int transient);
7992+/* 66 */
7993+EXTERN Window          TkpMakeWindow(TkWindow *winPtr, Window parent);
7994+/* 67 */
7995+EXTERN void            TkpMenuNotifyToplevelCreate(Tcl_Interp *interp,
7996+                               const char *menuName);
7997+/* 68 */
7998+EXTERN TkDisplay *     TkpOpenDisplay(const char *display_name);
7999+/* 69 */
8000+EXTERN int             TkPointerEvent(XEvent *eventPtr, TkWindow *winPtr);
8001+/* 70 */
8002+EXTERN int             TkPolygonToArea(double *polyPtr, int numPoints,
8003+                               double *rectPtr);
8004+/* 71 */
8005+EXTERN double          TkPolygonToPoint(double *polyPtr, int numPoints,
8006+                               double *pointPtr);
8007+/* 72 */
8008+EXTERN int             TkPositionInTree(TkWindow *winPtr, TkWindow *treePtr);
8009+/* 73 */
8010+EXTERN void            TkpRedirectKeyEvent(TkWindow *winPtr,
8011+                               XEvent *eventPtr);
8012+/* 74 */
8013+EXTERN void            TkpSetMainMenubar(Tcl_Interp *interp,
8014+                               Tk_Window tkwin, const char *menuName);
8015+/* 75 */
8016+EXTERN int             TkpUseWindow(Tcl_Interp *interp, Tk_Window tkwin,
8017+                               const char *string);
8018+/* Slot 76 is reserved */
8019+/* 77 */
8020+EXTERN void            TkQueueEventForAllChildren(TkWindow *winPtr,
8021+                               XEvent *eventPtr);
8022+/* 78 */
8023+EXTERN int             TkReadBitmapFile(Display *display, Drawable d,
8024+                               const char *filename,
8025+                               unsigned int *width_return,
8026+                               unsigned int *height_return,
8027+                               Pixmap *bitmap_return, int *x_hot_return,
8028+                               int *y_hot_return);
8029+/* 79 */
8030+EXTERN int             TkScrollWindow(Tk_Window tkwin, GC gc, int x, int y,
8031+                               int width, int height, int dx, int dy,
8032+                               TkRegion damageRgn);
8033+/* 80 */
8034+EXTERN void            TkSelDeadWindow(TkWindow *winPtr);
8035+/* 81 */
8036+EXTERN void            TkSelEventProc(Tk_Window tkwin, XEvent *eventPtr);
8037+/* 82 */
8038+EXTERN void            TkSelInit(Tk_Window tkwin);
8039+/* 83 */
8040+EXTERN void            TkSelPropProc(XEvent *eventPtr);
8041+/* Slot 84 is reserved */
8042+/* 85 */
8043+EXTERN void            TkSetWindowMenuBar(Tcl_Interp *interp,
8044+                               Tk_Window tkwin, const char *oldMenuName,
8045+                               const char *menuName);
8046+/* 86 */
8047+EXTERN KeySym          TkStringToKeysym(const char *name);
8048+/* 87 */
8049+EXTERN int             TkThickPolyLineToArea(double *coordPtr,
8050+                               int numPoints, double width, int capStyle,
8051+                               int joinStyle, double *rectPtr);
8052+/* 88 */
8053+EXTERN void            TkWmAddToColormapWindows(TkWindow *winPtr);
8054+/* 89 */
8055+EXTERN void            TkWmDeadWindow(TkWindow *winPtr);
8056+/* 90 */
8057+EXTERN TkWindow *      TkWmFocusToplevel(TkWindow *winPtr);
8058+/* 91 */
8059+EXTERN void            TkWmMapWindow(TkWindow *winPtr);
8060+/* 92 */
8061+EXTERN void            TkWmNewWindow(TkWindow *winPtr);
8062+/* 93 */
8063+EXTERN void            TkWmProtocolEventProc(TkWindow *winPtr,
8064+                               XEvent *evenvPtr);
8065+/* 94 */
8066+EXTERN void            TkWmRemoveFromColormapWindows(TkWindow *winPtr);
8067+/* 95 */
8068+EXTERN void            TkWmRestackToplevel(TkWindow *winPtr, int aboveBelow,
8069+                               TkWindow *otherPtr);
8070+/* 96 */
8071+EXTERN void            TkWmSetClass(TkWindow *winPtr);
8072+/* 97 */
8073+EXTERN void            TkWmUnmapWindow(TkWindow *winPtr);
8074+/* 98 */
8075+EXTERN Tcl_Obj *       TkDebugBitmap(Tk_Window tkwin, const char *name);
8076+/* 99 */
8077+EXTERN Tcl_Obj *       TkDebugBorder(Tk_Window tkwin, const char *name);
8078+/* 100 */
8079+EXTERN Tcl_Obj *       TkDebugCursor(Tk_Window tkwin, const char *name);
8080+/* 101 */
8081+EXTERN Tcl_Obj *       TkDebugColor(Tk_Window tkwin, const char *name);
8082+/* 102 */
8083+EXTERN Tcl_Obj *       TkDebugConfig(Tcl_Interp *interp,
8084+                               Tk_OptionTable table);
8085+/* 103 */
8086+EXTERN Tcl_Obj *       TkDebugFont(Tk_Window tkwin, const char *name);
8087+/* 104 */
8088+EXTERN int             TkFindStateNumObj(Tcl_Interp *interp,
8089+                               Tcl_Obj *optionPtr, const TkStateMap *mapPtr,
8090+                               Tcl_Obj *keyPtr);
8091+/* 105 */
8092+EXTERN Tcl_HashTable * TkGetBitmapPredefTable(void);
8093+/* 106 */
8094+EXTERN TkDisplay *     TkGetDisplayList(void);
8095+/* 107 */
8096+EXTERN TkMainInfo *    TkGetMainInfoList(void);
8097+/* 108 */
8098+EXTERN int             TkGetWindowFromObj(Tcl_Interp *interp,
8099+                               Tk_Window tkwin, Tcl_Obj *objPtr,
8100+                               Tk_Window *windowPtr);
8101+/* 109 */
8102+EXTERN CONST86 char *  TkpGetString(TkWindow *winPtr, XEvent *eventPtr,
8103+                               Tcl_DString *dsPtr);
8104+/* 110 */
8105+EXTERN void            TkpGetSubFonts(Tcl_Interp *interp, Tk_Font tkfont);
8106+/* 111 */
8107+EXTERN Tcl_Obj *       TkpGetSystemDefault(Tk_Window tkwin,
8108+                               const char *dbName, const char *className);
8109+/* 112 */
8110+EXTERN void            TkpMenuThreadInit(void);
8111+/* 113 */
8112+EXTERN void            TkClipBox(TkRegion rgn, XRectangle *rect_return);
8113+/* 114 */
8114+EXTERN TkRegion                TkCreateRegion(void);
8115+/* 115 */
8116+EXTERN void            TkDestroyRegion(TkRegion rgn);
8117+/* 116 */
8118+EXTERN void            TkIntersectRegion(TkRegion sra, TkRegion srcb,
8119+                               TkRegion dr_return);
8120+/* 117 */
8121+EXTERN int             TkRectInRegion(TkRegion rgn, int x, int y,
8122+                               unsigned int width, unsigned int height);
8123+/* 118 */
8124+EXTERN void            TkSetRegion(Display *display, GC gc, TkRegion rgn);
8125+/* 119 */
8126+EXTERN void            TkUnionRectWithRegion(XRectangle *rect, TkRegion src,
8127+                               TkRegion dr_return);
8128+/* Slot 120 is reserved */
8129+#ifdef MAC_OSX_TK /* AQUA */
8130+/* 121 */
8131+EXTERN Pixmap          TkpCreateNativeBitmap(Display *display,
8132+                               const void *source);
8133+#endif /* AQUA */
8134+#ifdef MAC_OSX_TK /* AQUA */
8135+/* 122 */
8136+EXTERN void            TkpDefineNativeBitmaps(void);
8137+#endif /* AQUA */
8138+/* Slot 123 is reserved */
8139+#ifdef MAC_OSX_TK /* AQUA */
8140+/* 124 */
8141+EXTERN Pixmap          TkpGetNativeAppBitmap(Display *display,
8142+                               const char *name, int *width, int *height);
8143+#endif /* AQUA */
8144+/* Slot 125 is reserved */
8145+/* Slot 126 is reserved */
8146+/* Slot 127 is reserved */
8147+/* Slot 128 is reserved */
8148+/* Slot 129 is reserved */
8149+/* Slot 130 is reserved */
8150+/* Slot 131 is reserved */
8151+/* Slot 132 is reserved */
8152+/* Slot 133 is reserved */
8153+/* Slot 134 is reserved */
8154+/* 135 */
8155+EXTERN void            TkpDrawHighlightBorder(Tk_Window tkwin, GC fgGC,
8156+                               GC bgGC, int highlightWidth,
8157+                               Drawable drawable);
8158+/* 136 */
8159+EXTERN void            TkSetFocusWin(TkWindow *winPtr, int force);
8160+/* 137 */
8161+EXTERN void            TkpSetKeycodeAndState(Tk_Window tkwin, KeySym keySym,
8162+                               XEvent *eventPtr);
8163+/* 138 */
8164+EXTERN KeySym          TkpGetKeySym(TkDisplay *dispPtr, XEvent *eventPtr);
8165+/* 139 */
8166+EXTERN void            TkpInitKeymapInfo(TkDisplay *dispPtr);
8167+/* 140 */
8168+EXTERN TkRegion                TkPhotoGetValidRegion(Tk_PhotoHandle handle);
8169+/* 141 */
8170+EXTERN TkWindow **     TkWmStackorderToplevel(TkWindow *parentPtr);
8171+/* 142 */
8172+EXTERN void            TkFocusFree(TkMainInfo *mainPtr);
8173+/* 143 */
8174+EXTERN void            TkClipCleanup(TkDisplay *dispPtr);
8175+/* 144 */
8176+EXTERN void            TkGCCleanup(TkDisplay *dispPtr);
8177+/* 145 */
8178+EXTERN void            TkSubtractRegion(TkRegion sra, TkRegion srcb,
8179+                               TkRegion dr_return);
8180+/* 146 */
8181+EXTERN void            TkStylePkgInit(TkMainInfo *mainPtr);
8182+/* 147 */
8183+EXTERN void            TkStylePkgFree(TkMainInfo *mainPtr);
8184+/* 148 */
8185+EXTERN Tk_Window       TkToplevelWindowForCommand(Tcl_Interp *interp,
8186+                               const char *cmdName);
8187+/* 149 */
8188+EXTERN const Tk_OptionSpec * TkGetOptionSpec(const char *name,
8189+                               Tk_OptionTable optionTable);
8190+/* 150 */
8191+EXTERN int             TkMakeRawCurve(Tk_Canvas canvas, double *pointPtr,
8192+                               int numPoints, int numSteps,
8193+                               XPoint xPoints[], double dblPoints[]);
8194+/* 151 */
8195+EXTERN void            TkMakeRawCurvePostscript(Tcl_Interp *interp,
8196+                               Tk_Canvas canvas, double *pointPtr,
8197+                               int numPoints);
8198+/* 152 */
8199+EXTERN void            TkpDrawFrame(Tk_Window tkwin, Tk_3DBorder border,
8200+                               int highlightWidth, int borderWidth,
8201+                               int relief);
8202+/* 153 */
8203+EXTERN void            TkCreateThreadExitHandler(Tcl_ExitProc *proc,
8204+                               ClientData clientData);
8205+/* 154 */
8206+EXTERN void            TkDeleteThreadExitHandler(Tcl_ExitProc *proc,
8207+                               ClientData clientData);
8208+/* Slot 155 is reserved */
8209+/* 156 */
8210+EXTERN int             TkpTestembedCmd(ClientData clientData,
8211+                               Tcl_Interp *interp, int argc,
8212+                               const char **argv);
8213+/* 157 */
8214+EXTERN int             TkpTesttextCmd(ClientData dummy, Tcl_Interp *interp,
8215+                               int argc, const char **argv);
8216+/* 158 */
8217+EXTERN int             TkSelGetSelection(Tcl_Interp *interp,
8218+                               Tk_Window tkwin, Atom selection, Atom target,
8219+                               Tk_GetSelProc *proc, ClientData clientData);
8220+/* 159 */
8221+EXTERN int             TkTextGetIndex(Tcl_Interp *interp,
8222+                               struct TkText *textPtr, const char *string,
8223+                               struct TkTextIndex *indexPtr);
8224+/* 160 */
8225+EXTERN int             TkTextIndexBackBytes(const struct TkText *textPtr,
8226+                               const struct TkTextIndex *srcPtr, int count,
8227+                               struct TkTextIndex *dstPtr);
8228+/* 161 */
8229+EXTERN int             TkTextIndexForwBytes(const struct TkText *textPtr,
8230+                               const struct TkTextIndex *srcPtr, int count,
8231+                               struct TkTextIndex *dstPtr);
8232+/* 162 */
8233+EXTERN struct TkTextIndex * TkTextMakeByteIndex(TkTextBTree tree,
8234+                               const struct TkText *textPtr, int lineIndex,
8235+                               int byteIndex, struct TkTextIndex *indexPtr);
8236+/* 163 */
8237+EXTERN int             TkTextPrintIndex(const struct TkText *textPtr,
8238+                               const struct TkTextIndex *indexPtr,
8239+                               char *string);
8240+/* 164 */
8241+EXTERN struct TkTextSegment * TkTextSetMark(struct TkText *textPtr,
8242+                               const char *name,
8243+                               struct TkTextIndex *indexPtr);
8244+/* 165 */
8245+EXTERN int             TkTextXviewCmd(struct TkText *textPtr,
8246+                               Tcl_Interp *interp, int objc,
8247+                               Tcl_Obj *const objv[]);
8248+/* 166 */
8249+EXTERN void            TkTextChanged(struct TkSharedText *sharedTextPtr,
8250+                               struct TkText *textPtr,
8251+                               const struct TkTextIndex *index1Ptr,
8252+                               const struct TkTextIndex *index2Ptr);
8253+/* 167 */
8254+EXTERN int             TkBTreeNumLines(TkTextBTree tree,
8255+                               const struct TkText *textPtr);
8256+/* 168 */
8257+EXTERN void            TkTextInsertDisplayProc(struct TkText *textPtr,
8258+                               struct TkTextDispChunk *chunkPtr, int x,
8259+                               int y, int height, int baseline,
8260+                               Display *display, Drawable dst, int screenY);
8261+/* 169 */
8262+EXTERN int             TkStateParseProc(ClientData clientData,
8263+                               Tcl_Interp *interp, Tk_Window tkwin,
8264+                               const char *value, char *widgRec, int offset);
8265+/* 170 */
8266+EXTERN CONST86 char *  TkStatePrintProc(ClientData clientData,
8267+                               Tk_Window tkwin, char *widgRec, int offset,
8268+                               Tcl_FreeProc **freeProcPtr);
8269+/* 171 */
8270+EXTERN int             TkCanvasDashParseProc(ClientData clientData,
8271+                               Tcl_Interp *interp, Tk_Window tkwin,
8272+                               const char *value, char *widgRec, int offset);
8273+/* 172 */
8274+EXTERN CONST86 char *  TkCanvasDashPrintProc(ClientData clientData,
8275+                               Tk_Window tkwin, char *widgRec, int offset,
8276+                               Tcl_FreeProc **freeProcPtr);
8277+/* 173 */
8278+EXTERN int             TkOffsetParseProc(ClientData clientData,
8279+                               Tcl_Interp *interp, Tk_Window tkwin,
8280+                               const char *value, char *widgRec, int offset);
8281+/* 174 */
8282+EXTERN CONST86 char *  TkOffsetPrintProc(ClientData clientData,
8283+                               Tk_Window tkwin, char *widgRec, int offset,
8284+                               Tcl_FreeProc **freeProcPtr);
8285+/* 175 */
8286+EXTERN int             TkPixelParseProc(ClientData clientData,
8287+                               Tcl_Interp *interp, Tk_Window tkwin,
8288+                               const char *value, char *widgRec, int offset);
8289+/* 176 */
8290+EXTERN CONST86 char *  TkPixelPrintProc(ClientData clientData,
8291+                               Tk_Window tkwin, char *widgRec, int offset,
8292+                               Tcl_FreeProc **freeProcPtr);
8293+/* 177 */
8294+EXTERN int             TkOrientParseProc(ClientData clientData,
8295+                               Tcl_Interp *interp, Tk_Window tkwin,
8296+                               const char *value, char *widgRec, int offset);
8297+/* 178 */
8298+EXTERN CONST86 char *  TkOrientPrintProc(ClientData clientData,
8299+                               Tk_Window tkwin, char *widgRec, int offset,
8300+                               Tcl_FreeProc **freeProcPtr);
8301+/* 179 */
8302+EXTERN int             TkSmoothParseProc(ClientData clientData,
8303+                               Tcl_Interp *interp, Tk_Window tkwin,
8304+                               const char *value, char *widgRec, int offset);
8305+/* 180 */
8306+EXTERN CONST86 char *  TkSmoothPrintProc(ClientData clientData,
8307+                               Tk_Window tkwin, char *widgRec, int offset,
8308+                               Tcl_FreeProc **freeProcPtr);
8309+/* 181 */
8310+EXTERN void            TkDrawAngledTextLayout(Display *display,
8311+                               Drawable drawable, GC gc,
8312+                               Tk_TextLayout layout, int x, int y,
8313+                               double angle, int firstChar, int lastChar);
8314+/* 182 */
8315+EXTERN void            TkUnderlineAngledTextLayout(Display *display,
8316+                               Drawable drawable, GC gc,
8317+                               Tk_TextLayout layout, int x, int y,
8318+                               double angle, int underline);
8319+/* 183 */
8320+EXTERN int             TkIntersectAngledTextLayout(Tk_TextLayout layout,
8321+                               int x, int y, int width, int height,
8322+                               double angle);
8323+/* 184 */
8324+EXTERN void            TkDrawAngledChars(Display *display,
8325+                               Drawable drawable, GC gc, Tk_Font tkfont,
8326+                               const char *source, int numBytes, double x,
8327+                               double y, double angle);
8328+
8329+typedef struct TkIntStubs {
8330+    int magic;
8331+    void *hooks;
8332+
8333+    TkWindow * (*tkAllocWindow) (TkDisplay *dispPtr, int screenNum, TkWindow *parentPtr); /* 0 */
8334+    void (*tkBezierPoints) (double control[], int numSteps, double *coordPtr); /* 1 */
8335+    void (*tkBezierScreenPoints) (Tk_Canvas canvas, double control[], int numSteps, XPoint *xPointPtr); /* 2 */
8336+    void (*reserved3)(void);
8337+    void (*tkBindEventProc) (TkWindow *winPtr, XEvent *eventPtr); /* 4 */
8338+    void (*tkBindFree) (TkMainInfo *mainPtr); /* 5 */
8339+    void (*tkBindInit) (TkMainInfo *mainPtr); /* 6 */
8340+    void (*tkChangeEventWindow) (XEvent *eventPtr, TkWindow *winPtr); /* 7 */
8341+    int (*tkClipInit) (Tcl_Interp *interp, TkDisplay *dispPtr); /* 8 */
8342+    void (*tkComputeAnchor) (Tk_Anchor anchor, Tk_Window tkwin, int padX, int padY, int innerWidth, int innerHeight, int *xPtr, int *yPtr); /* 9 */
8343+    void (*reserved10)(void);
8344+    void (*reserved11)(void);
8345+    TkCursor * (*tkCreateCursorFromData) (Tk_Window tkwin, const char *source, const char *mask, int width, int height, int xHot, int yHot, XColor fg, XColor bg); /* 12 */
8346+    int (*tkCreateFrame) (ClientData clientData, Tcl_Interp *interp, int argc, const char *const *argv, int toplevel, const char *appName); /* 13 */
8347+    Tk_Window (*tkCreateMainWindow) (Tcl_Interp *interp, const char *screenName, const char *baseName); /* 14 */
8348+    Time (*tkCurrentTime) (TkDisplay *dispPtr); /* 15 */
8349+    void (*tkDeleteAllImages) (TkMainInfo *mainPtr); /* 16 */
8350+    void (*tkDoConfigureNotify) (TkWindow *winPtr); /* 17 */
8351+    void (*tkDrawInsetFocusHighlight) (Tk_Window tkwin, GC gc, int width, Drawable drawable, int padding); /* 18 */
8352+    void (*tkEventDeadWindow) (TkWindow *winPtr); /* 19 */
8353+    void (*tkFillPolygon) (Tk_Canvas canvas, double *coordPtr, int numPoints, Display *display, Drawable drawable, GC gc, GC outlineGC); /* 20 */
8354+    int (*tkFindStateNum) (Tcl_Interp *interp, const char *option, const TkStateMap *mapPtr, const char *strKey); /* 21 */
8355+    CONST86 char * (*tkFindStateString) (const TkStateMap *mapPtr, int numKey); /* 22 */
8356+    void (*tkFocusDeadWindow) (TkWindow *winPtr); /* 23 */
8357+    int (*tkFocusFilterEvent) (TkWindow *winPtr, XEvent *eventPtr); /* 24 */
8358+    TkWindow * (*tkFocusKeyEvent) (TkWindow *winPtr, XEvent *eventPtr); /* 25 */
8359+    void (*tkFontPkgInit) (TkMainInfo *mainPtr); /* 26 */
8360+    void (*tkFontPkgFree) (TkMainInfo *mainPtr); /* 27 */
8361+    void (*tkFreeBindingTags) (TkWindow *winPtr); /* 28 */
8362+    void (*tkpFreeCursor) (TkCursor *cursorPtr); /* 29 */
8363+    char * (*tkGetBitmapData) (Tcl_Interp *interp, const char *string, const char *fileName, int *widthPtr, int *heightPtr, int *hotXPtr, int *hotYPtr); /* 30 */
8364+    void (*tkGetButtPoints) (double p1[], double p2[], double width, int project, double m1[], double m2[]); /* 31 */
8365+    TkCursor * (*tkGetCursorByName) (Tcl_Interp *interp, Tk_Window tkwin, Tk_Uid string); /* 32 */
8366+    const char * (*tkGetDefaultScreenName) (Tcl_Interp *interp, const char *screenName); /* 33 */
8367+    TkDisplay * (*tkGetDisplay) (Display *display); /* 34 */
8368+    int (*tkGetDisplayOf) (Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], Tk_Window *tkwinPtr); /* 35 */
8369+    TkWindow * (*tkGetFocusWin) (TkWindow *winPtr); /* 36 */
8370+    int (*tkGetInterpNames) (Tcl_Interp *interp, Tk_Window tkwin); /* 37 */
8371+    int (*tkGetMiterPoints) (double p1[], double p2[], double p3[], double width, double m1[], double m2[]); /* 38 */
8372+    void (*tkGetPointerCoords) (Tk_Window tkwin, int *xPtr, int *yPtr); /* 39 */
8373+    void (*tkGetServerInfo) (Tcl_Interp *interp, Tk_Window tkwin); /* 40 */
8374+    void (*tkGrabDeadWindow) (TkWindow *winPtr); /* 41 */
8375+    int (*tkGrabState) (TkWindow *winPtr); /* 42 */
8376+    void (*tkIncludePoint) (Tk_Item *itemPtr, double *pointPtr); /* 43 */
8377+    void (*tkInOutEvents) (XEvent *eventPtr, TkWindow *sourcePtr, TkWindow *destPtr, int leaveType, int enterType, Tcl_QueuePosition position); /* 44 */
8378+    void (*tkInstallFrameMenu) (Tk_Window tkwin); /* 45 */
8379+    CONST86 char * (*tkKeysymToString) (KeySym keysym); /* 46 */
8380+    int (*tkLineToArea) (double end1Ptr[], double end2Ptr[], double rectPtr[]); /* 47 */
8381+    double (*tkLineToPoint) (double end1Ptr[], double end2Ptr[], double pointPtr[]); /* 48 */
8382+    int (*tkMakeBezierCurve) (Tk_Canvas canvas, double *pointPtr, int numPoints, int numSteps, XPoint xPoints[], double dblPoints[]); /* 49 */
8383+    void (*tkMakeBezierPostscript) (Tcl_Interp *interp, Tk_Canvas canvas, double *pointPtr, int numPoints); /* 50 */
8384+    void (*tkOptionClassChanged) (TkWindow *winPtr); /* 51 */
8385+    void (*tkOptionDeadWindow) (TkWindow *winPtr); /* 52 */
8386+    int (*tkOvalToArea) (double *ovalPtr, double *rectPtr); /* 53 */
8387+    double (*tkOvalToPoint) (double ovalPtr[], double width, int filled, double pointPtr[]); /* 54 */
8388+    int (*tkpChangeFocus) (TkWindow *winPtr, int force); /* 55 */
8389+    void (*tkpCloseDisplay) (TkDisplay *dispPtr); /* 56 */
8390+    void (*tkpClaimFocus) (TkWindow *topLevelPtr, int force); /* 57 */
8391+    void (*tkpDisplayWarning) (const char *msg, const char *title); /* 58 */
8392+    void (*tkpGetAppName) (Tcl_Interp *interp, Tcl_DString *name); /* 59 */
8393+    TkWindow * (*tkpGetOtherWindow) (TkWindow *winPtr); /* 60 */
8394+    TkWindow * (*tkpGetWrapperWindow) (TkWindow *winPtr); /* 61 */
8395+    int (*tkpInit) (Tcl_Interp *interp); /* 62 */
8396+    void (*tkpInitializeMenuBindings) (Tcl_Interp *interp, Tk_BindingTable bindingTable); /* 63 */
8397+    void (*tkpMakeContainer) (Tk_Window tkwin); /* 64 */
8398+    void (*tkpMakeMenuWindow) (Tk_Window tkwin, int transient); /* 65 */
8399+    Window (*tkpMakeWindow) (TkWindow *winPtr, Window parent); /* 66 */
8400+    void (*tkpMenuNotifyToplevelCreate) (Tcl_Interp *interp, const char *menuName); /* 67 */
8401+    TkDisplay * (*tkpOpenDisplay) (const char *display_name); /* 68 */
8402+    int (*tkPointerEvent) (XEvent *eventPtr, TkWindow *winPtr); /* 69 */
8403+    int (*tkPolygonToArea) (double *polyPtr, int numPoints, double *rectPtr); /* 70 */
8404+    double (*tkPolygonToPoint) (double *polyPtr, int numPoints, double *pointPtr); /* 71 */
8405+    int (*tkPositionInTree) (TkWindow *winPtr, TkWindow *treePtr); /* 72 */
8406+    void (*tkpRedirectKeyEvent) (TkWindow *winPtr, XEvent *eventPtr); /* 73 */
8407+    void (*tkpSetMainMenubar) (Tcl_Interp *interp, Tk_Window tkwin, const char *menuName); /* 74 */
8408+    int (*tkpUseWindow) (Tcl_Interp *interp, Tk_Window tkwin, const char *string); /* 75 */
8409+    void (*reserved76)(void);
8410+    void (*tkQueueEventForAllChildren) (TkWindow *winPtr, XEvent *eventPtr); /* 77 */
8411+    int (*tkReadBitmapFile) (Display *display, Drawable d, const char *filename, unsigned int *width_return, unsigned int *height_return, Pixmap *bitmap_return, int *x_hot_return, int *y_hot_return); /* 78 */
8412+    int (*tkScrollWindow) (Tk_Window tkwin, GC gc, int x, int y, int width, int height, int dx, int dy, TkRegion damageRgn); /* 79 */
8413+    void (*tkSelDeadWindow) (TkWindow *winPtr); /* 80 */
8414+    void (*tkSelEventProc) (Tk_Window tkwin, XEvent *eventPtr); /* 81 */
8415+    void (*tkSelInit) (Tk_Window tkwin); /* 82 */
8416+    void (*tkSelPropProc) (XEvent *eventPtr); /* 83 */
8417+    void (*reserved84)(void);
8418+    void (*tkSetWindowMenuBar) (Tcl_Interp *interp, Tk_Window tkwin, const char *oldMenuName, const char *menuName); /* 85 */
8419+    KeySym (*tkStringToKeysym) (const char *name); /* 86 */
8420+    int (*tkThickPolyLineToArea) (double *coordPtr, int numPoints, double width, int capStyle, int joinStyle, double *rectPtr); /* 87 */
8421+    void (*tkWmAddToColormapWindows) (TkWindow *winPtr); /* 88 */
8422+    void (*tkWmDeadWindow) (TkWindow *winPtr); /* 89 */
8423+    TkWindow * (*tkWmFocusToplevel) (TkWindow *winPtr); /* 90 */
8424+    void (*tkWmMapWindow) (TkWindow *winPtr); /* 91 */
8425+    void (*tkWmNewWindow) (TkWindow *winPtr); /* 92 */
8426+    void (*tkWmProtocolEventProc) (TkWindow *winPtr, XEvent *evenvPtr); /* 93 */
8427+    void (*tkWmRemoveFromColormapWindows) (TkWindow *winPtr); /* 94 */
8428+    void (*tkWmRestackToplevel) (TkWindow *winPtr, int aboveBelow, TkWindow *otherPtr); /* 95 */
8429+    void (*tkWmSetClass) (TkWindow *winPtr); /* 96 */
8430+    void (*tkWmUnmapWindow) (TkWindow *winPtr); /* 97 */
8431+    Tcl_Obj * (*tkDebugBitmap) (Tk_Window tkwin, const char *name); /* 98 */
8432+    Tcl_Obj * (*tkDebugBorder) (Tk_Window tkwin, const char *name); /* 99 */
8433+    Tcl_Obj * (*tkDebugCursor) (Tk_Window tkwin, const char *name); /* 100 */
8434+    Tcl_Obj * (*tkDebugColor) (Tk_Window tkwin, const char *name); /* 101 */
8435+    Tcl_Obj * (*tkDebugConfig) (Tcl_Interp *interp, Tk_OptionTable table); /* 102 */
8436+    Tcl_Obj * (*tkDebugFont) (Tk_Window tkwin, const char *name); /* 103 */
8437+    int (*tkFindStateNumObj) (Tcl_Interp *interp, Tcl_Obj *optionPtr, const TkStateMap *mapPtr, Tcl_Obj *keyPtr); /* 104 */
8438+    Tcl_HashTable * (*tkGetBitmapPredefTable) (void); /* 105 */
8439+    TkDisplay * (*tkGetDisplayList) (void); /* 106 */
8440+    TkMainInfo * (*tkGetMainInfoList) (void); /* 107 */
8441+    int (*tkGetWindowFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, Tk_Window *windowPtr); /* 108 */
8442+    CONST86 char * (*tkpGetString) (TkWindow *winPtr, XEvent *eventPtr, Tcl_DString *dsPtr); /* 109 */
8443+    void (*tkpGetSubFonts) (Tcl_Interp *interp, Tk_Font tkfont); /* 110 */
8444+    Tcl_Obj * (*tkpGetSystemDefault) (Tk_Window tkwin, const char *dbName, const char *className); /* 111 */
8445+    void (*tkpMenuThreadInit) (void); /* 112 */
8446+    void (*tkClipBox) (TkRegion rgn, XRectangle *rect_return); /* 113 */
8447+    TkRegion (*tkCreateRegion) (void); /* 114 */
8448+    void (*tkDestroyRegion) (TkRegion rgn); /* 115 */
8449+    void (*tkIntersectRegion) (TkRegion sra, TkRegion srcb, TkRegion dr_return); /* 116 */
8450+    int (*tkRectInRegion) (TkRegion rgn, int x, int y, unsigned int width, unsigned int height); /* 117 */
8451+    void (*tkSetRegion) (Display *display, GC gc, TkRegion rgn); /* 118 */
8452+    void (*tkUnionRectWithRegion) (XRectangle *rect, TkRegion src, TkRegion dr_return); /* 119 */
8453+    void (*reserved120)(void);
8454+#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
8455+    void (*reserved121)(void);
8456+#endif /* X11 */
8457+#if defined(__WIN32__) /* WIN */
8458+    void (*reserved121)(void);
8459+#endif /* WIN */
8460+#ifdef MAC_OSX_TK /* AQUA */
8461+    void (*reserved121)(void); /* Dummy entry for stubs table backwards compatibility */
8462+    Pixmap (*tkpCreateNativeBitmap) (Display *display, const void *source); /* 121 */
8463+#endif /* AQUA */
8464+#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
8465+    void (*reserved122)(void);
8466+#endif /* X11 */
8467+#if defined(__WIN32__) /* WIN */
8468+    void (*reserved122)(void);
8469+#endif /* WIN */
8470+#ifdef MAC_OSX_TK /* AQUA */
8471+    void (*reserved122)(void); /* Dummy entry for stubs table backwards compatibility */
8472+    void (*tkpDefineNativeBitmaps) (void); /* 122 */
8473+#endif /* AQUA */
8474+    void (*reserved123)(void);
8475+#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
8476+    void (*reserved124)(void);
8477+#endif /* X11 */
8478+#if defined(__WIN32__) /* WIN */
8479+    void (*reserved124)(void);
8480+#endif /* WIN */
8481+#ifdef MAC_OSX_TK /* AQUA */
8482+    void (*reserved124)(void); /* Dummy entry for stubs table backwards compatibility */
8483+    Pixmap (*tkpGetNativeAppBitmap) (Display *display, const char *name, int *width, int *height); /* 124 */
8484+#endif /* AQUA */
8485+    void (*reserved125)(void);
8486+    void (*reserved126)(void);
8487+    void (*reserved127)(void);
8488+    void (*reserved128)(void);
8489+    void (*reserved129)(void);
8490+    void (*reserved130)(void);
8491+    void (*reserved131)(void);
8492+    void (*reserved132)(void);
8493+    void (*reserved133)(void);
8494+    void (*reserved134)(void);
8495+    void (*tkpDrawHighlightBorder) (Tk_Window tkwin, GC fgGC, GC bgGC, int highlightWidth, Drawable drawable); /* 135 */
8496+    void (*tkSetFocusWin) (TkWindow *winPtr, int force); /* 136 */
8497+    void (*tkpSetKeycodeAndState) (Tk_Window tkwin, KeySym keySym, XEvent *eventPtr); /* 137 */
8498+    KeySym (*tkpGetKeySym) (TkDisplay *dispPtr, XEvent *eventPtr); /* 138 */
8499+    void (*tkpInitKeymapInfo) (TkDisplay *dispPtr); /* 139 */
8500+    TkRegion (*tkPhotoGetValidRegion) (Tk_PhotoHandle handle); /* 140 */
8501+    TkWindow ** (*tkWmStackorderToplevel) (TkWindow *parentPtr); /* 141 */
8502+    void (*tkFocusFree) (TkMainInfo *mainPtr); /* 142 */
8503+    void (*tkClipCleanup) (TkDisplay *dispPtr); /* 143 */
8504+    void (*tkGCCleanup) (TkDisplay *dispPtr); /* 144 */
8505+    void (*tkSubtractRegion) (TkRegion sra, TkRegion srcb, TkRegion dr_return); /* 145 */
8506+    void (*tkStylePkgInit) (TkMainInfo *mainPtr); /* 146 */
8507+    void (*tkStylePkgFree) (TkMainInfo *mainPtr); /* 147 */
8508+    Tk_Window (*tkToplevelWindowForCommand) (Tcl_Interp *interp, const char *cmdName); /* 148 */
8509+    const Tk_OptionSpec * (*tkGetOptionSpec) (const char *name, Tk_OptionTable optionTable); /* 149 */
8510+    int (*tkMakeRawCurve) (Tk_Canvas canvas, double *pointPtr, int numPoints, int numSteps, XPoint xPoints[], double dblPoints[]); /* 150 */
8511+    void (*tkMakeRawCurvePostscript) (Tcl_Interp *interp, Tk_Canvas canvas, double *pointPtr, int numPoints); /* 151 */
8512+    void (*tkpDrawFrame) (Tk_Window tkwin, Tk_3DBorder border, int highlightWidth, int borderWidth, int relief); /* 152 */
8513+    void (*tkCreateThreadExitHandler) (Tcl_ExitProc *proc, ClientData clientData); /* 153 */
8514+    void (*tkDeleteThreadExitHandler) (Tcl_ExitProc *proc, ClientData clientData); /* 154 */
8515+    void (*reserved155)(void);
8516+    int (*tkpTestembedCmd) (ClientData clientData, Tcl_Interp *interp, int argc, const char **argv); /* 156 */
8517+    int (*tkpTesttextCmd) (ClientData dummy, Tcl_Interp *interp, int argc, const char **argv); /* 157 */
8518+    int (*tkSelGetSelection) (Tcl_Interp *interp, Tk_Window tkwin, Atom selection, Atom target, Tk_GetSelProc *proc, ClientData clientData); /* 158 */
8519+    int (*tkTextGetIndex) (Tcl_Interp *interp, struct TkText *textPtr, const char *string, struct TkTextIndex *indexPtr); /* 159 */
8520+    int (*tkTextIndexBackBytes) (const struct TkText *textPtr, const struct TkTextIndex *srcPtr, int count, struct TkTextIndex *dstPtr); /* 160 */
8521+    int (*tkTextIndexForwBytes) (const struct TkText *textPtr, const struct TkTextIndex *srcPtr, int count, struct TkTextIndex *dstPtr); /* 161 */
8522+    struct TkTextIndex * (*tkTextMakeByteIndex) (TkTextBTree tree, const struct TkText *textPtr, int lineIndex, int byteIndex, struct TkTextIndex *indexPtr); /* 162 */
8523+    int (*tkTextPrintIndex) (const struct TkText *textPtr, const struct TkTextIndex *indexPtr, char *string); /* 163 */
8524+    struct TkTextSegment * (*tkTextSetMark) (struct TkText *textPtr, const char *name, struct TkTextIndex *indexPtr); /* 164 */
8525+    int (*tkTextXviewCmd) (struct TkText *textPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 165 */
8526+    void (*tkTextChanged) (struct TkSharedText *sharedTextPtr, struct TkText *textPtr, const struct TkTextIndex *index1Ptr, const struct TkTextIndex *index2Ptr); /* 166 */
8527+    int (*tkBTreeNumLines) (TkTextBTree tree, const struct TkText *textPtr); /* 167 */
8528+    void (*tkTextInsertDisplayProc) (struct TkText *textPtr, struct TkTextDispChunk *chunkPtr, int x, int y, int height, int baseline, Display *display, Drawable dst, int screenY); /* 168 */
8529+    int (*tkStateParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 169 */
8530+    CONST86 char * (*tkStatePrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 170 */
8531+    int (*tkCanvasDashParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 171 */
8532+    CONST86 char * (*tkCanvasDashPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 172 */
8533+    int (*tkOffsetParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 173 */
8534+    CONST86 char * (*tkOffsetPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 174 */
8535+    int (*tkPixelParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 175 */
8536+    CONST86 char * (*tkPixelPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 176 */
8537+    int (*tkOrientParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 177 */
8538+    CONST86 char * (*tkOrientPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 178 */
8539+    int (*tkSmoothParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 179 */
8540+    CONST86 char * (*tkSmoothPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 180 */
8541+    void (*tkDrawAngledTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, double angle, int firstChar, int lastChar); /* 181 */
8542+    void (*tkUnderlineAngledTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, double angle, int underline); /* 182 */
8543+    int (*tkIntersectAngledTextLayout) (Tk_TextLayout layout, int x, int y, int width, int height, double angle); /* 183 */
8544+    void (*tkDrawAngledChars) (Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, int numBytes, double x, double y, double angle); /* 184 */
8545+} TkIntStubs;
8546+
8547+#ifdef __cplusplus
8548+extern "C" {
8549+#endif
8550+extern const TkIntStubs *tkIntStubsPtr;
8551+#ifdef __cplusplus
8552+}
8553+#endif
8554+
8555+#if defined(USE_TK_STUBS)
8556+
8557+/*
8558+ * Inline function declarations:
8559+ */
8560+
8561+#define TkAllocWindow \
8562+       (tkIntStubsPtr->tkAllocWindow) /* 0 */
8563+#define TkBezierPoints \
8564+       (tkIntStubsPtr->tkBezierPoints) /* 1 */
8565+#define TkBezierScreenPoints \
8566+       (tkIntStubsPtr->tkBezierScreenPoints) /* 2 */
8567+/* Slot 3 is reserved */
8568+#define TkBindEventProc \
8569+       (tkIntStubsPtr->tkBindEventProc) /* 4 */
8570+#define TkBindFree \
8571+       (tkIntStubsPtr->tkBindFree) /* 5 */
8572+#define TkBindInit \
8573+       (tkIntStubsPtr->tkBindInit) /* 6 */
8574+#define TkChangeEventWindow \
8575+       (tkIntStubsPtr->tkChangeEventWindow) /* 7 */
8576+#define TkClipInit \
8577+       (tkIntStubsPtr->tkClipInit) /* 8 */
8578+#define TkComputeAnchor \
8579+       (tkIntStubsPtr->tkComputeAnchor) /* 9 */
8580+/* Slot 10 is reserved */
8581+/* Slot 11 is reserved */
8582+#define TkCreateCursorFromData \
8583+       (tkIntStubsPtr->tkCreateCursorFromData) /* 12 */
8584+#define TkCreateFrame \
8585+       (tkIntStubsPtr->tkCreateFrame) /* 13 */
8586+#define TkCreateMainWindow \
8587+       (tkIntStubsPtr->tkCreateMainWindow) /* 14 */
8588+#define TkCurrentTime \
8589+       (tkIntStubsPtr->tkCurrentTime) /* 15 */
8590+#define TkDeleteAllImages \
8591+       (tkIntStubsPtr->tkDeleteAllImages) /* 16 */
8592+#define TkDoConfigureNotify \
8593+       (tkIntStubsPtr->tkDoConfigureNotify) /* 17 */
8594+#define TkDrawInsetFocusHighlight \
8595+       (tkIntStubsPtr->tkDrawInsetFocusHighlight) /* 18 */
8596+#define TkEventDeadWindow \
8597+       (tkIntStubsPtr->tkEventDeadWindow) /* 19 */
8598+#define TkFillPolygon \
8599+       (tkIntStubsPtr->tkFillPolygon) /* 20 */
8600+#define TkFindStateNum \
8601+       (tkIntStubsPtr->tkFindStateNum) /* 21 */
8602+#define TkFindStateString \
8603+       (tkIntStubsPtr->tkFindStateString) /* 22 */
8604+#define TkFocusDeadWindow \
8605+       (tkIntStubsPtr->tkFocusDeadWindow) /* 23 */
8606+#define TkFocusFilterEvent \
8607+       (tkIntStubsPtr->tkFocusFilterEvent) /* 24 */
8608+#define TkFocusKeyEvent \
8609+       (tkIntStubsPtr->tkFocusKeyEvent) /* 25 */
8610+#define TkFontPkgInit \
8611+       (tkIntStubsPtr->tkFontPkgInit) /* 26 */
8612+#define TkFontPkgFree \
8613+       (tkIntStubsPtr->tkFontPkgFree) /* 27 */
8614+#define TkFreeBindingTags \
8615+       (tkIntStubsPtr->tkFreeBindingTags) /* 28 */
8616+#define TkpFreeCursor \
8617+       (tkIntStubsPtr->tkpFreeCursor) /* 29 */
8618+#define TkGetBitmapData \
8619+       (tkIntStubsPtr->tkGetBitmapData) /* 30 */
8620+#define TkGetButtPoints \
8621+       (tkIntStubsPtr->tkGetButtPoints) /* 31 */
8622+#define TkGetCursorByName \
8623+       (tkIntStubsPtr->tkGetCursorByName) /* 32 */
8624+#define TkGetDefaultScreenName \
8625+       (tkIntStubsPtr->tkGetDefaultScreenName) /* 33 */
8626+#define TkGetDisplay \
8627+       (tkIntStubsPtr->tkGetDisplay) /* 34 */
8628+#define TkGetDisplayOf \
8629+       (tkIntStubsPtr->tkGetDisplayOf) /* 35 */
8630+#define TkGetFocusWin \
8631+       (tkIntStubsPtr->tkGetFocusWin) /* 36 */
8632+#define TkGetInterpNames \
8633+       (tkIntStubsPtr->tkGetInterpNames) /* 37 */
8634+#define TkGetMiterPoints \
8635+       (tkIntStubsPtr->tkGetMiterPoints) /* 38 */
8636+#define TkGetPointerCoords \
8637+       (tkIntStubsPtr->tkGetPointerCoords) /* 39 */
8638+#define TkGetServerInfo \
8639+       (tkIntStubsPtr->tkGetServerInfo) /* 40 */
8640+#define TkGrabDeadWindow \
8641+       (tkIntStubsPtr->tkGrabDeadWindow) /* 41 */
8642+#define TkGrabState \
8643+       (tkIntStubsPtr->tkGrabState) /* 42 */
8644+#define TkIncludePoint \
8645+       (tkIntStubsPtr->tkIncludePoint) /* 43 */
8646+#define TkInOutEvents \
8647+       (tkIntStubsPtr->tkInOutEvents) /* 44 */
8648+#define TkInstallFrameMenu \
8649+       (tkIntStubsPtr->tkInstallFrameMenu) /* 45 */
8650+#define TkKeysymToString \
8651+       (tkIntStubsPtr->tkKeysymToString) /* 46 */
8652+#define TkLineToArea \
8653+       (tkIntStubsPtr->tkLineToArea) /* 47 */
8654+#define TkLineToPoint \
8655+       (tkIntStubsPtr->tkLineToPoint) /* 48 */
8656+#define TkMakeBezierCurve \
8657+       (tkIntStubsPtr->tkMakeBezierCurve) /* 49 */
8658+#define TkMakeBezierPostscript \
8659+       (tkIntStubsPtr->tkMakeBezierPostscript) /* 50 */
8660+#define TkOptionClassChanged \
8661+       (tkIntStubsPtr->tkOptionClassChanged) /* 51 */
8662+#define TkOptionDeadWindow \
8663+       (tkIntStubsPtr->tkOptionDeadWindow) /* 52 */
8664+#define TkOvalToArea \
8665+       (tkIntStubsPtr->tkOvalToArea) /* 53 */
8666+#define TkOvalToPoint \
8667+       (tkIntStubsPtr->tkOvalToPoint) /* 54 */
8668+#define TkpChangeFocus \
8669+       (tkIntStubsPtr->tkpChangeFocus) /* 55 */
8670+#define TkpCloseDisplay \
8671+       (tkIntStubsPtr->tkpCloseDisplay) /* 56 */
8672+#define TkpClaimFocus \
8673+       (tkIntStubsPtr->tkpClaimFocus) /* 57 */
8674+#define TkpDisplayWarning \
8675+       (tkIntStubsPtr->tkpDisplayWarning) /* 58 */
8676+#define TkpGetAppName \
8677+       (tkIntStubsPtr->tkpGetAppName) /* 59 */
8678+#define TkpGetOtherWindow \
8679+       (tkIntStubsPtr->tkpGetOtherWindow) /* 60 */
8680+#define TkpGetWrapperWindow \
8681+       (tkIntStubsPtr->tkpGetWrapperWindow) /* 61 */
8682+#define TkpInit \
8683+       (tkIntStubsPtr->tkpInit) /* 62 */
8684+#define TkpInitializeMenuBindings \
8685+       (tkIntStubsPtr->tkpInitializeMenuBindings) /* 63 */
8686+#define TkpMakeContainer \
8687+       (tkIntStubsPtr->tkpMakeContainer) /* 64 */
8688+#define TkpMakeMenuWindow \
8689+       (tkIntStubsPtr->tkpMakeMenuWindow) /* 65 */
8690+#define TkpMakeWindow \
8691+       (tkIntStubsPtr->tkpMakeWindow) /* 66 */
8692+#define TkpMenuNotifyToplevelCreate \
8693+       (tkIntStubsPtr->tkpMenuNotifyToplevelCreate) /* 67 */
8694+#define TkpOpenDisplay \
8695+       (tkIntStubsPtr->tkpOpenDisplay) /* 68 */
8696+#define TkPointerEvent \
8697+       (tkIntStubsPtr->tkPointerEvent) /* 69 */
8698+#define TkPolygonToArea \
8699+       (tkIntStubsPtr->tkPolygonToArea) /* 70 */
8700+#define TkPolygonToPoint \
8701+       (tkIntStubsPtr->tkPolygonToPoint) /* 71 */
8702+#define TkPositionInTree \
8703+       (tkIntStubsPtr->tkPositionInTree) /* 72 */
8704+#define TkpRedirectKeyEvent \
8705+       (tkIntStubsPtr->tkpRedirectKeyEvent) /* 73 */
8706+#define TkpSetMainMenubar \
8707+       (tkIntStubsPtr->tkpSetMainMenubar) /* 74 */
8708+#define TkpUseWindow \
8709+       (tkIntStubsPtr->tkpUseWindow) /* 75 */
8710+/* Slot 76 is reserved */
8711+#define TkQueueEventForAllChildren \
8712+       (tkIntStubsPtr->tkQueueEventForAllChildren) /* 77 */
8713+#define TkReadBitmapFile \
8714+       (tkIntStubsPtr->tkReadBitmapFile) /* 78 */
8715+#define TkScrollWindow \
8716+       (tkIntStubsPtr->tkScrollWindow) /* 79 */
8717+#define TkSelDeadWindow \
8718+       (tkIntStubsPtr->tkSelDeadWindow) /* 80 */
8719+#define TkSelEventProc \
8720+       (tkIntStubsPtr->tkSelEventProc) /* 81 */
8721+#define TkSelInit \
8722+       (tkIntStubsPtr->tkSelInit) /* 82 */
8723+#define TkSelPropProc \
8724+       (tkIntStubsPtr->tkSelPropProc) /* 83 */
8725+/* Slot 84 is reserved */
8726+#define TkSetWindowMenuBar \
8727+       (tkIntStubsPtr->tkSetWindowMenuBar) /* 85 */
8728+#define TkStringToKeysym \
8729+       (tkIntStubsPtr->tkStringToKeysym) /* 86 */
8730+#define TkThickPolyLineToArea \
8731+       (tkIntStubsPtr->tkThickPolyLineToArea) /* 87 */
8732+#define TkWmAddToColormapWindows \
8733+       (tkIntStubsPtr->tkWmAddToColormapWindows) /* 88 */
8734+#define TkWmDeadWindow \
8735+       (tkIntStubsPtr->tkWmDeadWindow) /* 89 */
8736+#define TkWmFocusToplevel \
8737+       (tkIntStubsPtr->tkWmFocusToplevel) /* 90 */
8738+#define TkWmMapWindow \
8739+       (tkIntStubsPtr->tkWmMapWindow) /* 91 */
8740+#define TkWmNewWindow \
8741+       (tkIntStubsPtr->tkWmNewWindow) /* 92 */
8742+#define TkWmProtocolEventProc \
8743+       (tkIntStubsPtr->tkWmProtocolEventProc) /* 93 */
8744+#define TkWmRemoveFromColormapWindows \
8745+       (tkIntStubsPtr->tkWmRemoveFromColormapWindows) /* 94 */
8746+#define TkWmRestackToplevel \
8747+       (tkIntStubsPtr->tkWmRestackToplevel) /* 95 */
8748+#define TkWmSetClass \
8749+       (tkIntStubsPtr->tkWmSetClass) /* 96 */
8750+#define TkWmUnmapWindow \
8751+       (tkIntStubsPtr->tkWmUnmapWindow) /* 97 */
8752+#define TkDebugBitmap \
8753+       (tkIntStubsPtr->tkDebugBitmap) /* 98 */
8754+#define TkDebugBorder \
8755+       (tkIntStubsPtr->tkDebugBorder) /* 99 */
8756+#define TkDebugCursor \
8757+       (tkIntStubsPtr->tkDebugCursor) /* 100 */
8758+#define TkDebugColor \
8759+       (tkIntStubsPtr->tkDebugColor) /* 101 */
8760+#define TkDebugConfig \
8761+       (tkIntStubsPtr->tkDebugConfig) /* 102 */
8762+#define TkDebugFont \
8763+       (tkIntStubsPtr->tkDebugFont) /* 103 */
8764+#define TkFindStateNumObj \
8765+       (tkIntStubsPtr->tkFindStateNumObj) /* 104 */
8766+#define TkGetBitmapPredefTable \
8767+       (tkIntStubsPtr->tkGetBitmapPredefTable) /* 105 */
8768+#define TkGetDisplayList \
8769+       (tkIntStubsPtr->tkGetDisplayList) /* 106 */
8770+#define TkGetMainInfoList \
8771+       (tkIntStubsPtr->tkGetMainInfoList) /* 107 */
8772+#define TkGetWindowFromObj \
8773+       (tkIntStubsPtr->tkGetWindowFromObj) /* 108 */
8774+#define TkpGetString \
8775+       (tkIntStubsPtr->tkpGetString) /* 109 */
8776+#define TkpGetSubFonts \
8777+       (tkIntStubsPtr->tkpGetSubFonts) /* 110 */
8778+#define TkpGetSystemDefault \
8779+       (tkIntStubsPtr->tkpGetSystemDefault) /* 111 */
8780+#define TkpMenuThreadInit \
8781+       (tkIntStubsPtr->tkpMenuThreadInit) /* 112 */
8782+#define TkClipBox \
8783+       (tkIntStubsPtr->tkClipBox) /* 113 */
8784+#define TkCreateRegion \
8785+       (tkIntStubsPtr->tkCreateRegion) /* 114 */
8786+#define TkDestroyRegion \
8787+       (tkIntStubsPtr->tkDestroyRegion) /* 115 */
8788+#define TkIntersectRegion \
8789+       (tkIntStubsPtr->tkIntersectRegion) /* 116 */
8790+#define TkRectInRegion \
8791+       (tkIntStubsPtr->tkRectInRegion) /* 117 */
8792+#define TkSetRegion \
8793+       (tkIntStubsPtr->tkSetRegion) /* 118 */
8794+#define TkUnionRectWithRegion \
8795+       (tkIntStubsPtr->tkUnionRectWithRegion) /* 119 */
8796+/* Slot 120 is reserved */
8797+#ifdef MAC_OSX_TK /* AQUA */
8798+#define TkpCreateNativeBitmap \
8799+       (tkIntStubsPtr->tkpCreateNativeBitmap) /* 121 */
8800+#endif /* AQUA */
8801+#ifdef MAC_OSX_TK /* AQUA */
8802+#define TkpDefineNativeBitmaps \
8803+       (tkIntStubsPtr->tkpDefineNativeBitmaps) /* 122 */
8804+#endif /* AQUA */
8805+/* Slot 123 is reserved */
8806+#ifdef MAC_OSX_TK /* AQUA */
8807+#define TkpGetNativeAppBitmap \
8808+       (tkIntStubsPtr->tkpGetNativeAppBitmap) /* 124 */
8809+#endif /* AQUA */
8810+/* Slot 125 is reserved */
8811+/* Slot 126 is reserved */
8812+/* Slot 127 is reserved */
8813+/* Slot 128 is reserved */
8814+/* Slot 129 is reserved */
8815+/* Slot 130 is reserved */
8816+/* Slot 131 is reserved */
8817+/* Slot 132 is reserved */
8818+/* Slot 133 is reserved */
8819+/* Slot 134 is reserved */
8820+#define TkpDrawHighlightBorder \
8821+       (tkIntStubsPtr->tkpDrawHighlightBorder) /* 135 */
8822+#define TkSetFocusWin \
8823+       (tkIntStubsPtr->tkSetFocusWin) /* 136 */
8824+#define TkpSetKeycodeAndState \
8825+       (tkIntStubsPtr->tkpSetKeycodeAndState) /* 137 */
8826+#define TkpGetKeySym \
8827+       (tkIntStubsPtr->tkpGetKeySym) /* 138 */
8828+#define TkpInitKeymapInfo \
8829+       (tkIntStubsPtr->tkpInitKeymapInfo) /* 139 */
8830+#define TkPhotoGetValidRegion \
8831+       (tkIntStubsPtr->tkPhotoGetValidRegion) /* 140 */
8832+#define TkWmStackorderToplevel \
8833+       (tkIntStubsPtr->tkWmStackorderToplevel) /* 141 */
8834+#define TkFocusFree \
8835+       (tkIntStubsPtr->tkFocusFree) /* 142 */
8836+#define TkClipCleanup \
8837+       (tkIntStubsPtr->tkClipCleanup) /* 143 */
8838+#define TkGCCleanup \
8839+       (tkIntStubsPtr->tkGCCleanup) /* 144 */
8840+#define TkSubtractRegion \
8841+       (tkIntStubsPtr->tkSubtractRegion) /* 145 */
8842+#define TkStylePkgInit \
8843+       (tkIntStubsPtr->tkStylePkgInit) /* 146 */
8844+#define TkStylePkgFree \
8845+       (tkIntStubsPtr->tkStylePkgFree) /* 147 */
8846+#define TkToplevelWindowForCommand \
8847+       (tkIntStubsPtr->tkToplevelWindowForCommand) /* 148 */
8848+#define TkGetOptionSpec \
8849+       (tkIntStubsPtr->tkGetOptionSpec) /* 149 */
8850+#define TkMakeRawCurve \
8851+       (tkIntStubsPtr->tkMakeRawCurve) /* 150 */
8852+#define TkMakeRawCurvePostscript \
8853+       (tkIntStubsPtr->tkMakeRawCurvePostscript) /* 151 */
8854+#define TkpDrawFrame \
8855+       (tkIntStubsPtr->tkpDrawFrame) /* 152 */
8856+#define TkCreateThreadExitHandler \
8857+       (tkIntStubsPtr->tkCreateThreadExitHandler) /* 153 */
8858+#define TkDeleteThreadExitHandler \
8859+       (tkIntStubsPtr->tkDeleteThreadExitHandler) /* 154 */
8860+/* Slot 155 is reserved */
8861+#define TkpTestembedCmd \
8862+       (tkIntStubsPtr->tkpTestembedCmd) /* 156 */
8863+#define TkpTesttextCmd \
8864+       (tkIntStubsPtr->tkpTesttextCmd) /* 157 */
8865+#define TkSelGetSelection \
8866+       (tkIntStubsPtr->tkSelGetSelection) /* 158 */
8867+#define TkTextGetIndex \
8868+       (tkIntStubsPtr->tkTextGetIndex) /* 159 */
8869+#define TkTextIndexBackBytes \
8870+       (tkIntStubsPtr->tkTextIndexBackBytes) /* 160 */
8871+#define TkTextIndexForwBytes \
8872+       (tkIntStubsPtr->tkTextIndexForwBytes) /* 161 */
8873+#define TkTextMakeByteIndex \
8874+       (tkIntStubsPtr->tkTextMakeByteIndex) /* 162 */
8875+#define TkTextPrintIndex \
8876+       (tkIntStubsPtr->tkTextPrintIndex) /* 163 */
8877+#define TkTextSetMark \
8878+       (tkIntStubsPtr->tkTextSetMark) /* 164 */
8879+#define TkTextXviewCmd \
8880+       (tkIntStubsPtr->tkTextXviewCmd) /* 165 */
8881+#define TkTextChanged \
8882+       (tkIntStubsPtr->tkTextChanged) /* 166 */
8883+#define TkBTreeNumLines \
8884+       (tkIntStubsPtr->tkBTreeNumLines) /* 167 */
8885+#define TkTextInsertDisplayProc \
8886+       (tkIntStubsPtr->tkTextInsertDisplayProc) /* 168 */
8887+#define TkStateParseProc \
8888+       (tkIntStubsPtr->tkStateParseProc) /* 169 */
8889+#define TkStatePrintProc \
8890+       (tkIntStubsPtr->tkStatePrintProc) /* 170 */
8891+#define TkCanvasDashParseProc \
8892+       (tkIntStubsPtr->tkCanvasDashParseProc) /* 171 */
8893+#define TkCanvasDashPrintProc \
8894+       (tkIntStubsPtr->tkCanvasDashPrintProc) /* 172 */
8895+#define TkOffsetParseProc \
8896+       (tkIntStubsPtr->tkOffsetParseProc) /* 173 */
8897+#define TkOffsetPrintProc \
8898+       (tkIntStubsPtr->tkOffsetPrintProc) /* 174 */
8899+#define TkPixelParseProc \
8900+       (tkIntStubsPtr->tkPixelParseProc) /* 175 */
8901+#define TkPixelPrintProc \
8902+       (tkIntStubsPtr->tkPixelPrintProc) /* 176 */
8903+#define TkOrientParseProc \
8904+       (tkIntStubsPtr->tkOrientParseProc) /* 177 */
8905+#define TkOrientPrintProc \
8906+       (tkIntStubsPtr->tkOrientPrintProc) /* 178 */
8907+#define TkSmoothParseProc \
8908+       (tkIntStubsPtr->tkSmoothParseProc) /* 179 */
8909+#define TkSmoothPrintProc \
8910+       (tkIntStubsPtr->tkSmoothPrintProc) /* 180 */
8911+#define TkDrawAngledTextLayout \
8912+       (tkIntStubsPtr->tkDrawAngledTextLayout) /* 181 */
8913+#define TkUnderlineAngledTextLayout \
8914+       (tkIntStubsPtr->tkUnderlineAngledTextLayout) /* 182 */
8915+#define TkIntersectAngledTextLayout \
8916+       (tkIntStubsPtr->tkIntersectAngledTextLayout) /* 183 */
8917+#define TkDrawAngledChars \
8918+       (tkIntStubsPtr->tkDrawAngledChars) /* 184 */
8919+
8920+#endif /* defined(USE_TK_STUBS) */
8921+
8922+/* !END!: Do not edit above this line. */
8923+
8924+#undef TCL_STORAGE_CLASS
8925+#define TCL_STORAGE_CLASS DLLIMPORT
8926+
8927+/*
8928+ * On X11, these macros are just wrappers for the equivalent X Region calls.
8929+ */
8930+#if !(defined(__WIN32__) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) /* X11 */
8931+
8932+#undef TkClipBox
8933+#undef TkCreateRegion
8934+#undef TkDestroyRegion
8935+#undef TkIntersectRegion
8936+#undef TkRectInRegion
8937+#undef TkSetRegion
8938+#undef TkSubtractRegion
8939+#undef TkUnionRectWithRegion
8940+
8941+#define TkClipBox(rgn, rect) XClipBox((Region) rgn, rect)
8942+#define TkCreateRegion() (TkRegion) XCreateRegion()
8943+#define TkDestroyRegion(rgn) XDestroyRegion((Region) rgn)
8944+#define TkIntersectRegion(a, b, r) XIntersectRegion((Region) a, \
8945+       (Region) b, (Region) r)
8946+#define TkRectInRegion(r, x, y, w, h) XRectInRegion((Region) r, x, y, w, h)
8947+#define TkSetRegion(d, gc, rgn) XSetRegion(d, gc, (Region) rgn)
8948+#define TkSubtractRegion(a, b, r) XSubtractRegion((Region) a, \
8949+       (Region) b, (Region) r)
8950+#define TkUnionRectWithRegion(rect, src, ret) XUnionRectWithRegion(rect, \
8951+       (Region) src, (Region) ret)
8952+
8953+#endif /* UNIX */
8954+
8955+#endif /* _TKINTDECLS */
8956+
8957--- src/tkPort.h        1969-12-31 19:00:00.000000000 -0500
8958+++ src/tkPort.h        2013-08-20 11:44:47.000000000 -0400
8959@@ -0,0 +1,31 @@
8960+/*
8961+ * tkPort.h --
8962+ *
8963+ *     This header file handles porting issues that occur because of
8964+ *     differences between systems.  It reads in platform specific
8965+ *     portability files.
8966+ *
8967+ * Copyright (c) 1995 Sun Microsystems, Inc.
8968+ *
8969+ * See the file "license.terms" for information on usage and redistribution
8970+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
8971+ */
8972+
8973+#ifndef _TKPORT
8974+#define _TKPORT
8975+
8976+#if defined(_WIN32)
8977+#   include "tkWinPort.h"
8978+#endif
8979+#ifndef _TK
8980+#   include "tk.h"
8981+#endif
8982+#if !defined(_WIN32)
8983+#   if defined(MAC_OSX_TK)
8984+#      include "tkMacOSXPort.h"
8985+#   else
8986+#      include "tkUnixPort.h"
8987+#   endif
8988+#endif
8989+
8990+#endif /* _TKPORT */
8991--- src/tkUnixPort.h    1969-12-31 19:00:00.000000000 -0500
8992+++ src/tkUnixPort.h    2013-08-20 11:45:15.000000000 -0400
8993@@ -0,0 +1,198 @@
8994+/*
8995+ * tkUnixPort.h --
8996+ *
8997+ *     This file is included by all of the Tk C files.  It contains
8998+ *     information that may be configuration-dependent, such as
8999+ *     #includes for system include files and a few other things.
9000+ *
9001+ * Copyright (c) 1991-1993 The Regents of the University of California.
9002+ * Copyright (c) 1994-1996 Sun Microsystems, Inc.
9003+ *
9004+ * See the file "license.terms" for information on usage and redistribution
9005+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
9006+ */
9007+
9008+#ifndef _UNIXPORT
9009+#define _UNIXPORT
9010+
9011+#define __UNIX__ 1
9012+
9013+#include <stdio.h>
9014+#include <ctype.h>
9015+#include <fcntl.h>
9016+#ifndef NO_LIMITS_H
9017+#   include <limits.h>
9018+#else
9019+#   include "../compat/limits.h"
9020+#endif
9021+#include <math.h>
9022+#include <pwd.h>
9023+#ifdef NO_STDLIB_H
9024+#   include "../compat/stdlib.h"
9025+#else
9026+#   include <stdlib.h>
9027+#endif
9028+#include <string.h>
9029+#include <sys/types.h>
9030+#include <sys/file.h>
9031+#ifdef HAVE_SYS_SELECT_H
9032+#   include <sys/select.h>
9033+#endif
9034+#include <sys/stat.h>
9035+#ifndef _TCL
9036+#   include <tcl.h>
9037+#endif
9038+#if TIME_WITH_SYS_TIME
9039+#   include <sys/time.h>
9040+#   include <time.h>
9041+#else
9042+#   if HAVE_SYS_TIME_H
9043+#       include <sys/time.h>
9044+#   else
9045+#       include <time.h>
9046+#   endif
9047+#endif
9048+#if HAVE_INTTYPES_H
9049+#    include <inttypes.h>
9050+#endif
9051+#ifndef NO_UNISTD_H
9052+#   include <unistd.h>
9053+#else
9054+#   include "../compat/unistd.h"
9055+#endif
9056+#include <X11/Xlib.h>
9057+#include <X11/cursorfont.h>
9058+#include <X11/keysym.h>
9059+#include <X11/Xatom.h>
9060+#include <X11/Xproto.h>
9061+#include <X11/Xresource.h>
9062+#include <X11/Xutil.h>
9063+
9064+/*
9065+ * The following macro defines the type of the mask arguments to
9066+ * select:
9067+ */
9068+
9069+#ifndef NO_FD_SET
9070+#   define SELECT_MASK fd_set
9071+#else
9072+#   ifndef _AIX
9073+       typedef long fd_mask;
9074+#   endif
9075+#   if defined(_IBMR2)
9076+#      define SELECT_MASK void
9077+#   else
9078+#      define SELECT_MASK int
9079+#   endif
9080+#endif
9081+
9082+/*
9083+ * The following macro defines the number of fd_masks in an fd_set:
9084+ */
9085+
9086+#ifndef FD_SETSIZE
9087+#   ifdef OPEN_MAX
9088+#      define FD_SETSIZE OPEN_MAX
9089+#   else
9090+#      define FD_SETSIZE 256
9091+#   endif
9092+#endif
9093+#if !defined(howmany)
9094+#   define howmany(x, y) (((x)+((y)-1))/(y))
9095+#endif
9096+#ifndef NFDBITS
9097+#   define NFDBITS NBBY*sizeof(fd_mask)
9098+#endif
9099+#define MASK_SIZE howmany(FD_SETSIZE, NFDBITS)
9100+
9101+/*
9102+ * Define "NBBY" (number of bits per byte) if it's not already defined.
9103+ */
9104+
9105+#ifndef NBBY
9106+#   define NBBY 8
9107+#endif
9108+
9109+#ifdef __CYGWIN__
9110+#   define UINT unsigned int
9111+#   define HWND void *
9112+#   define HDC void *
9113+#   define HINSTANCE void *
9114+#   define COLORREF void *
9115+#   define HMENU void *
9116+#   define TkWinDCState void
9117+#   define HPALETTE void *
9118+#   define WNDPROC void *
9119+#   define WPARAM void *
9120+#   define LPARAM void *
9121+#   define LRESULT void *
9122+
9123+EXTERN int TkPutImage (unsigned long *, int, Display *, Drawable, GC,
9124+       XImage *, int, int, int, int, unsigned int, unsigned int);
9125+
9126+#else /* !__CYGWIN__ */
9127+    /*
9128+     * The TkPutImage macro strips off the color table information, which isn't
9129+     * needed for X.
9130+     */
9131+
9132+#   define TkPutImage(colors, ncolors, display, pixels, gc, image, srcx, srcy, destx, desty, width, height) \
9133+               XPutImage(display, pixels, gc, image, srcx, srcy, destx, \
9134+               desty, width, height);
9135+
9136+#endif /* !__CYGWIN__ */
9137+
9138+/*
9139+ * Supply macros for seek offsets, if they're not already provided by
9140+ * an include file.
9141+ */
9142+
9143+#ifndef SEEK_SET
9144+#   define SEEK_SET 0
9145+#endif
9146+
9147+#ifndef SEEK_CUR
9148+#   define SEEK_CUR 1
9149+#endif
9150+
9151+#ifndef SEEK_END
9152+#   define SEEK_END 2
9153+#endif
9154+
9155+/*
9156+ * Declarations for various library procedures that may not be declared
9157+ * in any other header file.
9158+ */
9159+
9160+
9161+/*
9162+ * These functions do nothing under Unix, so we just eliminate calls to them.
9163+ */
9164+
9165+#define TkpButtonSetDefaults() {}
9166+#define TkpDestroyButton(butPtr) {}
9167+#define TkSelUpdateClipboard(a,b) {}
9168+#ifndef __CYGWIN__
9169+#define TkSetPixmapColormap(p,c) {}
9170+#endif
9171+
9172+/*
9173+ * These calls implement native bitmaps which are not supported under
9174+ * UNIX.  The macros eliminate the calls.
9175+ */
9176+
9177+#define TkpDefineNativeBitmaps()
9178+#define TkpCreateNativeBitmap(display, source) None
9179+#define TkpGetNativeAppBitmap(display, name, w, h) None
9180+
9181+/*
9182+ * This macro stores a representation of the window handle in a string.
9183+ * This should perhaps use the real size of an XID.
9184+ */
9185+
9186+#ifndef __CYGWIN__
9187+#define TkpPrintWindowId(buf,w) \
9188+       sprintf((buf), "%#08lx", (unsigned long) (w))
9189+#endif
9190+
9191+#endif /* _UNIXPORT */
9192--- src/tkFrame.c.orig  2013-08-20 18:19:40.000000000 -0400
9193+++ src/tkFrame.c       2013-08-20 18:19:59.000000000 -0400
9194@@ -236,8 +236,6 @@
9195        ClientData instanceData));
9196 #endif /* TK_MAJOR_VERSION == 8 && TK_MINOR_VERSION > 3 */
9197 
9198-EXTERN void TkpSetMainMenubar _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin,
9199-       char * menuName));
9200 EXTERN void TkpMakeContainer _ANSI_ARGS_((Tk_Window tkwin));
9201 
9202