1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
|
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
|
-
+
+
+
|
int
Tcl_FSEvalFileEx(
Tcl_Interp *interp, /* Interpreter that evaluates the script. */
Tcl_Obj *pathPtr, /* Pathname of the file to process.
* Tilde-substitution is performed on this
* pathname. */
const char *encodingName) /* Either the name of an encoding or NULL to
use the utf-8 encoding. */
use the utf-8 encoding. May also be TCL_SHELL_PROFILE_STRICT,
TCL_SHELL_PROFILE_REPLACE, or TCL_SHELL_PROFILE_TCL8,
for specifying the profile. */
{
Tcl_Size length;
int result = TCL_ERROR;
Tcl_StatBuf statBuf;
Tcl_Obj *oldScriptFile;
Interp *iPtr;
const char *string;
|
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
|
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
|
+
-
+
+
+
+
+
+
+
+
|
*/
Tcl_SetChannelOption(interp, chan, "-eofchar", "\x1A");
/*
* If the encoding is specified, set the channel to that encoding.
* Otherwise use utf-8. If the encoding is unknown report an error.
* "tcl8", "replace" or "strict" are permitted values too.
*/
if (encodingName == NULL) {
if (encodingName == NULL || encodingName == TCL_SHELL_PROFILE_STRICT) {
goto utf8;
} else if (encodingName == TCL_SHELL_PROFILE_REPLACE) {
Tcl_SetChannelOption(interp, chan, "-profile", "replace");
goto utf8;
} else if (encodingName == TCL_SHELL_PROFILE_TCL8) {
Tcl_SetChannelOption(interp, chan, "-profile", "tcl8");
utf8:
encodingName = "utf-8";
}
if (Tcl_SetChannelOption(interp, chan, "-encoding", encodingName)
!= TCL_OK) {
Tcl_CloseEx(interp,chan,0);
return result;
}
|
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
|
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
|
+
-
+
+
+
+
+
+
+
+
|
*/
Tcl_SetChannelOption(interp, chan, "-eofchar", "\x1A");
/*
* If the encoding is specified, set the channel to that encoding.
* Otherwise use utf-8. If the encoding is unknown report an error.
* "tcl8", "replace" or "strict" are permitted values too.
*/
if (encodingName == NULL) {
if (encodingName == NULL || encodingName == TCL_SHELL_PROFILE_STRICT) {
goto utf8;
} else if (encodingName == TCL_SHELL_PROFILE_REPLACE) {
Tcl_SetChannelOption(interp, chan, "-profile", "replace");
goto utf8;
} else if (encodingName == TCL_SHELL_PROFILE_TCL8) {
Tcl_SetChannelOption(interp, chan, "-profile", "tcl8");
utf8:
encodingName = "utf-8";
}
if (Tcl_SetChannelOption(interp, chan, "-encoding", encodingName)
!= TCL_OK) {
Tcl_CloseEx(interp, chan, 0);
return TCL_ERROR;
}
|