Tcl Source Code

Hex Artifact Content
Login

Artifact 8e785393be056b290a2a5fc87d501daf3e8c65fc:

Attachment "range5.patch" to ticket [1052584fff] added by antirez 2004-10-25 15:07:59.
0000: 49 6e 64 65 78 3a 20 67 65 6e 65 72 69 63 2f 74  Index: generic/t
0010: 63 6c 2e 64 65 63 6c 73 0a 3d 3d 3d 3d 3d 3d 3d  cl.decls.=======
0020: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
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 0a 52 43 53  ============.RCS
0060: 20 66 69 6c 65 3a 20 2f 63 76 73 72 6f 6f 74 2f   file: /cvsroot/
0070: 74 63 6c 2f 74 63 6c 2f 67 65 6e 65 72 69 63 2f  tcl/tcl/generic/
0080: 74 63 6c 2e 64 65 63 6c 73 2c 76 0a 72 65 74 72  tcl.decls,v.retr
0090: 69 65 76 69 6e 67 20 72 65 76 69 73 69 6f 6e 20  ieving revision 
00a0: 31 2e 31 30 34 0a 64 69 66 66 20 2d 75 20 2d 72  1.104.diff -u -r
00b0: 31 2e 31 30 34 20 74 63 6c 2e 64 65 63 6c 73 0a  1.104 tcl.decls.
00c0: 2d 2d 2d 20 67 65 6e 65 72 69 63 2f 74 63 6c 2e  --- generic/tcl.
00d0: 64 65 63 6c 73 09 31 33 20 4d 61 79 20 32 30 30  decls.13 May 200
00e0: 34 20 31 32 3a 35 39 3a 32 30 20 2d 30 30 30 30  4 12:59:20 -0000
00f0: 09 31 2e 31 30 34 0a 2b 2b 2b 20 67 65 6e 65 72  .1.104.+++ gener
0100: 69 63 2f 74 63 6c 2e 64 65 63 6c 73 09 32 35 20  ic/tcl.decls.25 
0110: 4f 63 74 20 32 30 30 34 20 30 36 3a 33 37 3a 34  Oct 2004 06:37:4
0120: 30 20 2d 30 30 30 30 0a 40 40 20 2d 31 39 30 39  0 -0000.@@ -1909
0130: 2c 36 20 2b 31 39 30 39 2c 31 37 20 40 40 0a 20  ,6 +1909,17 @@. 
0140: 64 65 63 6c 61 72 65 20 35 33 34 20 67 65 6e 65  declare 534 gene
0150: 72 69 63 20 7b 0a 20 20 20 20 20 69 6e 74 20 54  ric {.     int T
0160: 63 6c 5f 4c 69 6d 69 74 47 65 74 47 72 61 6e 75  cl_LimitGetGranu
0170: 6c 61 72 69 74 79 28 54 63 6c 5f 49 6e 74 65 72  larity(Tcl_Inter
0180: 70 20 2a 69 6e 74 65 72 70 2c 20 69 6e 74 20 74  p *interp, int t
0190: 79 70 65 29 0a 20 7d 0a 2b 64 65 63 6c 61 72 65  ype). }.+declare
01a0: 20 35 33 35 20 67 65 6e 65 72 69 63 20 7b 0a 2b   535 generic {.+
01b0: 20 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 20 54 63      Tcl_Obj * Tc
01c0: 6c 5f 4e 65 77 41 72 69 74 68 53 65 72 69 65 73  l_NewArithSeries
01d0: 4f 62 6a 28 54 63 6c 5f 57 69 64 65 49 6e 74 20  Obj(Tcl_WideInt 
01e0: 73 74 61 72 74 2c 0a 2b 09 20 20 20 20 54 63 6c  start,.+.    Tcl
01f0: 5f 57 69 64 65 49 6e 74 20 65 6e 64 2c 20 54 63  _WideInt end, Tc
0200: 6c 5f 57 69 64 65 49 6e 74 20 73 74 65 70 29 0a  l_WideInt step).
0210: 2b 7d 0a 2b 64 65 63 6c 61 72 65 20 35 33 36 20  +}.+declare 536 
0220: 67 65 6e 65 72 69 63 20 7b 0a 2b 20 20 20 20 69  generic {.+    i
0230: 6e 74 20 54 63 6c 5f 41 72 69 74 68 53 65 72 69  nt Tcl_ArithSeri
0240: 65 73 4f 62 6a 49 6e 64 65 78 28 54 63 6c 5f 4f  esObjIndex(Tcl_O
0250: 62 6a 20 2a 61 72 69 74 68 53 65 72 69 65 73 50  bj *arithSeriesP
0260: 74 72 2c 20 69 6e 74 20 69 6e 64 65 78 2c 0a 2b  tr, int index,.+
0270: 20 20 20 20 20 20 20 20 20 20 20 20 54 63 6c 5f              Tcl_
0280: 57 69 64 65 49 6e 74 20 2a 65 6c 65 6d 65 6e 74  WideInt *element
0290: 29 0a 2b 7d 0a 2b 64 65 63 6c 61 72 65 20 35 33  ).+}.+declare 53
02a0: 37 20 67 65 6e 65 72 69 63 20 7b 0a 2b 20 20 20  7 generic {.+   
02b0: 20 69 6e 74 20 54 63 6c 5f 41 72 69 74 68 53 65   int Tcl_ArithSe
02c0: 72 69 65 73 4f 62 6a 4c 65 6e 67 74 68 28 54 63  riesObjLength(Tc
02d0: 6c 5f 4f 62 6a 20 2a 61 72 69 74 68 53 65 72 69  l_Obj *arithSeri
02e0: 65 73 50 74 72 29 0a 2b 7d 0a 20 0a 20 23 23 23  esPtr).+}. . ###
02f0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23  ################
0300: 23 23 23 23 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 0a 20 0a 49 6e  ###########. .In
0340: 64 65 78 3a 20 67 65 6e 65 72 69 63 2f 74 63 6c  dex: generic/tcl
0350: 42 61 73 69 63 2e 63 0a 3d 3d 3d 3d 3d 3d 3d 3d  Basic.c.========
0360: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
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 0a 52 43 53 20  ===========.RCS 
03a0: 66 69 6c 65 3a 20 2f 63 76 73 72 6f 6f 74 2f 74  file: /cvsroot/t
03b0: 63 6c 2f 74 63 6c 2f 67 65 6e 65 72 69 63 2f 74  cl/tcl/generic/t
03c0: 63 6c 42 61 73 69 63 2e 63 2c 76 0a 72 65 74 72  clBasic.c,v.retr
03d0: 69 65 76 69 6e 67 20 72 65 76 69 73 69 6f 6e 20  ieving revision 
03e0: 31 2e 31 33 33 0a 64 69 66 66 20 2d 75 20 2d 72  1.133.diff -u -r
03f0: 31 2e 31 33 33 20 74 63 6c 42 61 73 69 63 2e 63  1.133 tclBasic.c
0400: 0a 2d 2d 2d 20 67 65 6e 65 72 69 63 2f 74 63 6c  .--- generic/tcl
0410: 42 61 73 69 63 2e 63 09 32 34 20 4f 63 74 20 32  Basic.c.24 Oct 2
0420: 30 30 34 20 32 32 3a 32 35 3a 31 32 20 2d 30 30  004 22:25:12 -00
0430: 30 30 09 31 2e 31 33 33 0a 2b 2b 2b 20 67 65 6e  00.1.133.+++ gen
0440: 65 72 69 63 2f 74 63 6c 42 61 73 69 63 2e 63 09  eric/tclBasic.c.
0450: 32 35 20 4f 63 74 20 32 30 30 34 20 30 36 3a 33  25 Oct 2004 06:3
0460: 37 3a 34 37 20 2d 30 30 30 30 0a 40 40 20 2d 39  7:47 -0000.@@ -9
0470: 34 2c 36 20 2b 39 34 2c 37 20 40 40 0a 20 20 20  4,6 +94,7 @@.   
0480: 20 20 7b 22 6e 61 6d 65 73 70 61 63 65 22 2c 09    {"namespace",.
0490: 54 63 6c 5f 4e 61 6d 65 73 70 61 63 65 4f 62 6a  Tcl_NamespaceObj
04a0: 43 6d 64 2c 09 28 43 6f 6d 70 69 6c 65 50 72 6f  Cmd,.(CompilePro
04b0: 63 20 2a 29 20 4e 55 4c 4c 2c 09 31 7d 2c 0a 20  c *) NULL,.1},. 
04c0: 20 20 20 20 7b 22 70 61 63 6b 61 67 65 22 2c 09      {"package",.
04d0: 09 54 63 6c 5f 50 61 63 6b 61 67 65 4f 62 6a 43  .Tcl_PackageObjC
04e0: 6d 64 2c 09 28 43 6f 6d 70 69 6c 65 50 72 6f 63  md,.(CompileProc
04f0: 20 2a 29 20 4e 55 4c 4c 2c 09 31 7d 2c 0a 20 20   *) NULL,.1},.  
0500: 20 20 20 7b 22 70 72 6f 63 22 2c 09 09 54 63 6c     {"proc",..Tcl
0510: 5f 50 72 6f 63 4f 62 6a 43 6d 64 2c 09 09 28 43  _ProcObjCmd,..(C
0520: 6f 6d 70 69 6c 65 50 72 6f 63 20 2a 29 20 4e 55  ompileProc *) NU
0530: 4c 4c 2c 09 31 7d 2c 0a 2b 20 20 20 20 7b 22 72  LL,.1},.+    {"r
0540: 61 6e 67 65 22 2c 09 09 54 63 6c 5f 52 61 6e 67  ange",..Tcl_Rang
0550: 65 4f 62 6a 43 6d 64 2c 09 28 43 6f 6d 70 69 6c  eObjCmd,.(Compil
0560: 65 50 72 6f 63 20 2a 29 20 4e 55 4c 4c 2c 09 31  eProc *) NULL,.1
0570: 7d 2c 0a 20 20 20 20 20 7b 22 72 65 67 65 78 70  },.     {"regexp
0580: 22 2c 09 09 54 63 6c 5f 52 65 67 65 78 70 4f 62  ",..Tcl_RegexpOb
0590: 6a 43 6d 64 2c 09 54 63 6c 43 6f 6d 70 69 6c 65  jCmd,.TclCompile
05a0: 52 65 67 65 78 70 43 6d 64 2c 09 31 7d 2c 0a 20  RegexpCmd,.1},. 
05b0: 20 20 20 20 7b 22 72 65 67 73 75 62 22 2c 09 09      {"regsub",..
05c0: 54 63 6c 5f 52 65 67 73 75 62 4f 62 6a 43 6d 64  Tcl_RegsubObjCmd
05d0: 2c 09 28 43 6f 6d 70 69 6c 65 50 72 6f 63 20 2a  ,.(CompileProc *
05e0: 29 20 4e 55 4c 4c 2c 09 31 7d 2c 0a 20 20 20 20  ) NULL,.1},.    
05f0: 20 7b 22 72 65 6e 61 6d 65 22 2c 09 09 54 63 6c   {"rename",..Tcl
0600: 5f 52 65 6e 61 6d 65 4f 62 6a 43 6d 64 2c 09 28  _RenameObjCmd,.(
0610: 43 6f 6d 70 69 6c 65 50 72 6f 63 20 2a 29 20 4e  CompileProc *) N
0620: 55 4c 4c 2c 09 31 7d 2c 0a 49 6e 64 65 78 3a 20  ULL,.1},.Index: 
0630: 67 65 6e 65 72 69 63 2f 74 63 6c 43 6d 64 41 48  generic/tclCmdAH
0640: 2e 63 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  .c.=============
0650: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
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 0a 52 43 53 20 66 69 6c 65 3a  ======.RCS file:
0690: 20 2f 63 76 73 72 6f 6f 74 2f 74 63 6c 2f 74 63   /cvsroot/tcl/tc
06a0: 6c 2f 67 65 6e 65 72 69 63 2f 74 63 6c 43 6d 64  l/generic/tclCmd
06b0: 41 48 2e 63 2c 76 0a 72 65 74 72 69 65 76 69 6e  AH.c,v.retrievin
06c0: 67 20 72 65 76 69 73 69 6f 6e 20 31 2e 35 36 0a  g revision 1.56.
06d0: 64 69 66 66 20 2d 75 20 2d 72 31 2e 35 36 20 74  diff -u -r1.56 t
06e0: 63 6c 43 6d 64 41 48 2e 63 0a 2d 2d 2d 20 67 65  clCmdAH.c.--- ge
06f0: 6e 65 72 69 63 2f 74 63 6c 43 6d 64 41 48 2e 63  neric/tclCmdAH.c
0700: 09 32 31 20 4f 63 74 20 32 30 30 34 20 31 35 3a  .21 Oct 2004 15:
0710: 31 39 3a 34 36 20 2d 30 30 30 30 09 31 2e 35 36  19:46 -0000.1.56
0720: 0a 2b 2b 2b 20 67 65 6e 65 72 69 63 2f 74 63 6c  .+++ generic/tcl
0730: 43 6d 64 41 48 2e 63 09 32 35 20 4f 63 74 20 32  CmdAH.c.25 Oct 2
0740: 30 30 34 20 30 36 3a 33 37 3a 35 32 20 2d 30 30  004 06:37:52 -00
0750: 30 30 0a 40 40 20 2d 31 37 36 37 2c 31 30 20 2b  00.@@ -1767,10 +
0760: 31 37 36 37 2c 31 34 20 40 40 0a 20 09 20 20 20  1767,14 @@. .   
0770: 20 67 6f 74 6f 20 64 6f 6e 65 3b 0a 20 09 7d 0a   goto done;. .}.
0780: 20 0a 2d 09 72 65 73 75 6c 74 20 3d 20 54 63 6c   .-.result = Tcl
0790: 5f 4c 69 73 74 4f 62 6a 47 65 74 45 6c 65 6d 65  _ListObjGetEleme
07a0: 6e 74 73 28 69 6e 74 65 72 70 2c 20 61 72 67 4f  nts(interp, argO
07b0: 62 6a 76 5b 32 2b 69 2a 32 5d 2c 0a 2d 09 20 20  bjv[2+i*2],.-.  
07c0: 20 20 20 20 20 20 26 61 72 67 63 4c 69 73 74 5b        &argcList[
07d0: 69 5d 2c 20 26 61 72 67 76 4c 69 73 74 5b 69 5d  i], &argvList[i]
07e0: 29 3b 0a 2d 09 69 66 20 28 72 65 73 75 6c 74 20  );.-.if (result 
07f0: 21 3d 20 54 43 4c 5f 4f 4b 29 20 7b 0a 2d 09 20  != TCL_OK) {.-. 
0800: 20 20 20 67 6f 74 6f 20 64 6f 6e 65 3b 0a 2b 09     goto done;.+.
0810: 69 66 20 28 61 72 67 4f 62 6a 76 5b 32 2b 69 2a  if (argObjv[2+i*
0820: 32 5d 2d 3e 74 79 70 65 50 74 72 20 21 3d 20 26  2]->typePtr != &
0830: 74 63 6c 41 72 69 74 68 53 65 72 69 65 73 54 79  tclArithSeriesTy
0840: 70 65 29 20 7b 0a 2b 09 20 20 20 20 72 65 73 75  pe) {.+.    resu
0850: 6c 74 20 3d 20 54 63 6c 5f 4c 69 73 74 4f 62 6a  lt = Tcl_ListObj
0860: 47 65 74 45 6c 65 6d 65 6e 74 73 28 69 6e 74 65  GetElements(inte
0870: 72 70 2c 20 61 72 67 4f 62 6a 76 5b 32 2b 69 2a  rp, argObjv[2+i*
0880: 32 5d 2c 0a 2b 09 09 09 26 61 72 67 63 4c 69 73  2],.+...&argcLis
0890: 74 5b 69 5d 2c 20 26 61 72 67 76 4c 69 73 74 5b  t[i], &argvList[
08a0: 69 5d 29 3b 0a 2b 09 20 20 20 20 69 66 20 28 72  i]);.+.    if (r
08b0: 65 73 75 6c 74 20 21 3d 20 54 43 4c 5f 4f 4b 29  esult != TCL_OK)
08c0: 20 7b 0a 2b 09 20 20 20 20 20 20 20 20 67 6f 74   {.+.        got
08d0: 6f 20 64 6f 6e 65 3b 0a 2b 09 20 20 20 20 7d 0a  o done;.+.    }.
08e0: 2b 09 7d 20 65 6c 73 65 20 7b 0a 2b 09 20 20 20  +.} else {.+.   
08f0: 20 61 72 67 63 4c 69 73 74 5b 69 5d 20 3d 20 54   argcList[i] = T
0900: 63 6c 5f 41 72 69 74 68 53 65 72 69 65 73 4f 62  cl_ArithSeriesOb
0910: 6a 4c 65 6e 67 74 68 28 61 72 67 4f 62 6a 76 5b  jLength(argObjv[
0920: 32 2b 69 2a 32 5d 29 3b 0a 20 09 7d 0a 20 0a 20  2+i*2]);. .}. . 
0930: 09 6a 20 3d 20 61 72 67 63 4c 69 73 74 5b 69 5d  .j = argcList[i]
0940: 20 2f 20 76 61 72 63 4c 69 73 74 5b 69 5d 3b 0a   / varcList[i];.
0950: 40 40 20 2d 31 38 30 34 2c 31 30 20 2b 31 38 30  @@ -1804,10 +180
0960: 38 2c 31 34 20 40 40 0a 20 09 20 20 20 20 69 66  8,14 @@. .    if
0970: 20 28 72 65 73 75 6c 74 20 21 3d 20 54 43 4c 5f   (result != TCL_
0980: 4f 4b 29 20 7b 0a 20 09 09 54 63 6c 5f 50 61 6e  OK) {. ..Tcl_Pan
0990: 69 63 28 22 54 63 6c 5f 46 6f 72 65 61 63 68 4f  ic("Tcl_ForeachO
09a0: 62 6a 43 6d 64 3a 20 63 6f 75 6c 64 20 6e 6f 74  bjCmd: could not
09b0: 20 72 65 63 6f 6e 76 65 72 74 20 76 61 72 69 61   reconvert varia
09c0: 62 6c 65 20 6c 69 73 74 20 25 64 20 74 6f 20 61  ble list %d to a
09d0: 20 6c 69 73 74 20 6f 62 6a 65 63 74 5c 6e 22 2c   list object\n",
09e0: 20 69 29 3b 0a 20 09 20 20 20 20 7d 0a 2d 09 20   i);. .    }.-. 
09f0: 20 20 20 72 65 73 75 6c 74 20 3d 20 54 63 6c 5f     result = Tcl_
0a00: 4c 69 73 74 4f 62 6a 47 65 74 45 6c 65 6d 65 6e  ListObjGetElemen
0a10: 74 73 28 69 6e 74 65 72 70 2c 20 61 72 67 4f 62  ts(interp, argOb
0a20: 6a 76 5b 32 2b 69 2a 32 5d 2c 0a 2d 09 09 20 20  jv[2+i*2],.-..  
0a30: 20 20 26 61 72 67 63 4c 69 73 74 5b 69 5d 2c 20    &argcList[i], 
0a40: 26 61 72 67 76 4c 69 73 74 5b 69 5d 29 3b 0a 2d  &argvList[i]);.-
0a50: 09 20 20 20 20 69 66 20 28 72 65 73 75 6c 74 20  .    if (result 
0a60: 21 3d 20 54 43 4c 5f 4f 4b 29 20 7b 0a 2d 09 09  != TCL_OK) {.-..
0a70: 54 63 6c 5f 50 61 6e 69 63 28 22 54 63 6c 5f 46  Tcl_Panic("Tcl_F
0a80: 6f 72 65 61 63 68 4f 62 6a 43 6d 64 3a 20 63 6f  oreachObjCmd: co
0a90: 75 6c 64 20 6e 6f 74 20 72 65 63 6f 6e 76 65 72  uld not reconver
0aa0: 74 20 76 61 6c 75 65 20 6c 69 73 74 20 25 64 20  t value list %d 
0ab0: 74 6f 20 61 20 6c 69 73 74 20 6f 62 6a 65 63 74  to a list object
0ac0: 5c 6e 22 2c 20 69 29 3b 0a 2b 09 20 20 20 20 69  \n", i);.+.    i
0ad0: 66 20 28 61 72 67 4f 62 6a 76 5b 32 2b 69 2a 32  f (argObjv[2+i*2
0ae0: 5d 2d 3e 74 79 70 65 50 74 72 20 21 3d 20 26 74  ]->typePtr != &t
0af0: 63 6c 41 72 69 74 68 53 65 72 69 65 73 54 79 70  clArithSeriesTyp
0b00: 65 29 20 7b 0a 2b 09 20 20 20 20 20 20 20 20 72  e) {.+.        r
0b10: 65 73 75 6c 74 20 3d 20 54 63 6c 5f 4c 69 73 74  esult = Tcl_List
0b20: 4f 62 6a 47 65 74 45 6c 65 6d 65 6e 74 73 28 69  ObjGetElements(i
0b30: 6e 74 65 72 70 2c 20 61 72 67 4f 62 6a 76 5b 32  nterp, argObjv[2
0b40: 2b 69 2a 32 5d 2c 0a 2b 09 09 20 20 20 20 20 20  +i*2],.+..      
0b50: 20 20 26 61 72 67 63 4c 69 73 74 5b 69 5d 2c 20    &argcList[i], 
0b60: 26 61 72 67 76 4c 69 73 74 5b 69 5d 29 3b 0a 2b  &argvList[i]);.+
0b70: 09 20 20 20 20 20 20 20 20 69 66 20 28 72 65 73  .        if (res
0b80: 75 6c 74 20 21 3d 20 54 43 4c 5f 4f 4b 29 20 7b  ult != TCL_OK) {
0b90: 0a 2b 09 09 20 20 20 20 54 63 6c 5f 50 61 6e 69  .+..    Tcl_Pani
0ba0: 63 28 22 54 63 6c 5f 46 6f 72 65 61 63 68 4f 62  c("Tcl_ForeachOb
0bb0: 6a 43 6d 64 3a 20 63 6f 75 6c 64 20 6e 6f 74 20  jCmd: could not 
0bc0: 72 65 63 6f 6e 76 65 72 74 20 76 61 6c 75 65 20  reconvert value 
0bd0: 6c 69 73 74 20 25 64 20 74 6f 20 61 20 6c 69 73  list %d to a lis
0be0: 74 20 6f 62 6a 65 63 74 5c 6e 22 2c 20 69 29 3b  t object\n", i);
0bf0: 0a 2b 09 20 20 20 20 20 20 20 20 7d 0a 2b 09 20  .+.        }.+. 
0c00: 20 20 20 7d 20 65 6c 73 65 20 7b 0a 2b 09 09 61     } else {.+..a
0c10: 72 67 63 4c 69 73 74 5b 69 5d 20 3d 20 54 63 6c  rgcList[i] = Tcl
0c20: 5f 41 72 69 74 68 53 65 72 69 65 73 4f 62 6a 4c  _ArithSeriesObjL
0c30: 65 6e 67 74 68 28 61 72 67 4f 62 6a 76 5b 32 2b  ength(argObjv[2+
0c40: 69 2a 32 5d 29 3b 0a 20 09 20 20 20 20 7d 0a 20  i*2]);. .    }. 
0c50: 0a 20 09 20 20 20 20 66 6f 72 20 28 76 20 3d 20  . .    for (v = 
0c60: 30 3b 20 20 76 20 3c 20 76 61 72 63 4c 69 73 74  0;  v < varcList
0c70: 5b 69 5d 3b 20 20 76 2b 2b 29 20 7b 0a 40 40 20  [i];  v++) {.@@ 
0c80: 2d 31 38 31 36 2c 37 20 2b 31 38 32 34 2c 32 30  -1816,7 +1824,20
0c90: 20 40 40 0a 20 09 09 69 6e 74 20 69 73 45 6d 70   @@. ..int isEmp
0ca0: 74 79 4f 62 6a 20 3d 20 30 3b 0a 20 0a 20 09 09  tyObj = 0;. . ..
0cb0: 69 66 20 28 6b 20 3c 20 61 72 67 63 4c 69 73 74  if (k < argcList
0cc0: 5b 69 5d 29 20 7b 0a 2d 09 09 20 20 20 20 76 61  [i]) {.-..    va
0cd0: 6c 75 65 50 74 72 20 3d 20 61 72 67 76 4c 69 73  luePtr = argvLis
0ce0: 74 5b 69 5d 5b 6b 5d 3b 0a 2b 09 09 20 20 20 20  t[i][k];.+..    
0cf0: 69 66 20 28 61 72 67 4f 62 6a 76 5b 32 2b 69 2a  if (argObjv[2+i*
0d00: 32 5d 2d 3e 74 79 70 65 50 74 72 20 21 3d 20 26  2]->typePtr != &
0d10: 74 63 6c 41 72 69 74 68 53 65 72 69 65 73 54 79  tclArithSeriesTy
0d20: 70 65 29 20 7b 0a 2b 09 09 20 20 20 20 09 76 61  pe) {.+..    .va
0d30: 6c 75 65 50 74 72 20 3d 20 61 72 67 76 4c 69 73  luePtr = argvLis
0d40: 74 5b 69 5d 5b 6b 5d 3b 0a 2b 09 09 20 20 20 20  t[i][k];.+..    
0d50: 7d 20 65 6c 73 65 20 7b 0a 2b 09 09 09 54 63 6c  } else {.+...Tcl
0d60: 5f 57 69 64 65 49 6e 74 20 77 69 64 65 56 61 6c  _WideInt wideVal
0d70: 3b 0a 2b 0a 2b 09 09 09 41 72 69 74 68 53 65 72  ;.+.+...ArithSer
0d80: 69 65 73 20 2a 61 72 69 74 68 53 65 72 69 65 73  ies *arithSeries
0d90: 52 65 70 50 74 72 20 3d 0a 2b 09 09 09 09 61 72  RepPtr =.+....ar
0da0: 67 4f 62 6a 76 5b 32 2b 69 2a 32 5d 2d 3e 69 6e  gObjv[2+i*2]->in
0db0: 74 65 72 6e 61 6c 52 65 70 2e 74 77 6f 50 74 72  ternalRep.twoPtr
0dc0: 56 61 6c 75 65 2e 70 74 72 31 3b 0a 2b 09 09 09  Value.ptr1;.+...
0dd0: 77 69 64 65 56 61 6c 20 3d 20 61 72 69 74 68 53  wideVal = arithS
0de0: 65 72 69 65 73 52 65 70 50 74 72 2d 3e 73 74 61  eriesRepPtr->sta
0df0: 72 74 20 2b 0a 2b 09 09 09 09 28 6b 2a 61 72 69  rt +.+....(k*ari
0e00: 74 68 53 65 72 69 65 73 52 65 70 50 74 72 2d 3e  thSeriesRepPtr->
0e10: 73 74 65 70 29 3b 0a 2b 09 09 09 69 66 20 28 61  step);.+...if (a
0e20: 72 69 74 68 53 65 72 69 65 73 52 65 70 50 74 72  rithSeriesRepPtr
0e30: 2d 3e 66 6c 61 67 73 20 26 20 54 43 4c 5f 41 52  ->flags & TCL_AR
0e40: 49 54 48 53 45 52 49 45 53 5f 49 53 5f 57 49 44  ITHSERIES_IS_WID
0e50: 45 29 0a 2b 09 09 09 20 20 20 20 76 61 6c 75 65  E).+...    value
0e60: 50 74 72 20 3d 20 54 63 6c 5f 4e 65 77 57 69 64  Ptr = Tcl_NewWid
0e70: 65 49 6e 74 4f 62 6a 28 77 69 64 65 56 61 6c 29  eIntObj(wideVal)
0e80: 3b 0a 2b 09 09 09 65 6c 73 65 0a 2b 09 09 09 20  ;.+...else.+... 
0e90: 20 20 20 76 61 6c 75 65 50 74 72 20 3d 20 54 63     valuePtr = Tc
0ea0: 6c 5f 4e 65 77 49 6e 74 4f 62 6a 28 28 69 6e 74  l_NewIntObj((int
0eb0: 29 77 69 64 65 56 61 6c 29 3b 0a 2b 09 09 20 20  )wideVal);.+..  
0ec0: 20 20 7d 0a 20 09 09 7d 20 65 6c 73 65 20 7b 0a    }. ..} else {.
0ed0: 20 09 09 20 20 20 20 76 61 6c 75 65 50 74 72 20   ..    valuePtr 
0ee0: 3d 20 54 63 6c 5f 4e 65 77 4f 62 6a 28 29 3b 20  = Tcl_NewObj(); 
0ef0: 2f 2a 20 65 6d 70 74 79 20 73 74 72 69 6e 67 20  /* empty string 
0f00: 2a 2f 0a 20 09 09 20 20 20 20 69 73 45 6d 70 74  */. ..    isEmpt
0f10: 79 4f 62 6a 20 3d 20 31 3b 0a 49 6e 64 65 78 3a  yObj = 1;.Index:
0f20: 20 67 65 6e 65 72 69 63 2f 74 63 6c 43 6d 64 49   generic/tclCmdI
0f30: 4c 2e 63 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  L.c.============
0f40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0f50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0f60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0f70: 3d 3d 3d 3d 3d 3d 3d 0a 52 43 53 20 66 69 6c 65  =======.RCS file
0f80: 3a 20 2f 63 76 73 72 6f 6f 74 2f 74 63 6c 2f 74  : /cvsroot/tcl/t
0f90: 63 6c 2f 67 65 6e 65 72 69 63 2f 74 63 6c 43 6d  cl/generic/tclCm
0fa0: 64 49 4c 2e 63 2c 76 0a 72 65 74 72 69 65 76 69  dIL.c,v.retrievi
0fb0: 6e 67 20 72 65 76 69 73 69 6f 6e 20 31 2e 36 37  ng revision 1.67
0fc0: 0a 64 69 66 66 20 2d 75 20 2d 72 31 2e 36 37 20  .diff -u -r1.67 
0fd0: 74 63 6c 43 6d 64 49 4c 2e 63 0a 2d 2d 2d 20 67  tclCmdIL.c.--- g
0fe0: 65 6e 65 72 69 63 2f 74 63 6c 43 6d 64 49 4c 2e  eneric/tclCmdIL.
0ff0: 63 09 32 35 20 4f 63 74 20 32 30 30 34 20 30 31  c.25 Oct 2004 01
1000: 3a 30 36 3a 34 39 20 2d 30 30 30 30 09 31 2e 36  :06:49 -0000.1.6
1010: 37 0a 2b 2b 2b 20 67 65 6e 65 72 69 63 2f 74 63  7.+++ generic/tc
1020: 6c 43 6d 64 49 4c 2e 63 09 32 35 20 4f 63 74 20  lCmdIL.c.25 Oct 
1030: 32 30 30 34 20 30 36 3a 33 37 3a 35 38 20 2d 30  2004 06:37:58 -0
1040: 30 30 30 0a 40 40 20 2d 32 33 34 34 2c 36 20 2b  000.@@ -2344,6 +
1050: 32 33 34 34 2c 33 35 20 40 40 0a 20 0a 20 20 20  2344,35 @@. .   
1060: 20 20 69 66 20 28 61 72 67 50 74 72 2d 3e 74 79    if (argPtr->ty
1070: 70 65 50 74 72 20 21 3d 20 26 74 63 6c 4c 69 73  pePtr != &tclLis
1080: 74 54 79 70 65 20 0a 20 09 20 20 20 20 26 26 20  tType . .    && 
1090: 54 63 6c 47 65 74 49 6e 74 46 6f 72 49 6e 64 65  TclGetIntForInde
10a0: 78 28 4e 55 4c 4c 20 2c 20 61 72 67 50 74 72 2c  x(NULL , argPtr,
10b0: 20 30 2c 20 26 69 6e 64 65 78 29 20 3d 3d 20 54   0, &index) == T
10c0: 43 4c 5f 4f 4b 29 20 7b 0a 2b 0a 2b 09 2f 2a 20  CL_OK) {.+.+./* 
10d0: 49 66 20 74 68 65 20 6c 69 73 74 20 69 73 20 61  If the list is a
10e0: 6e 20 61 72 69 74 68 6d 65 74 69 63 20 73 65 72  n arithmetic ser
10f0: 69 65 73 20 72 65 74 75 72 6e 20 74 68 65 0a 2b  ies return the.+
1100: 09 20 2a 20 63 6f 6d 70 75 74 65 64 20 65 6c 65  . * computed ele
1110: 6d 65 6e 74 2e 20 2a 2f 0a 2b 20 20 20 20 20 20  ment. */.+      
1120: 20 20 69 66 20 28 6c 69 73 74 50 74 72 2d 3e 74    if (listPtr->t
1130: 79 70 65 50 74 72 20 3d 3d 20 26 74 63 6c 41 72  ypePtr == &tclAr
1140: 69 74 68 53 65 72 69 65 73 54 79 70 65 29 20 7b  ithSeriesType) {
1150: 0a 2b 09 20 20 20 20 54 63 6c 5f 4f 62 6a 20 2a  .+.    Tcl_Obj *
1160: 76 61 6c 50 74 72 3b 0a 2b 09 20 20 20 20 69 6e  valPtr;.+.    in
1170: 74 20 61 73 4c 65 6e 3b 0a 2b 09 20 20 20 20 54  t asLen;.+.    T
1180: 63 6c 5f 57 69 64 65 49 6e 74 20 77 69 64 65 56  cl_WideInt wideV
1190: 61 6c 3b 0a 2b 0a 2b 09 20 20 20 20 2f 2a 20 50  al;.+.+.    /* P
11a0: 61 72 73 65 20 74 68 65 20 69 6e 64 65 78 20 2a  arse the index *
11b0: 2f 0a 2b 09 20 20 20 20 61 73 4c 65 6e 20 3d 20  /.+.    asLen = 
11c0: 54 63 6c 5f 41 72 69 74 68 53 65 72 69 65 73 4f  Tcl_ArithSeriesO
11d0: 62 6a 4c 65 6e 67 74 68 28 6c 69 73 74 50 74 72  bjLength(listPtr
11e0: 29 3b 0a 2b 09 20 20 20 20 72 65 73 75 6c 74 20  );.+.    result 
11f0: 3d 20 54 63 6c 47 65 74 49 6e 74 46 6f 72 49 6e  = TclGetIntForIn
1200: 64 65 78 28 69 6e 74 65 72 70 2c 20 61 72 67 50  dex(interp, argP
1210: 74 72 2c 0a 2b 09 09 09 20 20 20 20 2f 2a 65 6e  tr,.+...    /*en
1220: 64 56 61 6c 75 65 2a 2f 20 61 73 4c 65 6e 2d 31  dValue*/ asLen-1
1230: 2c 20 26 69 6e 64 65 78 29 3b 0a 2b 09 20 20 20  , &index);.+.   
1240: 20 69 66 20 28 72 65 73 75 6c 74 20 21 3d 20 54   if (result != T
1250: 43 4c 5f 4f 4b 29 20 72 65 74 75 72 6e 20 4e 55  CL_OK) return NU
1260: 4c 4c 3b 0a 2b 0a 2b 09 20 20 20 20 2f 2a 20 52  LL;.+.+.    /* R
1270: 65 74 75 72 6e 20 74 68 65 20 63 6f 6d 70 75 74  eturn the comput
1280: 65 64 20 77 69 64 65 49 6e 74 20 6f 62 6a 65 63  ed wideInt objec
1290: 74 20 2a 2f 0a 2b 09 20 20 20 20 69 66 20 28 54  t */.+.    if (T
12a0: 63 6c 5f 41 72 69 74 68 53 65 72 69 65 73 4f 62  cl_ArithSeriesOb
12b0: 6a 49 6e 64 65 78 28 6c 69 73 74 50 74 72 2c 20  jIndex(listPtr, 
12c0: 69 6e 64 65 78 2c 20 26 77 69 64 65 56 61 6c 29  index, &wideVal)
12d0: 20 3d 3d 20 54 43 4c 5f 4f 4b 29 0a 2b 09 20 20   == TCL_OK).+.  
12e0: 20 20 7b 0a 2b 09 09 69 66 20 28 77 69 64 65 56    {.+..if (wideV
12f0: 61 6c 20 3e 20 49 4e 54 5f 4d 41 58 20 7c 7c 20  al > INT_MAX || 
1300: 77 69 64 65 56 61 6c 20 3c 20 49 4e 54 5f 4d 49  wideVal < INT_MI
1310: 4e 29 0a 2b 09 20 20 20 20 20 20 20 20 20 20 20  N).+.           
1320: 20 76 61 6c 50 74 72 20 3d 20 54 63 6c 5f 4e 65   valPtr = Tcl_Ne
1330: 77 57 69 64 65 49 6e 74 4f 62 6a 28 77 69 64 65  wWideIntObj(wide
1340: 56 61 6c 29 3b 0a 2b 09 09 65 6c 73 65 0a 2b 09  Val);.+..else.+.
1350: 09 20 20 20 20 76 61 6c 50 74 72 20 3d 20 54 63  .    valPtr = Tc
1360: 6c 5f 4e 65 77 49 6e 74 4f 62 6a 28 28 69 6e 74  l_NewIntObj((int
1370: 29 77 69 64 65 56 61 6c 29 3b 0a 2b 20 20 20 20  )wideVal);.+    
1380: 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b          } else {
1390: 0a 2b 09 09 2f 2a 20 49 6e 64 65 78 20 6f 75 74  .+../* Index out
13a0: 20 6f 66 20 72 61 6e 67 65 20 63 61 73 65 20 2a   of range case *
13b0: 2f 0a 2b 09 09 76 61 6c 50 74 72 20 3d 20 54 63  /.+..valPtr = Tc
13c0: 6c 5f 4e 65 77 4f 62 6a 28 29 3b 0a 2b 09 20 20  l_NewObj();.+.  
13d0: 20 20 7d 0a 2b 09 20 20 20 20 54 63 6c 5f 49 6e    }.+.    Tcl_In
13e0: 63 72 52 65 66 43 6f 75 6e 74 28 76 61 6c 50 74  crRefCount(valPt
13f0: 72 29 3b 0a 2b 09 20 20 20 20 72 65 74 75 72 6e  r);.+.    return
1400: 20 76 61 6c 50 74 72 3b 0a 2b 09 7d 0a 2b 0a 20   valPtr;.+.}.+. 
1410: 09 2f 2a 0a 20 09 20 2a 20 61 72 67 50 74 72 20  ./*. . * argPtr 
1420: 64 65 73 69 67 6e 61 74 65 73 20 61 20 73 69 6e  designates a sin
1430: 67 6c 65 20 69 6e 64 65 78 2e 0a 20 09 20 2a 2f  gle index.. . */
1440: 0a 40 40 20 2d 32 37 32 38 2c 39 20 2b 32 37 35  .@@ -2728,9 +275
1450: 37 2c 31 33 20 40 40 0a 20 09 72 65 74 75 72 6e  7,13 @@. .return
1460: 20 54 43 4c 5f 45 52 52 4f 52 3b 0a 20 20 20 20   TCL_ERROR;.    
1470: 20 7d 0a 20 0a 2d 20 20 20 20 72 65 73 75 6c 74   }. .-    result
1480: 20 3d 20 54 63 6c 5f 4c 69 73 74 4f 62 6a 4c 65   = Tcl_ListObjLe
1490: 6e 67 74 68 28 69 6e 74 65 72 70 2c 20 6f 62 6a  ngth(interp, obj
14a0: 76 5b 31 5d 2c 20 26 6c 69 73 74 4c 65 6e 29 3b  v[1], &listLen);
14b0: 0a 2d 20 20 20 20 69 66 20 28 72 65 73 75 6c 74  .-    if (result
14c0: 20 21 3d 20 54 43 4c 5f 4f 4b 29 20 7b 0a 2d 09   != TCL_OK) {.-.
14d0: 72 65 74 75 72 6e 20 72 65 73 75 6c 74 3b 0a 2b  return result;.+
14e0: 20 20 20 20 69 66 20 28 6f 62 6a 76 5b 31 5d 2d      if (objv[1]-
14f0: 3e 74 79 70 65 50 74 72 20 3d 3d 20 26 74 63 6c  >typePtr == &tcl
1500: 41 72 69 74 68 53 65 72 69 65 73 54 79 70 65 29  ArithSeriesType)
1510: 20 7b 0a 2b 09 20 20 20 20 6c 69 73 74 4c 65 6e   {.+.    listLen
1520: 20 3d 20 54 63 6c 5f 41 72 69 74 68 53 65 72 69   = Tcl_ArithSeri
1530: 65 73 4f 62 6a 4c 65 6e 67 74 68 28 6f 62 6a 76  esObjLength(objv
1540: 5b 31 5d 29 3b 0a 2b 20 20 20 20 7d 20 65 6c 73  [1]);.+    } els
1550: 65 20 7b 0a 2b 20 20 20 20 20 20 20 20 72 65 73  e {.+        res
1560: 75 6c 74 20 3d 20 54 63 6c 5f 4c 69 73 74 4f 62  ult = Tcl_ListOb
1570: 6a 4c 65 6e 67 74 68 28 69 6e 74 65 72 70 2c 20  jLength(interp, 
1580: 6f 62 6a 76 5b 31 5d 2c 20 26 6c 69 73 74 4c 65  objv[1], &listLe
1590: 6e 29 3b 0a 2b 20 20 20 20 20 20 20 20 69 66 20  n);.+        if 
15a0: 28 72 65 73 75 6c 74 20 21 3d 20 54 43 4c 5f 4f  (result != TCL_O
15b0: 4b 29 20 7b 0a 2b 09 20 20 20 20 72 65 74 75 72  K) {.+.    retur
15c0: 6e 20 72 65 73 75 6c 74 3b 0a 2b 20 20 20 20 20  n result;.+     
15d0: 20 20 20 7d 0a 20 20 20 20 20 7d 0a 20 0a 20 20     }.     }. .  
15e0: 20 20 20 2f 2a 0a 40 40 20 2d 33 36 34 37 2c 36     /*.@@ -3647,6
15f0: 20 2b 33 36 38 30 2c 38 33 20 40 40 0a 20 20 20   +3680,83 @@.   
1600: 20 20 72 65 74 75 72 6e 20 54 43 4c 5f 4f 4b 3b    return TCL_OK;
1610: 0a 20 7d 0a 20 0c 0a 2b 0a 2b 2f 2a 0a 2b 20 2a  . }. ..+.+/*.+ *
1620: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1630: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1640: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1650: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1660: 2d 2d 2d 2d 2d 2d 0a 2b 20 2a 0a 2b 20 2a 20 54  ------.+ *.+ * T
1670: 63 6c 5f 52 61 6e 67 65 4f 62 6a 43 6d 64 20 2d  cl_RangeObjCmd -
1680: 2d 0a 2b 20 2a 0a 2b 20 2a 20 09 54 68 69 73 20  -.+ *.+ * .This 
1690: 70 72 6f 63 65 64 75 72 65 20 72 65 74 75 72 6e  procedure return
16a0: 73 20 61 20 6c 69 73 74 20 77 68 65 72 65 20 65  s a list where e
16b0: 76 65 72 79 20 65 6c 65 6d 65 6e 74 20 69 73 0a  very element is.
16c0: 2b 20 2a 20 09 70 61 72 74 20 6f 66 20 61 6e 20  + * .part of an 
16d0: 61 72 69 74 68 6d 65 74 69 63 20 73 65 71 75 65  arithmetic seque
16e0: 6e 63 65 20 73 74 61 72 74 69 6e 67 20 77 69 74  nce starting wit
16f0: 68 20 74 68 65 20 6e 75 6d 62 65 72 20 53 54 41  h the number STA
1700: 52 54 2c 0a 2b 20 2a 20 09 69 6e 63 72 65 6d 65  RT,.+ * .increme
1710: 6e 74 69 6e 67 20 74 68 65 20 6e 65 78 74 20 65  nting the next e
1720: 6c 65 6d 65 6e 74 73 20 6f 66 20 53 54 45 50 2c  lements of STEP,
1730: 20 61 6e 64 20 69 6e 63 6c 75 64 69 6e 67 0a 2b   and including.+
1740: 20 2a 20 09 61 6c 6c 20 74 68 65 20 65 6c 65 6d   * .all the elem
1750: 65 6e 74 73 20 3c 20 45 4e 44 20 28 6f 72 20 3e  ents < END (or >
1760: 20 45 4e 44 20 66 6f 72 20 6e 65 67 61 74 69 76   END for negativ
1770: 65 20 73 74 65 70 73 29 2e 0a 2b 20 2a 20 09 54  e steps)..+ * .T
1780: 68 65 20 63 6f 6d 6d 61 6e 64 20 72 65 74 75 72  he command retur
1790: 6e 73 20 61 20 73 70 65 63 69 61 6c 69 7a 65 64  ns a specialized
17a0: 20 6f 62 6a 65 63 74 20 61 62 6c 65 20 74 6f 20   object able to 
17b0: 72 65 70 72 65 73 65 6e 74 0a 2b 20 2a 20 09 74  represent.+ * .t
17c0: 68 69 73 20 6c 69 73 74 73 20 69 6e 20 63 6f 6e  his lists in con
17d0: 73 74 61 6e 74 20 73 70 61 63 65 20 28 74 68 65  stant space (the
17e0: 20 41 72 69 74 68 6d 65 74 69 63 20 53 65 71 75   Arithmetic Sequ
17f0: 65 6e 63 65 20 6f 62 6a 65 63 74 20 74 79 70 65  ence object type
1800: 29 2e 0a 2b 20 2a 20 09 53 65 65 20 54 63 6c 5f  )..+ * .See Tcl_
1810: 4c 69 73 74 4f 62 6a 2e 63 20 66 6f 72 20 6d 6f  ListObj.c for mo
1820: 72 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 6f  re information o
1830: 6e 20 74 68 69 73 20 6f 62 6a 65 63 74 2e 0a 2b  n this object..+
1840: 20 2a 0a 2b 20 2a 20 52 65 73 75 6c 74 73 3a 0a   *.+ * Results:.
1850: 2b 20 2a 09 41 20 73 74 61 6e 64 61 72 64 20 54  + *.A standard T
1860: 63 6c 20 72 65 73 75 6c 74 2e 0a 2b 20 2a 0a 2b  cl result..+ *.+
1870: 20 2a 20 53 69 64 65 20 65 66 66 65 63 74 73 3a   * Side effects:
1880: 0a 2b 20 2a 09 53 65 65 20 74 68 65 20 75 73 65  .+ *.See the use
1890: 72 20 64 6f 63 75 6d 65 6e 74 61 74 69 6f 6e 2e  r documentation.
18a0: 0a 2b 20 2a 0a 2b 20 2a 2d 2d 2d 2d 2d 2d 2d 2d  .+ *.+ *--------
18b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
18c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
18d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
18e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 2b  --------------.+
18f0: 20 2a 2f 0a 2b 0a 2b 69 6e 74 0a 2b 54 63 6c 5f   */.+.+int.+Tcl_
1900: 52 61 6e 67 65 4f 62 6a 43 6d 64 28 20 63 6c 69  RangeObjCmd( cli
1910: 65 6e 74 44 61 74 61 2c 20 69 6e 74 65 72 70 2c  entData, interp,
1920: 20 6f 62 6a 63 2c 20 6f 62 6a 76 20 29 0a 2b 20   objc, objv ).+ 
1930: 20 20 20 43 6c 69 65 6e 74 44 61 74 61 20 63 6c     ClientData cl
1940: 69 65 6e 74 44 61 74 61 3b 09 2f 2a 20 4e 6f 74  ientData;./* Not
1950: 20 75 73 65 64 2e 20 2a 2f 0a 2b 20 20 20 20 54   used. */.+    T
1960: 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72  cl_Interp *inter
1970: 70 3b 09 09 2f 2a 20 43 75 72 72 65 6e 74 20 69  p;../* Current i
1980: 6e 74 65 72 70 72 65 74 65 72 2e 20 2a 2f 0a 2b  nterpreter. */.+
1990: 20 20 20 20 69 6e 74 20 6f 62 6a 63 3b 09 09 09      int objc;...
19a0: 2f 2a 20 4e 75 6d 62 65 72 20 6f 66 20 61 72 67  /* Number of arg
19b0: 75 6d 65 6e 74 73 2e 20 2a 2f 0a 2b 20 20 20 20  uments. */.+    
19c0: 54 63 6c 5f 4f 62 6a 20 2a 43 4f 4e 53 54 20 6f  Tcl_Obj *CONST o
19d0: 62 6a 76 5b 5d 3b 09 2f 2a 20 41 72 67 75 6d 65  bjv[];./* Argume
19e0: 6e 74 20 76 61 6c 75 65 73 2e 20 2a 2f 0a 2b 7b  nt values. */.+{
19f0: 0a 2b 20 20 20 20 54 63 6c 5f 57 69 64 65 49 6e  .+    Tcl_WideIn
1a00: 74 20 73 74 61 72 74 20 3d 20 30 2c 20 65 6e 64  t start = 0, end
1a10: 2c 20 73 74 65 70 20 3d 20 31 3b 0a 2b 20 20 20  , step = 1;.+   
1a20: 20 54 63 6c 5f 4f 62 6a 20 2a 61 72 69 74 68 53   Tcl_Obj *arithS
1a30: 65 72 69 65 73 50 74 72 3b 0a 2b 0a 2b 20 20 20  eriesPtr;.+.+   
1a40: 20 2f 2a 20 43 68 65 63 6b 20 70 61 72 61 6d 65   /* Check parame
1a50: 74 65 72 20 63 6f 75 6e 74 20 2a 2f 0a 2b 0a 2b  ter count */.+.+
1a60: 20 20 20 20 69 66 20 28 6f 62 6a 63 20 3c 20 32      if (objc < 2
1a70: 20 7c 7c 20 6f 62 6a 63 20 3e 20 34 29 20 7b 0a   || objc > 4) {.
1a80: 2b 09 54 63 6c 5f 57 72 6f 6e 67 4e 75 6d 41 72  +.Tcl_WrongNumAr
1a90: 67 73 28 69 6e 74 65 72 70 2c 20 31 2c 20 6f 62  gs(interp, 1, ob
1aa0: 6a 76 2c 20 22 3f 73 74 61 72 74 3f 20 65 6e 64  jv, "?start? end
1ab0: 20 3f 73 74 65 70 3f 22 29 3b 0a 2b 09 72 65 74   ?step?");.+.ret
1ac0: 75 72 6e 20 54 43 4c 5f 45 52 52 4f 52 3b 0a 2b  urn TCL_ERROR;.+
1ad0: 20 20 20 20 7d 0a 2b 0a 2b 20 20 20 20 2f 2a 20      }.+.+    /* 
1ae0: 47 65 74 20 74 68 65 20 73 74 61 72 74 2c 20 65  Get the start, e
1af0: 6e 64 2c 20 73 74 65 70 20 70 61 72 61 6d 65 74  nd, step paramet
1b00: 65 72 73 20 66 72 6f 6d 20 61 72 67 75 6d 65 6e  ers from argumen
1b10: 74 73 20 2a 2f 0a 2b 20 20 20 20 69 66 20 28 6f  ts */.+    if (o
1b20: 62 6a 63 20 3d 3d 20 32 29 20 7b 0a 2b 09 20 20  bjc == 2) {.+.  
1b30: 20 20 69 66 20 28 54 63 6c 5f 47 65 74 57 69 64    if (Tcl_GetWid
1b40: 65 49 6e 74 46 72 6f 6d 4f 62 6a 28 69 6e 74 65  eIntFromObj(inte
1b50: 72 70 2c 20 6f 62 6a 76 5b 31 5d 2c 20 26 65 6e  rp, objv[1], &en
1b60: 64 29 20 21 3d 20 54 43 4c 5f 4f 4b 29 0a 2b 09  d) != TCL_OK).+.
1b70: 09 20 20 20 20 72 65 74 75 72 6e 20 54 43 4c 5f  .    return TCL_
1b80: 45 52 52 4f 52 3b 0a 2b 20 20 20 20 7d 20 65 6c  ERROR;.+    } el
1b90: 73 65 20 69 66 20 28 6f 62 6a 63 20 3e 3d 20 33  se if (objc >= 3
1ba0: 29 20 7b 0a 2b 09 20 20 20 20 69 66 20 28 54 63  ) {.+.    if (Tc
1bb0: 6c 5f 47 65 74 57 69 64 65 49 6e 74 46 72 6f 6d  l_GetWideIntFrom
1bc0: 4f 62 6a 28 69 6e 74 65 72 70 2c 20 6f 62 6a 76  Obj(interp, objv
1bd0: 5b 31 5d 2c 20 26 73 74 61 72 74 29 20 21 3d 20  [1], &start) != 
1be0: 54 43 4c 5f 4f 4b 20 7c 7c 0a 2b 09 09 54 63 6c  TCL_OK ||.+..Tcl
1bf0: 5f 47 65 74 57 69 64 65 49 6e 74 46 72 6f 6d 4f  _GetWideIntFromO
1c00: 62 6a 28 69 6e 74 65 72 70 2c 20 6f 62 6a 76 5b  bj(interp, objv[
1c10: 32 5d 2c 20 26 65 6e 64 29 20 21 3d 20 54 43 4c  2], &end) != TCL
1c20: 5f 4f 4b 29 0a 2b 09 09 20 20 20 20 72 65 74 75  _OK).+..    retu
1c30: 72 6e 20 54 43 4c 5f 45 52 52 4f 52 3b 0a 2b 09  rn TCL_ERROR;.+.
1c40: 20 20 20 20 69 66 20 28 6f 62 6a 63 20 3d 3d 20      if (objc == 
1c50: 34 20 26 26 0a 2b 09 09 54 63 6c 5f 47 65 74 57  4 &&.+..Tcl_GetW
1c60: 69 64 65 49 6e 74 46 72 6f 6d 4f 62 6a 28 69 6e  ideIntFromObj(in
1c70: 74 65 72 70 2c 20 6f 62 6a 76 5b 33 5d 2c 20 26  terp, objv[3], &
1c80: 73 74 65 70 29 20 21 3d 20 54 43 4c 5f 4f 4b 29  step) != TCL_OK)
1c90: 0a 2b 09 09 20 20 20 20 72 65 74 75 72 6e 20 54  .+..    return T
1ca0: 43 4c 5f 45 52 52 4f 52 3b 0a 2b 20 20 20 20 7d  CL_ERROR;.+    }
1cb0: 0a 2b 0a 2b 20 20 20 20 2f 2a 20 43 72 65 61 74  .+.+    /* Creat
1cc0: 65 20 74 68 65 20 61 72 69 74 68 6d 65 74 69 63  e the arithmetic
1cd0: 20 73 65 72 69 65 73 20 6f 62 6a 65 63 74 2c 20   series object, 
1ce0: 63 68 65 63 6b 69 6e 67 20 69 66 20 74 68 65 0a  checking if the.
1cf0: 2b 20 20 20 20 20 2a 20 70 61 72 61 6d 65 74 65  +     * paramete
1d00: 72 73 20 61 72 65 20 69 6e 76 61 6c 69 64 2e 20  rs are invalid. 
1d10: 2a 2f 0a 2b 0a 2b 20 20 20 20 61 72 69 74 68 53  */.+.+    arithS
1d20: 65 72 69 65 73 50 74 72 20 3d 20 54 63 6c 5f 4e  eriesPtr = Tcl_N
1d30: 65 77 41 72 69 74 68 53 65 72 69 65 73 4f 62 6a  ewArithSeriesObj
1d40: 28 73 74 61 72 74 2c 20 65 6e 64 2c 20 73 74 65  (start, end, ste
1d50: 70 29 3b 0a 2b 20 20 20 20 69 66 20 28 61 72 69  p);.+    if (ari
1d60: 74 68 53 65 72 69 65 73 50 74 72 20 3d 3d 20 4e  thSeriesPtr == N
1d70: 55 4c 4c 29 20 7b 0a 2b 09 54 63 6c 5f 41 70 70  ULL) {.+.Tcl_App
1d80: 65 6e 64 52 65 73 75 6c 74 28 69 6e 74 65 72 70  endResult(interp
1d90: 2c 0a 2b 09 09 22 49 6e 76 61 6c 69 64 20 28 69  ,.+.."Invalid (i
1da0: 6e 66 69 6e 69 74 65 3f 29 20 61 72 69 74 68 6d  nfinite?) arithm
1db0: 65 74 69 63 20 73 65 71 75 65 6e 63 65 20 73 70  etic sequence sp
1dc0: 65 63 69 66 69 65 64 22 2c 20 4e 55 4c 4c 29 3b  ecified", NULL);
1dd0: 0a 2b 09 72 65 74 75 72 6e 20 54 43 4c 5f 45 52  .+.return TCL_ER
1de0: 52 4f 52 3b 0a 2b 20 20 20 20 7d 0a 2b 0a 2b 20  ROR;.+    }.+.+ 
1df0: 20 20 20 54 63 6c 5f 49 6e 63 72 52 65 66 43 6f     Tcl_IncrRefCo
1e00: 75 6e 74 28 61 72 69 74 68 53 65 72 69 65 73 50  unt(arithSeriesP
1e10: 74 72 29 3b 20 2f 2a 20 77 65 20 6d 61 79 20 75  tr); /* we may u
1e20: 73 65 20 44 65 63 72 52 65 66 43 6f 75 6e 74 20  se DecrRefCount 
1e30: 74 6f 20 66 72 65 65 20 69 74 20 2a 2f 0a 2b 20  to free it */.+ 
1e40: 20 20 20 69 66 20 28 54 63 6c 5f 41 72 69 74 68     if (Tcl_Arith
1e50: 53 65 72 69 65 73 4f 62 6a 4c 65 6e 67 74 68 28  SeriesObjLength(
1e60: 61 72 69 74 68 53 65 72 69 65 73 50 74 72 29 20  arithSeriesPtr) 
1e70: 3e 20 49 4e 54 5f 4d 41 58 2f 73 69 7a 65 6f 66  > INT_MAX/sizeof
1e80: 28 54 63 6c 5f 4f 62 6a 20 2a 29 29 20 7b 0a 2b  (Tcl_Obj *)) {.+
1e90: 09 54 63 6c 5f 44 65 63 72 52 65 66 43 6f 75 6e  .Tcl_DecrRefCoun
1ea0: 74 28 61 72 69 74 68 53 65 72 69 65 73 50 74 72  t(arithSeriesPtr
1eb0: 29 3b 0a 2b 09 54 63 6c 5f 41 70 70 65 6e 64 52  );.+.Tcl_AppendR
1ec0: 65 73 75 6c 74 28 69 6e 74 65 72 70 2c 20 22 6f  esult(interp, "o
1ed0: 76 65 72 66 6c 6f 77 20 6f 66 20 6d 61 78 69 6d  verflow of maxim
1ee0: 75 6d 20 6c 69 73 74 20 6c 65 6e 67 74 68 22 2c  um list length",
1ef0: 20 4e 55 4c 4c 29 3b 0a 2b 09 72 65 74 75 72 6e   NULL);.+.return
1f00: 20 54 43 4c 5f 45 52 52 4f 52 3b 0a 2b 20 20 20   TCL_ERROR;.+   
1f10: 20 7d 0a 2b 0a 2b 20 20 20 20 2f 2a 20 52 65 74   }.+.+    /* Ret
1f20: 75 72 6e 20 74 68 65 20 6e 65 77 20 6f 62 6a 65  urn the new obje
1f30: 63 74 2e 20 2a 2f 0a 2b 0a 2b 20 20 20 20 54 63  ct. */.+.+    Tc
1f40: 6c 5f 53 65 74 4f 62 6a 52 65 73 75 6c 74 28 69  l_SetObjResult(i
1f50: 6e 74 65 72 70 2c 20 61 72 69 74 68 53 65 72 69  nterp, arithSeri
1f60: 65 73 50 74 72 29 3b 0a 2b 20 20 20 20 54 63 6c  esPtr);.+    Tcl
1f70: 5f 44 65 63 72 52 65 66 43 6f 75 6e 74 28 61 72  _DecrRefCount(ar
1f80: 69 74 68 53 65 72 69 65 73 50 74 72 29 3b 0a 2b  ithSeriesPtr);.+
1f90: 20 20 20 20 72 65 74 75 72 6e 20 54 43 4c 5f 4f      return TCL_O
1fa0: 4b 3b 0a 2b 7d 0a 2b 0a 20 2f 2a 0a 20 20 2a 2d  K;.+}.+. /*.  *-
1fb0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1fc0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1fd0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1fe0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1ff0: 2d 2d 2d 2d 2d 0a 20 20 2a 0a 49 6e 64 65 78 3a  -----.  *.Index:
2000: 20 67 65 6e 65 72 69 63 2f 74 63 6c 44 65 63 6c   generic/tclDecl
2010: 73 2e 68 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  s.h.============
2020: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
2030: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
2040: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
2050: 3d 3d 3d 3d 3d 3d 3d 0a 52 43 53 20 66 69 6c 65  =======.RCS file
2060: 3a 20 2f 63 76 73 72 6f 6f 74 2f 74 63 6c 2f 74  : /cvsroot/tcl/t
2070: 63 6c 2f 67 65 6e 65 72 69 63 2f 74 63 6c 44 65  cl/generic/tclDe
2080: 63 6c 73 2e 68 2c 76 0a 72 65 74 72 69 65 76 69  cls.h,v.retrievi
2090: 6e 67 20 72 65 76 69 73 69 6f 6e 20 31 2e 31 30  ng revision 1.10
20a0: 35 0a 64 69 66 66 20 2d 75 20 2d 72 31 2e 31 30  5.diff -u -r1.10
20b0: 35 20 74 63 6c 44 65 63 6c 73 2e 68 0a 2d 2d 2d  5 tclDecls.h.---
20c0: 20 67 65 6e 65 72 69 63 2f 74 63 6c 44 65 63 6c   generic/tclDecl
20d0: 73 2e 68 09 37 20 4a 75 6e 20 32 30 30 34 20 31  s.h.7 Jun 2004 1
20e0: 36 3a 34 38 3a 34 34 20 2d 30 30 30 30 09 31 2e  6:48:44 -0000.1.
20f0: 31 30 35 0a 2b 2b 2b 20 67 65 6e 65 72 69 63 2f  105.+++ generic/
2100: 74 63 6c 44 65 63 6c 73 2e 68 09 32 35 20 4f 63  tclDecls.h.25 Oc
2110: 74 20 32 30 30 34 20 30 36 3a 33 38 3a 31 30 20  t 2004 06:38:10 
2120: 2d 30 30 30 30 0a 40 40 20 2d 33 33 31 34 2c 36  -0000.@@ -3314,6
2130: 20 2b 33 33 31 34 2c 32 35 20 40 40 0a 20 45 58   +3314,25 @@. EX
2140: 54 45 52 4e 20 69 6e 74 09 09 54 63 6c 5f 4c 69  TERN int..Tcl_Li
2150: 6d 69 74 47 65 74 47 72 61 6e 75 6c 61 72 69 74  mitGetGranularit
2160: 79 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 0a  y _ANSI_ARGS_((.
2170: 20 09 09 09 09 54 63 6c 5f 49 6e 74 65 72 70 20   ....Tcl_Interp 
2180: 2a 20 69 6e 74 65 72 70 2c 20 69 6e 74 20 74 79  * interp, int ty
2190: 70 65 29 29 3b 0a 20 23 65 6e 64 69 66 0a 2b 23  pe));. #endif.+#
21a0: 69 66 6e 64 65 66 20 54 63 6c 5f 4e 65 77 41 72  ifndef Tcl_NewAr
21b0: 69 74 68 53 65 72 69 65 73 4f 62 6a 5f 54 43 4c  ithSeriesObj_TCL
21c0: 5f 44 45 43 4c 41 52 45 44 0a 2b 23 64 65 66 69  _DECLARED.+#defi
21d0: 6e 65 20 54 63 6c 5f 4e 65 77 41 72 69 74 68 53  ne Tcl_NewArithS
21e0: 65 72 69 65 73 4f 62 6a 5f 54 43 4c 5f 44 45 43  eriesObj_TCL_DEC
21f0: 4c 41 52 45 44 0a 2b 2f 2a 20 35 33 35 20 2a 2f  LARED.+/* 535 */
2200: 0a 2b 45 58 54 45 52 4e 20 54 63 6c 5f 4f 62 6a  .+EXTERN Tcl_Obj
2210: 20 2a 09 54 63 6c 5f 4e 65 77 41 72 69 74 68 53   *.Tcl_NewArithS
2220: 65 72 69 65 73 4f 62 6a 20 5f 41 4e 53 49 5f 41  eriesObj _ANSI_A
2230: 52 47 53 5f 28 28 54 63 6c 5f 57 69 64 65 49 6e  RGS_((Tcl_WideIn
2240: 74 20 73 74 61 72 74 2c 20 0a 2b 09 09 09 09 54  t start, .+....T
2250: 63 6c 5f 57 69 64 65 49 6e 74 20 65 6e 64 2c 20  cl_WideInt end, 
2260: 54 63 6c 5f 57 69 64 65 49 6e 74 20 73 74 65 70  Tcl_WideInt step
2270: 29 29 3b 0a 2b 23 65 6e 64 69 66 0a 2b 23 69 66  ));.+#endif.+#if
2280: 6e 64 65 66 20 54 63 6c 5f 41 72 69 74 68 53 65  ndef Tcl_ArithSe
2290: 72 69 65 73 4f 62 6a 49 6e 64 65 78 5f 54 43 4c  riesObjIndex_TCL
22a0: 5f 44 45 43 4c 41 52 45 44 0a 2b 23 64 65 66 69  _DECLARED.+#defi
22b0: 6e 65 20 54 63 6c 5f 41 72 69 74 68 53 65 72 69  ne Tcl_ArithSeri
22c0: 65 73 4f 62 6a 49 6e 64 65 78 5f 54 43 4c 5f 44  esObjIndex_TCL_D
22d0: 45 43 4c 41 52 45 44 0a 2b 2f 2a 20 35 33 36 20  ECLARED.+/* 536 
22e0: 2a 2f 0a 2b 45 58 54 45 52 4e 20 69 6e 74 09 09  */.+EXTERN int..
22f0: 54 63 6c 5f 41 72 69 74 68 53 65 72 69 65 73 4f  Tcl_ArithSeriesO
2300: 62 6a 49 6e 64 65 78 20 5f 41 4e 53 49 5f 41 52  bjIndex _ANSI_AR
2310: 47 53 5f 28 28 0a 2b 09 09 09 09 54 63 6c 5f 4f  GS_((.+....Tcl_O
2320: 62 6a 20 2a 20 61 72 69 74 68 53 65 72 69 65 73  bj * arithSeries
2330: 50 74 72 2c 20 69 6e 74 20 69 6e 64 65 78 2c 20  Ptr, int index, 
2340: 0a 2b 09 09 09 09 54 63 6c 5f 57 69 64 65 49 6e  .+....Tcl_WideIn
2350: 74 20 2a 20 65 6c 65 6d 65 6e 74 29 29 3b 0a 2b  t * element));.+
2360: 23 65 6e 64 69 66 0a 2b 23 69 66 6e 64 65 66 20  #endif.+#ifndef 
2370: 54 63 6c 5f 41 72 69 74 68 53 65 72 69 65 73 4f  Tcl_ArithSeriesO
2380: 62 6a 4c 65 6e 67 74 68 5f 54 43 4c 5f 44 45 43  bjLength_TCL_DEC
2390: 4c 41 52 45 44 0a 2b 23 64 65 66 69 6e 65 20 54  LARED.+#define T
23a0: 63 6c 5f 41 72 69 74 68 53 65 72 69 65 73 4f 62  cl_ArithSeriesOb
23b0: 6a 4c 65 6e 67 74 68 5f 54 43 4c 5f 44 45 43 4c  jLength_TCL_DECL
23c0: 41 52 45 44 0a 2b 2f 2a 20 35 33 37 20 2a 2f 0a  ARED.+/* 537 */.
23d0: 2b 45 58 54 45 52 4e 20 69 6e 74 09 09 54 63 6c  +EXTERN int..Tcl
23e0: 5f 41 72 69 74 68 53 65 72 69 65 73 4f 62 6a 4c  _ArithSeriesObjL
23f0: 65 6e 67 74 68 20 5f 41 4e 53 49 5f 41 52 47 53  ength _ANSI_ARGS
2400: 5f 28 28 0a 2b 09 09 09 09 54 63 6c 5f 4f 62 6a  _((.+....Tcl_Obj
2410: 20 2a 20 61 72 69 74 68 53 65 72 69 65 73 50 74   * arithSeriesPt
2420: 72 29 29 3b 0a 2b 23 65 6e 64 69 66 0a 20 0a 20  r));.+#endif. . 
2430: 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20 54  typedef struct T
2440: 63 6c 53 74 75 62 48 6f 6f 6b 73 20 7b 0a 20 20  clStubHooks {.  
2450: 20 20 20 73 74 72 75 63 74 20 54 63 6c 50 6c 61     struct TclPla
2460: 74 53 74 75 62 73 20 2a 74 63 6c 50 6c 61 74 53  tStubs *tclPlatS
2470: 74 75 62 73 3b 0a 40 40 20 2d 33 38 39 30 2c 36  tubs;.@@ -3890,6
2480: 20 2b 33 39 30 39 2c 39 20 40 40 0a 20 20 20 20   +3909,9 @@.    
2490: 20 69 6e 74 20 28 2a 74 63 6c 5f 4c 69 6d 69 74   int (*tcl_Limit
24a0: 47 65 74 43 6f 6d 6d 61 6e 64 73 29 20 5f 41 4e  GetCommands) _AN
24b0: 53 49 5f 41 52 47 53 5f 28 28 54 63 6c 5f 49 6e  SI_ARGS_((Tcl_In
24c0: 74 65 72 70 20 2a 20 69 6e 74 65 72 70 29 29 3b  terp * interp));
24d0: 20 2f 2a 20 35 33 32 20 2a 2f 0a 20 20 20 20 20   /* 532 */.     
24e0: 76 6f 69 64 20 28 2a 74 63 6c 5f 4c 69 6d 69 74  void (*tcl_Limit
24f0: 47 65 74 54 69 6d 65 29 20 5f 41 4e 53 49 5f 41  GetTime) _ANSI_A
2500: 52 47 53 5f 28 28 54 63 6c 5f 49 6e 74 65 72 70  RGS_((Tcl_Interp
2510: 20 2a 20 69 6e 74 65 72 70 2c 20 54 63 6c 5f 54   * interp, Tcl_T
2520: 69 6d 65 20 2a 20 74 69 6d 65 4c 69 6d 69 74 50  ime * timeLimitP
2530: 74 72 29 29 3b 20 2f 2a 20 35 33 33 20 2a 2f 0a  tr)); /* 533 */.
2540: 20 20 20 20 20 69 6e 74 20 28 2a 74 63 6c 5f 4c       int (*tcl_L
2550: 69 6d 69 74 47 65 74 47 72 61 6e 75 6c 61 72 69  imitGetGranulari
2560: 74 79 29 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28  ty) _ANSI_ARGS_(
2570: 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a 20 69 6e  (Tcl_Interp * in
2580: 74 65 72 70 2c 20 69 6e 74 20 74 79 70 65 29 29  terp, int type))
2590: 3b 20 2f 2a 20 35 33 34 20 2a 2f 0a 2b 20 20 20  ; /* 534 */.+   
25a0: 20 54 63 6c 5f 4f 62 6a 20 2a 20 28 2a 74 63 6c   Tcl_Obj * (*tcl
25b0: 5f 4e 65 77 41 72 69 74 68 53 65 72 69 65 73 4f  _NewArithSeriesO
25c0: 62 6a 29 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28  bj) _ANSI_ARGS_(
25d0: 28 54 63 6c 5f 57 69 64 65 49 6e 74 20 73 74 61  (Tcl_WideInt sta
25e0: 72 74 2c 20 54 63 6c 5f 57 69 64 65 49 6e 74 20  rt, Tcl_WideInt 
25f0: 65 6e 64 2c 20 54 63 6c 5f 57 69 64 65 49 6e 74  end, Tcl_WideInt
2600: 20 73 74 65 70 29 29 3b 20 2f 2a 20 35 33 35 20   step)); /* 535 
2610: 2a 2f 0a 2b 20 20 20 20 69 6e 74 20 28 2a 74 63  */.+    int (*tc
2620: 6c 5f 41 72 69 74 68 53 65 72 69 65 73 4f 62 6a  l_ArithSeriesObj
2630: 49 6e 64 65 78 29 20 5f 41 4e 53 49 5f 41 52 47  Index) _ANSI_ARG
2640: 53 5f 28 28 54 63 6c 5f 4f 62 6a 20 2a 20 61 72  S_((Tcl_Obj * ar
2650: 69 74 68 53 65 72 69 65 73 50 74 72 2c 20 69 6e  ithSeriesPtr, in
2660: 74 20 69 6e 64 65 78 2c 20 54 63 6c 5f 57 69 64  t index, Tcl_Wid
2670: 65 49 6e 74 20 2a 20 65 6c 65 6d 65 6e 74 29 29  eInt * element))
2680: 3b 20 2f 2a 20 35 33 36 20 2a 2f 0a 2b 20 20 20  ; /* 536 */.+   
2690: 20 69 6e 74 20 28 2a 74 63 6c 5f 41 72 69 74 68   int (*tcl_Arith
26a0: 53 65 72 69 65 73 4f 62 6a 4c 65 6e 67 74 68 29  SeriesObjLength)
26b0: 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 54 63   _ANSI_ARGS_((Tc
26c0: 6c 5f 4f 62 6a 20 2a 20 61 72 69 74 68 53 65 72  l_Obj * arithSer
26d0: 69 65 73 50 74 72 29 29 3b 20 2f 2a 20 35 33 37  iesPtr)); /* 537
26e0: 20 2a 2f 0a 20 7d 20 54 63 6c 53 74 75 62 73 3b   */. } TclStubs;
26f0: 0a 20 0a 20 23 69 66 64 65 66 20 5f 5f 63 70 6c  . . #ifdef __cpl
2700: 75 73 70 6c 75 73 0a 40 40 20 2d 36 30 37 30 2c  usplus.@@ -6070,
2710: 36 20 2b 36 30 39 32 2c 31 38 20 40 40 0a 20 23  6 +6092,18 @@. #
2720: 64 65 66 69 6e 65 20 54 63 6c 5f 4c 69 6d 69 74  define Tcl_Limit
2730: 47 65 74 47 72 61 6e 75 6c 61 72 69 74 79 20 5c  GetGranularity \
2740: 0a 20 09 28 74 63 6c 53 74 75 62 73 50 74 72 2d  . .(tclStubsPtr-
2750: 3e 74 63 6c 5f 4c 69 6d 69 74 47 65 74 47 72 61  >tcl_LimitGetGra
2760: 6e 75 6c 61 72 69 74 79 29 20 2f 2a 20 35 33 34  nularity) /* 534
2770: 20 2a 2f 0a 20 23 65 6e 64 69 66 0a 2b 23 69 66   */. #endif.+#if
2780: 6e 64 65 66 20 54 63 6c 5f 4e 65 77 41 72 69 74  ndef Tcl_NewArit
2790: 68 53 65 72 69 65 73 4f 62 6a 0a 2b 23 64 65 66  hSeriesObj.+#def
27a0: 69 6e 65 20 54 63 6c 5f 4e 65 77 41 72 69 74 68  ine Tcl_NewArith
27b0: 53 65 72 69 65 73 4f 62 6a 20 5c 0a 2b 09 28 74  SeriesObj \.+.(t
27c0: 63 6c 53 74 75 62 73 50 74 72 2d 3e 74 63 6c 5f  clStubsPtr->tcl_
27d0: 4e 65 77 41 72 69 74 68 53 65 72 69 65 73 4f 62  NewArithSeriesOb
27e0: 6a 29 20 2f 2a 20 35 33 35 20 2a 2f 0a 2b 23 65  j) /* 535 */.+#e
27f0: 6e 64 69 66 0a 2b 23 69 66 6e 64 65 66 20 54 63  ndif.+#ifndef Tc
2800: 6c 5f 41 72 69 74 68 53 65 72 69 65 73 4f 62 6a  l_ArithSeriesObj
2810: 49 6e 64 65 78 0a 2b 23 64 65 66 69 6e 65 20 54  Index.+#define T
2820: 63 6c 5f 41 72 69 74 68 53 65 72 69 65 73 4f 62  cl_ArithSeriesOb
2830: 6a 49 6e 64 65 78 20 5c 0a 2b 09 28 74 63 6c 53  jIndex \.+.(tclS
2840: 74 75 62 73 50 74 72 2d 3e 74 63 6c 5f 41 72 69  tubsPtr->tcl_Ari
2850: 74 68 53 65 72 69 65 73 4f 62 6a 49 6e 64 65 78  thSeriesObjIndex
2860: 29 20 2f 2a 20 35 33 36 20 2a 2f 0a 2b 23 65 6e  ) /* 536 */.+#en
2870: 64 69 66 0a 2b 23 69 66 6e 64 65 66 20 54 63 6c  dif.+#ifndef Tcl
2880: 5f 41 72 69 74 68 53 65 72 69 65 73 4f 62 6a 4c  _ArithSeriesObjL
2890: 65 6e 67 74 68 0a 2b 23 64 65 66 69 6e 65 20 54  ength.+#define T
28a0: 63 6c 5f 41 72 69 74 68 53 65 72 69 65 73 4f 62  cl_ArithSeriesOb
28b0: 6a 4c 65 6e 67 74 68 20 5c 0a 2b 09 28 74 63 6c  jLength \.+.(tcl
28c0: 53 74 75 62 73 50 74 72 2d 3e 74 63 6c 5f 41 72  StubsPtr->tcl_Ar
28d0: 69 74 68 53 65 72 69 65 73 4f 62 6a 4c 65 6e 67  ithSeriesObjLeng
28e0: 74 68 29 20 2f 2a 20 35 33 37 20 2a 2f 0a 2b 23  th) /* 537 */.+#
28f0: 65 6e 64 69 66 0a 20 0a 20 23 65 6e 64 69 66 20  endif. . #endif 
2900: 2f 2a 20 64 65 66 69 6e 65 64 28 55 53 45 5f 54  /* defined(USE_T
2910: 43 4c 5f 53 54 55 42 53 29 20 26 26 20 21 64 65  CL_STUBS) && !de
2920: 66 69 6e 65 64 28 55 53 45 5f 54 43 4c 5f 53 54  fined(USE_TCL_ST
2930: 55 42 5f 50 52 4f 43 53 29 20 2a 2f 0a 20 0a 49  UB_PROCS) */. .I
2940: 6e 64 65 78 3a 20 67 65 6e 65 72 69 63 2f 74 63  ndex: generic/tc
2950: 6c 45 78 65 63 75 74 65 2e 63 0a 3d 3d 3d 3d 3d  lExecute.c.=====
2960: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
2970: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
2980: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
2990: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 52  ==============.R
29a0: 43 53 20 66 69 6c 65 3a 20 2f 63 76 73 72 6f 6f  CS file: /cvsroo
29b0: 74 2f 74 63 6c 2f 74 63 6c 2f 67 65 6e 65 72 69  t/tcl/tcl/generi
29c0: 63 2f 74 63 6c 45 78 65 63 75 74 65 2e 63 2c 76  c/tclExecute.c,v
29d0: 0a 72 65 74 72 69 65 76 69 6e 67 20 72 65 76 69  .retrieving revi
29e0: 73 69 6f 6e 20 31 2e 31 36 31 0a 64 69 66 66 20  sion 1.161.diff 
29f0: 2d 75 20 2d 72 31 2e 31 36 31 20 74 63 6c 45 78  -u -r1.161 tclEx
2a00: 65 63 75 74 65 2e 63 0a 2d 2d 2d 20 67 65 6e 65  ecute.c.--- gene
2a10: 72 69 63 2f 74 63 6c 45 78 65 63 75 74 65 2e 63  ric/tclExecute.c
2a20: 09 32 35 20 4f 63 74 20 32 30 30 34 20 30 31 3a  .25 Oct 2004 01:
2a30: 30 36 3a 34 39 20 2d 30 30 30 30 09 31 2e 31 36  06:49 -0000.1.16
2a40: 31 0a 2b 2b 2b 20 67 65 6e 65 72 69 63 2f 74 63  1.+++ generic/tc
2a50: 6c 45 78 65 63 75 74 65 2e 63 09 32 35 20 4f 63  lExecute.c.25 Oc
2a60: 74 20 32 30 30 34 20 30 36 3a 33 38 3a 31 39 20  t 2004 06:38:19 
2a70: 2d 30 30 30 30 0a 40 40 20 2d 32 36 30 30 2c 31  -0000.@@ -2600,1
2a80: 33 20 2b 32 36 30 30 2c 31 37 20 40 40 0a 20 09  3 +2600,17 @@. .
2a90: 20 20 20 20 0a 20 09 20 20 20 20 76 61 6c 75 65      . .    value
2aa0: 50 74 72 20 3d 20 2a 74 6f 73 50 74 72 3b 0a 20  Ptr = *tosPtr;. 
2ab0: 0a 2d 09 20 20 20 20 72 65 73 75 6c 74 20 3d 20  .-.    result = 
2ac0: 54 63 6c 5f 4c 69 73 74 4f 62 6a 4c 65 6e 67 74  Tcl_ListObjLengt
2ad0: 68 28 69 6e 74 65 72 70 2c 20 76 61 6c 75 65 50  h(interp, valueP
2ae0: 74 72 2c 20 26 6c 65 6e 67 74 68 29 3b 0a 2d 09  tr, &length);.-.
2af0: 20 20 20 20 69 66 20 28 72 65 73 75 6c 74 20 21      if (result !
2b00: 3d 20 54 43 4c 5f 4f 4b 29 20 7b 0a 2d 09 09 54  = TCL_OK) {.-..T
2b10: 52 41 43 45 5f 57 49 54 48 5f 4f 42 4a 28 28 22  RACE_WITH_OBJ(("
2b20: 25 2e 33 30 73 20 3d 3e 20 45 52 52 4f 52 3a 20  %.30s => ERROR: 
2b30: 22 2c 20 4f 32 53 28 76 61 6c 75 65 50 74 72 29  ", O2S(valuePtr)
2b40: 29 2c 0a 2d 09 09 09 54 63 6c 5f 47 65 74 4f 62  ),.-...Tcl_GetOb
2b50: 6a 52 65 73 75 6c 74 28 69 6e 74 65 72 70 29 29  jResult(interp))
2b60: 3b 0a 2d 09 09 67 6f 74 6f 20 63 68 65 63 6b 46  ;.-..goto checkF
2b70: 6f 72 43 61 74 63 68 3b 0a 2b 09 20 20 20 20 69  orCatch;.+.    i
2b80: 66 20 28 76 61 6c 75 65 50 74 72 2d 3e 74 79 70  f (valuePtr->typ
2b90: 65 50 74 72 20 3d 3d 20 26 74 63 6c 41 72 69 74  ePtr == &tclArit
2ba0: 68 53 65 72 69 65 73 54 79 70 65 29 20 7b 0a 2b  hSeriesType) {.+
2bb0: 09 20 20 20 20 20 20 20 20 6f 62 6a 52 65 73 75  .        objResu
2bc0: 6c 74 50 74 72 20 3d 20 54 63 6c 5f 4e 65 77 49  ltPtr = Tcl_NewI
2bd0: 6e 74 4f 62 6a 28 54 63 6c 5f 41 72 69 74 68 53  ntObj(Tcl_ArithS
2be0: 65 72 69 65 73 4f 62 6a 4c 65 6e 67 74 68 28 76  eriesObjLength(v
2bf0: 61 6c 75 65 50 74 72 29 29 3b 0a 2b 09 20 20 20  aluePtr));.+.   
2c00: 20 7d 20 65 6c 73 65 20 7b 0a 2b 09 20 20 20 20   } else {.+.    
2c10: 20 20 20 20 72 65 73 75 6c 74 20 3d 20 54 63 6c      result = Tcl
2c20: 5f 4c 69 73 74 4f 62 6a 4c 65 6e 67 74 68 28 69  _ListObjLength(i
2c30: 6e 74 65 72 70 2c 20 76 61 6c 75 65 50 74 72 2c  nterp, valuePtr,
2c40: 20 26 6c 65 6e 67 74 68 29 3b 0a 2b 09 20 20 20   &length);.+.   
2c50: 20 20 20 20 20 69 66 20 28 72 65 73 75 6c 74 20       if (result 
2c60: 21 3d 20 54 43 4c 5f 4f 4b 29 20 7b 0a 2b 09 09  != TCL_OK) {.+..
2c70: 20 20 20 20 54 52 41 43 45 5f 57 49 54 48 5f 4f      TRACE_WITH_O
2c80: 42 4a 28 28 22 25 2e 33 30 73 20 3d 3e 20 45 52  BJ(("%.30s => ER
2c90: 52 4f 52 3a 20 22 2c 20 4f 32 53 28 76 61 6c 75  ROR: ", O2S(valu
2ca0: 65 50 74 72 29 29 2c 0a 2b 09 09 09 20 20 20 20  ePtr)),.+...    
2cb0: 54 63 6c 5f 47 65 74 4f 62 6a 52 65 73 75 6c 74  Tcl_GetObjResult
2cc0: 28 69 6e 74 65 72 70 29 29 3b 0a 2b 09 09 20 20  (interp));.+..  
2cd0: 20 20 67 6f 74 6f 20 63 68 65 63 6b 46 6f 72 43    goto checkForC
2ce0: 61 74 63 68 3b 0a 2b 09 20 20 20 20 20 20 20 20  atch;.+.        
2cf0: 7d 0a 2b 09 20 20 20 20 20 20 20 20 6f 62 6a 52  }.+.        objR
2d00: 65 73 75 6c 74 50 74 72 20 3d 20 54 63 6c 5f 4e  esultPtr = Tcl_N
2d10: 65 77 49 6e 74 4f 62 6a 28 6c 65 6e 67 74 68 29  ewIntObj(length)
2d20: 3b 0a 20 09 20 20 20 20 7d 0a 2d 09 20 20 20 20  ;. .    }.-.    
2d30: 6f 62 6a 52 65 73 75 6c 74 50 74 72 20 3d 20 54  objResultPtr = T
2d40: 63 6c 5f 4e 65 77 49 6e 74 4f 62 6a 28 6c 65 6e  cl_NewIntObj(len
2d50: 67 74 68 29 3b 0a 20 09 20 20 20 20 54 52 41 43  gth);. .    TRAC
2d60: 45 28 28 22 25 2e 32 30 73 20 3d 3e 20 25 64 5c  E(("%.20s => %d\
2d70: 6e 22 2c 20 4f 32 53 28 76 61 6c 75 65 50 74 72  n", O2S(valuePtr
2d80: 29 2c 20 6c 65 6e 67 74 68 29 29 3b 0a 20 09 20  ), length));. . 
2d90: 20 20 20 4e 45 58 54 5f 49 4e 53 54 5f 46 28 31     NEXT_INST_F(1
2da0: 2c 20 31 2c 20 31 29 3b 0a 20 09 7d 0a 40 40 20  , 1, 1);. .}.@@ 
2db0: 2d 34 35 35 32 2c 36 20 2b 34 35 35 36 2c 37 20  -4552,6 +4556,7 
2dc0: 40 40 0a 20 09 20 20 20 20 69 6e 74 20 6e 75 6d  @@. .    int num
2dd0: 4c 69 73 74 73 3b 0a 20 09 20 20 20 20 54 63 6c  Lists;. .    Tcl
2de0: 5f 4f 62 6a 20 2a 6c 69 73 74 50 74 72 2c 2a 76  _Obj *listPtr,*v
2df0: 61 6c 75 65 50 74 72 2c 20 2a 76 61 6c 75 65 32  aluePtr, *value2
2e00: 50 74 72 3b 0a 20 09 20 20 20 20 4c 69 73 74 20  Ptr;. .    List 
2e10: 2a 6c 69 73 74 52 65 70 50 74 72 3b 0a 2b 09 20  *listRepPtr;.+. 
2e20: 20 20 20 41 72 69 74 68 53 65 72 69 65 73 20 2a     ArithSeries *
2e30: 61 72 69 74 68 53 65 72 69 65 73 52 65 70 50 74  arithSeriesRepPt
2e40: 72 3b 0a 20 09 20 20 20 20 56 61 72 20 2a 69 74  r;. .    Var *it
2e50: 65 72 56 61 72 50 74 72 2c 20 2a 6c 69 73 74 56  erVarPtr, *listV
2e60: 61 72 50 74 72 3b 0a 20 09 20 20 20 20 69 6e 74  arPtr;. .    int
2e70: 20 69 74 65 72 4e 75 6d 2c 20 6c 69 73 74 54 6d   iterNum, listTm
2e80: 70 49 6e 64 65 78 2c 20 6c 69 73 74 4c 65 6e 2c  pIndex, listLen,
2e90: 20 6e 75 6d 56 61 72 73 3b 0a 20 09 20 20 20 20   numVars;. .    
2ea0: 69 6e 74 20 76 61 72 49 6e 64 65 78 2c 20 76 61  int varIndex, va
2eb0: 6c 49 6e 64 65 78 2c 20 63 6f 6e 74 69 6e 75 65  lIndex, continue
2ec0: 4c 6f 6f 70 2c 20 6a 3b 0a 40 40 20 2d 34 35 38  Loop, j;.@@ -458
2ed0: 36 2c 37 20 2b 34 35 39 31 2c 31 32 20 40 40 0a  6,7 +4591,12 @@.
2ee0: 20 09 09 20 20 20 20 0a 20 09 09 6c 69 73 74 56   ..    . ..listV
2ef0: 61 72 50 74 72 20 3d 20 26 28 63 6f 6d 70 69 6c  arPtr = &(compil
2f00: 65 64 4c 6f 63 61 6c 73 5b 6c 69 73 74 54 6d 70  edLocals[listTmp
2f10: 49 6e 64 65 78 5d 29 3b 0a 20 09 09 6c 69 73 74  Index]);. ..list
2f20: 50 74 72 20 3d 20 6c 69 73 74 56 61 72 50 74 72  Ptr = listVarPtr
2f30: 2d 3e 76 61 6c 75 65 2e 6f 62 6a 50 74 72 3b 0a  ->value.objPtr;.
2f40: 2d 09 09 72 65 73 75 6c 74 20 3d 20 54 63 6c 5f  -..result = Tcl_
2f50: 4c 69 73 74 4f 62 6a 4c 65 6e 67 74 68 28 69 6e  ListObjLength(in
2f60: 74 65 72 70 2c 20 6c 69 73 74 50 74 72 2c 20 26  terp, listPtr, &
2f70: 6c 69 73 74 4c 65 6e 29 3b 0a 2b 09 09 69 66 20  listLen);.+..if 
2f80: 28 6c 69 73 74 50 74 72 2d 3e 74 79 70 65 50 74  (listPtr->typePt
2f90: 72 20 3d 3d 20 26 74 63 6c 41 72 69 74 68 53 65  r == &tclArithSe
2fa0: 72 69 65 73 54 79 70 65 29 20 7b 0a 2b 09 09 09  riesType) {.+...
2fb0: 6c 69 73 74 4c 65 6e 20 3d 20 54 63 6c 5f 41 72  listLen = Tcl_Ar
2fc0: 69 74 68 53 65 72 69 65 73 4f 62 6a 4c 65 6e 67  ithSeriesObjLeng
2fd0: 74 68 28 6c 69 73 74 50 74 72 29 3b 0a 2b 09 09  th(listPtr);.+..
2fe0: 09 72 65 73 75 6c 74 20 3d 20 54 43 4c 5f 4f 4b  .result = TCL_OK
2ff0: 3b 20 2f 2a 20 54 63 6c 5f 41 72 69 74 68 53 65  ; /* Tcl_ArithSe
3000: 72 69 65 73 4c 65 6e 67 74 68 20 63 61 6e 27 74  riesLength can't
3010: 20 66 61 69 6c 20 2a 2f 0a 2b 09 09 7d 20 65 6c   fail */.+..} el
3020: 73 65 20 7b 0a 2b 09 09 09 72 65 73 75 6c 74 20  se {.+...result 
3030: 3d 20 54 63 6c 5f 4c 69 73 74 4f 62 6a 4c 65 6e  = Tcl_ListObjLen
3040: 67 74 68 28 69 6e 74 65 72 70 2c 20 6c 69 73 74  gth(interp, list
3050: 50 74 72 2c 20 26 6c 69 73 74 4c 65 6e 29 3b 0a  Ptr, &listLen);.
3060: 2b 09 09 7d 0a 20 09 09 69 66 20 28 72 65 73 75  +..}. ..if (resu
3070: 6c 74 20 21 3d 20 54 43 4c 5f 4f 4b 29 20 7b 0a  lt != TCL_OK) {.
3080: 20 09 09 20 20 20 20 54 52 41 43 45 5f 57 49 54   ..    TRACE_WIT
3090: 48 5f 4f 42 4a 28 28 22 25 75 20 3d 3e 20 45 52  H_OBJ(("%u => ER
30a0: 52 4f 52 20 63 6f 6e 76 65 72 74 69 6e 67 20 6c  ROR converting l
30b0: 69 73 74 20 25 6c 64 2c 20 5c 22 25 73 5c 22 3a  ist %ld, \"%s\":
30c0: 20 22 2c 0a 20 09 09 20 20 20 20 20 20 20 20 20   ",. ..         
30d0: 20 20 20 6f 70 6e 64 2c 20 69 2c 20 4f 32 53 28     opnd, i, O2S(
30e0: 6c 69 73 74 50 74 72 29 29 2c 20 54 63 6c 5f 47  listPtr)), Tcl_G
30f0: 65 74 4f 62 6a 52 65 73 75 6c 74 28 69 6e 74 65  etObjResult(inte
3100: 72 70 29 29 3b 0a 40 40 20 2d 34 36 30 32 2c 37  rp));.@@ -4602,7
3110: 20 2b 34 36 31 32 2c 37 20 40 40 0a 20 09 20 20   +4612,7 @@. .  
3120: 20 20 20 2a 20 49 66 20 73 6f 6d 65 20 76 61 72     * If some var
3130: 20 69 6e 20 73 6f 6d 65 20 76 61 72 20 6c 69 73   in some var lis
3140: 74 20 73 74 69 6c 6c 20 68 61 73 20 61 20 72 65  t still has a re
3150: 6d 61 69 6e 69 6e 67 20 6c 69 73 74 0a 20 09 20  maining list. . 
3160: 20 20 20 20 2a 20 65 6c 65 6d 65 6e 74 20 69 74      * element it
3170: 65 72 61 74 65 20 6f 6e 65 20 6d 6f 72 65 20 74  erate one more t
3180: 69 6d 65 2e 20 41 73 73 69 67 6e 20 74 6f 20 76  ime. Assign to v
3190: 61 72 20 74 68 65 20 6e 65 78 74 0a 20 09 20 20  ar the next. .  
31a0: 20 20 20 2a 20 65 6c 65 6d 65 6e 74 20 66 72 6f     * element fro
31b0: 6d 20 69 74 73 20 76 61 6c 75 65 20 6c 69 73 74  m its value list
31c0: 2e 20 57 65 20 61 6c 72 65 61 64 79 20 63 68 65  . We already che
31d0: 63 6b 65 64 20 61 62 6f 76 65 0a 2d 09 20 20 20  cked above.-.   
31e0: 20 20 2a 20 74 68 61 74 20 65 61 63 68 20 6c 69    * that each li
31f0: 73 74 20 74 65 6d 70 20 68 6f 6c 64 73 20 61 20  st temp holds a 
3200: 76 61 6c 69 64 20 6c 69 73 74 20 6f 62 6a 65 63  valid list objec
3210: 74 2e 0a 2b 09 20 20 20 20 20 2a 20 74 68 61 74  t..+.     * that
3220: 20 65 61 63 68 20 6c 69 73 74 20 74 65 6d 70 20   each list temp 
3230: 68 6f 6c 64 73 20 61 20 76 61 6c 69 64 20 6c 69  holds a valid li
3240: 73 74 20 6f 72 20 72 61 6e 67 65 20 6f 62 6a 65  st or range obje
3250: 63 74 2e 0a 20 09 20 20 20 20 20 2a 2f 0a 20 09  ct.. .     */. .
3260: 09 0a 20 09 20 20 20 20 69 66 20 28 63 6f 6e 74  .. .    if (cont
3270: 69 6e 75 65 4c 6f 6f 70 29 20 7b 0a 40 40 20 2d  inueLoop) {.@@ -
3280: 34 36 31 34 2c 32 35 20 2b 34 36 32 34 2c 35 39  4614,25 +4624,59
3290: 20 40 40 0a 20 09 09 20 20 20 20 6c 69 73 74 56   @@. ..    listV
32a0: 61 72 50 74 72 20 3d 20 26 28 63 6f 6d 70 69 6c  arPtr = &(compil
32b0: 65 64 4c 6f 63 61 6c 73 5b 6c 69 73 74 54 6d 70  edLocals[listTmp
32c0: 49 6e 64 65 78 5d 29 3b 0a 20 09 09 20 20 20 20  Index]);. ..    
32d0: 6c 69 73 74 50 74 72 20 3d 20 6c 69 73 74 56 61  listPtr = listVa
32e0: 72 50 74 72 2d 3e 76 61 6c 75 65 2e 6f 62 6a 50  rPtr->value.objP
32f0: 74 72 3b 0a 20 09 09 20 20 20 20 6c 69 73 74 52  tr;. ..    listR
3300: 65 70 50 74 72 20 3d 20 28 4c 69 73 74 20 2a 29  epPtr = (List *)
3310: 20 6c 69 73 74 50 74 72 2d 3e 69 6e 74 65 72 6e   listPtr->intern
3320: 61 6c 52 65 70 2e 74 77 6f 50 74 72 56 61 6c 75  alRep.twoPtrValu
3330: 65 2e 70 74 72 31 3b 0a 2d 09 09 20 20 20 20 6c  e.ptr1;.-..    l
3340: 69 73 74 4c 65 6e 20 3d 20 6c 69 73 74 52 65 70  istLen = listRep
3350: 50 74 72 2d 3e 65 6c 65 6d 43 6f 75 6e 74 3b 0a  Ptr->elemCount;.
3360: 2b 09 09 20 20 20 20 61 72 69 74 68 53 65 72 69  +..    arithSeri
3370: 65 73 52 65 70 50 74 72 20 3d 20 28 41 72 69 74  esRepPtr = (Arit
3380: 68 53 65 72 69 65 73 20 2a 29 20 6c 69 73 74 52  hSeries *) listR
3390: 65 70 50 74 72 3b 0a 2b 09 09 20 20 20 20 69 66  epPtr;.+..    if
33a0: 20 28 6c 69 73 74 50 74 72 2d 3e 74 79 70 65 50   (listPtr->typeP
33b0: 74 72 20 3d 3d 20 26 74 63 6c 4c 69 73 74 54 79  tr == &tclListTy
33c0: 70 65 29 20 7b 0a 2b 09 09 20 20 20 20 09 6c 69  pe) {.+..    .li
33d0: 73 74 4c 65 6e 20 3d 20 6c 69 73 74 52 65 70 50  stLen = listRepP
33e0: 74 72 2d 3e 65 6c 65 6d 43 6f 75 6e 74 3b 0a 2b  tr->elemCount;.+
33f0: 09 09 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 2b  ..    } else {.+
3400: 09 09 09 6c 69 73 74 4c 65 6e 20 3d 20 61 72 69  ...listLen = ari
3410: 74 68 53 65 72 69 65 73 52 65 70 50 74 72 2d 3e  thSeriesRepPtr->
3420: 6c 65 6e 3b 0a 2b 09 09 20 20 20 20 7d 0a 20 09  len;.+..    }. .
3430: 09 09 0a 20 09 09 20 20 20 20 76 61 6c 49 6e 64  ... ..    valInd
3440: 65 78 20 3d 20 28 69 74 65 72 4e 75 6d 20 2a 20  ex = (iterNum * 
3450: 6e 75 6d 56 61 72 73 29 3b 0a 20 09 09 20 20 20  numVars);. ..   
3460: 20 66 6f 72 20 28 6a 20 3d 20 30 3b 20 20 6a 20   for (j = 0;  j 
3470: 3c 20 6e 75 6d 56 61 72 73 3b 20 20 6a 2b 2b 29  < numVars;  j++)
3480: 20 7b 0a 2d 09 09 09 69 6e 74 20 73 65 74 45 6d   {.-...int setEm
3490: 70 74 79 53 74 72 20 3d 20 30 3b 0a 2d 09 09 09  ptyStr = 0;.-...
34a0: 69 66 20 28 76 61 6c 49 6e 64 65 78 20 3e 3d 20  if (valIndex >= 
34b0: 6c 69 73 74 4c 65 6e 29 20 7b 0a 2d 09 09 09 20  listLen) {.-... 
34c0: 20 20 20 73 65 74 45 6d 70 74 79 53 74 72 20 3d     setEmptyStr =
34d0: 20 31 3b 0a 2d 09 09 09 20 20 20 20 54 63 6c 4e   1;.-...    TclN
34e0: 65 77 4f 62 6a 28 76 61 6c 75 65 50 74 72 29 3b  ewObj(valuePtr);
34f0: 0a 2d 09 09 09 7d 20 65 6c 73 65 20 7b 0a 2d 09  .-...} else {.-.
3500: 09 09 20 20 20 20 76 61 6c 75 65 50 74 72 20 3d  ..    valuePtr =
3510: 20 6c 69 73 74 52 65 70 50 74 72 2d 3e 65 6c 65   listRepPtr->ele
3520: 6d 65 6e 74 73 5b 76 61 6c 49 6e 64 65 78 5d 3b  ments[valIndex];
3530: 0a 2d 09 09 09 7d 0a 2d 09 09 09 20 20 20 20 0a  .-...}.-...    .
3540: 2b 09 09 09 69 6e 74 20 73 65 74 45 6d 70 74 79  +...int setEmpty
3550: 53 74 72 20 3d 20 30 2c 20 69 6e 6c 69 6e 65 56  Str = 0, inlineV
3560: 61 72 41 63 63 65 73 73 20 3d 20 30 3b 0a 2b 0a  arAccess = 0;.+.
3570: 20 09 09 09 76 61 72 49 6e 64 65 78 20 3d 20 76   ...varIndex = v
3580: 61 72 4c 69 73 74 50 74 72 2d 3e 76 61 72 49 6e  arListPtr->varIn
3590: 64 65 78 65 73 5b 6a 5d 3b 0a 20 09 09 09 76 61  dexes[j];. ...va
35a0: 72 50 74 72 20 3d 20 26 28 63 6f 6d 70 69 6c 65  rPtr = &(compile
35b0: 64 4c 6f 63 61 6c 73 5b 76 61 72 49 6e 64 65 78  dLocals[varIndex
35c0: 5d 29 3b 0a 20 09 09 09 70 61 72 74 31 20 3d 20  ]);. ...part1 = 
35d0: 76 61 72 50 74 72 2d 3e 6e 61 6d 65 3b 0a 20 09  varPtr->name;. .
35e0: 09 09 77 68 69 6c 65 20 28 54 63 6c 49 73 56 61  ..while (TclIsVa
35f0: 72 4c 69 6e 6b 28 76 61 72 50 74 72 29 29 20 7b  rLink(varPtr)) {
3600: 0a 20 09 09 09 20 20 20 20 76 61 72 50 74 72 20  . ...    varPtr 
3610: 3d 20 76 61 72 50 74 72 2d 3e 76 61 6c 75 65 2e  = varPtr->value.
3620: 6c 69 6e 6b 50 74 72 3b 0a 20 09 09 09 7d 0a 2d  linkPtr;. ...}.-
3630: 09 09 09 69 66 20 28 54 63 6c 49 73 56 61 72 44  ...if (TclIsVarD
3640: 69 72 65 63 74 57 72 69 74 61 62 6c 65 28 76 61  irectWritable(va
3650: 72 50 74 72 29 29 20 7b 0a 2b 09 09 09 69 66 20  rPtr)) {.+...if 
3660: 28 54 63 6c 49 73 56 61 72 44 69 72 65 63 74 57  (TclIsVarDirectW
3670: 72 69 74 61 62 6c 65 28 76 61 72 50 74 72 29 29  ritable(varPtr))
3680: 0a 2b 09 09 09 20 20 20 20 69 6e 6c 69 6e 65 56  .+...    inlineV
3690: 61 72 41 63 63 65 73 73 20 3d 20 31 3b 0a 2b 0a  arAccess = 1;.+.
36a0: 2b 09 09 09 69 66 20 28 76 61 6c 49 6e 64 65 78  +...if (valIndex
36b0: 20 3e 3d 20 6c 69 73 74 4c 65 6e 29 20 7b 0a 2b   >= listLen) {.+
36c0: 09 09 09 20 20 20 20 73 65 74 45 6d 70 74 79 53  ...    setEmptyS
36d0: 74 72 20 3d 20 31 3b 0a 2b 09 09 09 20 20 20 20  tr = 1;.+...    
36e0: 54 63 6c 4e 65 77 4f 62 6a 28 76 61 6c 75 65 50  TclNewObj(valueP
36f0: 74 72 29 3b 0a 2b 09 09 09 7d 20 65 6c 73 65 20  tr);.+...} else 
3700: 7b 0a 2b 09 09 09 20 20 20 20 69 66 28 6c 69 73  {.+...    if(lis
3710: 74 50 74 72 2d 3e 74 79 70 65 50 74 72 20 3d 3d  tPtr->typePtr ==
3720: 20 26 74 63 6c 4c 69 73 74 54 79 70 65 29 20 7b   &tclListType) {
3730: 0a 2b 09 09 09 20 20 20 20 20 20 20 20 76 61 6c  .+...        val
3740: 75 65 50 74 72 20 3d 20 6c 69 73 74 52 65 70 50  uePtr = listRepP
3750: 74 72 2d 3e 65 6c 65 6d 65 6e 74 73 5b 76 61 6c  tr->elements[val
3760: 49 6e 64 65 78 5d 3b 0a 2b 09 09 09 20 20 20 20  Index];.+...    
3770: 7d 20 65 6c 73 65 20 7b 0a 2b 09 09 09 09 2f 2a  } else {.+..../*
3780: 0a 2b 09 09 09 09 20 2a 20 49 74 20 69 73 20 61  .+.... * It is a
3790: 20 72 61 6e 67 65 54 79 70 65 20 54 63 6c 5f 4f   rangeType Tcl_O
37a0: 62 6a 21 0a 2b 09 09 09 09 20 2a 0a 2b 09 09 09  bj!.+.... *.+...
37b0: 09 20 2a 20 49 66 20 74 68 65 20 76 61 72 69 61  . * If the varia
37c0: 62 6c 65 20 63 61 6e 20 62 65 20 61 63 63 65 73  ble can be acces
37d0: 73 65 64 20 69 6e 6c 69 6e 65 20 61 6e 64 0a 2b  sed inline and.+
37e0: 09 09 09 09 20 2a 20 69 74 73 20 76 61 6c 75 65  .... * its value
37f0: 20 69 73 20 75 6e 73 68 61 72 65 64 20 77 65 20   is unshared we 
3800: 6d 6f 64 69 66 79 20 69 74 20 69 6e 0a 2b 09 09  modify it in.+..
3810: 09 09 20 2a 20 70 6c 61 63 65 3b 20 6f 74 68 65  .. * place; othe
3820: 72 77 69 73 65 20 77 65 20 63 72 65 61 74 65 20  rwise we create 
3830: 61 20 6e 65 77 20 54 63 6c 5f 4f 62 6a 2e 0a 2b  a new Tcl_Obj..+
3840: 09 09 09 09 20 2a 2f 0a 2b 09 09 09 09 0a 2b 09  .... */.+.....+.
3850: 09 09 09 76 61 6c 75 65 50 74 72 20 3d 20 76 61  ...valuePtr = va
3860: 72 50 74 72 2d 3e 76 61 6c 75 65 2e 6f 62 6a 50  rPtr->value.objP
3870: 74 72 3b 0a 2b 09 09 09 09 69 66 20 28 21 69 6e  tr;.+....if (!in
3880: 6c 69 6e 65 56 61 72 41 63 63 65 73 73 20 7c 7c  lineVarAccess ||
3890: 20 21 76 61 6c 75 65 50 74 72 20 7c 7c 20 54 63   !valuePtr || Tc
38a0: 6c 5f 49 73 53 68 61 72 65 64 28 76 61 6c 75 65  l_IsShared(value
38b0: 50 74 72 29 29 20 7b 0a 2b 09 09 09 09 20 20 20  Ptr)) {.+....   
38c0: 20 54 63 6c 4e 65 77 4f 62 6a 28 76 61 6c 75 65   TclNewObj(value
38d0: 50 74 72 29 3b 0a 2b 09 09 09 09 7d 0a 2b 09 09  Ptr);.+....}.+..
38e0: 09 09 20 20 20 20 0a 2b 09 09 09 09 69 66 20 28  ..    .+....if (
38f0: 61 72 69 74 68 53 65 72 69 65 73 52 65 70 50 74  arithSeriesRepPt
3900: 72 2d 3e 66 6c 61 67 73 20 26 20 54 43 4c 5f 41  r->flags & TCL_A
3910: 52 49 54 48 53 45 52 49 45 53 5f 49 53 5f 57 49  RITHSERIES_IS_WI
3920: 44 45 29 20 7b 0a 2b 09 09 09 09 20 20 20 20 54  DE) {.+....    T
3930: 63 6c 5f 53 65 74 57 69 64 65 49 6e 74 4f 62 6a  cl_SetWideIntObj
3940: 28 76 61 6c 75 65 50 74 72 2c 20 0a 2b 09 09 09  (valuePtr, .+...
3950: 09 09 20 20 20 20 61 72 69 74 68 53 65 72 69 65  ..    arithSerie
3960: 73 52 65 70 50 74 72 2d 3e 73 74 61 72 74 20 2b  sRepPtr->start +
3970: 0a 2b 09 09 09 09 09 20 20 20 20 28 76 61 6c 49  .+.....    (valI
3980: 6e 64 65 78 2a 61 72 69 74 68 53 65 72 69 65 73  ndex*arithSeries
3990: 52 65 70 50 74 72 2d 3e 73 74 65 70 29 29 3b 0a  RepPtr->step));.
39a0: 2b 09 09 09 09 7d 20 65 6c 73 65 20 7b 0a 2b 09  +....} else {.+.
39b0: 09 09 09 20 20 20 20 54 63 6c 5f 53 65 74 49 6e  ...    Tcl_SetIn
39c0: 74 4f 62 6a 28 76 61 6c 75 65 50 74 72 2c 20 0a  tObj(valuePtr, .
39d0: 2b 09 09 09 09 09 20 20 20 20 61 72 69 74 68 53  +.....    arithS
39e0: 65 72 69 65 73 52 65 70 50 74 72 2d 3e 73 74 61  eriesRepPtr->sta
39f0: 72 74 20 2b 0a 2b 09 09 09 09 09 20 20 20 20 28  rt +.+.....    (
3a00: 76 61 6c 49 6e 64 65 78 2a 61 72 69 74 68 53 65  valIndex*arithSe
3a10: 72 69 65 73 52 65 70 50 74 72 2d 3e 73 74 65 70  riesRepPtr->step
3a20: 29 29 3b 0a 2b 09 09 09 09 7d 0a 2b 09 09 09 20  ));.+....}.+... 
3a30: 20 20 20 7d 0a 2b 09 09 09 7d 0a 2b 09 09 09 20     }.+...}.+... 
3a40: 20 20 20 0a 2b 09 09 09 69 66 20 28 69 6e 6c 69     .+...if (inli
3a50: 6e 65 56 61 72 41 63 63 65 73 73 29 20 7b 0a 20  neVarAccess) {. 
3a60: 09 09 09 20 20 20 20 76 61 6c 75 65 32 50 74 72  ...    value2Ptr
3a70: 20 3d 20 76 61 72 50 74 72 2d 3e 76 61 6c 75 65   = varPtr->value
3a80: 2e 6f 62 6a 50 74 72 3b 0a 20 09 09 09 20 20 20  .objPtr;. ...   
3a90: 20 69 66 20 28 76 61 6c 75 65 50 74 72 20 21 3d   if (valuePtr !=
3aa0: 20 76 61 6c 75 65 32 50 74 72 29 20 7b 0a 20 09   value2Ptr) {. .
3ab0: 09 09 09 69 66 20 28 76 61 6c 75 65 32 50 74 72  ...if (value2Ptr
3ac0: 20 21 3d 20 4e 55 4c 4c 29 20 7b 0a 49 6e 64 65   != NULL) {.Inde
3ad0: 78 3a 20 67 65 6e 65 72 69 63 2f 74 63 6c 49 6e  x: generic/tclIn
3ae0: 74 2e 68 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  t.h.============
3af0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
3b00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
3b10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
3b20: 3d 3d 3d 3d 3d 3d 3d 0a 52 43 53 20 66 69 6c 65  =======.RCS file
3b30: 3a 20 2f 63 76 73 72 6f 6f 74 2f 74 63 6c 2f 74  : /cvsroot/tcl/t
3b40: 63 6c 2f 67 65 6e 65 72 69 63 2f 74 63 6c 49 6e  cl/generic/tclIn
3b50: 74 2e 68 2c 76 0a 72 65 74 72 69 65 76 69 6e 67  t.h,v.retrieving
3b60: 20 72 65 76 69 73 69 6f 6e 20 31 2e 31 38 37 0a   revision 1.187.
3b70: 64 69 66 66 20 2d 75 20 2d 72 31 2e 31 38 37 20  diff -u -r1.187 
3b80: 74 63 6c 49 6e 74 2e 68 0a 2d 2d 2d 20 67 65 6e  tclInt.h.--- gen
3b90: 65 72 69 63 2f 74 63 6c 49 6e 74 2e 68 09 32 35  eric/tclInt.h.25
3ba0: 20 4f 63 74 20 32 30 30 34 20 30 31 3a 30 36 3a   Oct 2004 01:06:
3bb0: 35 31 20 2d 30 30 30 30 09 31 2e 31 38 37 0a 2b  51 -0000.1.187.+
3bc0: 2b 2b 20 67 65 6e 65 72 69 63 2f 74 63 6c 49 6e  ++ generic/tclIn
3bd0: 74 2e 68 09 32 35 20 4f 63 74 20 32 30 30 34 20  t.h.25 Oct 2004 
3be0: 30 36 3a 33 38 3a 32 34 20 2d 30 30 30 30 0a 40  06:38:24 -0000.@
3bf0: 40 20 2d 31 35 36 39 2c 36 20 2b 31 35 36 39 2c  @ -1569,6 +1569,
3c00: 32 30 20 40 40 0a 20 7d 20 4c 69 73 74 3b 0a 20  20 @@. } List;. 
3c10: 0a 20 2f 2a 0a 2b 20 2a 20 54 68 65 20 73 74 72  . /*.+ * The str
3c20: 75 63 74 75 72 65 20 75 73 65 64 20 66 6f 72 20  ucture used for 
3c30: 74 68 65 20 41 69 72 74 68 53 65 72 69 65 73 20  the AirthSeries 
3c40: 69 6e 74 65 72 6e 61 6c 20 72 65 70 72 65 73 65  internal represe
3c50: 6e 74 61 74 69 6f 6e 2e 0a 2b 20 2a 20 4e 6f 74  ntation..+ * Not
3c60: 65 20 74 68 61 74 20 74 68 65 20 6c 65 6e 20 63  e that the len c
3c70: 61 6e 20 69 6e 20 74 68 65 6f 72 79 20 62 65 20  an in theory be 
3c80: 61 6c 77 61 79 73 20 63 6f 6d 70 75 74 65 64 20  always computed 
3c90: 62 79 20 73 74 61 72 74 2c 65 6e 64 2c 73 74 65  by start,end,ste
3ca0: 70 0a 2b 20 2a 20 62 75 74 20 69 74 27 73 20 66  p.+ * but it's f
3cb0: 61 73 74 65 72 20 74 6f 20 63 61 63 68 65 20 69  aster to cache i
3cc0: 74 20 69 6e 73 69 64 65 20 74 68 65 20 69 6e 74  t inside the int
3cd0: 65 72 6e 61 6c 20 72 65 70 72 65 73 65 6e 74 61  ernal representa
3ce0: 74 69 6f 6e 2e 0a 2b 20 2a 2f 0a 2b 23 64 65 66  tion..+ */.+#def
3cf0: 69 6e 65 20 54 43 4c 5f 41 52 49 54 48 53 45 52  ine TCL_ARITHSER
3d00: 49 45 53 5f 49 53 5f 57 49 44 45 20 31 0a 2b 74  IES_IS_WIDE 1.+t
3d10: 79 70 65 64 65 66 20 73 74 72 75 63 74 20 41 72  ypedef struct Ar
3d20: 69 74 68 53 65 72 69 65 73 20 7b 0a 2b 20 20 20  ithSeries {.+   
3d30: 20 54 63 6c 5f 57 69 64 65 49 6e 74 20 73 74 61   Tcl_WideInt sta
3d40: 72 74 3b 0a 2b 20 20 20 20 54 63 6c 5f 57 69 64  rt;.+    Tcl_Wid
3d50: 65 49 6e 74 20 65 6e 64 3b 0a 2b 20 20 20 20 54  eInt end;.+    T
3d60: 63 6c 5f 57 69 64 65 49 6e 74 20 73 74 65 70 3b  cl_WideInt step;
3d70: 0a 2b 20 20 20 20 69 6e 74 20 6c 65 6e 3b 0a 2b  .+    int len;.+
3d80: 20 20 20 20 69 6e 74 20 66 6c 61 67 73 3b 0a 2b      int flags;.+
3d90: 7d 20 41 72 69 74 68 53 65 72 69 65 73 3b 0a 2b  } ArithSeries;.+
3da0: 0a 2b 2f 2a 0a 20 20 2a 2d 2d 2d 2d 2d 2d 2d 2d  .+/*.  *--------
3db0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3dc0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3dd0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3de0: 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20 2a 20 44 61 74  --------.  * Dat
3df0: 61 20 73 74 72 75 63 74 75 72 65 73 20 72 65 6c  a structures rel
3e00: 61 74 65 64 20 74 6f 20 74 68 65 20 66 69 6c 65  ated to the file
3e10: 73 79 73 74 65 6d 20 69 6e 74 65 72 6e 61 6c 73  system internals
3e20: 0a 20 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  .  *------------
3e30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3e40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3e50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3e60: 2d 2d 2d 2d 0a 40 40 20 2d 31 36 37 34 2c 36 20  ----.@@ -1674,6 
3e70: 2b 31 36 38 38 2c 37 20 40 40 0a 20 65 78 74 65  +1688,7 @@. exte
3e80: 72 6e 20 54 63 6c 5f 4f 62 6a 54 79 70 65 09 74  rn Tcl_ObjType.t
3e90: 63 6c 45 6e 64 4f 66 66 73 65 74 54 79 70 65 3b  clEndOffsetType;
3ea0: 0a 20 65 78 74 65 72 6e 20 54 63 6c 5f 4f 62 6a  . extern Tcl_Obj
3eb0: 54 79 70 65 09 74 63 6c 49 6e 74 54 79 70 65 3b  Type.tclIntType;
3ec0: 0a 20 65 78 74 65 72 6e 20 54 63 6c 5f 4f 62 6a  . extern Tcl_Obj
3ed0: 54 79 70 65 09 74 63 6c 4c 69 73 74 54 79 70 65  Type.tclListType
3ee0: 3b 0a 2b 65 78 74 65 72 6e 20 54 63 6c 5f 4f 62  ;.+extern Tcl_Ob
3ef0: 6a 54 79 70 65 09 74 63 6c 41 72 69 74 68 53 65  jType.tclArithSe
3f00: 72 69 65 73 54 79 70 65 3b 0a 20 65 78 74 65 72  riesType;. exter
3f10: 6e 20 54 63 6c 5f 4f 62 6a 54 79 70 65 09 74 63  n Tcl_ObjType.tc
3f20: 6c 44 69 63 74 54 79 70 65 3b 0a 20 65 78 74 65  lDictType;. exte
3f30: 72 6e 20 54 63 6c 5f 4f 62 6a 54 79 70 65 09 74  rn Tcl_ObjType.t
3f40: 63 6c 50 72 6f 63 42 6f 64 79 54 79 70 65 3b 0a  clProcBodyType;.
3f50: 20 65 78 74 65 72 6e 20 54 63 6c 5f 4f 62 6a 54   extern Tcl_ObjT
3f60: 79 70 65 09 74 63 6c 53 74 72 69 6e 67 54 79 70  ype.tclStringTyp
3f70: 65 3b 0a 40 40 20 2d 32 30 39 34 2c 36 20 2b 32  e;.@@ -2094,6 +2
3f80: 31 30 39 2c 38 20 40 40 0a 20 09 09 20 20 20 20  109,8 @@. ..    
3f90: 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65  Tcl_Interp *inte
3fa0: 72 70 2c 20 69 6e 74 20 6f 62 6a 63 2c 20 54 63  rp, int objc, Tc
3fb0: 6c 5f 4f 62 6a 20 2a 43 4f 4e 53 54 20 6f 62 6a  l_Obj *CONST obj
3fc0: 76 5b 5d 29 29 3b 0a 20 45 58 54 45 52 4e 20 69  v[]));. EXTERN i
3fd0: 6e 74 09 54 63 6c 5f 50 77 64 4f 62 6a 43 6d 64  nt.Tcl_PwdObjCmd
3fe0: 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 43 6c   _ANSI_ARGS_((Cl
3ff0: 69 65 6e 74 44 61 74 61 20 63 6c 69 65 6e 74 44  ientData clientD
4000: 61 74 61 2c 0a 20 09 09 20 20 20 20 54 63 6c 5f  ata,. ..    Tcl_
4010: 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 2c 20  Interp *interp, 
4020: 69 6e 74 20 6f 62 6a 63 2c 20 54 63 6c 5f 4f 62  int objc, Tcl_Ob
4030: 6a 20 2a 43 4f 4e 53 54 20 6f 62 6a 76 5b 5d 29  j *CONST objv[])
4040: 29 3b 0a 2b 45 58 54 45 52 4e 20 69 6e 74 09 54  );.+EXTERN int.T
4050: 63 6c 5f 52 61 6e 67 65 4f 62 6a 43 6d 64 20 5f  cl_RangeObjCmd _
4060: 41 4e 53 49 5f 41 52 47 53 5f 28 28 43 6c 69 65  ANSI_ARGS_((Clie
4070: 6e 74 44 61 74 61 20 63 6c 69 65 6e 74 44 61 74  ntData clientDat
4080: 61 2c 0a 2b 09 09 20 20 20 20 54 63 6c 5f 49 6e  a,.+..    Tcl_In
4090: 74 65 72 70 20 2a 69 6e 74 65 72 70 2c 20 69 6e  terp *interp, in
40a0: 74 20 6f 62 6a 63 2c 20 54 63 6c 5f 4f 62 6a 20  t objc, Tcl_Obj 
40b0: 2a 43 4f 4e 53 54 20 6f 62 6a 76 5b 5d 29 29 3b  *CONST objv[]));
40c0: 0a 20 45 58 54 45 52 4e 20 69 6e 74 09 54 63 6c  . EXTERN int.Tcl
40d0: 5f 52 65 61 64 4f 62 6a 43 6d 64 20 5f 41 4e 53  _ReadObjCmd _ANS
40e0: 49 5f 41 52 47 53 5f 28 28 43 6c 69 65 6e 74 44  I_ARGS_((ClientD
40f0: 61 74 61 20 63 6c 69 65 6e 74 44 61 74 61 2c 0a  ata clientData,.
4100: 20 09 09 20 20 20 20 54 63 6c 5f 49 6e 74 65 72   ..    Tcl_Inter
4110: 70 20 2a 69 6e 74 65 72 70 2c 20 69 6e 74 20 6f  p *interp, int o
4120: 62 6a 63 2c 20 54 63 6c 5f 4f 62 6a 20 2a 43 4f  bjc, Tcl_Obj *CO
4130: 4e 53 54 20 6f 62 6a 76 5b 5d 29 29 3b 0a 20 45  NST objv[]));. E
4140: 58 54 45 52 4e 20 69 6e 74 09 54 63 6c 5f 52 65  XTERN int.Tcl_Re
4150: 67 65 78 70 4f 62 6a 43 6d 64 20 5f 41 4e 53 49  gexpObjCmd _ANSI
4160: 5f 41 52 47 53 5f 28 28 43 6c 69 65 6e 74 44 61  _ARGS_((ClientDa
4170: 74 61 20 63 6c 69 65 6e 74 44 61 74 61 2c 0a 49  ta clientData,.I
4180: 6e 64 65 78 3a 20 67 65 6e 65 72 69 63 2f 74 63  ndex: generic/tc
4190: 6c 4c 69 73 74 4f 62 6a 2e 63 0a 3d 3d 3d 3d 3d  lListObj.c.=====
41a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
41b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
41c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
41d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 52  ==============.R
41e0: 43 53 20 66 69 6c 65 3a 20 2f 63 76 73 72 6f 6f  CS file: /cvsroo
41f0: 74 2f 74 63 6c 2f 74 63 6c 2f 67 65 6e 65 72 69  t/tcl/tcl/generi
4200: 63 2f 74 63 6c 4c 69 73 74 4f 62 6a 2e 63 2c 76  c/tclListObj.c,v
4210: 0a 72 65 74 72 69 65 76 69 6e 67 20 72 65 76 69  .retrieving revi
4220: 73 69 6f 6e 20 31 2e 31 39 0a 64 69 66 66 20 2d  sion 1.19.diff -
4230: 75 20 2d 72 31 2e 31 39 20 74 63 6c 4c 69 73 74  u -r1.19 tclList
4240: 4f 62 6a 2e 63 0a 2d 2d 2d 20 67 65 6e 65 72 69  Obj.c.--- generi
4250: 63 2f 74 63 6c 4c 69 73 74 4f 62 6a 2e 63 09 32  c/tclListObj.c.2
4260: 39 20 53 65 70 20 32 30 30 34 20 32 32 3a 31 37  9 Sep 2004 22:17
4270: 3a 33 30 20 2d 30 30 30 30 09 31 2e 31 39 0a 2b  :30 -0000.1.19.+
4280: 2b 2b 20 67 65 6e 65 72 69 63 2f 74 63 6c 4c 69  ++ generic/tclLi
4290: 73 74 4f 62 6a 2e 63 09 32 35 20 4f 63 74 20 32  stObj.c.25 Oct 2
42a0: 30 30 34 20 30 36 3a 33 38 3a 32 37 20 2d 30 30  004 06:38:27 -00
42b0: 30 30 0a 40 40 20 2d 31 35 36 36 2c 36 20 2b 31  00.@@ -1566,6 +1
42c0: 35 36 36 2c 33 33 20 40 40 0a 20 20 20 20 20 4c  566,33 @@.     L
42d0: 69 73 74 20 2a 6c 69 73 74 52 65 70 50 74 72 3b  ist *listRepPtr;
42e0: 0a 20 0a 20 20 20 20 20 2f 2a 0a 2b 20 20 20 20  . .     /*.+    
42f0: 20 2a 20 43 6f 6e 76 65 72 74 69 6f 6e 20 66 72   * Convertion fr
4300: 6f 6d 20 41 72 69 74 68 6d 65 74 69 63 20 53 65  om Arithmetic Se
4310: 72 69 65 73 20 69 73 20 61 20 73 70 65 63 69 61  ries is a specia
4320: 6c 20 63 61 73 65 0a 2b 20 20 20 20 20 2a 20 62  l case.+     * b
4330: 65 63 61 75 73 65 20 69 74 20 63 61 6e 20 62 65  ecause it can be
4340: 20 64 6f 6e 65 20 61 6e 20 6f 72 64 65 72 20 6f   done an order o
4350: 66 20 6d 61 67 6e 69 74 75 64 65 20 66 61 73 74  f magnitude fast
4360: 65 72 0a 2b 20 20 20 20 20 2a 20 61 6e 64 20 6d  er.+     * and m
4370: 61 79 20 6f 63 63 75 72 20 66 72 65 71 75 65 6e  ay occur frequen
4380: 74 6c 79 2e 0a 2b 20 20 20 20 20 2a 2f 0a 2b 20  tly..+     */.+ 
4390: 20 20 20 69 66 20 28 6f 62 6a 50 74 72 2d 3e 74     if (objPtr->t
43a0: 79 70 65 50 74 72 20 3d 3d 20 26 74 63 6c 41 72  ypePtr == &tclAr
43b0: 69 74 68 53 65 72 69 65 73 54 79 70 65 29 20 7b  ithSeriesType) {
43c0: 0a 2b 20 20 20 20 20 20 20 20 54 63 6c 5f 57 69  .+        Tcl_Wi
43d0: 64 65 49 6e 74 20 77 69 64 65 4c 65 6e 20 3d 20  deInt wideLen = 
43e0: 54 63 6c 5f 41 72 69 74 68 53 65 72 69 65 73 4f  Tcl_ArithSeriesO
43f0: 62 6a 4c 65 6e 67 74 68 28 6f 62 6a 50 74 72 29  bjLength(objPtr)
4400: 2c 20 6a 3b 0a 2b 20 20 20 20 20 20 20 20 41 72  , j;.+        Ar
4410: 69 74 68 53 65 72 69 65 73 20 2a 61 72 69 74 68  ithSeries *arith
4420: 53 65 72 69 65 73 52 65 70 50 74 72 20 3d 20 28  SeriesRepPtr = (
4430: 41 72 69 74 68 53 65 72 69 65 73 2a 29 0a 2b 09  ArithSeries*).+.
4440: 09 6f 62 6a 50 74 72 2d 3e 69 6e 74 65 72 6e 61  .objPtr->interna
4450: 6c 52 65 70 2e 74 77 6f 50 74 72 56 61 6c 75 65  lRep.twoPtrValue
4460: 2e 70 74 72 31 3b 0a 2b 0a 2b 09 65 6c 65 6d 50  .ptr1;.+.+.elemP
4470: 74 72 73 20 3d 20 28 54 63 6c 5f 4f 62 6a 2a 2a  trs = (Tcl_Obj**
4480: 29 20 63 6b 61 6c 6c 6f 63 28 73 69 7a 65 6f 66  ) ckalloc(sizeof
4490: 28 54 63 6c 5f 4f 62 6a 2a 29 2a 77 69 64 65 4c  (Tcl_Obj*)*wideL
44a0: 65 6e 29 3b 0a 2b 09 66 6f 72 20 28 6a 20 3d 20  en);.+.for (j = 
44b0: 30 3b 20 6a 20 3c 20 77 69 64 65 4c 65 6e 3b 20  0; j < wideLen; 
44c0: 6a 2b 2b 29 20 7b 0a 2b 09 09 65 6c 65 6d 50 74  j++) {.+..elemPt
44d0: 72 73 5b 6a 5d 20 3d 20 54 63 6c 5f 4e 65 77 57  rs[j] = Tcl_NewW
44e0: 69 64 65 49 6e 74 4f 62 6a 28 0a 2b 09 09 09 61  ideIntObj(.+...a
44f0: 72 69 74 68 53 65 72 69 65 73 52 65 70 50 74 72  rithSeriesRepPtr
4500: 2d 3e 73 74 61 72 74 2b 28 6a 2a 61 72 69 74 68  ->start+(j*arith
4510: 53 65 72 69 65 73 52 65 70 50 74 72 2d 3e 73 74  SeriesRepPtr->st
4520: 65 70 29 29 3b 0a 2b 09 7d 0a 2b 20 20 20 20 20  ep));.+.}.+     
4530: 20 20 20 6c 69 73 74 52 65 70 50 74 72 20 3d 20     listRepPtr = 
4540: 28 4c 69 73 74 20 2a 29 20 63 6b 61 6c 6c 6f 63  (List *) ckalloc
4550: 28 73 69 7a 65 6f 66 28 4c 69 73 74 29 29 3b 0a  (sizeof(List));.
4560: 2b 20 20 20 20 20 20 20 20 6c 69 73 74 52 65 70  +        listRep
4570: 50 74 72 2d 3e 6d 61 78 45 6c 65 6d 43 6f 75 6e  Ptr->maxElemCoun
4580: 74 20 3d 20 77 69 64 65 4c 65 6e 3b 0a 2b 20 20  t = wideLen;.+  
4590: 20 20 20 20 20 20 6c 69 73 74 52 65 70 50 74 72        listRepPtr
45a0: 2d 3e 65 6c 65 6d 43 6f 75 6e 74 20 20 20 20 3d  ->elemCount    =
45b0: 20 77 69 64 65 4c 65 6e 3b 0a 2b 20 20 20 20 20   wideLen;.+     
45c0: 20 20 20 6c 69 73 74 52 65 70 50 74 72 2d 3e 65     listRepPtr->e
45d0: 6c 65 6d 65 6e 74 73 20 20 20 20 20 3d 20 65 6c  lements     = el
45e0: 65 6d 50 74 72 73 3b 0a 2b 0a 2b 20 20 20 20 20  emPtrs;.+.+     
45f0: 20 20 20 54 63 6c 46 72 65 65 49 6e 74 52 65 70     TclFreeIntRep
4600: 28 6f 62 6a 50 74 72 29 3b 0a 2b 20 20 20 20 20  (objPtr);.+     
4610: 20 20 20 6f 62 6a 50 74 72 2d 3e 69 6e 74 65 72     objPtr->inter
4620: 6e 61 6c 52 65 70 2e 74 77 6f 50 74 72 56 61 6c  nalRep.twoPtrVal
4630: 75 65 2e 70 74 72 31 20 3d 20 28 56 4f 49 44 20  ue.ptr1 = (VOID 
4640: 2a 29 20 6c 69 73 74 52 65 70 50 74 72 3b 0a 2b  *) listRepPtr;.+
4650: 20 20 20 20 20 20 20 20 6f 62 6a 50 74 72 2d 3e          objPtr->
4660: 69 6e 74 65 72 6e 61 6c 52 65 70 2e 74 77 6f 50  internalRep.twoP
4670: 74 72 56 61 6c 75 65 2e 70 74 72 32 20 3d 20 4e  trValue.ptr2 = N
4680: 55 4c 4c 3b 0a 2b 20 20 20 20 20 20 20 20 6f 62  ULL;.+        ob
4690: 6a 50 74 72 2d 3e 74 79 70 65 50 74 72 20 3d 20  jPtr->typePtr = 
46a0: 26 74 63 6c 4c 69 73 74 54 79 70 65 3b 0a 2b 09  &tclListType;.+.
46b0: 72 65 74 75 72 6e 20 54 43 4c 5f 4f 4b 3b 0a 2b  return TCL_OK;.+
46c0: 20 20 20 20 7d 0a 2b 0a 2b 20 20 20 20 2f 2a 0a      }.+.+    /*.
46d0: 20 20 20 20 20 20 2a 20 47 65 74 20 74 68 65 20        * Get the 
46e0: 73 74 72 69 6e 67 20 72 65 70 72 65 73 65 6e 74  string represent
46f0: 61 74 69 6f 6e 2e 20 4d 61 6b 65 20 69 74 20 75  ation. Make it u
4700: 70 2d 74 6f 2d 64 61 74 65 20 69 66 20 6e 65 63  p-to-date if nec
4710: 65 73 73 61 72 79 2e 0a 20 20 20 20 20 20 2a 2f  essary..      */
4720: 0a 20 0a 40 40 20 2d 31 37 33 33 2c 33 20 2b 31  . .@@ -1733,3 +1
4730: 37 36 30 2c 33 38 31 20 40 40 0a 20 20 20 20 20  760,381 @@.     
4740: 7d 0a 20 20 20 20 20 6c 69 73 74 50 74 72 2d 3e  }.     listPtr->
4750: 6c 65 6e 67 74 68 20 3d 20 64 73 74 20 2d 20 6c  length = dst - l
4760: 69 73 74 50 74 72 2d 3e 62 79 74 65 73 3b 0a 20  istPtr->bytes;. 
4770: 7d 0a 2b 0a 2b 2f 2a 20 2d 2d 2d 2d 2d 2d 2d 2d  }.+.+/* --------
4780: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4790: 2d 2d 20 41 72 69 74 68 53 65 72 69 65 73 20 6f  -- ArithSeries o
47a0: 62 6a 65 63 74 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  bject ----------
47b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
47c0: 2d 2d 20 2a 2f 0a 2b 0a 2b 2f 2a 0a 2b 20 2a 20  -- */.+.+/*.+ * 
47d0: 50 72 6f 74 6f 74 79 70 65 73 20 66 6f 72 20 70  Prototypes for p
47e0: 72 6f 63 65 64 75 72 65 73 20 64 65 66 69 6e 65  rocedures define
47f0: 64 20 6c 61 74 65 72 20 69 6e 20 74 68 69 73 20  d later in this 
4800: 66 69 6c 65 3a 0a 2b 20 2a 2f 0a 2b 0a 2b 73 74  file:.+ */.+.+st
4810: 61 74 69 63 20 76 6f 69 64 09 09 44 75 70 41 72  atic void..DupAr
4820: 69 74 68 53 65 72 69 65 73 49 6e 74 65 72 6e 61  ithSeriesInterna
4830: 6c 52 65 70 20 5f 41 4e 53 49 5f 41 52 47 53 5f  lRep _ANSI_ARGS_
4840: 28 28 54 63 6c 5f 4f 62 6a 20 2a 73 72 63 50 74  ((Tcl_Obj *srcPt
4850: 72 2c 0a 2b 09 09 09 20 20 20 20 54 63 6c 5f 4f  r,.+...    Tcl_O
4860: 62 6a 20 2a 63 6f 70 79 50 74 72 29 29 3b 0a 2b  bj *copyPtr));.+
4870: 73 74 61 74 69 63 20 76 6f 69 64 09 09 46 72 65  static void..Fre
4880: 65 41 72 69 74 68 53 65 72 69 65 73 49 6e 74 65  eArithSeriesInte
4890: 72 6e 61 6c 52 65 70 20 5f 41 4e 53 49 5f 41 52  rnalRep _ANSI_AR
48a0: 47 53 5f 28 28 54 63 6c 5f 4f 62 6a 20 2a 6c 69  GS_((Tcl_Obj *li
48b0: 73 74 50 74 72 29 29 3b 0a 2b 73 74 61 74 69 63  stPtr));.+static
48c0: 20 69 6e 74 09 09 53 65 74 41 72 69 74 68 53 65   int..SetArithSe
48d0: 72 69 65 73 46 72 6f 6d 41 6e 79 20 5f 41 4e 53  riesFromAny _ANS
48e0: 49 5f 41 52 47 53 5f 28 28 54 63 6c 5f 49 6e 74  I_ARGS_((Tcl_Int
48f0: 65 72 70 20 2a 69 6e 74 65 72 70 2c 0a 2b 09 09  erp *interp,.+..
4900: 09 20 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 6f 62  .    Tcl_Obj *ob
4910: 6a 50 74 72 29 29 3b 0a 2b 73 74 61 74 69 63 20  jPtr));.+static 
4920: 76 6f 69 64 09 09 55 70 64 61 74 65 53 74 72 69  void..UpdateStri
4930: 6e 67 4f 66 41 72 69 74 68 53 65 72 69 65 73 20  ngOfArithSeries 
4940: 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 54 63 6c  _ANSI_ARGS_((Tcl
4950: 5f 4f 62 6a 20 2a 6c 69 73 74 50 74 72 29 29 3b  _Obj *listPtr));
4960: 0a 2b 0a 2b 2f 2a 0a 2b 20 2a 20 54 68 65 20 73  .+.+/*.+ * The s
4970: 74 72 75 63 74 75 72 65 20 62 65 6c 6f 77 20 64  tructure below d
4980: 65 66 69 6e 65 73 20 74 68 65 20 61 72 69 74 68  efines the arith
4990: 6d 65 74 69 63 20 73 65 72 69 65 73 20 54 63 6c  metic series Tcl
49a0: 20 6f 62 6a 65 63 74 20 74 79 70 65 20 62 79 0a   object type by.
49b0: 2b 20 2a 20 6d 65 61 6e 73 20 6f 66 20 70 72 6f  + * means of pro
49c0: 63 65 64 75 72 65 73 20 74 68 61 74 20 63 61 6e  cedures that can
49d0: 20 62 65 20 69 6e 76 6f 6b 65 64 20 62 79 20 67   be invoked by g
49e0: 65 6e 65 72 69 63 20 6f 62 6a 65 63 74 20 63 6f  eneric object co
49f0: 64 65 2e 0a 2b 20 2a 0a 2b 20 2a 20 54 68 65 20  de..+ *.+ * The 
4a00: 61 72 69 74 68 6d 65 74 69 63 20 73 65 72 69 65  arithmetic serie
4a10: 73 20 6f 62 6a 65 63 74 20 69 73 20 61 20 73 70  s object is a sp
4a20: 65 63 69 61 6c 20 63 61 73 65 20 6f 66 20 54 63  ecial case of Tc
4a30: 6c 20 6c 69 73 74 20 72 65 70 72 65 73 65 6e 74  l list represent
4a40: 69 6e 67 0a 2b 20 2a 20 61 6e 20 69 6e 74 65 72  ing.+ * an inter
4a50: 76 61 6c 20 6f 66 20 61 6e 20 61 72 69 74 68 6d  val of an arithm
4a60: 65 74 69 63 20 73 65 72 69 65 73 20 69 6e 20 63  etic series in c
4a70: 6f 6e 73 74 61 6e 74 20 73 70 61 63 65 2e 0a 2b  onstant space..+
4a80: 20 2a 20 0a 2b 20 2a 20 54 68 65 20 61 72 69 74   * .+ * The arit
4a90: 68 6d 65 74 69 63 20 73 65 72 69 65 73 20 69 73  hmetic series is
4aa0: 20 69 6e 74 65 72 6e 61 6c 6c 79 20 72 65 70 72   internally repr
4ab0: 65 73 65 6e 74 65 64 20 77 69 74 68 20 74 68 72  esented with thr
4ac0: 65 65 20 69 6e 74 65 67 65 72 73 2c 0a 2b 20 2a  ee integers,.+ *
4ad0: 20 2a 73 74 61 72 74 2a 2c 20 2a 65 6e 64 2a 2c   *start*, *end*,
4ae0: 20 61 6e 64 20 2a 73 74 65 70 2a 2c 20 57 68 65   and *step*, Whe
4af0: 72 65 20 74 68 65 20 6c 65 6e 67 74 68 20 69 73  re the length is
4b00: 20 63 61 6c 63 75 6c 61 74 65 64 20 77 69 74 68   calculated with
4b10: 0a 2b 20 2a 20 74 68 65 20 66 6f 6c 6c 6f 77 69  .+ * the followi
4b20: 6e 67 20 61 6c 67 6f 72 69 74 68 6d 3a 0a 2b 20  ng algorithm:.+ 
4b30: 2a 0a 2b 20 2a 20 69 66 20 53 54 45 50 20 69 73  *.+ * if STEP is
4b40: 20 30 3a 20 45 52 52 4f 52 0a 2b 20 2a 20 65 6c   0: ERROR.+ * el
4b50: 73 65 20 69 66 20 53 54 41 52 54 20 69 73 20 74  se if START is t
4b60: 68 65 20 73 61 6d 65 20 61 73 20 45 4e 44 3a 20  he same as END: 
4b70: 4f 55 54 50 55 54 20 30 0a 2b 20 2a 20 65 6c 73  OUTPUT 0.+ * els
4b80: 65 20 69 66 20 53 54 45 50 20 69 73 20 50 4f 53  e if STEP is POS
4b90: 49 54 49 56 45 20 61 6e 64 20 53 54 41 52 54 20  ITIVE and START 
4ba0: 3e 20 45 4e 44 3a 20 45 52 52 4f 52 0a 2b 20 2a  > END: ERROR.+ *
4bb0: 20 65 6c 73 65 20 69 66 20 53 54 45 50 20 69 73   else if STEP is
4bc0: 20 4e 45 47 41 54 49 56 45 20 61 6e 64 20 45 4e   NEGATIVE and EN
4bd0: 44 20 3e 20 53 54 41 52 54 3a 20 45 52 52 4f 52  D > START: ERROR
4be0: 0a 2b 20 2a 20 65 6c 73 65 20 4f 55 54 50 55 54  .+ * else OUTPUT
4bf0: 20 31 2b 28 28 41 42 53 28 45 4e 44 2d 53 54 41   1+((ABS(END-STA
4c00: 52 54 29 2d 31 29 2f 41 42 53 28 53 54 45 50 29  RT)-1)/ABS(STEP)
4c10: 29 0a 2b 20 2a 0a 2b 20 2a 20 41 6e 64 20 77 68  ).+ *.+ * And wh
4c20: 65 72 65 20 74 68 65 20 49 2d 74 68 20 65 6c 65  ere the I-th ele
4c30: 6d 65 6e 74 20 6f 66 20 74 68 65 20 72 61 6e 67  ment of the rang
4c40: 65 20 69 73 3a 0a 2b 20 2a 0a 2b 20 2a 20 45 4c  e is:.+ *.+ * EL
4c50: 45 4d 45 4e 54 53 5b 69 5d 20 3d 20 53 54 41 52  EMENTS[i] = STAR
4c60: 54 2b 28 53 54 45 50 2a 69 29 0a 2b 20 2a 0a 2b  T+(STEP*i).+ *.+
4c70: 20 2a 20 5a 65 72 6f 20 65 6c 65 6d 65 6e 74 73   * Zero elements
4c80: 20 72 61 6e 67 65 73 2c 20 6c 69 6b 65 20 69 6e   ranges, like in
4c90: 20 74 68 65 20 63 61 73 65 20 6f 66 20 53 54 41   the case of STA
4ca0: 52 54 3d 31 30 20 45 4e 44 3d 31 30 20 53 54 45  RT=10 END=10 STE
4cb0: 50 3d 31 0a 2b 20 2a 20 61 72 65 20 76 61 6c 69  P=1.+ * are vali
4cc0: 64 20 61 6e 64 20 77 69 6c 6c 20 62 65 20 65 71  d and will be eq
4cd0: 75 69 76 61 6c 65 6e 74 20 74 6f 20 74 68 65 20  uivalent to the 
4ce0: 65 6d 70 74 79 20 6c 69 73 74 2e 0a 2b 20 2a 2f  empty list..+ */
4cf0: 0a 2b 0a 2b 54 63 6c 5f 4f 62 6a 54 79 70 65 20  .+.+Tcl_ObjType 
4d00: 74 63 6c 41 72 69 74 68 53 65 72 69 65 73 54 79  tclArithSeriesTy
4d10: 70 65 20 3d 20 7b 0a 2b 20 20 20 20 22 61 72 69  pe = {.+    "ari
4d20: 74 68 73 65 72 69 65 73 22 2c 09 09 09 2f 2a 20  thseries",.../* 
4d30: 6e 61 6d 65 20 2a 2f 0a 2b 20 20 20 20 46 72 65  name */.+    Fre
4d40: 65 41 72 69 74 68 53 65 72 69 65 73 49 6e 74 65  eArithSeriesInte
4d50: 72 6e 61 6c 52 65 70 2c 09 09 2f 2a 20 66 72 65  rnalRep,../* fre
4d60: 65 49 6e 74 52 65 70 50 72 6f 63 20 2a 2f 0a 2b  eIntRepProc */.+
4d70: 20 20 20 20 44 75 70 41 72 69 74 68 53 65 72 69      DupArithSeri
4d80: 65 73 49 6e 74 65 72 6e 61 6c 52 65 70 2c 09 09  esInternalRep,..
4d90: 2f 2a 20 64 75 70 49 6e 74 52 65 70 50 72 6f 63  /* dupIntRepProc
4da0: 20 2a 2f 0a 2b 20 20 20 20 55 70 64 61 74 65 53   */.+    UpdateS
4db0: 74 72 69 6e 67 4f 66 41 72 69 74 68 53 65 72 69  tringOfArithSeri
4dc0: 65 73 2c 09 09 2f 2a 20 75 70 64 61 74 65 53 74  es,../* updateSt
4dd0: 72 69 6e 67 50 72 6f 63 20 2a 2f 0a 2b 20 20 20  ringProc */.+   
4de0: 20 53 65 74 41 72 69 74 68 53 65 72 69 65 73 46   SetArithSeriesF
4df0: 72 6f 6d 41 6e 79 09 09 2f 2a 20 73 65 74 46 72  romAny../* setFr
4e00: 6f 6d 41 6e 79 50 72 6f 63 20 2a 2f 0a 2b 7d 3b  omAnyProc */.+};
4e10: 0a 2b 0a 2b 2f 2a 0a 2b 20 2a 2d 2d 2d 2d 2d 2d  .+.+/*.+ *------
4e20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4e30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4e40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4e50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4e60: 0a 2b 20 2a 0a 2b 20 2a 20 41 72 69 74 68 53 65  .+ *.+ * ArithSe
4e70: 72 69 65 73 4c 65 6e 20 2d 2d 0a 2b 20 2a 0a 2b  riesLen --.+ *.+
4e80: 20 2a 20 09 43 6f 6d 70 75 74 65 20 74 68 65 20   * .Compute the 
4e90: 6c 65 6e 67 74 68 20 6f 66 20 74 68 65 20 65 71  length of the eq
4ea0: 75 69 76 61 6c 65 6e 74 20 6c 69 73 74 20 77 68  uivalent list wh
4eb0: 65 72 65 0a 2b 20 2a 20 09 65 76 65 72 79 20 65  ere.+ * .every e
4ec0: 6c 65 6d 65 6e 74 20 69 73 20 67 65 6e 65 72 61  lement is genera
4ed0: 74 65 64 20 73 74 61 72 74 69 6e 67 20 66 72 6f  ted starting fro
4ee0: 6d 20 2a 73 74 61 72 74 2a 2c 0a 2b 20 2a 20 09  m *start*,.+ * .
4ef0: 61 6e 64 20 61 64 64 69 6e 67 20 2a 73 74 65 70  and adding *step
4f00: 2a 20 74 6f 20 67 65 6e 65 72 61 74 65 20 65 76  * to generate ev
4f10: 65 72 79 20 73 75 63 63 65 73 73 69 76 65 20 65  ery successive e
4f20: 6c 65 6d 65 6e 74 0a 2b 20 2a 20 09 74 68 61 74  lement.+ * .that
4f30: 27 73 20 3c 20 2a 65 6e 64 2a 20 66 6f 72 20 70  's < *end* for p
4f40: 6f 73 69 74 69 76 65 20 73 74 65 70 73 2c 20 6f  ositive steps, o
4f50: 72 20 3e 20 2a 65 6e 64 2a 20 66 6f 72 20 6e 65  r > *end* for ne
4f60: 67 61 74 69 76 65 0a 2b 20 2a 20 09 73 74 65 70  gative.+ * .step
4f70: 73 2e 0a 2b 20 2a 0a 2b 20 2a 20 52 65 73 75 6c  s..+ *.+ * Resul
4f80: 74 73 3a 0a 2b 20 2a 0a 2b 20 2a 20 09 54 68 65  ts:.+ *.+ * .The
4f90: 20 6c 65 6e 67 74 68 20 6f 66 20 74 68 65 20 6c   length of the l
4fa0: 69 73 74 20 67 65 6e 65 72 61 74 65 64 20 62 79  ist generated by
4fb0: 20 74 68 65 20 67 69 76 65 6e 20 72 61 6e 67 65   the given range
4fc0: 2c 0a 2b 20 2a 20 09 74 68 61 74 20 6d 61 79 20  ,.+ * .that may 
4fd0: 62 65 20 7a 65 72 6f 2e 0a 2b 20 2a 20 09 54 68  be zero..+ * .Th
4fe0: 65 20 66 75 6e 63 74 69 6f 6e 20 72 65 74 75 72  e function retur
4ff0: 6e 73 20 2d 31 20 69 66 20 74 68 65 20 6c 69 73  ns -1 if the lis
5000: 74 20 69 73 20 6f 66 20 6c 65 6e 67 74 68 20 69  t is of length i
5010: 6e 66 69 69 74 65 2e 0a 2b 20 2a 0a 2b 20 2a 20  nfiite..+ *.+ * 
5020: 53 69 64 65 20 65 66 66 65 63 74 73 3a 0a 2b 20  Side effects:.+ 
5030: 2a 0a 2b 20 2a 20 09 4e 6f 6e 65 2e 0a 2b 20 2a  *.+ * .None..+ *
5040: 0a 2b 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  .+ *------------
5050: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5060: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5070: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5080: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 2b 20 2a 2f 0a  ----------.+ */.
5090: 2b 73 74 61 74 69 63 20 69 6e 74 0a 2b 41 72 69  +static int.+Ari
50a0: 74 68 53 65 72 69 65 73 4c 65 6e 28 54 63 6c 5f  thSeriesLen(Tcl_
50b0: 57 69 64 65 49 6e 74 20 73 74 61 72 74 2c 20 54  WideInt start, T
50c0: 63 6c 5f 57 69 64 65 49 6e 74 20 65 6e 64 2c 20  cl_WideInt end, 
50d0: 54 63 6c 5f 57 69 64 65 49 6e 74 20 73 74 65 70  Tcl_WideInt step
50e0: 29 0a 2b 7b 0a 2b 09 54 63 6c 5f 57 69 64 65 49  ).+{.+.Tcl_WideI
50f0: 6e 74 20 6c 65 6e 3b 0a 2b 0a 2b 09 69 66 20 28  nt len;.+.+.if (
5100: 73 74 65 70 20 3d 3d 20 30 29 20 72 65 74 75 72  step == 0) retur
5110: 6e 20 2d 31 3b 0a 2b 09 69 66 20 28 73 74 61 72  n -1;.+.if (star
5120: 74 20 3d 3d 20 65 6e 64 29 20 72 65 74 75 72 6e  t == end) return
5130: 20 30 3b 0a 2b 09 65 6c 73 65 20 69 66 20 28 73   0;.+.else if (s
5140: 74 65 70 20 3e 20 30 20 26 26 20 73 74 61 72 74  tep > 0 && start
5150: 20 3e 20 65 6e 64 29 20 72 65 74 75 72 6e 20 2d   > end) return -
5160: 31 3b 0a 2b 09 65 6c 73 65 20 69 66 20 28 73 74  1;.+.else if (st
5170: 65 70 20 3c 20 30 20 26 26 20 65 6e 64 20 3e 20  ep < 0 && end > 
5180: 73 74 61 72 74 29 20 72 65 74 75 72 6e 20 2d 31  start) return -1
5190: 3b 0a 2b 09 6c 65 6e 20 3d 20 65 6e 64 2d 73 74  ;.+.len = end-st
51a0: 61 72 74 3b 0a 2b 09 69 66 20 28 6c 65 6e 20 3c  art;.+.if (len <
51b0: 20 30 29 20 6c 65 6e 20 3d 20 2d 6c 65 6e 3b 20   0) len = -len; 
51c0: 2f 2a 20 61 62 73 28 6c 65 6e 29 20 2a 2f 0a 2b  /* abs(len) */.+
51d0: 09 69 66 20 28 73 74 65 70 20 3c 20 30 29 20 73  .if (step < 0) s
51e0: 74 65 70 20 3d 20 2d 73 74 65 70 3b 20 2f 2a 20  tep = -step; /* 
51f0: 61 62 73 28 73 74 65 70 29 20 2a 2f 0a 2b 09 6c  abs(step) */.+.l
5200: 65 6e 20 3d 20 31 20 2b 20 28 28 6c 65 6e 2d 31  en = 1 + ((len-1
5210: 29 2f 73 74 65 70 29 3b 0a 2b 09 2f 2a 20 57 65  )/step);.+./* We
5220: 20 63 61 6e 20 74 72 75 6e 63 61 74 65 20 73 61   can truncate sa
5230: 66 65 6c 79 20 74 6f 20 49 4e 54 5f 4d 41 58 2c  fely to INT_MAX,
5240: 20 74 68 65 20 72 61 6e 67 65 20 63 6f 6d 6d 61   the range comma
5250: 6e 64 0a 2b 09 20 2a 20 77 69 6c 6c 20 61 6c 77  nd.+. * will alw
5260: 61 79 73 20 72 65 74 75 72 6e 20 61 6e 20 65 72  ays return an er
5270: 72 6f 72 20 66 6f 72 20 61 20 73 75 63 68 20 6c  ror for a such l
5280: 6f 6e 67 20 72 61 6e 67 65 0a 2b 09 20 2a 20 62  ong range.+. * b
5290: 65 63 61 75 73 65 20 54 63 6c 20 6c 69 73 74 73  ecause Tcl lists
52a0: 20 63 61 6e 27 74 20 62 65 20 73 6f 20 6c 6f 6e   can't be so lon
52b0: 67 2e 20 2a 2f 0a 2b 09 69 66 20 28 6c 65 6e 20  g. */.+.if (len 
52c0: 3e 20 49 4e 54 5f 4d 41 58 29 20 6c 65 6e 20 3d  > INT_MAX) len =
52d0: 20 49 4e 54 5f 4d 41 58 3b 0a 2b 09 72 65 74 75   INT_MAX;.+.retu
52e0: 72 6e 20 28 69 6e 74 29 28 28 6c 65 6e 20 3c 20  rn (int)((len < 
52f0: 30 29 20 3f 20 2d 31 20 3a 20 6c 65 6e 29 3b 0a  0) ? -1 : len);.
5300: 2b 7d 0a 2b 0a 2b 2f 2a 0a 2b 20 2a 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 2d 2d 2d 2d 2d 2d  ----------------
5330: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5340: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5350: 2d 2d 0a 2b 20 2a 0a 2b 20 2a 20 54 63 6c 5f 4e  --.+ *.+ * Tcl_N
5360: 65 77 41 72 69 74 68 53 65 72 69 65 73 4f 62 6a  ewArithSeriesObj
5370: 20 2d 2d 0a 2b 20 2a 0a 2b 20 2a 09 43 72 65 61   --.+ *.+ *.Crea
5380: 74 65 73 20 61 20 6e 65 77 20 41 72 69 74 68 53  tes a new ArithS
5390: 65 72 69 65 73 20 6f 62 6a 65 63 74 2e 20 54 68  eries object. Th
53a0: 65 20 72 65 74 75 72 6e 65 64 20 6f 62 6a 65 63  e returned objec
53b0: 74 20 68 61 73 0a 2b 20 2a 09 72 65 66 63 6f 75  t has.+ *.refcou
53c0: 6e 74 20 3d 20 30 2e 0a 2b 20 2a 0a 2b 20 2a 20  nt = 0..+ *.+ * 
53d0: 52 65 73 75 6c 74 73 3a 0a 2b 20 2a 0a 2b 20 2a  Results:.+ *.+ *
53e0: 20 09 41 20 54 63 6c 5f 4f 62 6a 20 70 6f 69 6e   .A Tcl_Obj poin
53f0: 74 65 72 20 74 6f 20 74 68 65 20 63 72 65 61 74  ter to the creat
5400: 65 64 20 41 72 69 74 68 53 65 72 69 65 73 20 6f  ed ArithSeries o
5410: 62 6a 65 63 74 2e 0a 2b 20 2a 20 09 41 20 4e 55  bject..+ * .A NU
5420: 4c 4c 20 70 6f 69 6e 74 65 72 20 6f 66 20 74 68  LL pointer of th
5430: 65 20 72 61 6e 67 65 20 69 73 20 69 6e 76 61 6c  e range is inval
5440: 69 64 2e 0a 2b 20 2a 0a 2b 20 2a 20 53 69 64 65  id..+ *.+ * Side
5450: 20 45 66 66 65 63 74 73 3a 0a 2b 20 2a 0a 2b 20   Effects:.+ *.+ 
5460: 2a 20 09 4e 6f 6e 65 2e 0a 2b 20 2a 2d 2d 2d 2d  * .None..+ *----
5470: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5480: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5490: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
54a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
54b0: 2d 2d 0a 2b 20 2a 2f 0a 2b 54 63 6c 5f 4f 62 6a  --.+ */.+Tcl_Obj
54c0: 20 2a 0a 2b 54 63 6c 5f 4e 65 77 41 72 69 74 68   *.+Tcl_NewArith
54d0: 53 65 72 69 65 73 4f 62 6a 28 54 63 6c 5f 57 69  SeriesObj(Tcl_Wi
54e0: 64 65 49 6e 74 20 73 74 61 72 74 2c 20 54 63 6c  deInt start, Tcl
54f0: 5f 57 69 64 65 49 6e 74 20 65 6e 64 2c 20 54 63  _WideInt end, Tc
5500: 6c 5f 57 69 64 65 49 6e 74 20 73 74 65 70 29 0a  l_WideInt step).
5510: 2b 7b 0a 2b 20 20 20 20 69 6e 74 20 6c 65 6e 20  +{.+    int len 
5520: 3d 20 41 72 69 74 68 53 65 72 69 65 73 4c 65 6e  = ArithSeriesLen
5530: 28 73 74 61 72 74 2c 20 65 6e 64 2c 20 73 74 65  (start, end, ste
5540: 70 29 3b 0a 2b 20 20 20 20 54 63 6c 5f 4f 62 6a  p);.+    Tcl_Obj
5550: 20 2a 61 72 69 74 68 53 65 72 69 65 73 50 74 72   *arithSeriesPtr
5560: 3b 0a 2b 20 20 20 20 41 72 69 74 68 53 65 72 69  ;.+    ArithSeri
5570: 65 73 20 2a 61 72 69 74 68 53 65 72 69 65 73 52  es *arithSeriesR
5580: 65 70 50 74 72 3b 0a 2b 0a 2b 20 20 20 20 69 66  epPtr;.+.+    if
5590: 20 28 6c 65 6e 20 3d 3d 20 2d 31 29 20 72 65 74   (len == -1) ret
55a0: 75 72 6e 20 4e 55 4c 4c 3b 20 2f 2a 20 49 6e 76  urn NULL; /* Inv
55b0: 61 6c 69 64 20 72 61 6e 67 65 20 65 72 72 6f 72  alid range error
55c0: 20 2a 2f 0a 2b 20 20 20 20 54 63 6c 4e 65 77 4f   */.+    TclNewO
55d0: 62 6a 28 61 72 69 74 68 53 65 72 69 65 73 50 74  bj(arithSeriesPt
55e0: 72 29 3b 0a 2b 0a 2b 20 20 20 20 61 72 69 74 68  r);.+.+    arith
55f0: 53 65 72 69 65 73 52 65 70 50 74 72 20 3d 20 28  SeriesRepPtr = (
5600: 41 72 69 74 68 53 65 72 69 65 73 2a 29 20 63 6b  ArithSeries*) ck
5610: 61 6c 6c 6f 63 28 73 69 7a 65 6f 66 20 28 41 72  alloc(sizeof (Ar
5620: 69 74 68 53 65 72 69 65 73 29 29 3b 0a 2b 20 20  ithSeries));.+  
5630: 20 20 61 72 69 74 68 53 65 72 69 65 73 52 65 70    arithSeriesRep
5640: 50 74 72 2d 3e 73 74 61 72 74 20 3d 20 73 74 61  Ptr->start = sta
5650: 72 74 3b 0a 2b 20 20 20 20 61 72 69 74 68 53 65  rt;.+    arithSe
5660: 72 69 65 73 52 65 70 50 74 72 2d 3e 65 6e 64 20  riesRepPtr->end 
5670: 3d 20 65 6e 64 3b 0a 2b 20 20 20 20 61 72 69 74  = end;.+    arit
5680: 68 53 65 72 69 65 73 52 65 70 50 74 72 2d 3e 73  hSeriesRepPtr->s
5690: 74 65 70 20 3d 20 73 74 65 70 3b 0a 2b 20 20 20  tep = step;.+   
56a0: 20 61 72 69 74 68 53 65 72 69 65 73 52 65 70 50   arithSeriesRepP
56b0: 74 72 2d 3e 6c 65 6e 20 3d 20 6c 65 6e 3b 0a 2b  tr->len = len;.+
56c0: 20 20 20 20 61 72 69 74 68 53 65 72 69 65 73 52      arithSeriesR
56d0: 65 70 50 74 72 2d 3e 66 6c 61 67 73 20 3d 20 30  epPtr->flags = 0
56e0: 3b 0a 2b 20 20 20 20 69 66 20 28 61 72 69 74 68  ;.+    if (arith
56f0: 53 65 72 69 65 73 52 65 70 50 74 72 2d 3e 73 74  SeriesRepPtr->st
5700: 61 72 74 20 3e 20 49 4e 54 5f 4d 41 58 20 7c 7c  art > INT_MAX ||
5710: 0a 2b 09 61 72 69 74 68 53 65 72 69 65 73 52 65  .+.arithSeriesRe
5720: 70 50 74 72 2d 3e 73 74 61 72 74 20 3c 20 49 4e  pPtr->start < IN
5730: 54 5f 4d 49 4e 20 7c 7c 0a 2b 09 61 72 69 74 68  T_MIN ||.+.arith
5740: 53 65 72 69 65 73 52 65 70 50 74 72 2d 3e 65 6e  SeriesRepPtr->en
5750: 64 20 3e 20 49 4e 54 5f 4d 41 58 20 7c 7c 0a 2b  d > INT_MAX ||.+
5760: 09 61 72 69 74 68 53 65 72 69 65 73 52 65 70 50  .arithSeriesRepP
5770: 74 72 2d 3e 65 6e 64 20 3c 20 49 4e 54 5f 4d 49  tr->end < INT_MI
5780: 4e 29 0a 2b 09 20 20 20 20 61 72 69 74 68 53 65  N).+.    arithSe
5790: 72 69 65 73 52 65 70 50 74 72 2d 3e 66 6c 61 67  riesRepPtr->flag
57a0: 73 20 3d 20 54 43 4c 5f 41 52 49 54 48 53 45 52  s = TCL_ARITHSER
57b0: 49 45 53 5f 49 53 5f 57 49 44 45 3b 0a 2b 20 20  IES_IS_WIDE;.+  
57c0: 20 20 61 72 69 74 68 53 65 72 69 65 73 50 74 72    arithSeriesPtr
57d0: 2d 3e 69 6e 74 65 72 6e 61 6c 52 65 70 2e 74 77  ->internalRep.tw
57e0: 6f 50 74 72 56 61 6c 75 65 2e 70 74 72 31 20 3d  oPtrValue.ptr1 =
57f0: 20 28 56 4f 49 44 20 2a 29 20 61 72 69 74 68 53   (VOID *) arithS
5800: 65 72 69 65 73 52 65 70 50 74 72 3b 0a 2b 20 20  eriesRepPtr;.+  
5810: 20 20 61 72 69 74 68 53 65 72 69 65 73 50 74 72    arithSeriesPtr
5820: 2d 3e 69 6e 74 65 72 6e 61 6c 52 65 70 2e 74 77  ->internalRep.tw
5830: 6f 50 74 72 56 61 6c 75 65 2e 70 74 72 32 20 3d  oPtrValue.ptr2 =
5840: 20 4e 55 4c 4c 3b 0a 2b 20 20 20 20 61 72 69 74   NULL;.+    arit
5850: 68 53 65 72 69 65 73 50 74 72 2d 3e 74 79 70 65  hSeriesPtr->type
5860: 50 74 72 20 3d 20 26 74 63 6c 41 72 69 74 68 53  Ptr = &tclArithS
5870: 65 72 69 65 73 54 79 70 65 3b 0a 2b 20 20 20 20  eriesType;.+    
5880: 69 66 20 28 6c 65 6e 20 3e 20 30 29 0a 2b 20 20  if (len > 0).+  
5890: 20 20 09 54 63 6c 5f 49 6e 76 61 6c 69 64 61 74    .Tcl_Invalidat
58a0: 65 53 74 72 69 6e 67 52 65 70 28 61 72 69 74 68  eStringRep(arith
58b0: 53 65 72 69 65 73 50 74 72 29 3b 0a 2b 0a 2b 20  SeriesPtr);.+.+ 
58c0: 20 20 20 72 65 74 75 72 6e 20 61 72 69 74 68 53     return arithS
58d0: 65 72 69 65 73 50 74 72 3b 0a 2b 7d 0a 2b 0a 2b  eriesPtr;.+}.+.+
58e0: 0a 2b 2f 2a 0a 2b 20 2a 2d 2d 2d 2d 2d 2d 2d 2d  .+/*.+ *--------
58f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5900: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5910: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5920: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 2b  --------------.+
5930: 20 2a 0a 2b 20 2a 20 54 63 6c 5f 41 72 69 74 68   *.+ * Tcl_Arith
5940: 53 65 72 69 65 73 4f 62 6a 49 6e 64 65 78 20 2d  SeriesObjIndex -
5950: 2d 0a 2b 20 2a 0a 2b 20 2a 09 52 65 74 75 72 6e  -.+ *.+ *.Return
5960: 73 20 74 68 65 20 65 6c 65 6d 65 6e 74 20 77 69  s the element wi
5970: 74 68 20 74 68 65 20 73 70 65 63 69 66 69 65 64  th the specified
5980: 20 69 6e 64 65 78 20 69 6e 20 74 68 65 20 6c 69   index in the li
5990: 73 74 0a 2b 20 2a 09 72 65 70 72 65 73 65 6e 74  st.+ *.represent
59a0: 65 64 20 62 79 20 74 68 65 20 73 70 65 63 69 66  ed by the specif
59b0: 69 65 64 20 41 72 69 74 68 6d 65 6e 74 69 63 20  ied Arithmentic 
59c0: 53 65 71 75 65 6e 63 65 20 6f 62 6a 65 63 74 2e  Sequence object.
59d0: 0a 2b 20 2a 09 49 66 20 74 68 65 20 69 6e 64 65  .+ *.If the inde
59e0: 78 20 69 73 20 6f 75 74 20 6f 66 20 72 61 6e 67  x is out of rang
59f0: 65 2c 20 54 43 4c 5f 45 52 52 4f 52 20 69 73 20  e, TCL_ERROR is 
5a00: 72 65 74 75 72 6e 65 64 2c 0a 2b 20 2a 09 6f 74  returned,.+ *.ot
5a10: 68 65 72 77 69 73 65 20 54 43 4c 5f 4f 4b 20 69  herwise TCL_OK i
5a20: 73 20 72 65 74 75 72 6e 65 64 20 61 6e 64 20 74  s returned and t
5a30: 68 65 20 69 6e 74 65 67 65 72 20 76 61 6c 75 65  he integer value
5a40: 20 6f 66 20 74 68 65 0a 2b 20 2a 09 65 6c 65 6d   of the.+ *.elem
5a50: 65 6e 74 20 69 73 20 73 74 6f 72 65 64 20 69 6e  ent is stored in
5a60: 20 2a 65 6c 65 6d 65 6e 74 2e 0a 2b 20 2a 0a 2b   *element..+ *.+
5a70: 20 2a 20 52 65 73 75 6c 74 73 3a 0a 2b 20 2a 0a   * Results:.+ *.
5a80: 2b 20 2a 20 09 54 43 4c 5f 4f 4b 20 6f 6e 20 73  + * .TCL_OK on s
5a90: 75 63 63 65 73 2c 20 54 43 4c 5f 45 52 52 4f 52  ucces, TCL_ERROR
5aa0: 20 6f 6e 20 69 6e 64 65 78 20 6f 75 74 20 6f 66   on index out of
5ab0: 20 72 61 6e 67 65 2e 0a 2b 20 2a 0a 2b 20 2a 20   range..+ *.+ * 
5ac0: 53 69 64 65 20 45 66 66 65 63 74 73 3a 0a 2b 20  Side Effects:.+ 
5ad0: 2a 0a 2b 20 2a 20 09 4f 6e 20 73 75 63 63 65 73  *.+ * .On succes
5ae0: 73 2c 20 74 68 65 20 69 6e 74 65 67 65 72 20 70  s, the integer p
5af0: 6f 69 6e 74 65 64 20 62 79 20 2a 65 6c 65 6d 65  ointed by *eleme
5b00: 6e 74 20 69 73 20 6d 6f 64 69 66 69 65 64 2e 0a  nt is modified..
5b10: 2b 20 2a 0a 2b 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d  + *.+ *---------
5b20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5b30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5b40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5b50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 2b 20  -------------.+ 
5b60: 2a 2f 0a 2b 0a 2b 69 6e 74 0a 2b 54 63 6c 5f 41  */.+.+int.+Tcl_A
5b70: 72 69 74 68 53 65 72 69 65 73 4f 62 6a 49 6e 64  rithSeriesObjInd
5b80: 65 78 28 54 63 6c 5f 4f 62 6a 20 2a 61 72 69 74  ex(Tcl_Obj *arit
5b90: 68 53 65 72 69 65 73 50 74 72 2c 20 69 6e 74 20  hSeriesPtr, int 
5ba0: 69 6e 64 65 78 2c 20 54 63 6c 5f 57 69 64 65 49  index, Tcl_WideI
5bb0: 6e 74 20 2a 65 6c 65 6d 65 6e 74 29 0a 2b 7b 0a  nt *element).+{.
5bc0: 2b 20 20 20 20 41 72 69 74 68 53 65 72 69 65 73  +    ArithSeries
5bd0: 20 2a 61 72 69 74 68 53 65 72 69 65 73 52 65 70   *arithSeriesRep
5be0: 50 74 72 3b 0a 2b 0a 2b 20 20 20 20 69 66 20 28  Ptr;.+.+    if (
5bf0: 61 72 69 74 68 53 65 72 69 65 73 50 74 72 2d 3e  arithSeriesPtr->
5c00: 74 79 70 65 50 74 72 20 21 3d 20 26 74 63 6c 41  typePtr != &tclA
5c10: 72 69 74 68 53 65 72 69 65 73 54 79 70 65 29 20  rithSeriesType) 
5c20: 7b 0a 2b 20 20 20 20 20 20 20 20 54 63 6c 5f 50  {.+        Tcl_P
5c30: 61 6e 69 63 28 22 54 63 6c 5f 41 72 69 74 68 53  anic("Tcl_ArithS
5c40: 65 72 69 65 73 4f 62 6a 49 6e 64 65 78 20 63 61  eriesObjIndex ca
5c50: 6c 6c 65 64 20 77 69 74 68 20 61 20 6e 6f 74 20  lled with a not 
5c60: 41 72 69 74 68 53 65 72 69 65 73 20 4f 62 6a 2e  ArithSeries Obj.
5c70: 22 29 3b 0a 2b 20 20 20 20 7d 0a 2b 20 20 20 20  ");.+    }.+    
5c80: 61 72 69 74 68 53 65 72 69 65 73 52 65 70 50 74  arithSeriesRepPt
5c90: 72 20 3d 20 28 41 72 69 74 68 53 65 72 69 65 73  r = (ArithSeries
5ca0: 2a 29 0a 2b 09 20 20 20 20 61 72 69 74 68 53 65  *).+.    arithSe
5cb0: 72 69 65 73 50 74 72 2d 3e 69 6e 74 65 72 6e 61  riesPtr->interna
5cc0: 6c 52 65 70 2e 74 77 6f 50 74 72 56 61 6c 75 65  lRep.twoPtrValue
5cd0: 2e 70 74 72 31 3b 0a 2b 20 20 20 20 69 66 20 28  .ptr1;.+    if (
5ce0: 69 6e 64 65 78 20 3c 20 30 20 7c 7c 20 69 6e 64  index < 0 || ind
5cf0: 65 78 20 3e 3d 20 61 72 69 74 68 53 65 72 69 65  ex >= arithSerie
5d00: 73 52 65 70 50 74 72 2d 3e 6c 65 6e 29 0a 2b 09  sRepPtr->len).+.
5d10: 20 20 20 20 72 65 74 75 72 6e 20 54 43 4c 5f 45      return TCL_E
5d20: 52 52 4f 52 3b 0a 2b 20 20 20 20 2f 2a 20 4c 69  RROR;.+    /* Li
5d30: 73 74 5b 69 5d 20 3d 20 53 74 61 72 74 20 2b 20  st[i] = Start + 
5d40: 28 53 74 65 70 20 2a 20 69 29 20 2a 2f 0a 2b 20  (Step * i) */.+ 
5d50: 20 20 20 2a 65 6c 65 6d 65 6e 74 20 3d 20 61 72     *element = ar
5d60: 69 74 68 53 65 72 69 65 73 52 65 70 50 74 72 2d  ithSeriesRepPtr-
5d70: 3e 73 74 61 72 74 2b 28 69 6e 64 65 78 2a 61 72  >start+(index*ar
5d80: 69 74 68 53 65 72 69 65 73 52 65 70 50 74 72 2d  ithSeriesRepPtr-
5d90: 3e 73 74 65 70 29 3b 0a 2b 20 20 20 20 72 65 74  >step);.+    ret
5da0: 75 72 6e 20 54 43 4c 5f 4f 4b 3b 0a 2b 7d 0a 2b  urn TCL_OK;.+}.+
5db0: 0a 2b 2f 2a 0a 2b 20 2a 2d 2d 2d 2d 2d 2d 2d 2d  .+/*.+ *--------
5dc0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5dd0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5de0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5df0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 2b  --------------.+
5e00: 20 2a 0a 2b 20 2a 20 54 63 6c 5f 41 72 69 74 68   *.+ * Tcl_Arith
5e10: 53 65 72 69 65 73 4f 62 6a 4c 65 6e 67 74 68 0a  SeriesObjLength.
5e20: 2b 20 2a 0a 2b 20 2a 09 52 65 74 75 72 6e 73 20  + *.+ *.Returns 
5e30: 74 68 65 20 6c 65 6e 67 74 68 20 6f 66 20 74 68  the length of th
5e40: 65 20 61 72 69 74 68 6d 65 6e 74 69 63 20 73 65  e arithmentic se
5e50: 72 69 65 73 2e 0a 2b 20 2a 0a 2b 20 2a 20 52 65  ries..+ *.+ * Re
5e60: 73 75 6c 74 73 3a 0a 2b 20 2a 0a 2b 20 2a 20 09  sults:.+ *.+ * .
5e70: 54 68 65 20 6c 65 6e 67 74 68 20 6f 66 20 74 68  The length of th
5e80: 65 20 73 65 72 69 65 73 2e 0a 2b 20 2a 0a 2b 20  e series..+ *.+ 
5e90: 2a 20 53 69 64 65 20 45 66 66 65 63 74 73 3a 0a  * Side Effects:.
5ea0: 2b 20 2a 0a 2b 20 2a 20 09 4e 6f 6e 65 2e 0a 2b  + *.+ * .None..+
5eb0: 20 2a 0a 2b 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d   *.+ *----------
5ec0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5ed0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5ee0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5ef0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 2b 20 2a  ------------.+ *
5f00: 2f 0a 2b 69 6e 74 20 54 63 6c 5f 41 72 69 74 68  /.+int Tcl_Arith
5f10: 53 65 72 69 65 73 4f 62 6a 4c 65 6e 67 74 68 28  SeriesObjLength(
5f20: 54 63 6c 5f 4f 62 6a 20 2a 61 72 69 74 68 53 65  Tcl_Obj *arithSe
5f30: 72 69 65 73 50 74 72 29 0a 2b 7b 0a 2b 20 20 20  riesPtr).+{.+   
5f40: 20 41 72 69 74 68 53 65 72 69 65 73 20 2a 61 72   ArithSeries *ar
5f50: 69 74 68 53 65 72 69 65 73 52 65 70 50 74 72 20  ithSeriesRepPtr 
5f60: 3d 20 28 41 72 69 74 68 53 65 72 69 65 73 2a 29  = (ArithSeries*)
5f70: 0a 2b 09 20 20 20 20 61 72 69 74 68 53 65 72 69  .+.    arithSeri
5f80: 65 73 50 74 72 2d 3e 69 6e 74 65 72 6e 61 6c 52  esPtr->internalR
5f90: 65 70 2e 74 77 6f 50 74 72 56 61 6c 75 65 2e 70  ep.twoPtrValue.p
5fa0: 74 72 31 3b 0a 2b 20 20 20 20 72 65 74 75 72 6e  tr1;.+    return
5fb0: 20 61 72 69 74 68 53 65 72 69 65 73 52 65 70 50   arithSeriesRepP
5fc0: 74 72 2d 3e 6c 65 6e 3b 0a 2b 7d 0a 2b 0a 2b 2f  tr->len;.+}.+.+/
5fd0: 2a 0a 2b 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  *.+ *-----------
5fe0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5ff0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
6000: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
6010: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 2b 20 2a 0a  -----------.+ *.
6020: 2b 20 2a 20 46 72 65 65 41 72 69 74 68 53 65 72  + * FreeArithSer
6030: 69 65 73 49 6e 74 65 72 6e 61 6c 52 65 70 20 2d  iesInternalRep -
6040: 2d 0a 2b 20 2a 0a 2b 20 2a 09 44 65 61 6c 6c 6f  -.+ *.+ *.Deallo
6050: 63 61 74 65 20 74 68 65 20 73 74 6f 72 61 67 65  cate the storage
6060: 20 61 73 73 6f 63 69 61 74 65 64 20 77 69 74 68   associated with
6070: 20 61 6e 20 61 72 69 74 68 73 65 72 69 65 73 20   an arithseries 
6080: 6f 62 6a 65 63 74 27 73 0a 2b 20 2a 09 69 6e 74  object's.+ *.int
6090: 65 72 6e 61 6c 20 72 65 70 72 65 73 65 6e 74 61  ernal representa
60a0: 74 69 6f 6e 2e 0a 2b 20 2a 0a 2b 20 2a 20 52 65  tion..+ *.+ * Re
60b0: 73 75 6c 74 73 3a 0a 2b 20 2a 09 4e 6f 6e 65 2e  sults:.+ *.None.
60c0: 0a 2b 20 2a 0a 2b 20 2a 20 53 69 64 65 20 65 66  .+ *.+ * Side ef
60d0: 66 65 63 74 73 3a 0a 2b 20 2a 09 46 72 65 65 73  fects:.+ *.Frees
60e0: 20 61 72 69 74 68 53 65 72 69 65 73 50 74 72 27   arithSeriesPtr'
60f0: 73 20 41 72 69 74 68 53 65 72 69 65 73 2a 20 69  s ArithSeries* i
6100: 6e 74 65 72 6e 61 6c 20 72 65 70 72 65 73 65 6e  nternal represen
6110: 74 61 74 69 6f 6e 20 61 6e 64 0a 2b 20 2a 09 73  tation and.+ *.s
6120: 65 74 73 20 6c 69 73 74 50 74 72 27 73 09 69 6e  ets listPtr's.in
6130: 74 65 72 6e 61 6c 52 65 70 2e 74 77 6f 50 74 72  ternalRep.twoPtr
6140: 56 61 6c 75 65 2e 70 74 72 31 20 74 6f 20 4e 55  Value.ptr1 to NU
6150: 4c 4c 2e 0a 2b 20 2a 0a 2b 20 2a 2d 2d 2d 2d 2d  LL..+ *.+ *-----
6160: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
6170: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
6180: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
6190: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
61a0: 2d 0a 2b 20 2a 2f 0a 2b 0a 2b 73 74 61 74 69 63  -.+ */.+.+static
61b0: 20 76 6f 69 64 0a 2b 46 72 65 65 41 72 69 74 68   void.+FreeArith
61c0: 53 65 72 69 65 73 49 6e 74 65 72 6e 61 6c 52 65  SeriesInternalRe
61d0: 70 28 54 63 6c 5f 4f 62 6a 20 2a 61 72 69 74 68  p(Tcl_Obj *arith
61e0: 53 65 72 69 65 73 50 74 72 29 0a 2b 7b 0a 2b 20  SeriesPtr).+{.+ 
61f0: 20 20 20 41 72 69 74 68 53 65 72 69 65 73 20 2a     ArithSeries *
6200: 61 72 69 74 68 53 65 72 69 65 73 52 65 70 50 74  arithSeriesRepPt
6210: 72 20 3d 0a 2b 09 20 20 20 20 28 41 72 69 74 68  r =.+.    (Arith
6220: 53 65 72 69 65 73 20 2a 29 20 61 72 69 74 68 53  Series *) arithS
6230: 65 72 69 65 73 50 74 72 2d 3e 69 6e 74 65 72 6e  eriesPtr->intern
6240: 61 6c 52 65 70 2e 74 77 6f 50 74 72 56 61 6c 75  alRep.twoPtrValu
6250: 65 2e 70 74 72 31 3b 0a 2b 20 20 20 20 63 6b 66  e.ptr1;.+    ckf
6260: 72 65 65 28 28 63 68 61 72 20 2a 29 20 61 72 69  ree((char *) ari
6270: 74 68 53 65 72 69 65 73 52 65 70 50 74 72 29 3b  thSeriesRepPtr);
6280: 0a 2b 20 20 20 20 61 72 69 74 68 53 65 72 69 65  .+    arithSerie
6290: 73 50 74 72 2d 3e 69 6e 74 65 72 6e 61 6c 52 65  sPtr->internalRe
62a0: 70 2e 74 77 6f 50 74 72 56 61 6c 75 65 2e 70 74  p.twoPtrValue.pt
62b0: 72 31 20 3d 20 4e 55 4c 4c 3b 0a 2b 7d 0a 2b 0a  r1 = NULL;.+}.+.
62c0: 2b 2f 2a 0a 2b 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d  +/*.+ *---------
62d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
62e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
62f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
6300: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 2b 20  -------------.+ 
6310: 2a 0a 2b 20 2a 20 44 75 70 41 72 69 74 68 53 65  *.+ * DupArithSe
6320: 72 69 65 73 49 6e 74 65 72 6e 61 6c 52 65 70 20  riesInternalRep 
6330: 2d 2d 0a 2b 20 2a 0a 2b 20 2a 09 49 6e 69 74 69  --.+ *.+ *.Initi
6340: 61 6c 69 7a 65 20 74 68 65 20 69 6e 74 65 72 6e  alize the intern
6350: 61 6c 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f  al representatio
6360: 6e 20 6f 66 20 61 20 61 72 69 74 68 73 65 72 69  n of a arithseri
6370: 65 73 20 54 63 6c 5f 4f 62 6a 20 74 6f 20 61 0a  es Tcl_Obj to a.
6380: 2b 20 2a 09 63 6f 70 79 20 6f 66 20 74 68 65 20  + *.copy of the 
6390: 69 6e 74 65 72 6e 61 6c 20 72 65 70 72 65 73 65  internal represe
63a0: 6e 74 61 74 69 6f 6e 20 6f 66 20 61 6e 20 65 78  ntation of an ex
63b0: 69 73 74 69 6e 67 20 61 72 69 74 68 73 65 72 69  isting arithseri
63c0: 65 73 20 6f 62 6a 65 63 74 2e 20 0a 2b 20 2a 0a  es object. .+ *.
63d0: 2b 20 2a 20 52 65 73 75 6c 74 73 3a 0a 2b 20 2a  + * Results:.+ *
63e0: 09 4e 6f 6e 65 2e 0a 2b 20 2a 0a 2b 20 2a 20 53  .None..+ *.+ * S
63f0: 69 64 65 20 65 66 66 65 63 74 73 3a 0a 2b 20 2a  ide effects:.+ *
6400: 09 57 65 20 73 65 74 20 22 63 6f 70 79 50 74 72  .We set "copyPtr
6410: 22 73 20 69 6e 74 65 72 6e 61 6c 20 72 65 70 20  "s internal rep 
6420: 74 6f 20 61 20 70 6f 69 6e 74 65 72 20 74 6f 20  to a pointer to 
6430: 61 0a 2b 20 2a 09 6e 65 77 6c 79 20 61 6c 6c 6f  a.+ *.newly allo
6440: 63 61 74 65 64 20 41 72 69 74 68 53 65 72 69 65  cated ArithSerie
6450: 73 20 73 74 72 75 63 74 75 72 65 2e 0a 2b 20 2a  s structure..+ *
6460: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
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 0a 2b 20 2a 2f 0a 2b 0a 2b 73  ------.+ */.+.+s
64b0: 74 61 74 69 63 20 76 6f 69 64 0a 2b 44 75 70 41  tatic void.+DupA
64c0: 72 69 74 68 53 65 72 69 65 73 49 6e 74 65 72 6e  rithSeriesIntern
64d0: 61 6c 52 65 70 28 73 72 63 50 74 72 2c 20 63 6f  alRep(srcPtr, co
64e0: 70 79 50 74 72 29 0a 2b 20 20 20 20 54 63 6c 5f  pyPtr).+    Tcl_
64f0: 4f 62 6a 20 2a 73 72 63 50 74 72 3b 09 09 2f 2a  Obj *srcPtr;../*
6500: 20 4f 62 6a 65 63 74 20 77 69 74 68 20 69 6e 74   Object with int
6510: 65 72 6e 61 6c 20 72 65 70 20 74 6f 20 63 6f 70  ernal rep to cop
6520: 79 2e 20 2a 2f 0a 2b 20 20 20 20 54 63 6c 5f 4f  y. */.+    Tcl_O
6530: 62 6a 20 2a 63 6f 70 79 50 74 72 3b 09 09 2f 2a  bj *copyPtr;../*
6540: 20 4f 62 6a 65 63 74 20 77 69 74 68 20 69 6e 74   Object with int
6550: 65 72 6e 61 6c 20 72 65 70 20 74 6f 20 73 65 74  ernal rep to set
6560: 2e 20 2a 2f 0a 2b 7b 0a 2b 20 20 20 20 41 72 69  . */.+{.+    Ari
6570: 74 68 53 65 72 69 65 73 20 2a 73 72 63 41 72 69  thSeries *srcAri
6580: 74 68 53 65 72 69 65 73 52 65 70 50 74 72 20 3d  thSeriesRepPtr =
6590: 0a 2b 09 20 20 20 20 28 41 72 69 74 68 53 65 72  .+.    (ArithSer
65a0: 69 65 73 20 2a 29 20 73 72 63 50 74 72 2d 3e 69  ies *) srcPtr->i
65b0: 6e 74 65 72 6e 61 6c 52 65 70 2e 74 77 6f 50 74  nternalRep.twoPt
65c0: 72 56 61 6c 75 65 2e 70 74 72 31 3b 0a 2b 20 20  rValue.ptr1;.+  
65d0: 20 20 41 72 69 74 68 53 65 72 69 65 73 20 2a 63    ArithSeries *c
65e0: 6f 70 79 41 72 69 74 68 53 65 72 69 65 73 52 65  opyArithSeriesRe
65f0: 70 50 74 72 3b 0a 2b 0a 2b 20 20 20 20 2f 2a 0a  pPtr;.+.+    /*.
6600: 2b 20 20 20 20 20 2a 20 41 6c 6c 6f 63 61 74 65  +     * Allocate
6610: 20 61 20 6e 65 77 20 41 72 69 74 68 53 65 72 69   a new ArithSeri
6620: 65 73 20 73 74 72 75 63 74 75 72 65 2e 20 2a 2f  es structure. */
6630: 0a 2b 0a 2b 20 20 20 20 63 6f 70 79 41 72 69 74  .+.+    copyArit
6640: 68 53 65 72 69 65 73 52 65 70 50 74 72 20 3d 20  hSeriesRepPtr = 
6650: 28 41 72 69 74 68 53 65 72 69 65 73 2a 29 20 63  (ArithSeries*) c
6660: 6b 61 6c 6c 6f 63 28 73 69 7a 65 6f 66 28 41 72  kalloc(sizeof(Ar
6670: 69 74 68 53 65 72 69 65 73 29 29 3b 0a 2b 20 20  ithSeries));.+  
6680: 20 20 63 6f 70 79 41 72 69 74 68 53 65 72 69 65    copyArithSerie
6690: 73 52 65 70 50 74 72 2d 3e 73 74 61 72 74 20 3d  sRepPtr->start =
66a0: 20 73 72 63 41 72 69 74 68 53 65 72 69 65 73 52   srcArithSeriesR
66b0: 65 70 50 74 72 2d 3e 73 74 61 72 74 3b 0a 2b 20  epPtr->start;.+ 
66c0: 20 20 20 63 6f 70 79 41 72 69 74 68 53 65 72 69     copyArithSeri
66d0: 65 73 52 65 70 50 74 72 2d 3e 65 6e 64 20 3d 20  esRepPtr->end = 
66e0: 73 72 63 41 72 69 74 68 53 65 72 69 65 73 52 65  srcArithSeriesRe
66f0: 70 50 74 72 2d 3e 65 6e 64 3b 0a 2b 20 20 20 20  pPtr->end;.+    
6700: 63 6f 70 79 41 72 69 74 68 53 65 72 69 65 73 52  copyArithSeriesR
6710: 65 70 50 74 72 2d 3e 73 74 65 70 20 3d 20 73 72  epPtr->step = sr
6720: 63 41 72 69 74 68 53 65 72 69 65 73 52 65 70 50  cArithSeriesRepP
6730: 74 72 2d 3e 73 74 65 70 3b 0a 2b 20 20 20 20 63  tr->step;.+    c
6740: 6f 70 79 41 72 69 74 68 53 65 72 69 65 73 52 65  opyArithSeriesRe
6750: 70 50 74 72 2d 3e 6c 65 6e 20 3d 20 73 72 63 41  pPtr->len = srcA
6760: 72 69 74 68 53 65 72 69 65 73 52 65 70 50 74 72  rithSeriesRepPtr
6770: 2d 3e 6c 65 6e 3b 0a 2b 20 20 20 20 63 6f 70 79  ->len;.+    copy
6780: 41 72 69 74 68 53 65 72 69 65 73 52 65 70 50 74  ArithSeriesRepPt
6790: 72 2d 3e 66 6c 61 67 73 20 3d 20 73 72 63 41 72  r->flags = srcAr
67a0: 69 74 68 53 65 72 69 65 73 52 65 70 50 74 72 2d  ithSeriesRepPtr-
67b0: 3e 66 6c 61 67 73 3b 0a 2b 0a 2b 20 20 20 20 63  >flags;.+.+    c
67c0: 6f 70 79 50 74 72 2d 3e 69 6e 74 65 72 6e 61 6c  opyPtr->internal
67d0: 52 65 70 2e 74 77 6f 50 74 72 56 61 6c 75 65 2e  Rep.twoPtrValue.
67e0: 70 74 72 31 20 3d 20 28 56 4f 49 44 20 2a 29 20  ptr1 = (VOID *) 
67f0: 63 6f 70 79 41 72 69 74 68 53 65 72 69 65 73 52  copyArithSeriesR
6800: 65 70 50 74 72 3b 0a 2b 20 20 20 20 63 6f 70 79  epPtr;.+    copy
6810: 50 74 72 2d 3e 69 6e 74 65 72 6e 61 6c 52 65 70  Ptr->internalRep
6820: 2e 74 77 6f 50 74 72 56 61 6c 75 65 2e 70 74 72  .twoPtrValue.ptr
6830: 32 20 3d 20 4e 55 4c 4c 3b 0a 2b 20 20 20 20 63  2 = NULL;.+    c
6840: 6f 70 79 50 74 72 2d 3e 74 79 70 65 50 74 72 20  opyPtr->typePtr 
6850: 3d 20 26 74 63 6c 41 72 69 74 68 53 65 72 69 65  = &tclArithSerie
6860: 73 54 79 70 65 3b 0a 2b 7d 0a 2b 0a 2b 2f 2a 0a  sType;.+}.+.+/*.
6870: 2b 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  + *-------------
6880: 2d 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 0a 2b 20 2a 0a 2b 20  ---------.+ *.+ 
68c0: 2a 20 55 70 64 61 74 65 53 74 72 69 6e 67 4f 66  * UpdateStringOf
68d0: 41 72 69 74 68 53 65 72 69 65 73 20 2d 2d 0a 2b  ArithSeries --.+
68e0: 20 2a 0a 2b 20 2a 09 55 70 64 61 74 65 20 74 68   *.+ *.Update th
68f0: 65 20 73 74 72 69 6e 67 20 72 65 70 72 65 73 65  e string represe
6900: 6e 74 61 74 69 6f 6e 20 66 6f 72 20 61 6e 20 61  ntation for an a
6910: 72 69 74 68 73 65 72 69 65 73 20 6f 62 6a 65 63  rithseries objec
6920: 74 2e 0a 2b 20 2a 09 4e 6f 74 65 3a 20 54 68 69  t..+ *.Note: Thi
6930: 73 20 70 72 6f 63 65 64 75 72 65 20 64 6f 65 73  s procedure does
6940: 20 6e 6f 74 20 69 6e 76 61 6c 69 64 61 74 65 20   not invalidate 
6950: 61 6e 20 65 78 69 73 74 69 6e 67 20 6f 6c 64 20  an existing old 
6960: 73 74 72 69 6e 67 20 72 65 70 0a 2b 20 2a 09 73  string rep.+ *.s
6970: 6f 20 73 74 6f 72 61 67 65 20 77 69 6c 6c 20 62  o storage will b
6980: 65 20 6c 6f 73 74 20 69 66 20 74 68 69 73 20 68  e lost if this h
6990: 61 73 20 6e 6f 74 20 61 6c 72 65 61 64 79 20 62  as not already b
69a0: 65 65 6e 20 64 6f 6e 65 2e 20 0a 2b 20 2a 0a 2b  een done. .+ *.+
69b0: 20 2a 20 52 65 73 75 6c 74 73 3a 0a 2b 20 2a 09   * Results:.+ *.
69c0: 4e 6f 6e 65 2e 0a 2b 20 2a 0a 2b 20 2a 20 53 69  None..+ *.+ * Si
69d0: 64 65 20 65 66 66 65 63 74 73 3a 0a 2b 20 2a 09  de effects:.+ *.
69e0: 54 68 65 20 6f 62 6a 65 63 74 27 73 20 73 74 72  The object's str
69f0: 69 6e 67 20 69 73 20 73 65 74 20 74 6f 20 61 20  ing is set to a 
6a00: 76 61 6c 69 64 20 73 74 72 69 6e 67 20 74 68 61  valid string tha
6a10: 74 20 72 65 73 75 6c 74 73 20 66 72 6f 6d 0a 2b  t results from.+
6a20: 20 2a 09 74 68 65 20 6c 69 73 74 2d 74 6f 2d 73   *.the list-to-s
6a30: 74 72 69 6e 67 20 63 6f 6e 76 65 72 73 69 6f 6e  tring conversion
6a40: 2e 20 54 68 69 73 20 73 74 72 69 6e 67 20 77 69  . This string wi
6a50: 6c 6c 20 62 65 20 65 6d 70 74 79 20 69 66 20 74  ll be empty if t
6a60: 68 65 0a 2b 20 2a 09 6c 69 73 74 20 68 61 73 20  he.+ *.list has 
6a70: 6e 6f 20 65 6c 65 6d 65 6e 74 73 2e 20 54 68 65  no elements. The
6a80: 20 6c 69 73 74 20 69 6e 74 65 72 6e 61 6c 20 72   list internal r
6a90: 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 0a 2b 20  epresentation.+ 
6aa0: 2a 09 73 68 6f 75 6c 64 20 6e 6f 74 20 62 65 20  *.should not be 
6ab0: 4e 55 4c 4c 20 61 6e 64 20 77 65 20 61 73 73 75  NULL and we assu
6ac0: 6d 65 20 69 74 20 69 73 20 6e 6f 74 20 4e 55 4c  me it is not NUL
6ad0: 4c 2e 0a 2b 20 2a 0a 2b 20 2a 20 4e 6f 74 65 73  L..+ *.+ * Notes
6ae0: 3a 0a 2b 20 2a 20 09 41 74 20 74 68 65 20 63 6f  :.+ * .At the co
6af0: 73 74 20 6f 66 20 6f 76 65 72 61 6c 6c 6f 63 61  st of overalloca
6b00: 74 69 6f 6e 20 69 74 27 73 20 70 6f 73 73 69 62  tion it's possib
6b10: 6c 65 20 74 6f 20 65 73 74 69 6d 61 74 65 0a 2b  le to estimate.+
6b20: 20 2a 20 09 74 68 65 20 6c 65 6e 67 74 68 20 6f   * .the length o
6b30: 66 20 74 68 65 20 73 74 72 69 6e 67 20 72 65 70  f the string rep
6b40: 72 65 73 65 6e 74 61 74 69 6f 6e 20 61 6e 64 20  resentation and 
6b50: 6d 61 6b 65 20 74 68 69 73 20 70 72 6f 63 65 64  make this proced
6b60: 75 72 65 0a 2b 20 2a 20 09 6d 75 63 68 20 66 61  ure.+ * .much fa
6b70: 73 74 65 72 2e 20 42 65 63 61 75 73 65 20 74 68  ster. Because th
6b80: 65 20 70 72 6f 67 72 61 6d 6d 65 72 20 73 68 6f  e programmer sho
6b90: 75 6c 64 6e 27 74 20 65 78 70 65 63 74 20 74 68  uldn't expect th
6ba0: 65 0a 2b 20 2a 20 09 73 74 72 69 6e 67 20 63 6f  e.+ * .string co
6bb0: 6e 76 65 72 73 69 6f 6e 20 6f 66 20 61 20 62 69  nversion of a bi
6bc0: 67 20 61 72 69 74 68 6d 65 74 69 63 20 73 65 71  g arithmetic seq
6bd0: 75 65 6e 63 65 20 74 6f 20 62 65 20 66 61 73 74  uence to be fast
6be0: 0a 2b 20 2a 20 09 74 68 69 73 20 76 65 72 73 69  .+ * .this versi
6bf0: 6f 6e 20 74 61 6b 65 73 20 6d 6f 72 65 20 63 61  on takes more ca
6c00: 72 65 20 6f 66 20 73 70 61 63 65 20 74 68 61 6e  re of space than
6c10: 20 74 69 6d 65 2e 0a 2b 20 2a 0a 2b 20 2a 2d 2d   time..+ *.+ *--
6c20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
6c30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
6c40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
6c50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
6c60: 2d 2d 2d 2d 0a 2b 20 2a 2f 0a 2b 0a 2b 73 74 61  ----.+ */.+.+sta
6c70: 74 69 63 20 76 6f 69 64 0a 2b 55 70 64 61 74 65  tic void.+Update
6c80: 53 74 72 69 6e 67 4f 66 41 72 69 74 68 53 65 72  StringOfArithSer
6c90: 69 65 73 28 54 63 6c 5f 4f 62 6a 20 2a 61 72 69  ies(Tcl_Obj *ari
6ca0: 74 68 53 65 72 69 65 73 50 74 72 29 0a 2b 7b 0a  thSeriesPtr).+{.
6cb0: 2b 20 20 20 20 41 72 69 74 68 53 65 72 69 65 73  +    ArithSeries
6cc0: 20 2a 61 72 69 74 68 53 65 72 69 65 73 52 65 70   *arithSeriesRep
6cd0: 50 74 72 20 3d 0a 2b 09 20 20 20 20 28 41 72 69  Ptr =.+.    (Ari
6ce0: 74 68 53 65 72 69 65 73 2a 29 20 61 72 69 74 68  thSeries*) arith
6cf0: 53 65 72 69 65 73 50 74 72 2d 3e 69 6e 74 65 72  SeriesPtr->inter
6d00: 6e 61 6c 52 65 70 2e 74 77 6f 50 74 72 56 61 6c  nalRep.twoPtrVal
6d10: 75 65 2e 70 74 72 31 3b 0a 2b 20 20 20 20 63 68  ue.ptr1;.+    ch
6d20: 61 72 20 62 75 66 66 65 72 5b 54 43 4c 5f 49 4e  ar buffer[TCL_IN
6d30: 54 45 47 45 52 5f 53 50 41 43 45 2b 32 5d 2c 20  TEGER_SPACE+2], 
6d40: 2a 70 3b 0a 2b 20 20 20 20 69 6e 74 20 69 2c 20  *p;.+    int i, 
6d50: 6c 65 6e 67 74 68 20 3d 20 30 2c 20 73 6c 65 6e  length = 0, slen
6d60: 3b 0a 2b 20 20 20 20 54 63 6c 5f 57 69 64 65 49  ;.+    Tcl_WideI
6d70: 6e 74 20 65 6c 65 3b 0a 2b 0a 2b 20 20 20 20 2f  nt ele;.+.+    /
6d80: 2a 0a 2b 20 20 20 20 20 2a 20 45 6d 70 74 79 20  *.+     * Empty 
6d90: 72 61 6e 67 65 20 63 61 73 65 0a 2b 20 20 20 20  range case.+    
6da0: 20 2a 2f 0a 2b 20 20 20 20 69 66 20 28 61 72 69   */.+    if (ari
6db0: 74 68 53 65 72 69 65 73 52 65 70 50 74 72 2d 3e  thSeriesRepPtr->
6dc0: 6c 65 6e 20 3d 3d 20 30 29 20 7b 0a 2b 09 61 72  len == 0) {.+.ar
6dd0: 69 74 68 53 65 72 69 65 73 50 74 72 2d 3e 62 79  ithSeriesPtr->by
6de0: 74 65 73 20 3d 20 74 63 6c 45 6d 70 74 79 53 74  tes = tclEmptySt
6df0: 72 69 6e 67 52 65 70 3b 0a 2b 09 61 72 69 74 68  ringRep;.+.arith
6e00: 53 65 72 69 65 73 50 74 72 2d 3e 6c 65 6e 67 74  SeriesPtr->lengt
6e10: 68 20 3d 20 31 3b 0a 2b 20 20 20 20 7d 0a 2b 0a  h = 1;.+    }.+.
6e20: 2b 20 20 20 20 2f 2a 0a 2b 20 20 20 20 20 2a 20  +    /*.+     * 
6e30: 50 61 73 73 20 31 3a 20 65 73 74 69 6d 61 74 65  Pass 1: estimate
6e40: 20 73 70 61 63 65 2e 0a 2b 20 20 20 20 20 2a 2f   space..+     */
6e50: 0a 2b 20 20 20 20 66 6f 72 20 28 69 20 3d 20 30  .+    for (i = 0
6e60: 3b 20 69 20 3c 20 61 72 69 74 68 53 65 72 69 65  ; i < arithSerie
6e70: 73 52 65 70 50 74 72 2d 3e 6c 65 6e 3b 20 69 2b  sRepPtr->len; i+
6e80: 2b 29 20 7b 0a 2b 09 65 6c 65 20 3d 20 61 72 69  +) {.+.ele = ari
6e90: 74 68 53 65 72 69 65 73 52 65 70 50 74 72 2d 3e  thSeriesRepPtr->
6ea0: 73 74 61 72 74 20 2b 20 28 69 2a 61 72 69 74 68  start + (i*arith
6eb0: 53 65 72 69 65 73 52 65 70 50 74 72 2d 3e 73 74  SeriesRepPtr->st
6ec0: 65 70 29 3b 0a 2b 20 20 20 20 2f 2a 0a 2b 20 20  ep);.+    /*.+  
6ed0: 20 20 20 2a 20 4e 6f 74 65 20 74 68 61 74 20 73     * Note that s
6ee0: 70 72 69 6e 74 66 20 77 69 6c 6c 20 67 65 6e 65  printf will gene
6ef0: 72 61 74 65 20 61 20 63 6f 6d 70 69 6c 65 72 20  rate a compiler 
6f00: 77 61 72 6e 69 6e 67 20 75 6e 64 65 72 0a 2b 20  warning under.+ 
6f10: 20 20 20 20 2a 20 4d 69 6e 67 77 20 63 6c 61 69      * Mingw clai
6f20: 6d 69 6e 67 20 25 49 36 34 20 69 73 20 61 6e 20  ming %I64 is an 
6f30: 75 6e 6b 6e 6f 77 6e 20 66 6f 72 6d 61 74 20 73  unknown format s
6f40: 70 65 63 69 66 69 65 72 2e 0a 2b 20 20 20 20 20  pecifier..+     
6f50: 2a 20 4a 75 73 74 20 69 67 6e 6f 72 65 20 74 68  * Just ignore th
6f60: 69 73 20 77 61 72 6e 69 6e 67 2e 20 57 65 20 63  is warning. We c
6f70: 61 6e 27 74 20 75 73 65 20 25 4c 20 61 73 20 74  an't use %L as t
6f80: 68 65 20 66 6f 72 6d 61 74 0a 2b 20 20 20 20 20  he format.+     
6f90: 2a 20 73 70 65 63 69 66 69 65 72 20 73 69 6e 63  * specifier sinc
6fa0: 65 20 74 68 61 74 20 67 65 74 73 20 70 72 69 6e  e that gets prin
6fb0: 74 65 64 20 61 73 20 61 20 33 32 20 62 69 74 20  ted as a 32 bit 
6fc0: 76 61 6c 75 65 2e 0a 2b 20 20 20 20 20 2a 2f 0a  value..+     */.
6fd0: 2b 09 73 70 72 69 6e 74 66 28 62 75 66 66 65 72  +.sprintf(buffer
6fe0: 2c 20 22 25 22 20 54 43 4c 5f 4c 4c 5f 4d 4f 44  , "%" TCL_LL_MOD
6ff0: 49 46 49 45 52 20 22 64 22 2c 20 65 6c 65 29 3b  IFIER "d", ele);
7000: 0a 2b 09 73 6c 65 6e 20 3d 20 73 74 72 6c 65 6e  .+.slen = strlen
7010: 28 62 75 66 66 65 72 29 20 2b 20 31 3b 20 2f 2a  (buffer) + 1; /*
7020: 20 2b 20 31 20 69 73 20 66 6f 72 20 74 68 65 20   + 1 is for the 
7030: 73 70 61 63 65 20 6f 72 20 74 68 65 20 6e 75 6c  space or the nul
7040: 2d 74 65 72 6d 20 2a 2f 0a 2b 09 6c 65 6e 67 74  -term */.+.lengt
7050: 68 20 2b 3d 20 73 6c 65 6e 3b 0a 2b 20 20 20 20  h += slen;.+    
7060: 7d 0a 2b 0a 2b 20 20 20 20 2f 2a 0a 2b 20 20 20  }.+.+    /*.+   
7070: 20 20 2a 20 50 61 73 73 20 32 3a 20 67 65 6e 65    * Pass 2: gene
7080: 72 61 74 65 20 74 68 65 20 73 74 72 69 6e 67 20  rate the string 
7090: 72 65 70 72 2e 0a 2b 20 20 20 20 20 2a 2f 0a 2b  repr..+     */.+
70a0: 0a 2b 20 20 20 20 70 20 3d 20 61 72 69 74 68 53  .+    p = arithS
70b0: 65 72 69 65 73 50 74 72 2d 3e 62 79 74 65 73 20  eriesPtr->bytes 
70c0: 3d 20 63 6b 61 6c 6c 6f 63 28 6c 65 6e 67 74 68  = ckalloc(length
70d0: 29 3b 0a 2b 20 20 20 20 66 6f 72 20 28 69 20 3d  );.+    for (i =
70e0: 20 30 3b 20 69 20 3c 20 61 72 69 74 68 53 65 72   0; i < arithSer
70f0: 69 65 73 52 65 70 50 74 72 2d 3e 6c 65 6e 3b 20  iesRepPtr->len; 
7100: 69 2b 2b 29 20 7b 0a 2b 09 65 6c 65 20 3d 20 61  i++) {.+.ele = a
7110: 72 69 74 68 53 65 72 69 65 73 52 65 70 50 74 72  rithSeriesRepPtr
7120: 2d 3e 73 74 61 72 74 20 2b 20 28 69 2a 61 72 69  ->start + (i*ari
7130: 74 68 53 65 72 69 65 73 52 65 70 50 74 72 2d 3e  thSeriesRepPtr->
7140: 73 74 65 70 29 3b 0a 2b 09 73 70 72 69 6e 74 66  step);.+.sprintf
7150: 28 62 75 66 66 65 72 2c 20 22 25 22 20 54 43 4c  (buffer, "%" TCL
7160: 5f 4c 4c 5f 4d 4f 44 49 46 49 45 52 20 22 64 22  _LL_MODIFIER "d"
7170: 2c 20 65 6c 65 29 3b 0a 2b 09 73 6c 65 6e 20 3d  , ele);.+.slen =
7180: 20 73 74 72 6c 65 6e 28 62 75 66 66 65 72 29 3b   strlen(buffer);
7190: 0a 2b 09 73 74 72 63 70 79 28 70 2c 20 62 75 66  .+.strcpy(p, buf
71a0: 66 65 72 29 3b 0a 2b 09 70 5b 73 6c 65 6e 5d 20  fer);.+.p[slen] 
71b0: 3d 20 27 20 27 3b 0a 2b 09 70 20 2b 3d 20 73 6c  = ' ';.+.p += sl
71c0: 65 6e 2b 31 3b 0a 2b 20 20 20 20 7d 0a 2b 20 20  en+1;.+    }.+  
71d0: 20 20 61 72 69 74 68 53 65 72 69 65 73 50 74 72    arithSeriesPtr
71e0: 2d 3e 62 79 74 65 73 5b 6c 65 6e 67 74 68 2d 31  ->bytes[length-1
71f0: 5d 20 3d 20 27 5c 30 27 3b 0a 2b 20 20 20 20 61  ] = '\0';.+    a
7200: 72 69 74 68 53 65 72 69 65 73 50 74 72 2d 3e 6c  rithSeriesPtr->l
7210: 65 6e 67 74 68 20 3d 20 6c 65 6e 67 74 68 2d 31  ength = length-1
7220: 3b 0a 2b 7d 0a 2b 0a 2b 2f 2a 0a 2b 20 2a 2d 2d  ;.+}.+.+/*.+ *--
7230: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
7240: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
7250: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
7260: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
7270: 2d 2d 2d 2d 0a 2b 20 2a 0a 2b 20 2a 20 53 65 74  ----.+ *.+ * Set
7280: 41 72 69 74 68 53 65 72 69 65 73 46 72 6f 6d 41  ArithSeriesFromA
7290: 6e 79 20 2d 2d 0a 2b 20 2a 0a 2b 20 2a 20 09 54  ny --.+ *.+ * .T
72a0: 68 65 20 41 72 69 74 68 6d 65 74 69 63 20 53 65  he Arithmetic Se
72b0: 72 69 65 73 20 6f 62 6a 65 63 74 20 69 73 20 6a  ries object is j
72c0: 75 73 74 20 61 6e 20 77 61 79 20 74 6f 20 6f 70  ust an way to op
72d0: 74 69 6d 69 7a 65 0a 2b 20 2a 20 09 4c 69 73 74  timize.+ * .List
72e0: 73 20 73 70 61 63 65 20 63 6f 6d 70 6c 65 78 69  s space complexi
72f0: 74 79 2c 20 73 6f 20 6e 6f 20 6f 6e 65 20 73 68  ty, so no one sh
7300: 6f 75 6c 64 20 74 72 79 20 74 6f 20 63 6f 6e 76  ould try to conv
7310: 65 72 74 0a 2b 20 2a 20 09 61 20 73 74 72 69 6e  ert.+ * .a strin
7320: 67 20 74 6f 20 61 6e 20 41 72 69 74 68 6d 65 74  g to an Arithmet
7330: 69 63 20 53 65 72 69 65 73 20 6f 62 6a 65 63 74  ic Series object
7340: 2e 0a 2b 20 2a 0a 2b 20 2a 20 09 54 68 69 73 20  ..+ *.+ * .This 
7350: 66 75 6e 63 74 69 6f 6e 20 69 73 20 68 65 72 65  function is here
7360: 20 6a 75 73 74 20 74 6f 20 70 6f 70 75 6c 61 74   just to populat
7370: 65 20 74 68 65 20 54 79 70 65 20 73 74 72 75 63  e the Type struc
7380: 74 75 72 65 2e 0a 2b 20 2a 0a 2b 20 2a 20 52 65  ture..+ *.+ * Re
7390: 73 75 6c 74 73 3a 0a 2b 20 2a 0a 2b 20 2a 20 09  sults:.+ *.+ * .
73a0: 54 68 65 20 72 65 73 75 6c 74 20 69 73 20 61 6c  The result is al
73b0: 77 61 79 73 20 54 43 4c 5f 45 52 52 4f 52 2e 20  ways TCL_ERROR. 
73c0: 42 75 74 20 73 65 65 20 53 69 64 65 20 45 66 66  But see Side Eff
73d0: 65 63 74 73 2e 0a 2b 20 2a 0a 2b 20 2a 20 53 69  ects..+ *.+ * Si
73e0: 64 65 20 65 66 66 65 63 74 73 3a 0a 2b 20 2a 0a  de effects:.+ *.
73f0: 2b 20 2a 20 09 54 63 6c 20 50 61 6e 69 63 20 69  + * .Tcl Panic i
7400: 66 20 63 61 6c 6c 65 64 2e 0a 2b 20 2a 0a 2b 20  f called..+ *.+ 
7410: 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  *---------------
7420: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
7430: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
7440: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
7450: 2d 2d 2d 2d 2d 2d 2d 0a 2b 20 2a 2f 0a 2b 0a 2b  -------.+ */.+.+
7460: 73 74 61 74 69 63 20 69 6e 74 0a 2b 53 65 74 41  static int.+SetA
7470: 72 69 74 68 53 65 72 69 65 73 46 72 6f 6d 41 6e  rithSeriesFromAn
7480: 79 28 69 6e 74 65 72 70 2c 20 6f 62 6a 50 74 72  y(interp, objPtr
7490: 29 0a 2b 20 20 20 20 54 63 6c 5f 49 6e 74 65 72  ).+    Tcl_Inter
74a0: 70 20 2a 69 6e 74 65 72 70 3b 09 09 2f 2a 20 55  p *interp;../* U
74b0: 73 65 64 20 66 6f 72 20 65 72 72 6f 72 20 72 65  sed for error re
74c0: 70 6f 72 74 69 6e 67 20 69 66 20 6e 6f 74 20 4e  porting if not N
74d0: 55 4c 4c 2e 20 2a 2f 0a 2b 20 20 20 20 54 63 6c  ULL. */.+    Tcl
74e0: 5f 4f 62 6a 20 2a 6f 62 6a 50 74 72 3b 09 09 2f  _Obj *objPtr;../
74f0: 2a 20 54 68 65 20 6f 62 6a 65 63 74 20 74 6f 20  * The object to 
7500: 63 6f 6e 76 65 72 74 2e 20 2a 2f 0a 2b 7b 0a 2b  convert. */.+{.+
7510: 20 20 20 20 54 63 6c 5f 50 61 6e 69 63 28 22 53      Tcl_Panic("S
7520: 65 74 41 72 69 74 68 53 65 72 69 65 73 46 72 6f  etArithSeriesFro
7530: 6d 41 6e 79 3a 20 73 68 6f 75 6c 64 20 6e 65 76  mAny: should nev
7540: 65 72 20 62 65 20 63 61 6c 6c 65 64 22 29 3b 0a  er be called");.
7550: 2b 20 20 20 20 72 65 74 75 72 6e 20 54 43 4c 5f  +    return TCL_
7560: 45 52 52 4f 52 3b 0a 2b 7d 0a 49 6e 64 65 78 3a  ERROR;.+}.Index:
7570: 20 67 65 6e 65 72 69 63 2f 74 63 6c 53 74 75 62   generic/tclStub
7580: 49 6e 69 74 2e 63 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d  Init.c.=========
7590: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
75a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
75b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
75c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 52 43 53 20 66  ==========.RCS f
75d0: 69 6c 65 3a 20 2f 63 76 73 72 6f 6f 74 2f 74 63  ile: /cvsroot/tc
75e0: 6c 2f 74 63 6c 2f 67 65 6e 65 72 69 63 2f 74 63  l/tcl/generic/tc
75f0: 6c 53 74 75 62 49 6e 69 74 2e 63 2c 76 0a 72 65  lStubInit.c,v.re
7600: 74 72 69 65 76 69 6e 67 20 72 65 76 69 73 69 6f  trieving revisio
7610: 6e 20 31 2e 31 30 35 0a 64 69 66 66 20 2d 75 20  n 1.105.diff -u 
7620: 2d 72 31 2e 31 30 35 20 74 63 6c 53 74 75 62 49  -r1.105 tclStubI
7630: 6e 69 74 2e 63 0a 2d 2d 2d 20 67 65 6e 65 72 69  nit.c.--- generi
7640: 63 2f 74 63 6c 53 74 75 62 49 6e 69 74 2e 63 09  c/tclStubInit.c.
7650: 31 34 20 4f 63 74 20 32 30 30 34 20 31 35 3a 30  14 Oct 2004 15:0
7660: 36 3a 30 33 20 2d 30 30 30 30 09 31 2e 31 30 35  6:03 -0000.1.105
7670: 0a 2b 2b 2b 20 67 65 6e 65 72 69 63 2f 74 63 6c  .+++ generic/tcl
7680: 53 74 75 62 49 6e 69 74 2e 63 09 32 35 20 4f 63  StubInit.c.25 Oc
7690: 74 20 32 30 30 34 20 30 36 3a 33 38 3a 32 39 20  t 2004 06:38:29 
76a0: 2d 30 30 30 30 0a 40 40 20 2d 39 33 32 2c 36 20  -0000.@@ -932,6 
76b0: 2b 39 33 32 2c 39 20 40 40 0a 20 20 20 20 20 54  +932,9 @@.     T
76c0: 63 6c 5f 4c 69 6d 69 74 47 65 74 43 6f 6d 6d 61  cl_LimitGetComma
76d0: 6e 64 73 2c 20 2f 2a 20 35 33 32 20 2a 2f 0a 20  nds, /* 532 */. 
76e0: 20 20 20 20 54 63 6c 5f 4c 69 6d 69 74 47 65 74      Tcl_LimitGet
76f0: 54 69 6d 65 2c 20 2f 2a 20 35 33 33 20 2a 2f 0a  Time, /* 533 */.
7700: 20 20 20 20 20 54 63 6c 5f 4c 69 6d 69 74 47 65       Tcl_LimitGe
7710: 74 47 72 61 6e 75 6c 61 72 69 74 79 2c 20 2f 2a  tGranularity, /*
7720: 20 35 33 34 20 2a 2f 0a 2b 20 20 20 20 54 63 6c   534 */.+    Tcl
7730: 5f 4e 65 77 41 72 69 74 68 53 65 72 69 65 73 4f  _NewArithSeriesO
7740: 62 6a 2c 20 2f 2a 20 35 33 35 20 2a 2f 0a 2b 20  bj, /* 535 */.+ 
7750: 20 20 20 54 63 6c 5f 41 72 69 74 68 53 65 72 69     Tcl_ArithSeri
7760: 65 73 4f 62 6a 49 6e 64 65 78 2c 20 2f 2a 20 35  esObjIndex, /* 5
7770: 33 36 20 2a 2f 0a 2b 20 20 20 20 54 63 6c 5f 41  36 */.+    Tcl_A
7780: 72 69 74 68 53 65 72 69 65 73 4f 62 6a 4c 65 6e  rithSeriesObjLen
7790: 67 74 68 2c 20 2f 2a 20 35 33 37 20 2a 2f 0a 20  gth, /* 537 */. 
77a0: 7d 3b 0a 20 0a 20 2f 2a 20 21 45 4e 44 21 3a 20  };. . /* !END!: 
77b0: 44 6f 20 6e 6f 74 20 65 64 69 74 20 61 62 6f 76  Do not edit abov
77c0: 65 20 74 68 69 73 20 6c 69 6e 65 2e 20 2a 2f 0a  e this line. */.