/*
* 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.285 97/01/29 13:04:49
*/
#ifndef _TCL
#define _TCL
#include <ast.h>
/*
* When version numbers change here, must also go into the following files
* and update the version numbers:
*
*
* The release level should be 0 for alpha, 1 for beta, and 2 for
* "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).
*/
/*
* The following definitions set up the proper options for Windows
* compilers. We use this method because there is no autoconf equivalent.
*/
#if !defined(_UWIN) && !defined(__CYGWIN__) && (defined(__WIN32__) || defined(_WIN32) || defined(WIN32))
#endif
#ifdef WIN_TCL
# ifndef STRICT
# define STRICT
# endif
# ifndef USE_PROTOTYPE
# endif
# ifndef HAS_STDARG
# endif
# ifndef USE_PROTOTYPE
# endif
# ifndef USE_TCLALLOC
# endif
# ifndef STRINGIFY
# define STRINGIFY1(x) #x
# endif
#endif /* WIN_TCL */
/*
* The following definitions set up the proper options for Macintosh
* compilers. We use this method because there is no autoconf equivalent.
*/
#ifdef MAC_TCL
# ifndef HAS_STDARG
# endif
# ifndef USE_TCLALLOC
# endif
# ifndef NO_STRERROR
# endif
#endif
/*
* 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.
*/
#ifndef RESOURCE_INCLUDED
#ifndef BUFSIZ
#include <stdio.h>
#endif
/*
* Definitions that allow Tcl functions with variable numbers of
* 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.
*/
#if defined(__STDC__) || defined(HAS_STDARG)
#else
# ifdef __cplusplus
# else
# endif
#endif
/*
* Definitions that allow this header file to be used either with or
* without ANSI C features like function prototypes.
*/
#if ((defined(__STDC__) || defined(SABER)) && !defined(NO_PROTOTYPE)) || defined(__cplusplus) || defined(USE_PROTOTYPE)
# define _ANSI_ARGS_(x) x
# define CONST const
#else
# define _ANSI_ARGS_(x) ()
# define CONST
#endif
#if _BLD_tcl && defined(__EXPORT__)
#define extern __EXPORT__
#endif
#ifdef __cplusplus
#else
# define EXTERN extern
#endif
/*
* 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.
*/
#ifndef WIN_TCL
#ifndef VOID
# ifdef __STDC__
# define VOID void
# else
# define VOID char
# endif
#endif
#else /* WIN_TCL */
/*
* The following code is copied from winnt.h
*/
#ifndef VOID
#define VOID void
typedef char CHAR;
typedef short SHORT;
typedef long LONG;
#endif
#endif /* WIN_TCL */
/*
* Miscellaneous declarations.
*/
#ifndef NULL
#define NULL 0
#endif
#ifndef _CLIENTDATA
# if defined(__STDC__) || defined(__cplusplus)
typedef void *ClientData;
# else
typedef int *ClientData;
# endif /* __STDC__ */
#define _CLIENTDATA
#endif
/*
* 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.
*/
typedef struct Tcl_Interp{
* command. */
/* Zero means result is statically allocated.
* TCL_DYNAMIC means result was allocated with
* ckalloc and should be freed with ckfree.
* Other values give address of procedure
* to invoke to free the result. Must be
* freed by Tcl_Eval before executing next
* command. */
* the line number within the command where
* the error occurred (1 means first line). */
} Tcl_Interp;
/*
* 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.
*/
#define TCL_OK 0
/*
* Argument descriptors for math function callbacks in expressions:
*/
typedef struct Tcl_Value {
* valid, or both. */
} Tcl_Value;
/*
* Procedure types defined by Tcl:
*/
int flags));
int flags));
Tcl_Interp *interp));
/*
* The structure returned by Tcl_GetCmdInfo and passed into
* Tcl_SetCmdInfo:
*/
typedef struct Tcl_CmdInfo {
* is deleted. */
* the same as clientData). */
} Tcl_CmdInfo;
/*
* 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.
*/
typedef struct Tcl_DString {
* staticSpace below or a malloc'ed array. */
* string. */
* string and its terminating NULL char. */
/* Space to use in common case where string
* is small. */
} Tcl_DString;
/*
* 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.
*/
/*
* 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).
*/
/*
* Flag values passed to Tcl_RecordAndEval.
* WARNING: these bit choices must not conflict with the bit choices
* for evalFlag bits in tclInt.h!!
*/
/*
* Special freeProc values that may be passed to Tcl_SetResult (see
* the man page for details):
*/
/*
* Flag values passed to variable-related procedures.
*/
/*
* Types for linked variables:
*/
/*
* 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.
*/
unsigned int size));
#ifdef TCL_MEM_DEBUG
int line));
#else
# if USE_TCLALLOC
# else
# endif
# define Tcl_DumpActiveMemory(x)
# define Tcl_ValidateAllMemory(x,y)
#endif /* TCL_MEM_DEBUG */
/*
* Macro to free result of interpreter.
*/
} else { \
} \
}
/*
* 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.
*/
#ifdef __cplusplus
struct Tcl_HashTable;
#endif
/*
* 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.
*/
typedef struct Tcl_HashEntry {
* hash bucket, or NULL for end of
* chain. */
* first entry in this entry's chain:
* used for deleting the entry. */
* with Tcl_SetHashValue. */
union { /* Key has one of these forms: */
* The actual size will be as large
* as necessary for this table's
* keys. */
* will be as large as needed to hold
* the key. */
/*
* 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.
*/
typedef struct Tcl_HashTable {
* element points to first entry in
* bucket's hash chain, or NULL. */
/* Bucket array used for small tables
* (to avoid mallocs and frees). */
* at **bucketPtr. */
* in table. */
* to be this large. */
* function. Designed to use high-
* order bits of randomized keys. */
* function. */
* 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.
*/
char *key));
/*
* Structure definition for information used to keep track of searches
* through hash tables:
*/
typedef struct Tcl_HashSearch {
* enumerated after present one. */
* the current bucket. */
/*
* Acceptable key types for hash tables:
*/
#define TCL_STRING_KEYS 0
/*
* Macros for clients to use to access fields of hash entries:
*/
/*
* Macros to use for clients to use to invoke find and create procedures
* for hash tables:
*/
/*
* Flag values to pass to Tcl_DoOneEvent to disable searches
* for some kinds of events:
*/
/*
* 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.
*/
struct Tcl_Event {
};
/*
* Positions to pass to Tk_QueueEvent:
*/
typedef enum {
/*
* 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.
*/
typedef struct Tcl_Time {
} Tcl_Time;
/*
* Bits to pass to Tcl_CreateFileHandler and Tcl_CreateChannelHandler
* to indicate what sorts of events are of interest:
*/
/*
* 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.
*/
/*
* Typedefs for the various operations in a channel type:
*/
int mode));
Tcl_Interp *interp));
char *optionName, char *value));
Tcl_DString *dsPtr));
int mask));
/*
* Enum for different end of line translation and recognition modes.
*/
typedef enum Tcl_EolTranslation {
/*
* 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.
*/
typedef struct Tcl_ChannelType {
* commands. This storage is owned by
* channel type. */
/* Set blocking mode for the
* raw channel. May be NULL. */
* the channel. */
* on channel. */
* on channel. */
* on the channel. May be NULL. */
/* Set an option on a channel. */
/* Get an option from a channel. */
/* Set up the notifier to watch
* for events on this channel. */
/* Check for events of interest on
* this channel. */
* or NULL if not supported. */
/*
* 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.
*/
* mode. */
/*
* Types for file handles:
*/
/*
* Enum for different types of file paths.
*/
typedef enum Tcl_PathType {
} Tcl_PathType;
/*
* The following interface is exported for backwards compatibility, but
* is only implemented on Unix. Portable applications should use
* Tcl_OpenCommandChannel, instead.
*/
int *inPipePtr, int *outPipePtr,
int *errFilePtr));
/*
* Exported Tcl procedures:
*/
char *message));
char *string));
int code));
int *readPtr));
Tcl_Channel chan));
char *name));
char *cmdName));
Tcl_DString *dsPtr));
Tcl_DString *dsPtr));
int length));
Tcl_DString *dsPtr));
char *fileName));
Tcl_FreeProc *freeProc));
char *string));
int mask));
char **targetCmdPtr, int *argcPtr,
char ***argvPtr));
Tcl_Channel chan));
int direction));
Tcl_Channel chan));
int type));
int *typePtr));
ClientData *filePtr));
Tcl_DString *dsPtr));
char *slaveName));
char *command));
int keyType));
Tcl_DString *resultPtr));
int flags));
char *fileName, char *modeString,
int permissions));
char *string));
Tcl_Channel chan));
int *flagPtr));
char *optionName, char *newValue));
int depth));
int type));
int flags));
char *pattern));
char *varName));
Tcl_Channel chan));
char *varName));
int options));
int mask));
char *s, int slen));
#endif /* RESOURCE_INCLUDED */
#undef extern
#endif /* _TCL */