summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorapnadkarni <apnmbx-wits@yahoo.com>2023-04-05 06:40:43 (GMT)
committerapnadkarni <apnmbx-wits@yahoo.com>2023-04-05 06:40:43 (GMT)
commit1ab82013f2c14f4c0627dfa13fb18970b9c1db49 (patch)
tree630d48a1c1609e578d2eec88c1b1ce39221e5898
parentd206ee3c75c6f7e11fcc83dcc0152edf9dd94831 (diff)
downloadtcl-1ab82013f2c14f4c0627dfa13fb18970b9c1db49.zip
tcl-1ab82013f2c14f4c0627dfa13fb18970b9c1db49.tar.gz
tcl-1ab82013f2c14f4c0627dfa13fb18970b9c1db49.tar.bz2
Tcl_GetSizeIntFromObj
-rw-r--r--generic/tcl.decls6
-rw-r--r--generic/tclDecls.h9
-rw-r--r--generic/tclObj.c25
-rw-r--r--generic/tclStubInit.c2
4 files changed, 38 insertions, 4 deletions
diff --git a/generic/tcl.decls b/generic/tcl.decls
index 7f7fafb..3dfa8dd 100644
--- a/generic/tcl.decls
+++ b/generic/tcl.decls
@@ -2567,6 +2567,12 @@ declare 685 {
Tcl_Obj *Tcl_DStringToObj(Tcl_DString *dsPtr)
}
+# TIP 660
+declare 686 {
+ int Tcl_GetSizeIntFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
+ Tcl_Size *sizePtr)
+}
+
# ----- BASELINE -- FOR -- 8.7.0 / 9.0.0 ----- #
declare 687 {
diff --git a/generic/tclDecls.h b/generic/tclDecls.h
index bee2ae2..bcec388 100644
--- a/generic/tclDecls.h
+++ b/generic/tclDecls.h
@@ -2049,7 +2049,9 @@ EXTERN int Tcl_GetWideUIntFromObj(Tcl_Interp *interp,
Tcl_Obj *objPtr, Tcl_WideUInt *uwidePtr);
/* 685 */
EXTERN Tcl_Obj * Tcl_DStringToObj(Tcl_DString *dsPtr);
-/* Slot 686 is reserved */
+/* 686 */
+EXTERN int Tcl_GetSizeIntFromObj(Tcl_Interp *interp,
+ Tcl_Obj *objPtr, Tcl_Size *sizePtr);
/* 687 */
EXTERN void TclUnusedStubEntry(void);
@@ -2773,7 +2775,7 @@ typedef struct TclStubs {
Tcl_Size (*tcl_GetEncodingNulLength) (Tcl_Encoding encoding); /* 683 */
int (*tcl_GetWideUIntFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_WideUInt *uwidePtr); /* 684 */
Tcl_Obj * (*tcl_DStringToObj) (Tcl_DString *dsPtr); /* 685 */
- void (*reserved686)(void);
+ int (*tcl_GetSizeIntFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Size *sizePtr); /* 686 */
void (*tclUnusedStubEntry) (void); /* 687 */
} TclStubs;
@@ -4177,7 +4179,8 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_GetWideUIntFromObj) /* 684 */
#define Tcl_DStringToObj \
(tclStubsPtr->tcl_DStringToObj) /* 685 */
-/* Slot 686 is reserved */
+#define Tcl_GetSizeIntFromObj \
+ (tclStubsPtr->tcl_GetSizeIntFromObj) /* 686 */
#define TclUnusedStubEntry \
(tclStubsPtr->tclUnusedStubEntry) /* 687 */
diff --git a/generic/tclObj.c b/generic/tclObj.c
index 99368fe..9d6cd2d 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -3555,6 +3555,31 @@ TclGetWideBitsFromObj(
/*
*----------------------------------------------------------------------
*
+ * Tcl_GetSizeIntFromObj --
+ *
+ * Attempt to return a Tcl_Size from the Tcl object "objPtr".
+ *
+ * Results:
+ * TCL_OK - the converted Tcl_Size value is stored in *sizePtr
+ * TCL_ERROR - the error message is stored in interp
+ *
+ * Side effects:
+ * The function may free up any existing internal representation.
+ *
+ *----------------------------------------------------------------------
+ */
+int
+Tcl_GetSizeIntFromObj(
+ Tcl_Interp *interp, /* Used for error reporting if not NULL. */
+ Tcl_Obj *objPtr, /* The object from which to get a int. */
+ Tcl_Size *sizePtr) /* Place to store resulting int. */
+{
+ return Tcl_GetIntFromObj(interp, objPtr, sizePtr);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* FreeBignum --
*
* This function frees the internal rep of a bignum.
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index ddc0bc9..6d29465 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -2057,7 +2057,7 @@ const TclStubs tclStubs = {
Tcl_GetEncodingNulLength, /* 683 */
Tcl_GetWideUIntFromObj, /* 684 */
Tcl_DStringToObj, /* 685 */
- 0, /* 686 */
+ Tcl_GetSizeIntFromObj, /* 686 */
TclUnusedStubEntry, /* 687 */
};