Tcl Source Code

Check-in [7b721861e8]
Login

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

Overview
Comment:on-hold at Don Porter's request change 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-trunk
Files: files | file ages | folders
SHA1: 7b721861e852a7ba4baaf5418d6abca43e57ab4c
User & Date: jan.nijtmans 2012-11-18 17:12:35
Original Comment: change 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:24
change stub library to detect - and generate a nice error-message - when a shared library compiled ... check-in: cd530ee72f user: jan.nijtmans tags: novem
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
2012-11-16
16:19
3587651 Fix [info functions] and Tcl_ListMathFuncs(). check-in: 182c1d99c3 user: dgp tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclStubLib.c.

27
28
29
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
MODULE_SCOPE const TclIntStubs *tclIntStubsPtr;
MODULE_SCOPE const TclIntPlatStubs *tclIntPlatStubsPtr;

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




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

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

	return iPtr->stubTable;
    }














    iPtr->result =

	    (char *)"This interpreter does not support stubs-enabled extensions.";
    iPtr->freeProc = TCL_STATIC;
    return NULL;


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

static int isDigit(const int c)







>
>
>







|
>
|

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







27
28
29
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
MODULE_SCOPE const TclIntStubs *tclIntStubsPtr;
MODULE_SCOPE const TclIntPlatStubs *tclIntPlatStubsPtr;

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

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


static const 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)