Tcl Source Code

Changes On Branch forgiving-pkgconfig
Login

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

Changes In Branch forgiving-pkgconfig Excluding Merge-Ins

This is equivalent to a diff from dc72be0dbc to 19cd443ed2

2012-11-15
00:20
IMPLEMENTATION OF TIP#416: New Options for 'load': -global and -lazy check-in: ee5b8dcfad user: jan.nijtmans tags: trunk
2012-11-14
16:57
merge trunk check-in: 872a233e89 user: dgp tags: core-8-6-0-rc
15:50
oops Closed-Leaf check-in: 19cd443ed2 user: jan.nijtmans tags: forgiving-pkgconfig
15:44
Experiment: make ::tcl::pkgconfig more forgiving when the requested encoding cannot be found. check-in: 4cc7e2a948 user: jan.nijtmans tags: forgiving-pkgconfig
14:35
merge mark check-in: dc72be0dbc user: dkf tags: trunk
14:33
* unix/tclUnixPipe.c (DefaultTempDir): [Bug 2933003]: Allow overriding of the back-stop default te...
check-in: 4fb4ed1471 user: dkf tags: core-8-5-branch
13:01
* unix/tclUnixFCmd.c (TclUnixOpenTemporaryFile): [Bug 2933003]: Factor out all the code to do temp...
check-in: 2f3da59db1 user: dkf tags: trunk

Changes to generic/tclConfig.c.

74
75
76
77
78
79
80


81
82
83
84
85
86
87
    const Tcl_Config *configuration,	/* Embedded configuration. */
    const char *valEncoding)	/* Name of the encoding used to store the
				 * configuration values, ASCII, thus UTF-8. */
{
    Tcl_DString cmdName;
    const Tcl_Config *cfg;
    Tcl_Encoding venc = Tcl_GetEncoding(NULL, valEncoding);


    QCCD *cdPtr = ckalloc(sizeof(QCCD));

    cdPtr->interp = interp;
    cdPtr->pkg = Tcl_NewStringObj(pkgName, -1);

    /*
     * Phase I: Adding the provided information to the internal database of







>
>







74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
    const Tcl_Config *configuration,	/* Embedded configuration. */
    const char *valEncoding)	/* Name of the encoding used to store the
				 * configuration values, ASCII, thus UTF-8. */
{
    Tcl_DString cmdName;
    const Tcl_Config *cfg;
    Tcl_Encoding venc = Tcl_GetEncoding(NULL, valEncoding);
    Tcl_Obj *pkgDict, *pDB;

    QCCD *cdPtr = ckalloc(sizeof(QCCD));

    cdPtr->interp = interp;
    cdPtr->pkg = Tcl_NewStringObj(pkgName, -1);

    /*
     * Phase I: Adding the provided information to the internal database of
95
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
     *
     * Note, the created command will have a reference through its clientdata.
     */

    Tcl_IncrRefCount(cdPtr->pkg);

    /*
     * For venc == NULL aka bogus encoding we skip the step setting up the
     * dictionaries visible at Tcl level. I.e. they are not filled
     */

    if (venc != NULL) {



	Tcl_Obj *pkgDict, *pDB = GetConfigDict(interp);

	/*
	 * Retrieve package specific configuration...
	 */

	if (Tcl_DictObjGet(interp, pDB, cdPtr->pkg, &pkgDict) != TCL_OK
		|| (pkgDict == NULL)) {
	    pkgDict = Tcl_NewDictObj();
	} else if (Tcl_IsShared(pkgDict)) {
	    pkgDict = Tcl_DuplicateObj(pkgDict);
	}

	/*
	 * Extend the package configuration...
	 */

	for (cfg=configuration ; cfg->key!=NULL && cfg->key[0]!='\0' ; cfg++) {
	    Tcl_DString conv;
	    const char *convValue =
		    Tcl_ExternalToUtfDString(venc, cfg->value, -1, &conv);

	    /*
	     * We know that the keys are in ASCII/UTF-8, so for them is no
	     * conversion required.
	     */

	    Tcl_DictObjPut(interp, pkgDict, Tcl_NewStringObj(cfg->key, -1),
		    Tcl_NewStringObj(convValue, -1));
	    Tcl_DStringFree(&conv);
	}

	/*
	 * We're now done with the encoding, so drop it.
	 */

	Tcl_FreeEncoding(venc);

	/*
	 * Write the changes back into the overall database.
	 */

	Tcl_DictObjPut(interp, pDB, cdPtr->pkg, pkgDict);
    }

    /*
     * Now create the interface command for retrieval of the package
     * information.
     */

    Tcl_DStringInit(&cmdName);







|
<


|
>
>
>
|

|
|
|

|
|
|
|
|
|

|
|
|

|
|
|
|

|
|
|
|

|
|
|
|

|
|
|

|

|
|
|

|
<







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
142
143
144
145
146
147
148
149
150
151
152
153

154
155
156
157
158
159
160
     *
     * Note, the created command will have a reference through its clientdata.
     */

    Tcl_IncrRefCount(cdPtr->pkg);

    /*
     * For venc == NULL aka bogus encoding we fall back to "iso8859-1"

     */

    if (venc == NULL) {
    	venc = Tcl_GetEncoding(NULL, "iso8859-1");;
    }

    pDB = GetConfigDict(interp);

    /*
     * Retrieve package specific configuration...
     */

    if (Tcl_DictObjGet(interp, pDB, cdPtr->pkg, &pkgDict) != TCL_OK
	    || (pkgDict == NULL)) {
	pkgDict = Tcl_NewDictObj();
    } else if (Tcl_IsShared(pkgDict)) {
	pkgDict = Tcl_DuplicateObj(pkgDict);
    }

    /*
     * Extend the package configuration...
     */

    for (cfg=configuration ; cfg->key!=NULL && cfg->key[0]!='\0' ; cfg++) {
	Tcl_DString conv;
	const char *convValue =
		Tcl_ExternalToUtfDString(venc, cfg->value, -1, &conv);

	/*
	 * We know that the keys are in ASCII/UTF-8, so for them is no
	 * conversion required.
	 */

	Tcl_DictObjPut(interp, pkgDict, Tcl_NewStringObj(cfg->key, -1),
		Tcl_NewStringObj(convValue, -1));
	Tcl_DStringFree(&conv);
    }

    /*
     * We're now done with the encoding, so drop it.
     */

    Tcl_FreeEncoding(venc);

    /*
     * Write the changes back into the overall database.
     */

    Tcl_DictObjPut(interp, pDB, cdPtr->pkg, pkgDict);


    /*
     * Now create the interface command for retrieval of the package
     * information.
     */

    Tcl_DStringInit(&cmdName);