From 642d30354803ef1ce02e98160bbc1d4f70435f00 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 15 May 2019 14:58:03 +0000 Subject: TIP #544 implementation. Documentation still missing. --- generic/tcl.decls | 5 +++++ generic/tclDecls.h | 11 +++++------ generic/tclInt.decls | 2 +- generic/tclInt.h | 4 ++-- generic/tclIntDecls.h | 7 +++++-- generic/tclStubInit.c | 4 +++- generic/tclUtil.c | 6 +++--- 7 files changed, 24 insertions(+), 15 deletions(-) diff --git a/generic/tcl.decls b/generic/tcl.decls index 7d3b535..9011ea7 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -2385,6 +2385,11 @@ declare 644 { int type, int size) } +declare 635 { + int Tcl_GetIntForIndex(Tcl_Interp *interp, Tcl_Obj *objPtr, + int endValue, int *indexPtr) +} + # ----- BASELINE -- FOR -- 8.7.0 ----- # ############################################################################## diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 3d40bef..0e5ca24 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -1874,9 +1874,8 @@ EXTERN int TclZipfs_Unmount(Tcl_Interp *interp, /* 634 */ EXTERN Tcl_Obj * TclZipfs_TclLibrary(void); /* 635 */ -EXTERN int TclZipfs_MountBuffer(Tcl_Interp *interp, - const char *mountPoint, unsigned char *data, - size_t datalen, int copy); +EXTERN int Tcl_GetIntForIndex(Tcl_Interp *interp, + Tcl_Obj *objPtr, int endValue, int *indexPtr); /* 636 */ EXTERN void Tcl_FreeIntRep(Tcl_Obj *objPtr); /* 637 */ @@ -2571,7 +2570,7 @@ typedef struct TclStubs { int (*tclZipfs_Mount) (Tcl_Interp *interp, const char *mountPoint, const char *zipname, const char *passwd); /* 632 */ int (*tclZipfs_Unmount) (Tcl_Interp *interp, const char *mountPoint); /* 633 */ Tcl_Obj * (*tclZipfs_TclLibrary) (void); /* 634 */ - int (*tclZipfs_MountBuffer) (Tcl_Interp *interp, const char *mountPoint, unsigned char *data, size_t datalen, int copy); /* 635 */ + int (*tcl_GetIntForIndex) (Tcl_Interp *interp, Tcl_Obj *objPtr, int endValue, int *indexPtr); /* 635 */ void (*tcl_FreeIntRep) (Tcl_Obj *objPtr); /* 636 */ char * (*tcl_InitStringRep) (Tcl_Obj *objPtr, const char *bytes, unsigned int numBytes); /* 637 */ Tcl_ObjIntRep * (*tcl_FetchIntRep) (Tcl_Obj *objPtr, const Tcl_ObjType *typePtr); /* 638 */ @@ -3881,8 +3880,8 @@ extern const TclStubs *tclStubsPtr; (tclStubsPtr->tclZipfs_Unmount) /* 633 */ #define TclZipfs_TclLibrary \ (tclStubsPtr->tclZipfs_TclLibrary) /* 634 */ -#define TclZipfs_MountBuffer \ - (tclStubsPtr->tclZipfs_MountBuffer) /* 635 */ +#define Tcl_GetIntForIndex \ + (tclStubsPtr->tcl_GetIntForIndex) /* 635 */ #define Tcl_FreeIntRep \ (tclStubsPtr->tcl_FreeIntRep) /* 636 */ #define Tcl_InitStringRep \ diff --git a/generic/tclInt.decls b/generic/tclInt.decls index 106b4e9..9eaade6 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -151,7 +151,7 @@ declare 32 { #declare 33 { # TclCmdProcType TclGetInterpProc(void) #} -declare 34 { +declare 34 {deprecated {Use Tcl_GetIntForIndex}} { int TclGetIntForIndex(Tcl_Interp *interp, Tcl_Obj *objPtr, int endValue, int *indexPtr) } diff --git a/generic/tclInt.h b/generic/tclInt.h index e76b2a8..ea8aeba 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2477,7 +2477,7 @@ typedef struct List { /* * Macros providing a faster path to booleans and integers: * Tcl_GetBooleanFromObj, Tcl_GetLongFromObj, Tcl_GetIntFromObj - * and TclGetIntForIndex. + * and Tcl_GetIntForIndex. * * WARNING: these macros eval their args more than once. */ @@ -2514,7 +2514,7 @@ typedef struct List { && (objPtr)->internalRep.wideValue <= (Tcl_WideInt)(INT_MAX)) \ ? ((*(idxPtr) = ((objPtr)->internalRep.wideValue >= 0) \ ? (int)(objPtr)->internalRep.wideValue : -1), TCL_OK) \ - : TclGetIntForIndex((interp), (objPtr), (endValue), (idxPtr))) + : Tcl_GetIntForIndex((interp), (objPtr), (endValue), (idxPtr))) /* * Macro used to save a function call for common uses of diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h index eddbcb3..9ce7ffc 100644 --- a/generic/tclIntDecls.h +++ b/generic/tclIntDecls.h @@ -28,6 +28,7 @@ #endif #if !defined(TCL_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9) +# define tclGetIntForIndex tcl_GetIntForIndex /* Those macro's are especially for Itcl 3.4 compatibility */ # define tclCreateNamespace tcl_CreateNamespace # define tclDeleteNamespace tcl_DeleteNamespace @@ -129,7 +130,8 @@ EXTERN int TclGetFrame(Tcl_Interp *interp, const char *str, CallFrame **framePtrPtr); /* Slot 33 is reserved */ /* 34 */ -EXTERN int TclGetIntForIndex(Tcl_Interp *interp, +TCL_DEPRECATED("Use Tcl_GetIntForIndex") +int TclGetIntForIndex(Tcl_Interp *interp, Tcl_Obj *objPtr, int endValue, int *indexPtr); /* Slot 35 is reserved */ /* Slot 36 is reserved */ @@ -692,7 +694,7 @@ typedef struct TclIntStubs { const char * (*tclGetExtension) (const char *name); /* 31 */ int (*tclGetFrame) (Tcl_Interp *interp, const char *str, CallFrame **framePtrPtr); /* 32 */ void (*reserved33)(void); - int (*tclGetIntForIndex) (Tcl_Interp *interp, Tcl_Obj *objPtr, int endValue, int *indexPtr); /* 34 */ + TCL_DEPRECATED_API("Use Tcl_GetIntForIndex") int (*tclGetIntForIndex) (Tcl_Interp *interp, Tcl_Obj *objPtr, int endValue, int *indexPtr); /* 34 */ void (*reserved35)(void); void (*reserved36)(void); int (*tclGetLoadedPackages) (Tcl_Interp *interp, const char *targetName); /* 37 */ @@ -1375,6 +1377,7 @@ extern const TclIntStubs *tclIntStubsPtr; # undef TclBackgroundException # undef TclSetStartupScript # undef TclGetStartupScript +# undef TclGetIntForIndex # undef TclCreateNamespace # undef TclDeleteNamespace # undef TclAppendExportList diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 8945e0b..2a3212c 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -387,6 +387,7 @@ static int uniCharNcasecmp(const Tcl_UniChar *ucs, const Tcl_UniChar *uct, unsig # define TclpReaddir 0 # define TclSetStartupScript 0 # define TclGetStartupScript 0 +# define TclGetIntForIndex 0 # define TclCreateNamespace 0 # define TclDeleteNamespace 0 # define TclAppendExportList 0 @@ -437,6 +438,7 @@ static int uniCharNcasecmp(const Tcl_UniChar *ucs, const Tcl_UniChar *uct, unsig # define TclBackgroundException Tcl_BackgroundException # define TclSetStartupScript Tcl_SetStartupScript # define TclGetStartupScript Tcl_GetStartupScript +# define TclGetIntForIndex Tcl_GetIntForIndex # define TclCreateNamespace Tcl_CreateNamespace # define TclDeleteNamespace Tcl_DeleteNamespace # define TclAppendExportList Tcl_AppendExportList @@ -1621,7 +1623,7 @@ const TclStubs tclStubs = { TclZipfs_Mount, /* 632 */ TclZipfs_Unmount, /* 633 */ TclZipfs_TclLibrary, /* 634 */ - TclZipfs_MountBuffer, /* 635 */ + Tcl_GetIntForIndex, /* 635 */ Tcl_FreeIntRep, /* 636 */ Tcl_InitStringRep, /* 637 */ Tcl_FetchIntRep, /* 638 */ diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 2889852..4387c75 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -121,7 +121,7 @@ static int FindElement(Tcl_Interp *interp, const char *string, /* * The following is the Tcl object type definition for an object that * represents a list index in the form, "end-offset". It is used as a - * performance optimization in TclGetIntForIndex. The internal rep is + * performance optimization in Tcl_GetIntForIndex. The internal rep is * stored directly in the wideValue, so no memory management is required * for it. This is a caching intrep, keeping the result of a parse * around. This type is only created from a pre-existing string, so an @@ -3872,7 +3872,7 @@ GetWideForIndex( /* *---------------------------------------------------------------------- * - * TclGetIntForIndex -- + * Tcl_GetIntForIndex -- * * This function returns an integer corresponding to the list index held * in a Tcl object. The Tcl object's value is expected to be in the @@ -3894,7 +3894,7 @@ GetWideForIndex( */ int -TclGetIntForIndex( +Tcl_GetIntForIndex( Tcl_Interp *interp, /* Interpreter to use for error reporting. If * NULL, then no error message is left after * errors. */ -- cgit v0.12