Attachment "range6.patch" to
ticket [1052584fff]
added by
antirez
2004-10-26 05:00:13.
0000: 3f 20 74 65 73 74 73 2f 72 61 6e 67 65 2e 74 65 ? tests/range.te
0010: 73 74 2e 74 63 6c 0a 49 6e 64 65 78 3a 20 67 65 st.tcl.Index: ge
0020: 6e 65 72 69 63 2f 74 63 6c 2e 64 65 63 6c 73 0a neric/tcl.decls.
0030: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0040: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0050: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0060: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0070: 3d 3d 3d 0a 52 43 53 20 66 69 6c 65 3a 20 2f 63 ===.RCS file: /c
0080: 76 73 72 6f 6f 74 2f 74 63 6c 2f 74 63 6c 2f 67 vsroot/tcl/tcl/g
0090: 65 6e 65 72 69 63 2f 74 63 6c 2e 64 65 63 6c 73 eneric/tcl.decls
00a0: 2c 76 0a 72 65 74 72 69 65 76 69 6e 67 20 72 65 ,v.retrieving re
00b0: 76 69 73 69 6f 6e 20 31 2e 31 30 34 0a 64 69 66 vision 1.104.dif
00c0: 66 20 2d 75 20 2d 72 31 2e 31 30 34 20 74 63 6c f -u -r1.104 tcl
00d0: 2e 64 65 63 6c 73 0a 2d 2d 2d 20 67 65 6e 65 72 .decls.--- gener
00e0: 69 63 2f 74 63 6c 2e 64 65 63 6c 73 09 31 33 20 ic/tcl.decls.13
00f0: 4d 61 79 20 32 30 30 34 20 31 32 3a 35 39 3a 32 May 2004 12:59:2
0100: 30 20 2d 30 30 30 30 09 31 2e 31 30 34 0a 2b 2b 0 -0000.1.104.++
0110: 2b 20 67 65 6e 65 72 69 63 2f 74 63 6c 2e 64 65 + generic/tcl.de
0120: 63 6c 73 09 32 35 20 4f 63 74 20 32 30 30 34 20 cls.25 Oct 2004
0130: 32 31 3a 35 32 3a 31 37 20 2d 30 30 30 30 0a 40 21:52:17 -0000.@
0140: 40 20 2d 31 39 30 39 2c 36 20 2b 31 39 30 39 2c @ -1909,6 +1909,
0150: 31 37 20 40 40 0a 20 64 65 63 6c 61 72 65 20 35 17 @@. declare 5
0160: 33 34 20 67 65 6e 65 72 69 63 20 7b 0a 20 20 20 34 generic {.
0170: 20 20 69 6e 74 20 54 63 6c 5f 4c 69 6d 69 74 47 int Tcl_LimitG
0180: 65 74 47 72 61 6e 75 6c 61 72 69 74 79 28 54 63 etGranularity(Tc
0190: 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 l_Interp *interp
01a0: 2c 20 69 6e 74 20 74 79 70 65 29 0a 20 7d 0a 2b , int type). }.+
01b0: 64 65 63 6c 61 72 65 20 35 33 35 20 67 65 6e 65 declare 535 gene
01c0: 72 69 63 20 7b 0a 2b 20 20 20 20 54 63 6c 5f 4f ric {.+ Tcl_O
01d0: 62 6a 20 2a 20 54 63 6c 5f 4e 65 77 41 72 69 74 bj * Tcl_NewArit
01e0: 68 53 65 72 69 65 73 4f 62 6a 28 54 63 6c 5f 57 hSeriesObj(Tcl_W
01f0: 69 64 65 49 6e 74 20 73 74 61 72 74 2c 0a 2b 09 ideInt start,.+.
0200: 20 20 20 20 54 63 6c 5f 57 69 64 65 49 6e 74 20 Tcl_WideInt
0210: 65 6e 64 2c 20 54 63 6c 5f 57 69 64 65 49 6e 74 end, Tcl_WideInt
0220: 20 73 74 65 70 29 0a 2b 7d 0a 2b 64 65 63 6c 61 step).+}.+decla
0230: 72 65 20 35 33 36 20 67 65 6e 65 72 69 63 20 7b re 536 generic {
0240: 0a 2b 20 20 20 20 69 6e 74 20 54 63 6c 5f 41 72 .+ int Tcl_Ar
0250: 69 74 68 53 65 72 69 65 73 4f 62 6a 49 6e 64 65 ithSeriesObjInde
0260: 78 28 54 63 6c 5f 4f 62 6a 20 2a 61 72 69 74 68 x(Tcl_Obj *arith
0270: 53 65 72 69 65 73 50 74 72 2c 20 69 6e 74 20 69 SeriesPtr, int i
0280: 6e 64 65 78 2c 0a 2b 20 20 20 20 20 20 20 20 20 ndex,.+
0290: 20 20 20 54 63 6c 5f 57 69 64 65 49 6e 74 20 2a Tcl_WideInt *
02a0: 65 6c 65 6d 65 6e 74 29 0a 2b 7d 0a 2b 64 65 63 element).+}.+dec
02b0: 6c 61 72 65 20 35 33 37 20 67 65 6e 65 72 69 63 lare 537 generic
02c0: 20 7b 0a 2b 20 20 20 20 69 6e 74 20 54 63 6c 5f {.+ int Tcl_
02d0: 41 72 69 74 68 53 65 72 69 65 73 4f 62 6a 4c 65 ArithSeriesObjLe
02e0: 6e 67 74 68 28 54 63 6c 5f 4f 62 6a 20 2a 61 72 ngth(Tcl_Obj *ar
02f0: 69 74 68 53 65 72 69 65 73 50 74 72 29 0a 2b 7d ithSeriesPtr).+}
0300: 0a 20 0a 20 23 23 23 23 23 23 23 23 23 23 23 23 . . ############
0310: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0320: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0330: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0340: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0350: 23 23 0a 20 0a 49 6e 64 65 78 3a 20 67 65 6e 65 ##. .Index: gene
0360: 72 69 63 2f 74 63 6c 42 61 73 69 63 2e 63 0a 3d ric/tclBasic.c.=
0370: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0380: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0390: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
03a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
03b0: 3d 3d 0a 52 43 53 20 66 69 6c 65 3a 20 2f 63 76 ==.RCS file: /cv
03c0: 73 72 6f 6f 74 2f 74 63 6c 2f 74 63 6c 2f 67 65 sroot/tcl/tcl/ge
03d0: 6e 65 72 69 63 2f 74 63 6c 42 61 73 69 63 2e 63 neric/tclBasic.c
03e0: 2c 76 0a 72 65 74 72 69 65 76 69 6e 67 20 72 65 ,v.retrieving re
03f0: 76 69 73 69 6f 6e 20 31 2e 31 33 33 0a 64 69 66 vision 1.133.dif
0400: 66 20 2d 75 20 2d 72 31 2e 31 33 33 20 74 63 6c f -u -r1.133 tcl
0410: 42 61 73 69 63 2e 63 0a 2d 2d 2d 20 67 65 6e 65 Basic.c.--- gene
0420: 72 69 63 2f 74 63 6c 42 61 73 69 63 2e 63 09 32 ric/tclBasic.c.2
0430: 34 20 4f 63 74 20 32 30 30 34 20 32 32 3a 32 35 4 Oct 2004 22:25
0440: 3a 31 32 20 2d 30 30 30 30 09 31 2e 31 33 33 0a :12 -0000.1.133.
0450: 2b 2b 2b 20 67 65 6e 65 72 69 63 2f 74 63 6c 42 +++ generic/tclB
0460: 61 73 69 63 2e 63 09 32 35 20 4f 63 74 20 32 30 asic.c.25 Oct 20
0470: 30 34 20 32 31 3a 35 32 3a 32 35 20 2d 30 30 30 04 21:52:25 -000
0480: 30 0a 40 40 20 2d 39 34 2c 36 20 2b 39 34 2c 37 0.@@ -94,6 +94,7
0490: 20 40 40 0a 20 20 20 20 20 7b 22 6e 61 6d 65 73 @@. {"names
04a0: 70 61 63 65 22 2c 09 54 63 6c 5f 4e 61 6d 65 73 pace",.Tcl_Names
04b0: 70 61 63 65 4f 62 6a 43 6d 64 2c 09 28 43 6f 6d paceObjCmd,.(Com
04c0: 70 69 6c 65 50 72 6f 63 20 2a 29 20 4e 55 4c 4c pileProc *) NULL
04d0: 2c 09 31 7d 2c 0a 20 20 20 20 20 7b 22 70 61 63 ,.1},. {"pac
04e0: 6b 61 67 65 22 2c 09 09 54 63 6c 5f 50 61 63 6b kage",..Tcl_Pack
04f0: 61 67 65 4f 62 6a 43 6d 64 2c 09 28 43 6f 6d 70 ageObjCmd,.(Comp
0500: 69 6c 65 50 72 6f 63 20 2a 29 20 4e 55 4c 4c 2c ileProc *) NULL,
0510: 09 31 7d 2c 0a 20 20 20 20 20 7b 22 70 72 6f 63 .1},. {"proc
0520: 22 2c 09 09 54 63 6c 5f 50 72 6f 63 4f 62 6a 43 ",..Tcl_ProcObjC
0530: 6d 64 2c 09 09 28 43 6f 6d 70 69 6c 65 50 72 6f md,..(CompilePro
0540: 63 20 2a 29 20 4e 55 4c 4c 2c 09 31 7d 2c 0a 2b c *) NULL,.1},.+
0550: 20 20 20 20 7b 22 72 61 6e 67 65 22 2c 09 09 54 {"range",..T
0560: 63 6c 5f 52 61 6e 67 65 4f 62 6a 43 6d 64 2c 09 cl_RangeObjCmd,.
0570: 28 43 6f 6d 70 69 6c 65 50 72 6f 63 20 2a 29 20 (CompileProc *)
0580: 4e 55 4c 4c 2c 09 31 7d 2c 0a 20 20 20 20 20 7b NULL,.1},. {
0590: 22 72 65 67 65 78 70 22 2c 09 09 54 63 6c 5f 52 "regexp",..Tcl_R
05a0: 65 67 65 78 70 4f 62 6a 43 6d 64 2c 09 54 63 6c egexpObjCmd,.Tcl
05b0: 43 6f 6d 70 69 6c 65 52 65 67 65 78 70 43 6d 64 CompileRegexpCmd
05c0: 2c 09 31 7d 2c 0a 20 20 20 20 20 7b 22 72 65 67 ,.1},. {"reg
05d0: 73 75 62 22 2c 09 09 54 63 6c 5f 52 65 67 73 75 sub",..Tcl_Regsu
05e0: 62 4f 62 6a 43 6d 64 2c 09 28 43 6f 6d 70 69 6c bObjCmd,.(Compil
05f0: 65 50 72 6f 63 20 2a 29 20 4e 55 4c 4c 2c 09 31 eProc *) NULL,.1
0600: 7d 2c 0a 20 20 20 20 20 7b 22 72 65 6e 61 6d 65 },. {"rename
0610: 22 2c 09 09 54 63 6c 5f 52 65 6e 61 6d 65 4f 62 ",..Tcl_RenameOb
0620: 6a 43 6d 64 2c 09 28 43 6f 6d 70 69 6c 65 50 72 jCmd,.(CompilePr
0630: 6f 63 20 2a 29 20 4e 55 4c 4c 2c 09 31 7d 2c 0a oc *) NULL,.1},.
0640: 49 6e 64 65 78 3a 20 67 65 6e 65 72 69 63 2f 74 Index: generic/t
0650: 63 6c 43 6d 64 41 48 2e 63 0a 3d 3d 3d 3d 3d 3d clCmdAH.c.======
0660: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0670: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0680: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0690: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 52 43 =============.RC
06a0: 53 20 66 69 6c 65 3a 20 2f 63 76 73 72 6f 6f 74 S file: /cvsroot
06b0: 2f 74 63 6c 2f 74 63 6c 2f 67 65 6e 65 72 69 63 /tcl/tcl/generic
06c0: 2f 74 63 6c 43 6d 64 41 48 2e 63 2c 76 0a 72 65 /tclCmdAH.c,v.re
06d0: 74 72 69 65 76 69 6e 67 20 72 65 76 69 73 69 6f trieving revisio
06e0: 6e 20 31 2e 35 36 0a 64 69 66 66 20 2d 75 20 2d n 1.56.diff -u -
06f0: 72 31 2e 35 36 20 74 63 6c 43 6d 64 41 48 2e 63 r1.56 tclCmdAH.c
0700: 0a 2d 2d 2d 20 67 65 6e 65 72 69 63 2f 74 63 6c .--- generic/tcl
0710: 43 6d 64 41 48 2e 63 09 32 31 20 4f 63 74 20 32 CmdAH.c.21 Oct 2
0720: 30 30 34 20 31 35 3a 31 39 3a 34 36 20 2d 30 30 004 15:19:46 -00
0730: 30 30 09 31 2e 35 36 0a 2b 2b 2b 20 67 65 6e 65 00.1.56.+++ gene
0740: 72 69 63 2f 74 63 6c 43 6d 64 41 48 2e 63 09 32 ric/tclCmdAH.c.2
0750: 35 20 4f 63 74 20 32 30 30 34 20 32 31 3a 35 32 5 Oct 2004 21:52
0760: 3a 32 38 20 2d 30 30 30 30 0a 40 40 20 2d 31 37 :28 -0000.@@ -17
0770: 36 37 2c 31 30 20 2b 31 37 36 37 2c 31 34 20 40 67,10 +1767,14 @
0780: 40 0a 20 09 20 20 20 20 67 6f 74 6f 20 64 6f 6e @. . goto don
0790: 65 3b 0a 20 09 7d 0a 20 0a 2d 09 72 65 73 75 6c e;. .}. .-.resul
07a0: 74 20 3d 20 54 63 6c 5f 4c 69 73 74 4f 62 6a 47 t = Tcl_ListObjG
07b0: 65 74 45 6c 65 6d 65 6e 74 73 28 69 6e 74 65 72 etElements(inter
07c0: 70 2c 20 61 72 67 4f 62 6a 76 5b 32 2b 69 2a 32 p, argObjv[2+i*2
07d0: 5d 2c 0a 2d 09 20 20 20 20 20 20 20 20 26 61 72 ],.-. &ar
07e0: 67 63 4c 69 73 74 5b 69 5d 2c 20 26 61 72 67 76 gcList[i], &argv
07f0: 4c 69 73 74 5b 69 5d 29 3b 0a 2d 09 69 66 20 28 List[i]);.-.if (
0800: 72 65 73 75 6c 74 20 21 3d 20 54 43 4c 5f 4f 4b result != TCL_OK
0810: 29 20 7b 0a 2d 09 20 20 20 20 67 6f 74 6f 20 64 ) {.-. goto d
0820: 6f 6e 65 3b 0a 2b 09 69 66 20 28 61 72 67 4f 62 one;.+.if (argOb
0830: 6a 76 5b 32 2b 69 2a 32 5d 2d 3e 74 79 70 65 50 jv[2+i*2]->typeP
0840: 74 72 20 21 3d 20 26 74 63 6c 41 72 69 74 68 53 tr != &tclArithS
0850: 65 72 69 65 73 54 79 70 65 29 20 7b 0a 2b 09 20 eriesType) {.+.
0860: 20 20 20 72 65 73 75 6c 74 20 3d 20 54 63 6c 5f result = Tcl_
0870: 4c 69 73 74 4f 62 6a 47 65 74 45 6c 65 6d 65 6e ListObjGetElemen
0880: 74 73 28 69 6e 74 65 72 70 2c 20 61 72 67 4f 62 ts(interp, argOb
0890: 6a 76 5b 32 2b 69 2a 32 5d 2c 0a 2b 09 09 09 26 jv[2+i*2],.+...&
08a0: 61 72 67 63 4c 69 73 74 5b 69 5d 2c 20 26 61 72 argcList[i], &ar
08b0: 67 76 4c 69 73 74 5b 69 5d 29 3b 0a 2b 09 20 20 gvList[i]);.+.
08c0: 20 20 69 66 20 28 72 65 73 75 6c 74 20 21 3d 20 if (result !=
08d0: 54 43 4c 5f 4f 4b 29 20 7b 0a 2b 09 20 20 20 20 TCL_OK) {.+.
08e0: 20 20 20 20 67 6f 74 6f 20 64 6f 6e 65 3b 0a 2b goto done;.+
08f0: 09 20 20 20 20 7d 0a 2b 09 7d 20 65 6c 73 65 20 . }.+.} else
0900: 7b 0a 2b 09 20 20 20 20 61 72 67 63 4c 69 73 74 {.+. argcList
0910: 5b 69 5d 20 3d 20 54 63 6c 5f 41 72 69 74 68 53 [i] = Tcl_ArithS
0920: 65 72 69 65 73 4f 62 6a 4c 65 6e 67 74 68 28 61 eriesObjLength(a
0930: 72 67 4f 62 6a 76 5b 32 2b 69 2a 32 5d 29 3b 0a rgObjv[2+i*2]);.
0940: 20 09 7d 0a 20 0a 20 09 6a 20 3d 20 61 72 67 63 .}. . .j = argc
0950: 4c 69 73 74 5b 69 5d 20 2f 20 76 61 72 63 4c 69 List[i] / varcLi
0960: 73 74 5b 69 5d 3b 0a 40 40 20 2d 31 38 30 34 2c st[i];.@@ -1804,
0970: 31 30 20 2b 31 38 30 38 2c 31 34 20 40 40 0a 20 10 +1808,14 @@.
0980: 09 20 20 20 20 69 66 20 28 72 65 73 75 6c 74 20 . if (result
0990: 21 3d 20 54 43 4c 5f 4f 4b 29 20 7b 0a 20 09 09 != TCL_OK) {. ..
09a0: 54 63 6c 5f 50 61 6e 69 63 28 22 54 63 6c 5f 46 Tcl_Panic("Tcl_F
09b0: 6f 72 65 61 63 68 4f 62 6a 43 6d 64 3a 20 63 6f oreachObjCmd: co
09c0: 75 6c 64 20 6e 6f 74 20 72 65 63 6f 6e 76 65 72 uld not reconver
09d0: 74 20 76 61 72 69 61 62 6c 65 20 6c 69 73 74 20 t variable list
09e0: 25 64 20 74 6f 20 61 20 6c 69 73 74 20 6f 62 6a %d to a list obj
09f0: 65 63 74 5c 6e 22 2c 20 69 29 3b 0a 20 09 20 20 ect\n", i);. .
0a00: 20 20 7d 0a 2d 09 20 20 20 20 72 65 73 75 6c 74 }.-. result
0a10: 20 3d 20 54 63 6c 5f 4c 69 73 74 4f 62 6a 47 65 = Tcl_ListObjGe
0a20: 74 45 6c 65 6d 65 6e 74 73 28 69 6e 74 65 72 70 tElements(interp
0a30: 2c 20 61 72 67 4f 62 6a 76 5b 32 2b 69 2a 32 5d , argObjv[2+i*2]
0a40: 2c 0a 2d 09 09 20 20 20 20 26 61 72 67 63 4c 69 ,.-.. &argcLi
0a50: 73 74 5b 69 5d 2c 20 26 61 72 67 76 4c 69 73 74 st[i], &argvList
0a60: 5b 69 5d 29 3b 0a 2d 09 20 20 20 20 69 66 20 28 [i]);.-. if (
0a70: 72 65 73 75 6c 74 20 21 3d 20 54 43 4c 5f 4f 4b result != TCL_OK
0a80: 29 20 7b 0a 2d 09 09 54 63 6c 5f 50 61 6e 69 63 ) {.-..Tcl_Panic
0a90: 28 22 54 63 6c 5f 46 6f 72 65 61 63 68 4f 62 6a ("Tcl_ForeachObj
0aa0: 43 6d 64 3a 20 63 6f 75 6c 64 20 6e 6f 74 20 72 Cmd: could not r
0ab0: 65 63 6f 6e 76 65 72 74 20 76 61 6c 75 65 20 6c econvert value l
0ac0: 69 73 74 20 25 64 20 74 6f 20 61 20 6c 69 73 74 ist %d to a list
0ad0: 20 6f 62 6a 65 63 74 5c 6e 22 2c 20 69 29 3b 0a object\n", i);.
0ae0: 2b 09 20 20 20 20 69 66 20 28 61 72 67 4f 62 6a +. if (argObj
0af0: 76 5b 32 2b 69 2a 32 5d 2d 3e 74 79 70 65 50 74 v[2+i*2]->typePt
0b00: 72 20 21 3d 20 26 74 63 6c 41 72 69 74 68 53 65 r != &tclArithSe
0b10: 72 69 65 73 54 79 70 65 29 20 7b 0a 2b 09 20 20 riesType) {.+.
0b20: 20 20 20 20 20 20 72 65 73 75 6c 74 20 3d 20 54 result = T
0b30: 63 6c 5f 4c 69 73 74 4f 62 6a 47 65 74 45 6c 65 cl_ListObjGetEle
0b40: 6d 65 6e 74 73 28 69 6e 74 65 72 70 2c 20 61 72 ments(interp, ar
0b50: 67 4f 62 6a 76 5b 32 2b 69 2a 32 5d 2c 0a 2b 09 gObjv[2+i*2],.+.
0b60: 09 20 20 20 20 20 20 20 20 26 61 72 67 63 4c 69 . &argcLi
0b70: 73 74 5b 69 5d 2c 20 26 61 72 67 76 4c 69 73 74 st[i], &argvList
0b80: 5b 69 5d 29 3b 0a 2b 09 20 20 20 20 20 20 20 20 [i]);.+.
0b90: 69 66 20 28 72 65 73 75 6c 74 20 21 3d 20 54 43 if (result != TC
0ba0: 4c 5f 4f 4b 29 20 7b 0a 2b 09 09 20 20 20 20 54 L_OK) {.+.. T
0bb0: 63 6c 5f 50 61 6e 69 63 28 22 54 63 6c 5f 46 6f cl_Panic("Tcl_Fo
0bc0: 72 65 61 63 68 4f 62 6a 43 6d 64 3a 20 63 6f 75 reachObjCmd: cou
0bd0: 6c 64 20 6e 6f 74 20 72 65 63 6f 6e 76 65 72 74 ld not reconvert
0be0: 20 76 61 6c 75 65 20 6c 69 73 74 20 25 64 20 74 value list %d t
0bf0: 6f 20 61 20 6c 69 73 74 20 6f 62 6a 65 63 74 5c o a list object\
0c00: 6e 22 2c 20 69 29 3b 0a 2b 09 20 20 20 20 20 20 n", i);.+.
0c10: 20 20 7d 0a 2b 09 20 20 20 20 7d 20 65 6c 73 65 }.+. } else
0c20: 20 7b 0a 2b 09 09 61 72 67 63 4c 69 73 74 5b 69 {.+..argcList[i
0c30: 5d 20 3d 20 54 63 6c 5f 41 72 69 74 68 53 65 72 ] = Tcl_ArithSer
0c40: 69 65 73 4f 62 6a 4c 65 6e 67 74 68 28 61 72 67 iesObjLength(arg
0c50: 4f 62 6a 76 5b 32 2b 69 2a 32 5d 29 3b 0a 20 09 Objv[2+i*2]);. .
0c60: 20 20 20 20 7d 0a 20 0a 20 09 20 20 20 20 66 6f }. . . fo
0c70: 72 20 28 76 20 3d 20 30 3b 20 20 76 20 3c 20 76 r (v = 0; v < v
0c80: 61 72 63 4c 69 73 74 5b 69 5d 3b 20 20 76 2b 2b arcList[i]; v++
0c90: 29 20 7b 0a 40 40 20 2d 31 38 31 36 2c 37 20 2b ) {.@@ -1816,7 +
0ca0: 31 38 32 34 2c 32 30 20 40 40 0a 20 09 09 69 6e 1824,20 @@. ..in
0cb0: 74 20 69 73 45 6d 70 74 79 4f 62 6a 20 3d 20 30 t isEmptyObj = 0
0cc0: 3b 0a 20 0a 20 09 09 69 66 20 28 6b 20 3c 20 61 ;. . ..if (k < a
0cd0: 72 67 63 4c 69 73 74 5b 69 5d 29 20 7b 0a 2d 09 rgcList[i]) {.-.
0ce0: 09 20 20 20 20 76 61 6c 75 65 50 74 72 20 3d 20 . valuePtr =
0cf0: 61 72 67 76 4c 69 73 74 5b 69 5d 5b 6b 5d 3b 0a argvList[i][k];.
0d00: 2b 09 09 20 20 20 20 69 66 20 28 61 72 67 4f 62 +.. if (argOb
0d10: 6a 76 5b 32 2b 69 2a 32 5d 2d 3e 74 79 70 65 50 jv[2+i*2]->typeP
0d20: 74 72 20 21 3d 20 26 74 63 6c 41 72 69 74 68 53 tr != &tclArithS
0d30: 65 72 69 65 73 54 79 70 65 29 20 7b 0a 2b 09 09 eriesType) {.+..
0d40: 20 20 20 20 09 76 61 6c 75 65 50 74 72 20 3d 20 .valuePtr =
0d50: 61 72 67 76 4c 69 73 74 5b 69 5d 5b 6b 5d 3b 0a argvList[i][k];.
0d60: 2b 09 09 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a +.. } else {.
0d70: 2b 09 09 09 41 72 69 74 68 53 65 72 69 65 73 20 +...ArithSeries
0d80: 2a 61 72 69 74 68 53 65 72 69 65 73 52 65 70 50 *arithSeriesRepP
0d90: 74 72 20 3d 0a 2b 09 09 09 09 61 72 67 4f 62 6a tr =.+....argObj
0da0: 76 5b 32 2b 69 2a 32 5d 2d 3e 69 6e 74 65 72 6e v[2+i*2]->intern
0db0: 61 6c 52 65 70 2e 74 77 6f 50 74 72 56 61 6c 75 alRep.twoPtrValu
0dc0: 65 2e 70 74 72 31 3b 0a 2b 0a 2b 09 09 09 69 66 e.ptr1;.+.+...if
0dd0: 20 28 61 72 69 74 68 53 65 72 69 65 73 52 65 70 (arithSeriesRep
0de0: 50 74 72 2d 3e 66 6c 61 67 73 20 26 20 54 43 4c Ptr->flags & TCL
0df0: 5f 41 52 49 54 48 53 45 52 49 45 53 5f 49 53 5f _ARITHSERIES_IS_
0e00: 57 49 44 45 29 0a 2b 09 09 09 20 20 20 20 76 61 WIDE).+... va
0e10: 6c 75 65 50 74 72 20 3d 20 54 63 6c 5f 4e 65 77 luePtr = Tcl_New
0e20: 57 69 64 65 49 6e 74 4f 62 6a 28 0a 2b 09 09 09 WideIntObj(.+...
0e30: 09 09 20 20 20 20 61 72 69 74 68 53 65 72 69 65 .. arithSerie
0e40: 73 52 65 70 50 74 72 2d 3e 73 74 61 72 74 2e 77 sRepPtr->start.w
0e50: 20 2b 0a 2b 09 09 09 09 09 20 20 20 20 28 6b 2a +.+..... (k*
0e60: 61 72 69 74 68 53 65 72 69 65 73 52 65 70 50 74 arithSeriesRepPt
0e70: 72 2d 3e 73 74 65 70 2e 77 29 29 3b 0a 2b 09 09 r->step.w));.+..
0e80: 09 65 6c 73 65 0a 2b 09 09 09 20 20 20 20 76 61 .else.+... va
0e90: 6c 75 65 50 74 72 20 3d 20 54 63 6c 5f 4e 65 77 luePtr = Tcl_New
0ea0: 49 6e 74 4f 62 6a 28 61 72 69 74 68 53 65 72 69 IntObj(arithSeri
0eb0: 65 73 52 65 70 50 74 72 2d 3e 73 74 61 72 74 2e esRepPtr->start.
0ec0: 69 2b 0a 2b 09 09 09 09 09 20 20 20 20 28 6b 2a i+.+..... (k*
0ed0: 61 72 69 74 68 53 65 72 69 65 73 52 65 70 50 74 arithSeriesRepPt
0ee0: 72 2d 3e 73 74 65 70 2e 69 29 29 3b 0a 2b 09 09 r->step.i));.+..
0ef0: 20 20 20 20 7d 0a 20 09 09 7d 20 65 6c 73 65 20 }. ..} else
0f00: 7b 0a 20 09 09 20 20 20 20 76 61 6c 75 65 50 74 {. .. valuePt
0f10: 72 20 3d 20 54 63 6c 5f 4e 65 77 4f 62 6a 28 29 r = Tcl_NewObj()
0f20: 3b 20 2f 2a 20 65 6d 70 74 79 20 73 74 72 69 6e ; /* empty strin
0f30: 67 20 2a 2f 0a 20 09 09 20 20 20 20 69 73 45 6d g */. .. isEm
0f40: 70 74 79 4f 62 6a 20 3d 20 31 3b 0a 49 6e 64 65 ptyObj = 1;.Inde
0f50: 78 3a 20 67 65 6e 65 72 69 63 2f 74 63 6c 43 6d x: generic/tclCm
0f60: 64 49 4c 2e 63 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d dIL.c.==========
0f70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0f80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0f90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0fa0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 52 43 53 20 66 69 =========.RCS fi
0fb0: 6c 65 3a 20 2f 63 76 73 72 6f 6f 74 2f 74 63 6c le: /cvsroot/tcl
0fc0: 2f 74 63 6c 2f 67 65 6e 65 72 69 63 2f 74 63 6c /tcl/generic/tcl
0fd0: 43 6d 64 49 4c 2e 63 2c 76 0a 72 65 74 72 69 65 CmdIL.c,v.retrie
0fe0: 76 69 6e 67 20 72 65 76 69 73 69 6f 6e 20 31 2e ving revision 1.
0ff0: 36 37 0a 64 69 66 66 20 2d 75 20 2d 72 31 2e 36 67.diff -u -r1.6
1000: 37 20 74 63 6c 43 6d 64 49 4c 2e 63 0a 2d 2d 2d 7 tclCmdIL.c.---
1010: 20 67 65 6e 65 72 69 63 2f 74 63 6c 43 6d 64 49 generic/tclCmdI
1020: 4c 2e 63 09 32 35 20 4f 63 74 20 32 30 30 34 20 L.c.25 Oct 2004
1030: 30 31 3a 30 36 3a 34 39 20 2d 30 30 30 30 09 31 01:06:49 -0000.1
1040: 2e 36 37 0a 2b 2b 2b 20 67 65 6e 65 72 69 63 2f .67.+++ generic/
1050: 74 63 6c 43 6d 64 49 4c 2e 63 09 32 35 20 4f 63 tclCmdIL.c.25 Oc
1060: 74 20 32 30 30 34 20 32 31 3a 35 32 3a 33 35 20 t 2004 21:52:35
1070: 2d 30 30 30 30 0a 40 40 20 2d 32 33 34 34 2c 36 -0000.@@ -2344,6
1080: 20 2b 32 33 34 34 2c 33 35 20 40 40 0a 20 0a 20 +2344,35 @@. .
1090: 20 20 20 20 69 66 20 28 61 72 67 50 74 72 2d 3e if (argPtr->
10a0: 74 79 70 65 50 74 72 20 21 3d 20 26 74 63 6c 4c typePtr != &tclL
10b0: 69 73 74 54 79 70 65 20 0a 20 09 20 20 20 20 26 istType . . &
10c0: 26 20 54 63 6c 47 65 74 49 6e 74 46 6f 72 49 6e & TclGetIntForIn
10d0: 64 65 78 28 4e 55 4c 4c 20 2c 20 61 72 67 50 74 dex(NULL , argPt
10e0: 72 2c 20 30 2c 20 26 69 6e 64 65 78 29 20 3d 3d r, 0, &index) ==
10f0: 20 54 43 4c 5f 4f 4b 29 20 7b 0a 2b 0a 2b 09 2f TCL_OK) {.+.+./
1100: 2a 20 49 66 20 74 68 65 20 6c 69 73 74 20 69 73 * If the list is
1110: 20 61 6e 20 61 72 69 74 68 6d 65 74 69 63 20 73 an arithmetic s
1120: 65 72 69 65 73 20 72 65 74 75 72 6e 20 74 68 65 eries return the
1130: 0a 2b 09 20 2a 20 63 6f 6d 70 75 74 65 64 20 65 .+. * computed e
1140: 6c 65 6d 65 6e 74 2e 20 2a 2f 0a 2b 20 20 20 20 lement. */.+
1150: 20 20 20 20 69 66 20 28 6c 69 73 74 50 74 72 2d if (listPtr-
1160: 3e 74 79 70 65 50 74 72 20 3d 3d 20 26 74 63 6c >typePtr == &tcl
1170: 41 72 69 74 68 53 65 72 69 65 73 54 79 70 65 29 ArithSeriesType)
1180: 20 7b 0a 2b 09 20 20 20 20 54 63 6c 5f 4f 62 6a {.+. Tcl_Obj
1190: 20 2a 76 61 6c 50 74 72 3b 0a 2b 09 20 20 20 20 *valPtr;.+.
11a0: 69 6e 74 20 61 73 4c 65 6e 3b 0a 2b 09 20 20 20 int asLen;.+.
11b0: 20 54 63 6c 5f 57 69 64 65 49 6e 74 20 77 69 64 Tcl_WideInt wid
11c0: 65 56 61 6c 3b 0a 2b 0a 2b 09 20 20 20 20 2f 2a eVal;.+.+. /*
11d0: 20 50 61 72 73 65 20 74 68 65 20 69 6e 64 65 78 Parse the index
11e0: 20 2a 2f 0a 2b 09 20 20 20 20 61 73 4c 65 6e 20 */.+. asLen
11f0: 3d 20 54 63 6c 5f 41 72 69 74 68 53 65 72 69 65 = Tcl_ArithSerie
1200: 73 4f 62 6a 4c 65 6e 67 74 68 28 6c 69 73 74 50 sObjLength(listP
1210: 74 72 29 3b 0a 2b 09 20 20 20 20 72 65 73 75 6c tr);.+. resul
1220: 74 20 3d 20 54 63 6c 47 65 74 49 6e 74 46 6f 72 t = TclGetIntFor
1230: 49 6e 64 65 78 28 69 6e 74 65 72 70 2c 20 61 72 Index(interp, ar
1240: 67 50 74 72 2c 0a 2b 09 09 09 20 20 20 20 2f 2a gPtr,.+... /*
1250: 65 6e 64 56 61 6c 75 65 2a 2f 20 61 73 4c 65 6e endValue*/ asLen
1260: 2d 31 2c 20 26 69 6e 64 65 78 29 3b 0a 2b 09 20 -1, &index);.+.
1270: 20 20 20 69 66 20 28 72 65 73 75 6c 74 20 21 3d if (result !=
1280: 20 54 43 4c 5f 4f 4b 29 20 72 65 74 75 72 6e 20 TCL_OK) return
1290: 4e 55 4c 4c 3b 0a 2b 0a 2b 09 20 20 20 20 2f 2a NULL;.+.+. /*
12a0: 20 52 65 74 75 72 6e 20 74 68 65 20 63 6f 6d 70 Return the comp
12b0: 75 74 65 64 20 77 69 64 65 49 6e 74 20 6f 62 6a uted wideInt obj
12c0: 65 63 74 20 2a 2f 0a 2b 09 20 20 20 20 69 66 20 ect */.+. if
12d0: 28 54 63 6c 5f 41 72 69 74 68 53 65 72 69 65 73 (Tcl_ArithSeries
12e0: 4f 62 6a 49 6e 64 65 78 28 6c 69 73 74 50 74 72 ObjIndex(listPtr
12f0: 2c 20 69 6e 64 65 78 2c 20 26 77 69 64 65 56 61 , index, &wideVa
1300: 6c 29 20 3d 3d 20 54 43 4c 5f 4f 4b 29 0a 2b 09 l) == TCL_OK).+.
1310: 20 20 20 20 7b 0a 2b 09 09 69 66 20 28 77 69 64 {.+..if (wid
1320: 65 56 61 6c 20 3e 20 49 4e 54 5f 4d 41 58 20 7c eVal > INT_MAX |
1330: 7c 20 77 69 64 65 56 61 6c 20 3c 20 49 4e 54 5f | wideVal < INT_
1340: 4d 49 4e 29 0a 2b 09 20 20 20 20 20 20 20 20 20 MIN).+.
1350: 20 20 20 76 61 6c 50 74 72 20 3d 20 54 63 6c 5f valPtr = Tcl_
1360: 4e 65 77 57 69 64 65 49 6e 74 4f 62 6a 28 77 69 NewWideIntObj(wi
1370: 64 65 56 61 6c 29 3b 0a 2b 09 09 65 6c 73 65 0a deVal);.+..else.
1380: 2b 09 09 20 20 20 20 76 61 6c 50 74 72 20 3d 20 +.. valPtr =
1390: 54 63 6c 5f 4e 65 77 49 6e 74 4f 62 6a 28 28 69 Tcl_NewIntObj((i
13a0: 6e 74 29 77 69 64 65 56 61 6c 29 3b 0a 2b 20 20 nt)wideVal);.+
13b0: 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 } else
13c0: 20 7b 0a 2b 09 09 2f 2a 20 49 6e 64 65 78 20 6f {.+../* Index o
13d0: 75 74 20 6f 66 20 72 61 6e 67 65 20 63 61 73 65 ut of range case
13e0: 20 2a 2f 0a 2b 09 09 76 61 6c 50 74 72 20 3d 20 */.+..valPtr =
13f0: 54 63 6c 5f 4e 65 77 4f 62 6a 28 29 3b 0a 2b 09 Tcl_NewObj();.+.
1400: 20 20 20 20 7d 0a 2b 09 20 20 20 20 54 63 6c 5f }.+. Tcl_
1410: 49 6e 63 72 52 65 66 43 6f 75 6e 74 28 76 61 6c IncrRefCount(val
1420: 50 74 72 29 3b 0a 2b 09 20 20 20 20 72 65 74 75 Ptr);.+. retu
1430: 72 6e 20 76 61 6c 50 74 72 3b 0a 2b 09 7d 0a 2b rn valPtr;.+.}.+
1440: 0a 20 09 2f 2a 0a 20 09 20 2a 20 61 72 67 50 74 . ./*. . * argPt
1450: 72 20 64 65 73 69 67 6e 61 74 65 73 20 61 20 73 r designates a s
1460: 69 6e 67 6c 65 20 69 6e 64 65 78 2e 0a 20 09 20 ingle index.. .
1470: 2a 2f 0a 40 40 20 2d 32 37 32 38 2c 39 20 2b 32 */.@@ -2728,9 +2
1480: 37 35 37 2c 31 33 20 40 40 0a 20 09 72 65 74 75 757,13 @@. .retu
1490: 72 6e 20 54 43 4c 5f 45 52 52 4f 52 3b 0a 20 20 rn TCL_ERROR;.
14a0: 20 20 20 7d 0a 20 0a 2d 20 20 20 20 72 65 73 75 }. .- resu
14b0: 6c 74 20 3d 20 54 63 6c 5f 4c 69 73 74 4f 62 6a lt = Tcl_ListObj
14c0: 4c 65 6e 67 74 68 28 69 6e 74 65 72 70 2c 20 6f Length(interp, o
14d0: 62 6a 76 5b 31 5d 2c 20 26 6c 69 73 74 4c 65 6e bjv[1], &listLen
14e0: 29 3b 0a 2d 20 20 20 20 69 66 20 28 72 65 73 75 );.- if (resu
14f0: 6c 74 20 21 3d 20 54 43 4c 5f 4f 4b 29 20 7b 0a lt != TCL_OK) {.
1500: 2d 09 72 65 74 75 72 6e 20 72 65 73 75 6c 74 3b -.return result;
1510: 0a 2b 20 20 20 20 69 66 20 28 6f 62 6a 76 5b 31 .+ if (objv[1
1520: 5d 2d 3e 74 79 70 65 50 74 72 20 3d 3d 20 26 74 ]->typePtr == &t
1530: 63 6c 41 72 69 74 68 53 65 72 69 65 73 54 79 70 clArithSeriesTyp
1540: 65 29 20 7b 0a 2b 09 20 20 20 20 6c 69 73 74 4c e) {.+. listL
1550: 65 6e 20 3d 20 54 63 6c 5f 41 72 69 74 68 53 65 en = Tcl_ArithSe
1560: 72 69 65 73 4f 62 6a 4c 65 6e 67 74 68 28 6f 62 riesObjLength(ob
1570: 6a 76 5b 31 5d 29 3b 0a 2b 20 20 20 20 7d 20 65 jv[1]);.+ } e
1580: 6c 73 65 20 7b 0a 2b 20 20 20 20 20 20 20 20 72 lse {.+ r
1590: 65 73 75 6c 74 20 3d 20 54 63 6c 5f 4c 69 73 74 esult = Tcl_List
15a0: 4f 62 6a 4c 65 6e 67 74 68 28 69 6e 74 65 72 70 ObjLength(interp
15b0: 2c 20 6f 62 6a 76 5b 31 5d 2c 20 26 6c 69 73 74 , objv[1], &list
15c0: 4c 65 6e 29 3b 0a 2b 20 20 20 20 20 20 20 20 69 Len);.+ i
15d0: 66 20 28 72 65 73 75 6c 74 20 21 3d 20 54 43 4c f (result != TCL
15e0: 5f 4f 4b 29 20 7b 0a 2b 09 20 20 20 20 72 65 74 _OK) {.+. ret
15f0: 75 72 6e 20 72 65 73 75 6c 74 3b 0a 2b 20 20 20 urn result;.+
1600: 20 20 20 20 20 7d 0a 20 20 20 20 20 7d 0a 20 0a }. }. .
1610: 20 20 20 20 20 2f 2a 0a 40 40 20 2d 33 36 34 37 /*.@@ -3647
1620: 2c 36 20 2b 33 36 38 30 2c 38 33 20 40 40 0a 20 ,6 +3680,83 @@.
1630: 20 20 20 20 72 65 74 75 72 6e 20 54 43 4c 5f 4f return TCL_O
1640: 4b 3b 0a 20 7d 0a 20 0c 0a 2b 0a 2b 2f 2a 0a 2b K;. }. ..+.+/*.+
1650: 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d *--------------
1660: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
1670: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
1680: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
1690: 2d 2d 2d 2d 2d 2d 2d 2d 0a 2b 20 2a 0a 2b 20 2a --------.+ *.+ *
16a0: 20 54 63 6c 5f 52 61 6e 67 65 4f 62 6a 43 6d 64 Tcl_RangeObjCmd
16b0: 20 2d 2d 0a 2b 20 2a 0a 2b 20 2a 20 09 54 68 69 --.+ *.+ * .Thi
16c0: 73 20 70 72 6f 63 65 64 75 72 65 20 72 65 74 75 s procedure retu
16d0: 72 6e 73 20 61 20 6c 69 73 74 20 77 68 65 72 65 rns a list where
16e0: 20 65 76 65 72 79 20 65 6c 65 6d 65 6e 74 20 69 every element i
16f0: 73 0a 2b 20 2a 20 09 70 61 72 74 20 6f 66 20 61 s.+ * .part of a
1700: 6e 20 61 72 69 74 68 6d 65 74 69 63 20 73 65 71 n arithmetic seq
1710: 75 65 6e 63 65 20 73 74 61 72 74 69 6e 67 20 77 uence starting w
1720: 69 74 68 20 74 68 65 20 6e 75 6d 62 65 72 20 53 ith the number S
1730: 54 41 52 54 2c 0a 2b 20 2a 20 09 69 6e 63 72 65 TART,.+ * .incre
1740: 6d 65 6e 74 69 6e 67 20 74 68 65 20 6e 65 78 74 menting the next
1750: 20 65 6c 65 6d 65 6e 74 73 20 6f 66 20 53 54 45 elements of STE
1760: 50 2c 20 61 6e 64 20 69 6e 63 6c 75 64 69 6e 67 P, and including
1770: 0a 2b 20 2a 20 09 61 6c 6c 20 74 68 65 20 65 6c .+ * .all the el
1780: 65 6d 65 6e 74 73 20 3c 20 45 4e 44 20 28 6f 72 ements < END (or
1790: 20 3e 20 45 4e 44 20 66 6f 72 20 6e 65 67 61 74 > END for negat
17a0: 69 76 65 20 73 74 65 70 73 29 2e 0a 2b 20 2a 20 ive steps)..+ *
17b0: 09 54 68 65 20 63 6f 6d 6d 61 6e 64 20 72 65 74 .The command ret
17c0: 75 72 6e 73 20 61 20 73 70 65 63 69 61 6c 69 7a urns a specializ
17d0: 65 64 20 6f 62 6a 65 63 74 20 61 62 6c 65 20 74 ed object able t
17e0: 6f 20 72 65 70 72 65 73 65 6e 74 0a 2b 20 2a 20 o represent.+ *
17f0: 09 74 68 69 73 20 6c 69 73 74 73 20 69 6e 20 63 .this lists in c
1800: 6f 6e 73 74 61 6e 74 20 73 70 61 63 65 20 28 74 onstant space (t
1810: 68 65 20 41 72 69 74 68 6d 65 74 69 63 20 53 65 he Arithmetic Se
1820: 71 75 65 6e 63 65 20 6f 62 6a 65 63 74 20 74 79 quence object ty
1830: 70 65 29 2e 0a 2b 20 2a 20 09 53 65 65 20 54 63 pe)..+ * .See Tc
1840: 6c 5f 4c 69 73 74 4f 62 6a 2e 63 20 66 6f 72 20 l_ListObj.c for
1850: 6d 6f 72 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e more information
1860: 20 6f 6e 20 74 68 69 73 20 6f 62 6a 65 63 74 2e on this object.
1870: 0a 2b 20 2a 0a 2b 20 2a 20 52 65 73 75 6c 74 73 .+ *.+ * Results
1880: 3a 0a 2b 20 2a 09 41 20 73 74 61 6e 64 61 72 64 :.+ *.A standard
1890: 20 54 63 6c 20 72 65 73 75 6c 74 2e 0a 2b 20 2a Tcl result..+ *
18a0: 0a 2b 20 2a 20 53 69 64 65 20 65 66 66 65 63 74 .+ * Side effect
18b0: 73 3a 0a 2b 20 2a 09 53 65 65 20 74 68 65 20 75 s:.+ *.See the u
18c0: 73 65 72 20 64 6f 63 75 6d 65 6e 74 61 74 69 6f ser documentatio
18d0: 6e 2e 0a 2b 20 2a 0a 2b 20 2a 2d 2d 2d 2d 2d 2d n..+ *.+ *------
18e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
18f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
1900: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
1910: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
1920: 0a 2b 20 2a 2f 0a 2b 0a 2b 69 6e 74 0a 2b 54 63 .+ */.+.+int.+Tc
1930: 6c 5f 52 61 6e 67 65 4f 62 6a 43 6d 64 28 20 63 l_RangeObjCmd( c
1940: 6c 69 65 6e 74 44 61 74 61 2c 20 69 6e 74 65 72 lientData, inter
1950: 70 2c 20 6f 62 6a 63 2c 20 6f 62 6a 76 20 29 0a p, objc, objv ).
1960: 2b 20 20 20 20 43 6c 69 65 6e 74 44 61 74 61 20 + ClientData
1970: 63 6c 69 65 6e 74 44 61 74 61 3b 09 2f 2a 20 4e clientData;./* N
1980: 6f 74 20 75 73 65 64 2e 20 2a 2f 0a 2b 20 20 20 ot used. */.+
1990: 20 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 Tcl_Interp *int
19a0: 65 72 70 3b 09 09 2f 2a 20 43 75 72 72 65 6e 74 erp;../* Current
19b0: 20 69 6e 74 65 72 70 72 65 74 65 72 2e 20 2a 2f interpreter. */
19c0: 0a 2b 20 20 20 20 69 6e 74 20 6f 62 6a 63 3b 09 .+ int objc;.
19d0: 09 09 2f 2a 20 4e 75 6d 62 65 72 20 6f 66 20 61 ../* Number of a
19e0: 72 67 75 6d 65 6e 74 73 2e 20 2a 2f 0a 2b 20 20 rguments. */.+
19f0: 20 20 54 63 6c 5f 4f 62 6a 20 2a 43 4f 4e 53 54 Tcl_Obj *CONST
1a00: 20 6f 62 6a 76 5b 5d 3b 09 2f 2a 20 41 72 67 75 objv[];./* Argu
1a10: 6d 65 6e 74 20 76 61 6c 75 65 73 2e 20 2a 2f 0a ment values. */.
1a20: 2b 7b 0a 2b 20 20 20 20 54 63 6c 5f 57 69 64 65 +{.+ Tcl_Wide
1a30: 49 6e 74 20 73 74 61 72 74 20 3d 20 30 2c 20 65 Int start = 0, e
1a40: 6e 64 2c 20 73 74 65 70 20 3d 20 31 3b 0a 2b 20 nd, step = 1;.+
1a50: 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 61 72 69 74 Tcl_Obj *arit
1a60: 68 53 65 72 69 65 73 50 74 72 3b 0a 2b 0a 2b 20 hSeriesPtr;.+.+
1a70: 20 20 20 2f 2a 20 43 68 65 63 6b 20 70 61 72 61 /* Check para
1a80: 6d 65 74 65 72 20 63 6f 75 6e 74 20 2a 2f 0a 2b meter count */.+
1a90: 0a 2b 20 20 20 20 69 66 20 28 6f 62 6a 63 20 3c .+ if (objc <
1aa0: 20 32 20 7c 7c 20 6f 62 6a 63 20 3e 20 34 29 20 2 || objc > 4)
1ab0: 7b 0a 2b 09 54 63 6c 5f 57 72 6f 6e 67 4e 75 6d {.+.Tcl_WrongNum
1ac0: 41 72 67 73 28 69 6e 74 65 72 70 2c 20 31 2c 20 Args(interp, 1,
1ad0: 6f 62 6a 76 2c 20 22 3f 73 74 61 72 74 3f 20 65 objv, "?start? e
1ae0: 6e 64 20 3f 73 74 65 70 3f 22 29 3b 0a 2b 09 72 nd ?step?");.+.r
1af0: 65 74 75 72 6e 20 54 43 4c 5f 45 52 52 4f 52 3b eturn TCL_ERROR;
1b00: 0a 2b 20 20 20 20 7d 0a 2b 0a 2b 20 20 20 20 2f .+ }.+.+ /
1b10: 2a 20 47 65 74 20 74 68 65 20 73 74 61 72 74 2c * Get the start,
1b20: 20 65 6e 64 2c 20 73 74 65 70 20 70 61 72 61 6d end, step param
1b30: 65 74 65 72 73 20 66 72 6f 6d 20 61 72 67 75 6d eters from argum
1b40: 65 6e 74 73 20 2a 2f 0a 2b 20 20 20 20 69 66 20 ents */.+ if
1b50: 28 6f 62 6a 63 20 3d 3d 20 32 29 20 7b 0a 2b 09 (objc == 2) {.+.
1b60: 20 20 20 20 69 66 20 28 54 63 6c 5f 47 65 74 57 if (Tcl_GetW
1b70: 69 64 65 49 6e 74 46 72 6f 6d 4f 62 6a 28 69 6e ideIntFromObj(in
1b80: 74 65 72 70 2c 20 6f 62 6a 76 5b 31 5d 2c 20 26 terp, objv[1], &
1b90: 65 6e 64 29 20 21 3d 20 54 43 4c 5f 4f 4b 29 0a end) != TCL_OK).
1ba0: 2b 09 09 20 20 20 20 72 65 74 75 72 6e 20 54 43 +.. return TC
1bb0: 4c 5f 45 52 52 4f 52 3b 0a 2b 20 20 20 20 7d 20 L_ERROR;.+ }
1bc0: 65 6c 73 65 20 69 66 20 28 6f 62 6a 63 20 3e 3d else if (objc >=
1bd0: 20 33 29 20 7b 0a 2b 09 20 20 20 20 69 66 20 28 3) {.+. if (
1be0: 54 63 6c 5f 47 65 74 57 69 64 65 49 6e 74 46 72 Tcl_GetWideIntFr
1bf0: 6f 6d 4f 62 6a 28 69 6e 74 65 72 70 2c 20 6f 62 omObj(interp, ob
1c00: 6a 76 5b 31 5d 2c 20 26 73 74 61 72 74 29 20 21 jv[1], &start) !
1c10: 3d 20 54 43 4c 5f 4f 4b 20 7c 7c 0a 2b 09 09 54 = TCL_OK ||.+..T
1c20: 63 6c 5f 47 65 74 57 69 64 65 49 6e 74 46 72 6f cl_GetWideIntFro
1c30: 6d 4f 62 6a 28 69 6e 74 65 72 70 2c 20 6f 62 6a mObj(interp, obj
1c40: 76 5b 32 5d 2c 20 26 65 6e 64 29 20 21 3d 20 54 v[2], &end) != T
1c50: 43 4c 5f 4f 4b 29 0a 2b 09 09 20 20 20 20 72 65 CL_OK).+.. re
1c60: 74 75 72 6e 20 54 43 4c 5f 45 52 52 4f 52 3b 0a turn TCL_ERROR;.
1c70: 2b 09 20 20 20 20 69 66 20 28 6f 62 6a 63 20 3d +. if (objc =
1c80: 3d 20 34 20 26 26 0a 2b 09 09 54 63 6c 5f 47 65 = 4 &&.+..Tcl_Ge
1c90: 74 57 69 64 65 49 6e 74 46 72 6f 6d 4f 62 6a 28 tWideIntFromObj(
1ca0: 69 6e 74 65 72 70 2c 20 6f 62 6a 76 5b 33 5d 2c interp, objv[3],
1cb0: 20 26 73 74 65 70 29 20 21 3d 20 54 43 4c 5f 4f &step) != TCL_O
1cc0: 4b 29 0a 2b 09 09 20 20 20 20 72 65 74 75 72 6e K).+.. return
1cd0: 20 54 43 4c 5f 45 52 52 4f 52 3b 0a 2b 20 20 20 TCL_ERROR;.+
1ce0: 20 7d 0a 2b 0a 2b 20 20 20 20 2f 2a 20 43 72 65 }.+.+ /* Cre
1cf0: 61 74 65 20 74 68 65 20 61 72 69 74 68 6d 65 74 ate the arithmet
1d00: 69 63 20 73 65 72 69 65 73 20 6f 62 6a 65 63 74 ic series object
1d10: 2c 20 63 68 65 63 6b 69 6e 67 20 69 66 20 74 68 , checking if th
1d20: 65 0a 2b 20 20 20 20 20 2a 20 70 61 72 61 6d 65 e.+ * parame
1d30: 74 65 72 73 20 61 72 65 20 69 6e 76 61 6c 69 64 ters are invalid
1d40: 2e 20 2a 2f 0a 2b 0a 2b 20 20 20 20 61 72 69 74 . */.+.+ arit
1d50: 68 53 65 72 69 65 73 50 74 72 20 3d 20 54 63 6c hSeriesPtr = Tcl
1d60: 5f 4e 65 77 41 72 69 74 68 53 65 72 69 65 73 4f _NewArithSeriesO
1d70: 62 6a 28 73 74 61 72 74 2c 20 65 6e 64 2c 20 73 bj(start, end, s
1d80: 74 65 70 29 3b 0a 2b 20 20 20 20 69 66 20 28 61 tep);.+ if (a
1d90: 72 69 74 68 53 65 72 69 65 73 50 74 72 20 3d 3d rithSeriesPtr ==
1da0: 20 4e 55 4c 4c 29 20 7b 0a 2b 09 54 63 6c 5f 41 NULL) {.+.Tcl_A
1db0: 70 70 65 6e 64 52 65 73 75 6c 74 28 69 6e 74 65 ppendResult(inte
1dc0: 72 70 2c 0a 2b 09 09 22 49 6e 76 61 6c 69 64 20 rp,.+.."Invalid
1dd0: 28 69 6e 66 69 6e 69 74 65 3f 29 20 61 72 69 74 (infinite?) arit
1de0: 68 6d 65 74 69 63 20 73 65 71 75 65 6e 63 65 20 hmetic sequence
1df0: 73 70 65 63 69 66 69 65 64 22 2c 20 4e 55 4c 4c specified", NULL
1e00: 29 3b 0a 2b 09 72 65 74 75 72 6e 20 54 43 4c 5f );.+.return TCL_
1e10: 45 52 52 4f 52 3b 0a 2b 20 20 20 20 7d 0a 2b 0a ERROR;.+ }.+.
1e20: 2b 20 20 20 20 54 63 6c 5f 49 6e 63 72 52 65 66 + Tcl_IncrRef
1e30: 43 6f 75 6e 74 28 61 72 69 74 68 53 65 72 69 65 Count(arithSerie
1e40: 73 50 74 72 29 3b 20 2f 2a 20 77 65 20 6d 61 79 sPtr); /* we may
1e50: 20 75 73 65 20 44 65 63 72 52 65 66 43 6f 75 6e use DecrRefCoun
1e60: 74 20 74 6f 20 66 72 65 65 20 69 74 20 2a 2f 0a t to free it */.
1e70: 2b 20 20 20 20 69 66 20 28 54 63 6c 5f 41 72 69 + if (Tcl_Ari
1e80: 74 68 53 65 72 69 65 73 4f 62 6a 4c 65 6e 67 74 thSeriesObjLengt
1e90: 68 28 61 72 69 74 68 53 65 72 69 65 73 50 74 72 h(arithSeriesPtr
1ea0: 29 20 3e 20 49 4e 54 5f 4d 41 58 2f 73 69 7a 65 ) > INT_MAX/size
1eb0: 6f 66 28 54 63 6c 5f 4f 62 6a 20 2a 29 29 20 7b of(Tcl_Obj *)) {
1ec0: 0a 2b 09 54 63 6c 5f 44 65 63 72 52 65 66 43 6f .+.Tcl_DecrRefCo
1ed0: 75 6e 74 28 61 72 69 74 68 53 65 72 69 65 73 50 unt(arithSeriesP
1ee0: 74 72 29 3b 0a 2b 09 54 63 6c 5f 41 70 70 65 6e tr);.+.Tcl_Appen
1ef0: 64 52 65 73 75 6c 74 28 69 6e 74 65 72 70 2c 20 dResult(interp,
1f00: 22 6f 76 65 72 66 6c 6f 77 20 6f 66 20 6d 61 78 "overflow of max
1f10: 69 6d 75 6d 20 6c 69 73 74 20 6c 65 6e 67 74 68 imum list length
1f20: 22 2c 20 4e 55 4c 4c 29 3b 0a 2b 09 72 65 74 75 ", NULL);.+.retu
1f30: 72 6e 20 54 43 4c 5f 45 52 52 4f 52 3b 0a 2b 20 rn TCL_ERROR;.+
1f40: 20 20 20 7d 0a 2b 0a 2b 20 20 20 20 2f 2a 20 52 }.+.+ /* R
1f50: 65 74 75 72 6e 20 74 68 65 20 6e 65 77 20 6f 62 eturn the new ob
1f60: 6a 65 63 74 2e 20 2a 2f 0a 2b 0a 2b 20 20 20 20 ject. */.+.+
1f70: 54 63 6c 5f 53 65 74 4f 62 6a 52 65 73 75 6c 74 Tcl_SetObjResult
1f80: 28 69 6e 74 65 72 70 2c 20 61 72 69 74 68 53 65 (interp, arithSe
1f90: 72 69 65 73 50 74 72 29 3b 0a 2b 20 20 20 20 54 riesPtr);.+ T
1fa0: 63 6c 5f 44 65 63 72 52 65 66 43 6f 75 6e 74 28 cl_DecrRefCount(
1fb0: 61 72 69 74 68 53 65 72 69 65 73 50 74 72 29 3b arithSeriesPtr);
1fc0: 0a 2b 20 20 20 20 72 65 74 75 72 6e 20 54 43 4c .+ return TCL
1fd0: 5f 4f 4b 3b 0a 2b 7d 0a 2b 0a 20 2f 2a 0a 20 20 _OK;.+}.+. /*.
1fe0: 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d *---------------
1ff0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
2000: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
2010: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
2020: 2d 2d 2d 2d 2d 2d 2d 0a 20 20 2a 0a 49 6e 64 65 -------. *.Inde
2030: 78 3a 20 67 65 6e 65 72 69 63 2f 74 63 6c 44 65 x: generic/tclDe
2040: 63 6c 73 2e 68 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d cls.h.==========
2050: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
2060: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
2070: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
2080: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 52 43 53 20 66 69 =========.RCS fi
2090: 6c 65 3a 20 2f 63 76 73 72 6f 6f 74 2f 74 63 6c le: /cvsroot/tcl
20a0: 2f 74 63 6c 2f 67 65 6e 65 72 69 63 2f 74 63 6c /tcl/generic/tcl
20b0: 44 65 63 6c 73 2e 68 2c 76 0a 72 65 74 72 69 65 Decls.h,v.retrie
20c0: 76 69 6e 67 20 72 65 76 69 73 69 6f 6e 20 31 2e ving revision 1.
20d0: 31 30 35 0a 64 69 66 66 20 2d 75 20 2d 72 31 2e 105.diff -u -r1.
20e0: 31 30 35 20 74 63 6c 44 65 63 6c 73 2e 68 0a 2d 105 tclDecls.h.-
20f0: 2d 2d 20 67 65 6e 65 72 69 63 2f 74 63 6c 44 65 -- generic/tclDe
2100: 63 6c 73 2e 68 09 37 20 4a 75 6e 20 32 30 30 34 cls.h.7 Jun 2004
2110: 20 31 36 3a 34 38 3a 34 34 20 2d 30 30 30 30 09 16:48:44 -0000.
2120: 31 2e 31 30 35 0a 2b 2b 2b 20 67 65 6e 65 72 69 1.105.+++ generi
2130: 63 2f 74 63 6c 44 65 63 6c 73 2e 68 09 32 35 20 c/tclDecls.h.25
2140: 4f 63 74 20 32 30 30 34 20 32 31 3a 35 32 3a 34 Oct 2004 21:52:4
2150: 38 20 2d 30 30 30 30 0a 40 40 20 2d 33 33 31 34 8 -0000.@@ -3314
2160: 2c 36 20 2b 33 33 31 34 2c 32 35 20 40 40 0a 20 ,6 +3314,25 @@.
2170: 45 58 54 45 52 4e 20 69 6e 74 09 09 54 63 6c 5f EXTERN int..Tcl_
2180: 4c 69 6d 69 74 47 65 74 47 72 61 6e 75 6c 61 72 LimitGetGranular
2190: 69 74 79 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 ity _ANSI_ARGS_(
21a0: 28 0a 20 09 09 09 09 54 63 6c 5f 49 6e 74 65 72 (. ....Tcl_Inter
21b0: 70 20 2a 20 69 6e 74 65 72 70 2c 20 69 6e 74 20 p * interp, int
21c0: 74 79 70 65 29 29 3b 0a 20 23 65 6e 64 69 66 0a type));. #endif.
21d0: 2b 23 69 66 6e 64 65 66 20 54 63 6c 5f 4e 65 77 +#ifndef Tcl_New
21e0: 41 72 69 74 68 53 65 72 69 65 73 4f 62 6a 5f 54 ArithSeriesObj_T
21f0: 43 4c 5f 44 45 43 4c 41 52 45 44 0a 2b 23 64 65 CL_DECLARED.+#de
2200: 66 69 6e 65 20 54 63 6c 5f 4e 65 77 41 72 69 74 fine Tcl_NewArit
2210: 68 53 65 72 69 65 73 4f 62 6a 5f 54 43 4c 5f 44 hSeriesObj_TCL_D
2220: 45 43 4c 41 52 45 44 0a 2b 2f 2a 20 35 33 35 20 ECLARED.+/* 535
2230: 2a 2f 0a 2b 45 58 54 45 52 4e 20 54 63 6c 5f 4f */.+EXTERN Tcl_O
2240: 62 6a 20 2a 09 54 63 6c 5f 4e 65 77 41 72 69 74 bj *.Tcl_NewArit
2250: 68 53 65 72 69 65 73 4f 62 6a 20 5f 41 4e 53 49 hSeriesObj _ANSI
2260: 5f 41 52 47 53 5f 28 28 54 63 6c 5f 57 69 64 65 _ARGS_((Tcl_Wide
2270: 49 6e 74 20 73 74 61 72 74 2c 20 0a 2b 09 09 09 Int start, .+...
2280: 09 54 63 6c 5f 57 69 64 65 49 6e 74 20 65 6e 64 .Tcl_WideInt end
2290: 2c 20 54 63 6c 5f 57 69 64 65 49 6e 74 20 73 74 , Tcl_WideInt st
22a0: 65 70 29 29 3b 0a 2b 23 65 6e 64 69 66 0a 2b 23 ep));.+#endif.+#
22b0: 69 66 6e 64 65 66 20 54 63 6c 5f 41 72 69 74 68 ifndef Tcl_Arith
22c0: 53 65 72 69 65 73 4f 62 6a 49 6e 64 65 78 5f 54 SeriesObjIndex_T
22d0: 43 4c 5f 44 45 43 4c 41 52 45 44 0a 2b 23 64 65 CL_DECLARED.+#de
22e0: 66 69 6e 65 20 54 63 6c 5f 41 72 69 74 68 53 65 fine Tcl_ArithSe
22f0: 72 69 65 73 4f 62 6a 49 6e 64 65 78 5f 54 43 4c riesObjIndex_TCL
2300: 5f 44 45 43 4c 41 52 45 44 0a 2b 2f 2a 20 35 33 _DECLARED.+/* 53
2310: 36 20 2a 2f 0a 2b 45 58 54 45 52 4e 20 69 6e 74 6 */.+EXTERN int
2320: 09 09 54 63 6c 5f 41 72 69 74 68 53 65 72 69 65 ..Tcl_ArithSerie
2330: 73 4f 62 6a 49 6e 64 65 78 20 5f 41 4e 53 49 5f sObjIndex _ANSI_
2340: 41 52 47 53 5f 28 28 0a 2b 09 09 09 09 54 63 6c ARGS_((.+....Tcl
2350: 5f 4f 62 6a 20 2a 20 61 72 69 74 68 53 65 72 69 _Obj * arithSeri
2360: 65 73 50 74 72 2c 20 69 6e 74 20 69 6e 64 65 78 esPtr, int index
2370: 2c 20 0a 2b 09 09 09 09 54 63 6c 5f 57 69 64 65 , .+....Tcl_Wide
2380: 49 6e 74 20 2a 20 65 6c 65 6d 65 6e 74 29 29 3b Int * element));
2390: 0a 2b 23 65 6e 64 69 66 0a 2b 23 69 66 6e 64 65 .+#endif.+#ifnde
23a0: 66 20 54 63 6c 5f 41 72 69 74 68 53 65 72 69 65 f Tcl_ArithSerie
23b0: 73 4f 62 6a 4c 65 6e 67 74 68 5f 54 43 4c 5f 44 sObjLength_TCL_D
23c0: 45 43 4c 41 52 45 44 0a 2b 23 64 65 66 69 6e 65 ECLARED.+#define
23d0: 20 54 63 6c 5f 41 72 69 74 68 53 65 72 69 65 73 Tcl_ArithSeries
23e0: 4f 62 6a 4c 65 6e 67 74 68 5f 54 43 4c 5f 44 45 ObjLength_TCL_DE
23f0: 43 4c 41 52 45 44 0a 2b 2f 2a 20 35 33 37 20 2a CLARED.+/* 537 *
2400: 2f 0a 2b 45 58 54 45 52 4e 20 69 6e 74 09 09 54 /.+EXTERN int..T
2410: 63 6c 5f 41 72 69 74 68 53 65 72 69 65 73 4f 62 cl_ArithSeriesOb
2420: 6a 4c 65 6e 67 74 68 20 5f 41 4e 53 49 5f 41 52 jLength _ANSI_AR
2430: 47 53 5f 28 28 0a 2b 09 09 09 09 54 63 6c 5f 4f GS_((.+....Tcl_O
2440: 62 6a 20 2a 20 61 72 69 74 68 53 65 72 69 65 73 bj * arithSeries
2450: 50 74 72 29 29 3b 0a 2b 23 65 6e 64 69 66 0a 20 Ptr));.+#endif.
2460: 0a 20 74 79 70 65 64 65 66 20 73 74 72 75 63 74 . typedef struct
2470: 20 54 63 6c 53 74 75 62 48 6f 6f 6b 73 20 7b 0a TclStubHooks {.
2480: 20 20 20 20 20 73 74 72 75 63 74 20 54 63 6c 50 struct TclP
2490: 6c 61 74 53 74 75 62 73 20 2a 74 63 6c 50 6c 61 latStubs *tclPla
24a0: 74 53 74 75 62 73 3b 0a 40 40 20 2d 33 38 39 30 tStubs;.@@ -3890
24b0: 2c 36 20 2b 33 39 30 39 2c 39 20 40 40 0a 20 20 ,6 +3909,9 @@.
24c0: 20 20 20 69 6e 74 20 28 2a 74 63 6c 5f 4c 69 6d int (*tcl_Lim
24d0: 69 74 47 65 74 43 6f 6d 6d 61 6e 64 73 29 20 5f itGetCommands) _
24e0: 41 4e 53 49 5f 41 52 47 53 5f 28 28 54 63 6c 5f ANSI_ARGS_((Tcl_
24f0: 49 6e 74 65 72 70 20 2a 20 69 6e 74 65 72 70 29 Interp * interp)
2500: 29 3b 20 2f 2a 20 35 33 32 20 2a 2f 0a 20 20 20 ); /* 532 */.
2510: 20 20 76 6f 69 64 20 28 2a 74 63 6c 5f 4c 69 6d void (*tcl_Lim
2520: 69 74 47 65 74 54 69 6d 65 29 20 5f 41 4e 53 49 itGetTime) _ANSI
2530: 5f 41 52 47 53 5f 28 28 54 63 6c 5f 49 6e 74 65 _ARGS_((Tcl_Inte
2540: 72 70 20 2a 20 69 6e 74 65 72 70 2c 20 54 63 6c rp * interp, Tcl
2550: 5f 54 69 6d 65 20 2a 20 74 69 6d 65 4c 69 6d 69 _Time * timeLimi
2560: 74 50 74 72 29 29 3b 20 2f 2a 20 35 33 33 20 2a tPtr)); /* 533 *
2570: 2f 0a 20 20 20 20 20 69 6e 74 20 28 2a 74 63 6c /. int (*tcl
2580: 5f 4c 69 6d 69 74 47 65 74 47 72 61 6e 75 6c 61 _LimitGetGranula
2590: 72 69 74 79 29 20 5f 41 4e 53 49 5f 41 52 47 53 rity) _ANSI_ARGS
25a0: 5f 28 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a 20 _((Tcl_Interp *
25b0: 69 6e 74 65 72 70 2c 20 69 6e 74 20 74 79 70 65 interp, int type
25c0: 29 29 3b 20 2f 2a 20 35 33 34 20 2a 2f 0a 2b 20 )); /* 534 */.+
25d0: 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 20 28 2a 74 Tcl_Obj * (*t
25e0: 63 6c 5f 4e 65 77 41 72 69 74 68 53 65 72 69 65 cl_NewArithSerie
25f0: 73 4f 62 6a 29 20 5f 41 4e 53 49 5f 41 52 47 53 sObj) _ANSI_ARGS
2600: 5f 28 28 54 63 6c 5f 57 69 64 65 49 6e 74 20 73 _((Tcl_WideInt s
2610: 74 61 72 74 2c 20 54 63 6c 5f 57 69 64 65 49 6e tart, Tcl_WideIn
2620: 74 20 65 6e 64 2c 20 54 63 6c 5f 57 69 64 65 49 t end, Tcl_WideI
2630: 6e 74 20 73 74 65 70 29 29 3b 20 2f 2a 20 35 33 nt step)); /* 53
2640: 35 20 2a 2f 0a 2b 20 20 20 20 69 6e 74 20 28 2a 5 */.+ int (*
2650: 74 63 6c 5f 41 72 69 74 68 53 65 72 69 65 73 4f tcl_ArithSeriesO
2660: 62 6a 49 6e 64 65 78 29 20 5f 41 4e 53 49 5f 41 bjIndex) _ANSI_A
2670: 52 47 53 5f 28 28 54 63 6c 5f 4f 62 6a 20 2a 20 RGS_((Tcl_Obj *
2680: 61 72 69 74 68 53 65 72 69 65 73 50 74 72 2c 20 arithSeriesPtr,
2690: 69 6e 74 20 69 6e 64 65 78 2c 20 54 63 6c 5f 57 int index, Tcl_W
26a0: 69 64 65 49 6e 74 20 2a 20 65 6c 65 6d 65 6e 74 ideInt * element
26b0: 29 29 3b 20 2f 2a 20 35 33 36 20 2a 2f 0a 2b 20 )); /* 536 */.+
26c0: 20 20 20 69 6e 74 20 28 2a 74 63 6c 5f 41 72 69 int (*tcl_Ari
26d0: 74 68 53 65 72 69 65 73 4f 62 6a 4c 65 6e 67 74 thSeriesObjLengt
26e0: 68 29 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 h) _ANSI_ARGS_((
26f0: 54 63 6c 5f 4f 62 6a 20 2a 20 61 72 69 74 68 53 Tcl_Obj * arithS
2700: 65 72 69 65 73 50 74 72 29 29 3b 20 2f 2a 20 35 eriesPtr)); /* 5
2710: 33 37 20 2a 2f 0a 20 7d 20 54 63 6c 53 74 75 62 37 */. } TclStub
2720: 73 3b 0a 20 0a 20 23 69 66 64 65 66 20 5f 5f 63 s;. . #ifdef __c
2730: 70 6c 75 73 70 6c 75 73 0a 40 40 20 2d 36 30 37 plusplus.@@ -607
2740: 30 2c 36 20 2b 36 30 39 32 2c 31 38 20 40 40 0a 0,6 +6092,18 @@.
2750: 20 23 64 65 66 69 6e 65 20 54 63 6c 5f 4c 69 6d #define Tcl_Lim
2760: 69 74 47 65 74 47 72 61 6e 75 6c 61 72 69 74 79 itGetGranularity
2770: 20 5c 0a 20 09 28 74 63 6c 53 74 75 62 73 50 74 \. .(tclStubsPt
2780: 72 2d 3e 74 63 6c 5f 4c 69 6d 69 74 47 65 74 47 r->tcl_LimitGetG
2790: 72 61 6e 75 6c 61 72 69 74 79 29 20 2f 2a 20 35 ranularity) /* 5
27a0: 33 34 20 2a 2f 0a 20 23 65 6e 64 69 66 0a 2b 23 34 */. #endif.+#
27b0: 69 66 6e 64 65 66 20 54 63 6c 5f 4e 65 77 41 72 ifndef Tcl_NewAr
27c0: 69 74 68 53 65 72 69 65 73 4f 62 6a 0a 2b 23 64 ithSeriesObj.+#d
27d0: 65 66 69 6e 65 20 54 63 6c 5f 4e 65 77 41 72 69 efine Tcl_NewAri
27e0: 74 68 53 65 72 69 65 73 4f 62 6a 20 5c 0a 2b 09 thSeriesObj \.+.
27f0: 28 74 63 6c 53 74 75 62 73 50 74 72 2d 3e 74 63 (tclStubsPtr->tc
2800: 6c 5f 4e 65 77 41 72 69 74 68 53 65 72 69 65 73 l_NewArithSeries
2810: 4f 62 6a 29 20 2f 2a 20 35 33 35 20 2a 2f 0a 2b Obj) /* 535 */.+
2820: 23 65 6e 64 69 66 0a 2b 23 69 66 6e 64 65 66 20 #endif.+#ifndef
2830: 54 63 6c 5f 41 72 69 74 68 53 65 72 69 65 73 4f Tcl_ArithSeriesO
2840: 62 6a 49 6e 64 65 78 0a 2b 23 64 65 66 69 6e 65 bjIndex.+#define
2850: 20 54 63 6c 5f 41 72 69 74 68 53 65 72 69 65 73 Tcl_ArithSeries
2860: 4f 62 6a 49 6e 64 65 78 20 5c 0a 2b 09 28 74 63 ObjIndex \.+.(tc
2870: 6c 53 74 75 62 73 50 74 72 2d 3e 74 63 6c 5f 41 lStubsPtr->tcl_A
2880: 72 69 74 68 53 65 72 69 65 73 4f 62 6a 49 6e 64 rithSeriesObjInd
2890: 65 78 29 20 2f 2a 20 35 33 36 20 2a 2f 0a 2b 23 ex) /* 536 */.+#
28a0: 65 6e 64 69 66 0a 2b 23 69 66 6e 64 65 66 20 54 endif.+#ifndef T
28b0: 63 6c 5f 41 72 69 74 68 53 65 72 69 65 73 4f 62 cl_ArithSeriesOb
28c0: 6a 4c 65 6e 67 74 68 0a 2b 23 64 65 66 69 6e 65 jLength.+#define
28d0: 20 54 63 6c 5f 41 72 69 74 68 53 65 72 69 65 73 Tcl_ArithSeries
28e0: 4f 62 6a 4c 65 6e 67 74 68 20 5c 0a 2b 09 28 74 ObjLength \.+.(t
28f0: 63 6c 53 74 75 62 73 50 74 72 2d 3e 74 63 6c 5f clStubsPtr->tcl_
2900: 41 72 69 74 68 53 65 72 69 65 73 4f 62 6a 4c 65 ArithSeriesObjLe
2910: 6e 67 74 68 29 20 2f 2a 20 35 33 37 20 2a 2f 0a ngth) /* 537 */.
2920: 2b 23 65 6e 64 69 66 0a 20 0a 20 23 65 6e 64 69 +#endif. . #endi
2930: 66 20 2f 2a 20 64 65 66 69 6e 65 64 28 55 53 45 f /* defined(USE
2940: 5f 54 43 4c 5f 53 54 55 42 53 29 20 26 26 20 21 _TCL_STUBS) && !
2950: 64 65 66 69 6e 65 64 28 55 53 45 5f 54 43 4c 5f defined(USE_TCL_
2960: 53 54 55 42 5f 50 52 4f 43 53 29 20 2a 2f 0a 20 STUB_PROCS) */.
2970: 0a 49 6e 64 65 78 3a 20 67 65 6e 65 72 69 63 2f .Index: generic/
2980: 74 63 6c 45 78 65 63 75 74 65 2e 63 0a 3d 3d 3d tclExecute.c.===
2990: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
29a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
29b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
29c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
29d0: 0a 52 43 53 20 66 69 6c 65 3a 20 2f 63 76 73 72 .RCS file: /cvsr
29e0: 6f 6f 74 2f 74 63 6c 2f 74 63 6c 2f 67 65 6e 65 oot/tcl/tcl/gene
29f0: 72 69 63 2f 74 63 6c 45 78 65 63 75 74 65 2e 63 ric/tclExecute.c
2a00: 2c 76 0a 72 65 74 72 69 65 76 69 6e 67 20 72 65 ,v.retrieving re
2a10: 76 69 73 69 6f 6e 20 31 2e 31 36 31 0a 64 69 66 vision 1.161.dif
2a20: 66 20 2d 75 20 2d 72 31 2e 31 36 31 20 74 63 6c f -u -r1.161 tcl
2a30: 45 78 65 63 75 74 65 2e 63 0a 2d 2d 2d 20 67 65 Execute.c.--- ge
2a40: 6e 65 72 69 63 2f 74 63 6c 45 78 65 63 75 74 65 neric/tclExecute
2a50: 2e 63 09 32 35 20 4f 63 74 20 32 30 30 34 20 30 .c.25 Oct 2004 0
2a60: 31 3a 30 36 3a 34 39 20 2d 30 30 30 30 09 31 2e 1:06:49 -0000.1.
2a70: 31 36 31 0a 2b 2b 2b 20 67 65 6e 65 72 69 63 2f 161.+++ generic/
2a80: 74 63 6c 45 78 65 63 75 74 65 2e 63 09 32 35 20 tclExecute.c.25
2a90: 4f 63 74 20 32 30 30 34 20 32 31 3a 35 32 3a 35 Oct 2004 21:52:5
2aa0: 38 20 2d 30 30 30 30 0a 40 40 20 2d 32 36 30 30 8 -0000.@@ -2600
2ab0: 2c 31 33 20 2b 32 36 30 30 2c 31 37 20 40 40 0a ,13 +2600,17 @@.
2ac0: 20 09 20 20 20 20 0a 20 09 20 20 20 20 76 61 6c . . . val
2ad0: 75 65 50 74 72 20 3d 20 2a 74 6f 73 50 74 72 3b uePtr = *tosPtr;
2ae0: 0a 20 0a 2d 09 20 20 20 20 72 65 73 75 6c 74 20 . .-. result
2af0: 3d 20 54 63 6c 5f 4c 69 73 74 4f 62 6a 4c 65 6e = Tcl_ListObjLen
2b00: 67 74 68 28 69 6e 74 65 72 70 2c 20 76 61 6c 75 gth(interp, valu
2b10: 65 50 74 72 2c 20 26 6c 65 6e 67 74 68 29 3b 0a ePtr, &length);.
2b20: 2d 09 20 20 20 20 69 66 20 28 72 65 73 75 6c 74 -. if (result
2b30: 20 21 3d 20 54 43 4c 5f 4f 4b 29 20 7b 0a 2d 09 != TCL_OK) {.-.
2b40: 09 54 52 41 43 45 5f 57 49 54 48 5f 4f 42 4a 28 .TRACE_WITH_OBJ(
2b50: 28 22 25 2e 33 30 73 20 3d 3e 20 45 52 52 4f 52 ("%.30s => ERROR
2b60: 3a 20 22 2c 20 4f 32 53 28 76 61 6c 75 65 50 74 : ", O2S(valuePt
2b70: 72 29 29 2c 0a 2d 09 09 09 54 63 6c 5f 47 65 74 r)),.-...Tcl_Get
2b80: 4f 62 6a 52 65 73 75 6c 74 28 69 6e 74 65 72 70 ObjResult(interp
2b90: 29 29 3b 0a 2d 09 09 67 6f 74 6f 20 63 68 65 63 ));.-..goto chec
2ba0: 6b 46 6f 72 43 61 74 63 68 3b 0a 2b 09 20 20 20 kForCatch;.+.
2bb0: 20 69 66 20 28 76 61 6c 75 65 50 74 72 2d 3e 74 if (valuePtr->t
2bc0: 79 70 65 50 74 72 20 3d 3d 20 26 74 63 6c 41 72 ypePtr == &tclAr
2bd0: 69 74 68 53 65 72 69 65 73 54 79 70 65 29 20 7b ithSeriesType) {
2be0: 0a 2b 09 20 20 20 20 20 20 20 20 6f 62 6a 52 65 .+. objRe
2bf0: 73 75 6c 74 50 74 72 20 3d 20 54 63 6c 5f 4e 65 sultPtr = Tcl_Ne
2c00: 77 49 6e 74 4f 62 6a 28 54 63 6c 5f 41 72 69 74 wIntObj(Tcl_Arit
2c10: 68 53 65 72 69 65 73 4f 62 6a 4c 65 6e 67 74 68 hSeriesObjLength
2c20: 28 76 61 6c 75 65 50 74 72 29 29 3b 0a 2b 09 20 (valuePtr));.+.
2c30: 20 20 20 7d 20 65 6c 73 65 20 7b 0a 2b 09 20 20 } else {.+.
2c40: 20 20 20 20 20 20 72 65 73 75 6c 74 20 3d 20 54 result = T
2c50: 63 6c 5f 4c 69 73 74 4f 62 6a 4c 65 6e 67 74 68 cl_ListObjLength
2c60: 28 69 6e 74 65 72 70 2c 20 76 61 6c 75 65 50 74 (interp, valuePt
2c70: 72 2c 20 26 6c 65 6e 67 74 68 29 3b 0a 2b 09 20 r, &length);.+.
2c80: 20 20 20 20 20 20 20 69 66 20 28 72 65 73 75 6c if (resul
2c90: 74 20 21 3d 20 54 43 4c 5f 4f 4b 29 20 7b 0a 2b t != TCL_OK) {.+
2ca0: 09 09 20 20 20 20 54 52 41 43 45 5f 57 49 54 48 .. TRACE_WITH
2cb0: 5f 4f 42 4a 28 28 22 25 2e 33 30 73 20 3d 3e 20 _OBJ(("%.30s =>
2cc0: 45 52 52 4f 52 3a 20 22 2c 20 4f 32 53 28 76 61 ERROR: ", O2S(va
2cd0: 6c 75 65 50 74 72 29 29 2c 0a 2b 09 09 09 20 20 luePtr)),.+...
2ce0: 20 20 54 63 6c 5f 47 65 74 4f 62 6a 52 65 73 75 Tcl_GetObjResu
2cf0: 6c 74 28 69 6e 74 65 72 70 29 29 3b 0a 2b 09 09 lt(interp));.+..
2d00: 20 20 20 20 67 6f 74 6f 20 63 68 65 63 6b 46 6f goto checkFo
2d10: 72 43 61 74 63 68 3b 0a 2b 09 20 20 20 20 20 20 rCatch;.+.
2d20: 20 20 7d 0a 2b 09 20 20 20 20 20 20 20 20 6f 62 }.+. ob
2d30: 6a 52 65 73 75 6c 74 50 74 72 20 3d 20 54 63 6c jResultPtr = Tcl
2d40: 5f 4e 65 77 49 6e 74 4f 62 6a 28 6c 65 6e 67 74 _NewIntObj(lengt
2d50: 68 29 3b 0a 20 09 20 20 20 20 7d 0a 2d 09 20 20 h);. . }.-.
2d60: 20 20 6f 62 6a 52 65 73 75 6c 74 50 74 72 20 3d objResultPtr =
2d70: 20 54 63 6c 5f 4e 65 77 49 6e 74 4f 62 6a 28 6c Tcl_NewIntObj(l
2d80: 65 6e 67 74 68 29 3b 0a 20 09 20 20 20 20 54 52 ength);. . TR
2d90: 41 43 45 28 28 22 25 2e 32 30 73 20 3d 3e 20 25 ACE(("%.20s => %
2da0: 64 5c 6e 22 2c 20 4f 32 53 28 76 61 6c 75 65 50 d\n", O2S(valueP
2db0: 74 72 29 2c 20 6c 65 6e 67 74 68 29 29 3b 0a 20 tr), length));.
2dc0: 09 20 20 20 20 4e 45 58 54 5f 49 4e 53 54 5f 46 . NEXT_INST_F
2dd0: 28 31 2c 20 31 2c 20 31 29 3b 0a 20 09 7d 0a 40 (1, 1, 1);. .}.@
2de0: 40 20 2d 32 36 34 39 2c 36 20 2b 32 36 35 33 2c @ -2649,6 +2653,
2df0: 37 20 40 40 0a 20 09 69 6e 74 20 6c 69 73 74 63 7 @@. .int listc
2e00: 2c 20 69 64 78 2c 20 6f 70 6e 64 3b 0a 20 09 54 , idx, opnd;. .T
2e10: 63 6c 5f 4f 62 6a 20 2a 2a 6c 69 73 74 76 3b 0a cl_Obj **listv;.
2e20: 20 09 54 63 6c 5f 4f 62 6a 20 2a 76 61 6c 75 65 .Tcl_Obj *value
2e30: 50 74 72 3b 0a 2b 09 41 72 69 74 68 53 65 72 69 Ptr;.+.ArithSeri
2e40: 65 73 20 2a 61 72 69 74 68 53 65 72 69 65 73 52 es *arithSeriesR
2e50: 65 70 50 74 72 20 3d 20 4e 55 4c 4c 3b 0a 20 09 epPtr = NULL;. .
2e60: 0a 20 09 2f 2a 0a 20 09 20 2a 20 50 6f 70 20 74 . ./*. . * Pop t
2e70: 68 65 20 6c 69 73 74 20 61 6e 64 20 67 65 74 20 he list and get
2e80: 74 68 65 20 69 6e 64 65 78 0a 40 40 20 2d 32 36 the index.@@ -26
2e90: 35 38 2c 31 33 20 2b 32 36 36 33 2c 32 30 20 40 58,13 +2663,20 @
2ea0: 40 0a 20 0a 20 09 2f 2a 0a 20 09 20 2a 20 47 65 @. . ./*. . * Ge
2eb0: 74 20 74 68 65 20 63 6f 6e 74 65 6e 74 73 20 6f t the contents o
2ec0: 66 20 74 68 65 20 6c 69 73 74 2c 20 6d 61 6b 69 f the list, maki
2ed0: 6e 67 20 73 75 72 65 20 74 68 61 74 20 69 74 0a ng sure that it.
2ee0: 2d 09 20 2a 20 72 65 61 6c 6c 79 20 69 73 20 61 -. * really is a
2ef0: 20 6c 69 73 74 20 69 6e 20 74 68 65 20 70 72 6f list in the pro
2f00: 63 65 73 73 2e 0a 2b 09 20 2a 20 72 65 61 6c 6c cess..+. * reall
2f10: 79 20 69 73 20 61 20 6c 69 73 74 20 69 6e 20 74 y is a list in t
2f20: 68 65 20 70 72 6f 63 65 73 73 2e 20 53 70 65 63 he process. Spec
2f30: 69 61 6c 20 63 61 73 65 20 66 6f 72 20 61 72 69 ial case for ari
2f40: 74 68 6d 65 74 69 63 0a 2b 09 20 2a 20 73 65 72 thmetic.+. * ser
2f50: 69 65 73 2e 0a 20 09 20 2a 2f 0a 2d 09 72 65 73 ies.. . */.-.res
2f60: 75 6c 74 20 3d 20 54 63 6c 5f 4c 69 73 74 4f 62 ult = Tcl_ListOb
2f70: 6a 47 65 74 45 6c 65 6d 65 6e 74 73 28 69 6e 74 jGetElements(int
2f80: 65 72 70 2c 20 76 61 6c 75 65 50 74 72 2c 20 26 erp, valuePtr, &
2f90: 6c 69 73 74 63 2c 20 26 6c 69 73 74 76 29 3b 0a listc, &listv);.
2fa0: 2d 09 69 66 20 28 72 65 73 75 6c 74 20 21 3d 20 -.if (result !=
2fb0: 54 43 4c 5f 4f 4b 29 20 7b 0a 2d 09 20 20 20 20 TCL_OK) {.-.
2fc0: 54 52 41 43 45 5f 57 49 54 48 5f 4f 42 4a 28 28 TRACE_WITH_OBJ((
2fd0: 22 5c 22 25 2e 33 30 73 5c 22 20 25 64 20 3d 3e "\"%.30s\" %d =>
2fe0: 20 45 52 52 4f 52 3a 20 22 2c 20 4f 32 53 28 76 ERROR: ", O2S(v
2ff0: 61 6c 75 65 50 74 72 29 2c 20 6f 70 6e 64 29 2c aluePtr), opnd),
3000: 0a 2d 09 09 20 20 20 20 54 63 6c 5f 47 65 74 4f .-.. Tcl_GetO
3010: 62 6a 52 65 73 75 6c 74 28 69 6e 74 65 72 70 29 bjResult(interp)
3020: 29 3b 0a 2d 09 20 20 20 20 67 6f 74 6f 20 63 68 );.-. goto ch
3030: 65 63 6b 46 6f 72 43 61 74 63 68 3b 0a 2b 09 69 eckForCatch;.+.i
3040: 66 20 28 76 61 6c 75 65 50 74 72 2d 3e 74 79 70 f (valuePtr->typ
3050: 65 50 74 72 20 3d 3d 20 26 74 63 6c 41 72 69 74 ePtr == &tclArit
3060: 68 53 65 72 69 65 73 54 79 70 65 29 20 7b 0a 2b hSeriesType) {.+
3070: 09 09 61 72 69 74 68 53 65 72 69 65 73 52 65 70 ..arithSeriesRep
3080: 50 74 72 20 3d 20 28 41 72 69 74 68 53 65 72 69 Ptr = (ArithSeri
3090: 65 73 2a 29 0a 2b 09 09 09 76 61 6c 75 65 50 74 es*).+...valuePt
30a0: 72 2d 3e 69 6e 74 65 72 6e 61 6c 52 65 70 2e 74 r->internalRep.t
30b0: 77 6f 50 74 72 56 61 6c 75 65 2e 70 74 72 31 3b woPtrValue.ptr1;
30c0: 0a 2b 09 09 6c 69 73 74 63 20 3d 20 61 72 69 74 .+..listc = arit
30d0: 68 53 65 72 69 65 73 52 65 70 50 74 72 2d 3e 6c hSeriesRepPtr->l
30e0: 65 6e 3b 0a 2b 09 7d 20 65 6c 73 65 20 7b 0a 2b en;.+.} else {.+
30f0: 09 20 20 20 20 72 65 73 75 6c 74 20 3d 20 54 63 . result = Tc
3100: 6c 5f 4c 69 73 74 4f 62 6a 47 65 74 45 6c 65 6d l_ListObjGetElem
3110: 65 6e 74 73 28 69 6e 74 65 72 70 2c 20 76 61 6c ents(interp, val
3120: 75 65 50 74 72 2c 20 26 6c 69 73 74 63 2c 20 26 uePtr, &listc, &
3130: 6c 69 73 74 76 29 3b 0a 2b 20 20 20 20 20 20 20 listv);.+
3140: 20 20 20 20 20 69 66 20 28 72 65 73 75 6c 74 20 if (result
3150: 21 3d 20 54 43 4c 5f 4f 4b 29 20 7b 0a 2b 09 09 != TCL_OK) {.+..
3160: 54 52 41 43 45 5f 57 49 54 48 5f 4f 42 4a 28 28 TRACE_WITH_OBJ((
3170: 22 5c 22 25 2e 33 30 73 5c 22 20 25 64 20 3d 3e "\"%.30s\" %d =>
3180: 20 45 52 52 4f 52 3a 20 22 2c 20 4f 32 53 28 76 ERROR: ", O2S(v
3190: 61 6c 75 65 50 74 72 29 2c 20 6f 70 6e 64 29 2c aluePtr), opnd),
31a0: 0a 2b 09 09 09 54 63 6c 5f 47 65 74 4f 62 6a 52 .+...Tcl_GetObjR
31b0: 65 73 75 6c 74 28 69 6e 74 65 72 70 29 29 3b 0a esult(interp));.
31c0: 2b 09 09 67 6f 74 6f 20 63 68 65 63 6b 46 6f 72 +..goto checkFor
31d0: 43 61 74 63 68 3b 0a 2b 09 20 20 20 20 7d 0a 20 Catch;.+. }.
31e0: 09 7d 0a 20 0a 20 09 2f 2a 0a 40 40 20 2d 34 35 .}. . ./*.@@ -45
31f0: 35 32 2c 36 20 2b 34 35 36 34 2c 37 20 40 40 0a 52,6 +4564,7 @@.
3200: 20 09 20 20 20 20 69 6e 74 20 6e 75 6d 4c 69 73 . int numLis
3210: 74 73 3b 0a 20 09 20 20 20 20 54 63 6c 5f 4f 62 ts;. . Tcl_Ob
3220: 6a 20 2a 6c 69 73 74 50 74 72 2c 2a 76 61 6c 75 j *listPtr,*valu
3230: 65 50 74 72 2c 20 2a 76 61 6c 75 65 32 50 74 72 ePtr, *value2Ptr
3240: 3b 0a 20 09 20 20 20 20 4c 69 73 74 20 2a 6c 69 ;. . List *li
3250: 73 74 52 65 70 50 74 72 3b 0a 2b 09 20 20 20 20 stRepPtr;.+.
3260: 41 72 69 74 68 53 65 72 69 65 73 20 2a 61 72 69 ArithSeries *ari
3270: 74 68 53 65 72 69 65 73 52 65 70 50 74 72 3b 0a thSeriesRepPtr;.
3280: 20 09 20 20 20 20 56 61 72 20 2a 69 74 65 72 56 . Var *iterV
3290: 61 72 50 74 72 2c 20 2a 6c 69 73 74 56 61 72 50 arPtr, *listVarP
32a0: 74 72 3b 0a 20 09 20 20 20 20 69 6e 74 20 69 74 tr;. . int it
32b0: 65 72 4e 75 6d 2c 20 6c 69 73 74 54 6d 70 49 6e erNum, listTmpIn
32c0: 64 65 78 2c 20 6c 69 73 74 4c 65 6e 2c 20 6e 75 dex, listLen, nu
32d0: 6d 56 61 72 73 3b 0a 20 09 20 20 20 20 69 6e 74 mVars;. . int
32e0: 20 76 61 72 49 6e 64 65 78 2c 20 76 61 6c 49 6e varIndex, valIn
32f0: 64 65 78 2c 20 63 6f 6e 74 69 6e 75 65 4c 6f 6f dex, continueLoo
3300: 70 2c 20 6a 3b 0a 40 40 20 2d 34 35 38 36 2c 37 p, j;.@@ -4586,7
3310: 20 2b 34 35 39 39 2c 31 32 20 40 40 0a 20 09 09 +4599,12 @@. ..
3320: 20 20 20 20 0a 20 09 09 6c 69 73 74 56 61 72 50 . ..listVarP
3330: 74 72 20 3d 20 26 28 63 6f 6d 70 69 6c 65 64 4c tr = &(compiledL
3340: 6f 63 61 6c 73 5b 6c 69 73 74 54 6d 70 49 6e 64 ocals[listTmpInd
3350: 65 78 5d 29 3b 0a 20 09 09 6c 69 73 74 50 74 72 ex]);. ..listPtr
3360: 20 3d 20 6c 69 73 74 56 61 72 50 74 72 2d 3e 76 = listVarPtr->v
3370: 61 6c 75 65 2e 6f 62 6a 50 74 72 3b 0a 2d 09 09 alue.objPtr;.-..
3380: 72 65 73 75 6c 74 20 3d 20 54 63 6c 5f 4c 69 73 result = Tcl_Lis
3390: 74 4f 62 6a 4c 65 6e 67 74 68 28 69 6e 74 65 72 tObjLength(inter
33a0: 70 2c 20 6c 69 73 74 50 74 72 2c 20 26 6c 69 73 p, listPtr, &lis
33b0: 74 4c 65 6e 29 3b 0a 2b 09 09 69 66 20 28 6c 69 tLen);.+..if (li
33c0: 73 74 50 74 72 2d 3e 74 79 70 65 50 74 72 20 3d stPtr->typePtr =
33d0: 3d 20 26 74 63 6c 41 72 69 74 68 53 65 72 69 65 = &tclArithSerie
33e0: 73 54 79 70 65 29 20 7b 0a 2b 09 09 09 6c 69 73 sType) {.+...lis
33f0: 74 4c 65 6e 20 3d 20 54 63 6c 5f 41 72 69 74 68 tLen = Tcl_Arith
3400: 53 65 72 69 65 73 4f 62 6a 4c 65 6e 67 74 68 28 SeriesObjLength(
3410: 6c 69 73 74 50 74 72 29 3b 0a 2b 09 09 09 72 65 listPtr);.+...re
3420: 73 75 6c 74 20 3d 20 54 43 4c 5f 4f 4b 3b 20 2f sult = TCL_OK; /
3430: 2a 20 54 63 6c 5f 41 72 69 74 68 53 65 72 69 65 * Tcl_ArithSerie
3440: 73 4c 65 6e 67 74 68 20 63 61 6e 27 74 20 66 61 sLength can't fa
3450: 69 6c 20 2a 2f 0a 2b 09 09 7d 20 65 6c 73 65 20 il */.+..} else
3460: 7b 0a 2b 09 09 09 72 65 73 75 6c 74 20 3d 20 54 {.+...result = T
3470: 63 6c 5f 4c 69 73 74 4f 62 6a 4c 65 6e 67 74 68 cl_ListObjLength
3480: 28 69 6e 74 65 72 70 2c 20 6c 69 73 74 50 74 72 (interp, listPtr
3490: 2c 20 26 6c 69 73 74 4c 65 6e 29 3b 0a 2b 09 09 , &listLen);.+..
34a0: 7d 0a 20 09 09 69 66 20 28 72 65 73 75 6c 74 20 }. ..if (result
34b0: 21 3d 20 54 43 4c 5f 4f 4b 29 20 7b 0a 20 09 09 != TCL_OK) {. ..
34c0: 20 20 20 20 54 52 41 43 45 5f 57 49 54 48 5f 4f TRACE_WITH_O
34d0: 42 4a 28 28 22 25 75 20 3d 3e 20 45 52 52 4f 52 BJ(("%u => ERROR
34e0: 20 63 6f 6e 76 65 72 74 69 6e 67 20 6c 69 73 74 converting list
34f0: 20 25 6c 64 2c 20 5c 22 25 73 5c 22 3a 20 22 2c %ld, \"%s\": ",
3500: 0a 20 09 09 20 20 20 20 20 20 20 20 20 20 20 20 . ..
3510: 6f 70 6e 64 2c 20 69 2c 20 4f 32 53 28 6c 69 73 opnd, i, O2S(lis
3520: 74 50 74 72 29 29 2c 20 54 63 6c 5f 47 65 74 4f tPtr)), Tcl_GetO
3530: 62 6a 52 65 73 75 6c 74 28 69 6e 74 65 72 70 29 bjResult(interp)
3540: 29 3b 0a 40 40 20 2d 34 36 30 32 2c 37 20 2b 34 );.@@ -4602,7 +4
3550: 36 32 30 2c 37 20 40 40 0a 20 09 20 20 20 20 20 620,7 @@. .
3560: 2a 20 49 66 20 73 6f 6d 65 20 76 61 72 20 69 6e * If some var in
3570: 20 73 6f 6d 65 20 76 61 72 20 6c 69 73 74 20 73 some var list s
3580: 74 69 6c 6c 20 68 61 73 20 61 20 72 65 6d 61 69 till has a remai
3590: 6e 69 6e 67 20 6c 69 73 74 0a 20 09 20 20 20 20 ning list. .
35a0: 20 2a 20 65 6c 65 6d 65 6e 74 20 69 74 65 72 61 * element itera
35b0: 74 65 20 6f 6e 65 20 6d 6f 72 65 20 74 69 6d 65 te one more time
35c0: 2e 20 41 73 73 69 67 6e 20 74 6f 20 76 61 72 20 . Assign to var
35d0: 74 68 65 20 6e 65 78 74 0a 20 09 20 20 20 20 20 the next. .
35e0: 2a 20 65 6c 65 6d 65 6e 74 20 66 72 6f 6d 20 69 * element from i
35f0: 74 73 20 76 61 6c 75 65 20 6c 69 73 74 2e 20 57 ts value list. W
3600: 65 20 61 6c 72 65 61 64 79 20 63 68 65 63 6b 65 e already checke
3610: 64 20 61 62 6f 76 65 0a 2d 09 20 20 20 20 20 2a d above.-. *
3620: 20 74 68 61 74 20 65 61 63 68 20 6c 69 73 74 20 that each list
3630: 74 65 6d 70 20 68 6f 6c 64 73 20 61 20 76 61 6c temp holds a val
3640: 69 64 20 6c 69 73 74 20 6f 62 6a 65 63 74 2e 0a id list object..
3650: 2b 09 20 20 20 20 20 2a 20 74 68 61 74 20 65 61 +. * that ea
3660: 63 68 20 6c 69 73 74 20 74 65 6d 70 20 68 6f 6c ch list temp hol
3670: 64 73 20 61 20 76 61 6c 69 64 20 6c 69 73 74 20 ds a valid list
3680: 6f 72 20 72 61 6e 67 65 20 6f 62 6a 65 63 74 2e or range object.
3690: 0a 20 09 20 20 20 20 20 2a 2f 0a 20 09 09 0a 20 . . */. ...
36a0: 09 20 20 20 20 69 66 20 28 63 6f 6e 74 69 6e 75 . if (continu
36b0: 65 4c 6f 6f 70 29 20 7b 0a 40 40 20 2d 34 36 31 eLoop) {.@@ -461
36c0: 34 2c 32 34 20 2b 34 36 33 32 2c 35 35 20 40 40 4,24 +4632,55 @@
36d0: 0a 20 09 09 20 20 20 20 6c 69 73 74 56 61 72 50 . .. listVarP
36e0: 74 72 20 3d 20 26 28 63 6f 6d 70 69 6c 65 64 4c tr = &(compiledL
36f0: 6f 63 61 6c 73 5b 6c 69 73 74 54 6d 70 49 6e 64 ocals[listTmpInd
3700: 65 78 5d 29 3b 0a 20 09 09 20 20 20 20 6c 69 73 ex]);. .. lis
3710: 74 50 74 72 20 3d 20 6c 69 73 74 56 61 72 50 74 tPtr = listVarPt
3720: 72 2d 3e 76 61 6c 75 65 2e 6f 62 6a 50 74 72 3b r->value.objPtr;
3730: 0a 20 09 09 20 20 20 20 6c 69 73 74 52 65 70 50 . .. listRepP
3740: 74 72 20 3d 20 28 4c 69 73 74 20 2a 29 20 6c 69 tr = (List *) li
3750: 73 74 50 74 72 2d 3e 69 6e 74 65 72 6e 61 6c 52 stPtr->internalR
3760: 65 70 2e 74 77 6f 50 74 72 56 61 6c 75 65 2e 70 ep.twoPtrValue.p
3770: 74 72 31 3b 0a 2d 09 09 20 20 20 20 6c 69 73 74 tr1;.-.. list
3780: 4c 65 6e 20 3d 20 6c 69 73 74 52 65 70 50 74 72 Len = listRepPtr
3790: 2d 3e 65 6c 65 6d 43 6f 75 6e 74 3b 0a 2b 09 09 ->elemCount;.+..
37a0: 20 20 20 20 61 72 69 74 68 53 65 72 69 65 73 52 arithSeriesR
37b0: 65 70 50 74 72 20 3d 20 28 41 72 69 74 68 53 65 epPtr = (ArithSe
37c0: 72 69 65 73 20 2a 29 20 6c 69 73 74 52 65 70 50 ries *) listRepP
37d0: 74 72 3b 0a 2b 09 09 20 20 20 20 69 66 20 28 6c tr;.+.. if (l
37e0: 69 73 74 50 74 72 2d 3e 74 79 70 65 50 74 72 20 istPtr->typePtr
37f0: 3d 3d 20 26 74 63 6c 4c 69 73 74 54 79 70 65 29 == &tclListType)
3800: 20 7b 0a 2b 09 09 20 20 20 20 09 6c 69 73 74 4c {.+.. .listL
3810: 65 6e 20 3d 20 6c 69 73 74 52 65 70 50 74 72 2d en = listRepPtr-
3820: 3e 65 6c 65 6d 43 6f 75 6e 74 3b 0a 2b 09 09 20 >elemCount;.+..
3830: 20 20 20 7d 20 65 6c 73 65 20 7b 0a 2b 09 09 09 } else {.+...
3840: 6c 69 73 74 4c 65 6e 20 3d 20 61 72 69 74 68 53 listLen = arithS
3850: 65 72 69 65 73 52 65 70 50 74 72 2d 3e 6c 65 6e eriesRepPtr->len
3860: 3b 0a 2b 09 09 20 20 20 20 7d 0a 20 09 09 09 0a ;.+.. }. ....
3870: 20 09 09 20 20 20 20 76 61 6c 49 6e 64 65 78 20 .. valIndex
3880: 3d 20 28 69 74 65 72 4e 75 6d 20 2a 20 6e 75 6d = (iterNum * num
3890: 56 61 72 73 29 3b 0a 20 09 09 20 20 20 20 66 6f Vars);. .. fo
38a0: 72 20 28 6a 20 3d 20 30 3b 20 20 6a 20 3c 20 6e r (j = 0; j < n
38b0: 75 6d 56 61 72 73 3b 20 20 6a 2b 2b 29 20 7b 0a umVars; j++) {.
38c0: 20 09 09 09 69 6e 74 20 73 65 74 45 6d 70 74 79 ...int setEmpty
38d0: 53 74 72 20 3d 20 30 3b 0a 2d 09 09 09 69 66 20 Str = 0;.-...if
38e0: 28 76 61 6c 49 6e 64 65 78 20 3e 3d 20 6c 69 73 (valIndex >= lis
38f0: 74 4c 65 6e 29 20 7b 0a 2d 09 09 09 20 20 20 20 tLen) {.-...
3900: 73 65 74 45 6d 70 74 79 53 74 72 20 3d 20 31 3b setEmptyStr = 1;
3910: 0a 2d 09 09 09 20 20 20 20 54 63 6c 4e 65 77 4f .-... TclNewO
3920: 62 6a 28 76 61 6c 75 65 50 74 72 29 3b 0a 2d 09 bj(valuePtr);.-.
3930: 09 09 7d 20 65 6c 73 65 20 7b 0a 2d 09 09 09 20 ..} else {.-...
3940: 20 20 20 76 61 6c 75 65 50 74 72 20 3d 20 6c 69 valuePtr = li
3950: 73 74 52 65 70 50 74 72 2d 3e 65 6c 65 6d 65 6e stRepPtr->elemen
3960: 74 73 5b 76 61 6c 49 6e 64 65 78 5d 3b 0a 2d 09 ts[valIndex];.-.
3970: 09 09 7d 0a 2d 09 09 09 20 20 20 20 0a 2b 0a 20 ..}.-... .+.
3980: 09 09 09 76 61 72 49 6e 64 65 78 20 3d 20 76 61 ...varIndex = va
3990: 72 4c 69 73 74 50 74 72 2d 3e 76 61 72 49 6e 64 rListPtr->varInd
39a0: 65 78 65 73 5b 6a 5d 3b 0a 20 09 09 09 76 61 72 exes[j];. ...var
39b0: 50 74 72 20 3d 20 26 28 63 6f 6d 70 69 6c 65 64 Ptr = &(compiled
39c0: 4c 6f 63 61 6c 73 5b 76 61 72 49 6e 64 65 78 5d Locals[varIndex]
39d0: 29 3b 0a 20 09 09 09 70 61 72 74 31 20 3d 20 76 );. ...part1 = v
39e0: 61 72 50 74 72 2d 3e 6e 61 6d 65 3b 0a 20 09 09 arPtr->name;. ..
39f0: 09 77 68 69 6c 65 20 28 54 63 6c 49 73 56 61 72 .while (TclIsVar
3a00: 4c 69 6e 6b 28 76 61 72 50 74 72 29 29 20 7b 0a Link(varPtr)) {.
3a10: 20 09 09 09 20 20 20 20 76 61 72 50 74 72 20 3d ... varPtr =
3a20: 20 76 61 72 50 74 72 2d 3e 76 61 6c 75 65 2e 6c varPtr->value.l
3a30: 69 6e 6b 50 74 72 3b 0a 20 09 09 09 7d 0a 2b 09 inkPtr;. ...}.+.
3a40: 09 09 69 66 20 28 76 61 6c 49 6e 64 65 78 20 3e ..if (valIndex >
3a50: 3d 20 6c 69 73 74 4c 65 6e 29 20 7b 0a 2b 09 09 = listLen) {.+..
3a60: 09 20 20 20 20 73 65 74 45 6d 70 74 79 53 74 72 . setEmptyStr
3a70: 20 3d 20 31 3b 0a 2b 09 09 09 20 20 20 20 54 63 = 1;.+... Tc
3a80: 6c 4e 65 77 4f 62 6a 28 76 61 6c 75 65 50 74 72 lNewObj(valuePtr
3a90: 29 3b 0a 2b 09 09 09 7d 20 65 6c 73 65 20 7b 0a );.+...} else {.
3aa0: 2b 09 09 09 20 20 20 20 69 66 28 6c 69 73 74 50 +... if(listP
3ab0: 74 72 2d 3e 74 79 70 65 50 74 72 20 3d 3d 20 26 tr->typePtr == &
3ac0: 74 63 6c 4c 69 73 74 54 79 70 65 29 20 7b 0a 2b tclListType) {.+
3ad0: 09 09 09 20 20 20 20 20 20 20 20 76 61 6c 75 65 ... value
3ae0: 50 74 72 20 3d 20 6c 69 73 74 52 65 70 50 74 72 Ptr = listRepPtr
3af0: 2d 3e 65 6c 65 6d 65 6e 74 73 5b 76 61 6c 49 6e ->elements[valIn
3b00: 64 65 78 5d 3b 0a 2b 09 09 09 20 20 20 20 7d 20 dex];.+... }
3b10: 65 6c 73 65 20 7b 0a 2b 09 09 09 09 2f 2a 0a 2b else {.+..../*.+
3b20: 09 09 09 09 20 2a 20 49 74 20 69 73 20 61 20 72 .... * It is a r
3b30: 61 6e 67 65 54 79 70 65 20 54 63 6c 5f 4f 62 6a angeType Tcl_Obj
3b40: 21 0a 2b 09 09 09 09 20 2a 0a 2b 09 09 09 09 20 !.+.... *.+....
3b50: 2a 20 49 66 20 74 68 65 20 76 61 72 69 61 62 6c * If the variabl
3b60: 65 20 63 61 6e 20 62 65 20 61 63 63 65 73 73 65 e can be accesse
3b70: 64 20 69 6e 6c 69 6e 65 20 61 6e 64 0a 2b 09 09 d inline and.+..
3b80: 09 09 20 2a 20 69 74 73 20 76 61 6c 75 65 20 69 .. * its value i
3b90: 73 20 75 6e 73 68 61 72 65 64 20 77 65 20 6d 6f s unshared we mo
3ba0: 64 69 66 79 20 69 74 20 69 6e 0a 2b 09 09 09 09 dify it in.+....
3bb0: 20 2a 20 70 6c 61 63 65 3b 20 6f 74 68 65 72 77 * place; otherw
3bc0: 69 73 65 20 77 65 20 63 72 65 61 74 65 20 61 20 ise we create a
3bd0: 6e 65 77 20 54 63 6c 5f 4f 62 6a 2e 0a 2b 09 09 new Tcl_Obj..+..
3be0: 09 09 20 2a 2f 0a 2b 09 09 09 09 0a 2b 09 09 09 .. */.+.....+...
3bf0: 09 76 61 6c 75 65 50 74 72 20 3d 20 76 61 72 50 .valuePtr = varP
3c00: 74 72 2d 3e 76 61 6c 75 65 2e 6f 62 6a 50 74 72 tr->value.objPtr
3c10: 3b 0a 2b 09 09 09 09 69 66 20 28 21 54 63 6c 49 ;.+....if (!TclI
3c20: 73 56 61 72 44 69 72 65 63 74 57 72 69 74 61 62 sVarDirectWritab
3c30: 6c 65 28 76 61 72 50 74 72 29 20 7c 7c 20 21 76 le(varPtr) || !v
3c40: 61 6c 75 65 50 74 72 20 7c 7c 20 54 63 6c 5f 49 aluePtr || Tcl_I
3c50: 73 53 68 61 72 65 64 28 76 61 6c 75 65 50 74 72 sShared(valuePtr
3c60: 29 29 20 7b 0a 2b 09 09 09 09 20 20 20 20 54 63 )) {.+.... Tc
3c70: 6c 4e 65 77 4f 62 6a 28 76 61 6c 75 65 50 74 72 lNewObj(valuePtr
3c80: 29 3b 0a 2b 09 09 09 09 7d 0a 2b 09 09 09 09 20 );.+....}.+....
3c90: 20 20 20 0a 2b 09 09 09 09 69 66 20 28 61 72 69 .+....if (ari
3ca0: 74 68 53 65 72 69 65 73 52 65 70 50 74 72 2d 3e thSeriesRepPtr->
3cb0: 66 6c 61 67 73 20 26 20 54 43 4c 5f 41 52 49 54 flags & TCL_ARIT
3cc0: 48 53 45 52 49 45 53 5f 49 53 5f 57 49 44 45 29 HSERIES_IS_WIDE)
3cd0: 20 7b 0a 2b 09 09 09 09 20 20 20 20 54 63 6c 5f {.+.... Tcl_
3ce0: 53 65 74 57 69 64 65 49 6e 74 4f 62 6a 28 76 61 SetWideIntObj(va
3cf0: 6c 75 65 50 74 72 2c 20 0a 2b 09 09 09 09 09 20 luePtr, .+.....
3d00: 20 20 20 61 72 69 74 68 53 65 72 69 65 73 52 65 arithSeriesRe
3d10: 70 50 74 72 2d 3e 73 74 61 72 74 2e 77 20 2b 0a pPtr->start.w +.
3d20: 2b 09 09 09 09 09 20 20 20 20 28 76 61 6c 49 6e +..... (valIn
3d30: 64 65 78 2a 61 72 69 74 68 53 65 72 69 65 73 52 dex*arithSeriesR
3d40: 65 70 50 74 72 2d 3e 73 74 65 70 2e 77 29 29 3b epPtr->step.w));
3d50: 0a 2b 09 09 09 09 7d 20 65 6c 73 65 20 7b 0a 2b .+....} else {.+
3d60: 09 09 09 09 20 20 20 20 54 63 6c 5f 53 65 74 49 .... Tcl_SetI
3d70: 6e 74 4f 62 6a 28 76 61 6c 75 65 50 74 72 2c 20 ntObj(valuePtr,
3d80: 0a 2b 09 09 09 09 09 20 20 20 20 61 72 69 74 68 .+..... arith
3d90: 53 65 72 69 65 73 52 65 70 50 74 72 2d 3e 73 74 SeriesRepPtr->st
3da0: 61 72 74 2e 69 20 2b 0a 2b 09 09 09 09 09 20 20 art.i +.+.....
3db0: 20 20 28 76 61 6c 49 6e 64 65 78 2a 61 72 69 74 (valIndex*arit
3dc0: 68 53 65 72 69 65 73 52 65 70 50 74 72 2d 3e 73 hSeriesRepPtr->s
3dd0: 74 65 70 2e 69 29 29 3b 0a 2b 09 09 09 09 7d 0a tep.i));.+....}.
3de0: 2b 09 09 09 20 20 20 20 7d 0a 2b 09 09 09 7d 0a +... }.+...}.
3df0: 2b 09 09 09 20 20 20 20 0a 20 09 09 09 69 66 20 +... . ...if
3e00: 28 54 63 6c 49 73 56 61 72 44 69 72 65 63 74 57 (TclIsVarDirectW
3e10: 72 69 74 61 62 6c 65 28 76 61 72 50 74 72 29 29 ritable(varPtr))
3e20: 20 7b 0a 20 09 09 09 20 20 20 20 76 61 6c 75 65 {. ... value
3e30: 32 50 74 72 20 3d 20 76 61 72 50 74 72 2d 3e 76 2Ptr = varPtr->v
3e40: 61 6c 75 65 2e 6f 62 6a 50 74 72 3b 0a 20 09 09 alue.objPtr;. ..
3e50: 09 20 20 20 20 69 66 20 28 76 61 6c 75 65 50 74 . if (valuePt
3e60: 72 20 21 3d 20 76 61 6c 75 65 32 50 74 72 29 20 r != value2Ptr)
3e70: 7b 0a 49 6e 64 65 78 3a 20 67 65 6e 65 72 69 63 {.Index: generic
3e80: 2f 74 63 6c 49 6e 74 2e 68 0a 3d 3d 3d 3d 3d 3d /tclInt.h.======
3e90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
3ea0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
3eb0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
3ec0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 52 43 =============.RC
3ed0: 53 20 66 69 6c 65 3a 20 2f 63 76 73 72 6f 6f 74 S file: /cvsroot
3ee0: 2f 74 63 6c 2f 74 63 6c 2f 67 65 6e 65 72 69 63 /tcl/tcl/generic
3ef0: 2f 74 63 6c 49 6e 74 2e 68 2c 76 0a 72 65 74 72 /tclInt.h,v.retr
3f00: 69 65 76 69 6e 67 20 72 65 76 69 73 69 6f 6e 20 ieving revision
3f10: 31 2e 31 38 37 0a 64 69 66 66 20 2d 75 20 2d 72 1.187.diff -u -r
3f20: 31 2e 31 38 37 20 74 63 6c 49 6e 74 2e 68 0a 2d 1.187 tclInt.h.-
3f30: 2d 2d 20 67 65 6e 65 72 69 63 2f 74 63 6c 49 6e -- generic/tclIn
3f40: 74 2e 68 09 32 35 20 4f 63 74 20 32 30 30 34 20 t.h.25 Oct 2004
3f50: 30 31 3a 30 36 3a 35 31 20 2d 30 30 30 30 09 31 01:06:51 -0000.1
3f60: 2e 31 38 37 0a 2b 2b 2b 20 67 65 6e 65 72 69 63 .187.+++ generic
3f70: 2f 74 63 6c 49 6e 74 2e 68 09 32 35 20 4f 63 74 /tclInt.h.25 Oct
3f80: 20 32 30 30 34 20 32 31 3a 35 33 3a 30 34 20 2d 2004 21:53:04 -
3f90: 30 30 30 30 0a 40 40 20 2d 31 35 36 39 2c 36 20 0000.@@ -1569,6
3fa0: 2b 31 35 36 39 2c 32 39 20 40 40 0a 20 7d 20 4c +1569,29 @@. } L
3fb0: 69 73 74 3b 0a 20 0a 20 2f 2a 0a 2b 20 2a 20 54 ist;. . /*.+ * T
3fc0: 68 65 20 73 74 72 75 63 74 75 72 65 20 75 73 65 he structure use
3fd0: 64 20 66 6f 72 20 74 68 65 20 41 69 72 74 68 53 d for the AirthS
3fe0: 65 72 69 65 73 20 69 6e 74 65 72 6e 61 6c 20 72 eries internal r
3ff0: 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 2e 0a 2b epresentation..+
4000: 20 2a 20 4e 6f 74 65 20 74 68 61 74 20 74 68 65 * Note that the
4010: 20 6c 65 6e 20 63 61 6e 20 69 6e 20 74 68 65 6f len can in theo
4020: 72 79 20 62 65 20 61 6c 77 61 79 73 20 63 6f 6d ry be always com
4030: 70 75 74 65 64 20 62 79 20 73 74 61 72 74 2c 65 puted by start,e
4040: 6e 64 2c 73 74 65 70 0a 2b 20 2a 20 62 75 74 20 nd,step.+ * but
4050: 69 74 27 73 20 66 61 73 74 65 72 20 74 6f 20 63 it's faster to c
4060: 61 63 68 65 20 69 74 20 69 6e 73 69 64 65 20 74 ache it inside t
4070: 68 65 20 69 6e 74 65 72 6e 61 6c 20 72 65 70 72 he internal repr
4080: 65 73 65 6e 74 61 74 69 6f 6e 2e 0a 2b 20 2a 2f esentation..+ */
4090: 0a 2b 23 64 65 66 69 6e 65 20 54 43 4c 5f 41 52 .+#define TCL_AR
40a0: 49 54 48 53 45 52 49 45 53 5f 49 53 5f 57 49 44 ITHSERIES_IS_WID
40b0: 45 20 31 0a 2b 74 79 70 65 64 65 66 20 73 74 72 E 1.+typedef str
40c0: 75 63 74 20 41 72 69 74 68 53 65 72 69 65 73 20 uct ArithSeries
40d0: 7b 0a 2b 20 20 20 20 75 6e 69 6f 6e 20 7b 0a 2b {.+ union {.+
40e0: 09 69 6e 74 20 69 3b 0a 2b 20 20 20 20 20 20 20 .int i;.+
40f0: 20 54 63 6c 5f 57 69 64 65 49 6e 74 20 77 3b 0a Tcl_WideInt w;.
4100: 2b 20 20 20 20 7d 20 73 74 61 72 74 3b 0a 2b 20 + } start;.+
4110: 20 20 20 75 6e 69 6f 6e 20 7b 0a 2b 09 69 6e 74 union {.+.int
4120: 20 69 3b 0a 2b 20 20 20 20 20 20 20 20 54 63 6c i;.+ Tcl
4130: 5f 57 69 64 65 49 6e 74 20 77 3b 0a 2b 20 20 20 _WideInt w;.+
4140: 20 7d 20 65 6e 64 3b 0a 2b 20 20 20 20 75 6e 69 } end;.+ uni
4150: 6f 6e 20 7b 0a 2b 09 69 6e 74 20 69 3b 0a 2b 20 on {.+.int i;.+
4160: 20 20 20 20 20 20 20 54 63 6c 5f 57 69 64 65 49 Tcl_WideI
4170: 6e 74 20 77 3b 0a 2b 20 20 20 20 7d 20 73 74 65 nt w;.+ } ste
4180: 70 3b 0a 2b 20 20 20 20 69 6e 74 20 6c 65 6e 3b p;.+ int len;
4190: 0a 2b 20 20 20 20 69 6e 74 20 66 6c 61 67 73 3b .+ int flags;
41a0: 0a 2b 7d 20 41 72 69 74 68 53 65 72 69 65 73 3b .+} ArithSeries;
41b0: 0a 2b 0a 2b 2f 2a 0a 20 20 2a 2d 2d 2d 2d 2d 2d .+.+/*. *------
41c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
41d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
41e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
41f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20 2a 20 44 ----------. * D
4200: 61 74 61 20 73 74 72 75 63 74 75 72 65 73 20 72 ata structures r
4210: 65 6c 61 74 65 64 20 74 6f 20 74 68 65 20 66 69 elated to the fi
4220: 6c 65 73 79 73 74 65 6d 20 69 6e 74 65 72 6e 61 lesystem interna
4230: 6c 73 0a 20 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ls. *----------
4240: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
4250: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
4260: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
4270: 2d 2d 2d 2d 2d 2d 0a 40 40 20 2d 31 36 37 34 2c ------.@@ -1674,
4280: 36 20 2b 31 36 39 37 2c 37 20 40 40 0a 20 65 78 6 +1697,7 @@. ex
4290: 74 65 72 6e 20 54 63 6c 5f 4f 62 6a 54 79 70 65 tern Tcl_ObjType
42a0: 09 74 63 6c 45 6e 64 4f 66 66 73 65 74 54 79 70 .tclEndOffsetTyp
42b0: 65 3b 0a 20 65 78 74 65 72 6e 20 54 63 6c 5f 4f e;. extern Tcl_O
42c0: 62 6a 54 79 70 65 09 74 63 6c 49 6e 74 54 79 70 bjType.tclIntTyp
42d0: 65 3b 0a 20 65 78 74 65 72 6e 20 54 63 6c 5f 4f e;. extern Tcl_O
42e0: 62 6a 54 79 70 65 09 74 63 6c 4c 69 73 74 54 79 bjType.tclListTy
42f0: 70 65 3b 0a 2b 65 78 74 65 72 6e 20 54 63 6c 5f pe;.+extern Tcl_
4300: 4f 62 6a 54 79 70 65 09 74 63 6c 41 72 69 74 68 ObjType.tclArith
4310: 53 65 72 69 65 73 54 79 70 65 3b 0a 20 65 78 74 SeriesType;. ext
4320: 65 72 6e 20 54 63 6c 5f 4f 62 6a 54 79 70 65 09 ern Tcl_ObjType.
4330: 74 63 6c 44 69 63 74 54 79 70 65 3b 0a 20 65 78 tclDictType;. ex
4340: 74 65 72 6e 20 54 63 6c 5f 4f 62 6a 54 79 70 65 tern Tcl_ObjType
4350: 09 74 63 6c 50 72 6f 63 42 6f 64 79 54 79 70 65 .tclProcBodyType
4360: 3b 0a 20 65 78 74 65 72 6e 20 54 63 6c 5f 4f 62 ;. extern Tcl_Ob
4370: 6a 54 79 70 65 09 74 63 6c 53 74 72 69 6e 67 54 jType.tclStringT
4380: 79 70 65 3b 0a 40 40 20 2d 32 30 39 34 2c 36 20 ype;.@@ -2094,6
4390: 2b 32 31 31 38 2c 38 20 40 40 0a 20 09 09 20 20 +2118,8 @@. ..
43a0: 20 20 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e Tcl_Interp *in
43b0: 74 65 72 70 2c 20 69 6e 74 20 6f 62 6a 63 2c 20 terp, int objc,
43c0: 54 63 6c 5f 4f 62 6a 20 2a 43 4f 4e 53 54 20 6f Tcl_Obj *CONST o
43d0: 62 6a 76 5b 5d 29 29 3b 0a 20 45 58 54 45 52 4e bjv[]));. EXTERN
43e0: 20 69 6e 74 09 54 63 6c 5f 50 77 64 4f 62 6a 43 int.Tcl_PwdObjC
43f0: 6d 64 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 md _ANSI_ARGS_((
4400: 43 6c 69 65 6e 74 44 61 74 61 20 63 6c 69 65 6e ClientData clien
4410: 74 44 61 74 61 2c 0a 20 09 09 20 20 20 20 54 63 tData,. .. Tc
4420: 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 l_Interp *interp
4430: 2c 20 69 6e 74 20 6f 62 6a 63 2c 20 54 63 6c 5f , int objc, Tcl_
4440: 4f 62 6a 20 2a 43 4f 4e 53 54 20 6f 62 6a 76 5b Obj *CONST objv[
4450: 5d 29 29 3b 0a 2b 45 58 54 45 52 4e 20 69 6e 74 ]));.+EXTERN int
4460: 09 54 63 6c 5f 52 61 6e 67 65 4f 62 6a 43 6d 64 .Tcl_RangeObjCmd
4470: 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 43 6c _ANSI_ARGS_((Cl
4480: 69 65 6e 74 44 61 74 61 20 63 6c 69 65 6e 74 44 ientData clientD
4490: 61 74 61 2c 0a 2b 09 09 20 20 20 20 54 63 6c 5f ata,.+.. Tcl_
44a0: 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 2c 20 Interp *interp,
44b0: 69 6e 74 20 6f 62 6a 63 2c 20 54 63 6c 5f 4f 62 int objc, Tcl_Ob
44c0: 6a 20 2a 43 4f 4e 53 54 20 6f 62 6a 76 5b 5d 29 j *CONST objv[])
44d0: 29 3b 0a 20 45 58 54 45 52 4e 20 69 6e 74 09 54 );. EXTERN int.T
44e0: 63 6c 5f 52 65 61 64 4f 62 6a 43 6d 64 20 5f 41 cl_ReadObjCmd _A
44f0: 4e 53 49 5f 41 52 47 53 5f 28 28 43 6c 69 65 6e NSI_ARGS_((Clien
4500: 74 44 61 74 61 20 63 6c 69 65 6e 74 44 61 74 61 tData clientData
4510: 2c 0a 20 09 09 20 20 20 20 54 63 6c 5f 49 6e 74 ,. .. Tcl_Int
4520: 65 72 70 20 2a 69 6e 74 65 72 70 2c 20 69 6e 74 erp *interp, int
4530: 20 6f 62 6a 63 2c 20 54 63 6c 5f 4f 62 6a 20 2a objc, Tcl_Obj *
4540: 43 4f 4e 53 54 20 6f 62 6a 76 5b 5d 29 29 3b 0a CONST objv[]));.
4550: 20 45 58 54 45 52 4e 20 69 6e 74 09 54 63 6c 5f EXTERN int.Tcl_
4560: 52 65 67 65 78 70 4f 62 6a 43 6d 64 20 5f 41 4e RegexpObjCmd _AN
4570: 53 49 5f 41 52 47 53 5f 28 28 43 6c 69 65 6e 74 SI_ARGS_((Client
4580: 44 61 74 61 20 63 6c 69 65 6e 74 44 61 74 61 2c Data clientData,
4590: 0a 49 6e 64 65 78 3a 20 67 65 6e 65 72 69 63 2f .Index: generic/
45a0: 74 63 6c 4c 69 73 74 4f 62 6a 2e 63 0a 3d 3d 3d tclListObj.c.===
45b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
45c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
45d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
45e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
45f0: 0a 52 43 53 20 66 69 6c 65 3a 20 2f 63 76 73 72 .RCS file: /cvsr
4600: 6f 6f 74 2f 74 63 6c 2f 74 63 6c 2f 67 65 6e 65 oot/tcl/tcl/gene
4610: 72 69 63 2f 74 63 6c 4c 69 73 74 4f 62 6a 2e 63 ric/tclListObj.c
4620: 2c 76 0a 72 65 74 72 69 65 76 69 6e 67 20 72 65 ,v.retrieving re
4630: 76 69 73 69 6f 6e 20 31 2e 31 39 0a 64 69 66 66 vision 1.19.diff
4640: 20 2d 75 20 2d 72 31 2e 31 39 20 74 63 6c 4c 69 -u -r1.19 tclLi
4650: 73 74 4f 62 6a 2e 63 0a 2d 2d 2d 20 67 65 6e 65 stObj.c.--- gene
4660: 72 69 63 2f 74 63 6c 4c 69 73 74 4f 62 6a 2e 63 ric/tclListObj.c
4670: 09 32 39 20 53 65 70 20 32 30 30 34 20 32 32 3a .29 Sep 2004 22:
4680: 31 37 3a 33 30 20 2d 30 30 30 30 09 31 2e 31 39 17:30 -0000.1.19
4690: 0a 2b 2b 2b 20 67 65 6e 65 72 69 63 2f 74 63 6c .+++ generic/tcl
46a0: 4c 69 73 74 4f 62 6a 2e 63 09 32 35 20 4f 63 74 ListObj.c.25 Oct
46b0: 20 32 30 30 34 20 32 31 3a 35 33 3a 30 37 20 2d 2004 21:53:07 -
46c0: 30 30 30 30 0a 40 40 20 2d 31 35 36 36 2c 36 20 0000.@@ -1566,6
46d0: 2b 31 35 36 36 2c 33 39 20 40 40 0a 20 20 20 20 +1566,39 @@.
46e0: 20 4c 69 73 74 20 2a 6c 69 73 74 52 65 70 50 74 List *listRepPt
46f0: 72 3b 0a 20 0a 20 20 20 20 20 2f 2a 0a 2b 20 20 r;. . /*.+
4700: 20 20 20 2a 20 43 6f 6e 76 65 72 74 69 6f 6e 20 * Convertion
4710: 66 72 6f 6d 20 41 72 69 74 68 6d 65 74 69 63 20 from Arithmetic
4720: 53 65 72 69 65 73 20 69 73 20 61 20 73 70 65 63 Series is a spec
4730: 69 61 6c 20 63 61 73 65 0a 2b 20 20 20 20 20 2a ial case.+ *
4740: 20 62 65 63 61 75 73 65 20 69 74 20 63 61 6e 20 because it can
4750: 62 65 20 64 6f 6e 65 20 61 6e 20 6f 72 64 65 72 be done an order
4760: 20 6f 66 20 6d 61 67 6e 69 74 75 64 65 20 66 61 of magnitude fa
4770: 73 74 65 72 0a 2b 20 20 20 20 20 2a 20 61 6e 64 ster.+ * and
4780: 20 6d 61 79 20 6f 63 63 75 72 20 66 72 65 71 75 may occur frequ
4790: 65 6e 74 6c 79 2e 0a 2b 20 20 20 20 20 2a 2f 0a ently..+ */.
47a0: 2b 20 20 20 20 69 66 20 28 6f 62 6a 50 74 72 2d + if (objPtr-
47b0: 3e 74 79 70 65 50 74 72 20 3d 3d 20 26 74 63 6c >typePtr == &tcl
47c0: 41 72 69 74 68 53 65 72 69 65 73 54 79 70 65 29 ArithSeriesType)
47d0: 20 7b 0a 2b 20 20 20 20 20 20 20 20 54 63 6c 5f {.+ Tcl_
47e0: 57 69 64 65 49 6e 74 20 77 69 64 65 4c 65 6e 20 WideInt wideLen
47f0: 3d 20 54 63 6c 5f 41 72 69 74 68 53 65 72 69 65 = Tcl_ArithSerie
4800: 73 4f 62 6a 4c 65 6e 67 74 68 28 6f 62 6a 50 74 sObjLength(objPt
4810: 72 29 2c 20 6a 3b 0a 2b 20 20 20 20 20 20 20 20 r), j;.+
4820: 41 72 69 74 68 53 65 72 69 65 73 20 2a 61 72 69 ArithSeries *ari
4830: 74 68 53 65 72 69 65 73 52 65 70 50 74 72 20 3d thSeriesRepPtr =
4840: 20 28 41 72 69 74 68 53 65 72 69 65 73 2a 29 0a (ArithSeries*).
4850: 2b 09 09 6f 62 6a 50 74 72 2d 3e 69 6e 74 65 72 +..objPtr->inter
4860: 6e 61 6c 52 65 70 2e 74 77 6f 50 74 72 56 61 6c nalRep.twoPtrVal
4870: 75 65 2e 70 74 72 31 3b 0a 2b 0a 2b 09 65 6c 65 ue.ptr1;.+.+.ele
4880: 6d 50 74 72 73 20 3d 20 28 54 63 6c 5f 4f 62 6a mPtrs = (Tcl_Obj
4890: 2a 2a 29 20 63 6b 61 6c 6c 6f 63 28 73 69 7a 65 **) ckalloc(size
48a0: 6f 66 28 54 63 6c 5f 4f 62 6a 2a 29 2a 77 69 64 of(Tcl_Obj*)*wid
48b0: 65 4c 65 6e 29 3b 0a 2b 09 66 6f 72 20 28 6a 20 eLen);.+.for (j
48c0: 3d 20 30 3b 20 6a 20 3c 20 77 69 64 65 4c 65 6e = 0; j < wideLen
48d0: 3b 20 6a 2b 2b 29 20 7b 0a 2b 09 09 69 66 20 28 ; j++) {.+..if (
48e0: 61 72 69 74 68 53 65 72 69 65 73 52 65 70 50 74 arithSeriesRepPt
48f0: 72 2d 3e 66 6c 61 67 73 20 26 20 54 43 4c 5f 41 r->flags & TCL_A
4900: 52 49 54 48 53 45 52 49 45 53 5f 49 53 5f 57 49 RITHSERIES_IS_WI
4910: 44 45 29 0a 2b 09 09 09 65 6c 65 6d 50 74 72 73 DE).+...elemPtrs
4920: 5b 6a 5d 20 3d 20 54 63 6c 5f 4e 65 77 57 69 64 [j] = Tcl_NewWid
4930: 65 49 6e 74 4f 62 6a 28 0a 2b 09 09 09 09 61 72 eIntObj(.+....ar
4940: 69 74 68 53 65 72 69 65 73 52 65 70 50 74 72 2d ithSeriesRepPtr-
4950: 3e 73 74 61 72 74 2e 77 20 2b 0a 2b 09 09 09 09 >start.w +.+....
4960: 28 6a 2a 61 72 69 74 68 53 65 72 69 65 73 52 65 (j*arithSeriesRe
4970: 70 50 74 72 2d 3e 73 74 65 70 2e 77 29 29 3b 0a pPtr->step.w));.
4980: 2b 09 09 65 6c 73 65 0a 2b 09 09 09 65 6c 65 6d +..else.+...elem
4990: 50 74 72 73 5b 6a 5d 20 3d 20 54 63 6c 5f 4e 65 Ptrs[j] = Tcl_Ne
49a0: 77 49 6e 74 4f 62 6a 28 0a 2b 09 09 09 09 61 72 wIntObj(.+....ar
49b0: 69 74 68 53 65 72 69 65 73 52 65 70 50 74 72 2d ithSeriesRepPtr-
49c0: 3e 73 74 61 72 74 2e 69 20 2b 0a 2b 09 09 09 09 >start.i +.+....
49d0: 28 6a 2a 61 72 69 74 68 53 65 72 69 65 73 52 65 (j*arithSeriesRe
49e0: 70 50 74 72 2d 3e 73 74 65 70 2e 69 29 29 3b 0a pPtr->step.i));.
49f0: 2b 09 7d 0a 2b 20 20 20 20 20 20 20 20 6c 69 73 +.}.+ lis
4a00: 74 52 65 70 50 74 72 20 3d 20 28 4c 69 73 74 20 tRepPtr = (List
4a10: 2a 29 20 63 6b 61 6c 6c 6f 63 28 73 69 7a 65 6f *) ckalloc(sizeo
4a20: 66 28 4c 69 73 74 29 29 3b 0a 2b 20 20 20 20 20 f(List));.+
4a30: 20 20 20 6c 69 73 74 52 65 70 50 74 72 2d 3e 6d listRepPtr->m
4a40: 61 78 45 6c 65 6d 43 6f 75 6e 74 20 3d 20 77 69 axElemCount = wi
4a50: 64 65 4c 65 6e 3b 0a 2b 20 20 20 20 20 20 20 20 deLen;.+
4a60: 6c 69 73 74 52 65 70 50 74 72 2d 3e 65 6c 65 6d listRepPtr->elem
4a70: 43 6f 75 6e 74 20 20 20 20 3d 20 77 69 64 65 4c Count = wideL
4a80: 65 6e 3b 0a 2b 20 20 20 20 20 20 20 20 6c 69 73 en;.+ lis
4a90: 74 52 65 70 50 74 72 2d 3e 65 6c 65 6d 65 6e 74 tRepPtr->element
4aa0: 73 20 20 20 20 20 3d 20 65 6c 65 6d 50 74 72 73 s = elemPtrs
4ab0: 3b 0a 2b 0a 2b 20 20 20 20 20 20 20 20 54 63 6c ;.+.+ Tcl
4ac0: 46 72 65 65 49 6e 74 52 65 70 28 6f 62 6a 50 74 FreeIntRep(objPt
4ad0: 72 29 3b 0a 2b 20 20 20 20 20 20 20 20 6f 62 6a r);.+ obj
4ae0: 50 74 72 2d 3e 69 6e 74 65 72 6e 61 6c 52 65 70 Ptr->internalRep
4af0: 2e 74 77 6f 50 74 72 56 61 6c 75 65 2e 70 74 72 .twoPtrValue.ptr
4b00: 31 20 3d 20 28 56 4f 49 44 20 2a 29 20 6c 69 73 1 = (VOID *) lis
4b10: 74 52 65 70 50 74 72 3b 0a 2b 20 20 20 20 20 20 tRepPtr;.+
4b20: 20 20 6f 62 6a 50 74 72 2d 3e 69 6e 74 65 72 6e objPtr->intern
4b30: 61 6c 52 65 70 2e 74 77 6f 50 74 72 56 61 6c 75 alRep.twoPtrValu
4b40: 65 2e 70 74 72 32 20 3d 20 4e 55 4c 4c 3b 0a 2b e.ptr2 = NULL;.+
4b50: 20 20 20 20 20 20 20 20 6f 62 6a 50 74 72 2d 3e objPtr->
4b60: 74 79 70 65 50 74 72 20 3d 20 26 74 63 6c 4c 69 typePtr = &tclLi
4b70: 73 74 54 79 70 65 3b 0a 2b 09 72 65 74 75 72 6e stType;.+.return
4b80: 20 54 43 4c 5f 4f 4b 3b 0a 2b 20 20 20 20 7d 0a TCL_OK;.+ }.
4b90: 2b 0a 2b 20 20 20 20 2f 2a 0a 20 20 20 20 20 20 +.+ /*.
4ba0: 2a 20 47 65 74 20 74 68 65 20 73 74 72 69 6e 67 * Get the string
4bb0: 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 2e representation.
4bc0: 20 4d 61 6b 65 20 69 74 20 75 70 2d 74 6f 2d 64 Make it up-to-d
4bd0: 61 74 65 20 69 66 20 6e 65 63 65 73 73 61 72 79 ate if necessary
4be0: 2e 0a 20 20 20 20 20 20 2a 2f 0a 20 0a 40 40 20 .. */. .@@
4bf0: 2d 31 37 33 33 2c 33 20 2b 31 37 36 36 2c 33 39 -1733,3 +1766,39
4c00: 35 20 40 40 0a 20 20 20 20 20 7d 0a 20 20 20 20 5 @@. }.
4c10: 20 6c 69 73 74 50 74 72 2d 3e 6c 65 6e 67 74 68 listPtr->length
4c20: 20 3d 20 64 73 74 20 2d 20 6c 69 73 74 50 74 72 = dst - listPtr
4c30: 2d 3e 62 79 74 65 73 3b 0a 20 7d 0a 2b 0a 2b 2f ->bytes;. }.+.+/
4c40: 2a 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d * --------------
4c50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 41 72 69 ------------ Ari
4c60: 74 68 53 65 72 69 65 73 20 6f 62 6a 65 63 74 20 thSeries object
4c70: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
4c80: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 2a 2f 0a ------------ */.
4c90: 2b 0a 2b 2f 2a 0a 2b 20 2a 20 50 72 6f 74 6f 74 +.+/*.+ * Protot
4ca0: 79 70 65 73 20 66 6f 72 20 70 72 6f 63 65 64 75 ypes for procedu
4cb0: 72 65 73 20 64 65 66 69 6e 65 64 20 6c 61 74 65 res defined late
4cc0: 72 20 69 6e 20 74 68 69 73 20 66 69 6c 65 3a 0a r in this file:.
4cd0: 2b 20 2a 2f 0a 2b 0a 2b 73 74 61 74 69 63 20 76 + */.+.+static v
4ce0: 6f 69 64 09 09 44 75 70 41 72 69 74 68 53 65 72 oid..DupArithSer
4cf0: 69 65 73 49 6e 74 65 72 6e 61 6c 52 65 70 20 5f iesInternalRep _
4d00: 41 4e 53 49 5f 41 52 47 53 5f 28 28 54 63 6c 5f ANSI_ARGS_((Tcl_
4d10: 4f 62 6a 20 2a 73 72 63 50 74 72 2c 0a 2b 09 09 Obj *srcPtr,.+..
4d20: 09 20 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 63 6f . Tcl_Obj *co
4d30: 70 79 50 74 72 29 29 3b 0a 2b 73 74 61 74 69 63 pyPtr));.+static
4d40: 20 76 6f 69 64 09 09 46 72 65 65 41 72 69 74 68 void..FreeArith
4d50: 53 65 72 69 65 73 49 6e 74 65 72 6e 61 6c 52 65 SeriesInternalRe
4d60: 70 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 54 p _ANSI_ARGS_((T
4d70: 63 6c 5f 4f 62 6a 20 2a 6c 69 73 74 50 74 72 29 cl_Obj *listPtr)
4d80: 29 3b 0a 2b 73 74 61 74 69 63 20 69 6e 74 09 09 );.+static int..
4d90: 53 65 74 41 72 69 74 68 53 65 72 69 65 73 46 72 SetArithSeriesFr
4da0: 6f 6d 41 6e 79 20 5f 41 4e 53 49 5f 41 52 47 53 omAny _ANSI_ARGS
4db0: 5f 28 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 _((Tcl_Interp *i
4dc0: 6e 74 65 72 70 2c 0a 2b 09 09 09 20 20 20 20 54 nterp,.+... T
4dd0: 63 6c 5f 4f 62 6a 20 2a 6f 62 6a 50 74 72 29 29 cl_Obj *objPtr))
4de0: 3b 0a 2b 73 74 61 74 69 63 20 76 6f 69 64 09 09 ;.+static void..
4df0: 55 70 64 61 74 65 53 74 72 69 6e 67 4f 66 41 72 UpdateStringOfAr
4e00: 69 74 68 53 65 72 69 65 73 20 5f 41 4e 53 49 5f ithSeries _ANSI_
4e10: 41 52 47 53 5f 28 28 54 63 6c 5f 4f 62 6a 20 2a ARGS_((Tcl_Obj *
4e20: 6c 69 73 74 50 74 72 29 29 3b 0a 2b 0a 2b 2f 2a listPtr));.+.+/*
4e30: 0a 2b 20 2a 20 54 68 65 20 73 74 72 75 63 74 75 .+ * The structu
4e40: 72 65 20 62 65 6c 6f 77 20 64 65 66 69 6e 65 73 re below defines
4e50: 20 74 68 65 20 61 72 69 74 68 6d 65 74 69 63 20 the arithmetic
4e60: 73 65 72 69 65 73 20 54 63 6c 20 6f 62 6a 65 63 series Tcl objec
4e70: 74 20 74 79 70 65 20 62 79 0a 2b 20 2a 20 6d 65 t type by.+ * me
4e80: 61 6e 73 20 6f 66 20 70 72 6f 63 65 64 75 72 65 ans of procedure
4e90: 73 20 74 68 61 74 20 63 61 6e 20 62 65 20 69 6e s that can be in
4ea0: 76 6f 6b 65 64 20 62 79 20 67 65 6e 65 72 69 63 voked by generic
4eb0: 20 6f 62 6a 65 63 74 20 63 6f 64 65 2e 0a 2b 20 object code..+
4ec0: 2a 0a 2b 20 2a 20 54 68 65 20 61 72 69 74 68 6d *.+ * The arithm
4ed0: 65 74 69 63 20 73 65 72 69 65 73 20 6f 62 6a 65 etic series obje
4ee0: 63 74 20 69 73 20 61 20 73 70 65 63 69 61 6c 20 ct is a special
4ef0: 63 61 73 65 20 6f 66 20 54 63 6c 20 6c 69 73 74 case of Tcl list
4f00: 20 72 65 70 72 65 73 65 6e 74 69 6e 67 0a 2b 20 representing.+
4f10: 2a 20 61 6e 20 69 6e 74 65 72 76 61 6c 20 6f 66 * an interval of
4f20: 20 61 6e 20 61 72 69 74 68 6d 65 74 69 63 20 73 an arithmetic s
4f30: 65 72 69 65 73 20 69 6e 20 63 6f 6e 73 74 61 6e eries in constan
4f40: 74 20 73 70 61 63 65 2e 0a 2b 20 2a 20 0a 2b 20 t space..+ * .+
4f50: 2a 20 54 68 65 20 61 72 69 74 68 6d 65 74 69 63 * The arithmetic
4f60: 20 73 65 72 69 65 73 20 69 73 20 69 6e 74 65 72 series is inter
4f70: 6e 61 6c 6c 79 20 72 65 70 72 65 73 65 6e 74 65 nally represente
4f80: 64 20 77 69 74 68 20 74 68 72 65 65 20 69 6e 74 d with three int
4f90: 65 67 65 72 73 2c 0a 2b 20 2a 20 2a 73 74 61 72 egers,.+ * *star
4fa0: 74 2a 2c 20 2a 65 6e 64 2a 2c 20 61 6e 64 20 2a t*, *end*, and *
4fb0: 73 74 65 70 2a 2c 20 57 68 65 72 65 20 74 68 65 step*, Where the
4fc0: 20 6c 65 6e 67 74 68 20 69 73 20 63 61 6c 63 75 length is calcu
4fd0: 6c 61 74 65 64 20 77 69 74 68 0a 2b 20 2a 20 74 lated with.+ * t
4fe0: 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 61 6c 67 he following alg
4ff0: 6f 72 69 74 68 6d 3a 0a 2b 20 2a 0a 2b 20 2a 20 orithm:.+ *.+ *
5000: 69 66 20 53 54 45 50 20 69 73 20 30 3a 20 45 52 if STEP is 0: ER
5010: 52 4f 52 0a 2b 20 2a 20 65 6c 73 65 20 69 66 20 ROR.+ * else if
5020: 53 54 41 52 54 20 69 73 20 74 68 65 20 73 61 6d START is the sam
5030: 65 20 61 73 20 45 4e 44 3a 20 4f 55 54 50 55 54 e as END: OUTPUT
5040: 20 30 0a 2b 20 2a 20 65 6c 73 65 20 69 66 20 53 0.+ * else if S
5050: 54 45 50 20 69 73 20 50 4f 53 49 54 49 56 45 20 TEP is POSITIVE
5060: 61 6e 64 20 53 54 41 52 54 20 3e 20 45 4e 44 3a and START > END:
5070: 20 45 52 52 4f 52 0a 2b 20 2a 20 65 6c 73 65 20 ERROR.+ * else
5080: 69 66 20 53 54 45 50 20 69 73 20 4e 45 47 41 54 if STEP is NEGAT
5090: 49 56 45 20 61 6e 64 20 45 4e 44 20 3e 20 53 54 IVE and END > ST
50a0: 41 52 54 3a 20 45 52 52 4f 52 0a 2b 20 2a 20 65 ART: ERROR.+ * e
50b0: 6c 73 65 20 4f 55 54 50 55 54 20 31 2b 28 28 41 lse OUTPUT 1+((A
50c0: 42 53 28 45 4e 44 2d 53 54 41 52 54 29 2d 31 29 BS(END-START)-1)
50d0: 2f 41 42 53 28 53 54 45 50 29 29 0a 2b 20 2a 0a /ABS(STEP)).+ *.
50e0: 2b 20 2a 20 41 6e 64 20 77 68 65 72 65 20 74 68 + * And where th
50f0: 65 20 49 2d 74 68 20 65 6c 65 6d 65 6e 74 20 6f e I-th element o
5100: 66 20 74 68 65 20 72 61 6e 67 65 20 69 73 3a 0a f the range is:.
5110: 2b 20 2a 0a 2b 20 2a 20 45 4c 45 4d 45 4e 54 53 + *.+ * ELEMENTS
5120: 5b 69 5d 20 3d 20 53 54 41 52 54 2b 28 53 54 45 [i] = START+(STE
5130: 50 2a 69 29 0a 2b 20 2a 0a 2b 20 2a 20 5a 65 72 P*i).+ *.+ * Zer
5140: 6f 20 65 6c 65 6d 65 6e 74 73 20 72 61 6e 67 65 o elements range
5150: 73 2c 20 6c 69 6b 65 20 69 6e 20 74 68 65 20 63 s, like in the c
5160: 61 73 65 20 6f 66 20 53 54 41 52 54 3d 31 30 20 ase of START=10
5170: 45 4e 44 3d 31 30 20 53 54 45 50 3d 31 0a 2b 20 END=10 STEP=1.+
5180: 2a 20 61 72 65 20 76 61 6c 69 64 20 61 6e 64 20 * are valid and
5190: 77 69 6c 6c 20 62 65 20 65 71 75 69 76 61 6c 65 will be equivale
51a0: 6e 74 20 74 6f 20 74 68 65 20 65 6d 70 74 79 20 nt to the empty
51b0: 6c 69 73 74 2e 0a 2b 20 2a 2f 0a 2b 0a 2b 54 63 list..+ */.+.+Tc
51c0: 6c 5f 4f 62 6a 54 79 70 65 20 74 63 6c 41 72 69 l_ObjType tclAri
51d0: 74 68 53 65 72 69 65 73 54 79 70 65 20 3d 20 7b thSeriesType = {
51e0: 0a 2b 20 20 20 20 22 61 72 69 74 68 73 65 72 69 .+ "arithseri
51f0: 65 73 22 2c 09 09 09 2f 2a 20 6e 61 6d 65 20 2a es",.../* name *
5200: 2f 0a 2b 20 20 20 20 46 72 65 65 41 72 69 74 68 /.+ FreeArith
5210: 53 65 72 69 65 73 49 6e 74 65 72 6e 61 6c 52 65 SeriesInternalRe
5220: 70 2c 09 09 2f 2a 20 66 72 65 65 49 6e 74 52 65 p,../* freeIntRe
5230: 70 50 72 6f 63 20 2a 2f 0a 2b 20 20 20 20 44 75 pProc */.+ Du
5240: 70 41 72 69 74 68 53 65 72 69 65 73 49 6e 74 65 pArithSeriesInte
5250: 72 6e 61 6c 52 65 70 2c 09 09 2f 2a 20 64 75 70 rnalRep,../* dup
5260: 49 6e 74 52 65 70 50 72 6f 63 20 2a 2f 0a 2b 20 IntRepProc */.+
5270: 20 20 20 55 70 64 61 74 65 53 74 72 69 6e 67 4f UpdateStringO
5280: 66 41 72 69 74 68 53 65 72 69 65 73 2c 09 09 2f fArithSeries,../
5290: 2a 20 75 70 64 61 74 65 53 74 72 69 6e 67 50 72 * updateStringPr
52a0: 6f 63 20 2a 2f 0a 2b 20 20 20 20 53 65 74 41 72 oc */.+ SetAr
52b0: 69 74 68 53 65 72 69 65 73 46 72 6f 6d 41 6e 79 ithSeriesFromAny
52c0: 09 09 2f 2a 20 73 65 74 46 72 6f 6d 41 6e 79 50 ../* setFromAnyP
52d0: 72 6f 63 20 2a 2f 0a 2b 7d 3b 0a 2b 0a 2b 2f 2a roc */.+};.+.+/*
52e0: 0a 2b 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d .+ *------------
52f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
5300: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
5310: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
5320: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 2b 20 2a 0a 2b ----------.+ *.+
5330: 20 2a 20 41 72 69 74 68 53 65 72 69 65 73 4c 65 * ArithSeriesLe
5340: 6e 20 2d 2d 0a 2b 20 2a 0a 2b 20 2a 20 09 43 6f n --.+ *.+ * .Co
5350: 6d 70 75 74 65 20 74 68 65 20 6c 65 6e 67 74 68 mpute the length
5360: 20 6f 66 20 74 68 65 20 65 71 75 69 76 61 6c 65 of the equivale
5370: 6e 74 20 6c 69 73 74 20 77 68 65 72 65 0a 2b 20 nt list where.+
5380: 2a 20 09 65 76 65 72 79 20 65 6c 65 6d 65 6e 74 * .every element
5390: 20 69 73 20 67 65 6e 65 72 61 74 65 64 20 73 74 is generated st
53a0: 61 72 74 69 6e 67 20 66 72 6f 6d 20 2a 73 74 61 arting from *sta
53b0: 72 74 2a 2c 0a 2b 20 2a 20 09 61 6e 64 20 61 64 rt*,.+ * .and ad
53c0: 64 69 6e 67 20 2a 73 74 65 70 2a 20 74 6f 20 67 ding *step* to g
53d0: 65 6e 65 72 61 74 65 20 65 76 65 72 79 20 73 75 enerate every su
53e0: 63 63 65 73 73 69 76 65 20 65 6c 65 6d 65 6e 74 ccessive element
53f0: 0a 2b 20 2a 20 09 74 68 61 74 27 73 20 3c 20 2a .+ * .that's < *
5400: 65 6e 64 2a 20 66 6f 72 20 70 6f 73 69 74 69 76 end* for positiv
5410: 65 20 73 74 65 70 73 2c 20 6f 72 20 3e 20 2a 65 e steps, or > *e
5420: 6e 64 2a 20 66 6f 72 20 6e 65 67 61 74 69 76 65 nd* for negative
5430: 0a 2b 20 2a 20 09 73 74 65 70 73 2e 0a 2b 20 2a .+ * .steps..+ *
5440: 0a 2b 20 2a 20 52 65 73 75 6c 74 73 3a 0a 2b 20 .+ * Results:.+
5450: 2a 0a 2b 20 2a 20 09 54 68 65 20 6c 65 6e 67 74 *.+ * .The lengt
5460: 68 20 6f 66 20 74 68 65 20 6c 69 73 74 20 67 65 h of the list ge
5470: 6e 65 72 61 74 65 64 20 62 79 20 74 68 65 20 67 nerated by the g
5480: 69 76 65 6e 20 72 61 6e 67 65 2c 0a 2b 20 2a 20 iven range,.+ *
5490: 09 74 68 61 74 20 6d 61 79 20 62 65 20 7a 65 72 .that may be zer
54a0: 6f 2e 0a 2b 20 2a 20 09 54 68 65 20 66 75 6e 63 o..+ * .The func
54b0: 74 69 6f 6e 20 72 65 74 75 72 6e 73 20 2d 31 20 tion returns -1
54c0: 69 66 20 74 68 65 20 6c 69 73 74 20 69 73 20 6f if the list is o
54d0: 66 20 6c 65 6e 67 74 68 20 69 6e 66 69 69 74 65 f length infiite
54e0: 2e 0a 2b 20 2a 0a 2b 20 2a 20 53 69 64 65 20 65 ..+ *.+ * Side e
54f0: 66 66 65 63 74 73 3a 0a 2b 20 2a 0a 2b 20 2a 20 ffects:.+ *.+ *
5500: 09 4e 6f 6e 65 2e 0a 2b 20 2a 0a 2b 20 2a 2d 2d .None..+ *.+ *--
5510: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
5520: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
5530: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
5540: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
5550: 2d 2d 2d 2d 0a 2b 20 2a 2f 0a 2b 73 74 61 74 69 ----.+ */.+stati
5560: 63 20 69 6e 74 0a 2b 41 72 69 74 68 53 65 72 69 c int.+ArithSeri
5570: 65 73 4c 65 6e 28 54 63 6c 5f 57 69 64 65 49 6e esLen(Tcl_WideIn
5580: 74 20 73 74 61 72 74 2c 20 54 63 6c 5f 57 69 64 t start, Tcl_Wid
5590: 65 49 6e 74 20 65 6e 64 2c 20 54 63 6c 5f 57 69 eInt end, Tcl_Wi
55a0: 64 65 49 6e 74 20 73 74 65 70 29 0a 2b 7b 0a 2b deInt step).+{.+
55b0: 09 54 63 6c 5f 57 69 64 65 49 6e 74 20 6c 65 6e .Tcl_WideInt len
55c0: 3b 0a 2b 0a 2b 09 69 66 20 28 73 74 65 70 20 3d ;.+.+.if (step =
55d0: 3d 20 30 29 20 72 65 74 75 72 6e 20 2d 31 3b 0a = 0) return -1;.
55e0: 2b 09 69 66 20 28 73 74 61 72 74 20 3d 3d 20 65 +.if (start == e
55f0: 6e 64 29 20 72 65 74 75 72 6e 20 30 3b 0a 2b 09 nd) return 0;.+.
5600: 65 6c 73 65 20 69 66 20 28 73 74 65 70 20 3e 20 else if (step >
5610: 30 20 26 26 20 73 74 61 72 74 20 3e 20 65 6e 64 0 && start > end
5620: 29 20 72 65 74 75 72 6e 20 2d 31 3b 0a 2b 09 65 ) return -1;.+.e
5630: 6c 73 65 20 69 66 20 28 73 74 65 70 20 3c 20 30 lse if (step < 0
5640: 20 26 26 20 65 6e 64 20 3e 20 73 74 61 72 74 29 && end > start)
5650: 20 72 65 74 75 72 6e 20 2d 31 3b 0a 2b 09 6c 65 return -1;.+.le
5660: 6e 20 3d 20 65 6e 64 2d 73 74 61 72 74 3b 0a 2b n = end-start;.+
5670: 09 69 66 20 28 6c 65 6e 20 3c 20 30 29 20 6c 65 .if (len < 0) le
5680: 6e 20 3d 20 2d 6c 65 6e 3b 20 2f 2a 20 61 62 73 n = -len; /* abs
5690: 28 6c 65 6e 29 20 2a 2f 0a 2b 09 69 66 20 28 73 (len) */.+.if (s
56a0: 74 65 70 20 3c 20 30 29 20 73 74 65 70 20 3d 20 tep < 0) step =
56b0: 2d 73 74 65 70 3b 20 2f 2a 20 61 62 73 28 73 74 -step; /* abs(st
56c0: 65 70 29 20 2a 2f 0a 2b 09 6c 65 6e 20 3d 20 31 ep) */.+.len = 1
56d0: 20 2b 20 28 28 6c 65 6e 2d 31 29 2f 73 74 65 70 + ((len-1)/step
56e0: 29 3b 0a 2b 09 2f 2a 20 57 65 20 63 61 6e 20 74 );.+./* We can t
56f0: 72 75 6e 63 61 74 65 20 73 61 66 65 6c 79 20 74 runcate safely t
5700: 6f 20 49 4e 54 5f 4d 41 58 2c 20 74 68 65 20 72 o INT_MAX, the r
5710: 61 6e 67 65 20 63 6f 6d 6d 61 6e 64 0a 2b 09 20 ange command.+.
5720: 2a 20 77 69 6c 6c 20 61 6c 77 61 79 73 20 72 65 * will always re
5730: 74 75 72 6e 20 61 6e 20 65 72 72 6f 72 20 66 6f turn an error fo
5740: 72 20 61 20 73 75 63 68 20 6c 6f 6e 67 20 72 61 r a such long ra
5750: 6e 67 65 0a 2b 09 20 2a 20 62 65 63 61 75 73 65 nge.+. * because
5760: 20 54 63 6c 20 6c 69 73 74 73 20 63 61 6e 27 74 Tcl lists can't
5770: 20 62 65 20 73 6f 20 6c 6f 6e 67 2e 20 2a 2f 0a be so long. */.
5780: 2b 09 69 66 20 28 6c 65 6e 20 3e 20 49 4e 54 5f +.if (len > INT_
5790: 4d 41 58 29 20 6c 65 6e 20 3d 20 49 4e 54 5f 4d MAX) len = INT_M
57a0: 41 58 3b 0a 2b 09 72 65 74 75 72 6e 20 28 69 6e AX;.+.return (in
57b0: 74 29 28 28 6c 65 6e 20 3c 20 30 29 20 3f 20 2d t)((len < 0) ? -
57c0: 31 20 3a 20 6c 65 6e 29 3b 0a 2b 7d 0a 2b 0a 2b 1 : len);.+}.+.+
57d0: 2f 2a 0a 2b 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d /*.+ *----------
57e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
57f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
5800: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
5810: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 2b 20 2a ------------.+ *
5820: 0a 2b 20 2a 20 54 63 6c 5f 4e 65 77 41 72 69 74 .+ * Tcl_NewArit
5830: 68 53 65 72 69 65 73 4f 62 6a 20 2d 2d 0a 2b 20 hSeriesObj --.+
5840: 2a 0a 2b 20 2a 09 43 72 65 61 74 65 73 20 61 20 *.+ *.Creates a
5850: 6e 65 77 20 41 72 69 74 68 53 65 72 69 65 73 20 new ArithSeries
5860: 6f 62 6a 65 63 74 2e 20 54 68 65 20 72 65 74 75 object. The retu
5870: 72 6e 65 64 20 6f 62 6a 65 63 74 20 68 61 73 0a rned object has.
5880: 2b 20 2a 09 72 65 66 63 6f 75 6e 74 20 3d 20 30 + *.refcount = 0
5890: 2e 0a 2b 20 2a 0a 2b 20 2a 20 52 65 73 75 6c 74 ..+ *.+ * Result
58a0: 73 3a 0a 2b 20 2a 0a 2b 20 2a 20 09 41 20 54 63 s:.+ *.+ * .A Tc
58b0: 6c 5f 4f 62 6a 20 70 6f 69 6e 74 65 72 20 74 6f l_Obj pointer to
58c0: 20 74 68 65 20 63 72 65 61 74 65 64 20 41 72 69 the created Ari
58d0: 74 68 53 65 72 69 65 73 20 6f 62 6a 65 63 74 2e thSeries object.
58e0: 0a 2b 20 2a 20 09 41 20 4e 55 4c 4c 20 70 6f 69 .+ * .A NULL poi
58f0: 6e 74 65 72 20 6f 66 20 74 68 65 20 72 61 6e 67 nter of the rang
5900: 65 20 69 73 20 69 6e 76 61 6c 69 64 2e 0a 2b 20 e is invalid..+
5910: 2a 0a 2b 20 2a 20 53 69 64 65 20 45 66 66 65 63 *.+ * Side Effec
5920: 74 73 3a 0a 2b 20 2a 0a 2b 20 2a 20 09 4e 6f 6e ts:.+ *.+ * .Non
5930: 65 2e 0a 2b 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d e..+ *----------
5940: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
5950: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
5960: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
5970: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 2b 20 2a ------------.+ *
5980: 2f 0a 2b 54 63 6c 5f 4f 62 6a 20 2a 0a 2b 54 63 /.+Tcl_Obj *.+Tc
5990: 6c 5f 4e 65 77 41 72 69 74 68 53 65 72 69 65 73 l_NewArithSeries
59a0: 4f 62 6a 28 54 63 6c 5f 57 69 64 65 49 6e 74 20 Obj(Tcl_WideInt
59b0: 73 74 61 72 74 2c 20 54 63 6c 5f 57 69 64 65 49 start, Tcl_WideI
59c0: 6e 74 20 65 6e 64 2c 20 54 63 6c 5f 57 69 64 65 nt end, Tcl_Wide
59d0: 49 6e 74 20 73 74 65 70 29 0a 2b 7b 0a 2b 20 20 Int step).+{.+
59e0: 20 20 69 6e 74 20 6c 65 6e 20 3d 20 41 72 69 74 int len = Arit
59f0: 68 53 65 72 69 65 73 4c 65 6e 28 73 74 61 72 74 hSeriesLen(start
5a00: 2c 20 65 6e 64 2c 20 73 74 65 70 29 3b 0a 2b 20 , end, step);.+
5a10: 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 61 72 69 74 Tcl_Obj *arit
5a20: 68 53 65 72 69 65 73 50 74 72 3b 0a 2b 20 20 20 hSeriesPtr;.+
5a30: 20 41 72 69 74 68 53 65 72 69 65 73 20 2a 61 72 ArithSeries *ar
5a40: 69 74 68 53 65 72 69 65 73 52 65 70 50 74 72 3b ithSeriesRepPtr;
5a50: 0a 2b 0a 2b 20 20 20 20 69 66 20 28 6c 65 6e 20 .+.+ if (len
5a60: 3d 3d 20 2d 31 29 20 72 65 74 75 72 6e 20 4e 55 == -1) return NU
5a70: 4c 4c 3b 20 2f 2a 20 49 6e 76 61 6c 69 64 20 72 LL; /* Invalid r
5a80: 61 6e 67 65 20 65 72 72 6f 72 20 2a 2f 0a 2b 20 ange error */.+
5a90: 20 20 20 54 63 6c 4e 65 77 4f 62 6a 28 61 72 69 TclNewObj(ari
5aa0: 74 68 53 65 72 69 65 73 50 74 72 29 3b 0a 2b 0a thSeriesPtr);.+.
5ab0: 2b 20 20 20 20 61 72 69 74 68 53 65 72 69 65 73 + arithSeries
5ac0: 52 65 70 50 74 72 20 3d 20 28 41 72 69 74 68 53 RepPtr = (ArithS
5ad0: 65 72 69 65 73 2a 29 20 63 6b 61 6c 6c 6f 63 28 eries*) ckalloc(
5ae0: 73 69 7a 65 6f 66 20 28 41 72 69 74 68 53 65 72 sizeof (ArithSer
5af0: 69 65 73 29 29 3b 0a 2b 20 20 20 20 61 72 69 74 ies));.+ arit
5b00: 68 53 65 72 69 65 73 52 65 70 50 74 72 2d 3e 66 hSeriesRepPtr->f
5b10: 6c 61 67 73 20 3d 20 30 3b 0a 2b 20 20 20 20 69 lags = 0;.+ i
5b20: 66 20 28 73 74 61 72 74 20 3e 20 49 4e 54 5f 4d f (start > INT_M
5b30: 41 58 20 7c 7c 0a 2b 09 73 74 61 72 74 20 3c 20 AX ||.+.start <
5b40: 49 4e 54 5f 4d 49 4e 20 7c 7c 0a 2b 09 65 6e 64 INT_MIN ||.+.end
5b50: 20 3e 20 49 4e 54 5f 4d 41 58 20 7c 7c 0a 2b 09 > INT_MAX ||.+.
5b60: 65 6e 64 20 3c 20 49 4e 54 5f 4d 49 4e 29 0a 2b end < INT_MIN).+
5b70: 20 20 20 20 7b 0a 2b 09 20 20 20 20 61 72 69 74 {.+. arit
5b80: 68 53 65 72 69 65 73 52 65 70 50 74 72 2d 3e 66 hSeriesRepPtr->f
5b90: 6c 61 67 73 20 3d 20 54 43 4c 5f 41 52 49 54 48 lags = TCL_ARITH
5ba0: 53 45 52 49 45 53 5f 49 53 5f 57 49 44 45 3b 0a SERIES_IS_WIDE;.
5bb0: 2b 09 20 20 20 20 61 72 69 74 68 53 65 72 69 65 +. arithSerie
5bc0: 73 52 65 70 50 74 72 2d 3e 73 74 61 72 74 2e 77 sRepPtr->start.w
5bd0: 20 3d 20 73 74 61 72 74 3b 0a 2b 09 20 20 20 20 = start;.+.
5be0: 61 72 69 74 68 53 65 72 69 65 73 52 65 70 50 74 arithSeriesRepPt
5bf0: 72 2d 3e 65 6e 64 2e 77 20 3d 20 65 6e 64 3b 0a r->end.w = end;.
5c00: 2b 09 20 20 20 20 61 72 69 74 68 53 65 72 69 65 +. arithSerie
5c10: 73 52 65 70 50 74 72 2d 3e 73 74 65 70 2e 77 20 sRepPtr->step.w
5c20: 3d 20 73 74 65 70 3b 0a 2b 20 20 20 20 7d 20 65 = step;.+ } e
5c30: 6c 73 65 20 7b 0a 2b 09 20 20 20 20 61 72 69 74 lse {.+. arit
5c40: 68 53 65 72 69 65 73 52 65 70 50 74 72 2d 3e 73 hSeriesRepPtr->s
5c50: 74 61 72 74 2e 69 20 3d 20 73 74 61 72 74 3b 0a tart.i = start;.
5c60: 2b 09 20 20 20 20 61 72 69 74 68 53 65 72 69 65 +. arithSerie
5c70: 73 52 65 70 50 74 72 2d 3e 65 6e 64 2e 69 20 3d sRepPtr->end.i =
5c80: 20 65 6e 64 3b 0a 2b 09 20 20 20 20 61 72 69 74 end;.+. arit
5c90: 68 53 65 72 69 65 73 52 65 70 50 74 72 2d 3e 73 hSeriesRepPtr->s
5ca0: 74 65 70 2e 69 20 3d 20 73 74 65 70 3b 0a 2b 20 tep.i = step;.+
5cb0: 20 20 20 7d 0a 2b 20 20 20 20 61 72 69 74 68 53 }.+ arithS
5cc0: 65 72 69 65 73 52 65 70 50 74 72 2d 3e 6c 65 6e eriesRepPtr->len
5cd0: 20 3d 20 6c 65 6e 3b 0a 2b 20 20 20 20 61 72 69 = len;.+ ari
5ce0: 74 68 53 65 72 69 65 73 50 74 72 2d 3e 69 6e 74 thSeriesPtr->int
5cf0: 65 72 6e 61 6c 52 65 70 2e 74 77 6f 50 74 72 56 ernalRep.twoPtrV
5d00: 61 6c 75 65 2e 70 74 72 31 20 3d 20 28 56 4f 49 alue.ptr1 = (VOI
5d10: 44 20 2a 29 20 61 72 69 74 68 53 65 72 69 65 73 D *) arithSeries
5d20: 52 65 70 50 74 72 3b 0a 2b 20 20 20 20 61 72 69 RepPtr;.+ ari
5d30: 74 68 53 65 72 69 65 73 50 74 72 2d 3e 69 6e 74 thSeriesPtr->int
5d40: 65 72 6e 61 6c 52 65 70 2e 74 77 6f 50 74 72 56 ernalRep.twoPtrV
5d50: 61 6c 75 65 2e 70 74 72 32 20 3d 20 4e 55 4c 4c alue.ptr2 = NULL
5d60: 3b 0a 2b 20 20 20 20 61 72 69 74 68 53 65 72 69 ;.+ arithSeri
5d70: 65 73 50 74 72 2d 3e 74 79 70 65 50 74 72 20 3d esPtr->typePtr =
5d80: 20 26 74 63 6c 41 72 69 74 68 53 65 72 69 65 73 &tclArithSeries
5d90: 54 79 70 65 3b 0a 2b 20 20 20 20 69 66 20 28 6c Type;.+ if (l
5da0: 65 6e 20 3e 20 30 29 0a 2b 20 20 20 20 09 54 63 en > 0).+ .Tc
5db0: 6c 5f 49 6e 76 61 6c 69 64 61 74 65 53 74 72 69 l_InvalidateStri
5dc0: 6e 67 52 65 70 28 61 72 69 74 68 53 65 72 69 65 ngRep(arithSerie
5dd0: 73 50 74 72 29 3b 0a 2b 0a 2b 20 20 20 20 72 65 sPtr);.+.+ re
5de0: 74 75 72 6e 20 61 72 69 74 68 53 65 72 69 65 73 turn arithSeries
5df0: 50 74 72 3b 0a 2b 7d 0a 2b 0a 2b 2f 2a 0a 2b 20 Ptr;.+}.+.+/*.+
5e00: 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d *---------------
5e10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
5e20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
5e30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
5e40: 2d 2d 2d 2d 2d 2d 2d 0a 2b 20 2a 0a 2b 20 2a 20 -------.+ *.+ *
5e50: 54 63 6c 5f 41 72 69 74 68 53 65 72 69 65 73 4f Tcl_ArithSeriesO
5e60: 62 6a 49 6e 64 65 78 20 2d 2d 0a 2b 20 2a 0a 2b bjIndex --.+ *.+
5e70: 20 2a 09 52 65 74 75 72 6e 73 20 74 68 65 20 65 *.Returns the e
5e80: 6c 65 6d 65 6e 74 20 77 69 74 68 20 74 68 65 20 lement with the
5e90: 73 70 65 63 69 66 69 65 64 20 69 6e 64 65 78 20 specified index
5ea0: 69 6e 20 74 68 65 20 6c 69 73 74 0a 2b 20 2a 09 in the list.+ *.
5eb0: 72 65 70 72 65 73 65 6e 74 65 64 20 62 79 20 74 represented by t
5ec0: 68 65 20 73 70 65 63 69 66 69 65 64 20 41 72 69 he specified Ari
5ed0: 74 68 6d 65 6e 74 69 63 20 53 65 71 75 65 6e 63 thmentic Sequenc
5ee0: 65 20 6f 62 6a 65 63 74 2e 0a 2b 20 2a 09 49 66 e object..+ *.If
5ef0: 20 74 68 65 20 69 6e 64 65 78 20 69 73 20 6f 75 the index is ou
5f00: 74 20 6f 66 20 72 61 6e 67 65 2c 20 54 43 4c 5f t of range, TCL_
5f10: 45 52 52 4f 52 20 69 73 20 72 65 74 75 72 6e 65 ERROR is returne
5f20: 64 2c 0a 2b 20 2a 09 6f 74 68 65 72 77 69 73 65 d,.+ *.otherwise
5f30: 20 54 43 4c 5f 4f 4b 20 69 73 20 72 65 74 75 72 TCL_OK is retur
5f40: 6e 65 64 20 61 6e 64 20 74 68 65 20 69 6e 74 65 ned and the inte
5f50: 67 65 72 20 76 61 6c 75 65 20 6f 66 20 74 68 65 ger value of the
5f60: 0a 2b 20 2a 09 65 6c 65 6d 65 6e 74 20 69 73 20 .+ *.element is
5f70: 73 74 6f 72 65 64 20 69 6e 20 2a 65 6c 65 6d 65 stored in *eleme
5f80: 6e 74 2e 0a 2b 20 2a 0a 2b 20 2a 20 52 65 73 75 nt..+ *.+ * Resu
5f90: 6c 74 73 3a 0a 2b 20 2a 0a 2b 20 2a 20 09 54 43 lts:.+ *.+ * .TC
5fa0: 4c 5f 4f 4b 20 6f 6e 20 73 75 63 63 65 73 2c 20 L_OK on succes,
5fb0: 54 43 4c 5f 45 52 52 4f 52 20 6f 6e 20 69 6e 64 TCL_ERROR on ind
5fc0: 65 78 20 6f 75 74 20 6f 66 20 72 61 6e 67 65 2e ex out of range.
5fd0: 0a 2b 20 2a 0a 2b 20 2a 20 53 69 64 65 20 45 66 .+ *.+ * Side Ef
5fe0: 66 65 63 74 73 3a 0a 2b 20 2a 0a 2b 20 2a 20 09 fects:.+ *.+ * .
5ff0: 4f 6e 20 73 75 63 63 65 73 73 2c 20 74 68 65 20 On success, the
6000: 69 6e 74 65 67 65 72 20 70 6f 69 6e 74 65 64 20 integer pointed
6010: 62 79 20 2a 65 6c 65 6d 65 6e 74 20 69 73 20 6d by *element is m
6020: 6f 64 69 66 69 65 64 2e 0a 2b 20 2a 0a 2b 20 2a odified..+ *.+ *
6030: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
6040: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
6050: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
6060: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
6070: 2d 2d 2d 2d 2d 2d 0a 2b 20 2a 2f 0a 2b 0a 2b 69 ------.+ */.+.+i
6080: 6e 74 0a 2b 54 63 6c 5f 41 72 69 74 68 53 65 72 nt.+Tcl_ArithSer
6090: 69 65 73 4f 62 6a 49 6e 64 65 78 28 54 63 6c 5f iesObjIndex(Tcl_
60a0: 4f 62 6a 20 2a 61 72 69 74 68 53 65 72 69 65 73 Obj *arithSeries
60b0: 50 74 72 2c 20 69 6e 74 20 69 6e 64 65 78 2c 20 Ptr, int index,
60c0: 54 63 6c 5f 57 69 64 65 49 6e 74 20 2a 65 6c 65 Tcl_WideInt *ele
60d0: 6d 65 6e 74 29 0a 2b 7b 0a 2b 20 20 20 20 41 72 ment).+{.+ Ar
60e0: 69 74 68 53 65 72 69 65 73 20 2a 61 72 69 74 68 ithSeries *arith
60f0: 53 65 72 69 65 73 52 65 70 50 74 72 3b 0a 2b 0a SeriesRepPtr;.+.
6100: 2b 20 20 20 20 69 66 20 28 61 72 69 74 68 53 65 + if (arithSe
6110: 72 69 65 73 50 74 72 2d 3e 74 79 70 65 50 74 72 riesPtr->typePtr
6120: 20 21 3d 20 26 74 63 6c 41 72 69 74 68 53 65 72 != &tclArithSer
6130: 69 65 73 54 79 70 65 29 20 7b 0a 2b 20 20 20 20 iesType) {.+
6140: 20 20 20 20 54 63 6c 5f 50 61 6e 69 63 28 22 54 Tcl_Panic("T
6150: 63 6c 5f 41 72 69 74 68 53 65 72 69 65 73 4f 62 cl_ArithSeriesOb
6160: 6a 49 6e 64 65 78 20 63 61 6c 6c 65 64 20 77 69 jIndex called wi
6170: 74 68 20 61 20 6e 6f 74 20 41 72 69 74 68 53 65 th a not ArithSe
6180: 72 69 65 73 20 4f 62 6a 2e 22 29 3b 0a 2b 20 20 ries Obj.");.+
6190: 20 20 7d 0a 2b 20 20 20 20 61 72 69 74 68 53 65 }.+ arithSe
61a0: 72 69 65 73 52 65 70 50 74 72 20 3d 20 28 41 72 riesRepPtr = (Ar
61b0: 69 74 68 53 65 72 69 65 73 2a 29 0a 2b 09 20 20 ithSeries*).+.
61c0: 20 20 61 72 69 74 68 53 65 72 69 65 73 50 74 72 arithSeriesPtr
61d0: 2d 3e 69 6e 74 65 72 6e 61 6c 52 65 70 2e 74 77 ->internalRep.tw
61e0: 6f 50 74 72 56 61 6c 75 65 2e 70 74 72 31 3b 0a oPtrValue.ptr1;.
61f0: 2b 20 20 20 20 69 66 20 28 69 6e 64 65 78 20 3c + if (index <
6200: 20 30 20 7c 7c 20 69 6e 64 65 78 20 3e 3d 20 61 0 || index >= a
6210: 72 69 74 68 53 65 72 69 65 73 52 65 70 50 74 72 rithSeriesRepPtr
6220: 2d 3e 6c 65 6e 29 0a 2b 09 20 20 20 20 72 65 74 ->len).+. ret
6230: 75 72 6e 20 54 43 4c 5f 45 52 52 4f 52 3b 0a 2b urn TCL_ERROR;.+
6240: 20 20 20 20 2f 2a 20 4c 69 73 74 5b 69 5d 20 3d /* List[i] =
6250: 20 53 74 61 72 74 20 2b 20 28 53 74 65 70 20 2a Start + (Step *
6260: 20 69 29 20 2a 2f 0a 2b 20 20 20 20 69 66 20 28 i) */.+ if (
6270: 61 72 69 74 68 53 65 72 69 65 73 52 65 70 50 74 arithSeriesRepPt
6280: 72 2d 3e 66 6c 61 67 73 20 26 20 54 43 4c 5f 41 r->flags & TCL_A
6290: 52 49 54 48 53 45 52 49 45 53 5f 49 53 5f 57 49 RITHSERIES_IS_WI
62a0: 44 45 29 0a 2b 20 20 20 20 20 20 20 20 2a 65 6c DE).+ *el
62b0: 65 6d 65 6e 74 20 3d 20 61 72 69 74 68 53 65 72 ement = arithSer
62c0: 69 65 73 52 65 70 50 74 72 2d 3e 73 74 61 72 74 iesRepPtr->start
62d0: 2e 77 2b 28 69 6e 64 65 78 2a 61 72 69 74 68 53 .w+(index*arithS
62e0: 65 72 69 65 73 52 65 70 50 74 72 2d 3e 73 74 65 eriesRepPtr->ste
62f0: 70 2e 77 29 3b 0a 2b 20 20 20 20 65 6c 73 65 0a p.w);.+ else.
6300: 2b 20 20 20 20 20 20 20 20 2a 65 6c 65 6d 65 6e + *elemen
6310: 74 20 3d 20 61 72 69 74 68 53 65 72 69 65 73 52 t = arithSeriesR
6320: 65 70 50 74 72 2d 3e 73 74 61 72 74 2e 69 2b 28 epPtr->start.i+(
6330: 69 6e 64 65 78 2a 61 72 69 74 68 53 65 72 69 65 index*arithSerie
6340: 73 52 65 70 50 74 72 2d 3e 73 74 65 70 2e 69 29 sRepPtr->step.i)
6350: 3b 0a 2b 20 20 20 20 72 65 74 75 72 6e 20 54 43 ;.+ return TC
6360: 4c 5f 4f 4b 3b 0a 2b 7d 0a 2b 0a 2b 2f 2a 0a 2b L_OK;.+}.+.+/*.+
6370: 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d *--------------
6380: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
6390: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
63a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
63b0: 2d 2d 2d 2d 2d 2d 2d 2d 0a 2b 20 2a 0a 2b 20 2a --------.+ *.+ *
63c0: 20 54 63 6c 5f 41 72 69 74 68 53 65 72 69 65 73 Tcl_ArithSeries
63d0: 4f 62 6a 4c 65 6e 67 74 68 0a 2b 20 2a 0a 2b 20 ObjLength.+ *.+
63e0: 2a 09 52 65 74 75 72 6e 73 20 74 68 65 20 6c 65 *.Returns the le
63f0: 6e 67 74 68 20 6f 66 20 74 68 65 20 61 72 69 74 ngth of the arit
6400: 68 6d 65 6e 74 69 63 20 73 65 72 69 65 73 2e 0a hmentic series..
6410: 2b 20 2a 0a 2b 20 2a 20 52 65 73 75 6c 74 73 3a + *.+ * Results:
6420: 0a 2b 20 2a 0a 2b 20 2a 20 09 54 68 65 20 6c 65 .+ *.+ * .The le
6430: 6e 67 74 68 20 6f 66 20 74 68 65 20 73 65 72 69 ngth of the seri
6440: 65 73 2e 0a 2b 20 2a 0a 2b 20 2a 20 53 69 64 65 es..+ *.+ * Side
6450: 20 45 66 66 65 63 74 73 3a 0a 2b 20 2a 0a 2b 20 Effects:.+ *.+
6460: 2a 20 09 4e 6f 6e 65 2e 0a 2b 20 2a 0a 2b 20 2a * .None..+ *.+ *
6470: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
6480: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
6490: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
64a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
64b0: 2d 2d 2d 2d 2d 2d 0a 2b 20 2a 2f 0a 2b 69 6e 74 ------.+ */.+int
64c0: 20 54 63 6c 5f 41 72 69 74 68 53 65 72 69 65 73 Tcl_ArithSeries
64d0: 4f 62 6a 4c 65 6e 67 74 68 28 54 63 6c 5f 4f 62 ObjLength(Tcl_Ob
64e0: 6a 20 2a 61 72 69 74 68 53 65 72 69 65 73 50 74 j *arithSeriesPt
64f0: 72 29 0a 2b 7b 0a 2b 20 20 20 20 41 72 69 74 68 r).+{.+ Arith
6500: 53 65 72 69 65 73 20 2a 61 72 69 74 68 53 65 72 Series *arithSer
6510: 69 65 73 52 65 70 50 74 72 20 3d 20 28 41 72 69 iesRepPtr = (Ari
6520: 74 68 53 65 72 69 65 73 2a 29 0a 2b 09 20 20 20 thSeries*).+.
6530: 20 61 72 69 74 68 53 65 72 69 65 73 50 74 72 2d arithSeriesPtr-
6540: 3e 69 6e 74 65 72 6e 61 6c 52 65 70 2e 74 77 6f >internalRep.two
6550: 50 74 72 56 61 6c 75 65 2e 70 74 72 31 3b 0a 2b PtrValue.ptr1;.+
6560: 20 20 20 20 72 65 74 75 72 6e 20 61 72 69 74 68 return arith
6570: 53 65 72 69 65 73 52 65 70 50 74 72 2d 3e 6c 65 SeriesRepPtr->le
6580: 6e 3b 0a 2b 7d 0a 2b 0a 2b 2f 2a 0a 2b 20 2a 2d n;.+}.+.+/*.+ *-
6590: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
65a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
65b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
65c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
65d0: 2d 2d 2d 2d 2d 0a 2b 20 2a 0a 2b 20 2a 20 46 72 -----.+ *.+ * Fr
65e0: 65 65 41 72 69 74 68 53 65 72 69 65 73 49 6e 74 eeArithSeriesInt
65f0: 65 72 6e 61 6c 52 65 70 20 2d 2d 0a 2b 20 2a 0a ernalRep --.+ *.
6600: 2b 20 2a 09 44 65 61 6c 6c 6f 63 61 74 65 20 74 + *.Deallocate t
6610: 68 65 20 73 74 6f 72 61 67 65 20 61 73 73 6f 63 he storage assoc
6620: 69 61 74 65 64 20 77 69 74 68 20 61 6e 20 61 72 iated with an ar
6630: 69 74 68 73 65 72 69 65 73 20 6f 62 6a 65 63 74 ithseries object
6640: 27 73 0a 2b 20 2a 09 69 6e 74 65 72 6e 61 6c 20 's.+ *.internal
6650: 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 2e 0a representation..
6660: 2b 20 2a 0a 2b 20 2a 20 52 65 73 75 6c 74 73 3a + *.+ * Results:
6670: 0a 2b 20 2a 09 4e 6f 6e 65 2e 0a 2b 20 2a 0a 2b .+ *.None..+ *.+
6680: 20 2a 20 53 69 64 65 20 65 66 66 65 63 74 73 3a * Side effects:
6690: 0a 2b 20 2a 09 46 72 65 65 73 20 61 72 69 74 68 .+ *.Frees arith
66a0: 53 65 72 69 65 73 50 74 72 27 73 20 41 72 69 74 SeriesPtr's Arit
66b0: 68 53 65 72 69 65 73 2a 20 69 6e 74 65 72 6e 61 hSeries* interna
66c0: 6c 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e l representation
66d0: 20 61 6e 64 0a 2b 20 2a 09 73 65 74 73 20 6c 69 and.+ *.sets li
66e0: 73 74 50 74 72 27 73 09 69 6e 74 65 72 6e 61 6c stPtr's.internal
66f0: 52 65 70 2e 74 77 6f 50 74 72 56 61 6c 75 65 2e Rep.twoPtrValue.
6700: 70 74 72 31 20 74 6f 20 4e 55 4c 4c 2e 0a 2b 20 ptr1 to NULL..+
6710: 2a 0a 2b 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d *.+ *-----------
6720: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
6730: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
6740: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
6750: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 2b 20 2a 2f -----------.+ */
6760: 0a 2b 0a 2b 73 74 61 74 69 63 20 76 6f 69 64 0a .+.+static void.
6770: 2b 46 72 65 65 41 72 69 74 68 53 65 72 69 65 73 +FreeArithSeries
6780: 49 6e 74 65 72 6e 61 6c 52 65 70 28 54 63 6c 5f InternalRep(Tcl_
6790: 4f 62 6a 20 2a 61 72 69 74 68 53 65 72 69 65 73 Obj *arithSeries
67a0: 50 74 72 29 0a 2b 7b 0a 2b 20 20 20 20 41 72 69 Ptr).+{.+ Ari
67b0: 74 68 53 65 72 69 65 73 20 2a 61 72 69 74 68 53 thSeries *arithS
67c0: 65 72 69 65 73 52 65 70 50 74 72 20 3d 0a 2b 09 eriesRepPtr =.+.
67d0: 20 20 20 20 28 41 72 69 74 68 53 65 72 69 65 73 (ArithSeries
67e0: 20 2a 29 20 61 72 69 74 68 53 65 72 69 65 73 50 *) arithSeriesP
67f0: 74 72 2d 3e 69 6e 74 65 72 6e 61 6c 52 65 70 2e tr->internalRep.
6800: 74 77 6f 50 74 72 56 61 6c 75 65 2e 70 74 72 31 twoPtrValue.ptr1
6810: 3b 0a 2b 20 20 20 20 63 6b 66 72 65 65 28 28 63 ;.+ ckfree((c
6820: 68 61 72 20 2a 29 20 61 72 69 74 68 53 65 72 69 har *) arithSeri
6830: 65 73 52 65 70 50 74 72 29 3b 0a 2b 20 20 20 20 esRepPtr);.+
6840: 61 72 69 74 68 53 65 72 69 65 73 50 74 72 2d 3e arithSeriesPtr->
6850: 69 6e 74 65 72 6e 61 6c 52 65 70 2e 74 77 6f 50 internalRep.twoP
6860: 74 72 56 61 6c 75 65 2e 70 74 72 31 20 3d 20 4e trValue.ptr1 = N
6870: 55 4c 4c 3b 0a 2b 7d 0a 2b 0a 2b 2f 2a 0a 2b 20 ULL;.+}.+.+/*.+
6880: 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d *---------------
6890: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
68a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
68b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
68c0: 2d 2d 2d 2d 2d 2d 2d 0a 2b 20 2a 0a 2b 20 2a 20 -------.+ *.+ *
68d0: 44 75 70 41 72 69 74 68 53 65 72 69 65 73 49 6e DupArithSeriesIn
68e0: 74 65 72 6e 61 6c 52 65 70 20 2d 2d 0a 2b 20 2a ternalRep --.+ *
68f0: 0a 2b 20 2a 09 49 6e 69 74 69 61 6c 69 7a 65 20 .+ *.Initialize
6900: 74 68 65 20 69 6e 74 65 72 6e 61 6c 20 72 65 70 the internal rep
6910: 72 65 73 65 6e 74 61 74 69 6f 6e 20 6f 66 20 61 resentation of a
6920: 20 61 72 69 74 68 73 65 72 69 65 73 20 54 63 6c arithseries Tcl
6930: 5f 4f 62 6a 20 74 6f 20 61 0a 2b 20 2a 09 63 6f _Obj to a.+ *.co
6940: 70 79 20 6f 66 20 74 68 65 20 69 6e 74 65 72 6e py of the intern
6950: 61 6c 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f al representatio
6960: 6e 20 6f 66 20 61 6e 20 65 78 69 73 74 69 6e 67 n of an existing
6970: 20 61 72 69 74 68 73 65 72 69 65 73 20 6f 62 6a arithseries obj
6980: 65 63 74 2e 20 0a 2b 20 2a 0a 2b 20 2a 20 52 65 ect. .+ *.+ * Re
6990: 73 75 6c 74 73 3a 0a 2b 20 2a 09 4e 6f 6e 65 2e sults:.+ *.None.
69a0: 0a 2b 20 2a 0a 2b 20 2a 20 53 69 64 65 20 65 66 .+ *.+ * Side ef
69b0: 66 65 63 74 73 3a 0a 2b 20 2a 09 57 65 20 73 65 fects:.+ *.We se
69c0: 74 20 22 63 6f 70 79 50 74 72 22 73 20 69 6e 74 t "copyPtr"s int
69d0: 65 72 6e 61 6c 20 72 65 70 20 74 6f 20 61 20 70 ernal rep to a p
69e0: 6f 69 6e 74 65 72 20 74 6f 20 61 0a 2b 20 2a 09 ointer to a.+ *.
69f0: 6e 65 77 6c 79 20 61 6c 6c 6f 63 61 74 65 64 20 newly allocated
6a00: 41 72 69 74 68 53 65 72 69 65 73 20 73 74 72 75 ArithSeries stru
6a10: 63 74 75 72 65 2e 0a 2b 20 2a 2d 2d 2d 2d 2d 2d cture..+ *------
6a20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
6a30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
6a40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
6a50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
6a60: 0a 2b 20 2a 2f 0a 2b 0a 2b 73 74 61 74 69 63 20 .+ */.+.+static
6a70: 76 6f 69 64 0a 2b 44 75 70 41 72 69 74 68 53 65 void.+DupArithSe
6a80: 72 69 65 73 49 6e 74 65 72 6e 61 6c 52 65 70 28 riesInternalRep(
6a90: 73 72 63 50 74 72 2c 20 63 6f 70 79 50 74 72 29 srcPtr, copyPtr)
6aa0: 0a 2b 20 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 73 .+ Tcl_Obj *s
6ab0: 72 63 50 74 72 3b 09 09 2f 2a 20 4f 62 6a 65 63 rcPtr;../* Objec
6ac0: 74 20 77 69 74 68 20 69 6e 74 65 72 6e 61 6c 20 t with internal
6ad0: 72 65 70 20 74 6f 20 63 6f 70 79 2e 20 2a 2f 0a rep to copy. */.
6ae0: 2b 20 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 63 6f + Tcl_Obj *co
6af0: 70 79 50 74 72 3b 09 09 2f 2a 20 4f 62 6a 65 63 pyPtr;../* Objec
6b00: 74 20 77 69 74 68 20 69 6e 74 65 72 6e 61 6c 20 t with internal
6b10: 72 65 70 20 74 6f 20 73 65 74 2e 20 2a 2f 0a 2b rep to set. */.+
6b20: 7b 0a 2b 20 20 20 20 41 72 69 74 68 53 65 72 69 {.+ ArithSeri
6b30: 65 73 20 2a 73 72 63 41 72 69 74 68 53 65 72 69 es *srcArithSeri
6b40: 65 73 52 65 70 50 74 72 20 3d 0a 2b 09 20 20 20 esRepPtr =.+.
6b50: 20 28 41 72 69 74 68 53 65 72 69 65 73 20 2a 29 (ArithSeries *)
6b60: 20 73 72 63 50 74 72 2d 3e 69 6e 74 65 72 6e 61 srcPtr->interna
6b70: 6c 52 65 70 2e 74 77 6f 50 74 72 56 61 6c 75 65 lRep.twoPtrValue
6b80: 2e 70 74 72 31 3b 0a 2b 20 20 20 20 41 72 69 74 .ptr1;.+ Arit
6b90: 68 53 65 72 69 65 73 20 2a 63 6f 70 79 41 72 69 hSeries *copyAri
6ba0: 74 68 53 65 72 69 65 73 52 65 70 50 74 72 3b 0a thSeriesRepPtr;.
6bb0: 2b 0a 2b 20 20 20 20 2f 2a 0a 2b 20 20 20 20 20 +.+ /*.+
6bc0: 2a 20 41 6c 6c 6f 63 61 74 65 20 61 20 6e 65 77 * Allocate a new
6bd0: 20 41 72 69 74 68 53 65 72 69 65 73 20 73 74 72 ArithSeries str
6be0: 75 63 74 75 72 65 2e 20 2a 2f 0a 2b 0a 2b 20 20 ucture. */.+.+
6bf0: 20 20 63 6f 70 79 41 72 69 74 68 53 65 72 69 65 copyArithSerie
6c00: 73 52 65 70 50 74 72 20 3d 20 28 41 72 69 74 68 sRepPtr = (Arith
6c10: 53 65 72 69 65 73 2a 29 20 63 6b 61 6c 6c 6f 63 Series*) ckalloc
6c20: 28 73 69 7a 65 6f 66 28 41 72 69 74 68 53 65 72 (sizeof(ArithSer
6c30: 69 65 73 29 29 3b 0a 2b 20 20 20 20 63 6f 70 79 ies));.+ copy
6c40: 41 72 69 74 68 53 65 72 69 65 73 52 65 70 50 74 ArithSeriesRepPt
6c50: 72 2d 3e 73 74 61 72 74 20 3d 20 73 72 63 41 72 r->start = srcAr
6c60: 69 74 68 53 65 72 69 65 73 52 65 70 50 74 72 2d ithSeriesRepPtr-
6c70: 3e 73 74 61 72 74 3b 0a 2b 20 20 20 20 63 6f 70 >start;.+ cop
6c80: 79 41 72 69 74 68 53 65 72 69 65 73 52 65 70 50 yArithSeriesRepP
6c90: 74 72 2d 3e 65 6e 64 20 3d 20 73 72 63 41 72 69 tr->end = srcAri
6ca0: 74 68 53 65 72 69 65 73 52 65 70 50 74 72 2d 3e thSeriesRepPtr->
6cb0: 65 6e 64 3b 0a 2b 20 20 20 20 63 6f 70 79 41 72 end;.+ copyAr
6cc0: 69 74 68 53 65 72 69 65 73 52 65 70 50 74 72 2d ithSeriesRepPtr-
6cd0: 3e 73 74 65 70 20 3d 20 73 72 63 41 72 69 74 68 >step = srcArith
6ce0: 53 65 72 69 65 73 52 65 70 50 74 72 2d 3e 73 74 SeriesRepPtr->st
6cf0: 65 70 3b 0a 2b 20 20 20 20 63 6f 70 79 41 72 69 ep;.+ copyAri
6d00: 74 68 53 65 72 69 65 73 52 65 70 50 74 72 2d 3e thSeriesRepPtr->
6d10: 6c 65 6e 20 3d 20 73 72 63 41 72 69 74 68 53 65 len = srcArithSe
6d20: 72 69 65 73 52 65 70 50 74 72 2d 3e 6c 65 6e 3b riesRepPtr->len;
6d30: 0a 2b 20 20 20 20 63 6f 70 79 41 72 69 74 68 53 .+ copyArithS
6d40: 65 72 69 65 73 52 65 70 50 74 72 2d 3e 66 6c 61 eriesRepPtr->fla
6d50: 67 73 20 3d 20 73 72 63 41 72 69 74 68 53 65 72 gs = srcArithSer
6d60: 69 65 73 52 65 70 50 74 72 2d 3e 66 6c 61 67 73 iesRepPtr->flags
6d70: 3b 0a 2b 0a 2b 20 20 20 20 63 6f 70 79 50 74 72 ;.+.+ copyPtr
6d80: 2d 3e 69 6e 74 65 72 6e 61 6c 52 65 70 2e 74 77 ->internalRep.tw
6d90: 6f 50 74 72 56 61 6c 75 65 2e 70 74 72 31 20 3d oPtrValue.ptr1 =
6da0: 20 28 56 4f 49 44 20 2a 29 20 63 6f 70 79 41 72 (VOID *) copyAr
6db0: 69 74 68 53 65 72 69 65 73 52 65 70 50 74 72 3b ithSeriesRepPtr;
6dc0: 0a 2b 20 20 20 20 63 6f 70 79 50 74 72 2d 3e 69 .+ copyPtr->i
6dd0: 6e 74 65 72 6e 61 6c 52 65 70 2e 74 77 6f 50 74 nternalRep.twoPt
6de0: 72 56 61 6c 75 65 2e 70 74 72 32 20 3d 20 4e 55 rValue.ptr2 = NU
6df0: 4c 4c 3b 0a 2b 20 20 20 20 63 6f 70 79 50 74 72 LL;.+ copyPtr
6e00: 2d 3e 74 79 70 65 50 74 72 20 3d 20 26 74 63 6c ->typePtr = &tcl
6e10: 41 72 69 74 68 53 65 72 69 65 73 54 79 70 65 3b ArithSeriesType;
6e20: 0a 2b 7d 0a 2b 0a 2b 2f 2a 0a 2b 20 2a 2d 2d 2d .+}.+.+/*.+ *---
6e30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
6e40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
6e50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
6e60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
6e70: 2d 2d 2d 0a 2b 20 2a 0a 2b 20 2a 20 55 70 64 61 ---.+ *.+ * Upda
6e80: 74 65 53 74 72 69 6e 67 4f 66 41 72 69 74 68 53 teStringOfArithS
6e90: 65 72 69 65 73 20 2d 2d 0a 2b 20 2a 0a 2b 20 2a eries --.+ *.+ *
6ea0: 09 55 70 64 61 74 65 20 74 68 65 20 73 74 72 69 .Update the stri
6eb0: 6e 67 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f ng representatio
6ec0: 6e 20 66 6f 72 20 61 6e 20 61 72 69 74 68 73 65 n for an arithse
6ed0: 72 69 65 73 20 6f 62 6a 65 63 74 2e 0a 2b 20 2a ries object..+ *
6ee0: 09 4e 6f 74 65 3a 20 54 68 69 73 20 70 72 6f 63 .Note: This proc
6ef0: 65 64 75 72 65 20 64 6f 65 73 20 6e 6f 74 20 69 edure does not i
6f00: 6e 76 61 6c 69 64 61 74 65 20 61 6e 20 65 78 69 nvalidate an exi
6f10: 73 74 69 6e 67 20 6f 6c 64 20 73 74 72 69 6e 67 sting old string
6f20: 20 72 65 70 0a 2b 20 2a 09 73 6f 20 73 74 6f 72 rep.+ *.so stor
6f30: 61 67 65 20 77 69 6c 6c 20 62 65 20 6c 6f 73 74 age will be lost
6f40: 20 69 66 20 74 68 69 73 20 68 61 73 20 6e 6f 74 if this has not
6f50: 20 61 6c 72 65 61 64 79 20 62 65 65 6e 20 64 6f already been do
6f60: 6e 65 2e 20 0a 2b 20 2a 0a 2b 20 2a 20 52 65 73 ne. .+ *.+ * Res
6f70: 75 6c 74 73 3a 0a 2b 20 2a 09 4e 6f 6e 65 2e 0a ults:.+ *.None..
6f80: 2b 20 2a 0a 2b 20 2a 20 53 69 64 65 20 65 66 66 + *.+ * Side eff
6f90: 65 63 74 73 3a 0a 2b 20 2a 09 54 68 65 20 6f 62 ects:.+ *.The ob
6fa0: 6a 65 63 74 27 73 20 73 74 72 69 6e 67 20 69 73 ject's string is
6fb0: 20 73 65 74 20 74 6f 20 61 20 76 61 6c 69 64 20 set to a valid
6fc0: 73 74 72 69 6e 67 20 74 68 61 74 20 72 65 73 75 string that resu
6fd0: 6c 74 73 20 66 72 6f 6d 0a 2b 20 2a 09 74 68 65 lts from.+ *.the
6fe0: 20 6c 69 73 74 2d 74 6f 2d 73 74 72 69 6e 67 20 list-to-string
6ff0: 63 6f 6e 76 65 72 73 69 6f 6e 2e 20 54 68 69 73 conversion. This
7000: 20 73 74 72 69 6e 67 20 77 69 6c 6c 20 62 65 20 string will be
7010: 65 6d 70 74 79 20 69 66 20 74 68 65 0a 2b 20 2a empty if the.+ *
7020: 09 6c 69 73 74 20 68 61 73 20 6e 6f 20 65 6c 65 .list has no ele
7030: 6d 65 6e 74 73 2e 20 54 68 65 20 6c 69 73 74 20 ments. The list
7040: 69 6e 74 65 72 6e 61 6c 20 72 65 70 72 65 73 65 internal represe
7050: 6e 74 61 74 69 6f 6e 0a 2b 20 2a 09 73 68 6f 75 ntation.+ *.shou
7060: 6c 64 20 6e 6f 74 20 62 65 20 4e 55 4c 4c 20 61 ld not be NULL a
7070: 6e 64 20 77 65 20 61 73 73 75 6d 65 20 69 74 20 nd we assume it
7080: 69 73 20 6e 6f 74 20 4e 55 4c 4c 2e 0a 2b 20 2a is not NULL..+ *
7090: 0a 2b 20 2a 20 4e 6f 74 65 73 3a 0a 2b 20 2a 20 .+ * Notes:.+ *
70a0: 09 41 74 20 74 68 65 20 63 6f 73 74 20 6f 66 20 .At the cost of
70b0: 6f 76 65 72 61 6c 6c 6f 63 61 74 69 6f 6e 20 69 overallocation i
70c0: 74 27 73 20 70 6f 73 73 69 62 6c 65 20 74 6f 20 t's possible to
70d0: 65 73 74 69 6d 61 74 65 0a 2b 20 2a 20 09 74 68 estimate.+ * .th
70e0: 65 20 6c 65 6e 67 74 68 20 6f 66 20 74 68 65 20 e length of the
70f0: 73 74 72 69 6e 67 20 72 65 70 72 65 73 65 6e 74 string represent
7100: 61 74 69 6f 6e 20 61 6e 64 20 6d 61 6b 65 20 74 ation and make t
7110: 68 69 73 20 70 72 6f 63 65 64 75 72 65 0a 2b 20 his procedure.+
7120: 2a 20 09 6d 75 63 68 20 66 61 73 74 65 72 2e 20 * .much faster.
7130: 42 65 63 61 75 73 65 20 74 68 65 20 70 72 6f 67 Because the prog
7140: 72 61 6d 6d 65 72 20 73 68 6f 75 6c 64 6e 27 74 rammer shouldn't
7150: 20 65 78 70 65 63 74 20 74 68 65 0a 2b 20 2a 20 expect the.+ *
7160: 09 73 74 72 69 6e 67 20 63 6f 6e 76 65 72 73 69 .string conversi
7170: 6f 6e 20 6f 66 20 61 20 62 69 67 20 61 72 69 74 on of a big arit
7180: 68 6d 65 74 69 63 20 73 65 71 75 65 6e 63 65 20 hmetic sequence
7190: 74 6f 20 62 65 20 66 61 73 74 0a 2b 20 2a 20 09 to be fast.+ * .
71a0: 74 68 69 73 20 76 65 72 73 69 6f 6e 20 74 61 6b this version tak
71b0: 65 73 20 6d 6f 72 65 20 63 61 72 65 20 6f 66 20 es more care of
71c0: 73 70 61 63 65 20 74 68 61 6e 20 74 69 6d 65 2e space than time.
71d0: 0a 2b 20 2a 0a 2b 20 2a 2d 2d 2d 2d 2d 2d 2d 2d .+ *.+ *--------
71e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
71f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
7200: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
7210: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 2b --------------.+
7220: 20 2a 2f 0a 2b 0a 2b 73 74 61 74 69 63 20 76 6f */.+.+static vo
7230: 69 64 0a 2b 55 70 64 61 74 65 53 74 72 69 6e 67 id.+UpdateString
7240: 4f 66 41 72 69 74 68 53 65 72 69 65 73 28 54 63 OfArithSeries(Tc
7250: 6c 5f 4f 62 6a 20 2a 61 72 69 74 68 53 65 72 69 l_Obj *arithSeri
7260: 65 73 50 74 72 29 0a 2b 7b 0a 2b 20 20 20 20 41 esPtr).+{.+ A
7270: 72 69 74 68 53 65 72 69 65 73 20 2a 61 72 69 74 rithSeries *arit
7280: 68 53 65 72 69 65 73 52 65 70 50 74 72 20 3d 0a hSeriesRepPtr =.
7290: 2b 09 20 20 20 20 28 41 72 69 74 68 53 65 72 69 +. (ArithSeri
72a0: 65 73 2a 29 20 61 72 69 74 68 53 65 72 69 65 73 es*) arithSeries
72b0: 50 74 72 2d 3e 69 6e 74 65 72 6e 61 6c 52 65 70 Ptr->internalRep
72c0: 2e 74 77 6f 50 74 72 56 61 6c 75 65 2e 70 74 72 .twoPtrValue.ptr
72d0: 31 3b 0a 2b 20 20 20 20 63 68 61 72 20 62 75 66 1;.+ char buf
72e0: 66 65 72 5b 54 43 4c 5f 49 4e 54 45 47 45 52 5f fer[TCL_INTEGER_
72f0: 53 50 41 43 45 2b 32 5d 2c 20 2a 70 3b 0a 2b 20 SPACE+2], *p;.+
7300: 20 20 20 69 6e 74 20 69 2c 20 6c 65 6e 67 74 68 int i, length
7310: 20 3d 20 30 2c 20 73 6c 65 6e 3b 0a 2b 20 20 20 = 0, slen;.+
7320: 20 54 63 6c 5f 57 69 64 65 49 6e 74 20 65 6c 65 Tcl_WideInt ele
7330: 3b 0a 2b 0a 2b 20 20 20 20 2f 2a 0a 2b 20 20 20 ;.+.+ /*.+
7340: 20 20 2a 20 45 6d 70 74 79 20 72 61 6e 67 65 20 * Empty range
7350: 63 61 73 65 0a 2b 20 20 20 20 20 2a 2f 0a 2b 20 case.+ */.+
7360: 20 20 20 69 66 20 28 61 72 69 74 68 53 65 72 69 if (arithSeri
7370: 65 73 52 65 70 50 74 72 2d 3e 6c 65 6e 20 3d 3d esRepPtr->len ==
7380: 20 30 29 20 7b 0a 2b 09 61 72 69 74 68 53 65 72 0) {.+.arithSer
7390: 69 65 73 50 74 72 2d 3e 62 79 74 65 73 20 3d 20 iesPtr->bytes =
73a0: 74 63 6c 45 6d 70 74 79 53 74 72 69 6e 67 52 65 tclEmptyStringRe
73b0: 70 3b 0a 2b 09 61 72 69 74 68 53 65 72 69 65 73 p;.+.arithSeries
73c0: 50 74 72 2d 3e 6c 65 6e 67 74 68 20 3d 20 31 3b Ptr->length = 1;
73d0: 0a 2b 20 20 20 20 7d 0a 2b 0a 2b 20 20 20 20 2f .+ }.+.+ /
73e0: 2a 0a 2b 20 20 20 20 20 2a 20 50 61 73 73 20 31 *.+ * Pass 1
73f0: 3a 20 65 73 74 69 6d 61 74 65 20 73 70 61 63 65 : estimate space
7400: 2e 0a 2b 20 20 20 20 20 2a 2f 0a 2b 20 20 20 20 ..+ */.+
7410: 66 6f 72 20 28 69 20 3d 20 30 3b 20 69 20 3c 20 for (i = 0; i <
7420: 61 72 69 74 68 53 65 72 69 65 73 52 65 70 50 74 arithSeriesRepPt
7430: 72 2d 3e 6c 65 6e 3b 20 69 2b 2b 29 20 7b 0a 2b r->len; i++) {.+
7440: 09 69 66 20 28 61 72 69 74 68 53 65 72 69 65 73 .if (arithSeries
7450: 52 65 70 50 74 72 2d 3e 66 6c 61 67 73 20 26 20 RepPtr->flags &
7460: 54 43 4c 5f 41 52 49 54 48 53 45 52 49 45 53 5f TCL_ARITHSERIES_
7470: 49 53 5f 57 49 44 45 29 0a 2b 09 20 20 20 20 65 IS_WIDE).+. e
7480: 6c 65 20 3d 20 61 72 69 74 68 53 65 72 69 65 73 le = arithSeries
7490: 52 65 70 50 74 72 2d 3e 73 74 61 72 74 2e 77 20 RepPtr->start.w
74a0: 2b 20 28 69 2a 61 72 69 74 68 53 65 72 69 65 73 + (i*arithSeries
74b0: 52 65 70 50 74 72 2d 3e 73 74 65 70 2e 77 29 3b RepPtr->step.w);
74c0: 0a 2b 09 65 6c 73 65 0a 2b 09 20 20 20 20 65 6c .+.else.+. el
74d0: 65 20 3d 20 61 72 69 74 68 53 65 72 69 65 73 52 e = arithSeriesR
74e0: 65 70 50 74 72 2d 3e 73 74 61 72 74 2e 69 20 2b epPtr->start.i +
74f0: 20 28 69 2a 61 72 69 74 68 53 65 72 69 65 73 52 (i*arithSeriesR
7500: 65 70 50 74 72 2d 3e 73 74 65 70 2e 69 29 3b 0a epPtr->step.i);.
7510: 2b 20 20 20 20 2f 2a 0a 2b 20 20 20 20 20 2a 20 + /*.+ *
7520: 4e 6f 74 65 20 74 68 61 74 20 73 70 72 69 6e 74 Note that sprint
7530: 66 20 77 69 6c 6c 20 67 65 6e 65 72 61 74 65 20 f will generate
7540: 61 20 63 6f 6d 70 69 6c 65 72 20 77 61 72 6e 69 a compiler warni
7550: 6e 67 20 75 6e 64 65 72 0a 2b 20 20 20 20 20 2a ng under.+ *
7560: 20 4d 69 6e 67 77 20 63 6c 61 69 6d 69 6e 67 20 Mingw claiming
7570: 25 49 36 34 20 69 73 20 61 6e 20 75 6e 6b 6e 6f %I64 is an unkno
7580: 77 6e 20 66 6f 72 6d 61 74 20 73 70 65 63 69 66 wn format specif
7590: 69 65 72 2e 0a 2b 20 20 20 20 20 2a 20 4a 75 73 ier..+ * Jus
75a0: 74 20 69 67 6e 6f 72 65 20 74 68 69 73 20 77 61 t ignore this wa
75b0: 72 6e 69 6e 67 2e 20 57 65 20 63 61 6e 27 74 20 rning. We can't
75c0: 75 73 65 20 25 4c 20 61 73 20 74 68 65 20 66 6f use %L as the fo
75d0: 72 6d 61 74 0a 2b 20 20 20 20 20 2a 20 73 70 65 rmat.+ * spe
75e0: 63 69 66 69 65 72 20 73 69 6e 63 65 20 74 68 61 cifier since tha
75f0: 74 20 67 65 74 73 20 70 72 69 6e 74 65 64 20 61 t gets printed a
7600: 73 20 61 20 33 32 20 62 69 74 20 76 61 6c 75 65 s a 32 bit value
7610: 2e 0a 2b 20 20 20 20 20 2a 2f 0a 2b 09 73 70 72 ..+ */.+.spr
7620: 69 6e 74 66 28 62 75 66 66 65 72 2c 20 22 25 22 intf(buffer, "%"
7630: 20 54 43 4c 5f 4c 4c 5f 4d 4f 44 49 46 49 45 52 TCL_LL_MODIFIER
7640: 20 22 64 22 2c 20 65 6c 65 29 3b 0a 2b 09 73 6c "d", ele);.+.sl
7650: 65 6e 20 3d 20 73 74 72 6c 65 6e 28 62 75 66 66 en = strlen(buff
7660: 65 72 29 20 2b 20 31 3b 20 2f 2a 20 2b 20 31 20 er) + 1; /* + 1
7670: 69 73 20 66 6f 72 20 74 68 65 20 73 70 61 63 65 is for the space
7680: 20 6f 72 20 74 68 65 20 6e 75 6c 2d 74 65 72 6d or the nul-term
7690: 20 2a 2f 0a 2b 09 6c 65 6e 67 74 68 20 2b 3d 20 */.+.length +=
76a0: 73 6c 65 6e 3b 0a 2b 20 20 20 20 7d 0a 2b 0a 2b slen;.+ }.+.+
76b0: 20 20 20 20 2f 2a 0a 2b 20 20 20 20 20 2a 20 50 /*.+ * P
76c0: 61 73 73 20 32 3a 20 67 65 6e 65 72 61 74 65 20 ass 2: generate
76d0: 74 68 65 20 73 74 72 69 6e 67 20 72 65 70 72 2e the string repr.
76e0: 0a 2b 20 20 20 20 20 2a 2f 0a 2b 0a 2b 20 20 20 .+ */.+.+
76f0: 20 70 20 3d 20 61 72 69 74 68 53 65 72 69 65 73 p = arithSeries
7700: 50 74 72 2d 3e 62 79 74 65 73 20 3d 20 63 6b 61 Ptr->bytes = cka
7710: 6c 6c 6f 63 28 6c 65 6e 67 74 68 29 3b 0a 2b 20 lloc(length);.+
7720: 20 20 20 66 6f 72 20 28 69 20 3d 20 30 3b 20 69 for (i = 0; i
7730: 20 3c 20 61 72 69 74 68 53 65 72 69 65 73 52 65 < arithSeriesRe
7740: 70 50 74 72 2d 3e 6c 65 6e 3b 20 69 2b 2b 29 20 pPtr->len; i++)
7750: 7b 0a 2b 09 69 66 20 28 61 72 69 74 68 53 65 72 {.+.if (arithSer
7760: 69 65 73 52 65 70 50 74 72 2d 3e 66 6c 61 67 73 iesRepPtr->flags
7770: 20 26 20 54 43 4c 5f 41 52 49 54 48 53 45 52 49 & TCL_ARITHSERI
7780: 45 53 5f 49 53 5f 57 49 44 45 29 0a 2b 09 20 20 ES_IS_WIDE).+.
7790: 20 20 65 6c 65 20 3d 20 61 72 69 74 68 53 65 72 ele = arithSer
77a0: 69 65 73 52 65 70 50 74 72 2d 3e 73 74 61 72 74 iesRepPtr->start
77b0: 2e 77 20 2b 20 28 69 2a 61 72 69 74 68 53 65 72 .w + (i*arithSer
77c0: 69 65 73 52 65 70 50 74 72 2d 3e 73 74 65 70 2e iesRepPtr->step.
77d0: 77 29 3b 0a 2b 09 65 6c 73 65 0a 2b 09 20 20 20 w);.+.else.+.
77e0: 20 65 6c 65 20 3d 20 61 72 69 74 68 53 65 72 69 ele = arithSeri
77f0: 65 73 52 65 70 50 74 72 2d 3e 73 74 61 72 74 2e esRepPtr->start.
7800: 69 20 2b 20 28 69 2a 61 72 69 74 68 53 65 72 69 i + (i*arithSeri
7810: 65 73 52 65 70 50 74 72 2d 3e 73 74 65 70 2e 69 esRepPtr->step.i
7820: 29 3b 0a 2b 09 73 70 72 69 6e 74 66 28 62 75 66 );.+.sprintf(buf
7830: 66 65 72 2c 20 22 25 22 20 54 43 4c 5f 4c 4c 5f fer, "%" TCL_LL_
7840: 4d 4f 44 49 46 49 45 52 20 22 64 22 2c 20 65 6c MODIFIER "d", el
7850: 65 29 3b 0a 2b 09 73 6c 65 6e 20 3d 20 73 74 72 e);.+.slen = str
7860: 6c 65 6e 28 62 75 66 66 65 72 29 3b 0a 2b 09 73 len(buffer);.+.s
7870: 74 72 63 70 79 28 70 2c 20 62 75 66 66 65 72 29 trcpy(p, buffer)
7880: 3b 0a 2b 09 70 5b 73 6c 65 6e 5d 20 3d 20 27 20 ;.+.p[slen] = '
7890: 27 3b 0a 2b 09 70 20 2b 3d 20 73 6c 65 6e 2b 31 ';.+.p += slen+1
78a0: 3b 0a 2b 20 20 20 20 7d 0a 2b 20 20 20 20 61 72 ;.+ }.+ ar
78b0: 69 74 68 53 65 72 69 65 73 50 74 72 2d 3e 62 79 ithSeriesPtr->by
78c0: 74 65 73 5b 6c 65 6e 67 74 68 2d 31 5d 20 3d 20 tes[length-1] =
78d0: 27 5c 30 27 3b 0a 2b 20 20 20 20 61 72 69 74 68 '\0';.+ arith
78e0: 53 65 72 69 65 73 50 74 72 2d 3e 6c 65 6e 67 74 SeriesPtr->lengt
78f0: 68 20 3d 20 6c 65 6e 67 74 68 2d 31 3b 0a 2b 7d h = length-1;.+}
7900: 0a 2b 0a 2b 2f 2a 0a 2b 20 2a 2d 2d 2d 2d 2d 2d .+.+/*.+ *------
7910: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
7920: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
7930: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
7940: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
7950: 0a 2b 20 2a 0a 2b 20 2a 20 53 65 74 41 72 69 74 .+ *.+ * SetArit
7960: 68 53 65 72 69 65 73 46 72 6f 6d 41 6e 79 20 2d hSeriesFromAny -
7970: 2d 0a 2b 20 2a 0a 2b 20 2a 20 09 54 68 65 20 41 -.+ *.+ * .The A
7980: 72 69 74 68 6d 65 74 69 63 20 53 65 72 69 65 73 rithmetic Series
7990: 20 6f 62 6a 65 63 74 20 69 73 20 6a 75 73 74 20 object is just
79a0: 61 6e 20 77 61 79 20 74 6f 20 6f 70 74 69 6d 69 an way to optimi
79b0: 7a 65 0a 2b 20 2a 20 09 4c 69 73 74 73 20 73 70 ze.+ * .Lists sp
79c0: 61 63 65 20 63 6f 6d 70 6c 65 78 69 74 79 2c 20 ace complexity,
79d0: 73 6f 20 6e 6f 20 6f 6e 65 20 73 68 6f 75 6c 64 so no one should
79e0: 20 74 72 79 20 74 6f 20 63 6f 6e 76 65 72 74 0a try to convert.
79f0: 2b 20 2a 20 09 61 20 73 74 72 69 6e 67 20 74 6f + * .a string to
7a00: 20 61 6e 20 41 72 69 74 68 6d 65 74 69 63 20 53 an Arithmetic S
7a10: 65 72 69 65 73 20 6f 62 6a 65 63 74 2e 0a 2b 20 eries object..+
7a20: 2a 0a 2b 20 2a 20 09 54 68 69 73 20 66 75 6e 63 *.+ * .This func
7a30: 74 69 6f 6e 20 69 73 20 68 65 72 65 20 6a 75 73 tion is here jus
7a40: 74 20 74 6f 20 70 6f 70 75 6c 61 74 65 20 74 68 t to populate th
7a50: 65 20 54 79 70 65 20 73 74 72 75 63 74 75 72 65 e Type structure
7a60: 2e 0a 2b 20 2a 0a 2b 20 2a 20 52 65 73 75 6c 74 ..+ *.+ * Result
7a70: 73 3a 0a 2b 20 2a 0a 2b 20 2a 20 09 54 68 65 20 s:.+ *.+ * .The
7a80: 72 65 73 75 6c 74 20 69 73 20 61 6c 77 61 79 73 result is always
7a90: 20 54 43 4c 5f 45 52 52 4f 52 2e 20 42 75 74 20 TCL_ERROR. But
7aa0: 73 65 65 20 53 69 64 65 20 45 66 66 65 63 74 73 see Side Effects
7ab0: 2e 0a 2b 20 2a 0a 2b 20 2a 20 53 69 64 65 20 65 ..+ *.+ * Side e
7ac0: 66 66 65 63 74 73 3a 0a 2b 20 2a 0a 2b 20 2a 20 ffects:.+ *.+ *
7ad0: 09 54 63 6c 20 50 61 6e 69 63 20 69 66 20 63 61 .Tcl Panic if ca
7ae0: 6c 6c 65 64 2e 0a 2b 20 2a 0a 2b 20 2a 2d 2d 2d lled..+ *.+ *---
7af0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
7b00: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
7b10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
7b20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
7b30: 2d 2d 2d 0a 2b 20 2a 2f 0a 2b 0a 2b 73 74 61 74 ---.+ */.+.+stat
7b40: 69 63 20 69 6e 74 0a 2b 53 65 74 41 72 69 74 68 ic int.+SetArith
7b50: 53 65 72 69 65 73 46 72 6f 6d 41 6e 79 28 69 6e SeriesFromAny(in
7b60: 74 65 72 70 2c 20 6f 62 6a 50 74 72 29 0a 2b 20 terp, objPtr).+
7b70: 20 20 20 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 Tcl_Interp *i
7b80: 6e 74 65 72 70 3b 09 09 2f 2a 20 55 73 65 64 20 nterp;../* Used
7b90: 66 6f 72 20 65 72 72 6f 72 20 72 65 70 6f 72 74 for error report
7ba0: 69 6e 67 20 69 66 20 6e 6f 74 20 4e 55 4c 4c 2e ing if not NULL.
7bb0: 20 2a 2f 0a 2b 20 20 20 20 54 63 6c 5f 4f 62 6a */.+ Tcl_Obj
7bc0: 20 2a 6f 62 6a 50 74 72 3b 09 09 2f 2a 20 54 68 *objPtr;../* Th
7bd0: 65 20 6f 62 6a 65 63 74 20 74 6f 20 63 6f 6e 76 e object to conv
7be0: 65 72 74 2e 20 2a 2f 0a 2b 7b 0a 2b 20 20 20 20 ert. */.+{.+
7bf0: 54 63 6c 5f 50 61 6e 69 63 28 22 53 65 74 41 72 Tcl_Panic("SetAr
7c00: 69 74 68 53 65 72 69 65 73 46 72 6f 6d 41 6e 79 ithSeriesFromAny
7c10: 3a 20 73 68 6f 75 6c 64 20 6e 65 76 65 72 20 62 : should never b
7c20: 65 20 63 61 6c 6c 65 64 22 29 3b 0a 2b 20 20 20 e called");.+
7c30: 20 72 65 74 75 72 6e 20 54 43 4c 5f 45 52 52 4f return TCL_ERRO
7c40: 52 3b 0a 2b 7d 0a 49 6e 64 65 78 3a 20 67 65 6e R;.+}.Index: gen
7c50: 65 72 69 63 2f 74 63 6c 53 74 75 62 49 6e 69 74 eric/tclStubInit
7c60: 2e 63 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d .c.=============
7c70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7c80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7c90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7ca0: 3d 3d 3d 3d 3d 3d 0a 52 43 53 20 66 69 6c 65 3a ======.RCS file:
7cb0: 20 2f 63 76 73 72 6f 6f 74 2f 74 63 6c 2f 74 63 /cvsroot/tcl/tc
7cc0: 6c 2f 67 65 6e 65 72 69 63 2f 74 63 6c 53 74 75 l/generic/tclStu
7cd0: 62 49 6e 69 74 2e 63 2c 76 0a 72 65 74 72 69 65 bInit.c,v.retrie
7ce0: 76 69 6e 67 20 72 65 76 69 73 69 6f 6e 20 31 2e ving revision 1.
7cf0: 31 30 35 0a 64 69 66 66 20 2d 75 20 2d 72 31 2e 105.diff -u -r1.
7d00: 31 30 35 20 74 63 6c 53 74 75 62 49 6e 69 74 2e 105 tclStubInit.
7d10: 63 0a 2d 2d 2d 20 67 65 6e 65 72 69 63 2f 74 63 c.--- generic/tc
7d20: 6c 53 74 75 62 49 6e 69 74 2e 63 09 31 34 20 4f lStubInit.c.14 O
7d30: 63 74 20 32 30 30 34 20 31 35 3a 30 36 3a 30 33 ct 2004 15:06:03
7d40: 20 2d 30 30 30 30 09 31 2e 31 30 35 0a 2b 2b 2b -0000.1.105.+++
7d50: 20 67 65 6e 65 72 69 63 2f 74 63 6c 53 74 75 62 generic/tclStub
7d60: 49 6e 69 74 2e 63 09 32 35 20 4f 63 74 20 32 30 Init.c.25 Oct 20
7d70: 30 34 20 32 31 3a 35 33 3a 30 39 20 2d 30 30 30 04 21:53:09 -000
7d80: 30 0a 40 40 20 2d 39 33 32 2c 36 20 2b 39 33 32 0.@@ -932,6 +932
7d90: 2c 39 20 40 40 0a 20 20 20 20 20 54 63 6c 5f 4c ,9 @@. Tcl_L
7da0: 69 6d 69 74 47 65 74 43 6f 6d 6d 61 6e 64 73 2c imitGetCommands,
7db0: 20 2f 2a 20 35 33 32 20 2a 2f 0a 20 20 20 20 20 /* 532 */.
7dc0: 54 63 6c 5f 4c 69 6d 69 74 47 65 74 54 69 6d 65 Tcl_LimitGetTime
7dd0: 2c 20 2f 2a 20 35 33 33 20 2a 2f 0a 20 20 20 20 , /* 533 */.
7de0: 20 54 63 6c 5f 4c 69 6d 69 74 47 65 74 47 72 61 Tcl_LimitGetGra
7df0: 6e 75 6c 61 72 69 74 79 2c 20 2f 2a 20 35 33 34 nularity, /* 534
7e00: 20 2a 2f 0a 2b 20 20 20 20 54 63 6c 5f 4e 65 77 */.+ Tcl_New
7e10: 41 72 69 74 68 53 65 72 69 65 73 4f 62 6a 2c 20 ArithSeriesObj,
7e20: 2f 2a 20 35 33 35 20 2a 2f 0a 2b 20 20 20 20 54 /* 535 */.+ T
7e30: 63 6c 5f 41 72 69 74 68 53 65 72 69 65 73 4f 62 cl_ArithSeriesOb
7e40: 6a 49 6e 64 65 78 2c 20 2f 2a 20 35 33 36 20 2a jIndex, /* 536 *
7e50: 2f 0a 2b 20 20 20 20 54 63 6c 5f 41 72 69 74 68 /.+ Tcl_Arith
7e60: 53 65 72 69 65 73 4f 62 6a 4c 65 6e 67 74 68 2c SeriesObjLength,
7e70: 20 2f 2a 20 35 33 37 20 2a 2f 0a 20 7d 3b 0a 20 /* 537 */. };.
7e80: 0a 20 2f 2a 20 21 45 4e 44 21 3a 20 44 6f 20 6e . /* !END!: Do n
7e90: 6f 74 20 65 64 69 74 20 61 62 6f 76 65 20 74 68 ot edit above th
7ea0: 69 73 20 6c 69 6e 65 2e 20 2a 2f 0a is line. */.