Tcl Source Code

Check-in [e3336029df]
Login

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

Overview
Comment:Simpler code to do installation of [info class] and [info object].

We know this is a safe thing to do as we know this is inside Tcl_CreateInterp() and so no confounding code could have been run.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e3336029df84be60dc73f4ab0bf98398b80fdc0d
User & Date: dkf 2012-12-17 14:40:17
Context
2013-01-02
17:38
Merge trunk through conflict-free, failure-free checkins. check-in: d66d19493d user: dgp tags: dgp-refactor
2012-12-18
14:02
Improved the sequence of instructions issued for [subst] when dealing with simple variable reference... check-in: 879b78fc5c user: dkf tags: trunk
09:02
merge trunk check-in: 7e88f46d94 user: dkf tags: dkf-bytecode-8.6-main
2012-12-17
14:40
Simpler code to do installation of [info class] and [info object].

We know this is a safe thing to ... check-in: e3336029df user: dkf tags: trunk

14:27
Slim down the code a bit more; we can make more safe assumptions. Closed-Leaf check-in: db490510ed user: dkf tags: dkf-review
2012-12-13
20:20
TIP 400 suffered from the same segfaulting flaw as 3595576. Segfaulting test and fix committed. check-in: 8ca83061d7 user: dgp tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclOOInfo.c.

96
97
98
99
100
101
102

103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
 */

void
TclOOInitInfo(
    Tcl_Interp *interp)
{
    Tcl_Command infoCmd;


    /*
     * Build the ensembles used to implement [info object] and [info class].
     */

    TclMakeEnsemble(interp, "::oo::InfoObject", infoObjectCmds);
    TclMakeEnsemble(interp, "::oo::InfoClass", infoClassCmds);

    /*
     * Install into the master [info] ensemble.
     */

    infoCmd = Tcl_FindCommand(interp, "info", NULL, TCL_GLOBAL_ONLY);
    if (infoCmd != NULL && Tcl_IsEnsemble(infoCmd)) {
	Tcl_Obj *mapDict, *objectObj, *classObj;

	Tcl_GetEnsembleMappingDict(NULL, infoCmd, &mapDict);
	if (mapDict != NULL) {
	    objectObj = Tcl_NewStringObj("object", -1);
	    classObj = Tcl_NewStringObj("class", -1);

	    Tcl_IncrRefCount(objectObj);
	    Tcl_IncrRefCount(classObj);
	    Tcl_DictObjPut(NULL, mapDict, objectObj,
		    Tcl_NewStringObj("::oo::InfoObject", -1));
	    Tcl_DictObjPut(NULL, mapDict, classObj,
		    Tcl_NewStringObj("::oo::InfoClass", -1));
	    Tcl_DecrRefCount(objectObj);
	    Tcl_DecrRefCount(classObj);
	    Tcl_SetEnsembleMappingDict(interp, infoCmd, mapDict);
	}
    }
}

/*
 * ----------------------------------------------------------------------
 *
 * GetClassFromObj --
 *







>













<
<
<
|
<
<
<
<
<
<
|
|
|
|
<
<
|
<
<







96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116



117






118
119
120
121


122


123
124
125
126
127
128
129
 */

void
TclOOInitInfo(
    Tcl_Interp *interp)
{
    Tcl_Command infoCmd;
    Tcl_Obj *mapDict;

    /*
     * Build the ensembles used to implement [info object] and [info class].
     */

    TclMakeEnsemble(interp, "::oo::InfoObject", infoObjectCmds);
    TclMakeEnsemble(interp, "::oo::InfoClass", infoClassCmds);

    /*
     * Install into the master [info] ensemble.
     */

    infoCmd = Tcl_FindCommand(interp, "info", NULL, TCL_GLOBAL_ONLY);



    Tcl_GetEnsembleMappingDict(NULL, infoCmd, &mapDict);






    Tcl_DictObjPut(NULL, mapDict, Tcl_NewStringObj("object", -1),
	    Tcl_NewStringObj("::oo::InfoObject", -1));
    Tcl_DictObjPut(NULL, mapDict, Tcl_NewStringObj("class", -1),
	    Tcl_NewStringObj("::oo::InfoClass", -1));


    Tcl_SetEnsembleMappingDict(interp, infoCmd, mapDict);


}

/*
 * ----------------------------------------------------------------------
 *
 * GetClassFromObj --
 *