Tcl Source Code

Check-in [9c960be0cb]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:On hold at Don Porter's request hange stub library to detect - and generate a nice error-message - when a shared library compiled for Tcl 8.x is attempted to be loaded in Tcl 9.x: Tcl 9 will not have the iPtr->result field so we cannot use that any more.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | on-hold-85
Files: files | file ages | folders
SHA1: 9c960be0cb8c5de3930651b937d202ace9137911
User & Date: jan.nijtmans 2012-11-18 17:04:38
Original Comment: hange stub library to detect - and generate a nice error-message - when a shared library compiled for Tcl 8.x is attempted to be loaded in Tcl 9.x: Tcl 9 will not have the iPtr->result field so we cannot use that any more.
Context
2012-11-18
17:12
on-hold at Don Porter's request change stub library to detect - and generate a nice error-me... Closed-Leaf check-in: 7b721861e8 user: jan.nijtmans tags: on-hold-trunk
17:04
On hold at Don Porter's request hange stub library to detect - and generate a nice error-mes... Closed-Leaf check-in: 9c960be0cb user: jan.nijtmans tags: on-hold-85
16:54
On-hold at Don Porter's request. change stub library to detect - and generate a nice error-m... Closed-Leaf check-in: 062ca741cb user: jan.nijtmans tags: on-hold-84
2012-11-16
16:11
3587651 Fix Tcl_ListMathFuncs() by turning it into a call to [info functions] check-in: 970cfc1041 user: dgp tags: core-8-5-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclStubLib.c.

30
31
32
33
34
35
36



37
38
39
40
41
42
43
44

45
46








47






48
49
50
51


52
53
54
55
56
57
58
 */

TclStubs *tclStubsPtr = NULL;
TclPlatStubs *tclPlatStubsPtr = NULL;
TclIntStubs *tclIntStubsPtr = NULL;
TclIntPlatStubs *tclIntPlatStubsPtr = NULL;
TclTomMathStubs* tclTomMathStubsPtr = NULL;




static TclStubs *
HasStubSupport(
    Tcl_Interp *interp)
{
    Interp *iPtr = (Interp *) interp;

    if (iPtr->stubTable && (iPtr->stubTable->magic == TCL_STUB_MAGIC)) {

	return iPtr->stubTable;
    }















    interp->result =
	    "This interpreter does not support stubs-enabled extensions.";
    interp->freeProc = TCL_STATIC;
    return NULL;


}

/*
 * Use our own isdigit to avoid linking to libc on windows
 */

static int isDigit(const int c)







>
>
>







|
>
|

>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
|
|
<
|
>
>







30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67

68
69
70
71
72
73
74
75
76
77
 */

TclStubs *tclStubsPtr = NULL;
TclPlatStubs *tclPlatStubsPtr = NULL;
TclIntStubs *tclIntStubsPtr = NULL;
TclIntPlatStubs *tclIntPlatStubsPtr = NULL;
TclTomMathStubs* tclTomMathStubsPtr = NULL;

typedef Tcl_Obj *(NewStringObjProc) (CONST char *bytes, size_t length);


static TclStubs *
HasStubSupport(
    Tcl_Interp *interp)
{
    Interp *iPtr = (Interp *) interp;

    if (!iPtr->stubTable) {
	/* No stub table at all? Nothing we can do. */
	return NULL;
    }
    if (iPtr->stubTable->magic != TCL_STUB_MAGIC) {
	/*
	 * We cannot acces interp->result and interp->freeProc
	 * any more: They will be gone in Tcl 9. In stead,
	 * assume that the iPtr->stubTable entry from Tcl_Interp
	 * and the Tcl_NewStringObj() and Tcl_SetObjResult() entries
	 * in the stub table don't change in Tcl 9. Need to add
	 * a test-case in Tcl 9 to assure that.
	 * 
	 * The signature of Tcl_NewStringObj will change: the length
	 * parameter will be of type size_t. But passing the value
	 * (size_t)-1 will work, whatever the signature will be.
	 */
	NewStringObjProc *newStringObj = (NewStringObjProc *)
		iPtr->stubTable->tcl_NewStringObj;
	iPtr->stubTable->tcl_SetObjResult(interp, newStringObj(
		"This extension is compiled for Tcl 8.x", (size_t)-1));

	return NULL;
    }
    return iPtr->stubTable;
}

/*
 * Use our own isdigit to avoid linking to libc on windows
 */

static int isDigit(const int c)