--------------------------------------------------------------------
--
-- tcl.ads -- This package is the "thin" binding to Tcl.
--
-- Copyright (c) 1987-1994 The Regents of the University of California.
-- Copyright (c) 1994-1996 Sun Microsystems, Inc.
-- Copyright (c) 1995-1996 Terry J. Westley
--
-- See the file "license.htm" for information on usage and
-- redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
--
-- This package is automatically generated from tcl.h.  Note that some
-- of the comments below, preserved from tcl.h, do not apply to the
-- Ada version.  Someday, these comments may be customized better.
--
--------------------------------------------------------------------

with CArgv;
with CHelper;
with Interfaces.C.Strings;
with System;

package Tcl is

   package C renames Interfaces.C;

   function "-" (Left, Right : in C.size_t) return C.size_t renames C."-";

   -- 
   --  tcl.h --
   -- 
   -- 	This header file describes the externally-visible facilities
   -- 	of the Tcl interpreter.
   -- 
   --  Copyright {c} 1987-1994 The Regents of the University of California.
   --  Copyright {c} 1994-1996 Sun Microsystems, Inc.
   -- 
   --  See the file "license.terms" for information on usage and redistribution
   --  of this file, and for a DISCLAIMER OF ALL WARRANTIES.
   -- 
   --  SCCS: @{#} tcl.h 1.283 96/10/02 17:17:39
   -- 

   -- 
   --  When version numbers change here, must also go into the following files
   --  and update the version numbers:
   -- 
   --  library/init.tcl
   --  unix/configure.in
   --  unix/Makefile.in
   --  unix/pkginfo
   --  win/makefile.bc
   --  win/makefile.vc
   -- 
   --  The release level should be  0 for alpha, 1 for beta, and 2 for
   --  final/patch.  The release serial value is the number that follows the
   --  "a", "b", or "p" in the patch level; for example, if the patch level
   --  is 7.6b2, TCL_RELEASE_SERIAL is 2.  It restarts at 1 whenever the
   --  release level is changed, except for the final release which is 0
   --  {the first patch will start at 1}.
   -- 

   TCL_MAJOR_VERSION    : constant := 7;
   TCL_MINOR_VERSION    : constant := 6;
   TCL_RELEASE_LEVEL    : constant := 2;
   TCL_RELEASE_SERIAL   : constant := 0;
   TCL_VERSION          : constant := 7.6;
   TCL_PATCH_LEVEL      : constant := 7.6;
   -- 
   --  The following definitions set up the proper options for Windows
   --  compilers.  We use this method because there is no autoconf equivalent.
   -- 

   -- 
   --  The following definitions set up the proper options for Macintosh
   --  compilers.  We use this method because there is no autoconf equivalent.
   -- 

   -- 
   --  A special definition used to allow this header file to be included 
   --  in resource files so that they can get obtain version information from
   --  this file.  Resource compilers don't like all the C stuff, like typedefs
   --  and procedure declarations, that occur below.
   -- 

   -- 
   --  Definitions that allow Tcl functions with variable numbers of
   --  arguments to be used with either varargs.h or stdarg.h.  TCL_VARARGS
   --  is used in procedure prototypes.  TCL_VARARGS_DEF is used to declare
   --  the arguments in a function definiton: it takes the type and name of
   --  the first argument and supplies the appropriate argument declaration
   --  string for use in the function definition.  TCL_VARARGS_START
   --  initializes the va_list data structure and returns the first argument.
   -- 

   -- 
   --  Definitions that allow this header file to be used either with or
   --  without ANSI C features like function prototypes.
   -- 

   -- 
   --  Macro to use instead of "void" for arguments that must have
   --  type "void *" in ANSI C;  maps them to type "char *" in
   --  non-ANSI systems.
   -- 

   -- 
   --  Miscellaneous declarations.
   -- 

   subtype ClientData is C.Int;

   -- 
   --  Data structures defined opaquely in this module.  The definitions
   --  below just provide dummy types.  A few fields are made visible in
   --  Tcl_Interp structures, namely those for returning string values.
   --  Note:  any change to the Tcl_Interp definition below must be mirrored
   --  in the "real" definition in tclInt.h.
   -- 

   type Tcl_Interp is private;

   function Is_Null (Ptr : Tcl_Interp) return Boolean;

   type Tcl_AsyncHandler is private;

   function Is_Null (Ptr : Tcl_AsyncHandler) return Boolean;

   type Tcl_Command is private;

   function Is_Null (Ptr : Tcl_Command) return Boolean;

   type Tcl_Event is private;

   function Is_Null (Ptr : Tcl_Event) return Boolean;

   type Tcl_File is private;

   function Is_Null (Ptr : Tcl_File) return Boolean;

   type Tcl_Channel is private;

   function Is_Null (Ptr : Tcl_Channel) return Boolean;

   type Tcl_RegExp is private;

   function Is_Null (Ptr : Tcl_RegExp) return Boolean;

   type Tcl_TimerToken is private;

   function Is_Null (Ptr : Tcl_TimerToken) return Boolean;

   type Tcl_Trace is private;

   function Is_Null (Ptr : Tcl_Trace) return Boolean;

   -- 
   --  When a TCL command returns, the string pointer interp->result points to
   --  a string containing return information from the command.  In addition,
   --  the command procedure returns an integer value, which is one of the
   --  following:
   -- 
   --  TCL_OK		Command completed normally;  interp->result contains
   -- 			the command's result.
   --  TCL_ERROR		The command couldn't be completed successfully;
   -- 			interp->result describes what went wrong.
   --  TCL_RETURN		The command requests that the current procedure
   -- 			return;  interp->result contains the procedure's
   -- 			return value.
   --  TCL_BREAK		The command requests that the innermost loop
   -- 			be exited;  interp->result is meaningless.
   --  TCL_CONTINUE		Go on to the next iteration of the current loop;
   -- 			interp->result is meaningless.
   -- 

   TCL_OK               : constant := 0;
   TCL_ERROR            : constant := 1;
   TCL_RETURN           : constant := 2;
   TCL_BREAK            : constant := 3;
   TCL_CONTINUE         : constant := 4;
   TCL_RESULT_SIZE      : constant := 200;
   -- 
   --  Argument descriptors for math function callbacks in expressions:
   -- 

   type Tcl_ValueType is (
      TCL_INT,
      TCL_DOUBLE,
      TCL_EITHER
   );
   for Tcl_ValueType'size use 32;

   type Tcl_Value_rec is private;
   type Tcl_Value is access all Tcl_Value_rec;
   pragma Convention (C, Tcl_Value);

   type Tcl_Value_array is array (C.size_t range <>) of Tcl_Value;

   function Is_Null (Ptr : Tcl_Value) return Boolean;

   -- 
   --  Procedure types defined by Tcl:
   -- 

   type Tcl_AppInitProc is access function (
      interp          : Tcl_Interp
   ) return C.Int;
   pragma Convention (C, Tcl_AppInitProc);

   type Tcl_AsyncProc is access function (
      data            : ClientData;
      interp          : Tcl_Interp;
      code            : C.Int
   ) return C.Int;
   pragma Convention (C, Tcl_AsyncProc);

   type Tcl_ChannelProc is access procedure (
      data            : ClientData;
      mask            : C.Int
   );
   pragma Convention (C, Tcl_ChannelProc);

   type Tcl_CloseProc is access procedure (
      data            : ClientData
   );
   pragma Convention (C, Tcl_CloseProc);

   type Tcl_CmdDeleteProc is access procedure (
      data            : ClientData
   );
   pragma Convention (C, Tcl_CmdDeleteProc);

   type Tcl_CmdProc is access function (
      data            : ClientData;
      interp          : Tcl_Interp;
      argc            : C.Int;
      argv            : CArgv.Chars_Ptr_Ptr
   ) return C.Int;
   pragma Convention (C, Tcl_CmdProc);

   type Tcl_CmdTraceProc is access procedure (
      data            : ClientData;
      interp          : Tcl_Interp;
      level           : C.Int;
      command         : C.Strings.Chars_Ptr;
      proc            : Tcl_CmdProc;
      cmdclientdata   : ClientData;
      argc            : C.Int;
      argv            : CArgv.Chars_Ptr_Ptr
   );
   pragma Convention (C, Tcl_CmdTraceProc);

   type Tcl_EventProc is access function (
      evPtr           : Tcl_Event;
      flags           : C.Int
   ) return C.Int;
   pragma Convention (C, Tcl_EventProc);

   type Tcl_EventCheckProc is access procedure (
      data            : ClientData;
      flags           : C.Int
   );
   pragma Convention (C, Tcl_EventCheckProc);

   type Tcl_EventDeleteProc is access function (
      evPtr           : Tcl_Event;
      data            : ClientData
   ) return C.Int;
   pragma Convention (C, Tcl_EventDeleteProc);

   type Tcl_EventSetupProc is access procedure (
      data            : ClientData;
      flags           : C.Int
   );
   pragma Convention (C, Tcl_EventSetupProc);

   type Tcl_ExitProc is access procedure (
      data            : ClientData
   );
   pragma Convention (C, Tcl_ExitProc);

   type Tcl_FileProc is access procedure (
      data            : ClientData;
      mask            : C.Int
   );
   pragma Convention (C, Tcl_FileProc);

   type Tcl_FileFreeProc is access procedure (
      data            : ClientData
   );
   pragma Convention (C, Tcl_FileFreeProc);

   type Tcl_FreeProc is access procedure (
      blockPtr        : C.Strings.Chars_Ptr
   );
   pragma Convention (C, Tcl_FreeProc);

   type Tcl_IdleProc is access procedure (
      data            : ClientData
   );
   pragma Convention (C, Tcl_IdleProc);

   type Tcl_InterpDeleteProc is access procedure (
      data            : ClientData;
      interp          : Tcl_Interp
   );
   pragma Convention (C, Tcl_InterpDeleteProc);

   type Tcl_MathProc is access function (
      data            : ClientData;
      interp          : Tcl_Interp;
      args            : Tcl_Value;
      resultPtr       : Tcl_Value
   ) return C.Int;
   pragma Convention (C, Tcl_MathProc);

   type Tcl_PackageInitProc is access function (
      interp          : Tcl_Interp
   ) return C.Int;
   pragma Convention (C, Tcl_PackageInitProc);

   type Tcl_TcpAcceptProc is access procedure (
      callbackdata    : ClientData;
      chan            : Tcl_Channel;
      address         : C.Strings.Chars_Ptr;
      port            : C.Int
   );
   pragma Convention (C, Tcl_TcpAcceptProc);

   type Tcl_TimerProc is access procedure (
      data            : ClientData
   );
   pragma Convention (C, Tcl_TimerProc);

   type Tcl_VarTraceProc is access function (
      data            : ClientData;
      interp          : Tcl_Interp;
      part1           : C.Strings.Chars_Ptr;
      part2           : C.Strings.Chars_Ptr;
      flags           : C.Int
   ) return C.Strings.Chars_Ptr;
   pragma Convention (C, Tcl_VarTraceProc);

   -- 
   --  The structure returned by Tcl_GetCmdInfo and passed into
   --  Tcl_SetCmdInfo:
   -- 

   type Tcl_CmdInfo_rec is private;
   type Tcl_CmdInfo is access all Tcl_CmdInfo_rec;
   pragma Convention (C, Tcl_CmdInfo);

   type Tcl_CmdInfo_array is array (C.size_t range <>) of Tcl_CmdInfo;

   function Is_Null (Ptr : Tcl_CmdInfo) return Boolean;

   -- 
   --  The structure defined below is used to hold dynamic strings.  The only
   --  field that clients should use is the string field, and they should
   --  never modify it.
   -- 

   TCL_DSTRING_STATIC_SIZE : constant := 200;
   type Tcl_DString_rec is private;
   type Tcl_DString is access all Tcl_DString_rec;
   pragma Convention (C, Tcl_DString);

   type Tcl_DString_array is array (C.size_t range <>) of Tcl_DString;

   function Is_Null (Ptr : Tcl_DString) return Boolean;

   function Tcl_DStringLength (
      dsPtr           : Tcl_DString
   ) return C.Int;
   pragma Import (C, Tcl_DStringLength, "Tcl_CallDStringLength");

   function Tcl_DStringValue (
      dsPtr           : Tcl_DString
   ) return C.Strings.Chars_Ptr;
   pragma Import (C, Tcl_DStringValue, "Tcl_CallDStringValue");

   procedure Tcl_DStringSetLength (
      dsPtr           : Tcl_DString;
      length          : C.Int
   );
   pragma Import (C, Tcl_DStringSetLength, "Tcl_DStringSetLength");

   procedure Tcl_DStringTrunc (
      dsPtr           : Tcl_DString;
      length          : C.Int
   ) renames Tcl_DStringSetLength;

   -- 
   --  Definitions for the maximum number of digits of precision that may
   --  be specified in the "tcl_precision" variable, and the number of
   --  characters of buffer space required by Tcl_PrintDouble.
   -- 

   TCL_MAX_PREC         : constant := 17;
   TCL_DOUBLE_SPACE     : constant := TCL_MAX_PREC+10;
   -- 
   --  Flag that may be passed to Tcl_ConvertElement to force it not to
   --  output braces {careful!  if you change this flag be sure to change
   --  the definitions at the front of tclUtil.c}.
   -- 

   TCL_DONT_USE_BRACES  : constant := 1;
   -- 
   --  Flag values passed to Tcl_RecordAndEval.
   --  WARNING: these bit choices must not conflict with the bit choices
   --  for evalFlag bits in tclInt.h!!
   -- 

   TCL_NO_EVAL          : constant := 65536;
   TCL_EVAL_GLOBAL      : constant := 131072;
   -- 
   --  Special freeProc values that may be passed to Tcl_SetResult {see
   --  the man page for details}:
   -- 

   TCL_VOLATILE         : constant := 1;
   TCL_STATIC           : constant := 0;
   TCL_DYNAMIC          : constant := 3;
   -- 
   --  Flag values passed to variable-related procedures.
   -- 

   TCL_GLOBAL_ONLY      : constant := 1;
   TCL_APPEND_VALUE     : constant := 2;
   TCL_LIST_ELEMENT     : constant := 4;
   TCL_TRACE_READS      : constant := 16;
   TCL_TRACE_WRITES     : constant := 32;
   TCL_TRACE_UNSETS     : constant := 64;
   TCL_TRACE_DESTROYED  : constant := 128;
   TCL_INTERP_DESTROYED : constant := 256;
   TCL_LEAVE_ERR_MSG    : constant := 512;
   -- 
   --  Types for linked variables:
   -- 

   TCL_LINK_INT         : constant := 1;
   TCL_LINK_DOUBLE      : constant := 2;
   TCL_LINK_BOOLEAN     : constant := 3;
   TCL_LINK_STRING      : constant := 4;
   TCL_LINK_READ_ONLY   : constant := 128;
   -- 
   --  The following declarations either map ckalloc and ckfree to
   --  malloc and free, or they map them to procedures with all sorts
   --  of debugging hooks defined in tclCkalloc.c.
   -- 

   function Tcl_Alloc (
      size            : C.Unsigned
   ) return C.Strings.Chars_Ptr;
   pragma Import (C, Tcl_Alloc, "Tcl_Alloc");

   procedure Tcl_Free (
      ptr             : C.Strings.Chars_Ptr
   );
   pragma Import (C, Tcl_Free, "Tcl_Free");

   function Tcl_Realloc (
      ptr             : C.Strings.Chars_Ptr;
      size            : C.Unsigned
   ) return C.Strings.Chars_Ptr;
   pragma Import (C, Tcl_Realloc, "Tcl_Realloc");

   -- 
   --  Macro to free result of interpreter.
   -- 

   procedure Tcl_FreeResult (
      interp          : Tcl_interp
   );
   pragma Import (C, Tcl_FreeResult, "Tcl_CallFreeResult");

   -- 
   --  Forward declaration of Tcl_HashTable.  Needed by some C++ compilers
   --  to prevent errors when the forward reference to Tcl_HashTable is
   --  encountered in the Tcl_HashEntry structure.
   -- 

   -- 
   --  Structure definition for an entry in a hash table.  No-one outside
   --  Tcl should access any of these fields directly;  use the macros
   --  defined below.
   -- 

   type Tcl_HashEntry is private;

   function Is_Null (Ptr : Tcl_HashEntry) return Boolean;

   -- 
   --  Structure definition for a hash table.  Must be in tcl.h so clients
   --  can allocate space for these structures, but clients should never
   --  access any fields in this structure.
   -- 

   TCL_SMALL_HASH_TABLE : constant := 4;
   type Tcl_HashTable_rec is private;
   type Tcl_HashTable is access all Tcl_HashTable_rec;
   pragma Convention (C, Tcl_HashTable);

   type Tcl_HashTable_array is array (C.size_t range <>) of Tcl_HashTable;

   function Is_Null (Ptr : Tcl_HashTable) return Boolean;

   -- 
   --  Structure definition for information used to keep track of searches
   --  through hash tables:
   -- 

   type Tcl_HashSearch_rec is private;
   type Tcl_HashSearch is access all Tcl_HashSearch_rec;
   pragma Convention (C, Tcl_HashSearch);

   type Tcl_HashSearch_array is array (C.size_t range <>) of Tcl_HashSearch;

   function Is_Null (Ptr : Tcl_HashSearch) return Boolean;

   -- 
   --  Acceptable key types for hash tables:
   -- 

   TCL_STRING_KEYS      : constant := 0;
   TCL_ONE_WORD_KEYS    : constant := 1;
   -- 
   --  Macros for clients to use to access fields of hash entries:
   -- 

   function Tcl_GetHashValue (
      HashEntry       : Tcl_HashEntry
   ) return ClientData;
   pragma Import (C, Tcl_GetHashValue, "Tcl_CallGetHashValue");

   procedure Tcl_SetHashValue (
      HashEntry       : Tcl_HashEntry;
      value           : ClientData
   );
   pragma Import (C, Tcl_SetHashValue, "Tcl_CallSetHashValue");

   function Tcl_GetHashKey (
      HashTable       : Tcl_HashTable;
      HashEntry       : Tcl_HashEntry
   ) return C.Strings.Chars_Ptr;
   pragma Import (C, Tcl_GetHashKey, "Tcl_CallGetHashKey");

   -- 
   --  Macros to use for clients to use to invoke find and create procedures
   --  for hash tables:
   -- 

   function Tcl_FindHashEntry (
      HashTable       : Tcl_HashTable;
      key             : C.Strings.Chars_Ptr
   ) return Tcl_HashEntry;
   pragma Import (C, Tcl_FindHashEntry, "Tcl_CallFindHashEntry");

   function Tcl_CreateHashEntry (
      HashTable       : Tcl_HashTable;
      key             : C.Strings.Chars_Ptr;
      newPtr          : access C.Int
   ) return Tcl_HashEntry;
   pragma Import (C, Tcl_CreateHashEntry, "Tcl_CallCreateHashEntry");

   -- 
   --  Flag values to pass to Tcl_DoOneEvent to disable searches
   --  for some kinds of events:
   -- 

   TCL_DONT_WAIT        : constant := 2;
   TCL_WINDOW_EVENTS    : constant := 4;
   TCL_FILE_EVENTS      : constant := 8;
   TCL_TIMER_EVENTS     : constant := 16;
   TCL_IDLE_EVENTS      : constant := 32;
   -- WAS 0x10 ???? 

   TCL_ALL_EVENTS       : constant := -3;
   -- 
   --  The following structure defines a generic event for the Tcl event
   --  system.  These are the things that are queued in calls to Tcl_QueueEvent
   --  and serviced later by Tcl_DoOneEvent.  There can be many different
   --  kinds of events with different fields, corresponding to window events,
   --  timer events, etc.  The structure for a particular event consists of
   --  a Tcl_Event header followed by additional information specific to that
   --  event.
   -- 

   -- 
   --  Positions to pass to Tk_QueueEvent:
   -- 

   type Tcl_QueuePosition is (
      TCL_QUEUE_TAIL,
      TCL_QUEUE_HEAD,
      TCL_QUEUE_MARK
   );
   for Tcl_QueuePosition'size use 32;

   -- 
   --  The following structure keeps is used to hold a time value, either as
   --  an absolute time {the number of seconds from the epoch} or as an
   --  elapsed time. On Unix systems the epoch is Midnight Jan 1, 1970 GMT.
   --  On Macintosh systems the epoch is Midnight Jan 1, 1904 GMT.
   -- 

   type Tcl_Time_rec is private;
   type Tcl_Time is access all Tcl_Time_rec;
   pragma Convention (C, Tcl_Time);

   type Tcl_Time_array is array (C.size_t range <>) of Tcl_Time;

   function Is_Null (Ptr : Tcl_Time) return Boolean;

   -- 
   --  Bits to pass to Tcl_CreateFileHandler and Tcl_CreateChannelHandler
   --  to indicate what sorts of events are of interest:
   -- 

   TCL_READABLE         : constant := 2;
   TCL_WRITABLE         : constant := 4;
   TCL_EXCEPTION        : constant := 8;
   -- 
   --  Flag values to pass to Tcl_OpenCommandChannel to indicate the
   --  disposition of the stdio handles.  TCL_STDIN, TCL_STDOUT, TCL_STDERR,
   --  are also used in Tcl_GetStdChannel.
   -- 

   TCL_STDIN            : constant := 2;
   TCL_STDOUT           : constant := 4;
   TCL_STDERR           : constant := 8;
   TCL_ENFORCE_MODE     : constant := 16;
   -- 
   --  Typedefs for the various operations in a channel type:
   -- 

   type Tcl_DriverBlockModeProc is access function (
      instancedata    : ClientData;
      mode            : C.Int
   ) return C.Int;
   pragma Convention (C, Tcl_DriverBlockModeProc);

   type Tcl_DriverCloseProc is access function (
      instancedata    : ClientData;
      interp          : Tcl_Interp
   ) return C.Int;
   pragma Convention (C, Tcl_DriverCloseProc);

   type Tcl_DriverInputProc is access function (
      instancedata    : ClientData;
      buf             : C.Strings.Chars_Ptr;
      toRead          : C.Int;
      errorCodePtr    : access C.Int
   ) return C.Int;
   pragma Convention (C, Tcl_DriverInputProc);

   type Tcl_DriverOutputProc is access function (
      instancedata    : ClientData;
      buf             : C.Strings.Chars_Ptr;
      toWrite         : C.Int;
      errorCodePtr    : access C.Int
   ) return C.Int;
   pragma Convention (C, Tcl_DriverOutputProc);

   type Tcl_DriverSeekProc is access function (
      instancedata    : ClientData;
      offset          : C.Long;
      mode            : C.Int;
      errorCodePtr    : access C.Int
   ) return C.Int;
   pragma Convention (C, Tcl_DriverSeekProc);

   type Tcl_DriverSetOptionProc is access function (
      instancedata    : ClientData;
      interp          : Tcl_Interp;
      optionName      : C.Strings.Chars_Ptr;
      value           : C.Strings.Chars_Ptr
   ) return C.Int;
   pragma Convention (C, Tcl_DriverSetOptionProc);

   type Tcl_DriverGetOptionProc is access function (
      instancedata    : ClientData;
      optionName      : C.Strings.Chars_Ptr;
      dsPtr           : Tcl_DString
   ) return C.Int;
   pragma Convention (C, Tcl_DriverGetOptionProc);

   type Tcl_DriverWatchChannelProc is access procedure (
      instancedata    : ClientData;
      mask            : C.Int
   );
   pragma Convention (C, Tcl_DriverWatchChannelProc);

   type Tcl_DriverChannelReadyProc is access function (
      instancedata    : ClientData;
      mask            : C.Int
   ) return C.Int;
   pragma Convention (C, Tcl_DriverChannelReadyProc);

   type Tcl_DriverGetFileProc is access function (
      instancedata    : ClientData;
      mask            : C.Int
   ) return Tcl_File;
   pragma Convention (C, Tcl_DriverGetFileProc);

   -- 
   --  Enum for different end of line translation and recognition modes.
   -- 

   type Tcl_EolTranslation is (
      TCL_TRANSLATE_AUTO,
      -- Eol == \r, \n and \r\n.
      TCL_TRANSLATE_CR,
      -- Eol == \r.
      TCL_TRANSLATE_LF,
      -- Eol == \n.
      TCL_TRANSLATE_CRLF
      -- Eol == \r\n.
   );
   for Tcl_EolTranslation'size use 32;

   -- 
   --  struct Tcl_ChannelType:
   -- 
   --  One such structure exists for each type {kind} of channel.
   --  It collects together in one place all the functions that are
   --  part of the specific channel type.
   -- 

   type Tcl_ChannelType_rec is private;
   type Tcl_ChannelType is access all Tcl_ChannelType_rec;
   pragma Convention (C, Tcl_ChannelType);

   type Tcl_ChannelType_array is array (C.size_t range <>) of Tcl_ChannelType;

   function Is_Null (Ptr : Tcl_ChannelType) return Boolean;

   -- 
   --  The following flags determine whether the blockModeProc above should
   --  set the channel into blocking or nonblocking mode. They are passed
   --  as arguments to the blockModeProc procedure in the above structure.
   -- 

   TCL_MODE_BLOCKING    : constant := 0;
   -- Put channel into blocking mode. 

   TCL_MODE_NONBLOCKING : constant := 1;
   -- Put channel into nonblocking
   --  mode. 

   -- 
   --  Types for file handles:
   -- 

   TCL_UNIX_FD          : constant := 1;
   TCL_MAC_FILE         : constant := 2;
   TCL_MAC_SOCKET       : constant := 3;
   TCL_WIN_PIPE         : constant := 4;
   TCL_WIN_FILE         : constant := 5;
   TCL_WIN_SOCKET       : constant := 6;
   TCL_WIN_CONSOLE      : constant := 7;
   TCL_WIN32S_PIPE      : constant := 8;
   -- 
   --  Enum for different types of file paths.
   -- 

   type Tcl_PathType is (
      TCL_PATH_ABSOLUTE,
      TCL_PATH_RELATIVE,
      TCL_PATH_VOLUME_RELATIVE
   );
   for Tcl_PathType'size use 32;

   -- 
   --  The following interface is exported for backwards compatibility, but
   --  is only implemented on Unix.  Portable applications should use
   --  Tcl_OpenCommandChannel, instead.
   -- 

   function Tcl_CreatePipeline (
      interp          : Tcl_Interp;
      argc            : C.Int;
      argv            : CArgv.Chars_Ptr_Ptr;
      pidArrayPtr     : access CHelper.Int_Ptr;
      inPipePtr       : access C.Int;
      outPipePtr      : access C.Int;
      errFilePtr      : access C.Int
   ) return C.Int;
   pragma Import (C, Tcl_CreatePipeline, "Tcl_CreatePipeline");

   -- 
   --  Exported Tcl procedures:
   -- 

   procedure Tcl_AddErrorInfo (
      interp          : Tcl_Interp;
      message         : C.Strings.Chars_Ptr
   );
   pragma Import (C, Tcl_AddErrorInfo, "Tcl_AddErrorInfo");

   procedure Tcl_AllowExceptions (
      interp          : Tcl_Interp
   );
   pragma Import (C, Tcl_AllowExceptions, "Tcl_AllowExceptions");

   procedure Tcl_AppendElement (
      interp          : Tcl_Interp;
      strng           : C.Strings.Chars_Ptr
   );
   pragma Import (C, Tcl_AppendElement, "Tcl_AppendElement");

   procedure Tcl_AppendResult (
      interp          : Tcl_Interp;
      String1         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr;
      String2         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr;
      String3         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr;
      String4         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr;
      String5         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr;
      String6         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr;
      String7         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr;
      String8         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr;
      String9         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr
   );
   pragma Import (C, Tcl_AppendResult, "Tcl_AppendResult");

   function Tcl_AppInit (
      interp          : Tcl_Interp
   ) return C.Int;
   pragma Import (C, Tcl_AppInit, "Tcl_AppInit");

   function Tcl_AsyncCreate (
      proc            : Tcl_AsyncProc;
      data            : ClientData
   ) return Tcl_AsyncHandler;
   pragma Import (C, Tcl_AsyncCreate, "Tcl_AsyncCreate");

   procedure Tcl_AsyncDelete (
      async           : Tcl_AsyncHandler
   );
   pragma Import (C, Tcl_AsyncDelete, "Tcl_AsyncDelete");

   function Tcl_AsyncInvoke (
      interp          : Tcl_Interp;
      code            : C.Int
   ) return C.Int;
   pragma Import (C, Tcl_AsyncInvoke, "Tcl_AsyncInvoke");

   procedure Tcl_AsyncMark (
      async           : Tcl_AsyncHandler
   );
   pragma Import (C, Tcl_AsyncMark, "Tcl_AsyncMark");

   function Tcl_AsyncReady return C.Int;
   pragma Import (C, Tcl_AsyncReady, "Tcl_AsyncReady");

   procedure Tcl_BackgroundError (
      interp          : Tcl_Interp
   );
   pragma Import (C, Tcl_BackgroundError, "Tcl_BackgroundError");

   function Tcl_Backslash (
      src             : C.Strings.Chars_Ptr;
      readPtr         : access C.Int
   ) return C.Char;
   pragma Import (C, Tcl_Backslash, "Tcl_Backslash");

   procedure Tcl_CallWhenDeleted (
      interp          : Tcl_Interp;
      proc            : Tcl_InterpDeleteProc;
      data            : ClientData
   );
   pragma Import (C, Tcl_CallWhenDeleted, "Tcl_CallWhenDeleted");

   procedure Tcl_CancelIdleCall (
      idleProc        : Tcl_IdleProc;
      data            : ClientData
   );
   pragma Import (C, Tcl_CancelIdleCall, "Tcl_CancelIdleCall");

   function Tcl_Ckalloc (
      size            : C.Unsigned
   ) return C.Strings.Chars_Ptr renames Tcl_Alloc;

   procedure Tcl_Ckfree (
      ptr             : C.Strings.Chars_Ptr
   ) renames Tcl_Free;

   function Tcl_Ckrealloc (
      ptr             : C.Strings.Chars_Ptr;
      size            : C.Unsigned
   ) return C.Strings.Chars_Ptr renames Tcl_Realloc;

   function Tcl_Close (
      interp          : Tcl_Interp;
      chan            : Tcl_Channel
   ) return C.Int;
   pragma Import (C, Tcl_Close, "Tcl_Close");

   function Tcl_CommandComplete (
      cmd             : C.Strings.Chars_Ptr
   ) return C.Int;
   pragma Import (C, Tcl_CommandComplete, "Tcl_CommandComplete");

   function Tcl_Concat (
      argc            : C.Int;
      argv            : CArgv.Chars_Ptr_Ptr
   ) return C.Strings.Chars_Ptr;
   pragma Import (C, Tcl_Concat, "Tcl_Concat");

   function Tcl_ConvertElement (
      src             : C.Strings.Chars_Ptr;
      dst             : C.Strings.Chars_Ptr;
      flags           : C.Int
   ) return C.Int;
   pragma Import (C, Tcl_ConvertElement, "Tcl_ConvertElement");

   function Tcl_CreateAlias (
      slave           : Tcl_Interp;
      slaveCmd        : C.Strings.Chars_Ptr;
      target          : Tcl_Interp;
      targetCmd       : C.Strings.Chars_Ptr;
      argc            : C.Int;
      argv            : CArgv.Chars_Ptr_Ptr
   ) return C.Int;
   pragma Import (C, Tcl_CreateAlias, "Tcl_CreateAlias");

   function Tcl_CreateChannel (
      typePtr         : Tcl_ChannelType;
      chanName        : C.Strings.Chars_Ptr;
      instancedata    : ClientData;
      mask            : C.Int
   ) return Tcl_Channel;
   pragma Import (C, Tcl_CreateChannel, "Tcl_CreateChannel");

   procedure Tcl_CreateChannelHandler (
      chan            : Tcl_Channel;
      mask            : C.Int;
      proc            : Tcl_ChannelProc;
      data            : ClientData
   );
   pragma Import (C, Tcl_CreateChannelHandler, "Tcl_CreateChannelHandler");

   procedure Tcl_CreateCloseHandler (
      chan            : Tcl_Channel;
      proc            : Tcl_CloseProc;
      data            : ClientData
   );
   pragma Import (C, Tcl_CreateCloseHandler, "Tcl_CreateCloseHandler");

   function Tcl_CreateCommand (
      interp          : Tcl_Interp;
      cmdName         : C.Strings.Chars_Ptr;
      proc            : Tcl_CmdProc;
      data            : ClientData;
      deleteProc      : Tcl_CmdDeleteProc
   ) return Tcl_Command;
   pragma Import (C, Tcl_CreateCommand, "Tcl_CreateCommand");

   procedure Tcl_CreateEventSource (
      setupProc       : Tcl_EventSetupProc;
      checkProc       : Tcl_EventCheckProc;
      data            : ClientData
   );
   pragma Import (C, Tcl_CreateEventSource, "Tcl_CreateEventSource");

   procedure Tcl_CreateExitHandler (
      proc            : Tcl_ExitProc;
      data            : ClientData
   );
   pragma Import (C, Tcl_CreateExitHandler, "Tcl_CreateExitHandler");

   procedure Tcl_CreateFileHandler (
      file            : Tcl_File;
      mask            : C.Int;
      proc            : Tcl_FileProc;
      data            : ClientData
   );
   pragma Import (C, Tcl_CreateFileHandler, "Tcl_CreateFileHandler");

   function Tcl_CreateInterp return Tcl_Interp;
   pragma Import (C, Tcl_CreateInterp, "Tcl_CreateInterp");

   procedure Tcl_CreateMathFunc (
      interp          : Tcl_Interp;
      name            : C.Strings.Chars_Ptr;
      numArgs         : C.Int;
      argTypes        : Tcl_ValueType;
      proc            : Tcl_MathProc;
      data            : ClientData
   );
   pragma Import (C, Tcl_CreateMathFunc, "Tcl_CreateMathFunc");

   procedure Tcl_CreateModalTimeout (
      milliseconds    : C.Int;
      proc            : Tcl_TimerProc;
      data            : ClientData
   );
   pragma Import (C, Tcl_CreateModalTimeout, "Tcl_CreateModalTimeout");

   function Tcl_CreateSlave (
      interp          : Tcl_Interp;
      slaveName       : C.Strings.Chars_Ptr;
      isSafe          : C.Int
   ) return Tcl_Interp;
   pragma Import (C, Tcl_CreateSlave, "Tcl_CreateSlave");

   function Tcl_CreateTimerHandler (
      milliseconds    : C.Int;
      proc            : Tcl_TimerProc;
      data            : ClientData
   ) return Tcl_TimerToken;
   pragma Import (C, Tcl_CreateTimerHandler, "Tcl_CreateTimerHandler");

   function Tcl_CreateTrace (
      interp          : Tcl_Interp;
      level           : C.Int;
      proc            : Tcl_CmdTraceProc;
      data            : ClientData
   ) return Tcl_Trace;
   pragma Import (C, Tcl_CreateTrace, "Tcl_CreateTrace");

   function Tcl_DbCkalloc (
      size            : C.Unsigned;
      file            : C.Strings.Chars_Ptr;
      line            : C.Int
   ) return C.Strings.Chars_Ptr;
   pragma Import (C, Tcl_DbCkalloc, "Tcl_DbCkalloc");

   function Tcl_DbCkfree (
      ptr             : C.Strings.Chars_Ptr;
      file            : C.Strings.Chars_Ptr;
      line            : C.Int
   ) return C.Int;
   pragma Import (C, Tcl_DbCkfree, "Tcl_DbCkfree");

   function Tcl_DbCkrealloc (
      ptr             : C.Strings.Chars_Ptr;
      size            : C.Unsigned;
      file            : C.Strings.Chars_Ptr;
      line            : C.Int
   ) return C.Strings.Chars_Ptr;
   pragma Import (C, Tcl_DbCkrealloc, "Tcl_DbCkrealloc");

   procedure Tcl_DeleteAssocData (
      interp          : Tcl_Interp;
      name            : C.Strings.Chars_Ptr
   );
   pragma Import (C, Tcl_DeleteAssocData, "Tcl_DeleteAssocData");

   function Tcl_DeleteCommand (
      interp          : Tcl_Interp;
      cmdName         : C.Strings.Chars_Ptr
   ) return C.Int;
   pragma Import (C, Tcl_DeleteCommand, "Tcl_DeleteCommand");

   procedure Tcl_DeleteChannelHandler (
      chan            : Tcl_Channel;
      proc            : Tcl_ChannelProc;
      data            : ClientData
   );
   pragma Import (C, Tcl_DeleteChannelHandler, "Tcl_DeleteChannelHandler");

   procedure Tcl_DeleteCloseHandler (
      chan            : Tcl_Channel;
      proc            : Tcl_CloseProc;
      data            : ClientData
   );
   pragma Import (C, Tcl_DeleteCloseHandler, "Tcl_DeleteCloseHandler");

   procedure Tcl_DeleteEventSource (
      setupProc       : Tcl_EventSetupProc;
      checkProc       : Tcl_EventCheckProc;
      data            : ClientData
   );
   pragma Import (C, Tcl_DeleteEventSource, "Tcl_DeleteEventSource");

   procedure Tcl_DeleteEvents (
      proc            : Tcl_EventDeleteProc;
      data            : ClientData
   );
   pragma Import (C, Tcl_DeleteEvents, "Tcl_DeleteEvents");

   procedure Tcl_DeleteExitHandler (
      proc            : Tcl_ExitProc;
      data            : ClientData
   );
   pragma Import (C, Tcl_DeleteExitHandler, "Tcl_DeleteExitHandler");

   procedure Tcl_DeleteFileHandler (
      file            : Tcl_File
   );
   pragma Import (C, Tcl_DeleteFileHandler, "Tcl_DeleteFileHandler");

   procedure Tcl_DeleteHashEntry (
      entryPtr        : Tcl_HashEntry
   );
   pragma Import (C, Tcl_DeleteHashEntry, "Tcl_DeleteHashEntry");

   procedure Tcl_DeleteHashTable (
      tablePtr        : Tcl_HashTable
   );
   pragma Import (C, Tcl_DeleteHashTable, "Tcl_DeleteHashTable");

   procedure Tcl_DeleteInterp (
      interp          : Tcl_Interp
   );
   pragma Import (C, Tcl_DeleteInterp, "Tcl_DeleteInterp");

   procedure Tcl_DeleteModalTimeout (
      proc            : Tcl_TimerProc;
      data            : ClientData
   );
   pragma Import (C, Tcl_DeleteModalTimeout, "Tcl_DeleteModalTimeout");

   procedure Tcl_DeleteTimerHandler (
      token           : Tcl_TimerToken
   );
   pragma Import (C, Tcl_DeleteTimerHandler, "Tcl_DeleteTimerHandler");

   procedure Tcl_DeleteTrace (
      interp          : Tcl_Interp;
      trace           : Tcl_Trace
   );
   pragma Import (C, Tcl_DeleteTrace, "Tcl_DeleteTrace");

   procedure Tcl_DetachPids (
      numPids         : C.Int;
      pidPtr          : access C.Int
   );
   pragma Import (C, Tcl_DetachPids, "Tcl_DetachPids");

   procedure Tcl_DontCallWhenDeleted (
      interp          : Tcl_Interp;
      proc            : Tcl_InterpDeleteProc;
      data            : ClientData
   );
   pragma Import (C, Tcl_DontCallWhenDeleted, "Tcl_DontCallWhenDeleted");

   function Tcl_DoOneEvent (
      flags           : C.Int
   ) return C.Int;
   pragma Import (C, Tcl_DoOneEvent, "Tcl_DoOneEvent");

   procedure Tcl_DoWhenIdle (
      proc            : Tcl_IdleProc;
      data            : ClientData
   );
   pragma Import (C, Tcl_DoWhenIdle, "Tcl_DoWhenIdle");

   function Tcl_DStringAppend (
      dsPtr           : Tcl_DString;
      strng           : C.Strings.Chars_Ptr;
      length          : C.Int
   ) return C.Strings.Chars_Ptr;
   pragma Import (C, Tcl_DStringAppend, "Tcl_DStringAppend");

   function Tcl_DStringAppendElement (
      dsPtr           : Tcl_DString;
      strng           : C.Strings.Chars_Ptr
   ) return C.Strings.Chars_Ptr;
   pragma Import (C, Tcl_DStringAppendElement, "Tcl_DStringAppendElement");

   procedure Tcl_DStringEndSublist (
      dsPtr           : Tcl_DString
   );
   pragma Import (C, Tcl_DStringEndSublist, "Tcl_DStringEndSublist");

   procedure Tcl_DStringFree (
      dsPtr           : Tcl_DString
   );
   pragma Import (C, Tcl_DStringFree, "Tcl_DStringFree");

   procedure Tcl_DStringGetResult (
      interp          : Tcl_Interp;
      dsPtr           : Tcl_DString
   );
   pragma Import (C, Tcl_DStringGetResult, "Tcl_DStringGetResult");

   procedure Tcl_DStringInit (
      dsPtr           : Tcl_DString
   );
   pragma Import (C, Tcl_DStringInit, "Tcl_DStringInit");

   procedure Tcl_DStringResult (
      interp          : Tcl_Interp;
      dsPtr           : Tcl_DString
   );
   pragma Import (C, Tcl_DStringResult, "Tcl_DStringResult");

   procedure Tcl_DStringStartSublist (
      dsPtr           : Tcl_DString
   );
   pragma Import (C, Tcl_DStringStartSublist, "Tcl_DStringStartSublist");

   function Tcl_Eof (
      chan            : Tcl_Channel
   ) return C.Int;
   pragma Import (C, Tcl_Eof, "Tcl_Eof");

   function Tcl_ErrnoId return C.Strings.Chars_Ptr;
   pragma Import (C, Tcl_ErrnoId, "Tcl_ErrnoId");

   function Tcl_ErrnoMsg (
      err             : C.Int
   ) return C.Strings.Chars_Ptr;
   pragma Import (C, Tcl_ErrnoMsg, "Tcl_ErrnoMsg");

   function Tcl_Eval (
      interp          : Tcl_Interp;
      cmd             : C.Strings.Chars_Ptr
   ) return C.Int;
   pragma Import (C, Tcl_Eval, "Tcl_Eval");

   function Tcl_EvalFile (
      interp          : Tcl_Interp;
      fileName        : C.Strings.Chars_Ptr
   ) return C.Int;
   pragma Import (C, Tcl_EvalFile, "Tcl_EvalFile");

   procedure Tcl_EventuallyFree (
      data            : ClientData;
      freeProc        : Tcl_FreeProc
   );
   pragma Import (C, Tcl_EventuallyFree, "Tcl_EventuallyFree");

   procedure Tcl_Exit (
      status          : C.Int
   );
   pragma Import (C, Tcl_Exit, "Tcl_Exit");

   function Tcl_ExprBoolean (
      interp          : Tcl_Interp;
      strng           : C.Strings.Chars_Ptr;
      ptr             : access C.Int
   ) return C.Int;
   pragma Import (C, Tcl_ExprBoolean, "Tcl_ExprBoolean");

   function Tcl_ExprDouble (
      interp          : Tcl_Interp;
      strng           : C.Strings.Chars_Ptr;
      ptr             : access C.Double
   ) return C.Int;
   pragma Import (C, Tcl_ExprDouble, "Tcl_ExprDouble");

   function Tcl_ExprLong (
      interp          : Tcl_Interp;
      strng           : C.Strings.Chars_Ptr;
      ptr             : access C.Long
   ) return C.Int;
   pragma Import (C, Tcl_ExprLong, "Tcl_ExprLong");

   function Tcl_ExprString (
      interp          : Tcl_Interp;
      strng           : C.Strings.Chars_Ptr
   ) return C.Int;
   pragma Import (C, Tcl_ExprString, "Tcl_ExprString");

   function Tcl_FileReady (
      file            : Tcl_File;
      mask            : C.Int
   ) return C.Int;
   pragma Import (C, Tcl_FileReady, "Tcl_FileReady");

   procedure Tcl_FindExecutable (
      argv0           : C.Strings.Chars_Ptr
   );
   pragma Import (C, Tcl_FindExecutable, "Tcl_FindExecutable");

   function Tcl_FirstHashEntry (
      tablePtr        : Tcl_HashTable;
      searchPtr       : Tcl_HashSearch
   ) return Tcl_HashEntry;
   pragma Import (C, Tcl_FirstHashEntry, "Tcl_FirstHashEntry");

   function Tcl_Flush (
      chan            : Tcl_Channel
   ) return C.Int;
   pragma Import (C, Tcl_Flush, "Tcl_Flush");

   procedure Tcl_FreeFile (
      file            : Tcl_File
   );
   pragma Import (C, Tcl_FreeFile, "Tcl_FreeFile");

   function Tcl_GetAlias (
      interp          : Tcl_Interp;
      slaveCmd        : C.Strings.Chars_Ptr;
      targetInterpPtr : Tcl_Interp;
      targetCmdPtr    : CArgv.Chars_Ptr_Ptr;
      argcPtr         : access C.Int;
      argvPtr         : access CArgv.Chars_Ptr_Ptr
   ) return C.Int;
   pragma Import (C, Tcl_GetAlias, "Tcl_GetAlias");

   function Tcl_GetAssocData (
      interp          : Tcl_Interp;
      name            : C.Strings.Chars_Ptr;
      procPtr         : Tcl_InterpDeleteProc
   ) return ClientData;
   pragma Import (C, Tcl_GetAssocData, "Tcl_GetAssocData");

   function Tcl_GetBoolean (
      interp          : Tcl_Interp;
      strng           : C.Strings.Chars_Ptr;
      boolPtr         : access C.Int
   ) return C.Int;
   pragma Import (C, Tcl_GetBoolean, "Tcl_GetBoolean");

   function Tcl_GetChannel (
      interp          : Tcl_Interp;
      chanName        : C.Strings.Chars_Ptr;
      modePtr         : access C.Int
   ) return Tcl_Channel;
   pragma Import (C, Tcl_GetChannel, "Tcl_GetChannel");

   function Tcl_GetChannelBufferSize (
      chan            : Tcl_Channel
   ) return C.Int;
   pragma Import (C, Tcl_GetChannelBufferSize, "Tcl_GetChannelBufferSize");

   function Tcl_GetChannelFile (
      chan            : Tcl_Channel;
      direction       : C.Int
   ) return Tcl_File;
   pragma Import (C, Tcl_GetChannelFile, "Tcl_GetChannelFile");

   function Tcl_GetChannelInstanceData (
      chan            : Tcl_Channel
   ) return ClientData;
   pragma Import (C, Tcl_GetChannelInstanceData, "Tcl_GetChannelInstanceData");

   function Tcl_GetChannelMode (
      chan            : Tcl_Channel
   ) return C.Int;
   pragma Import (C, Tcl_GetChannelMode, "Tcl_GetChannelMode");

   function Tcl_GetChannelName (
      chan            : Tcl_Channel
   ) return C.Strings.Chars_Ptr;
   pragma Import (C, Tcl_GetChannelName, "Tcl_GetChannelName");

   function Tcl_GetChannelOption (
      chan            : Tcl_Channel;
      optionName      : C.Strings.Chars_Ptr;
      dsPtr           : Tcl_DString
   ) return C.Int;
   pragma Import (C, Tcl_GetChannelOption, "Tcl_GetChannelOption");

   function Tcl_GetChannelType (
      chan            : Tcl_Channel
   ) return Tcl_ChannelType;
   pragma Import (C, Tcl_GetChannelType, "Tcl_GetChannelType");

   function Tcl_GetCommandInfo (
      interp          : Tcl_Interp;
      cmdName         : C.Strings.Chars_Ptr;
      infoPtr         : Tcl_CmdInfo
   ) return C.Int;
   pragma Import (C, Tcl_GetCommandInfo, "Tcl_GetCommandInfo");

   function Tcl_GetCommandName (
      interp          : Tcl_Interp;
      command         : Tcl_Command
   ) return C.Strings.Chars_Ptr;
   pragma Import (C, Tcl_GetCommandName, "Tcl_GetCommandName");

   function Tcl_GetDouble (
      interp          : Tcl_Interp;
      strng           : C.Strings.Chars_Ptr;
      doublePtr       : access C.Double
   ) return C.Int;
   pragma Import (C, Tcl_GetDouble, "Tcl_GetDouble");

   function Tcl_GetErrno return C.Int;
   pragma Import (C, Tcl_GetErrno, "Tcl_GetErrno");

   function Tcl_GetFile (
      filedata        : ClientData;
      typ             : C.Int
   ) return Tcl_File;
   pragma Import (C, Tcl_GetFile, "Tcl_GetFile");

   function Tcl_GetFileInfo (
      file            : Tcl_File;
      typePtr         : access C.Int
   ) return ClientData;
   pragma Import (C, Tcl_GetFileInfo, "Tcl_GetFileInfo");

   function Tcl_GetHostName return C.Strings.Chars_Ptr;
   pragma Import (C, Tcl_GetHostName, "Tcl_GetHostName");

   function Tcl_GetInt (
      interp          : Tcl_Interp;
      strng           : C.Strings.Chars_Ptr;
      intPtr          : access C.Int
   ) return C.Int;
   pragma Import (C, Tcl_GetInt, "Tcl_GetInt");

   function Tcl_GetInterpPath (
      askInterp       : Tcl_Interp;
      slaveInterp     : Tcl_Interp
   ) return C.Int;
   pragma Import (C, Tcl_GetInterpPath, "Tcl_GetInterpPath");

   function Tcl_GetMaster (
      interp          : Tcl_Interp
   ) return Tcl_Interp;
   pragma Import (C, Tcl_GetMaster, "Tcl_GetMaster");

   function Tcl_GetNotifierData (
      file            : Tcl_File;
      freeProcPtr     : Tcl_FileFreeProc
   ) return ClientData;
   pragma Import (C, Tcl_GetNotifierData, "Tcl_GetNotifierData");

   procedure Tcl_GetOpenFile (
      interp          : Tcl_Interp;
      strng           : C.Strings.Chars_Ptr;
      write           : C.Int;
      checkUsage      : C.Int;
      fileptr         : ClientData
   );
   pragma Import (C, Tcl_GetOpenFile, "Tcl_GetOpenFile");

   function Tcl_GetPathType (
      path            : C.Strings.Chars_Ptr
   ) return Tcl_PathType;
   pragma Import (C, Tcl_GetPathType, "Tcl_GetPathType");

   function Tcl_Gets (
      chan            : Tcl_Channel;
      dsPtr           : Tcl_DString
   ) return C.Int;
   pragma Import (C, Tcl_Gets, "Tcl_Gets");

   function Tcl_GetSlave (
      interp          : Tcl_Interp;
      slaveName       : C.Strings.Chars_Ptr
   ) return Tcl_Interp;
   pragma Import (C, Tcl_GetSlave, "Tcl_GetSlave");

   function Tcl_GetStdChannel (
      typ             : C.Int
   ) return Tcl_Channel;
   pragma Import (C, Tcl_GetStdChannel, "Tcl_GetStdChannel");

   function Tcl_GetVar (
      interp          : Tcl_Interp;
      varName         : C.Strings.Chars_Ptr;
      flags           : C.Int
   ) return C.Strings.Chars_Ptr;
   pragma Import (C, Tcl_GetVar, "Tcl_GetVar");

   function Tcl_GetVar2 (
      interp          : Tcl_Interp;
      part1           : C.Strings.Chars_Ptr;
      part2           : C.Strings.Chars_Ptr;
      flags           : C.Int
   ) return C.Strings.Chars_Ptr;
   pragma Import (C, Tcl_GetVar2, "Tcl_GetVar2");

   function Tcl_GlobalEval (
      interp          : Tcl_Interp;
      command         : C.Strings.Chars_Ptr
   ) return C.Int;
   pragma Import (C, Tcl_GlobalEval, "Tcl_GlobalEval");

   function Tcl_HashStats (
      tablePtr        : Tcl_HashTable
   ) return C.Strings.Chars_Ptr;
   pragma Import (C, Tcl_HashStats, "Tcl_HashStats");

   function Tcl_Init (
      interp          : Tcl_Interp
   ) return C.Int;
   pragma Import (C, Tcl_Init, "Tcl_Init");

   procedure Tcl_InitHashTable (
      tablePtr        : Tcl_HashTable;
      keyType         : C.Int
   );
   pragma Import (C, Tcl_InitHashTable, "Tcl_InitHashTable");

   procedure Tcl_InitMemory (
      interp          : Tcl_Interp
   );
   pragma Import (C, Tcl_InitMemory, "Tcl_InitMemory");

   function Tcl_InputBlocked (
      chan            : Tcl_Channel
   ) return C.Int;
   pragma Import (C, Tcl_InputBlocked, "Tcl_InputBlocked");

   function Tcl_InputBuffered (
      chan            : Tcl_Channel
   ) return C.Int;
   pragma Import (C, Tcl_InputBuffered, "Tcl_InputBuffered");

   function Tcl_InterpDeleted (
      interp          : Tcl_Interp
   ) return C.Int;
   pragma Import (C, Tcl_InterpDeleted, "Tcl_InterpDeleted");

   function Tcl_IsSafe (
      interp          : Tcl_Interp
   ) return C.Int;
   pragma Import (C, Tcl_IsSafe, "Tcl_IsSafe");

   function Tcl_JoinPath (
      argc            : C.Int;
      argv            : CArgv.Chars_Ptr_Ptr;
      resultPtr       : Tcl_DString
   ) return C.Strings.Chars_Ptr;
   pragma Import (C, Tcl_JoinPath, "Tcl_JoinPath");

   function Tcl_LinkVar (
      interp          : Tcl_Interp;
      varName         : C.Strings.Chars_Ptr;
      addr            : C.Strings.Chars_Ptr;
      typ             : C.Int
   ) return C.Int;
   pragma Import (C, Tcl_LinkVar, "Tcl_LinkVar");

   procedure Tcl_Main (
      argc            : C.Int;
      argv            : CArgv.Chars_Ptr_Ptr;
      appInitProc     : Tcl_AppInitProc
   );
   pragma Import (C, Tcl_Main, "Tcl_Main");

   function Tcl_MakeFileChannel (
      infile          : ClientData;
      outfile         : ClientData;
      mode            : C.Int
   ) return Tcl_Channel;
   pragma Import (C, Tcl_MakeFileChannel, "Tcl_MakeFileChannel");

   function Tcl_MakeSafe (
      interp          : Tcl_Interp
   ) return C.Int;
   pragma Import (C, Tcl_MakeSafe, "Tcl_MakeSafe");

   function Tcl_MakeTcpClientChannel (
      tcpsocket       : ClientData
   ) return Tcl_Channel;
   pragma Import (C, Tcl_MakeTcpClientChannel, "Tcl_MakeTcpClientChannel");

   function Tcl_Merge (
      argc            : C.Int;
      argv            : CArgv.Chars_Ptr_Ptr
   ) return C.Strings.Chars_Ptr;
   pragma Import (C, Tcl_Merge, "Tcl_Merge");

   function Tcl_NextHashEntry (
      searchPtr       : Tcl_HashSearch
   ) return Tcl_HashEntry;
   pragma Import (C, Tcl_NextHashEntry, "Tcl_NextHashEntry");

   function Tcl_OpenCommandChannel (
      interp          : Tcl_Interp;
      argc            : C.Int;
      argv            : CArgv.Chars_Ptr_Ptr;
      flags           : C.Int
   ) return Tcl_Channel;
   pragma Import (C, Tcl_OpenCommandChannel, "Tcl_OpenCommandChannel");

   function Tcl_OpenFileChannel (
      interp          : Tcl_Interp;
      fileName        : C.Strings.Chars_Ptr;
      modeString      : C.Strings.Chars_Ptr;
      permissions     : C.Int
   ) return Tcl_Channel;
   pragma Import (C, Tcl_OpenFileChannel, "Tcl_OpenFileChannel");

   function Tcl_OpenTcpClient (
      interp          : Tcl_Interp;
      port            : C.Int;
      address         : C.Strings.Chars_Ptr;
      myaddr          : C.Strings.Chars_Ptr;
      myport          : C.Int;
      async           : C.Int
   ) return Tcl_Channel;
   pragma Import (C, Tcl_OpenTcpClient, "Tcl_OpenTcpClient");

   function Tcl_OpenTcpServer (
      interp          : Tcl_Interp;
      port            : C.Int;
      host            : C.Strings.Chars_Ptr;
      acceptProc      : Tcl_TcpAcceptProc;
      callbackdata    : ClientData
   ) return Tcl_Channel;
   pragma Import (C, Tcl_OpenTcpServer, "Tcl_OpenTcpServer");

   function Tcl_ParseVar (
      interp          : Tcl_Interp;
      strng           : C.Strings.Chars_Ptr;
      termPtr         : CArgv.Chars_Ptr_Ptr
   ) return C.Strings.Chars_Ptr;
   pragma Import (C, Tcl_ParseVar, "Tcl_ParseVar");

   function Tcl_PkgProvide (
      interp          : Tcl_Interp;
      name            : C.Strings.Chars_Ptr;
      version         : C.Strings.Chars_Ptr
   ) return C.Int;
   pragma Import (C, Tcl_PkgProvide, "Tcl_PkgProvide");

   function Tcl_PkgRequire (
      interp          : Tcl_Interp;
      name            : C.Strings.Chars_Ptr;
      version         : C.Strings.Chars_Ptr;
      exact           : C.Int
   ) return C.Strings.Chars_Ptr;
   pragma Import (C, Tcl_PkgRequire, "Tcl_PkgRequire");

   function Tcl_PosixError (
      interp          : Tcl_Interp
   ) return C.Strings.Chars_Ptr;
   pragma Import (C, Tcl_PosixError, "Tcl_PosixError");

   procedure Tcl_Preserve (
      data            : ClientData
   );
   pragma Import (C, Tcl_Preserve, "Tcl_Preserve");

   procedure Tcl_PrintDouble (
      interp          : Tcl_Interp;
      value           : C.Double;
      dst             : C.Strings.Chars_Ptr
   );
   pragma Import (C, Tcl_PrintDouble, "Tcl_PrintDouble");

   function Tcl_PutEnv (
      strng           : C.Strings.Chars_Ptr
   ) return C.Int;
   pragma Import (C, Tcl_PutEnv, "Tcl_PutEnv");

   procedure Tcl_QueueEvent (
      evPtr           : Tcl_Event;
      position        : Tcl_QueuePosition
   );
   pragma Import (C, Tcl_QueueEvent, "Tcl_QueueEvent");

   function Tcl_Read (
      chan            : Tcl_Channel;
      bufPtr          : C.Strings.Chars_Ptr;
      toRead          : C.Int
   ) return C.Int;
   pragma Import (C, Tcl_Read, "Tcl_Read");

   procedure Tcl_ReapDetachedProcs;
   pragma Import (C, Tcl_ReapDetachedProcs, "Tcl_ReapDetachedProcs");

   function Tcl_RecordAndEval (
      interp          : Tcl_Interp;
      cmd             : C.Strings.Chars_Ptr;
      flags           : C.Int
   ) return C.Int;
   pragma Import (C, Tcl_RecordAndEval, "Tcl_RecordAndEval");

   function Tcl_RegExpCompile (
      interp          : Tcl_Interp;
      strng           : C.Strings.Chars_Ptr
   ) return Tcl_RegExp;
   pragma Import (C, Tcl_RegExpCompile, "Tcl_RegExpCompile");

   function Tcl_RegExpExec (
      interp          : Tcl_Interp;
      regexp          : Tcl_RegExp;
      strng           : C.Strings.Chars_Ptr;
      start           : C.Strings.Chars_Ptr
   ) return C.Int;
   pragma Import (C, Tcl_RegExpExec, "Tcl_RegExpExec");

   function Tcl_RegExpMatch (
      interp          : Tcl_Interp;
      strng           : C.Strings.Chars_Ptr;
      pattern         : C.Strings.Chars_Ptr
   ) return C.Int;
   pragma Import (C, Tcl_RegExpMatch, "Tcl_RegExpMatch");

   procedure Tcl_RegExpRange (
      regexp          : Tcl_RegExp;
      index           : C.Int;
      startPtr        : CArgv.Chars_Ptr_Ptr;
      endPtr          : CArgv.Chars_Ptr_Ptr
   );
   pragma Import (C, Tcl_RegExpRange, "Tcl_RegExpRange");

   procedure Tcl_RegisterChannel (
      interp          : Tcl_Interp;
      chan            : Tcl_Channel
   );
   pragma Import (C, Tcl_RegisterChannel, "Tcl_RegisterChannel");

   procedure Tcl_Release (
      data            : ClientData
   );
   pragma Import (C, Tcl_Release, "Tcl_Release");

   procedure Tcl_ResetResult (
      interp          : Tcl_Interp
   );
   pragma Import (C, Tcl_ResetResult, "Tcl_ResetResult");

   -- Tcl_Return is not implemented because its name conflicts with
   -- an enumeration literal.  Use Tcl_SetResult instead.

   function Tcl_ScanElement (
      strng           : C.Strings.Chars_Ptr;
      flagPtr         : access C.Int
   ) return C.Int;
   pragma Import (C, Tcl_ScanElement, "Tcl_ScanElement");

   function Tcl_Seek (
      chan            : Tcl_Channel;
      offset          : C.Int;
      mode            : C.Int
   ) return C.Int;
   pragma Import (C, Tcl_Seek, "Tcl_Seek");

   procedure Tcl_SetAssocData (
      interp          : Tcl_Interp;
      name            : C.Strings.Chars_Ptr;
      proc            : Tcl_InterpDeleteProc;
      data            : ClientData
   );
   pragma Import (C, Tcl_SetAssocData, "Tcl_SetAssocData");

   procedure Tcl_SetChannelBufferSize (
      chan            : Tcl_Channel;
      sz              : C.Int
   );
   pragma Import (C, Tcl_SetChannelBufferSize, "Tcl_SetChannelBufferSize");

   function Tcl_SetChannelOption (
      interp          : Tcl_Interp;
      chan            : Tcl_Channel;
      optionName      : C.Strings.Chars_Ptr;
      newValue        : C.Strings.Chars_Ptr
   ) return C.Int;
   pragma Import (C, Tcl_SetChannelOption, "Tcl_SetChannelOption");

   function Tcl_SetCommandInfo (
      interp          : Tcl_Interp;
      cmdName         : C.Strings.Chars_Ptr;
      infoPtr         : Tcl_CmdInfo
   ) return C.Int;
   pragma Import (C, Tcl_SetCommandInfo, "Tcl_SetCommandInfo");

   procedure Tcl_SetErrno (
      err             : C.Int
   );
   pragma Import (C, Tcl_SetErrno, "Tcl_SetErrno");

   procedure Tcl_SetErrorCode (
      interp          : Tcl_Interp;
      String1         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr;
      String2         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr;
      String3         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr;
      String4         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr;
      String5         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr;
      String6         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr;
      String7         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr;
      String8         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr;
      String9         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr
   );
   pragma Import (C, Tcl_SetErrorCode, "Tcl_SetErrorCode");

   procedure Tcl_SetMaxBlockTime (
      timePtr         : Tcl_Time
   );
   pragma Import (C, Tcl_SetMaxBlockTime, "Tcl_SetMaxBlockTime");

   procedure Tcl_SetNotifierData (
      file            : Tcl_File;
      freeProcPtr     : Tcl_FileFreeProc;
      data            : ClientData
   );
   pragma Import (C, Tcl_SetNotifierData, "Tcl_SetNotifierData");

   type Tcl_PanicProc is access procedure (
      format          : C.Strings.Chars_Ptr;
      String1         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr;
      String2         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr;
      String3         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr;
      String4         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr;
      String5         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr;
      String6         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr;
      String7         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr;
      String8         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr;
      String9         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr
   );
   pragma Convention (C, Tcl_PanicProc);

   procedure Tcl_SetPanicProc (
      panicProc       : Tcl_PanicProc
   );
   pragma Import (C, Tcl_SetPanicProc, "Tcl_SetPanicProc");

   function Tcl_SetRecursionLimit (
      interp          : Tcl_Interp;
      depth           : C.Int
   ) return C.Int;
   pragma Import (C, Tcl_SetRecursionLimit, "Tcl_SetRecursionLimit");

   procedure Tcl_SetResult (
      interp          : Tcl_Interp;
      strng           : C.Strings.Chars_Ptr;
      freeProc        : Tcl_FreeProc
   );
   pragma Import (C, Tcl_SetResult, "Tcl_SetResult");

   procedure Tcl_SetResult (
      interp          : Tcl_Interp;
      strng           : C.Strings.Chars_Ptr;
      freeProc        : C.Int
   );
   pragma Import (C, Tcl_SetResult, "Tcl_SetResult");

   procedure Tcl_SetStdChannel (
      channel         : Tcl_Channel;
      typ             : C.Int
   );
   pragma Import (C, Tcl_SetStdChannel, "Tcl_SetStdChannel");

   function Tcl_SetVar (
      interp          : Tcl_Interp;
      varName         : C.Strings.Chars_Ptr;
      newValue        : C.Strings.Chars_Ptr;
      flags           : C.Int
   ) return C.Strings.Chars_Ptr;
   pragma Import (C, Tcl_SetVar, "Tcl_SetVar");

   function Tcl_SetVar2 (
      interp          : Tcl_Interp;
      part1           : C.Strings.Chars_Ptr;
      part2           : C.Strings.Chars_Ptr;
      newValue        : C.Strings.Chars_Ptr;
      flags           : C.Int
   ) return C.Strings.Chars_Ptr;
   pragma Import (C, Tcl_SetVar2, "Tcl_SetVar2");

   function Tcl_SignalId (
      sig             : C.Int
   ) return C.Strings.Chars_Ptr;
   pragma Import (C, Tcl_SignalId, "Tcl_SignalId");

   function Tcl_SignalMsg (
      sig             : C.Int
   ) return C.Strings.Chars_Ptr;
   pragma Import (C, Tcl_SignalMsg, "Tcl_SignalMsg");

   procedure Tcl_Sleep (
      ms              : C.Int
   );
   pragma Import (C, Tcl_Sleep, "Tcl_Sleep");

   procedure Tcl_SourceRCFile (
      interp          : Tcl_Interp
   );
   pragma Import (C, Tcl_SourceRCFile, "Tcl_SourceRCFile");

   function Tcl_SplitList (
      interp          : Tcl_Interp;
      list            : C.Strings.Chars_Ptr;
      argcPtr         : access C.Int;
      argvPtr         : access CArgv.Chars_Ptr_Ptr
   ) return C.Int;
   pragma Import (C, Tcl_SplitList, "Tcl_SplitList");

   procedure Tcl_SplitPath (
      path            : C.Strings.Chars_Ptr;
      argcPtr         : access C.Int;
      argvPtr         : access CArgv.Chars_Ptr_Ptr
   );
   pragma Import (C, Tcl_SplitPath, "Tcl_SplitPath");

   procedure Tcl_StaticPackage (
      interp          : Tcl_Interp;
      pkgName         : C.Strings.Chars_Ptr;
      initProc        : Tcl_PackageInitProc;
      safeInitProc    : Tcl_PackageInitProc
   );
   pragma Import (C, Tcl_StaticPackage, "Tcl_StaticPackage");

   function Tcl_StringMatch (
      strng           : C.Strings.Chars_Ptr;
      pattern         : C.Strings.Chars_Ptr
   ) return C.Int;
   pragma Import (C, Tcl_StringMatch, "Tcl_StringMatch");

   function Tcl_Tell (
      chan            : Tcl_Channel
   ) return C.Int;
   pragma Import (C, Tcl_Tell, "Tcl_Tell");

   function Tcl_TranslateFileName (
      interp          : Tcl_Interp;
      name            : C.Strings.Chars_Ptr;
      bufferPtr       : Tcl_DString
   ) return C.Strings.Chars_Ptr;
   pragma Import (C, Tcl_TranslateFileName, "Tcl_TranslateFileName");

   function Tcl_TildeSubst (
      interp          : Tcl_Interp;
      name            : C.Strings.Chars_Ptr;
      bufferPtr       : Tcl_DString
   ) return C.Strings.Chars_Ptr renames Tcl_TranslateFileName;

   procedure Tcl_TraceVar (
      interp          : Tcl_Interp;
      varName         : C.Strings.Chars_Ptr;
      flags           : C.Int;
      proc            : Tcl_VarTraceProc;
      data            : ClientData
   );
   pragma Import (C, Tcl_TraceVar, "Tcl_TraceVar");

   procedure Tcl_TraceVar2 (
      interp          : Tcl_Interp;
      part1           : C.Strings.Chars_Ptr;
      part2           : C.Strings.Chars_Ptr;
      flags           : C.Int;
      proc            : Tcl_VarTraceProc;
      data            : ClientData
   );
   pragma Import (C, Tcl_TraceVar2, "Tcl_TraceVar2");

   procedure Tcl_UnlinkVar (
      interp          : Tcl_Interp;
      varName         : C.Strings.Chars_Ptr
   );
   pragma Import (C, Tcl_UnlinkVar, "Tcl_UnlinkVar");

   function Tcl_UnregisterChannel (
      interp          : Tcl_Interp;
      chan            : Tcl_Channel
   ) return C.Int;
   pragma Import (C, Tcl_UnregisterChannel, "Tcl_UnregisterChannel");

   function Tcl_UnsetVar (
      interp          : Tcl_Interp;
      varName         : C.Strings.Chars_Ptr;
      flags           : C.Int
   ) return C.Int;
   pragma Import (C, Tcl_UnsetVar, "Tcl_UnsetVar");

   function Tcl_UnsetVar2 (
      interp          : Tcl_Interp;
      part1           : C.Strings.Chars_Ptr;
      part2           : C.Strings.Chars_Ptr;
      flags           : C.Int
   ) return C.Int;
   pragma Import (C, Tcl_UnsetVar2, "Tcl_UnsetVar2");

   procedure Tcl_UntraceVar (
      interp          : Tcl_Interp;
      varName         : C.Strings.Chars_Ptr;
      flags           : C.Int;
      proc            : Tcl_VarTraceProc;
      data            : ClientData
   );
   pragma Import (C, Tcl_UntraceVar, "Tcl_UntraceVar");

   procedure Tcl_UntraceVar2 (
      interp          : Tcl_Interp;
      part1           : C.Strings.Chars_Ptr;
      part2           : C.Strings.Chars_Ptr;
      flags           : C.Int;
      proc            : Tcl_VarTraceProc;
      data            : ClientData
   );
   pragma Import (C, Tcl_UntraceVar2, "Tcl_UntraceVar2");

   procedure Tcl_UpdateLinkedVar (
      interp          : Tcl_Interp;
      varName         : C.Strings.Chars_Ptr
   );
   pragma Import (C, Tcl_UpdateLinkedVar, "Tcl_UpdateLinkedVar");

   function Tcl_UpVar (
      interp          : Tcl_Interp;
      frameName       : C.Strings.Chars_Ptr;
      varName         : C.Strings.Chars_Ptr;
      localName       : C.Strings.Chars_Ptr;
      flags           : C.Int
   ) return C.Int;
   pragma Import (C, Tcl_UpVar, "Tcl_UpVar");

   function Tcl_UpVar2 (
      interp          : Tcl_Interp;
      frameName       : C.Strings.Chars_Ptr;
      part1           : C.Strings.Chars_Ptr;
      part2           : C.Strings.Chars_Ptr;
      localName       : C.Strings.Chars_Ptr;
      flags           : C.Int
   ) return C.Int;
   pragma Import (C, Tcl_UpVar2, "Tcl_UpVar2");

   function Tcl_VarEval (
      interp          : Tcl_Interp;
      String1         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr;
      String2         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr;
      String3         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr;
      String4         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr;
      String5         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr;
      String6         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr;
      String7         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr;
      String8         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr;
      String9         : C.Strings.Chars_Ptr := C.Strings.Null_Ptr
   ) return C.Int;
   pragma Import (C, Tcl_VarEval, "Tcl_VarEval");

   function Tcl_VarTraceInfo (
      interp          : Tcl_Interp;
      varName         : C.Strings.Chars_Ptr;
      flags           : C.Int;
      procPtr         : Tcl_VarTraceProc;
      prevclientdata  : ClientData
   ) return ClientData;
   pragma Import (C, Tcl_VarTraceInfo, "Tcl_VarTraceInfo");

   function Tcl_VarTraceInfo2 (
      interp          : Tcl_Interp;
      part1           : C.Strings.Chars_Ptr;
      part2           : C.Strings.Chars_Ptr;
      flags           : C.Int;
      procPtr         : Tcl_VarTraceProc;
      prevclientdata  : ClientData
   ) return ClientData;
   pragma Import (C, Tcl_VarTraceInfo2, "Tcl_VarTraceInfo2");

   function Tcl_WaitForEvent (
      timePtr         : Tcl_Time
   ) return C.Int;
   pragma Import (C, Tcl_WaitForEvent, "Tcl_WaitForEvent");

   function Tcl_WaitPid (
      pid             : C.Int;
      statPtr         : access C.Int;
      options         : C.Int
   ) return C.Int;
   pragma Import (C, Tcl_WaitPid, "Tcl_WaitPid");

   procedure Tcl_WatchFile (
      file            : Tcl_File;
      mask            : C.Int
   );
   pragma Import (C, Tcl_WatchFile, "Tcl_WatchFile");

   function Tcl_Write (
      chan            : Tcl_Channel;
      s               : C.Strings.Chars_Ptr;
      slen            : C.Int
   ) return C.Int;
   pragma Import (C, Tcl_Write, "Tcl_Write");

   function Tcl_GetResult (
      interp          : Tcl_Interp
   ) return C.Strings.Chars_Ptr;
   pragma Import (C, Tcl_GetResult, "Tcl_GetResult");

   function Tcl_GetErrorLine (
      interp          : Tcl_Interp
   ) return C.Int;
   pragma Import (C, Tcl_GetErrorLine, "Tcl_GetErrorLine");


private

   type Tcl_AsyncHandler_rec is null record;
   type Tcl_AsyncHandler is access all Tcl_AsyncHandler_rec;
   pragma Convention (C, Tcl_AsyncHandler);

   type Tcl_AsyncHandler_array is array (C.size_t range <>) of Tcl_AsyncHandler;

   type Tcl_Channel_rec is null record;
   type Tcl_Channel is access all Tcl_Channel_rec;
   pragma Convention (C, Tcl_Channel);

   type Tcl_Channel_array is array (C.size_t range <>) of Tcl_Channel;

   type Tcl_ChannelType_rec is
      record
         typeName        : C.Strings.Chars_Ptr;
         -- The name of the channel type in Tcl
         -- commands. This storage is owned by
         -- channel type. 
         blockModeProc   : Tcl_DriverBlockModeProc;
         -- Set blocking mode for the
         -- raw channel. May be NULL. 
         closeProc       : Tcl_DriverCloseProc;
         -- Procedure to call to close
         -- the channel. 
         inputProc       : Tcl_DriverInputProc;
         -- Procedure to call for input
         -- on channel. 
         outputProc      : Tcl_DriverOutputProc;
         -- Procedure to call for output
         -- on channel. 
         seekProc        : Tcl_DriverSeekProc;
         -- Procedure to call to seek
         -- on the channel. May be NULL. 
         setOptionProc   : Tcl_DriverSetOptionProc;
         -- Set an option on a channel. 
         getOptionProc   : Tcl_DriverGetOptionProc;
         -- Get an option from a channel. 
         watchChannelProc : Tcl_DriverWatchChannelProc;
         -- Set up the notifier to watch
         -- for events on this channel. 
         channelReadyProc : Tcl_DriverChannelReadyProc;
         -- Check for events of interest on
         -- this channel. 
         getFileProc     : Tcl_DriverGetFileProc;
         -- Get a Tcl_File from the channel
         -- or NULL if not supported. 
      end record;

   type Tcl_CmdInfo_rec is
      record
         proc            : Tcl_CmdProc;
         -- Procedure to implement command. 
         data            : ClientData;
         -- ClientData passed to proc. 
         deleteProc      : Tcl_CmdDeleteProc;
         -- Procedure to call when command
         -- is deleted. 
         deletedata      : ClientData;
         -- Value to pass to deleteProc {usually
         -- the same as clientData}. 
      end record;

   type Tcl_Command_rec is null record;
   type Tcl_Command is access all Tcl_Command_rec;
   pragma Convention (C, Tcl_Command);

   type Tcl_Command_array is array (C.size_t range <>) of Tcl_Command;

   type Tcl_DString_rec is
      record
         strng           : C.Strings.Chars_Ptr;
         -- Points to beginning of string:  either
         -- staticSpace below or a malloc'ed array. 
         length          : C.Int;
         -- Number of non-NULL characters in the
         -- string. 
         spaceAvl        : C.Int;
         -- Total number of bytes available for the
         -- string and its terminating NULL char. 
         staticSpace     : C.Char_Array(0..TCL_DSTRING_STATIC_SIZE-1);
         -- Space to use in common case where string
         -- is small. 
      end record;

   type Tcl_Event_rec is null record;
   type Tcl_Event is access all Tcl_Event_rec;
   pragma Convention (C, Tcl_Event);

   type Tcl_Event_array is array (C.size_t range <>) of Tcl_Event;

   type Tcl_File_rec is null record;
   type Tcl_File is access all Tcl_File_rec;
   pragma Convention (C, Tcl_File);

   type Tcl_File_array is array (C.size_t range <>) of Tcl_File;

   type Tcl_HashEntry_rec is null record;
   type Tcl_HashEntry is access all Tcl_HashEntry_rec;
   pragma Convention (C, Tcl_HashEntry);

   type Tcl_HashEntry_array is array (C.size_t range <>) of Tcl_HashEntry;

   type Tcl_HashSearch_rec is
      record
         tablePtr        : Tcl_HashTable;
         -- Table being searched. 
         nextIndex       : C.Int;
         -- Index of next bucket to be
         -- enumerated after present one. 
         nextEntryPtr    : Tcl_HashEntry;
         -- Next entry to be enumerated in the
         -- the current bucket. 
      end record;

   type Tcl_HashTable_rec is
      record
         buckets         : Tcl_HashEntry;
         -- Pointer to bucket array.  Each
         -- element points to first entry in
         -- bucket's hash chain, or NULL. 
         staticBuckets   : Tcl_HashEntry_array(0..TCL_SMALL_HASH_TABLE-1);
         -- Bucket array used for small tables
         -- {to avoid mallocs and frees}. 
         numBuckets      : C.Int;
         -- Total number of buckets allocated
         -- at **bucketPtr. 
         numEntries      : C.Int;
         -- Total number of entries present
         -- in table. 
         rebuildSize     : C.Int;
         -- Enlarge table when numEntries gets
         -- to be this large. 
         downShift       : C.Int;
         -- Shift count used in hashing
         -- function.  Designed to use high-
         -- order bits of randomized keys. 
         mask            : C.Int;
         -- Mask value used in hashing
         -- function. 
         keyType         : C.Int;
         -- Type of keys used in this table. 
         -- It's either TCL_STRING_KEYS,
         -- TCL_ONE_WORD_KEYS, or an integer
         -- giving the number of ints that
         -- is the size of the key.
         -- 
         findProc        : Tcl_HashEntry;
         createProc      : Tcl_HashEntry;
      end record;

   type Tcl_Interp_rec is null record;
   type Tcl_Interp is access all Tcl_Interp_rec;
   pragma Convention (C, Tcl_Interp);

   type Tcl_Interp_array is array (C.size_t range <>) of Tcl_Interp;

   type Tcl_RegExp_rec is null record;
   type Tcl_RegExp is access all Tcl_RegExp_rec;
   pragma Convention (C, Tcl_RegExp);

   type Tcl_RegExp_array is array (C.size_t range <>) of Tcl_RegExp;

   type Tcl_Time_rec is
      record
         sec             : C.Long;
         -- Seconds. 
         usec            : C.Long;
         -- Microseconds. 
      end record;

   type Tcl_TimerToken_rec is null record;
   type Tcl_TimerToken is access all Tcl_TimerToken_rec;
   pragma Convention (C, Tcl_TimerToken);

   type Tcl_TimerToken_array is array (C.size_t range <>) of Tcl_TimerToken;

   type Tcl_Trace_rec is null record;
   type Tcl_Trace is access all Tcl_Trace_rec;
   pragma Convention (C, Tcl_Trace);

   type Tcl_Trace_array is array (C.size_t range <>) of Tcl_Trace;

   type Tcl_Value_rec is
      record
         typ             : Tcl_ValueType;
         -- Indicates intValue or doubleValue is
         -- valid, or both. 
         intValue        : C.Long;
         -- Integer value. 
         doubleValue     : C.Double;
         -- Double-precision floating value. 
      end record;


end Tcl;