diff options
-rw-r--r-- | doc/DictObj.3 | 2 | ||||
-rw-r--r-- | doc/ListObj.3 | 6 | ||||
-rw-r--r-- | generic/tcl.decls | 5 | ||||
-rw-r--r-- | generic/tclDecls.h | 12 | ||||
-rw-r--r-- | generic/tclStubInit.c | 11 |
5 files changed, 30 insertions, 6 deletions
diff --git a/doc/DictObj.3 b/doc/DictObj.3 index 0b4c1ca..73b0da8 100644 --- a/doc/DictObj.3 +++ b/doc/DictObj.3 @@ -70,7 +70,7 @@ Points to a variable that will have the value from a key/value pair placed within it. For \fBTcl_DictObjFirst\fR and \fBTcl_DictObjNext\fR, this may be NULL to indicate that the caller is not interested in the value. -.AP int *sizePtr out +.AP size_t | int *sizePtr out Points to a variable that will have the number of key/value pairs contained within the dictionary placed within it. .AP Tcl_DictSearch *searchPtr in/out diff --git a/doc/ListObj.3 b/doc/ListObj.3 index 67721c9..403789d 100644 --- a/doc/ListObj.3 +++ b/doc/ListObj.3 @@ -28,7 +28,7 @@ int \fBTcl_ListObjGetElements\fR(\fIinterp, listPtr, objcPtr, objvPtr\fR) .sp int -\fBTcl_ListObjLength\fR(\fIinterp, listPtr, intPtr\fR) +\fBTcl_ListObjLength\fR(\fIinterp, listPtr, lengthPtr\fR) .sp int \fBTcl_ListObjIndex\fR(\fIinterp, listPtr, index, objPtrPtr\fR) @@ -76,7 +76,7 @@ An array of pointers to values. \fBTcl_NewListObj\fR will insert these values into a new list value and \fBTcl_ListObjReplace\fR will insert them into an existing \fIlistPtr\fR. Each value will become a separate list element. -.AP int *intPtr out +.AP size_t | int *lengthPtr out Points to location where \fBTcl_ListObjLength\fR stores the length of the list. .AP int index in @@ -162,7 +162,7 @@ Otherwise it returns \fBTCL_OK\fR after storing the count and array pointer. .PP \fBTcl_ListObjLength\fR returns the number of elements in the list value referenced by \fIlistPtr\fR. -It returns this count by storing an integer in the address \fIintPtr\fR. +It returns this count by storing a value in the address \fIlengthPtr\fR. If the value is not already a list value, \fBTcl_ListObjLength\fR will attempt to convert it to one; if the conversion fails, it returns \fBTCL_ERROR\fR diff --git a/generic/tcl.decls b/generic/tcl.decls index 249a361..b0d2dd4 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -2442,7 +2442,7 @@ declare 660 { int Tcl_AsyncMarkFromSignal(Tcl_AsyncHandler async, int sigNumber) } -# TIP #??? +# TIP #616 declare 661 { int TclListObjGetElements_(Tcl_Interp *interp, Tcl_Obj *listPtr, size_t *objcPtr, Tcl_Obj ***objvPtr) @@ -2451,6 +2451,9 @@ declare 662 { int TclListObjLength_(Tcl_Interp *interp, Tcl_Obj *listPtr, size_t *lengthPtr) } +declare 663 { + int TclDictObjSize_(Tcl_Interp *interp, Tcl_Obj *dictPtr, size_t *sizePtr) +} # ----- BASELINE -- FOR -- 8.7.0 ----- # diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 18f9ed7..d19881d 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -1955,6 +1955,9 @@ EXTERN int TclListObjGetElements_(Tcl_Interp *interp, /* 662 */ EXTERN int TclListObjLength_(Tcl_Interp *interp, Tcl_Obj *listPtr, size_t *lengthPtr); +/* 663 */ +EXTERN int TclDictObjSize_(Tcl_Interp *interp, Tcl_Obj *dictPtr, + size_t *sizePtr); typedef struct { const struct TclPlatStubs *tclPlatStubs; @@ -2653,6 +2656,7 @@ typedef struct TclStubs { int (*tcl_AsyncMarkFromSignal) (Tcl_AsyncHandler async, int sigNumber); /* 660 */ int (*tclListObjGetElements_) (Tcl_Interp *interp, Tcl_Obj *listPtr, size_t *objcPtr, Tcl_Obj ***objvPtr); /* 661 */ int (*tclListObjLength_) (Tcl_Interp *interp, Tcl_Obj *listPtr, size_t *lengthPtr); /* 662 */ + int (*tclDictObjSize_) (Tcl_Interp *interp, Tcl_Obj *dictPtr, size_t *sizePtr); /* 663 */ } TclStubs; extern const TclStubs *tclStubsPtr; @@ -4007,6 +4011,8 @@ extern const TclStubs *tclStubsPtr; (tclStubsPtr->tclListObjGetElements_) /* 661 */ #define TclListObjLength_ \ (tclStubsPtr->tclListObjLength_) /* 662 */ +#define TclDictObjSize_ \ + (tclStubsPtr->tclDictObjSize_) /* 663 */ #endif /* defined(USE_TCL_STUBS) */ @@ -4285,7 +4291,7 @@ extern const TclStubs *tclStubsPtr; ? (int (*)(const char *, wchar_t *))tclStubsPtr->tcl_UtfToChar16 \ : (int (*)(const char *, wchar_t *))Tcl_UtfToUniChar) # undef Tcl_ListObjGetElements -#ifndef TCL_NO_DEPRECATED +#ifdef TCL_NO_DEPRECATED # define Tcl_ListObjGetElements(interp, listPtr, objcPtr, objvPtr) (sizeof(*objcPtr) == sizeof(int) \ ? tclStubsPtr->tcl_ListObjGetElements((interp), (listPtr), (int *)(void *)(objcPtr), (objvPtr)) \ : tclStubsPtr->tclListObjGetElements_((interp), (listPtr), (size_t *)(void *)(objcPtr), (objvPtr))) @@ -4293,6 +4299,10 @@ extern const TclStubs *tclStubsPtr; # define Tcl_ListObjLength(interp, listPtr, lengthPtr) (sizeof(*lengthPtr) == sizeof(int) \ ? tclStubsPtr->tcl_ListObjLength((interp), (listPtr), (int *)(void *)(lengthPtr)) \ : tclStubsPtr->tclListObjLength_((interp), (listPtr), (size_t *)(void *)(lengthPtr))) +# undef Tcl_DictObjSize +# define Tcl_DictObjSize(interp, dictPtr, sizePtr) (sizeof(*sizePtr) == sizeof(int) \ + ? tclStubsPtr->tcl_DictObjSize((interp), (dictPtr), (int *)(void *)(sizePtr)) \ + : tclStubsPtr->tclDictObjSize_((interp), (dictPtr), (size_t *)(void *)(sizePtr))) #endif /* TCL_NO_DEPRECATED */ #else # define Tcl_WCharToUtfDString (sizeof(wchar_t) != sizeof(short) \ diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 836eddc..234805c 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -125,6 +125,7 @@ static const char *TclUtfPrev(const char *src, const char *start) { #define TclListObjGetElements_ LOGetElements #define TclListObjLength_ LOLength +#define TclDictObjSize_ DOSize static int LOGetElements(Tcl_Interp *interp, Tcl_Obj *listPtr, size_t *objcPtr, Tcl_Obj ***objvPtr) { int n; @@ -143,6 +144,15 @@ static int LOLength(Tcl_Interp *interp, Tcl_Obj *listPtr, } return result; } +static int DOSize(Tcl_Interp *interp, Tcl_Obj *dictPtr, + size_t *sizePtr) { + int n; + int result = Tcl_DictObjSize(interp, dictPtr, &n); + if (sizePtr) { + *sizePtr = n; + } + return result; +} #define TclBN_mp_add mp_add #define TclBN_mp_and mp_and @@ -1967,6 +1977,7 @@ const TclStubs tclStubs = { Tcl_AsyncMarkFromSignal, /* 660 */ TclListObjGetElements_, /* 661 */ TclListObjLength_, /* 662 */ + TclDictObjSize_, /* 663 */ }; /* !END!: Do not edit above this line. */ |