summaryrefslogtreecommitdiffstats
path: root/generic/tcl.h
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tcl.h')
-rw-r--r--generic/tcl.h332
1 files changed, 49 insertions, 283 deletions
diff --git a/generic/tcl.h b/generic/tcl.h
index b93b3ac..b773e33 100644
--- a/generic/tcl.h
+++ b/generic/tcl.h
@@ -53,30 +53,15 @@ extern "C" {
* tools/tcl.hpj.in (not patchlevel, for windows installer)
*/
-#define TCL_MAJOR_VERSION 8
-#define TCL_MINOR_VERSION 6
-#define TCL_RELEASE_LEVEL TCL_FINAL_RELEASE
-#define TCL_RELEASE_SERIAL 1
+#define TCL_MAJOR_VERSION 9
+#define TCL_MINOR_VERSION 0
+#define TCL_RELEASE_LEVEL TCL_ALPHA_RELEASE
+#define TCL_RELEASE_SERIAL 0
-#define TCL_VERSION "8.6"
-#define TCL_PATCH_LEVEL "8.6.1"
+#define TCL_VERSION "9.0"
+#define TCL_PATCH_LEVEL "9.0a0"
/*
- *----------------------------------------------------------------------------
- * The following definitions set up the proper options for Windows compilers.
- * We use this method because there is no autoconf equivalent.
- */
-
-#ifdef _WIN32
-# ifndef __WIN32__
-# define __WIN32__
-# endif
-# ifndef WIN32
-# define WIN32
-# endif
-#endif
-
-/*
* STRICT: See MSDN Article Q83456
*/
@@ -87,20 +72,6 @@ extern "C" {
#endif /* _WIN32 */
/*
- * Utility macros: STRINGIFY takes an argument and wraps it in "" (double
- * quotation marks), JOIN joins two arguments.
- */
-
-#ifndef STRINGIFY
-# define STRINGIFY(x) STRINGIFY1(x)
-# define STRINGIFY1(x) #x
-#endif
-#ifndef JOIN
-# define JOIN(a,b) JOIN1(a,b)
-# define JOIN1(a,b) a##b
-#endif
-
-/*
* A special definition used to allow this header file to be included from
* windows resource files so that they can obtain version information.
* RC_INVOKED is defined by default by the windows RC tool.
@@ -146,11 +117,6 @@ extern "C" {
*/
#include <stdarg.h>
-#ifndef TCL_NO_DEPRECATED
-# define TCL_VARARGS(type, name) (type name, ...)
-# define TCL_VARARGS_DEF(type, name) (type name, ...)
-# define TCL_VARARGS_START(type, name, list) (va_start(list, name), name)
-#endif
#if defined(__GNUC__) && (__GNUC__ > 2)
# define TCL_FORMAT_PRINTF(a,b) __attribute__ ((__format__ (__printf__, a, b)))
#else
@@ -229,123 +195,17 @@ extern "C" {
* be reset to DLLIMPORT.
*/
-#undef TCL_STORAGE_CLASS
#ifdef BUILD_tcl
-# define TCL_STORAGE_CLASS DLLEXPORT
+# define TCLAPI extern DLLEXPORT
#else
-# ifdef USE_TCL_STUBS
-# define TCL_STORAGE_CLASS
-# else
-# define TCL_STORAGE_CLASS DLLIMPORT
-# endif
-#endif
-
-/*
- * The following _ANSI_ARGS_ macro is to support old extensions
- * written for older versions of Tcl where it permitted support
- * for compilers written in the pre-prototype era of C.
- *
- * New code should use prototypes.
- */
-
-#ifndef TCL_NO_DEPRECATED
-# undef _ANSI_ARGS_
-# define _ANSI_ARGS_(x) x
-#endif
-
-/*
- * Definitions that allow this header file to be used either with or without
- * ANSI C features.
- */
-
-#ifndef INLINE
-# define INLINE
-#endif
-
-#ifdef NO_CONST
-# ifndef const
-# define const
-# endif
-#endif
-#ifndef CONST
-# define CONST const
-#endif
-
-#ifdef USE_NON_CONST
-# ifdef USE_COMPAT_CONST
-# error define at most one of USE_NON_CONST and USE_COMPAT_CONST
-# endif
-# define CONST84
-# define CONST84_RETURN
-#else
-# ifdef USE_COMPAT_CONST
-# define CONST84
-# define CONST84_RETURN const
-# else
-# define CONST84 const
-# define CONST84_RETURN const
-# endif
-#endif
-
-#ifndef CONST86
-# define CONST86 CONST84
-#endif
-
-/*
- * Make sure EXTERN isn't defined elsewhere.
- */
-
-#ifdef EXTERN
-# undef EXTERN
-#endif /* EXTERN */
-
-#ifdef __cplusplus
-# define EXTERN extern "C" TCL_STORAGE_CLASS
-#else
-# define EXTERN extern TCL_STORAGE_CLASS
-#endif
-
-/*
- *----------------------------------------------------------------------------
- * The following code is copied from winnt.h. If we don't replicate it here,
- * then <windows.h> can't be included after tcl.h, since tcl.h also defines
- * VOID. This block is skipped under Cygwin and Mingw.
- */
-
-#if defined(_WIN32) && !defined(HAVE_WINNT_IGNORE_VOID)
-#ifndef VOID
-#define VOID void
-typedef char CHAR;
-typedef short SHORT;
-typedef long LONG;
-#endif
-#endif /* _WIN32 && !HAVE_WINNT_IGNORE_VOID */
-
-/*
- * 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 __VXWORKS__
-# ifndef NO_VOID
-# define VOID void
-# else
-# define VOID char
-# endif
+# define TCLAPI extern DLLIMPORT
#endif
/*
* Miscellaneous declarations.
*/
-#ifndef _CLIENTDATA
-# ifndef NO_VOID
- typedef void *ClientData;
-# else
- typedef int *ClientData;
-# endif
-# define _CLIENTDATA
-#endif
+typedef void *ClientData;
/*
* Darwin specific configure overrides (to support fat compiles, where
@@ -497,39 +357,7 @@ typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt;
* accessed with Tcl_GetObjResult() and Tcl_SetObjResult().
*/
-typedef struct Tcl_Interp
-#ifndef TCL_NO_DEPRECATED
-{
- /* TIP #330: Strongly discourage extensions from using the string
- * result. */
-#ifdef USE_INTERP_RESULT
- char *result TCL_DEPRECATED_API("use Tcl_GetStringResult/Tcl_SetResult");
- /* If the last command returned a string
- * result, this points to it. */
- void (*freeProc) (char *blockPtr)
- TCL_DEPRECATED_API("use Tcl_GetStringResult/Tcl_SetResult");
- /* Zero means the string result is statically
- * allocated. TCL_DYNAMIC means it was
- * allocated with ckalloc and should be freed
- * with ckfree. Other values give the address
- * of function to invoke to free the result.
- * Tcl_Eval must free it before executing next
- * command. */
-#else
- char *resultDontUse; /* Don't use in extensions! */
- void (*freeProcDontUse) (char *); /* Don't use in extensions! */
-#endif
-#ifdef USE_INTERP_ERRORLINE
- int errorLine TCL_DEPRECATED_API("use Tcl_GetErrorLine/Tcl_SetErrorLine");
- /* When TCL_ERROR is returned, this gives the
- * line number within the command where the
- * error occurred (1 if first line). */
-#else
- int errorLineDontUse; /* Don't use in extensions! */
-#endif
-}
-#endif /* TCL_NO_DEPRECATED */
-Tcl_Interp;
+typedef struct Tcl_Interp Tcl_Interp;
typedef struct Tcl_AsyncHandler_ *Tcl_AsyncHandler;
typedef struct Tcl_Channel_ *Tcl_Channel;
@@ -678,8 +506,6 @@ typedef struct stat *Tcl_OldStat_;
#define TCL_BREAK 3
#define TCL_CONTINUE 4
-#define TCL_RESULT_SIZE 200
-
/*
*----------------------------------------------------------------------------
* Flags to control what substitutions are performed by Tcl_SubstObj():
@@ -691,28 +517,14 @@ typedef struct stat *Tcl_OldStat_;
#define TCL_SUBST_ALL 007
/*
- * Argument descriptors for math function callbacks in expressions:
- */
-
-typedef enum {
- TCL_INT, TCL_DOUBLE, TCL_EITHER, TCL_WIDE_INT
-} Tcl_ValueType;
-
-typedef struct Tcl_Value {
- Tcl_ValueType type; /* Indicates intValue or doubleValue is valid,
- * or both. */
- long intValue; /* Integer value. */
- double doubleValue; /* Double-precision floating value. */
- Tcl_WideInt wideValue; /* Wide (min. 64-bit) integer value. */
-} Tcl_Value;
-
-/*
* Forward declaration of Tcl_Obj to prevent an error when the forward
* reference to Tcl_Obj is encountered in the function types declared below.
*/
struct Tcl_Obj;
+typedef struct Tcl_Obj Tcl_Value;
+
/*
*----------------------------------------------------------------------------
* Function types defined by Tcl:
@@ -725,10 +537,10 @@ typedef void (Tcl_ChannelProc) (ClientData clientData, int mask);
typedef void (Tcl_CloseProc) (ClientData data);
typedef void (Tcl_CmdDeleteProc) (ClientData clientData);
typedef int (Tcl_CmdProc) (ClientData clientData, Tcl_Interp *interp,
- int argc, CONST84 char *argv[]);
+ int argc, const char *argv[]);
typedef void (Tcl_CmdTraceProc) (ClientData clientData, Tcl_Interp *interp,
int level, char *command, Tcl_CmdProc *proc,
- ClientData cmdClientData, int argc, CONST84 char *argv[]);
+ ClientData cmdClientData, int argc, const char *argv[]);
typedef int (Tcl_CmdObjTraceProc) (ClientData clientData, Tcl_Interp *interp,
int level, const char *command, Tcl_Command commandInfo, int objc,
struct Tcl_Obj *const *objv);
@@ -751,8 +563,6 @@ typedef void (Tcl_FreeProc) (char *blockPtr);
typedef void (Tcl_IdleProc) (ClientData clientData);
typedef void (Tcl_InterpDeleteProc) (ClientData clientData,
Tcl_Interp *interp);
-typedef int (Tcl_MathProc) (ClientData clientData, Tcl_Interp *interp,
- Tcl_Value *args, Tcl_Value *resultPtr);
typedef void (Tcl_NamespaceDeleteProc) (ClientData clientData);
typedef int (Tcl_ObjCmdProc) (ClientData clientData, Tcl_Interp *interp,
int objc, struct Tcl_Obj *const *objv);
@@ -765,7 +575,7 @@ typedef void (Tcl_TimerProc) (ClientData clientData);
typedef int (Tcl_SetFromAnyProc) (Tcl_Interp *interp, struct Tcl_Obj *objPtr);
typedef void (Tcl_UpdateStringProc) (struct Tcl_Obj *objPtr);
typedef char * (Tcl_VarTraceProc) (ClientData clientData, Tcl_Interp *interp,
- CONST84 char *part1, CONST84 char *part2, int flags);
+ const char *part1, const char *part2, int flags);
typedef void (Tcl_CommandTraceProc) (ClientData clientData, Tcl_Interp *interp,
const char *oldName, const char *newName, int flags);
typedef void (Tcl_CreateFileHandlerProc) (int fd, int mask, Tcl_FileProc *proc,
@@ -862,20 +672,11 @@ int Tcl_IsShared(Tcl_Obj *objPtr);
/*
*----------------------------------------------------------------------------
- * The following structure contains the state needed by Tcl_SaveResult. No-one
- * outside of Tcl should access any of these fields. This structure is
- * typically allocated on the stack.
+ * The following type contains the state needed by Tcl_SaveResult. This
+ * structure is typically allocated on the stack.
*/
-typedef struct Tcl_SavedResult {
- char *result;
- Tcl_FreeProc *freeProc;
- Tcl_Obj *objResultPtr;
- char *appendResult;
- int appendAvl;
- int appendUsed;
- char resultSpace[TCL_RESULT_SIZE+1];
-} Tcl_SavedResult;
+typedef Tcl_Obj *Tcl_SavedResult;
/*
*----------------------------------------------------------------------------
@@ -1000,7 +801,6 @@ typedef struct Tcl_DString {
#define Tcl_DStringLength(dsPtr) ((dsPtr)->length)
#define Tcl_DStringValue(dsPtr) ((dsPtr)->string)
-#define Tcl_DStringTrunc Tcl_DStringSetLength
/*
* Definitions for the maximum number of digits of precision that may be
@@ -1120,17 +920,6 @@ typedef struct Tcl_DString {
#define TCL_ALLOW_INLINE_COMPILATION 0x20000
/*
- * The TCL_PARSE_PART1 flag is deprecated and has no effect. The part1 is now
- * always parsed whenever the part2 is NULL. (This is to avoid a common error
- * when converting code to use the new object based APIs and forgetting to
- * give the flag)
- */
-
-#ifndef TCL_NO_DEPRECATED
-# define TCL_PARSE_PART1 0x400
-#endif
-
-/*
* Types for linked variables:
*/
@@ -1413,8 +1202,8 @@ typedef struct Tcl_Time {
long usec; /* Microseconds. */
} Tcl_Time;
-typedef void (Tcl_SetTimerProc) (CONST86 Tcl_Time *timePtr);
-typedef int (Tcl_WaitForEventProc) (CONST86 Tcl_Time *timePtr);
+typedef void (Tcl_SetTimerProc) (const Tcl_Time *timePtr);
+typedef int (Tcl_WaitForEventProc) (const Tcl_Time *timePtr);
/*
* TIP #233 (Virtualized Time)
@@ -1488,14 +1277,14 @@ typedef int (Tcl_DriverClose2Proc) (ClientData instanceData,
typedef int (Tcl_DriverInputProc) (ClientData instanceData, char *buf,
int toRead, int *errorCodePtr);
typedef int (Tcl_DriverOutputProc) (ClientData instanceData,
- CONST84 char *buf, int toWrite, int *errorCodePtr);
+ const char *buf, int toWrite, int *errorCodePtr);
typedef int (Tcl_DriverSeekProc) (ClientData instanceData, long offset,
int mode, int *errorCodePtr);
typedef int (Tcl_DriverSetOptionProc) (ClientData instanceData,
Tcl_Interp *interp, const char *optionName,
const char *value);
typedef int (Tcl_DriverGetOptionProc) (ClientData instanceData,
- Tcl_Interp *interp, CONST84 char *optionName,
+ Tcl_Interp *interp, const char *optionName,
Tcl_DString *dsPtr);
typedef void (Tcl_DriverWatchProc) (ClientData instanceData, int mask);
typedef int (Tcl_DriverGetHandleProc) (ClientData instanceData,
@@ -1686,7 +1475,7 @@ typedef int (Tcl_FSNormalizePathProc) (Tcl_Interp *interp, Tcl_Obj *pathPtr,
int nextCheckpoint);
typedef int (Tcl_FSFileAttrsGetProc) (Tcl_Interp *interp, int index,
Tcl_Obj *pathPtr, Tcl_Obj **objPtrRef);
-typedef const char *CONST86 * (Tcl_FSFileAttrStringsProc) (Tcl_Obj *pathPtr,
+typedef const char *const * (Tcl_FSFileAttrStringsProc) (Tcl_Obj *pathPtr,
Tcl_Obj **objPtrRef);
typedef int (Tcl_FSFileAttrsSetProc) (Tcl_Interp *interp, int index,
Tcl_Obj *pathPtr, Tcl_Obj *objPtr);
@@ -2376,9 +2165,6 @@ typedef int (Tcl_NRPostProc) (ClientData data[], Tcl_Interp *interp,
*----------------------------------------------------------------------------
* The following constant is used to test for older versions of Tcl in the
* stubs tables.
- *
- * Jan Nijtman's plus patch uses 0xFCA1BACF, so we need to pick a different
- * value since the stubs tables don't match.
*/
#define TCL_STUB_MAGIC ((int) 0xFCA3BACF)
@@ -2391,36 +2177,44 @@ typedef int (Tcl_NRPostProc) (ClientData data[], Tcl_Interp *interp,
*/
const char * Tcl_InitStubs(Tcl_Interp *interp, const char *version,
- int exact);
+ int exact, const char *tclversion, int magic);
const char * TclTomMathInitializeStubs(Tcl_Interp *interp,
const char *version, int epoch, int revision);
-/*
- * When not using stubs, make it a macro.
- */
-
-#ifndef USE_TCL_STUBS
+#ifdef USE_TCL_STUBS
+#if TCL_RELEASE_LEVEL == TCL_FINAL_RELEASE
+# define Tcl_InitStubs(interp, version, exact) \
+ (Tcl_InitStubs)((interp), (version), (exact)|(int)sizeof(size_t), \
+ TCL_VERSION, TCL_STUB_MAGIC)
+#else
+# define Tcl_InitStubs(interp, version, exact) \
+ (Tcl_InitStubs)(interp, TCL_PATCH_LEVEL, 1|(int)sizeof(size_t), \
+ TCL_VERSION, TCL_STUB_MAGIC)
+#endif
+#else
#define Tcl_InitStubs(interp, version, exact) \
Tcl_PkgInitStubsCheck(interp, version, exact)
#endif
/*
- * TODO - tommath stubs export goes here!
- */
-
-/*
* Public functions that are not accessible via the stubs table.
* Tcl_GetMemoryInfo is needed for AOLserver. [Bug 1868171]
*/
#define Tcl_Main(argc, argv, proc) Tcl_MainEx(argc, argv, proc, \
((Tcl_CreateInterp)()))
-EXTERN void Tcl_MainEx(int argc, char **argv,
+TCLAPI void Tcl_FindExecutable(const char *argv0);
+TCLAPI void Tcl_SetPanicProc(Tcl_PanicProc *panicProc);
+TCLAPI void Tcl_MainEx(int argc, char **argv,
Tcl_AppInitProc *appInitProc, Tcl_Interp *interp);
-EXTERN const char * Tcl_PkgInitStubsCheck(Tcl_Interp *interp,
+#if defined(_WIN32) && defined(UNICODE)
+TCLAPI void Tcl_MainExW(int argc, wchar_t **argv,
+ Tcl_AppInitProc *appInitProc, Tcl_Interp *interp);
+#endif
+TCLAPI const char * Tcl_PkgInitStubsCheck(Tcl_Interp *interp,
const char *version, int exact);
#if defined(TCL_THREADS) && defined(USE_THREAD_ALLOC)
-EXTERN void Tcl_GetMemoryInfo(Tcl_DString *dsPtr);
+TCLAPI void Tcl_GetMemoryInfo(Tcl_DString *dsPtr);
#endif
/*
@@ -2498,11 +2292,15 @@ EXTERN void Tcl_GetMemoryInfo(Tcl_DString *dsPtr);
/*
* Use do/while0 idiom for optimum correctness without compiler warnings.
* http://c2.com/cgi/wiki?TrivialDoWhileLoop
+ *
+ * Decrement refCount AFTER checking it for 0 or 1 (<2), because
+ * we cannot assume anymore that refCount is a signed type; In
+ * Tcl8 it was but in Tcl9 it is subject to change.
*/
# define Tcl_DecrRefCount(objPtr) \
do { \
Tcl_Obj *_objPtr = (objPtr); \
- if (--(_objPtr)->refCount <= 0) { \
+ if (_objPtr->refCount-- < 2) { \
TclFreeObj(_objPtr); \
} \
} while(0)
@@ -2529,9 +2327,6 @@ EXTERN void Tcl_GetMemoryInfo(Tcl_DString *dsPtr);
# undef Tcl_NewDoubleObj
# define Tcl_NewDoubleObj(val) \
Tcl_DbNewDoubleObj(val, __FILE__, __LINE__)
-# undef Tcl_NewIntObj
-# define Tcl_NewIntObj(val) \
- Tcl_DbNewLongObj(val, __FILE__, __LINE__)
# undef Tcl_NewListObj
# define Tcl_NewListObj(objc, objv) \
Tcl_DbNewListObj(objc, objv, __FILE__, __LINE__)
@@ -2595,35 +2390,6 @@ EXTERN void Tcl_GetMemoryInfo(Tcl_DString *dsPtr);
#define Tcl_ConditionFinalize(condPtr)
#endif /* TCL_THREADS */
-/*
- *----------------------------------------------------------------------------
- * Deprecated Tcl functions:
- */
-
-#ifndef TCL_NO_DEPRECATED
-/*
- * These function have been renamed. The old names are deprecated, but we
- * define these macros for backwards compatibilty.
- */
-
-# define Tcl_Ckalloc Tcl_Alloc
-# define Tcl_Ckfree Tcl_Free
-# define Tcl_Ckrealloc Tcl_Realloc
-# define Tcl_Return Tcl_SetResult
-# define Tcl_TildeSubst Tcl_TranslateFileName
-# define panic Tcl_Panic
-# define panicVA Tcl_PanicVA
-#endif /* !TCL_NO_DEPRECATED */
-
-/*
- *----------------------------------------------------------------------------
- * Convenience declaration of Tcl_AppInit for backwards compatibility. This
- * function is not *implemented* by the tcl library, so the storage class is
- * neither DLLEXPORT nor DLLIMPORT.
- */
-
-extern Tcl_AppInitProc Tcl_AppInit;
-
#endif /* RC_INVOKED */
/*