Diff
Not logged in

Differences From Artifact [a759152963]:

To Artifact [9001545058]:


70
71
72
73
74
75
76

77
78
79
80
81
82
83
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84







+







    const char *argv0)		/* The value of the application's argv[0]
				 * (native). */
{
    const char *name, *p;
    Tcl_StatBuf statBuf;
    Tcl_DString buffer, nameString, cwd, utfName;
    Tcl_Obj *obj;
    int status;

    if (argv0 == NULL) {
	return;
    }
    Tcl_DStringInit(&buffer);

    name = argv0;
160
161
162
163
164
165
166
167
168





169
170
171
172
173
174
175
161
162
163
164
165
166
167


168
169
170
171
172
173
174
175
176
177
178
179







-
-
+
+
+
+
+







  gotName:
#ifdef DJGPP
    if (name[1] == ':')
#else
    if (name[0] == '/')
#endif
    {
	Tcl_ExternalToUtfDStringEx(NULL, NULL, name, TCL_INDEX_NONE
		,TCL_ENCODING_PROFILE_TCL8 ,&utfName ,NULL);
	status = Tcl_ExternalToUtfDStringEx(NULL, NULL, name, TCL_INDEX_NONE
		,TCL_ENCODING_PROFILE_STRICT ,&utfName ,NULL);
	if (status != TCL_OK) {
	    Tcl_Panic("%s {unable to encode value of path}" ,"TclpFindExecutable");
	}
	TclSetObjNameOfExecutable(
		Tcl_NewStringObj(Tcl_DStringValue(&utfName), TCL_INDEX_NONE), NULL);
	Tcl_DStringFree(&utfName);
	goto done;
    }

    if (TclpGetCwd(NULL, &cwd) == NULL) {
188
189
190
191
192
193
194
195
196





197
198
199
200
201
202
203
204
205






206
207
208
209
210
211
212
192
193
194
195
196
197
198


199
200
201
202
203
204
205
206
207
208
209
210


211
212
213
214
215
216
217
218
219
220
221
222
223







-
-
+
+
+
+
+







-
-
+
+
+
+
+
+







	name += 2;
    }

    Tcl_DStringInit(&nameString);
    Tcl_DStringAppend(&nameString, name, TCL_INDEX_NONE);

    Tcl_DStringFree(&buffer);
    Tcl_UtfToExternalDStringEx(NULL, NULL, Tcl_DStringValue(&cwd),
	    Tcl_DStringLength(&cwd), TCL_ENCODING_PROFILE_TCL8, &buffer, NULL);
    status = Tcl_UtfToExternalDStringEx(NULL, NULL, Tcl_DStringValue(&cwd),
	    Tcl_DStringLength(&cwd), TCL_ENCODING_PROFILE_STRICT, &buffer, NULL);
    if (status != TCL_OK) {
	Tcl_Panic("%s {unable to encode value of cwd}" ,"TclpFindExecutable");
    }
    if (Tcl_DStringValue(&cwd)[Tcl_DStringLength(&cwd) -1] != '/') {
	TclDStringAppendLiteral(&buffer, "/");
    }
    Tcl_DStringFree(&cwd);
    TclDStringAppendDString(&buffer, &nameString);
    Tcl_DStringFree(&nameString);

    Tcl_ExternalToUtfDStringEx(NULL, NULL, Tcl_DStringValue(&buffer), TCL_INDEX_NONE,
	    TCL_ENCODING_PROFILE_TCL8, &utfName, NULL);
    status = Tcl_ExternalToUtfDStringEx(NULL, NULL, Tcl_DStringValue(&buffer)
	, TCL_INDEX_NONE, TCL_ENCODING_PROFILE_STRICT, &utfName, NULL);
    if (status != TCL_OK) {
	Tcl_Panic("%s {unable to encode value of executable name}"
	    ,"TclpFindExecutable");
    }
    TclSetObjNameOfExecutable(
	    Tcl_NewStringObj(Tcl_DStringValue(&utfName), TCL_INDEX_NONE), NULL);
    Tcl_DStringFree(&utfName);

  done:
    Tcl_DStringFree(&buffer);
}
1109
1110
1111
1112
1113
1114
1115

1116
1117
1118






1119
1120
1121
1122
1123
1124
1125
1120
1121
1122
1123
1124
1125
1126
1127
1128


1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141







+

-
-
+
+
+
+
+
+







 */

Tcl_Obj *
TclpNativeToNormalized(
    void *clientData)
{
    Tcl_DString ds;
    int status;

    Tcl_ExternalToUtfDStringEx(NULL, NULL, (const char *) clientData,
	    TCL_INDEX_NONE, TCL_ENCODING_PROFILE_TCL8, &ds, NULL);
    status = Tcl_ExternalToUtfDStringEx(NULL, NULL, (const char *) clientData,
	    TCL_INDEX_NONE, TCL_ENCODING_PROFILE_STRICT, &ds, NULL);
    if (status != TCL_OK) {
	Tcl_Panic("%s {unable to encode value}" ,"TclpNativeToNormalized");
    }

    return Tcl_DStringToObj(&ds);
}

/*
 *---------------------------------------------------------------------------
 *
 * TclNativeCreateNativeRep --