summaryrefslogtreecommitdiffstats
path: root/mac/tclMacResource.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2003-09-05 21:52:11 (GMT)
committerdgp <dgp@users.sourceforge.net>2003-09-05 21:52:11 (GMT)
commitc024a2de4b3868a69fd48901c50a0beedb49ed9d (patch)
treed3430b36c25b01800aa40d815fadb9629ef33770 /mac/tclMacResource.c
parent4383bd1bfc3daa1d69ddcb095a35c5e723f1ba6b (diff)
downloadtcl-c024a2de4b3868a69fd48901c50a0beedb49ed9d.zip
tcl-c024a2de4b3868a69fd48901c50a0beedb49ed9d.tar.gz
tcl-c024a2de4b3868a69fd48901c50a0beedb49ed9d.tar.bz2
* doc/FileSystem.3: Implementation of
* doc/source.n: TIPs 137/151. Adds * doc/tclsh.1: a -encoding option to * generic/tcl.decls: the [source] command * generic/tclCmdMZ.c (Tcl_SourceObjCmd): and a new C routine, * generic/tclIOUtil.c (Tcl_FSEvalFileEx): Tcl_FSEvalFileEx(), * generic/tclMain.c (Tcl_Main): that provides C access * mac/tclMacResource.c (Tcl_MacSourceObjCmd): to the same function. * tests/cmdMZ.test: Also adds command line * tests/main.test: option handling in Tcl_Main() so that tclsh * tests/source.test: and other apps built on Tcl_Main() respect a -encoding command line option before a script filename. Docs and tests updated as well. [Patch 742683] This is a ***POTENTIAL INCOMPATIBILITY*** only for those C programs that embed Tcl, build on Tcl_Main(), and make use of Tcl_Main's former ability to pass a leading "-encoding" option to interactive shell operations. * generic/tclInt.decls: Added internal stub * generic/tclMain.c (Tcl*StartupScript*): table entries for two new functions Tcl_SetStartupScript() and Tcl_GetStartupScript() that set/get the path and encoding for the startup script to be evaluated by either Tcl_Main() or Tk_Main(). Given public names in anticipation of their exposure by a followup TIP. * generic/tclDecls.h: make genstubs * generic/tclIntDecls.h: * generic/tclStubInit.c:
Diffstat (limited to 'mac/tclMacResource.c')
-rw-r--r--mac/tclMacResource.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/mac/tclMacResource.c b/mac/tclMacResource.c
index 49e1110..3833a65 100644
--- a/mac/tclMacResource.c
+++ b/mac/tclMacResource.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclMacResource.c,v 1.15 2003/05/14 19:21:24 das Exp $
+ * RCS: @(#) $Id: tclMacResource.c,v 1.16 2003/09/05 21:52:12 dgp Exp $
*/
#include <Errors.h>
@@ -946,6 +946,7 @@ Tcl_MacSourceObjCmd(
char *fileName = NULL, *rsrcName = NULL;
long rsrcID = -1;
char *string;
+ char *encodingName = NULL;
int length;
if (objc < 2 || objc > 4) {
@@ -968,6 +969,10 @@ Tcl_MacSourceObjCmd(
if (Tcl_GetLongFromObj(interp, objv[2], &rsrcID) != TCL_OK) {
return TCL_ERROR;
}
+ } else if (!strcmp(string, "-encoding")) {
+ if (objc != 4)
+ goto sourceFmtErr;
+ encodingName = Tcl_GetString(objv[2]);
} else {
errStr = errBad;
goto sourceFmtErr;
@@ -976,13 +981,19 @@ Tcl_MacSourceObjCmd(
if (objc == 4) {
fileName = Tcl_GetStringFromObj(objv[3], &length);
}
+
+ if (encodingName) {
+ return Tcl_FSEvalFileEx(interp, fileName, encodingName);
+ }
+
return Tcl_MacEvalResource(interp, rsrcName, rsrcID, fileName);
sourceFmtErr:
Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), errStr, "should be \"",
Tcl_GetString(objv[0]), " fileName\" or \"",
Tcl_GetString(objv[0]), " -rsrc name ?fileName?\" or \"",
- Tcl_GetString(objv[0]), " -rsrcid id ?fileName?\"",
+ Tcl_GetString(objv[0]), " -rsrcid id ?fileName?\" or \"",
+ Tcl_GetString(objv[0]), " -encoding name fileName\"",
(char *) NULL);
return TCL_ERROR;
}