Tcl Source Code

Hex Artifact Content
Login

Artifact aed2cad05036e06c1e44c7925302dabc09fd946e:

Attachment "tip287.patch" to ticket [1586860fff] added by cleverly 2006-10-30 04:38:44.
0000: 2d 2d 2d 20 64 6f 63 2f 63 68 61 6e 2e 6e 2e 6f  --- doc/chan.n.o
0010: 72 69 67 09 32 30 30 36 2d 31 30 2d 32 38 20 32  rig.2006-10-28 2
0020: 32 3a 33 37 3a 34 38 2e 30 30 30 30 30 30 30 30  2:37:48.00000000
0030: 30 20 2d 30 36 30 30 0a 2b 2b 2b 20 64 6f 63 2f  0 -0600.+++ doc/
0040: 63 68 61 6e 2e 6e 09 32 30 30 36 2d 31 30 2d 32  chan.n.2006-10-2
0050: 38 20 32 32 3a 35 31 3a 33 33 2e 30 30 30 30 30  8 22:51:33.00000
0060: 30 30 30 30 20 2d 30 36 30 30 0a 40 40 20 2d 32  0000 -0600.@@ -2
0070: 34 2c 36 20 2b 32 34 2c 31 34 20 40 40 0a 20 5c  4,6 +24,14 @@. \
0080: 66 49 4f 70 74 69 6f 6e 5c 66 52 20 69 6e 64 69  fIOption\fR indi
0090: 63 61 74 65 73 20 77 68 61 74 20 74 6f 20 64 6f  cates what to do
00a0: 20 77 69 74 68 20 74 68 65 20 63 68 61 6e 6e 65   with the channe
00b0: 6c 3b 20 61 6e 79 20 75 6e 69 71 75 65 0a 20 61  l; any unique. a
00c0: 62 62 72 65 76 69 61 74 69 6f 6e 20 66 6f 72 20  bbreviation for 
00d0: 5c 66 49 6f 70 74 69 6f 6e 5c 66 52 20 69 73 20  \fIoption\fR is 
00e0: 61 63 63 65 70 74 61 62 6c 65 2e 20 56 61 6c 69  acceptable. Vali
00f0: 64 20 6f 70 74 69 6f 6e 73 20 61 72 65 3a 0a 20  d options are:. 
0100: 2e 54 50 0a 2b 5c 66 42 63 68 61 6e 20 61 76 61  .TP.+\fBchan ava
0110: 69 6c 61 62 6c 65 20 5c 66 49 63 68 61 6e 6e 65  ilable \fIchanne
0120: 6c 49 64 5c 66 52 0a 2b 2e 0a 2b 54 68 69 73 20  lId\fR.+..+This 
0130: 72 65 74 75 72 6e 73 20 74 68 65 20 6e 75 6d 62  returns the numb
0140: 65 72 20 6f 66 20 62 79 74 65 73 20 6f 66 20 69  er of bytes of i
0150: 6e 70 75 74 20 63 75 72 72 65 6e 74 6c 79 20 62  nput currently b
0160: 75 66 66 65 72 65 64 20 0a 2b 69 6e 74 65 72 6e  uffered .+intern
0170: 61 6c 6c 79 20 66 6f 72 20 5c 66 49 63 68 61 6e  ally for \fIchan
0180: 6e 65 6c 49 64 5c 66 72 20 28 65 73 70 65 63 69  nelId\fr (especi
0190: 61 6c 6c 79 20 75 73 65 66 75 6c 20 69 6e 20 61  ally useful in a
01a0: 20 72 65 61 64 61 62 6c 65 20 65 76 65 6e 74 20   readable event 
01b0: 0a 2b 63 61 6c 6c 62 61 63 6b 20 74 6f 20 69 6d  .+callback to im
01c0: 70 6f 73 65 20 61 70 70 6c 69 63 61 74 69 6f 6e  pose application
01d0: 2d 73 70 65 63 69 66 69 63 20 6c 69 6d 69 74 73  -specific limits
01e0: 20 6f 6e 20 6c 69 6e 65 20 6c 65 6e 67 74 68 73   on line lengths
01f0: 20 74 6f 20 61 76 6f 69 64 0a 2b 61 20 70 6f 74   to avoid.+a pot
0200: 65 6e 74 69 61 6c 20 64 65 6e 69 61 6c 2d 6f 66  ential denial-of
0210: 2d 73 65 72 76 69 63 65 20 61 74 74 61 63 6b 20  -service attack 
0220: 77 68 65 72 65 20 61 20 68 6f 73 74 69 6c 65 20  where a hostile 
0230: 75 73 65 72 20 63 72 61 66 74 73 0a 2b 61 6e 20  user crafts.+an 
0240: 65 78 74 72 65 6d 65 6c 79 20 6c 6f 6e 67 20 6c  extremely long l
0250: 69 6e 65 20 74 68 61 74 20 65 78 63 65 65 64 73  ine that exceeds
0260: 20 74 68 65 20 61 76 61 69 6c 61 62 6c 65 20 6d   the available m
0270: 65 6d 6f 72 79 20 74 6f 20 62 75 66 66 65 72 20  emory to buffer 
0280: 69 74 29 2e 0a 2b 2e 54 50 0a 20 5c 66 42 63 68  it)..+.TP. \fBch
0290: 61 6e 20 62 6c 6f 63 6b 65 64 20 5c 66 49 63 68  an blocked \fIch
02a0: 61 6e 6e 65 6c 49 64 5c 66 52 0a 20 2e 0a 20 54  annelId\fR. .. T
02b0: 68 69 73 20 74 65 73 74 73 20 77 68 65 74 68 65  his tests whethe
02c0: 72 20 74 68 65 20 6c 61 73 74 20 69 6e 70 75 74  r the last input
02d0: 20 6f 70 65 72 61 74 69 6f 6e 20 6f 6e 20 74 68   operation on th
02e0: 65 20 63 68 61 6e 6e 65 6c 20 63 61 6c 6c 65 64  e channel called
02f0: 0a 2d 2d 2d 20 67 65 6e 65 72 69 63 2f 74 63 6c  .--- generic/tcl
0300: 42 61 73 69 63 2e 63 2e 6f 72 69 67 09 32 30 30  Basic.c.orig.200
0310: 36 2d 31 30 2d 32 38 20 32 31 3a 35 35 3a 35 39  6-10-28 21:55:59
0320: 2e 30 30 30 30 30 30 30 30 30 20 2d 30 36 30 30  .000000000 -0600
0330: 0a 2b 2b 2b 20 67 65 6e 65 72 69 63 2f 74 63 6c  .+++ generic/tcl
0340: 42 61 73 69 63 2e 63 09 32 30 30 36 2d 31 30 2d  Basic.c.2006-10-
0350: 32 38 20 32 31 3a 35 37 3a 30 38 2e 30 30 30 30  28 21:57:08.0000
0360: 30 30 30 30 30 20 2d 30 36 30 30 0a 40 40 20 2d  00000 -0600.@@ -
0370: 34 38 35 2c 36 20 2b 34 38 35 2c 31 30 20 40 40  485,6 +485,10 @@
0380: 0a 20 20 20 20 20 54 63 6c 5f 43 72 65 61 74 65  .     Tcl_Create
0390: 4f 62 6a 43 6f 6d 6d 61 6e 64 28 69 6e 74 65 72  ObjCommand(inter
03a0: 70 2c 20 22 3a 3a 74 63 6c 3a 3a 63 68 61 6e 3a  p, "::tcl::chan:
03b0: 3a 72 50 6f 73 74 65 76 65 6e 74 22 2c 0a 20 09  :rPostevent",. .
03c0: 20 20 20 20 54 63 6c 43 68 61 6e 50 6f 73 74 45      TclChanPostE
03d0: 76 65 6e 74 4f 62 6a 43 6d 64 2c 20 28 43 6c 69  ventObjCmd, (Cli
03e0: 65 6e 74 44 61 74 61 29 20 4e 55 4c 4c 2c 20 4e  entData) NULL, N
03f0: 55 4c 4c 29 3b 0a 20 0a 2b 20 20 20 20 2f 2a 20  ULL);. .+    /* 
0400: 54 49 50 20 23 32 38 37 20 2a 2f 0a 2b 20 20 20  TIP #287 */.+   
0410: 20 54 63 6c 5f 43 72 65 61 74 65 4f 62 6a 43 6f   Tcl_CreateObjCo
0420: 6d 6d 61 6e 64 28 69 6e 74 65 72 70 2c 20 22 3a  mmand(interp, ":
0430: 3a 74 63 6c 3a 3a 63 68 61 6e 3a 3a 41 76 61 69  :tcl::chan::Avai
0440: 6c 61 62 6c 65 22 2c 0a 2b 09 20 20 20 20 54 63  lable",.+.    Tc
0450: 6c 43 68 61 6e 41 76 61 69 6c 61 62 6c 65 4f 62  lChanAvailableOb
0460: 6a 43 6d 64 2c 20 28 43 6c 69 65 6e 74 44 61 74  jCmd, (ClientDat
0470: 61 29 20 4e 55 4c 4c 2c 20 4e 55 4c 4c 29 3b 0a  a) NULL, NULL);.
0480: 2b 0a 20 20 20 20 20 2f 2a 0a 20 20 20 20 20 20  +.     /*.      
0490: 2a 20 52 65 67 69 73 74 65 72 20 74 68 65 20 62  * Register the b
04a0: 75 69 6c 74 2d 69 6e 20 66 75 6e 63 74 69 6f 6e  uilt-in function
04b0: 73 2e 20 54 68 69 73 20 69 73 20 65 6d 70 74 79  s. This is empty
04c0: 20 6e 6f 77 20 74 68 61 74 20 74 68 65 79 20 61   now that they a
04d0: 72 65 0a 20 20 20 20 20 20 2a 20 69 6d 70 6c 65  re.      * imple
04e0: 6d 65 6e 74 65 64 20 61 73 20 63 6f 6d 6d 61 6e  mented as comman
04f0: 64 73 20 69 6e 20 74 68 65 20 3a 3a 74 63 6c 3a  ds in the ::tcl:
0500: 3a 6d 61 74 68 66 75 6e 63 20 6e 61 6d 65 73 70  :mathfunc namesp
0510: 61 63 65 2e 0a 2d 2d 2d 20 67 65 6e 65 72 69 63  ace..--- generic
0520: 2f 74 63 6c 49 6e 74 2e 68 2e 6f 72 69 67 09 32  /tclInt.h.orig.2
0530: 30 30 36 2d 31 30 2d 32 38 20 32 32 3a 30 38 3a  006-10-28 22:08:
0540: 33 38 2e 30 30 30 30 30 30 30 30 30 20 2d 30 36  38.000000000 -06
0550: 30 30 0a 2b 2b 2b 20 67 65 6e 65 72 69 63 2f 74  00.+++ generic/t
0560: 63 6c 49 6e 74 2e 68 09 32 30 30 36 2d 31 30 2d  clInt.h.2006-10-
0570: 32 38 20 32 32 3a 30 39 3a 35 32 2e 30 30 30 30  28 22:09:52.0000
0580: 30 30 30 30 30 20 2d 30 36 30 30 0a 40 40 20 2d  00000 -0600.@@ -
0590: 32 32 38 36 2c 36 20 2b 32 32 38 36 2c 39 20 40  2286,6 +2286,9 @
05a0: 40 0a 20 4d 4f 44 55 4c 45 5f 53 43 4f 50 45 20  @. MODULE_SCOPE 
05b0: 69 6e 74 09 54 63 6c 5f 43 64 4f 62 6a 43 6d 64  int.Tcl_CdObjCmd
05c0: 28 43 6c 69 65 6e 74 44 61 74 61 20 63 6c 69 65  (ClientData clie
05d0: 6e 74 44 61 74 61 2c 0a 20 09 09 09 20 20 20 20  ntData,. ...    
05e0: 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65  Tcl_Interp *inte
05f0: 72 70 2c 20 69 6e 74 20 6f 62 6a 63 2c 0a 20 09  rp, int objc,. .
0600: 09 09 20 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 43  ..    Tcl_Obj *C
0610: 4f 4e 53 54 20 6f 62 6a 76 5b 5d 29 3b 0a 2b 4d  ONST objv[]);.+M
0620: 4f 44 55 4c 45 5f 53 43 4f 50 45 20 69 6e 74 09  ODULE_SCOPE int.
0630: 54 63 6c 43 68 61 6e 41 76 61 69 6c 61 62 6c 65  TclChanAvailable
0640: 4f 62 6a 43 6d 64 28 0a 2b 09 09 09 20 20 20 20  ObjCmd(.+...    
0650: 43 6c 69 65 6e 74 44 61 74 61 20 63 6c 69 65 6e  ClientData clien
0660: 74 44 61 74 61 2c 20 54 63 6c 5f 49 6e 74 65 72  tData, Tcl_Inter
0670: 70 20 2a 69 6e 74 65 72 70 2c 0a 2b 09 09 09 20  p *interp,.+... 
0680: 20 20 20 69 6e 74 20 6f 62 6a 63 2c 20 54 63 6c     int objc, Tcl
0690: 5f 4f 62 6a 20 2a 43 4f 4e 53 54 20 6f 62 6a 76  _Obj *CONST objv
06a0: 5b 5d 29 3b 0a 20 4d 4f 44 55 4c 45 5f 53 43 4f  []);. MODULE_SCO
06b0: 50 45 20 69 6e 74 09 54 63 6c 43 68 61 6e 54 72  PE int.TclChanTr
06c0: 75 6e 63 61 74 65 4f 62 6a 43 6d 64 28 0a 20 09  uncateObjCmd(. .
06d0: 09 09 20 20 20 20 43 6c 69 65 6e 74 44 61 74 61  ..    ClientData
06e0: 20 63 6c 69 65 6e 74 44 61 74 61 2c 20 54 63 6c   clientData, Tcl
06f0: 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 2c  _Interp *interp,
0700: 0a 20 09 09 09 20 20 20 20 69 6e 74 20 6f 62 6a  . ...    int obj
0710: 63 2c 20 54 63 6c 5f 4f 62 6a 20 2a 43 4f 4e 53  c, Tcl_Obj *CONS
0720: 54 20 6f 62 6a 76 5b 5d 29 3b 0a 2d 2d 2d 20 67  T objv[]);.--- g
0730: 65 6e 65 72 69 63 2f 74 63 6c 49 4f 43 6d 64 2e  eneric/tclIOCmd.
0740: 63 2e 6f 72 69 67 09 32 30 30 36 2d 31 30 2d 32  c.orig.2006-10-2
0750: 38 20 32 31 3a 35 38 3a 32 37 2e 30 30 30 30 30  8 21:58:27.00000
0760: 30 30 30 30 20 2d 30 36 30 30 0a 2b 2b 2b 20 67  0000 -0600.+++ g
0770: 65 6e 65 72 69 63 2f 74 63 6c 49 4f 43 6d 64 2e  eneric/tclIOCmd.
0780: 63 09 32 30 30 36 2d 31 30 2d 32 38 20 32 32 3a  c.2006-10-28 22:
0790: 30 38 3a 30 33 2e 30 30 30 30 30 30 30 30 30 20  08:03.000000000 
07a0: 2d 30 36 30 30 0a 40 40 20 2d 31 36 31 39 2c 36  -0600.@@ -1619,6
07b0: 20 2b 31 36 31 39 2c 35 36 20 40 40 0a 20 7d 0a   +1619,56 @@. }.
07c0: 20 0c 0a 20 2f 2a 0a 2b 20 2a 2d 2d 2d 2d 2d 2d   .. /*.+ *------
07d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
07e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
07f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0800: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0810: 2d 2d 2d 2d 2d 0a 2b 20 2a 0a 2b 20 2a 20 54 63  -----.+ *.+ * Tc
0820: 6c 43 68 61 6e 41 76 61 69 6c 61 62 6c 65 4f 62  lChanAvailableOb
0830: 6a 43 6d 64 20 2d 2d 0a 2b 20 2a 0a 2b 20 2a 09  jCmd --.+ *.+ *.
0840: 54 68 69 73 20 66 75 6e 63 74 69 6f 6e 20 69 73  This function is
0850: 20 69 6e 76 6f 6b 65 64 20 74 6f 20 70 72 6f 63   invoked to proc
0860: 65 73 73 20 74 68 65 20 54 63 6c 20 22 63 68 61  ess the Tcl "cha
0870: 6e 20 61 76 61 69 6c 61 62 6c 65 22 20 0a 2b 20  n available" .+ 
0880: 2a 09 63 6f 6d 6d 61 6e 64 2e 20 53 65 65 20 74  *.command. See t
0890: 68 65 20 75 73 65 72 20 64 6f 63 75 6d 65 6e 74  he user document
08a0: 61 74 69 6f 6e 20 66 6f 72 20 64 65 74 61 69 6c  ation for detail
08b0: 73 20 6f 6e 20 77 68 61 74 20 69 74 20 64 6f 65  s on what it doe
08c0: 73 2e 0a 2b 20 2a 0a 2b 20 2a 20 52 65 73 75 6c  s..+ *.+ * Resul
08d0: 74 73 3a 0a 2b 20 2a 09 41 20 73 74 61 6e 64 61  ts:.+ *.A standa
08e0: 72 64 20 54 63 6c 20 72 65 73 75 6c 74 2e 0a 2b  rd Tcl result..+
08f0: 20 2a 0a 2b 20 2a 20 53 69 64 65 20 65 66 66 65   *.+ * Side effe
0900: 63 74 73 3a 0a 2b 20 2a 09 53 65 74 73 20 69 6e  cts:.+ *.Sets in
0910: 74 65 72 70 27 73 20 72 65 73 75 6c 74 20 74 6f  terp's result to
0920: 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 62   the number of b
0930: 79 74 65 73 20 6f 66 20 69 6e 70 75 74 20 69 6e  ytes of input in
0940: 20 74 68 65 0a 2b 20 2a 20 20 20 20 20 20 63 68   the.+ *      ch
0950: 61 6e 6e 65 6c 73 20 69 6e 70 75 74 20 62 75 66  annels input buf
0960: 66 65 72 2e 0a 2b 20 2a 0a 2b 20 2a 2d 2d 2d 2d  fer..+ *.+ *----
0970: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0980: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0990: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
09a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
09b0: 2d 2d 2d 2d 2d 2d 2d 0a 2b 20 2a 2f 0a 2b 0a 2b  -------.+ */.+.+
09c0: 09 2f 2a 20 41 52 47 53 55 53 45 44 20 2a 2f 0a  ./* ARGSUSED */.
09d0: 2b 69 6e 74 0a 2b 54 63 6c 43 68 61 6e 41 76 61  +int.+TclChanAva
09e0: 69 6c 61 62 6c 65 4f 62 6a 43 6d 64 28 0a 2b 20  ilableObjCmd(.+ 
09f0: 20 20 20 43 6c 69 65 6e 74 44 61 74 61 20 75 6e     ClientData un
0a00: 75 73 65 64 2c 09 09 2f 2a 20 4e 6f 74 20 75 73  used,../* Not us
0a10: 65 64 2e 20 2a 2f 0a 2b 20 20 20 20 54 63 6c 5f  ed. */.+    Tcl_
0a20: 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 2c 09  Interp *interp,.
0a30: 09 2f 2a 20 43 75 72 72 65 6e 74 20 69 6e 74 65  ./* Current inte
0a40: 72 70 72 65 74 65 72 2e 20 2a 2f 0a 2b 20 20 20  rpreter. */.+   
0a50: 20 69 6e 74 20 6f 62 6a 63 2c 09 09 09 2f 2a 20   int objc,.../* 
0a60: 4e 75 6d 62 65 72 20 6f 66 20 61 72 67 75 6d 65  Number of argume
0a70: 6e 74 73 2e 20 2a 2f 0a 2b 20 20 20 20 54 63 6c  nts. */.+    Tcl
0a80: 5f 4f 62 6a 20 2a 43 4f 4e 53 54 20 6f 62 6a 76  _Obj *CONST objv
0a90: 5b 5d 29 09 2f 2a 20 41 72 67 75 6d 65 6e 74 20  [])./* Argument 
0aa0: 6f 62 6a 65 63 74 73 2e 20 2a 2f 0a 2b 7b 0a 2b  objects. */.+{.+
0ab0: 20 20 20 20 54 63 6c 5f 43 68 61 6e 6e 65 6c 20      Tcl_Channel 
0ac0: 63 68 61 6e 3b 0a 2b 20 20 20 20 69 6e 74 20 6d  chan;.+    int m
0ad0: 6f 64 65 3b 0a 2b 20 20 20 20 63 68 61 72 20 2a  ode;.+    char *
0ae0: 61 72 67 3b 0a 2b 0a 2b 20 20 20 20 69 66 20 28  arg;.+.+    if (
0af0: 6f 62 6a 63 20 21 3d 20 32 29 20 7b 0a 2b 09 54  objc != 2) {.+.T
0b00: 63 6c 5f 57 72 6f 6e 67 4e 75 6d 41 72 67 73 28  cl_WrongNumArgs(
0b10: 69 6e 74 65 72 70 2c 20 31 2c 20 6f 62 6a 76 2c  interp, 1, objv,
0b20: 20 22 63 68 61 6e 6e 65 6c 49 64 22 29 3b 0a 2b   "channelId");.+
0b30: 09 72 65 74 75 72 6e 20 54 43 4c 5f 45 52 52 4f  .return TCL_ERRO
0b40: 52 3b 0a 2b 20 20 20 20 7d 0a 2b 0a 2b 20 20 20  R;.+    }.+.+   
0b50: 20 61 72 67 20 3d 20 54 63 6c 5f 47 65 74 53 74   arg = Tcl_GetSt
0b60: 72 69 6e 67 28 6f 62 6a 76 5b 31 5d 29 3b 0a 2b  ring(objv[1]);.+
0b70: 20 20 20 20 63 68 61 6e 20 3d 20 54 63 6c 5f 47      chan = Tcl_G
0b80: 65 74 43 68 61 6e 6e 65 6c 28 69 6e 74 65 72 70  etChannel(interp
0b90: 2c 20 61 72 67 2c 20 26 6d 6f 64 65 29 3b 0a 2b  , arg, &mode);.+
0ba0: 20 20 20 20 69 66 20 28 63 68 61 6e 20 3d 3d 20      if (chan == 
0bb0: 4e 55 4c 4c 29 20 7b 0a 2b 09 72 65 74 75 72 6e  NULL) {.+.return
0bc0: 20 54 43 4c 5f 45 52 52 4f 52 3b 0a 2b 20 20 20   TCL_ERROR;.+   
0bd0: 20 7d 0a 2b 20 20 20 20 69 66 20 28 28 6d 6f 64   }.+    if ((mod
0be0: 65 20 26 20 54 43 4c 5f 52 45 41 44 41 42 4c 45  e & TCL_READABLE
0bf0: 29 20 3d 3d 20 30 29 20 7b 0a 2b 09 54 63 6c 5f  ) == 0) {.+.Tcl_
0c00: 41 70 70 65 6e 64 52 65 73 75 6c 74 28 69 6e 74  AppendResult(int
0c10: 65 72 70 2c 20 22 63 68 61 6e 6e 65 6c 20 5c 22  erp, "channel \"
0c20: 22 2c 20 61 72 67 2c 0a 2b 09 09 22 5c 22 20 77  ", arg,.+.."\" w
0c30: 61 73 6e 27 74 20 6f 70 65 6e 65 64 20 66 6f 72  asn't opened for
0c40: 20 72 65 61 64 69 6e 67 22 2c 20 4e 55 4c 4c 29   reading", NULL)
0c50: 3b 0a 2b 09 72 65 74 75 72 6e 20 54 43 4c 5f 45  ;.+.return TCL_E
0c60: 52 52 4f 52 3b 0a 2b 20 20 20 20 7d 0a 2b 0a 2b  RROR;.+    }.+.+
0c70: 20 20 20 20 54 63 6c 5f 53 65 74 4f 62 6a 52 65      Tcl_SetObjRe
0c80: 73 75 6c 74 28 69 6e 74 65 72 70 2c 20 54 63 6c  sult(interp, Tcl
0c90: 5f 4e 65 77 49 6e 74 4f 62 6a 28 54 63 6c 5f 49  _NewIntObj(Tcl_I
0ca0: 6e 70 75 74 42 75 66 66 65 72 65 64 28 63 68 61  nputBuffered(cha
0cb0: 6e 29 29 29 3b 0a 2b 20 20 20 20 72 65 74 75 72  n)));.+    retur
0cc0: 6e 20 54 43 4c 5f 4f 4b 3b 0a 2b 7d 0a 2b 0c 0a  n TCL_OK;.+}.+..
0cd0: 2b 2f 2a 0a 20 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d  +/*.  *---------
0ce0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0cf0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0d00: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0d10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20  -------------.  
0d20: 2a 0a 20 20 2a 20 54 63 6c 5f 43 68 61 6e 54 72  *.  * Tcl_ChanTr
0d30: 75 6e 63 61 74 65 4f 62 6a 43 6d 64 20 2d 2d 0a  uncateObjCmd --.
0d40: 2d 2d 2d 20 6c 69 62 72 61 72 79 2f 69 6e 69 74  --- library/init
0d50: 2e 74 63 6c 2e 6f 72 69 67 09 32 30 30 36 2d 30  .tcl.orig.2006-0
0d60: 39 2d 32 32 20 31 32 3a 31 33 3a 32 39 2e 30 30  9-22 12:13:29.00
0d70: 30 30 30 30 30 30 30 20 2d 30 36 30 30 0a 2b 2b  0000000 -0600.++
0d80: 2b 20 6c 69 62 72 61 72 79 2f 69 6e 69 74 2e 74  + library/init.t
0d90: 63 6c 09 32 30 30 36 2d 31 30 2d 32 38 20 32 31  cl.2006-10-28 21
0da0: 3a 35 35 3a 34 31 2e 30 30 30 30 30 30 30 30 30  :55:41.000000000
0db0: 20 2d 30 36 30 30 0a 40 40 20 2d 37 38 2c 37 20   -0600.@@ -78,7 
0dc0: 2b 37 38 2c 39 20 40 40 0a 20 20 20 20 20 23 20  +78,9 @@.     # 
0dd0: 53 65 74 20 75 70 20 74 68 65 20 27 63 68 61 6e  Set up the 'chan
0de0: 27 20 65 6e 73 65 6d 62 6c 65 20 28 54 49 50 20  ' ensemble (TIP 
0df0: 23 32 30 38 29 2e 0a 20 20 20 20 20 6e 61 6d 65  #208)..     name
0e00: 73 70 61 63 65 20 65 76 61 6c 20 63 68 61 6e 20  space eval chan 
0e10: 7b 0a 20 20 20 20 20 20 20 20 20 23 20 54 49 50  {.         # TIP
0e20: 20 23 32 31 39 2e 20 41 64 64 65 64 20 6d 65 74   #219. Added met
0e30: 68 6f 64 73 3a 20 63 72 65 61 74 65 2c 20 70 6f  hods: create, po
0e40: 73 74 65 76 65 6e 74 2e 0a 2b 20 20 20 20 20 20  stevent..+      
0e50: 20 20 23 20 54 49 50 20 23 32 38 37 2e 20 41 64    # TIP #287. Ad
0e60: 64 65 64 20 6d 65 74 68 6f 64 3a 20 61 76 61 69  ded method: avai
0e70: 6c 61 62 6c 65 2e 0a 20 20 20 20 20 20 20 20 20  lable..         
0e80: 6e 61 6d 65 73 70 61 63 65 20 65 6e 73 65 6d 62  namespace ensemb
0e90: 6c 65 20 63 72 65 61 74 65 20 2d 63 6f 6d 6d 61  le create -comma
0ea0: 6e 64 20 3a 3a 63 68 61 6e 20 2d 6d 61 70 20 7b  nd ::chan -map {
0eb0: 0a 2b 20 20 20 20 20 20 20 20 20 20 20 20 61 76  .+            av
0ec0: 61 69 6c 61 62 6c 65 20 20 20 3a 3a 74 63 6c 3a  ailable   ::tcl:
0ed0: 3a 63 68 61 6e 3a 3a 41 76 61 69 6c 61 62 6c 65  :chan::Available
0ee0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 62 6c  .             bl
0ef0: 6f 63 6b 65 64 20 20 20 20 20 3a 3a 66 62 6c 6f  ocked     ::fblo
0f00: 63 6b 65 64 0a 20 20 20 20 20 20 20 20 20 20 20  cked.           
0f10: 20 20 63 6c 6f 73 65 20 20 20 20 20 20 20 3a 3a    close       ::
0f20: 63 6c 6f 73 65 0a 20 20 20 20 20 20 20 20 20 20  close.          
0f30: 20 20 20 63 6f 6e 66 69 67 75 72 65 20 20 20 3a     configure   :
0f40: 3a 66 63 6f 6e 66 69 67 75 72 65 0a 2d 2d 2d 20  :fconfigure.--- 
0f50: 74 65 73 74 73 2f 63 68 61 6e 2e 74 65 73 74 2e  tests/chan.test.
0f60: 6f 72 69 67 09 32 30 30 36 2d 31 30 2d 32 39 20  orig.2006-10-29 
0f70: 31 33 3a 35 39 3a 33 35 2e 30 30 30 30 30 30 30  13:59:35.0000000
0f80: 30 30 20 2d 30 37 30 30 0a 2b 2b 2b 20 74 65 73  00 -0700.+++ tes
0f90: 74 73 2f 63 68 61 6e 2e 74 65 73 74 09 32 30 30  ts/chan.test.200
0fa0: 36 2d 31 30 2d 32 39 20 31 34 3a 32 32 3a 35 31  6-10-29 14:22:51
0fb0: 2e 30 30 30 30 30 30 30 30 30 20 2d 30 37 30 30  .000000000 -0700
0fc0: 0a 40 40 20 2d 32 34 2c 37 20 2b 32 34 2c 37 20  .@@ -24,7 +24,7 
0fd0: 40 40 0a 20 7d 20 2d 72 65 74 75 72 6e 43 6f 64  @@. } -returnCod
0fe0: 65 73 20 65 72 72 6f 72 20 2d 72 65 73 75 6c 74  es error -result
0ff0: 20 22 77 72 6f 6e 67 20 23 20 61 72 67 73 3a 20   "wrong # args: 
1000: 73 68 6f 75 6c 64 20 62 65 20 5c 22 63 68 61 6e  should be \"chan
1010: 20 73 75 62 63 6f 6d 6d 61 6e 64 20 3f 61 72 67   subcommand ?arg
1020: 75 6d 65 6e 74 20 2e 2e 2e 3f 5c 22 22 0a 20 74  ument ...?\"". t
1030: 65 73 74 20 63 68 61 6e 2d 31 2e 32 20 7b 63 68  est chan-1.2 {ch
1040: 61 6e 20 63 6f 6d 6d 61 6e 64 20 67 65 6e 65 72  an command gener
1050: 61 6c 20 73 79 6e 74 61 78 7d 20 2d 62 6f 64 79  al syntax} -body
1060: 20 7b 0a 20 20 20 20 20 63 68 61 6e 20 46 4f 4f   {.     chan FOO
1070: 42 41 52 0a 2d 7d 20 2d 72 65 74 75 72 6e 43 6f  BAR.-} -returnCo
1080: 64 65 73 20 65 72 72 6f 72 20 2d 72 65 73 75 6c  des error -resul
1090: 74 20 22 75 6e 6b 6e 6f 77 6e 20 6f 72 20 61 6d  t "unknown or am
10a0: 62 69 67 75 6f 75 73 20 73 75 62 63 6f 6d 6d 61  biguous subcomma
10b0: 6e 64 20 5c 22 46 4f 4f 42 41 52 5c 22 3a 20 6d  nd \"FOOBAR\": m
10c0: 75 73 74 20 62 65 20 62 6c 6f 63 6b 65 64 2c 20  ust be blocked, 
10d0: 63 6c 6f 73 65 2c 20 63 6f 6e 66 69 67 75 72 65  close, configure
10e0: 2c 20 63 6f 70 79 2c 20 63 72 65 61 74 65 2c 20  , copy, create, 
10f0: 65 6f 66 2c 20 65 76 65 6e 74 2c 20 66 6c 75 73  eof, event, flus
1100: 68 2c 20 67 65 74 73 2c 20 6e 61 6d 65 73 2c 20  h, gets, names, 
1110: 70 6f 73 74 65 76 65 6e 74 2c 20 70 75 74 73 2c  postevent, puts,
1120: 20 72 65 61 64 2c 20 73 65 65 6b 2c 20 74 65 6c   read, seek, tel
1130: 6c 2c 20 6f 72 20 74 72 75 6e 63 61 74 65 22 0a  l, or truncate".
1140: 2b 7d 20 2d 72 65 74 75 72 6e 43 6f 64 65 73 20  +} -returnCodes 
1150: 65 72 72 6f 72 20 2d 72 65 73 75 6c 74 20 22 75  error -result "u
1160: 6e 6b 6e 6f 77 6e 20 6f 72 20 61 6d 62 69 67 75  nknown or ambigu
1170: 6f 75 73 20 73 75 62 63 6f 6d 6d 61 6e 64 20 5c  ous subcommand \
1180: 22 46 4f 4f 42 41 52 5c 22 3a 20 6d 75 73 74 20  "FOOBAR\": must 
1190: 62 65 20 61 76 61 69 6c 61 62 6c 65 2c 20 62 6c  be available, bl
11a0: 6f 63 6b 65 64 2c 20 63 6c 6f 73 65 2c 20 63 6f  ocked, close, co
11b0: 6e 66 69 67 75 72 65 2c 20 63 6f 70 79 2c 20 63  nfigure, copy, c
11c0: 72 65 61 74 65 2c 20 65 6f 66 2c 20 65 76 65 6e  reate, eof, even
11d0: 74 2c 20 66 6c 75 73 68 2c 20 67 65 74 73 2c 20  t, flush, gets, 
11e0: 6e 61 6d 65 73 2c 20 70 6f 73 74 65 76 65 6e 74  names, postevent
11f0: 2c 20 70 75 74 73 2c 20 72 65 61 64 2c 20 73 65  , puts, read, se
1200: 65 6b 2c 20 74 65 6c 6c 2c 20 6f 72 20 74 72 75  ek, tell, or tru
1210: 6e 63 61 74 65 22 0a 20 0a 20 74 65 73 74 20 63  ncate". . test c
1220: 68 61 6e 2d 32 2e 31 20 7b 63 68 61 6e 20 63 6f  han-2.1 {chan co
1230: 6d 6d 61 6e 64 3a 20 62 6c 6f 63 6b 65 64 20 73  mmand: blocked s
1240: 75 62 63 6f 6d 6d 61 6e 64 7d 20 2d 62 6f 64 79  ubcommand} -body
1250: 20 7b 0a 20 20 20 20 20 63 68 61 6e 20 62 6c 6f   {.     chan blo
1260: 63 6b 65 64 20 66 6f 6f 20 62 61 72 0a 40 40 20  cked foo bar.@@ 
1270: 2d 39 36 2c 36 20 2b 39 36 2c 33 35 20 40 40 0a  -96,6 +96,35 @@.
1280: 20 20 20 20 20 63 61 74 63 68 20 7b 72 65 6d 6f       catch {remo
1290: 76 65 46 69 6c 65 20 24 66 69 6c 65 7d 0a 20 7d  veFile $file}. }
12a0: 0a 20 0a 2b 23 20 54 49 50 20 32 38 37 3a 20 63  . .+# TIP 287: c
12b0: 68 61 6e 20 61 76 61 69 6c 61 62 6c 65 0a 2b 74  han available.+t
12c0: 65 73 74 20 63 68 61 6e 2d 31 36 2e 31 20 7b 63  est chan-16.1 {c
12d0: 68 61 6e 20 63 6f 6d 6d 61 6e 64 3a 20 61 76 61  han command: ava
12e0: 69 6c 61 62 6c 65 20 73 75 62 63 6f 6d 6d 61 6e  ilable subcomman
12f0: 64 7d 20 2d 62 6f 64 79 20 7b 0a 2b 20 20 20 20  d} -body {.+    
1300: 63 68 61 6e 20 61 76 61 69 6c 61 62 6c 65 20 66  chan available f
1310: 6f 6f 20 62 61 72 0a 2b 7d 20 2d 72 65 74 75 72  oo bar.+} -retur
1320: 6e 43 6f 64 65 73 20 65 72 72 6f 72 20 2d 72 65  nCodes error -re
1330: 73 75 6c 74 20 22 77 72 6f 6e 67 20 23 20 61 72  sult "wrong # ar
1340: 67 73 3a 20 73 68 6f 75 6c 64 20 62 65 20 5c 22  gs: should be \"
1350: 63 68 61 6e 20 61 76 61 69 6c 61 62 6c 65 20 63  chan available c
1360: 68 61 6e 6e 65 6c 49 64 5c 22 22 0a 2b 74 65 73  hannelId\"".+tes
1370: 74 20 63 68 61 6e 2d 31 36 2e 32 20 7b 63 68 61  t chan-16.2 {cha
1380: 6e 20 63 6f 6d 6d 61 6e 64 3a 20 61 76 61 69 6c  n command: avail
1390: 61 62 6c 65 20 73 75 62 63 6f 6d 6d 61 6e 64 7d  able subcommand}
13a0: 20 2d 62 6f 64 79 20 7b 0a 2b 20 20 20 20 63 68   -body {.+    ch
13b0: 61 6e 20 61 76 61 69 6c 61 62 6c 65 20 73 74 64  an available std
13c0: 6f 75 74 20 0a 2b 7d 20 2d 72 65 74 75 72 6e 43  out .+} -returnC
13d0: 6f 64 65 73 20 65 72 72 6f 72 20 2d 72 65 73 75  odes error -resu
13e0: 6c 74 20 22 63 68 61 6e 6e 65 6c 20 5c 22 73 74  lt "channel \"st
13f0: 64 6f 75 74 5c 22 20 77 61 73 6e 27 74 20 6f 70  dout\" wasn't op
1400: 65 6e 65 64 20 66 6f 72 20 72 65 61 64 69 6e 67  ened for reading
1410: 22 0a 2b 74 65 73 74 20 63 68 61 6e 2d 31 36 2e  ".+test chan-16.
1420: 33 20 7b 63 68 61 6e 20 63 6f 6d 6d 61 6e 64 3a  3 {chan command:
1430: 20 61 76 61 69 6c 61 62 6c 65 20 73 75 62 63 6f   available subco
1440: 6d 6d 61 6e 64 7d 20 2d 62 6f 64 79 20 7b 0a 2b  mmand} -body {.+
1450: 20 20 20 20 63 68 61 6e 20 61 76 61 69 6c 61 62      chan availab
1460: 6c 65 20 73 74 64 69 6e 0a 2b 7d 20 2d 72 65 73  le stdin.+} -res
1470: 75 6c 74 20 30 0a 2b 74 65 73 74 20 63 68 61 6e  ult 0.+test chan
1480: 2d 31 36 2e 34 20 7b 63 68 61 6e 20 63 6f 6d 6d  -16.4 {chan comm
1490: 61 6e 64 3a 20 61 76 61 69 6c 61 62 6c 65 20 73  and: available s
14a0: 75 62 63 6f 6d 6d 61 6e 64 7d 20 2d 62 6f 64 79  ubcommand} -body
14b0: 20 7b 0a 2b 20 20 20 20 63 68 61 6e 20 61 76 61   {.+    chan ava
14c0: 69 6c 61 62 6c 65 20 46 4f 4f 42 41 52 0a 2b 7d  ilable FOOBAR.+}
14d0: 20 2d 72 65 74 75 72 6e 43 6f 64 65 73 20 65 72   -returnCodes er
14e0: 72 6f 72 20 2d 72 65 73 75 6c 74 20 22 63 61 6e  ror -result "can
14f0: 20 6e 6f 74 20 66 69 6e 64 20 63 68 61 6e 6e 65   not find channe
1500: 6c 20 6e 61 6d 65 64 20 5c 22 46 4f 4f 42 41 52  l named \"FOOBAR
1510: 5c 22 22 0a 2b 74 65 73 74 20 63 68 61 6e 2d 31  \"".+test chan-1
1520: 36 2e 35 20 7b 63 68 61 6e 20 63 6f 6d 6d 61 6e  6.5 {chan comman
1530: 64 3a 20 61 76 61 69 6c 61 62 6c 65 20 73 75 62  d: available sub
1540: 63 6f 6d 6d 61 6e 64 7d 20 2d 73 65 74 75 70 20  command} -setup 
1550: 7b 0a 2b 20 20 20 20 73 65 74 20 66 69 6c 65 20  {.+    set file 
1560: 5b 6d 61 6b 65 46 69 6c 65 20 7b 7d 20 74 65 73  [makeFile {} tes
1570: 74 41 76 61 69 6c 61 62 6c 65 5d 0a 2b 20 20 20  tAvailable].+   
1580: 20 73 65 74 20 66 20 5b 6f 70 65 6e 20 24 66 69   set f [open $fi
1590: 6c 65 20 77 2b 5d 0a 2b 20 20 20 20 63 68 61 6e  le w+].+    chan
15a0: 20 63 6f 6e 66 69 67 75 72 65 20 24 66 20 2d 74   configure $f -t
15b0: 72 61 6e 73 6c 61 74 69 6f 6e 20 6c 66 20 2d 62  ranslation lf -b
15c0: 75 66 66 65 72 69 6e 67 20 6c 69 6e 65 0a 2b 7d  uffering line.+}
15d0: 20 2d 62 6f 64 79 20 7b 0a 2b 20 20 20 20 63 68   -body {.+    ch
15e0: 61 6e 20 70 75 74 73 20 24 66 20 66 6f 6f 0a 2b  an puts $f foo.+
15f0: 20 20 20 20 63 68 61 6e 20 70 75 74 73 20 24 66      chan puts $f
1600: 20 62 61 72 0a 2b 20 20 20 20 63 68 61 6e 20 70   bar.+    chan p
1610: 75 74 73 20 24 66 20 62 61 7a 0a 2b 20 20 20 20  uts $f baz.+    
1620: 63 68 61 6e 20 73 65 65 6b 20 24 66 20 30 0a 2b  chan seek $f 0.+
1630: 20 20 20 20 63 68 61 6e 20 67 65 74 73 20 24 66      chan gets $f
1640: 0a 2b 20 20 20 20 63 68 61 6e 20 61 76 61 69 6c  .+    chan avail
1650: 61 62 6c 65 20 24 66 0a 2b 7d 20 2d 72 65 73 75  able $f.+} -resu
1660: 6c 74 20 38 20 2d 63 6c 65 61 6e 75 70 20 7b 0a  lt 8 -cleanup {.
1670: 2b 20 20 20 20 63 61 74 63 68 20 7b 63 68 61 6e  +    catch {chan
1680: 20 63 6c 6f 73 65 20 24 66 7d 0a 2b 20 20 20 20   close $f}.+    
1690: 63 61 74 63 68 20 7b 72 65 6d 6f 76 65 46 69 6c  catch {removeFil
16a0: 65 20 24 66 69 6c 65 7d 0a 2b 7d 0a 2b 0a 20 63  e $file}.+}.+. c
16b0: 6c 65 61 6e 75 70 54 65 73 74 73 0a 20 72 65 74  leanupTests. ret
16c0: 75 72 6e 0a 20 0a 2d 2d 2d 20 74 65 73 74 73 2f  urn. .--- tests/
16d0: 69 6f 43 6d 64 2e 74 65 73 74 2e 6f 72 69 67 09  ioCmd.test.orig.
16e0: 32 30 30 36 2d 31 30 2d 32 38 20 32 33 3a 30 36  2006-10-28 23:06
16f0: 3a 34 34 2e 30 30 30 30 30 30 30 30 30 20 2d 30  :44.000000000 -0
1700: 36 30 30 0a 2b 2b 2b 20 74 65 73 74 73 2f 69 6f  600.+++ tests/io
1710: 43 6d 64 2e 74 65 73 74 09 32 30 30 36 2d 31 30  Cmd.test.2006-10
1720: 2d 32 38 20 32 33 3a 30 39 3a 31 30 2e 30 30 30  -28 23:09:10.000
1730: 30 30 30 30 30 30 20 2d 30 36 30 30 0a 40 40 20  000000 -0600.@@ 
1740: 2d 36 32 38 2c 37 20 2b 36 32 38 2c 37 20 40 40  -628,7 +628,7 @@
1750: 0a 20 74 65 73 74 20 69 6f 63 6d 64 2d 32 30 2e  . test iocmd-20.
1760: 31 20 7b 63 68 61 6e 2c 20 75 6e 6b 6e 6f 77 6e  1 {chan, unknown
1770: 20 6d 65 74 68 6f 64 7d 20 7b 0a 20 20 20 20 20   method} {.     
1780: 63 61 74 63 68 20 7b 63 68 61 6e 20 66 6f 6f 7d  catch {chan foo}
1790: 20 6d 73 67 0a 20 20 20 20 20 73 65 74 20 6d 73   msg.     set ms
17a0: 67 0a 2d 7d 20 7b 75 6e 6b 6e 6f 77 6e 20 6f 72  g.-} {unknown or
17b0: 20 61 6d 62 69 67 75 6f 75 73 20 73 75 62 63 6f   ambiguous subco
17c0: 6d 6d 61 6e 64 20 22 66 6f 6f 22 3a 20 6d 75 73  mmand "foo": mus
17d0: 74 20 62 65 20 62 6c 6f 63 6b 65 64 2c 20 63 6c  t be blocked, cl
17e0: 6f 73 65 2c 20 63 6f 6e 66 69 67 75 72 65 2c 20  ose, configure, 
17f0: 63 6f 70 79 2c 20 63 72 65 61 74 65 2c 20 65 6f  copy, create, eo
1800: 66 2c 20 65 76 65 6e 74 2c 20 66 6c 75 73 68 2c  f, event, flush,
1810: 20 67 65 74 73 2c 20 6e 61 6d 65 73 2c 20 70 6f   gets, names, po
1820: 73 74 65 76 65 6e 74 2c 20 70 75 74 73 2c 20 72  stevent, puts, r
1830: 65 61 64 2c 20 73 65 65 6b 2c 20 74 65 6c 6c 2c  ead, seek, tell,
1840: 20 6f 72 20 74 72 75 6e 63 61 74 65 7d 0a 2b 7d   or truncate}.+}
1850: 20 7b 75 6e 6b 6e 6f 77 6e 20 6f 72 20 61 6d 62   {unknown or amb
1860: 69 67 75 6f 75 73 20 73 75 62 63 6f 6d 6d 61 6e  iguous subcomman
1870: 64 20 22 66 6f 6f 22 3a 20 6d 75 73 74 20 62 65  d "foo": must be
1880: 20 61 76 61 69 6c 61 62 6c 65 2c 20 62 6c 6f 63   available, bloc
1890: 6b 65 64 2c 20 63 6c 6f 73 65 2c 20 63 6f 6e 66  ked, close, conf
18a0: 69 67 75 72 65 2c 20 63 6f 70 79 2c 20 63 72 65  igure, copy, cre
18b0: 61 74 65 2c 20 65 6f 66 2c 20 65 76 65 6e 74 2c  ate, eof, event,
18c0: 20 66 6c 75 73 68 2c 20 67 65 74 73 2c 20 6e 61   flush, gets, na
18d0: 6d 65 73 2c 20 70 6f 73 74 65 76 65 6e 74 2c 20  mes, postevent, 
18e0: 70 75 74 73 2c 20 72 65 61 64 2c 20 73 65 65 6b  puts, read, seek
18f0: 2c 20 74 65 6c 6c 2c 20 6f 72 20 74 72 75 6e 63  , tell, or trunc
1900: 61 74 65 7d 0a 20 0a 20 23 20 2d 2d 2d 20 2d 2d  ate}. . # --- --
1910: 2d 20 2d 2d 2d 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 20  - --- --------- 
1920: 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 2d 2d 2d 2d 2d 2d  --------- ------
1930: 2d 2d 2d 0a 20 23 20 63 68 61 6e 20 63 72 65 61  ---. # chan crea
1940: 74 65 2c 20 61 6e 64 20 6d 65 74 68 6f 64 20 22  te, and method "
1950: 69 6e 69 74 61 6c 69 7a 65 22 0a                 initalize".