Attachment "tcl-enc-option.patch" to
ticket [742683ffff]
added by
a_kovalenko
2003-05-24 19:38:20.
0000: 64 69 66 66 20 2d 4e 61 75 72 64 20 74 63 6c 2f diff -Naurd tcl/
0010: 64 6f 63 2f 45 76 61 6c 2e 33 20 74 63 6c 2d 65 doc/Eval.3 tcl-e
0020: 6e 63 2d 6f 70 74 69 6f 6e 2f 64 6f 63 2f 45 76 nc-option/doc/Ev
0030: 61 6c 2e 33 0a 2d 2d 2d 20 74 63 6c 2f 64 6f 63 al.3.--- tcl/doc
0040: 2f 45 76 61 6c 2e 33 09 54 75 65 20 4d 61 79 20 /Eval.3.Tue May
0050: 31 33 20 32 33 3a 32 30 3a 35 34 20 32 30 30 33 13 23:20:54 2003
0060: 0a 2b 2b 2b 20 74 63 6c 2d 65 6e 63 2d 6f 70 74 .+++ tcl-enc-opt
0070: 69 6f 6e 2f 64 6f 63 2f 45 76 61 6c 2e 33 09 53 ion/doc/Eval.3.S
0080: 61 74 20 4d 61 79 20 32 34 20 31 35 3a 35 35 3a at May 24 15:55:
0090: 35 30 20 32 30 30 33 0a 40 40 20 2d 32 35 2c 36 50 2003.@@ -25,6
00a0: 20 2b 32 35 2c 39 20 40 40 0a 20 5c 66 42 54 63 +25,9 @@. \fBTc
00b0: 6c 5f 45 76 61 6c 46 69 6c 65 5c 66 52 28 5c 66 l_EvalFile\fR(\f
00c0: 49 69 6e 74 65 72 70 2c 20 66 69 6c 65 4e 61 6d Iinterp, fileNam
00d0: 65 5c 66 52 29 0a 20 2e 73 70 0a 20 69 6e 74 0a e\fR). .sp. int.
00e0: 2b 5c 66 42 54 63 6c 5f 45 76 61 6c 46 69 6c 65 +\fBTcl_EvalFile
00f0: 45 78 5c 66 52 28 5c 66 49 69 6e 74 65 72 70 2c Ex\fR(\fIinterp,
0100: 20 66 69 6c 65 4e 61 6d 65 2c 20 65 6e 63 6f 64 fileName, encod
0110: 69 6e 67 4e 61 6d 65 5c 66 52 29 0a 2b 2e 73 70 ingName\fR).+.sp
0120: 0a 2b 69 6e 74 0a 20 5c 66 42 54 63 6c 5f 45 76 .+int. \fBTcl_Ev
0130: 61 6c 4f 62 6a 76 5c 66 52 28 5c 66 49 69 6e 74 alObjv\fR(\fIint
0140: 65 72 70 2c 20 6f 62 6a 63 2c 20 6f 62 6a 76 2c erp, objc, objv,
0150: 20 66 6c 61 67 73 5c 66 52 29 0a 20 2e 73 70 0a flags\fR). .sp.
0160: 20 69 6e 74 0a 40 40 20 2d 35 36 2c 36 20 2b 35 int.@@ -56,6 +5
0170: 39 2c 38 20 40 40 0a 20 5c 66 42 54 43 4c 5f 45 9,8 @@. \fBTCL_E
0180: 56 41 4c 5f 47 4c 4f 42 41 4c 5c 66 52 20 61 6e VAL_GLOBAL\fR an
0190: 64 20 5c 66 42 54 43 4c 5f 45 56 41 4c 5f 44 49 d \fBTCL_EVAL_DI
01a0: 52 45 43 54 5c 66 52 20 61 72 65 20 63 75 72 72 RECT\fR are curr
01b0: 65 6e 74 6c 79 20 73 75 70 70 6f 72 74 65 64 2e ently supported.
01c0: 0a 20 2e 41 50 20 22 43 4f 4e 53 54 20 63 68 61 . .AP "CONST cha
01d0: 72 22 20 2a 66 69 6c 65 4e 61 6d 65 20 69 6e 0a r" *fileName in.
01e0: 20 4e 61 6d 65 20 6f 66 20 61 20 66 69 6c 65 20 Name of a file
01f0: 63 6f 6e 74 61 69 6e 69 6e 67 20 61 20 54 63 6c containing a Tcl
0200: 20 73 63 72 69 70 74 2e 0a 2b 2e 41 50 20 22 43 script..+.AP "C
0210: 4f 4e 53 54 20 63 68 61 72 22 20 2a 65 6e 63 6f ONST char" *enco
0220: 64 69 6e 67 4e 61 6d 65 20 69 6e 0a 2b 4e 61 6d dingName in.+Nam
0230: 65 20 6f 66 20 61 6e 20 65 6e 63 6f 64 69 6e 67 e of an encoding
0240: 20 6f 66 20 74 68 65 20 54 63 6c 20 73 63 72 69 of the Tcl scri
0250: 70 74 2e 0a 20 2e 41 50 20 69 6e 74 20 6f 62 6a pt.. .AP int obj
0260: 63 20 69 6e 0a 20 54 68 65 20 6e 75 6d 62 65 72 c in. The number
0270: 20 6f 66 20 6f 62 6a 65 63 74 73 20 69 6e 20 74 of objects in t
0280: 68 65 20 61 72 72 61 79 20 70 6f 69 6e 74 65 64 he array pointed
0290: 20 74 6f 20 62 79 20 5c 66 49 6f 62 6a 50 74 72 to by \fIobjPtr
02a0: 5c 66 52 3b 0a 20 74 68 69 73 20 69 73 20 61 6c \fR;. this is al
02b0: 73 6f 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 so the number of
02c0: 20 77 6f 72 64 73 20 69 6e 20 74 68 65 20 63 6f words in the co
02d0: 6d 6d 61 6e 64 2e 0a 64 69 66 66 20 2d 4e 61 75 mmand..diff -Nau
02e0: 72 64 20 74 63 6c 2f 64 6f 63 2f 73 6f 75 72 63 rd tcl/doc/sourc
02f0: 65 2e 6e 20 74 63 6c 2d 65 6e 63 2d 6f 70 74 69 e.n tcl-enc-opti
0300: 6f 6e 2f 64 6f 63 2f 73 6f 75 72 63 65 2e 6e 0a on/doc/source.n.
0310: 2d 2d 2d 20 74 63 6c 2f 64 6f 63 2f 73 6f 75 72 --- tcl/doc/sour
0320: 63 65 2e 6e 09 54 68 75 20 53 65 70 20 20 37 20 ce.n.Thu Sep 7
0330: 31 38 3a 32 37 3a 35 31 20 32 30 30 30 0a 2b 2b 18:27:51 2000.++
0340: 2b 20 74 63 6c 2d 65 6e 63 2d 6f 70 74 69 6f 6e + tcl-enc-option
0350: 2f 64 6f 63 2f 73 6f 75 72 63 65 2e 6e 09 53 61 /doc/source.n.Sa
0360: 74 20 4d 61 79 20 32 34 20 31 35 3a 35 37 3a 31 t May 24 15:57:1
0370: 36 20 32 30 30 33 0a 40 40 20 2d 31 37 2c 36 20 6 2003.@@ -17,6
0380: 2b 31 37 2c 38 20 40 40 0a 20 2e 53 48 20 53 59 +17,8 @@. .SH SY
0390: 4e 4f 50 53 49 53 0a 20 5c 66 42 73 6f 75 72 63 NOPSIS. \fBsourc
03a0: 65 20 5c 66 49 66 69 6c 65 4e 61 6d 65 5c 66 52 e \fIfileName\fR
03b0: 0a 20 2e 73 70 0a 2b 5c 66 42 73 6f 75 72 63 65 . .sp.+\fBsource
03c0: 5c 66 52 20 5c 66 42 5c 2d 65 6e 63 6f 64 69 6e \fR \fB\-encodin
03d0: 67 20 5c 66 49 65 6e 63 6f 64 69 6e 67 4e 61 6d g \fIencodingNam
03e0: 65 20 66 69 6c 65 4e 61 6d 65 5c 66 52 0a 2b 2e e fileName\fR.+.
03f0: 73 70 0a 20 5c 66 42 73 6f 75 72 63 65 5c 66 52 sp. \fBsource\fR
0400: 20 5c 66 42 5c 2d 72 73 72 63 20 5c 66 49 72 65 \fB\-rsrc \fIre
0410: 73 6f 75 72 63 65 4e 61 6d 65 20 5c 66 52 3f 5c sourceName \fR?\
0420: 66 49 66 69 6c 65 4e 61 6d 65 5c 66 52 3f 0a 20 fIfileName\fR?.
0430: 2e 73 70 0a 20 5c 66 42 73 6f 75 72 63 65 5c 66 .sp. \fBsource\f
0440: 52 20 5c 66 42 5c 2d 72 73 72 63 69 64 20 5c 66 R \fB\-rsrcid \f
0450: 49 72 65 73 6f 75 72 63 65 49 64 20 5c 66 52 3f IresourceId \fR?
0460: 5c 66 49 66 69 6c 65 4e 61 6d 65 5c 66 52 3f 0a \fIfileName\fR?.
0470: 64 69 66 66 20 2d 4e 61 75 72 64 20 74 63 6c 2f diff -Naurd tcl/
0480: 64 6f 63 2f 74 63 6c 73 68 2e 31 20 74 63 6c 2d doc/tclsh.1 tcl-
0490: 65 6e 63 2d 6f 70 74 69 6f 6e 2f 64 6f 63 2f 74 enc-option/doc/t
04a0: 63 6c 73 68 2e 31 0a 2d 2d 2d 20 74 63 6c 2f 64 clsh.1.--- tcl/d
04b0: 6f 63 2f 74 63 6c 73 68 2e 31 09 4d 6f 6e 20 46 oc/tclsh.1.Mon F
04c0: 65 62 20 31 37 20 31 36 3a 34 30 3a 34 30 20 32 eb 17 16:40:40 2
04d0: 30 30 33 0a 2b 2b 2b 20 74 63 6c 2d 65 6e 63 2d 003.+++ tcl-enc-
04e0: 6f 70 74 69 6f 6e 2f 64 6f 63 2f 74 63 6c 73 68 option/doc/tclsh
04f0: 2e 31 09 53 61 74 20 4d 61 79 20 32 34 20 31 36 .1.Sat May 24 16
0500: 3a 31 38 3a 35 30 20 32 30 30 33 0a 40 40 20 2d :18:50 2003.@@ -
0510: 31 34 2c 37 20 2b 31 34 2c 37 20 40 40 0a 20 2e 14,7 +14,7 @@. .
0520: 53 48 20 4e 41 4d 45 0a 20 74 63 6c 73 68 20 5c SH NAME. tclsh \
0530: 2d 20 53 69 6d 70 6c 65 20 73 68 65 6c 6c 20 63 - Simple shell c
0540: 6f 6e 74 61 69 6e 69 6e 67 20 54 63 6c 20 69 6e ontaining Tcl in
0550: 74 65 72 70 72 65 74 65 72 0a 20 2e 53 48 20 53 terpreter. .SH S
0560: 59 4e 4f 50 53 49 53 0a 2d 5c 66 42 74 63 6c 73 YNOPSIS.-\fBtcls
0570: 68 5c 66 52 20 3f 5c 66 49 66 69 6c 65 4e 61 6d h\fR ?\fIfileNam
0580: 65 20 61 72 67 20 61 72 67 20 2e 2e 2e 5c 66 52 e arg arg ...\fR
0590: 3f 0a 2b 5c 66 42 74 63 6c 73 68 5c 66 52 20 3f ?.+\fBtclsh\fR ?
05a0: 2d 65 6e 63 6f 64 69 6e 67 20 5c 66 49 6e 61 6d -encoding \fInam
05b0: 65 5c 66 52 3f 20 3f 5c 66 49 66 69 6c 65 4e 61 e\fR? ?\fIfileNa
05c0: 6d 65 20 61 72 67 20 61 72 67 20 2e 2e 2e 5c 66 me arg arg ...\f
05d0: 52 3f 0a 20 2e 42 45 0a 20 0a 20 2e 53 48 20 44 R?. .BE. . .SH D
05e0: 45 53 43 52 49 50 54 49 4f 4e 0a 64 69 66 66 20 ESCRIPTION.diff
05f0: 2d 4e 61 75 72 64 20 74 63 6c 2f 67 65 6e 65 72 -Naurd tcl/gener
0600: 69 63 2f 74 63 6c 2e 64 65 63 6c 73 20 74 63 6c ic/tcl.decls tcl
0610: 2d 65 6e 63 2d 6f 70 74 69 6f 6e 2f 67 65 6e 65 -enc-option/gene
0620: 72 69 63 2f 74 63 6c 2e 64 65 63 6c 73 0a 2d 2d ric/tcl.decls.--
0630: 2d 20 74 63 6c 2f 67 65 6e 65 72 69 63 2f 74 63 - tcl/generic/tc
0640: 6c 2e 64 65 63 6c 73 09 54 75 65 20 4d 61 79 20 l.decls.Tue May
0650: 31 33 20 32 33 3a 32 31 3a 30 38 20 32 30 30 33 13 23:21:08 2003
0660: 0a 2b 2b 2b 20 74 63 6c 2d 65 6e 63 2d 6f 70 74 .+++ tcl-enc-opt
0670: 69 6f 6e 2f 67 65 6e 65 72 69 63 2f 74 63 6c 2e ion/generic/tcl.
0680: 64 65 63 6c 73 09 53 61 74 20 4d 61 79 20 32 34 decls.Sat May 24
0690: 20 31 35 3a 34 31 3a 35 38 20 32 30 30 33 0a 40 15:41:58 2003.@
06a0: 40 20 2d 31 37 39 37 2c 36 20 2b 31 37 39 37 2c @ -1797,6 +1797,
06b0: 31 30 20 40 40 0a 20 20 20 20 20 54 63 6c 5f 4f 10 @@. Tcl_O
06c0: 62 6a 20 2a 54 63 6c 5f 44 62 4e 65 77 44 69 63 bj *Tcl_DbNewDic
06d0: 74 4f 62 6a 28 43 4f 4e 53 54 20 63 68 61 72 20 tObj(CONST char
06e0: 2a 66 69 6c 65 2c 20 69 6e 74 20 6c 69 6e 65 29 *file, int line)
06f0: 0a 20 7d 0a 20 0a 2b 64 65 63 6c 61 72 65 20 35 . }. .+declare 5
0700: 30 35 20 67 65 6e 65 72 69 63 20 7b 0a 2b 20 20 05 generic {.+
0710: 20 20 69 6e 74 20 54 63 6c 5f 46 53 45 76 61 6c int Tcl_FSEval
0720: 46 69 6c 65 45 78 28 54 63 6c 5f 49 6e 74 65 72 FileEx(Tcl_Inter
0730: 70 20 2a 69 6e 74 65 72 70 2c 20 54 63 6c 5f 4f p *interp, Tcl_O
0740: 62 6a 20 2a 66 69 6c 65 4e 61 6d 65 2c 0a 2b 20 bj *fileName,.+
0750: 20 20 20 20 20 20 20 20 20 20 20 43 4f 4e 53 54 CONST
0760: 20 63 68 61 72 20 2a 65 6e 63 6f 64 69 6e 67 4e char *encodingN
0770: 61 6d 65 29 0a 2b 7d 0a 20 23 23 23 23 23 23 23 ame).+}. #######
0780: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0790: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
07a0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
07b0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
07c0: 23 23 23 23 23 23 23 0a 20 0a 20 23 20 44 65 66 #######. . # Def
07d0: 69 6e 65 20 74 68 65 20 70 6c 61 74 66 6f 72 6d ine the platform
07e0: 20 73 70 65 63 69 66 69 63 20 70 75 62 6c 69 63 specific public
07f0: 20 54 63 6c 20 69 6e 74 65 72 66 61 63 65 2e 20 Tcl interface.
0800: 20 54 68 65 73 65 20 66 75 6e 63 74 69 6f 6e 73 These functions
0810: 20 61 72 65 0a 64 69 66 66 20 2d 4e 61 75 72 64 are.diff -Naurd
0820: 20 74 63 6c 2f 67 65 6e 65 72 69 63 2f 74 63 6c tcl/generic/tcl
0830: 43 6d 64 4d 5a 2e 63 20 74 63 6c 2d 65 6e 63 2d CmdMZ.c tcl-enc-
0840: 6f 70 74 69 6f 6e 2f 67 65 6e 65 72 69 63 2f 74 option/generic/t
0850: 63 6c 43 6d 64 4d 5a 2e 63 0a 2d 2d 2d 20 74 63 clCmdMZ.c.--- tc
0860: 6c 2f 67 65 6e 65 72 69 63 2f 74 63 6c 43 6d 64 l/generic/tclCmd
0870: 4d 5a 2e 63 09 54 75 65 20 4d 61 79 20 31 33 20 MZ.c.Tue May 13
0880: 32 33 3a 32 31 3a 30 39 20 32 30 30 33 0a 2b 2b 23:21:09 2003.++
0890: 2b 20 74 63 6c 2d 65 6e 63 2d 6f 70 74 69 6f 6e + tcl-enc-option
08a0: 2f 67 65 6e 65 72 69 63 2f 74 63 6c 43 6d 64 4d /generic/tclCmdM
08b0: 5a 2e 63 09 53 61 74 20 4d 61 79 20 32 34 20 31 Z.c.Sat May 24 1
08c0: 35 3a 33 39 3a 35 38 20 32 30 30 33 0a 40 40 20 5:39:58 2003.@@
08d0: 2d 31 31 30 35 2c 31 32 20 2b 31 31 30 35 2c 32 -1105,12 +1105,2
08e0: 33 20 40 40 0a 20 20 20 20 20 69 6e 74 20 6f 62 3 @@. int ob
08f0: 6a 63 3b 09 09 09 2f 2a 20 4e 75 6d 62 65 72 20 jc;.../* Number
0900: 6f 66 20 61 72 67 75 6d 65 6e 74 73 2e 20 2a 2f of arguments. */
0910: 0a 20 20 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 43 . Tcl_Obj *C
0920: 4f 4e 53 54 20 6f 62 6a 76 5b 5d 3b 09 2f 2a 20 ONST objv[];./*
0930: 41 72 67 75 6d 65 6e 74 20 6f 62 6a 65 63 74 73 Argument objects
0940: 2e 20 2a 2f 0a 20 7b 0a 2d 20 20 20 20 69 66 20 . */. {.- if
0950: 28 6f 62 6a 63 20 21 3d 20 32 29 20 7b 0a 2d 09 (objc != 2) {.-.
0960: 54 63 6c 5f 57 72 6f 6e 67 4e 75 6d 41 72 67 73 Tcl_WrongNumArgs
0970: 28 69 6e 74 65 72 70 2c 20 31 2c 20 6f 62 6a 76 (interp, 1, objv
0980: 2c 20 22 66 69 6c 65 4e 61 6d 65 22 29 3b 0a 2b , "fileName");.+
0990: 20 20 20 20 43 4f 4e 53 54 20 63 68 61 72 20 2a CONST char *
09a0: 65 6e 63 6f 64 69 6e 67 4e 61 6d 65 20 3d 20 4e encodingName = N
09b0: 55 4c 4c 3b 0a 2b 20 20 20 20 43 4f 4e 53 54 20 ULL;.+ CONST
09c0: 63 68 61 72 20 2a 61 72 67 3b 0a 2b 0a 2b 20 20 char *arg;.+.+
09d0: 20 20 69 66 20 28 6f 62 6a 63 20 21 3d 20 32 20 if (objc != 2
09e0: 26 26 20 6f 62 6a 63 20 21 3d 34 29 20 7b 0a 2b && objc !=4) {.+
09f0: 09 54 63 6c 5f 57 72 6f 6e 67 4e 75 6d 41 72 67 .Tcl_WrongNumArg
0a00: 73 28 69 6e 74 65 72 70 2c 20 31 2c 20 6f 62 6a s(interp, 1, obj
0a10: 76 2c 20 22 3f 2d 65 6e 63 6f 64 69 6e 67 20 6e v, "?-encoding n
0a20: 61 6d 65 3f 20 66 69 6c 65 4e 61 6d 65 22 29 3b ame? fileName");
0a30: 0a 20 09 72 65 74 75 72 6e 20 54 43 4c 5f 45 52 . .return TCL_ER
0a40: 52 4f 52 3b 0a 20 20 20 20 20 7d 0a 2d 0a 2d 20 ROR;. }.-.-
0a50: 20 20 20 72 65 74 75 72 6e 20 54 63 6c 5f 46 53 return Tcl_FS
0a60: 45 76 61 6c 46 69 6c 65 28 69 6e 74 65 72 70 2c EvalFile(interp,
0a70: 20 6f 62 6a 76 5b 31 5d 29 3b 0a 2b 20 20 20 20 objv[1]);.+
0a80: 69 66 20 28 6f 62 6a 63 20 3d 3d 20 34 29 20 7b if (objc == 4) {
0a90: 0a 2b 09 61 72 67 20 3d 20 54 63 6c 5f 47 65 74 .+.arg = Tcl_Get
0aa0: 53 74 72 69 6e 67 28 6f 62 6a 76 5b 31 5d 29 3b String(objv[1]);
0ab0: 0a 2b 09 69 66 20 28 73 74 72 63 6d 70 28 22 2d .+.if (strcmp("-
0ac0: 65 6e 63 6f 64 69 6e 67 22 2c 20 61 72 67 29 20 encoding", arg)
0ad0: 21 3d 20 30 29 20 7b 0a 2b 09 20 20 20 20 54 63 != 0) {.+. Tc
0ae0: 6c 5f 41 70 70 65 6e 64 52 65 73 75 6c 74 28 69 l_AppendResult(i
0af0: 6e 74 65 72 70 2c 20 22 62 61 64 20 61 72 67 75 nterp, "bad argu
0b00: 6d 65 6e 74 5c 22 22 2c 20 61 72 67 2c 0a 2b 09 ment\"", arg,.+.
0b10: 09 20 20 20 20 22 5c 22 3a 20 73 68 6f 75 6c 64 . "\": should
0b20: 20 62 65 20 2d 65 6e 63 6f 64 69 6e 67 22 29 3b be -encoding");
0b30: 0a 2b 09 20 20 20 20 72 65 74 75 72 6e 20 54 43 .+. return TC
0b40: 4c 5f 45 52 52 4f 52 3b 0a 2b 09 7d 0a 2b 09 65 L_ERROR;.+.}.+.e
0b50: 6e 63 6f 64 69 6e 67 4e 61 6d 65 20 3d 20 54 63 ncodingName = Tc
0b60: 6c 5f 47 65 74 53 74 72 69 6e 67 28 6f 62 6a 76 l_GetString(objv
0b70: 5b 32 5d 29 3b 0a 2b 20 20 20 20 7d 0a 2b 20 20 [2]);.+ }.+
0b80: 20 20 72 65 74 75 72 6e 20 54 63 6c 5f 46 53 45 return Tcl_FSE
0b90: 76 61 6c 46 69 6c 65 45 78 28 69 6e 74 65 72 70 valFileEx(interp
0ba0: 2c 20 6f 62 6a 76 5b 31 5d 2c 20 65 6e 63 6f 64 , objv[1], encod
0bb0: 69 6e 67 4e 61 6d 65 29 3b 0a 20 7d 0a 20 0c 0a ingName);. }. ..
0bc0: 20 2f 2a 0a 64 69 66 66 20 2d 4e 61 75 72 64 20 /*.diff -Naurd
0bd0: 74 63 6c 2f 67 65 6e 65 72 69 63 2f 74 63 6c 44 tcl/generic/tclD
0be0: 65 63 6c 73 2e 68 20 74 63 6c 2d 65 6e 63 2d 6f ecls.h tcl-enc-o
0bf0: 70 74 69 6f 6e 2f 67 65 6e 65 72 69 63 2f 74 63 ption/generic/tc
0c00: 6c 44 65 63 6c 73 2e 68 0a 2d 2d 2d 20 74 63 6c lDecls.h.--- tcl
0c10: 2f 67 65 6e 65 72 69 63 2f 74 63 6c 44 65 63 6c /generic/tclDecl
0c20: 73 2e 68 09 54 75 65 20 4d 61 79 20 31 33 20 32 s.h.Tue May 13 2
0c30: 33 3a 32 31 3a 31 30 20 32 30 30 33 0a 2b 2b 2b 3:21:10 2003.+++
0c40: 20 74 63 6c 2d 65 6e 63 2d 6f 70 74 69 6f 6e 2f tcl-enc-option/
0c50: 67 65 6e 65 72 69 63 2f 74 63 6c 44 65 63 6c 73 generic/tclDecls
0c60: 2e 68 09 53 61 74 20 4d 61 79 20 32 34 20 31 35 .h.Sat May 24 15
0c70: 3a 34 32 3a 34 31 20 32 30 30 33 0a 40 40 20 2d :42:41 2003.@@ -
0c80: 31 36 30 36 2c 36 20 2b 31 36 30 36 2c 31 30 20 1606,6 +1606,10
0c90: 40 40 0a 20 2f 2a 20 35 30 34 20 2a 2f 0a 20 45 @@. /* 504 */. E
0ca0: 58 54 45 52 4e 20 54 63 6c 5f 4f 62 6a 20 2a 09 XTERN Tcl_Obj *.
0cb0: 54 63 6c 5f 44 62 4e 65 77 44 69 63 74 4f 62 6a Tcl_DbNewDictObj
0cc0: 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 43 4f _ANSI_ARGS_((CO
0cd0: 4e 53 54 20 63 68 61 72 20 2a 20 66 69 6c 65 2c NST char * file,
0ce0: 20 0a 20 09 09 09 09 69 6e 74 20 6c 69 6e 65 29 . ....int line)
0cf0: 29 3b 0a 2b 2f 2a 20 35 30 35 20 2a 2f 0a 2b 45 );.+/* 505 */.+E
0d00: 58 54 45 52 4e 20 69 6e 74 09 09 54 63 6c 5f 46 XTERN int..Tcl_F
0d10: 53 45 76 61 6c 46 69 6c 65 45 78 20 5f 41 4e 53 SEvalFileEx _ANS
0d20: 49 5f 41 52 47 53 5f 28 28 54 63 6c 5f 49 6e 74 I_ARGS_((Tcl_Int
0d30: 65 72 70 20 2a 20 69 6e 74 65 72 70 2c 20 0a 2b erp * interp, .+
0d40: 09 09 09 09 54 63 6c 5f 4f 62 6a 20 2a 20 66 69 ....Tcl_Obj * fi
0d50: 6c 65 4e 61 6d 65 2c 20 0a 2b 09 09 09 09 43 4f leName, .+....CO
0d60: 4e 53 54 20 63 68 61 72 20 2a 20 65 6e 63 6f 64 NST char * encod
0d70: 69 6e 67 4e 61 6d 65 29 29 3b 0a 20 0a 20 74 79 ingName));. . ty
0d80: 70 65 64 65 66 20 73 74 72 75 63 74 20 54 63 6c pedef struct Tcl
0d90: 53 74 75 62 48 6f 6f 6b 73 20 7b 0a 20 20 20 20 StubHooks {.
0da0: 20 73 74 72 75 63 74 20 54 63 6c 50 6c 61 74 53 struct TclPlatS
0db0: 74 75 62 73 20 2a 74 63 6c 50 6c 61 74 53 74 75 tubs *tclPlatStu
0dc0: 62 73 3b 0a 40 40 20 2d 32 31 37 30 2c 36 20 2b bs;.@@ -2170,6 +
0dd0: 32 31 37 34 2c 37 20 40 40 0a 20 20 20 20 20 69 2174,7 @@. i
0de0: 6e 74 20 28 2a 74 63 6c 5f 44 69 63 74 4f 62 6a nt (*tcl_DictObj
0df0: 52 65 6d 6f 76 65 4b 65 79 4c 69 73 74 29 20 5f RemoveKeyList) _
0e00: 41 4e 53 49 5f 41 52 47 53 5f 28 28 54 63 6c 5f ANSI_ARGS_((Tcl_
0e10: 49 6e 74 65 72 70 20 2a 20 69 6e 74 65 72 70 2c Interp * interp,
0e20: 20 54 63 6c 5f 4f 62 6a 20 2a 20 64 69 63 74 50 Tcl_Obj * dictP
0e30: 74 72 2c 20 69 6e 74 20 6b 65 79 63 2c 20 54 63 tr, int keyc, Tc
0e40: 6c 5f 4f 62 6a 20 2a 43 4f 4e 53 54 20 2a 20 6b l_Obj *CONST * k
0e50: 65 79 76 29 29 3b 20 2f 2a 20 35 30 32 20 2a 2f eyv)); /* 502 */
0e60: 0a 20 20 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 20 . Tcl_Obj *
0e70: 28 2a 74 63 6c 5f 4e 65 77 44 69 63 74 4f 62 6a (*tcl_NewDictObj
0e80: 29 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 76 ) _ANSI_ARGS_((v
0e90: 6f 69 64 29 29 3b 20 2f 2a 20 35 30 33 20 2a 2f oid)); /* 503 */
0ea0: 0a 20 20 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 20 . Tcl_Obj *
0eb0: 28 2a 74 63 6c 5f 44 62 4e 65 77 44 69 63 74 4f (*tcl_DbNewDictO
0ec0: 62 6a 29 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 bj) _ANSI_ARGS_(
0ed0: 28 43 4f 4e 53 54 20 63 68 61 72 20 2a 20 66 69 (CONST char * fi
0ee0: 6c 65 2c 20 69 6e 74 20 6c 69 6e 65 29 29 3b 20 le, int line));
0ef0: 2f 2a 20 35 30 34 20 2a 2f 0a 2b 20 20 20 20 69 /* 504 */.+ i
0f00: 6e 74 20 28 2a 74 63 6c 5f 46 53 45 76 61 6c 46 nt (*tcl_FSEvalF
0f10: 69 6c 65 45 78 29 20 5f 41 4e 53 49 5f 41 52 47 ileEx) _ANSI_ARG
0f20: 53 5f 28 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a S_((Tcl_Interp *
0f30: 20 69 6e 74 65 72 70 2c 20 54 63 6c 5f 4f 62 6a interp, Tcl_Obj
0f40: 20 2a 20 66 69 6c 65 4e 61 6d 65 2c 20 43 4f 4e * fileName, CON
0f50: 53 54 20 63 68 61 72 20 2a 20 65 6e 63 6f 64 69 ST char * encodi
0f60: 6e 67 4e 61 6d 65 29 29 3b 20 2f 2a 20 35 30 35 ngName)); /* 505
0f70: 20 2a 2f 0a 20 7d 20 54 63 6c 53 74 75 62 73 3b */. } TclStubs;
0f80: 0a 20 0a 20 23 69 66 64 65 66 20 5f 5f 63 70 6c . . #ifdef __cpl
0f90: 75 73 70 6c 75 73 0a 40 40 20 2d 34 32 32 39 2c usplus.@@ -4229,
0fa0: 36 20 2b 34 32 33 34 2c 31 30 20 40 40 0a 20 23 6 +4234,10 @@. #
0fb0: 69 66 6e 64 65 66 20 54 63 6c 5f 44 62 4e 65 77 ifndef Tcl_DbNew
0fc0: 44 69 63 74 4f 62 6a 0a 20 23 64 65 66 69 6e 65 DictObj. #define
0fd0: 20 54 63 6c 5f 44 62 4e 65 77 44 69 63 74 4f 62 Tcl_DbNewDictOb
0fe0: 6a 20 5c 0a 20 09 28 74 63 6c 53 74 75 62 73 50 j \. .(tclStubsP
0ff0: 74 72 2d 3e 74 63 6c 5f 44 62 4e 65 77 44 69 63 tr->tcl_DbNewDic
1000: 74 4f 62 6a 29 20 2f 2a 20 35 30 34 20 2a 2f 0a tObj) /* 504 */.
1010: 2b 23 65 6e 64 69 66 0a 2b 23 69 66 6e 64 65 66 +#endif.+#ifndef
1020: 20 54 63 6c 5f 46 53 45 76 61 6c 46 69 6c 65 45 Tcl_FSEvalFileE
1030: 78 0a 2b 23 64 65 66 69 6e 65 20 54 63 6c 5f 46 x.+#define Tcl_F
1040: 53 45 76 61 6c 46 69 6c 65 45 78 20 5c 0a 2b 09 SEvalFileEx \.+.
1050: 28 74 63 6c 53 74 75 62 73 50 74 72 2d 3e 74 63 (tclStubsPtr->tc
1060: 6c 5f 46 53 45 76 61 6c 46 69 6c 65 45 78 29 20 l_FSEvalFileEx)
1070: 2f 2a 20 35 30 35 20 2a 2f 0a 20 23 65 6e 64 69 /* 505 */. #endi
1080: 66 0a 20 0a 20 23 65 6e 64 69 66 20 2f 2a 20 64 f. . #endif /* d
1090: 65 66 69 6e 65 64 28 55 53 45 5f 54 43 4c 5f 53 efined(USE_TCL_S
10a0: 54 55 42 53 29 20 26 26 20 21 64 65 66 69 6e 65 TUBS) && !define
10b0: 64 28 55 53 45 5f 54 43 4c 5f 53 54 55 42 5f 50 d(USE_TCL_STUB_P
10c0: 52 4f 43 53 29 20 2a 2f 0a 64 69 66 66 20 2d 4e ROCS) */.diff -N
10d0: 61 75 72 64 20 74 63 6c 2f 67 65 6e 65 72 69 63 aurd tcl/generic
10e0: 2f 74 63 6c 49 4f 55 74 69 6c 2e 63 20 74 63 6c /tclIOUtil.c tcl
10f0: 2d 65 6e 63 2d 6f 70 74 69 6f 6e 2f 67 65 6e 65 -enc-option/gene
1100: 72 69 63 2f 74 63 6c 49 4f 55 74 69 6c 2e 63 0a ric/tclIOUtil.c.
1110: 2d 2d 2d 20 74 63 6c 2f 67 65 6e 65 72 69 63 2f --- tcl/generic/
1120: 74 63 6c 49 4f 55 74 69 6c 2e 63 09 54 68 75 20 tclIOUtil.c.Thu
1130: 4d 61 79 20 31 35 20 30 30 3a 35 36 3a 35 35 20 May 15 00:56:55
1140: 32 30 30 33 0a 2b 2b 2b 20 74 63 6c 2d 65 6e 63 2003.+++ tcl-enc
1150: 2d 6f 70 74 69 6f 6e 2f 67 65 6e 65 72 69 63 2f -option/generic/
1160: 74 63 6c 49 4f 55 74 69 6c 2e 63 09 53 61 74 20 tclIOUtil.c.Sat
1170: 4d 61 79 20 32 34 20 31 35 3a 35 30 3a 31 32 20 May 24 15:50:12
1180: 32 30 30 33 0a 40 40 20 2d 31 33 33 38 2c 31 30 2003.@@ -1338,10
1190: 20 2b 31 33 33 38 2c 32 30 20 40 40 0a 20 20 20 +1338,20 @@.
11a0: 20 20 72 65 74 75 72 6e 20 6d 6f 64 65 3b 0a 20 return mode;.
11b0: 7d 0a 20 0c 0a 2b 2f 2a 20 54 63 6c 5f 46 53 45 }. ..+/* Tcl_FSE
11c0: 76 61 6c 46 69 6c 65 20 69 73 20 54 63 6c 5f 46 valFile is Tcl_F
11d0: 53 45 76 61 6c 46 69 6c 65 45 78 20 77 69 74 68 SEvalFileEx with
11e0: 6f 75 74 20 65 6e 63 6f 64 69 6e 67 20 61 72 67 out encoding arg
11f0: 75 6d 65 6e 74 20 2a 2f 0a 2b 69 6e 74 0a 2b 54 ument */.+int.+T
1200: 63 6c 5f 46 53 45 76 61 6c 46 69 6c 65 28 69 6e cl_FSEvalFile(in
1210: 74 65 72 70 2c 20 70 61 74 68 50 74 72 29 0a 2b terp, pathPtr).+
1220: 20 20 20 20 54 63 6c 5f 49 6e 74 65 72 70 20 2a Tcl_Interp *
1230: 69 6e 74 65 72 70 3b 09 09 2f 2a 20 49 6e 74 65 interp;../* Inte
1240: 72 70 72 65 74 65 72 20 69 6e 20 77 68 69 63 68 rpreter in which
1250: 20 74 6f 20 70 72 6f 63 65 73 73 20 66 69 6c 65 to process file
1260: 2e 20 2a 2f 0a 2b 20 20 20 20 54 63 6c 5f 4f 62 . */.+ Tcl_Ob
1270: 6a 20 2a 70 61 74 68 50 74 72 3b 09 09 2f 2a 20 j *pathPtr;../*
1280: 50 61 74 68 20 6f 66 20 66 69 6c 65 20 74 6f 20 Path of file to
1290: 70 72 6f 63 65 73 73 2e 20 20 54 69 6c 64 65 2d process. Tilde-
12a0: 73 75 62 73 74 69 74 75 74 69 6f 6e 0a 2b 09 09 substitution.+..
12b0: 09 09 20 2a 20 77 69 6c 6c 20 62 65 20 70 65 72 .. * will be per
12c0: 66 6f 72 6d 65 64 20 6f 6e 20 74 68 69 73 20 6e formed on this n
12d0: 61 6d 65 2e 20 2a 2f 0a 2b 7b 0a 2b 20 20 20 20 ame. */.+{.+
12e0: 72 65 74 75 72 6e 20 54 63 6c 5f 46 53 45 76 61 return Tcl_FSEva
12f0: 6c 46 69 6c 65 45 78 28 69 6e 74 65 72 70 2c 20 lFileEx(interp,
1300: 70 61 74 68 50 74 72 2c 20 4e 55 4c 4c 29 3b 0a pathPtr, NULL);.
1310: 2b 7d 0a 2b 0c 0a 20 2f 2a 0a 20 20 2a 2d 2d 2d +}.+.. /*. *---
1320: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
1330: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
1340: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
1350: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
1360: 2d 2d 2d 0a 20 20 2a 0a 2d 20 2a 20 54 63 6c 5f ---. *.- * Tcl_
1370: 46 53 45 76 61 6c 46 69 6c 65 20 2d 2d 0a 2b 20 FSEvalFile --.+
1380: 2a 20 54 63 6c 5f 46 53 45 76 61 6c 46 69 6c 65 * Tcl_FSEvalFile
1390: 45 78 20 2d 2d 0a 20 20 2a 0a 20 20 2a 09 52 65 Ex --. *. *.Re
13a0: 61 64 20 69 6e 20 61 20 66 69 6c 65 20 61 6e 64 ad in a file and
13b0: 20 70 72 6f 63 65 73 73 20 74 68 65 20 65 6e 74 process the ent
13c0: 69 72 65 20 66 69 6c 65 20 61 73 20 6f 6e 65 20 ire file as one
13d0: 67 69 67 61 6e 74 69 63 0a 20 20 2a 09 54 63 6c gigantic. *.Tcl
13e0: 20 63 6f 6d 6d 61 6e 64 2e 0a 40 40 20 2d 31 33 command..@@ -13
13f0: 36 30 2c 31 30 20 2b 31 33 37 30 2c 31 31 20 40 60,10 +1370,11 @
1400: 40 0a 20 20 2a 2f 0a 20 0a 20 69 6e 74 0a 2d 54 @. */. . int.-T
1410: 63 6c 5f 46 53 45 76 61 6c 46 69 6c 65 28 69 6e cl_FSEvalFile(in
1420: 74 65 72 70 2c 20 70 61 74 68 50 74 72 29 0a 2b terp, pathPtr).+
1430: 54 63 6c 5f 46 53 45 76 61 6c 46 69 6c 65 45 78 Tcl_FSEvalFileEx
1440: 28 69 6e 74 65 72 70 2c 20 70 61 74 68 50 74 72 (interp, pathPtr
1450: 2c 20 65 6e 63 6f 64 69 6e 67 4e 61 6d 65 29 0a , encodingName).
1460: 20 20 20 20 20 54 63 6c 5f 49 6e 74 65 72 70 20 Tcl_Interp
1470: 2a 69 6e 74 65 72 70 3b 09 09 2f 2a 20 49 6e 74 *interp;../* Int
1480: 65 72 70 72 65 74 65 72 20 69 6e 20 77 68 69 63 erpreter in whic
1490: 68 20 74 6f 20 70 72 6f 63 65 73 73 20 66 69 6c h to process fil
14a0: 65 2e 20 2a 2f 0a 20 20 20 20 20 54 63 6c 5f 4f e. */. Tcl_O
14b0: 62 6a 20 2a 70 61 74 68 50 74 72 3b 09 09 2f 2a bj *pathPtr;../*
14c0: 20 50 61 74 68 20 6f 66 20 66 69 6c 65 20 74 6f Path of file to
14d0: 20 70 72 6f 63 65 73 73 2e 20 20 54 69 6c 64 65 process. Tilde
14e0: 2d 73 75 62 73 74 69 74 75 74 69 6f 6e 0a 20 09 -substitution. .
14f0: 09 09 09 20 2a 20 77 69 6c 6c 20 62 65 20 70 65 ... * will be pe
1500: 72 66 6f 72 6d 65 64 20 6f 6e 20 74 68 69 73 20 rformed on this
1510: 6e 61 6d 65 2e 20 2a 2f 0a 2b 20 20 20 20 43 4f name. */.+ CO
1520: 4e 53 54 20 63 68 61 72 20 2a 65 6e 63 6f 64 69 NST char *encodi
1530: 6e 67 4e 61 6d 65 3b 0a 20 7b 0a 20 20 20 20 20 ngName;. {.
1540: 69 6e 74 20 72 65 73 75 6c 74 2c 20 6c 65 6e 67 int result, leng
1550: 74 68 3b 0a 20 20 20 20 20 54 63 6c 5f 53 74 61 th;. Tcl_Sta
1560: 74 42 75 66 20 73 74 61 74 42 75 66 3b 0a 40 40 tBuf statBuf;.@@
1570: 20 2d 31 34 30 31 2c 36 20 2b 31 34 31 32 2c 31 -1401,6 +1412,1
1580: 38 20 40 40 0a 20 20 20 20 20 20 2a 20 5b 42 75 8 @@. * [Bu
1590: 67 3a 20 32 30 34 30 5d 0a 20 20 20 20 20 20 2a g: 2040]. *
15a0: 2f 0a 20 20 20 20 20 54 63 6c 5f 53 65 74 43 68 /. Tcl_SetCh
15b0: 61 6e 6e 65 6c 4f 70 74 69 6f 6e 28 69 6e 74 65 annelOption(inte
15c0: 72 70 2c 20 63 68 61 6e 2c 20 22 2d 65 6f 66 63 rp, chan, "-eofc
15d0: 68 61 72 22 2c 20 22 5c 33 32 22 29 3b 0a 2b 20 har", "\32");.+
15e0: 20 20 20 2f 2a 0a 2b 20 20 20 20 20 2a 20 49 66 /*.+ * If
15f0: 20 74 68 65 20 65 6e 63 6f 64 69 6e 67 20 69 73 the encoding is
1600: 20 73 70 65 63 69 66 69 65 64 2c 20 73 65 74 20 specified, set
1610: 69 74 20 66 6f 72 20 74 68 65 20 63 68 61 6e 6e it for the chann
1620: 65 6c 2e 0a 2b 20 20 20 20 20 2a 20 45 6c 73 65 el..+ * Else
1630: 20 64 6f 6e 27 74 20 74 6f 75 63 68 20 69 74 20 don't touch it
1640: 28 61 6e 64 20 75 73 65 20 74 68 65 20 73 79 73 (and use the sys
1650: 74 65 6d 20 65 6e 63 6f 64 69 6e 67 29 0a 2b 20 tem encoding).+
1660: 20 20 20 20 2a 20 52 65 70 6f 72 74 20 65 72 72 * Report err
1670: 6f 72 20 6f 6e 20 75 6e 6b 6e 6f 77 6e 20 65 6e or on unknown en
1680: 63 6f 64 69 6e 67 2e 0a 2b 20 20 20 20 20 2a 2f coding..+ */
1690: 0a 2b 20 20 20 20 69 66 20 28 65 6e 63 6f 64 69 .+ if (encodi
16a0: 6e 67 4e 61 6d 65 29 20 7b 0a 2b 09 69 66 20 28 ngName) {.+.if (
16b0: 54 63 6c 5f 53 65 74 43 68 61 6e 6e 65 6c 4f 70 Tcl_SetChannelOp
16c0: 74 69 6f 6e 28 69 6e 74 65 72 70 2c 20 63 68 61 tion(interp, cha
16d0: 6e 2c 20 22 2d 65 6e 63 6f 64 69 6e 67 22 2c 20 n, "-encoding",
16e0: 65 6e 63 6f 64 69 6e 67 4e 61 6d 65 29 0a 2b 09 encodingName).+.
16f0: 09 21 3d 20 54 43 4c 5f 4f 4b 29 20 7b 0a 2b 09 .!= TCL_OK) {.+.
1700: 20 20 20 20 54 63 6c 5f 43 6c 6f 73 65 28 69 6e Tcl_Close(in
1710: 74 65 72 70 2c 63 68 61 6e 29 3b 0a 2b 09 20 20 terp,chan);.+.
1720: 20 20 67 6f 74 6f 20 65 6e 64 3b 0a 2b 09 7d 0a goto end;.+.}.
1730: 2b 20 20 20 20 7d 0a 20 20 20 20 20 69 66 20 28 + }. if (
1740: 54 63 6c 5f 52 65 61 64 43 68 61 72 73 28 63 68 Tcl_ReadChars(ch
1750: 61 6e 2c 20 6f 62 6a 50 74 72 2c 20 2d 31 2c 20 an, objPtr, -1,
1760: 30 29 20 3c 20 30 29 20 7b 0a 20 20 20 20 20 20 0) < 0) {.
1770: 20 20 20 54 63 6c 5f 43 6c 6f 73 65 28 69 6e 74 Tcl_Close(int
1780: 65 72 70 2c 20 63 68 61 6e 29 3b 0a 20 09 54 63 erp, chan);. .Tc
1790: 6c 5f 41 70 70 65 6e 64 52 65 73 75 6c 74 28 69 l_AppendResult(i
17a0: 6e 74 65 72 70 2c 20 22 63 6f 75 6c 64 6e 27 74 nterp, "couldn't
17b0: 20 72 65 61 64 20 66 69 6c 65 20 5c 22 22 2c 20 read file \"",
17c0: 0a 64 69 66 66 20 2d 4e 61 75 72 64 20 74 63 6c .diff -Naurd tcl
17d0: 2f 67 65 6e 65 72 69 63 2f 74 63 6c 4d 61 69 6e /generic/tclMain
17e0: 2e 63 20 74 63 6c 2d 65 6e 63 2d 6f 70 74 69 6f .c tcl-enc-optio
17f0: 6e 2f 67 65 6e 65 72 69 63 2f 74 63 6c 4d 61 69 n/generic/tclMai
1800: 6e 2e 63 0a 2d 2d 2d 20 74 63 6c 2f 67 65 6e 65 n.c.--- tcl/gene
1810: 72 69 63 2f 74 63 6c 4d 61 69 6e 2e 63 09 54 75 ric/tclMain.c.Tu
1820: 65 20 4d 61 79 20 32 30 20 30 34 3a 35 38 3a 34 e May 20 04:58:4
1830: 30 20 32 30 30 33 0a 2b 2b 2b 20 74 63 6c 2d 65 0 2003.+++ tcl-e
1840: 6e 63 2d 6f 70 74 69 6f 6e 2f 67 65 6e 65 72 69 nc-option/generi
1850: 63 2f 74 63 6c 4d 61 69 6e 2e 63 09 53 61 74 20 c/tclMain.c.Sat
1860: 4d 61 79 20 32 34 20 31 36 3a 32 30 3a 32 33 20 May 24 16:20:23
1870: 32 30 30 33 0a 40 40 20 2d 32 30 36 2c 36 20 2b 2003.@@ -206,6 +
1880: 32 30 36 2c 37 20 40 40 0a 20 7b 0a 20 20 20 20 206,7 @@. {.
1890: 20 54 63 6c 5f 4f 62 6a 20 2a 72 65 73 75 6c 74 Tcl_Obj *result
18a0: 50 74 72 3b 0a 20 20 20 20 20 54 63 6c 5f 4f 62 Ptr;. Tcl_Ob
18b0: 6a 20 2a 63 6f 6d 6d 61 6e 64 50 74 72 20 3d 20 j *commandPtr =
18c0: 4e 55 4c 4c 3b 0a 2b 20 20 20 20 43 4f 4e 53 54 NULL;.+ CONST
18d0: 20 63 68 61 72 20 2a 65 6e 63 6f 64 69 6e 67 4e char *encodingN
18e0: 61 6d 65 20 3d 20 4e 55 4c 4c 3b 0a 20 20 20 20 ame = NULL;.
18f0: 20 63 68 61 72 20 62 75 66 66 65 72 5b 54 43 4c char buffer[TCL
1900: 5f 49 4e 54 45 47 45 52 5f 53 50 41 43 45 20 2b _INTEGER_SPACE +
1910: 20 35 5d 2c 20 2a 61 72 67 73 3b 0a 20 20 20 20 5], *args;.
1920: 20 50 72 6f 6d 70 74 54 79 70 65 20 70 72 6f 6d PromptType prom
1930: 70 74 20 3d 20 50 52 4f 4d 50 54 5f 53 54 41 52 pt = PROMPT_STAR
1940: 54 3b 0a 20 20 20 20 20 69 6e 74 20 63 6f 64 65 T;. int code
1950: 2c 20 6c 65 6e 67 74 68 2c 20 74 74 79 3b 0a 40 , length, tty;.@
1960: 40 20 2d 32 32 33 2c 39 20 2b 32 32 34 2c 32 32 @ -223,9 +224,22
1970: 20 40 40 0a 20 20 20 20 20 20 2a 20 4d 61 6b 65 @@. * Make
1980: 20 63 6f 6d 6d 61 6e 64 2d 6c 69 6e 65 20 61 72 command-line ar
1990: 67 75 6d 65 6e 74 73 20 61 76 61 69 6c 61 62 6c guments availabl
19a0: 65 20 69 6e 20 74 68 65 20 54 63 6c 20 76 61 72 e in the Tcl var
19b0: 69 61 62 6c 65 73 20 22 61 72 67 63 22 0a 20 20 iables "argc".
19c0: 20 20 20 20 2a 20 61 6e 64 20 22 61 72 67 76 22 * and "argv"
19d0: 2e 20 20 49 66 20 74 68 65 20 66 69 72 73 74 20 . If the first
19e0: 61 72 67 75 6d 65 6e 74 20 64 6f 65 73 6e 27 74 argument doesn't
19f0: 20 73 74 61 72 74 20 77 69 74 68 20 61 20 22 2d start with a "-
1a00: 22 20 74 68 65 6e 0a 20 20 20 20 20 20 2a 20 73 " then. * s
1a10: 74 72 69 70 20 69 74 20 6f 66 66 20 61 6e 64 20 trip it off and
1a20: 75 73 65 20 69 74 20 61 73 20 74 68 65 20 6e 61 use it as the na
1a30: 6d 65 20 6f 66 20 61 20 73 63 72 69 70 74 20 66 me of a script f
1a40: 69 6c 65 20 74 6f 20 70 72 6f 63 65 73 73 2e 0a ile to process..
1a50: 2b 20 20 20 20 20 2a 20 49 66 20 74 68 65 20 66 + * If the f
1a60: 69 72 73 74 20 61 72 67 75 6d 65 6e 74 20 69 73 irst argument is
1a70: 20 22 2d 65 6e 63 6f 64 69 6e 67 3a 6e 61 6d 65 "-encoding:name
1a80: 22 20 74 68 65 6e 20 73 74 72 69 70 20 69 74 20 " then strip it
1a90: 6f 66 66 20 61 6e 64 0a 2b 20 20 20 20 20 2a 20 off and.+ *
1aa0: 75 73 65 20 61 73 20 74 68 65 20 65 6e 63 6f 64 use as the encod
1ab0: 69 6e 67 20 6f 66 20 74 68 65 20 73 63 72 69 70 ing of the scrip
1ac0: 74 20 66 69 6c 65 2e 0a 2b 20 20 20 20 20 2a 20 t file..+ *
1ad0: 49 66 20 74 68 65 20 66 69 72 73 74 20 61 72 67 If the first arg
1ae0: 75 6d 65 6e 74 20 69 73 20 22 2d 65 6e 63 6f 64 ument is "-encod
1af0: 69 6e 67 22 20 74 68 65 6e 20 75 73 65 20 74 68 ing" then use th
1b00: 65 20 73 65 63 6f 6e 64 20 6f 6e 65 20 61 73 0a e second one as.
1b10: 2b 20 20 20 20 20 2a 20 74 68 65 20 65 6e 63 6f + * the enco
1b20: 64 69 6e 67 2e 0a 20 20 20 20 20 20 2a 2f 0a 20 ding.. */.
1b30: 0a 20 20 20 20 20 69 66 20 28 54 63 6c 47 65 74 . if (TclGet
1b40: 53 74 61 72 74 75 70 53 63 72 69 70 74 50 61 74 StartupScriptPat
1b50: 68 28 29 20 3d 3d 20 4e 55 4c 4c 29 20 7b 0a 2b h() == NULL) {.+
1b60: 09 69 66 20 28 28 61 72 67 63 20 3e 20 32 29 20 .if ((argc > 2)
1b70: 26 26 20 28 73 74 72 63 6d 70 28 61 72 67 76 5b && (strcmp(argv[
1b80: 31 5d 2c 22 2d 65 6e 63 6f 64 69 6e 67 22 29 3d 1],"-encoding")=
1b90: 3d 30 29 29 20 7b 0a 2b 09 20 20 20 20 65 6e 63 =0)) {.+. enc
1ba0: 6f 64 69 6e 67 4e 61 6d 65 20 3d 20 61 72 67 76 odingName = argv
1bb0: 5b 32 5d 3b 0a 2b 09 20 20 20 20 61 72 67 63 2d [2];.+. argc-
1bc0: 3d 32 3b 0a 2b 09 20 20 20 20 61 72 67 76 2b 3d =2;.+. argv+=
1bd0: 32 3b 0a 2b 09 7d 20 65 6c 73 65 20 69 66 20 28 2;.+.} else if (
1be0: 28 61 72 67 63 20 3e 20 31 29 20 26 26 20 28 73 (argc > 1) && (s
1bf0: 74 72 6e 63 6d 70 28 61 72 67 76 5b 31 5d 2c 22 trncmp(argv[1],"
1c00: 2d 65 6e 63 6f 64 69 6e 67 3a 22 2c 31 30 29 3d -encoding:",10)=
1c10: 3d 30 29 29 20 7b 0a 2b 09 20 20 20 20 65 6e 63 =0)) {.+. enc
1c20: 6f 64 69 6e 67 4e 61 6d 65 20 3d 20 61 72 67 76 odingName = argv
1c30: 5b 31 5d 2b 31 30 3b 0a 2b 09 20 20 20 20 61 72 [1]+10;.+. ar
1c40: 67 63 2d 2d 3b 0a 2b 09 20 20 20 20 61 72 67 76 gc--;.+. argv
1c50: 2b 2b 3b 0a 2b 09 7d 0a 20 09 69 66 20 28 28 61 ++;.+.}. .if ((a
1c60: 72 67 63 20 3e 20 31 29 20 26 26 20 28 61 72 67 rgc > 1) && (arg
1c70: 76 5b 31 5d 5b 30 5d 20 21 3d 20 27 2d 27 29 29 v[1][0] != '-'))
1c80: 20 7b 0a 20 09 20 20 20 20 54 63 6c 53 65 74 53 {. . TclSetS
1c90: 74 61 72 74 75 70 53 63 72 69 70 74 46 69 6c 65 tartupScriptFile
1ca0: 4e 61 6d 65 28 61 72 67 76 5b 31 5d 29 3b 0a 20 Name(argv[1]);.
1cb0: 09 20 20 20 20 61 72 67 63 2d 2d 3b 0a 40 40 20 . argc--;.@@
1cc0: 2d 32 38 39 2c 37 20 2b 33 30 33 2c 38 20 40 40 -289,7 +303,8 @@
1cd0: 0a 20 20 20 20 20 20 2a 2f 0a 20 0a 20 20 20 20 . */. .
1ce0: 20 69 66 20 28 54 63 6c 47 65 74 53 74 61 72 74 if (TclGetStart
1cf0: 75 70 53 63 72 69 70 74 50 61 74 68 28 29 20 21 upScriptPath() !
1d00: 3d 20 4e 55 4c 4c 29 20 7b 0a 2d 09 63 6f 64 65 = NULL) {.-.code
1d10: 20 3d 20 54 63 6c 5f 46 53 45 76 61 6c 46 69 6c = Tcl_FSEvalFil
1d20: 65 28 69 6e 74 65 72 70 2c 20 54 63 6c 47 65 74 e(interp, TclGet
1d30: 53 74 61 72 74 75 70 53 63 72 69 70 74 50 61 74 StartupScriptPat
1d40: 68 28 29 29 3b 0a 2b 09 63 6f 64 65 20 3d 20 54 h());.+.code = T
1d50: 63 6c 5f 46 53 45 76 61 6c 46 69 6c 65 45 78 28 cl_FSEvalFileEx(
1d60: 69 6e 74 65 72 70 2c 20 54 63 6c 47 65 74 53 74 interp, TclGetSt
1d70: 61 72 74 75 70 53 63 72 69 70 74 50 61 74 68 28 artupScriptPath(
1d80: 29 2c 0a 2b 09 09 65 6e 63 6f 64 69 6e 67 4e 61 ),.+..encodingNa
1d90: 6d 65 29 3b 0a 20 09 69 66 20 28 63 6f 64 65 20 me);. .if (code
1da0: 21 3d 20 54 43 4c 5f 4f 4b 29 20 7b 0a 20 09 20 != TCL_OK) {. .
1db0: 20 20 20 65 72 72 43 68 61 6e 6e 65 6c 20 3d 20 errChannel =
1dc0: 54 63 6c 5f 47 65 74 53 74 64 43 68 61 6e 6e 65 Tcl_GetStdChanne
1dd0: 6c 28 54 43 4c 5f 53 54 44 45 52 52 29 3b 0a 20 l(TCL_STDERR);.
1de0: 09 20 20 20 20 69 66 20 28 65 72 72 43 68 61 6e . if (errChan
1df0: 6e 65 6c 29 20 7b 0a 64 69 66 66 20 2d 4e 61 75 nel) {.diff -Nau
1e00: 72 64 20 74 63 6c 2f 67 65 6e 65 72 69 63 2f 74 rd tcl/generic/t
1e10: 63 6c 53 74 75 62 49 6e 69 74 2e 63 20 74 63 6c clStubInit.c tcl
1e20: 2d 65 6e 63 2d 6f 70 74 69 6f 6e 2f 67 65 6e 65 -enc-option/gene
1e30: 72 69 63 2f 74 63 6c 53 74 75 62 49 6e 69 74 2e ric/tclStubInit.
1e40: 63 0a 2d 2d 2d 20 74 63 6c 2f 67 65 6e 65 72 69 c.--- tcl/generi
1e50: 63 2f 74 63 6c 53 74 75 62 49 6e 69 74 2e 63 09 c/tclStubInit.c.
1e60: 54 68 75 20 4d 61 79 20 31 35 20 30 30 3a 35 36 Thu May 15 00:56
1e70: 3a 35 36 20 32 30 30 33 0a 2b 2b 2b 20 74 63 6c :56 2003.+++ tcl
1e80: 2d 65 6e 63 2d 6f 70 74 69 6f 6e 2f 67 65 6e 65 -enc-option/gene
1e90: 72 69 63 2f 74 63 6c 53 74 75 62 49 6e 69 74 2e ric/tclStubInit.
1ea0: 63 09 53 61 74 20 4d 61 79 20 32 34 20 31 35 3a c.Sat May 24 15:
1eb0: 34 32 3a 34 31 20 32 30 30 33 0a 40 40 20 2d 39 42:41 2003.@@ -9
1ec0: 34 34 2c 36 20 2b 39 34 34 2c 37 20 40 40 0a 20 44,6 +944,7 @@.
1ed0: 20 20 20 20 54 63 6c 5f 44 69 63 74 4f 62 6a 52 Tcl_DictObjR
1ee0: 65 6d 6f 76 65 4b 65 79 4c 69 73 74 2c 20 2f 2a emoveKeyList, /*
1ef0: 20 35 30 32 20 2a 2f 0a 20 20 20 20 20 54 63 6c 502 */. Tcl
1f00: 5f 4e 65 77 44 69 63 74 4f 62 6a 2c 20 2f 2a 20 _NewDictObj, /*
1f10: 35 30 33 20 2a 2f 0a 20 20 20 20 20 54 63 6c 5f 503 */. Tcl_
1f20: 44 62 4e 65 77 44 69 63 74 4f 62 6a 2c 20 2f 2a DbNewDictObj, /*
1f30: 20 35 30 34 20 2a 2f 0a 2b 20 20 20 20 54 63 6c 504 */.+ Tcl
1f40: 5f 46 53 45 76 61 6c 46 69 6c 65 45 78 2c 20 2f _FSEvalFileEx, /
1f50: 2a 20 35 30 35 20 2a 2f 0a 20 7d 3b 0a 20 0a 20 * 505 */. };. .
1f60: 2f 2a 20 21 45 4e 44 21 3a 20 44 6f 20 6e 6f 74 /* !END!: Do not
1f70: 20 65 64 69 74 20 61 62 6f 76 65 20 74 68 69 73 edit above this
1f80: 20 6c 69 6e 65 2e 20 2a 2f 0a 64 69 66 66 20 2d line. */.diff -
1f90: 4e 61 75 72 64 20 74 63 6c 2f 6d 61 63 2f 74 63 Naurd tcl/mac/tc
1fa0: 6c 4d 61 63 52 65 73 6f 75 72 63 65 2e 63 20 74 lMacResource.c t
1fb0: 63 6c 2d 65 6e 63 2d 6f 70 74 69 6f 6e 2f 6d 61 cl-enc-option/ma
1fc0: 63 2f 74 63 6c 4d 61 63 52 65 73 6f 75 72 63 65 c/tclMacResource
1fd0: 2e 63 0a 2d 2d 2d 20 74 63 6c 2f 6d 61 63 2f 74 .c.--- tcl/mac/t
1fe0: 63 6c 4d 61 63 52 65 73 6f 75 72 63 65 2e 63 09 clMacResource.c.
1ff0: 54 68 75 20 4d 61 79 20 31 35 20 30 30 3a 35 37 Thu May 15 00:57
2000: 3a 31 31 20 32 30 30 33 0a 2b 2b 2b 20 74 63 6c :11 2003.+++ tcl
2010: 2d 65 6e 63 2d 6f 70 74 69 6f 6e 2f 6d 61 63 2f -enc-option/mac/
2020: 74 63 6c 4d 61 63 52 65 73 6f 75 72 63 65 2e 63 tclMacResource.c
2030: 09 53 61 74 20 4d 61 79 20 32 34 20 31 35 3a 35 .Sat May 24 15:5
2040: 33 3a 32 30 20 32 30 30 33 0a 40 40 20 2d 39 34 3:20 2003.@@ -94
2050: 36 2c 36 20 2b 39 34 36 2c 37 20 40 40 0a 20 20 6,6 +946,7 @@.
2060: 20 20 20 63 68 61 72 20 2a 66 69 6c 65 4e 61 6d char *fileNam
2070: 65 20 3d 20 4e 55 4c 4c 2c 20 2a 72 73 72 63 4e e = NULL, *rsrcN
2080: 61 6d 65 20 3d 20 4e 55 4c 4c 3b 0a 20 20 20 20 ame = NULL;.
2090: 20 6c 6f 6e 67 20 72 73 72 63 49 44 20 3d 20 2d long rsrcID = -
20a0: 31 3b 0a 20 20 20 20 20 63 68 61 72 20 2a 73 74 1;. char *st
20b0: 72 69 6e 67 3b 0a 2b 20 20 20 20 63 68 61 72 20 ring;.+ char
20c0: 2a 65 6e 63 6f 64 69 6e 67 4e 61 6d 65 20 3d 20 *encodingName =
20d0: 4e 55 4c 4c 3b 0a 20 20 20 20 20 69 6e 74 20 6c NULL;. int l
20e0: 65 6e 67 74 68 3b 0a 20 0a 20 20 20 20 20 69 66 ength;. . if
20f0: 20 28 6f 62 6a 63 20 3c 20 32 20 7c 7c 20 6f 62 (objc < 2 || ob
2100: 6a 63 20 3e 20 34 29 20 20 7b 0a 40 40 20 2d 39 jc > 4) {.@@ -9
2110: 36 38 2c 36 20 2b 39 36 39 2c 31 30 20 40 40 0a 68,6 +969,10 @@.
2120: 20 09 69 66 20 28 54 63 6c 5f 47 65 74 4c 6f 6e .if (Tcl_GetLon
2130: 67 46 72 6f 6d 4f 62 6a 28 69 6e 74 65 72 70 2c gFromObj(interp,
2140: 20 6f 62 6a 76 5b 32 5d 2c 20 26 72 73 72 63 49 objv[2], &rsrcI
2150: 44 29 20 21 3d 20 54 43 4c 5f 4f 4b 29 20 7b 0a D) != TCL_OK) {.
2160: 20 09 20 20 20 20 72 65 74 75 72 6e 20 54 43 4c . return TCL
2170: 5f 45 52 52 4f 52 3b 0a 20 09 7d 0a 2b 20 20 20 _ERROR;. .}.+
2180: 20 7d 20 65 6c 73 65 20 69 66 20 28 21 73 74 72 } else if (!str
2190: 63 6d 70 28 73 74 72 69 6e 67 2c 20 22 2d 65 6e cmp(string, "-en
21a0: 63 6f 64 69 6e 67 22 29 29 20 7b 0a 2b 09 69 66 coding")) {.+.if
21b0: 20 28 6f 62 6a 63 20 21 3d 20 34 29 20 0a 2b 09 (objc != 4) .+.
21c0: 20 20 20 20 67 6f 74 6f 20 73 6f 75 72 63 65 46 goto sourceF
21d0: 6d 74 45 72 72 3b 0a 2b 09 65 6e 63 6f 64 69 6e mtErr;.+.encodin
21e0: 67 4e 61 6d 65 20 3d 20 54 63 6c 5f 47 65 74 53 gName = Tcl_GetS
21f0: 74 72 69 6e 67 28 6f 62 6a 76 5b 32 5d 29 3b 0a tring(objv[2]);.
2200: 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 } else {.
2210: 20 20 20 09 65 72 72 53 74 72 20 3d 20 65 72 72 .errStr = err
2220: 42 61 64 3b 0a 20 20 20 20 20 09 67 6f 74 6f 20 Bad;. .goto
2230: 73 6f 75 72 63 65 46 6d 74 45 72 72 3b 0a 40 40 sourceFmtErr;.@@
2240: 20 2d 39 37 36 2c 31 33 20 2b 39 38 31 2c 31 39 -976,13 +981,19
2250: 20 40 40 0a 20 20 20 20 20 69 66 20 28 6f 62 6a @@. if (obj
2260: 63 20 3d 3d 20 34 29 20 7b 0a 20 09 66 69 6c 65 c == 4) {. .file
2270: 4e 61 6d 65 20 3d 20 54 63 6c 5f 47 65 74 53 74 Name = Tcl_GetSt
2280: 72 69 6e 67 46 72 6f 6d 4f 62 6a 28 6f 62 6a 76 ringFromObj(objv
2290: 5b 33 5d 2c 20 26 6c 65 6e 67 74 68 29 3b 0a 20 [3], &length);.
22a0: 20 20 20 20 7d 0a 2b 0a 2b 20 20 20 20 69 66 20 }.+.+ if
22b0: 28 65 6e 63 6f 64 69 6e 67 4e 61 6d 65 29 20 7b (encodingName) {
22c0: 0a 2b 09 72 65 74 75 72 6e 20 54 63 6c 5f 46 53 .+.return Tcl_FS
22d0: 45 76 61 6c 46 69 6c 65 45 78 28 69 6e 74 65 72 EvalFileEx(inter
22e0: 70 2c 20 66 69 6c 65 4e 61 6d 65 2c 20 65 6e 63 p, fileName, enc
22f0: 6f 64 69 6e 67 4e 61 6d 65 29 3b 0a 2b 20 20 20 odingName);.+
2300: 20 7d 0a 2b 0a 20 20 20 20 20 72 65 74 75 72 6e }.+. return
2310: 20 54 63 6c 5f 4d 61 63 45 76 61 6c 52 65 73 6f Tcl_MacEvalReso
2320: 75 72 63 65 28 69 6e 74 65 72 70 2c 20 72 73 72 urce(interp, rsr
2330: 63 4e 61 6d 65 2c 20 72 73 72 63 49 44 2c 20 66 cName, rsrcID, f
2340: 69 6c 65 4e 61 6d 65 29 3b 0a 20 09 0a 20 20 20 ileName);. ..
2350: 20 20 73 6f 75 72 63 65 46 6d 74 45 72 72 3a 0a sourceFmtErr:.
2360: 20 20 20 20 20 54 63 6c 5f 41 70 70 65 6e 64 53 Tcl_AppendS
2370: 74 72 69 6e 67 73 54 6f 4f 62 6a 28 54 63 6c 5f tringsToObj(Tcl_
2380: 47 65 74 4f 62 6a 52 65 73 75 6c 74 28 69 6e 74 GetObjResult(int
2390: 65 72 70 29 2c 20 65 72 72 53 74 72 2c 20 22 73 erp), errStr, "s
23a0: 68 6f 75 6c 64 20 62 65 20 5c 22 22 2c 0a 20 09 hould be \"",. .
23b0: 09 54 63 6c 5f 47 65 74 53 74 72 69 6e 67 28 6f .Tcl_GetString(o
23c0: 62 6a 76 5b 30 5d 29 2c 20 22 20 66 69 6c 65 4e bjv[0]), " fileN
23d0: 61 6d 65 5c 22 20 6f 72 20 5c 22 22 2c 0a 20 09 ame\" or \"",. .
23e0: 09 54 63 6c 5f 47 65 74 53 74 72 69 6e 67 28 6f .Tcl_GetString(o
23f0: 62 6a 76 5b 30 5d 29 2c 09 22 20 2d 72 73 72 63 bjv[0]),." -rsrc
2400: 20 6e 61 6d 65 20 3f 66 69 6c 65 4e 61 6d 65 3f name ?fileName?
2410: 5c 22 20 6f 72 20 5c 22 22 2c 20 0a 2d 09 09 54 \" or \"", .-..T
2420: 63 6c 5f 47 65 74 53 74 72 69 6e 67 28 6f 62 6a cl_GetString(obj
2430: 76 5b 30 5d 29 2c 20 22 20 2d 72 73 72 63 69 64 v[0]), " -rsrcid
2440: 20 69 64 20 3f 66 69 6c 65 4e 61 6d 65 3f 5c 22 id ?fileName?\"
2450: 22 2c 0a 2b 09 09 54 63 6c 5f 47 65 74 53 74 72 ",.+..Tcl_GetStr
2460: 69 6e 67 28 6f 62 6a 76 5b 30 5d 29 2c 20 22 20 ing(objv[0]), "
2470: 2d 72 73 72 63 69 64 20 69 64 20 3f 66 69 6c 65 -rsrcid id ?file
2480: 4e 61 6d 65 3f 5c 22 20 6f 72 20 5c 22 22 2c 0a Name?\" or \"",.
2490: 2b 09 09 54 63 6c 5f 47 65 74 53 74 72 69 6e 67 +..Tcl_GetString
24a0: 28 6f 62 6a 76 5b 30 5d 29 2c 20 22 20 2d 65 6e (objv[0]), " -en
24b0: 63 6f 64 69 6e 67 20 6e 61 6d 65 20 66 69 6c 65 coding name file
24c0: 4e 61 6d 65 5c 22 22 2c 0a 20 09 09 28 63 68 61 Name\"",. ..(cha
24d0: 72 20 2a 29 20 4e 55 4c 4c 29 3b 0a 20 20 20 20 r *) NULL);.
24e0: 20 72 65 74 75 72 6e 20 54 43 4c 5f 45 52 52 4f return TCL_ERRO
24f0: 52 3b 0a 20 7d 0a R;. }.