summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2018-01-22 09:18:19 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2018-01-22 09:18:19 (GMT)
commit03a71b070685eecb97de3d3cfe830823b056054e (patch)
tree1d48db41d82066ea612323dd134c7740f6701c38 /generic
parenta4953f93f427b0187c1f3eaa7e7614098b66fb0a (diff)
downloadtcl-03a71b070685eecb97de3d3cfe830823b056054e.zip
tcl-03a71b070685eecb97de3d3cfe830823b056054e.tar.gz
tcl-03a71b070685eecb97de3d3cfe830823b056054e.tar.bz2
Put old "int" type back. Not used by Tcl anymore, but this restores compatibility with Tk < 8.6.9 and some extensions: "nsf", "tdbcload", "tclxml" and "VecTcl"
(this workaround was used by "boolean" as well, when its internal implementation changed, there's still an oldBooleanType because of that)
Diffstat (limited to 'generic')
-rw-r--r--generic/tclInt.h1
-rw-r--r--generic/tclObj.c31
2 files changed, 32 insertions, 0 deletions
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 50d0469..d74cd0e 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -2713,6 +2713,7 @@ MODULE_SCOPE const Tcl_ObjType tclByteCodeType;
MODULE_SCOPE const Tcl_ObjType tclDoubleType;
MODULE_SCOPE const Tcl_ObjType tclEndOffsetType;
MODULE_SCOPE const Tcl_ObjType tclIntType;
+MODULE_SCOPE const Tcl_ObjType tclOldIntType;
MODULE_SCOPE const Tcl_ObjType tclListType;
MODULE_SCOPE const Tcl_ObjType tclDictType;
MODULE_SCOPE const Tcl_ObjType tclProcBodyType;
diff --git a/generic/tclObj.c b/generic/tclObj.c
index 8ec95ce..e02f6c4 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -210,6 +210,9 @@ static int SetDoubleFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
static int SetIntFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
static void UpdateStringOfDouble(Tcl_Obj *objPtr);
static void UpdateStringOfInt(Tcl_Obj *objPtr);
+#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 && !defined(TCL_WIDE_INT_IS_LONG)
+static void UpdateStringOfOldInt(Tcl_Obj *objPtr);
+#endif
static void FreeBignum(Tcl_Obj *objPtr);
static void DupBignum(Tcl_Obj *objPtr, Tcl_Obj *copyPtr);
static void UpdateStringOfBignum(Tcl_Obj *objPtr);
@@ -272,6 +275,15 @@ const Tcl_ObjType tclIntType = {
UpdateStringOfInt, /* updateStringProc */
SetIntFromAny /* setFromAnyProc */
};
+#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 && !defined(TCL_WIDE_INT_IS_LONG)
+const Tcl_ObjType tclOldIntType = {
+ "int", /* name */
+ NULL, /* freeIntRepProc */
+ NULL, /* dupIntRepProc */
+ UpdateStringOfOldInt, /* updateStringProc */
+ SetIntFromAny /* setFromAnyProc */
+};
+#endif
const Tcl_ObjType tclBignumType = {
"bignum", /* name */
FreeBignum, /* freeIntRepProc */
@@ -400,6 +412,9 @@ TclInitObjSubsystem(void)
/* For backward compatibility only ... */
#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
Tcl_RegisterObjType(&tclIntType);
+#if !defined(TCL_WIDE_INT_IS_LONG)
+ Tcl_RegisterObjType(&tclOldIntType);
+#endif
Tcl_RegisterObjType(&oldBooleanType);
#endif
@@ -2548,6 +2563,22 @@ UpdateStringOfInt(
memcpy(objPtr->bytes, buffer, (unsigned) len + 1);
objPtr->length = len;
}
+
+#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 && !defined(TCL_WIDE_INT_IS_LONG)
+static void
+UpdateStringOfOldInt(
+ register Tcl_Obj *objPtr) /* Int object whose string rep to update. */
+{
+ char buffer[TCL_INTEGER_SPACE];
+ register int len;
+
+ len = TclFormatInt(buffer, objPtr->internalRep.longValue);
+
+ objPtr->bytes = ckalloc(len + 1);
+ memcpy(objPtr->bytes, buffer, (unsigned) len + 1);
+ objPtr->length = len;
+}
+#endif
/*
*----------------------------------------------------------------------