Tcl Source Code

Hex Artifact Content
Login

Artifact 5e4157c232b0f885b40eba79d57fb4daa4ac0b4b:

Attachment "range3.patch" to ticket [1052584fff] added by antirez 2004-10-24 16:34:19.
0000: 3f 20 66 6f 6f 2e 70 73 0a 3f 20 75 6e 69 78 2f  ? foo.ps.? unix/
0010: 64 6c 74 65 73 74 2e 6d 61 72 6b 65 72 0a 49 6e  dltest.marker.In
0020: 64 65 78 3a 20 67 65 6e 65 72 69 63 2f 74 63 6c  dex: generic/tcl
0030: 2e 64 65 63 6c 73 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d  .decls.=========
0040: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0050: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0060: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0070: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 52 43 53 20 66  ==========.RCS f
0080: 69 6c 65 3a 20 2f 63 76 73 72 6f 6f 74 2f 74 63  ile: /cvsroot/tc
0090: 6c 2f 74 63 6c 2f 67 65 6e 65 72 69 63 2f 74 63  l/tcl/generic/tc
00a0: 6c 2e 64 65 63 6c 73 2c 76 0a 72 65 74 72 69 65  l.decls,v.retrie
00b0: 76 69 6e 67 20 72 65 76 69 73 69 6f 6e 20 31 2e  ving revision 1.
00c0: 31 30 34 0a 64 69 66 66 20 2d 75 20 2d 72 31 2e  104.diff -u -r1.
00d0: 31 30 34 20 74 63 6c 2e 64 65 63 6c 73 0a 2d 2d  104 tcl.decls.--
00e0: 2d 20 67 65 6e 65 72 69 63 2f 74 63 6c 2e 64 65  - generic/tcl.de
00f0: 63 6c 73 09 31 33 20 4d 61 79 20 32 30 30 34 20  cls.13 May 2004 
0100: 31 32 3a 35 39 3a 32 30 20 2d 30 30 30 30 09 31  12:59:20 -0000.1
0110: 2e 31 30 34 0a 2b 2b 2b 20 67 65 6e 65 72 69 63  .104.+++ generic
0120: 2f 74 63 6c 2e 64 65 63 6c 73 09 32 34 20 4f 63  /tcl.decls.24 Oc
0130: 74 20 32 30 30 34 20 30 39 3a 33 31 3a 31 38 20  t 2004 09:31:18 
0140: 2d 30 30 30 30 0a 40 40 20 2d 31 39 30 39 2c 36  -0000.@@ -1909,6
0150: 20 2b 31 39 30 39 2c 31 37 20 40 40 0a 20 64 65   +1909,17 @@. de
0160: 63 6c 61 72 65 20 35 33 34 20 67 65 6e 65 72 69  clare 534 generi
0170: 63 20 7b 0a 20 20 20 20 20 69 6e 74 20 54 63 6c  c {.     int Tcl
0180: 5f 4c 69 6d 69 74 47 65 74 47 72 61 6e 75 6c 61  _LimitGetGranula
0190: 72 69 74 79 28 54 63 6c 5f 49 6e 74 65 72 70 20  rity(Tcl_Interp 
01a0: 2a 69 6e 74 65 72 70 2c 20 69 6e 74 20 74 79 70  *interp, int typ
01b0: 65 29 0a 20 7d 0a 2b 64 65 63 6c 61 72 65 20 35  e). }.+declare 5
01c0: 33 35 20 67 65 6e 65 72 69 63 20 7b 0a 2b 20 20  35 generic {.+  
01d0: 20 20 54 63 6c 5f 4f 62 6a 20 2a 20 54 63 6c 5f    Tcl_Obj * Tcl_
01e0: 4e 65 77 41 72 69 74 68 53 65 72 69 65 73 4f 62  NewArithSeriesOb
01f0: 6a 28 54 63 6c 5f 57 69 64 65 49 6e 74 20 73 74  j(Tcl_WideInt st
0200: 61 72 74 2c 0a 2b 09 20 20 20 20 54 63 6c 5f 57  art,.+.    Tcl_W
0210: 69 64 65 49 6e 74 20 65 6e 64 2c 20 54 63 6c 5f  ideInt end, Tcl_
0220: 57 69 64 65 49 6e 74 20 73 74 65 70 29 0a 2b 7d  WideInt step).+}
0230: 0a 2b 64 65 63 6c 61 72 65 20 35 33 36 20 67 65  .+declare 536 ge
0240: 6e 65 72 69 63 20 7b 0a 2b 20 20 20 20 69 6e 74  neric {.+    int
0250: 20 54 63 6c 5f 41 72 69 74 68 53 65 72 69 65 73   Tcl_ArithSeries
0260: 4f 62 6a 49 6e 64 65 78 28 54 63 6c 5f 4f 62 6a  ObjIndex(Tcl_Obj
0270: 20 2a 61 72 69 74 68 53 65 72 69 65 73 50 74 72   *arithSeriesPtr
0280: 2c 20 54 63 6c 5f 57 69 64 65 49 6e 74 20 69 6e  , Tcl_WideInt in
0290: 64 65 78 2c 0a 2b 20 20 20 20 20 20 20 20 20 20  dex,.+          
02a0: 20 20 54 63 6c 5f 57 69 64 65 49 6e 74 20 2a 65    Tcl_WideInt *e
02b0: 6c 65 6d 65 6e 74 29 0a 2b 7d 0a 2b 64 65 63 6c  lement).+}.+decl
02c0: 61 72 65 20 35 33 37 20 67 65 6e 65 72 69 63 20  are 537 generic 
02d0: 7b 0a 2b 20 20 20 20 54 63 6c 5f 57 69 64 65 49  {.+    Tcl_WideI
02e0: 6e 74 20 54 63 6c 5f 41 72 69 74 68 53 65 72 69  nt Tcl_ArithSeri
02f0: 65 73 4f 62 6a 4c 65 6e 67 74 68 28 54 63 6c 5f  esObjLength(Tcl_
0300: 4f 62 6a 20 2a 61 72 69 74 68 53 65 72 69 65 73  Obj *arithSeries
0310: 50 74 72 29 0a 2b 7d 0a 20 0a 20 23 23 23 23 23  Ptr).+}. . #####
0320: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23  ################
0330: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23  ################
0340: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23  ################
0350: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23  ################
0360: 23 23 23 23 23 23 23 23 23 0a 20 0a 49 6e 64 65  #########. .Inde
0370: 78 3a 20 67 65 6e 65 72 69 63 2f 74 63 6c 42 61  x: generic/tclBa
0380: 73 69 63 2e 63 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  sic.c.==========
0390: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
03a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
03b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
03c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 52 43 53 20 66 69  =========.RCS fi
03d0: 6c 65 3a 20 2f 63 76 73 72 6f 6f 74 2f 74 63 6c  le: /cvsroot/tcl
03e0: 2f 74 63 6c 2f 67 65 6e 65 72 69 63 2f 74 63 6c  /tcl/generic/tcl
03f0: 42 61 73 69 63 2e 63 2c 76 0a 72 65 74 72 69 65  Basic.c,v.retrie
0400: 76 69 6e 67 20 72 65 76 69 73 69 6f 6e 20 31 2e  ving revision 1.
0410: 31 33 32 0a 64 69 66 66 20 2d 75 20 2d 72 31 2e  132.diff -u -r1.
0420: 31 33 32 20 74 63 6c 42 61 73 69 63 2e 63 0a 2d  132 tclBasic.c.-
0430: 2d 2d 20 67 65 6e 65 72 69 63 2f 74 63 6c 42 61  -- generic/tclBa
0440: 73 69 63 2e 63 09 32 31 20 4f 63 74 20 32 30 30  sic.c.21 Oct 200
0450: 34 20 31 37 3a 30 37 3a 33 31 20 2d 30 30 30 30  4 17:07:31 -0000
0460: 09 31 2e 31 33 32 0a 2b 2b 2b 20 67 65 6e 65 72  .1.132.+++ gener
0470: 69 63 2f 74 63 6c 42 61 73 69 63 2e 63 09 32 34  ic/tclBasic.c.24
0480: 20 4f 63 74 20 32 30 30 34 20 30 39 3a 33 31 3a   Oct 2004 09:31:
0490: 32 35 20 2d 30 30 30 30 0a 40 40 20 2d 39 34 2c  25 -0000.@@ -94,
04a0: 36 20 2b 39 34 2c 37 20 40 40 0a 20 20 20 20 20  6 +94,7 @@.     
04b0: 7b 22 6e 61 6d 65 73 70 61 63 65 22 2c 09 54 63  {"namespace",.Tc
04c0: 6c 5f 4e 61 6d 65 73 70 61 63 65 4f 62 6a 43 6d  l_NamespaceObjCm
04d0: 64 2c 09 28 43 6f 6d 70 69 6c 65 50 72 6f 63 20  d,.(CompileProc 
04e0: 2a 29 20 4e 55 4c 4c 2c 09 31 7d 2c 0a 20 20 20  *) NULL,.1},.   
04f0: 20 20 7b 22 70 61 63 6b 61 67 65 22 2c 09 09 54    {"package",..T
0500: 63 6c 5f 50 61 63 6b 61 67 65 4f 62 6a 43 6d 64  cl_PackageObjCmd
0510: 2c 09 28 43 6f 6d 70 69 6c 65 50 72 6f 63 20 2a  ,.(CompileProc *
0520: 29 20 4e 55 4c 4c 2c 09 31 7d 2c 0a 20 20 20 20  ) NULL,.1},.    
0530: 20 7b 22 70 72 6f 63 22 2c 09 09 54 63 6c 5f 50   {"proc",..Tcl_P
0540: 72 6f 63 4f 62 6a 43 6d 64 2c 09 09 28 43 6f 6d  rocObjCmd,..(Com
0550: 70 69 6c 65 50 72 6f 63 20 2a 29 20 4e 55 4c 4c  pileProc *) NULL
0560: 2c 09 31 7d 2c 0a 2b 20 20 20 20 7b 22 72 61 6e  ,.1},.+    {"ran
0570: 67 65 22 2c 09 09 54 63 6c 5f 52 61 6e 67 65 4f  ge",..Tcl_RangeO
0580: 62 6a 43 6d 64 2c 09 28 43 6f 6d 70 69 6c 65 50  bjCmd,.(CompileP
0590: 72 6f 63 20 2a 29 20 4e 55 4c 4c 2c 09 31 7d 2c  roc *) NULL,.1},
05a0: 0a 20 20 20 20 20 7b 22 72 65 67 65 78 70 22 2c  .     {"regexp",
05b0: 09 09 54 63 6c 5f 52 65 67 65 78 70 4f 62 6a 43  ..Tcl_RegexpObjC
05c0: 6d 64 2c 09 54 63 6c 43 6f 6d 70 69 6c 65 52 65  md,.TclCompileRe
05d0: 67 65 78 70 43 6d 64 2c 09 31 7d 2c 0a 20 20 20  gexpCmd,.1},.   
05e0: 20 20 7b 22 72 65 67 73 75 62 22 2c 09 09 54 63    {"regsub",..Tc
05f0: 6c 5f 52 65 67 73 75 62 4f 62 6a 43 6d 64 2c 09  l_RegsubObjCmd,.
0600: 28 43 6f 6d 70 69 6c 65 50 72 6f 63 20 2a 29 20  (CompileProc *) 
0610: 4e 55 4c 4c 2c 09 31 7d 2c 0a 20 20 20 20 20 7b  NULL,.1},.     {
0620: 22 72 65 6e 61 6d 65 22 2c 09 09 54 63 6c 5f 52  "rename",..Tcl_R
0630: 65 6e 61 6d 65 4f 62 6a 43 6d 64 2c 09 28 43 6f  enameObjCmd,.(Co
0640: 6d 70 69 6c 65 50 72 6f 63 20 2a 29 20 4e 55 4c  mpileProc *) NUL
0650: 4c 2c 09 31 7d 2c 0a 49 6e 64 65 78 3a 20 67 65  L,.1},.Index: ge
0660: 6e 65 72 69 63 2f 74 63 6c 43 6d 64 41 48 2e 63  neric/tclCmdAH.c
0670: 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  .===============
0680: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0690: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
06a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
06b0: 3d 3d 3d 3d 0a 52 43 53 20 66 69 6c 65 3a 20 2f  ====.RCS file: /
06c0: 63 76 73 72 6f 6f 74 2f 74 63 6c 2f 74 63 6c 2f  cvsroot/tcl/tcl/
06d0: 67 65 6e 65 72 69 63 2f 74 63 6c 43 6d 64 41 48  generic/tclCmdAH
06e0: 2e 63 2c 76 0a 72 65 74 72 69 65 76 69 6e 67 20  .c,v.retrieving 
06f0: 72 65 76 69 73 69 6f 6e 20 31 2e 35 36 0a 64 69  revision 1.56.di
0700: 66 66 20 2d 75 20 2d 72 31 2e 35 36 20 74 63 6c  ff -u -r1.56 tcl
0710: 43 6d 64 41 48 2e 63 0a 2d 2d 2d 20 67 65 6e 65  CmdAH.c.--- gene
0720: 72 69 63 2f 74 63 6c 43 6d 64 41 48 2e 63 09 32  ric/tclCmdAH.c.2
0730: 31 20 4f 63 74 20 32 30 30 34 20 31 35 3a 31 39  1 Oct 2004 15:19
0740: 3a 34 36 20 2d 30 30 30 30 09 31 2e 35 36 0a 2b  :46 -0000.1.56.+
0750: 2b 2b 20 67 65 6e 65 72 69 63 2f 74 63 6c 43 6d  ++ generic/tclCm
0760: 64 41 48 2e 63 09 32 34 20 4f 63 74 20 32 30 30  dAH.c.24 Oct 200
0770: 34 20 30 39 3a 33 31 3a 32 39 20 2d 30 30 30 30  4 09:31:29 -0000
0780: 0a 40 40 20 2d 31 37 36 37 2c 31 30 20 2b 31 37  .@@ -1767,10 +17
0790: 36 37 2c 31 34 20 40 40 0a 20 09 20 20 20 20 67  67,14 @@. .    g
07a0: 6f 74 6f 20 64 6f 6e 65 3b 0a 20 09 7d 0a 20 0a  oto done;. .}. .
07b0: 2d 09 72 65 73 75 6c 74 20 3d 20 54 63 6c 5f 4c  -.result = Tcl_L
07c0: 69 73 74 4f 62 6a 47 65 74 45 6c 65 6d 65 6e 74  istObjGetElement
07d0: 73 28 69 6e 74 65 72 70 2c 20 61 72 67 4f 62 6a  s(interp, argObj
07e0: 76 5b 32 2b 69 2a 32 5d 2c 0a 2d 09 20 20 20 20  v[2+i*2],.-.    
07f0: 20 20 20 20 26 61 72 67 63 4c 69 73 74 5b 69 5d      &argcList[i]
0800: 2c 20 26 61 72 67 76 4c 69 73 74 5b 69 5d 29 3b  , &argvList[i]);
0810: 0a 2d 09 69 66 20 28 72 65 73 75 6c 74 20 21 3d  .-.if (result !=
0820: 20 54 43 4c 5f 4f 4b 29 20 7b 0a 2d 09 20 20 20   TCL_OK) {.-.   
0830: 20 67 6f 74 6f 20 64 6f 6e 65 3b 0a 2b 09 69 66   goto done;.+.if
0840: 20 28 61 72 67 4f 62 6a 76 5b 32 2b 69 2a 32 5d   (argObjv[2+i*2]
0850: 2d 3e 74 79 70 65 50 74 72 20 21 3d 20 26 74 63  ->typePtr != &tc
0860: 6c 41 72 69 74 68 53 65 72 69 65 73 54 79 70 65  lArithSeriesType
0870: 29 20 7b 0a 2b 09 20 20 20 20 72 65 73 75 6c 74  ) {.+.    result
0880: 20 3d 20 54 63 6c 5f 4c 69 73 74 4f 62 6a 47 65   = Tcl_ListObjGe
0890: 74 45 6c 65 6d 65 6e 74 73 28 69 6e 74 65 72 70  tElements(interp
08a0: 2c 20 61 72 67 4f 62 6a 76 5b 32 2b 69 2a 32 5d  , argObjv[2+i*2]
08b0: 2c 0a 2b 09 09 09 26 61 72 67 63 4c 69 73 74 5b  ,.+...&argcList[
08c0: 69 5d 2c 20 26 61 72 67 76 4c 69 73 74 5b 69 5d  i], &argvList[i]
08d0: 29 3b 0a 2b 09 20 20 20 20 69 66 20 28 72 65 73  );.+.    if (res
08e0: 75 6c 74 20 21 3d 20 54 43 4c 5f 4f 4b 29 20 7b  ult != TCL_OK) {
08f0: 0a 2b 09 20 20 20 20 20 20 20 20 67 6f 74 6f 20  .+.        goto 
0900: 64 6f 6e 65 3b 0a 2b 09 20 20 20 20 7d 0a 2b 09  done;.+.    }.+.
0910: 7d 20 65 6c 73 65 20 7b 0a 2b 09 20 20 20 20 61  } else {.+.    a
0920: 72 67 63 4c 69 73 74 5b 69 5d 20 3d 20 28 69 6e  rgcList[i] = (in
0930: 74 29 20 54 63 6c 5f 41 72 69 74 68 53 65 72 69  t) Tcl_ArithSeri
0940: 65 73 4f 62 6a 4c 65 6e 67 74 68 28 61 72 67 4f  esObjLength(argO
0950: 62 6a 76 5b 32 2b 69 2a 32 5d 29 3b 0a 20 09 7d  bjv[2+i*2]);. .}
0960: 0a 20 0a 20 09 6a 20 3d 20 61 72 67 63 4c 69 73  . . .j = argcLis
0970: 74 5b 69 5d 20 2f 20 76 61 72 63 4c 69 73 74 5b  t[i] / varcList[
0980: 69 5d 3b 0a 40 40 20 2d 31 38 30 34 2c 31 30 20  i];.@@ -1804,10 
0990: 2b 31 38 30 38 2c 31 34 20 40 40 0a 20 09 20 20  +1808,14 @@. .  
09a0: 20 20 69 66 20 28 72 65 73 75 6c 74 20 21 3d 20    if (result != 
09b0: 54 43 4c 5f 4f 4b 29 20 7b 0a 20 09 09 54 63 6c  TCL_OK) {. ..Tcl
09c0: 5f 50 61 6e 69 63 28 22 54 63 6c 5f 46 6f 72 65  _Panic("Tcl_Fore
09d0: 61 63 68 4f 62 6a 43 6d 64 3a 20 63 6f 75 6c 64  achObjCmd: could
09e0: 20 6e 6f 74 20 72 65 63 6f 6e 76 65 72 74 20 76   not reconvert v
09f0: 61 72 69 61 62 6c 65 20 6c 69 73 74 20 25 64 20  ariable list %d 
0a00: 74 6f 20 61 20 6c 69 73 74 20 6f 62 6a 65 63 74  to a list object
0a10: 5c 6e 22 2c 20 69 29 3b 0a 20 09 20 20 20 20 7d  \n", i);. .    }
0a20: 0a 2d 09 20 20 20 20 72 65 73 75 6c 74 20 3d 20  .-.    result = 
0a30: 54 63 6c 5f 4c 69 73 74 4f 62 6a 47 65 74 45 6c  Tcl_ListObjGetEl
0a40: 65 6d 65 6e 74 73 28 69 6e 74 65 72 70 2c 20 61  ements(interp, a
0a50: 72 67 4f 62 6a 76 5b 32 2b 69 2a 32 5d 2c 0a 2d  rgObjv[2+i*2],.-
0a60: 09 09 20 20 20 20 26 61 72 67 63 4c 69 73 74 5b  ..    &argcList[
0a70: 69 5d 2c 20 26 61 72 67 76 4c 69 73 74 5b 69 5d  i], &argvList[i]
0a80: 29 3b 0a 2d 09 20 20 20 20 69 66 20 28 72 65 73  );.-.    if (res
0a90: 75 6c 74 20 21 3d 20 54 43 4c 5f 4f 4b 29 20 7b  ult != TCL_OK) {
0aa0: 0a 2d 09 09 54 63 6c 5f 50 61 6e 69 63 28 22 54  .-..Tcl_Panic("T
0ab0: 63 6c 5f 46 6f 72 65 61 63 68 4f 62 6a 43 6d 64  cl_ForeachObjCmd
0ac0: 3a 20 63 6f 75 6c 64 20 6e 6f 74 20 72 65 63 6f  : could not reco
0ad0: 6e 76 65 72 74 20 76 61 6c 75 65 20 6c 69 73 74  nvert value list
0ae0: 20 25 64 20 74 6f 20 61 20 6c 69 73 74 20 6f 62   %d to a list ob
0af0: 6a 65 63 74 5c 6e 22 2c 20 69 29 3b 0a 2b 09 20  ject\n", i);.+. 
0b00: 20 20 20 69 66 20 28 61 72 67 4f 62 6a 76 5b 32     if (argObjv[2
0b10: 2b 69 2a 32 5d 2d 3e 74 79 70 65 50 74 72 20 21  +i*2]->typePtr !
0b20: 3d 20 26 74 63 6c 41 72 69 74 68 53 65 72 69 65  = &tclArithSerie
0b30: 73 54 79 70 65 29 20 7b 0a 2b 09 20 20 20 20 20  sType) {.+.     
0b40: 20 20 20 72 65 73 75 6c 74 20 3d 20 54 63 6c 5f     result = Tcl_
0b50: 4c 69 73 74 4f 62 6a 47 65 74 45 6c 65 6d 65 6e  ListObjGetElemen
0b60: 74 73 28 69 6e 74 65 72 70 2c 20 61 72 67 4f 62  ts(interp, argOb
0b70: 6a 76 5b 32 2b 69 2a 32 5d 2c 0a 2b 09 09 20 20  jv[2+i*2],.+..  
0b80: 20 20 20 20 20 20 26 61 72 67 63 4c 69 73 74 5b        &argcList[
0b90: 69 5d 2c 20 26 61 72 67 76 4c 69 73 74 5b 69 5d  i], &argvList[i]
0ba0: 29 3b 0a 2b 09 20 20 20 20 20 20 20 20 69 66 20  );.+.        if 
0bb0: 28 72 65 73 75 6c 74 20 21 3d 20 54 43 4c 5f 4f  (result != TCL_O
0bc0: 4b 29 20 7b 0a 2b 09 09 20 20 20 20 54 63 6c 5f  K) {.+..    Tcl_
0bd0: 50 61 6e 69 63 28 22 54 63 6c 5f 46 6f 72 65 61  Panic("Tcl_Forea
0be0: 63 68 4f 62 6a 43 6d 64 3a 20 63 6f 75 6c 64 20  chObjCmd: could 
0bf0: 6e 6f 74 20 72 65 63 6f 6e 76 65 72 74 20 76 61  not reconvert va
0c00: 6c 75 65 20 6c 69 73 74 20 25 64 20 74 6f 20 61  lue list %d to a
0c10: 20 6c 69 73 74 20 6f 62 6a 65 63 74 5c 6e 22 2c   list object\n",
0c20: 20 69 29 3b 0a 2b 09 20 20 20 20 20 20 20 20 7d   i);.+.        }
0c30: 0a 2b 09 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a  .+.    } else {.
0c40: 2b 09 09 61 72 67 63 4c 69 73 74 5b 69 5d 20 3d  +..argcList[i] =
0c50: 20 28 69 6e 74 29 20 54 63 6c 5f 41 72 69 74 68   (int) Tcl_Arith
0c60: 53 65 72 69 65 73 4f 62 6a 4c 65 6e 67 74 68 28  SeriesObjLength(
0c70: 61 72 67 4f 62 6a 76 5b 32 2b 69 2a 32 5d 29 3b  argObjv[2+i*2]);
0c80: 0a 20 09 20 20 20 20 7d 0a 20 0a 20 09 20 20 20  . .    }. . .   
0c90: 20 66 6f 72 20 28 76 20 3d 20 30 3b 20 20 76 20   for (v = 0;  v 
0ca0: 3c 20 76 61 72 63 4c 69 73 74 5b 69 5d 3b 20 20  < varcList[i];  
0cb0: 76 2b 2b 29 20 7b 0a 40 40 20 2d 31 38 31 36 2c  v++) {.@@ -1816,
0cc0: 37 20 2b 31 38 32 34 2c 31 34 20 40 40 0a 20 09  7 +1824,14 @@. .
0cd0: 09 69 6e 74 20 69 73 45 6d 70 74 79 4f 62 6a 20  .int isEmptyObj 
0ce0: 3d 20 30 3b 0a 20 0a 20 09 09 69 66 20 28 6b 20  = 0;. . ..if (k 
0cf0: 3c 20 61 72 67 63 4c 69 73 74 5b 69 5d 29 20 7b  < argcList[i]) {
0d00: 0a 2d 09 09 20 20 20 20 76 61 6c 75 65 50 74 72  .-..    valuePtr
0d10: 20 3d 20 61 72 67 76 4c 69 73 74 5b 69 5d 5b 6b   = argvList[i][k
0d20: 5d 3b 0a 2b 09 09 20 20 20 20 69 66 20 28 61 72  ];.+..    if (ar
0d30: 67 4f 62 6a 76 5b 32 2b 69 2a 32 5d 2d 3e 74 79  gObjv[2+i*2]->ty
0d40: 70 65 50 74 72 20 21 3d 20 26 74 63 6c 41 72 69  pePtr != &tclAri
0d50: 74 68 53 65 72 69 65 73 54 79 70 65 29 20 7b 0a  thSeriesType) {.
0d60: 2b 09 09 20 20 20 20 09 76 61 6c 75 65 50 74 72  +..    .valuePtr
0d70: 20 3d 20 61 72 67 76 4c 69 73 74 5b 69 5d 5b 6b   = argvList[i][k
0d80: 5d 3b 0a 2b 09 09 20 20 20 20 7d 20 65 6c 73 65  ];.+..    } else
0d90: 20 7b 0a 2b 09 09 09 41 72 69 74 68 53 65 72 69   {.+...ArithSeri
0da0: 65 73 20 2a 61 72 69 74 68 53 65 72 69 65 73 52  es *arithSeriesR
0db0: 65 70 50 74 72 20 3d 0a 2b 09 09 09 09 61 72 67  epPtr =.+....arg
0dc0: 4f 62 6a 76 5b 32 2b 69 2a 32 5d 2d 3e 69 6e 74  Objv[2+i*2]->int
0dd0: 65 72 6e 61 6c 52 65 70 2e 74 77 6f 50 74 72 56  ernalRep.twoPtrV
0de0: 61 6c 75 65 2e 70 74 72 31 3b 0a 2b 09 09 09 76  alue.ptr1;.+...v
0df0: 61 6c 75 65 50 74 72 20 3d 20 54 63 6c 5f 4e 65  aluePtr = Tcl_Ne
0e00: 77 57 69 64 65 49 6e 74 4f 62 6a 28 61 72 69 74  wWideIntObj(arit
0e10: 68 53 65 72 69 65 73 52 65 70 50 74 72 2d 3e 73  hSeriesRepPtr->s
0e20: 74 61 72 74 2b 0a 2b 09 09 09 09 09 28 6b 2a 61  tart+.+.....(k*a
0e30: 72 69 74 68 53 65 72 69 65 73 52 65 70 50 74 72  rithSeriesRepPtr
0e40: 2d 3e 73 74 65 70 29 29 3b 0a 2b 09 09 20 20 20  ->step));.+..   
0e50: 20 7d 0a 20 09 09 7d 20 65 6c 73 65 20 7b 0a 20   }. ..} else {. 
0e60: 09 09 20 20 20 20 76 61 6c 75 65 50 74 72 20 3d  ..    valuePtr =
0e70: 20 54 63 6c 5f 4e 65 77 4f 62 6a 28 29 3b 20 2f   Tcl_NewObj(); /
0e80: 2a 20 65 6d 70 74 79 20 73 74 72 69 6e 67 20 2a  * empty string *
0e90: 2f 0a 20 09 09 20 20 20 20 69 73 45 6d 70 74 79  /. ..    isEmpty
0ea0: 4f 62 6a 20 3d 20 31 3b 0a 49 6e 64 65 78 3a 20  Obj = 1;.Index: 
0eb0: 67 65 6e 65 72 69 63 2f 74 63 6c 43 6d 64 49 4c  generic/tclCmdIL
0ec0: 2e 63 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  .c.=============
0ed0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0ee0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0ef0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0f00: 3d 3d 3d 3d 3d 3d 0a 52 43 53 20 66 69 6c 65 3a  ======.RCS file:
0f10: 20 2f 63 76 73 72 6f 6f 74 2f 74 63 6c 2f 74 63   /cvsroot/tcl/tc
0f20: 6c 2f 67 65 6e 65 72 69 63 2f 74 63 6c 43 6d 64  l/generic/tclCmd
0f30: 49 4c 2e 63 2c 76 0a 72 65 74 72 69 65 76 69 6e  IL.c,v.retrievin
0f40: 67 20 72 65 76 69 73 69 6f 6e 20 31 2e 36 36 0a  g revision 1.66.
0f50: 64 69 66 66 20 2d 75 20 2d 72 31 2e 36 36 20 74  diff -u -r1.66 t
0f60: 63 6c 43 6d 64 49 4c 2e 63 0a 2d 2d 2d 20 67 65  clCmdIL.c.--- ge
0f70: 6e 65 72 69 63 2f 74 63 6c 43 6d 64 49 4c 2e 63  neric/tclCmdIL.c
0f80: 09 31 34 20 4f 63 74 20 32 30 30 34 20 31 37 3a  .14 Oct 2004 17:
0f90: 32 30 3a 31 31 20 2d 30 30 30 30 09 31 2e 36 36  20:11 -0000.1.66
0fa0: 0a 2b 2b 2b 20 67 65 6e 65 72 69 63 2f 74 63 6c  .+++ generic/tcl
0fb0: 43 6d 64 49 4c 2e 63 09 32 34 20 4f 63 74 20 32  CmdIL.c.24 Oct 2
0fc0: 30 30 34 20 30 39 3a 33 31 3a 33 35 20 2d 30 30  004 09:31:35 -00
0fd0: 30 30 0a 40 40 20 2d 32 33 34 34 2c 36 20 2b 32  00.@@ -2344,6 +2
0fe0: 33 34 34 2c 33 31 20 40 40 0a 20 0a 20 20 20 20  344,31 @@. .    
0ff0: 20 69 66 20 28 61 72 67 50 74 72 2d 3e 74 79 70   if (argPtr->typ
1000: 65 50 74 72 20 21 3d 20 26 74 63 6c 4c 69 73 74  ePtr != &tclList
1010: 54 79 70 65 20 0a 20 09 20 20 20 20 26 26 20 54  Type . .    && T
1020: 63 6c 47 65 74 49 6e 74 46 6f 72 49 6e 64 65 78  clGetIntForIndex
1030: 28 4e 55 4c 4c 20 2c 20 61 72 67 50 74 72 2c 20  (NULL , argPtr, 
1040: 30 2c 20 26 69 6e 64 65 78 29 20 3d 3d 20 54 43  0, &index) == TC
1050: 4c 5f 4f 4b 29 20 7b 0a 2b 0a 2b 09 2f 2a 20 49  L_OK) {.+.+./* I
1060: 66 20 74 68 65 20 6c 69 73 74 20 69 73 20 61 6e  f the list is an
1070: 20 61 72 69 74 68 6d 65 74 69 63 20 73 65 72 69   arithmetic seri
1080: 65 73 20 72 65 74 75 72 6e 20 74 68 65 0a 2b 09  es return the.+.
1090: 20 2a 20 63 6f 6d 70 75 74 65 64 20 65 6c 65 6d   * computed elem
10a0: 65 6e 74 2e 20 2a 2f 0a 2b 20 20 20 20 20 20 20  ent. */.+       
10b0: 20 69 66 20 28 6c 69 73 74 50 74 72 2d 3e 74 79   if (listPtr->ty
10c0: 70 65 50 74 72 20 3d 3d 20 26 74 63 6c 41 72 69  pePtr == &tclAri
10d0: 74 68 53 65 72 69 65 73 54 79 70 65 29 20 7b 0a  thSeriesType) {.
10e0: 2b 09 20 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 77  +.    Tcl_Obj *w
10f0: 69 64 65 50 74 72 3b 0a 2b 09 20 20 20 20 54 63  idePtr;.+.    Tc
1100: 6c 5f 57 69 64 65 49 6e 74 20 77 69 64 65 56 61  l_WideInt wideVa
1110: 6c 2c 20 61 73 4c 65 6e 3b 0a 2b 0a 2b 09 20 20  l, asLen;.+.+.  
1120: 20 20 2f 2a 20 50 61 72 73 65 20 74 68 65 20 69    /* Parse the i
1130: 6e 64 65 78 20 2a 2f 0a 2b 09 20 20 20 20 61 73  ndex */.+.    as
1140: 4c 65 6e 20 3d 20 54 63 6c 5f 41 72 69 74 68 53  Len = Tcl_ArithS
1150: 65 72 69 65 73 4f 62 6a 4c 65 6e 67 74 68 28 6c  eriesObjLength(l
1160: 69 73 74 50 74 72 29 3b 0a 2b 09 20 20 20 20 72  istPtr);.+.    r
1170: 65 73 75 6c 74 20 3d 20 54 63 6c 47 65 74 49 6e  esult = TclGetIn
1180: 74 46 6f 72 49 6e 64 65 78 28 69 6e 74 65 72 70  tForIndex(interp
1190: 2c 20 61 72 67 50 74 72 2c 0a 2b 09 09 09 20 20  , argPtr,.+...  
11a0: 20 20 2f 2a 65 6e 64 56 61 6c 75 65 2a 2f 20 61    /*endValue*/ a
11b0: 73 4c 65 6e 2d 31 2c 20 26 69 6e 64 65 78 29 3b  sLen-1, &index);
11c0: 0a 2b 09 20 20 20 20 69 66 20 28 72 65 73 75 6c  .+.    if (resul
11d0: 74 20 21 3d 20 54 43 4c 5f 4f 4b 29 20 72 65 74  t != TCL_OK) ret
11e0: 75 72 6e 20 4e 55 4c 4c 3b 0a 2b 0a 2b 09 20 20  urn NULL;.+.+.  
11f0: 20 20 2f 2a 20 52 65 74 75 72 6e 20 74 68 65 20    /* Return the 
1200: 63 6f 6d 70 75 74 65 64 20 77 69 64 65 49 6e 74  computed wideInt
1210: 20 6f 62 6a 65 63 74 20 2a 2f 0a 2b 09 20 20 20   object */.+.   
1220: 20 69 66 20 28 54 63 6c 5f 41 72 69 74 68 53 65   if (Tcl_ArithSe
1230: 72 69 65 73 4f 62 6a 49 6e 64 65 78 28 6c 69 73  riesObjIndex(lis
1240: 74 50 74 72 2c 20 69 6e 64 65 78 2c 20 26 77 69  tPtr, index, &wi
1250: 64 65 56 61 6c 29 20 3d 3d 20 54 43 4c 5f 4f 4b  deVal) == TCL_OK
1260: 29 0a 2b 09 20 20 20 20 7b 0a 2b 09 20 20 20 20  ).+.    {.+.    
1270: 20 20 20 20 77 69 64 65 50 74 72 20 3d 20 54 63      widePtr = Tc
1280: 6c 5f 4e 65 77 57 69 64 65 49 6e 74 4f 62 6a 28  l_NewWideIntObj(
1290: 77 69 64 65 56 61 6c 29 3b 0a 2b 20 20 20 20 20  wideVal);.+     
12a0: 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a         } else {.
12b0: 2b 09 09 2f 2a 20 49 6e 64 65 78 20 6f 75 74 20  +../* Index out 
12c0: 6f 66 20 72 61 6e 67 65 20 63 61 73 65 20 2a 2f  of range case */
12d0: 0a 2b 09 09 77 69 64 65 50 74 72 20 3d 20 54 63  .+..widePtr = Tc
12e0: 6c 5f 4e 65 77 4f 62 6a 28 29 3b 0a 2b 09 20 20  l_NewObj();.+.  
12f0: 20 20 7d 0a 2b 09 20 20 20 20 54 63 6c 5f 49 6e    }.+.    Tcl_In
1300: 63 72 52 65 66 43 6f 75 6e 74 28 77 69 64 65 50  crRefCount(wideP
1310: 74 72 29 3b 0a 2b 09 20 20 20 20 72 65 74 75 72  tr);.+.    retur
1320: 6e 20 77 69 64 65 50 74 72 3b 0a 2b 09 7d 0a 2b  n widePtr;.+.}.+
1330: 0a 20 09 2f 2a 0a 20 09 20 2a 20 61 72 67 50 74  . ./*. . * argPt
1340: 72 20 64 65 73 69 67 6e 61 74 65 73 20 61 20 73  r designates a s
1350: 69 6e 67 6c 65 20 69 6e 64 65 78 2e 0a 20 09 20  ingle index.. . 
1360: 2a 2f 0a 40 40 20 2d 32 37 32 38 2c 36 20 2b 32  */.@@ -2728,6 +2
1370: 37 35 33 2c 31 31 20 40 40 0a 20 09 72 65 74 75  753,11 @@. .retu
1380: 72 6e 20 54 43 4c 5f 45 52 52 4f 52 3b 0a 20 20  rn TCL_ERROR;.  
1390: 20 20 20 7d 0a 20 0a 2b 20 20 20 20 69 66 20 28     }. .+    if (
13a0: 6f 62 6a 76 5b 31 5d 2d 3e 74 79 70 65 50 74 72  objv[1]->typePtr
13b0: 20 3d 3d 20 26 74 63 6c 41 72 69 74 68 53 65 72   == &tclArithSer
13c0: 69 65 73 54 79 70 65 29 20 7b 0a 2b 09 20 20 20  iesType) {.+.   
13d0: 20 54 63 6c 5f 53 65 74 4f 62 6a 52 65 73 75 6c   Tcl_SetObjResul
13e0: 74 28 69 6e 74 65 72 70 2c 0a 2b 09 09 54 63 6c  t(interp,.+..Tcl
13f0: 5f 4e 65 77 57 69 64 65 49 6e 74 4f 62 6a 28 54  _NewWideIntObj(T
1400: 63 6c 5f 41 72 69 74 68 53 65 72 69 65 73 4f 62  cl_ArithSeriesOb
1410: 6a 4c 65 6e 67 74 68 28 6f 62 6a 76 5b 31 5d 29  jLength(objv[1])
1420: 29 29 3b 0a 2b 09 20 20 20 20 72 65 74 75 72 6e  ));.+.    return
1430: 20 54 43 4c 5f 4f 4b 3b 0a 2b 20 20 20 20 7d 0a   TCL_OK;.+    }.
1440: 20 20 20 20 20 72 65 73 75 6c 74 20 3d 20 54 63       result = Tc
1450: 6c 5f 4c 69 73 74 4f 62 6a 4c 65 6e 67 74 68 28  l_ListObjLength(
1460: 69 6e 74 65 72 70 2c 20 6f 62 6a 76 5b 31 5d 2c  interp, objv[1],
1470: 20 26 6c 69 73 74 4c 65 6e 29 3b 0a 20 20 20 20   &listLen);.    
1480: 20 69 66 20 28 72 65 73 75 6c 74 20 21 3d 20 54   if (result != T
1490: 43 4c 5f 4f 4b 29 20 7b 0a 20 09 72 65 74 75 72  CL_OK) {. .retur
14a0: 6e 20 72 65 73 75 6c 74 3b 0a 40 40 20 2d 33 36  n result;.@@ -36
14b0: 34 37 2c 36 20 2b 33 36 37 37 2c 38 33 20 40 40  47,6 +3677,83 @@
14c0: 0a 20 20 20 20 20 72 65 74 75 72 6e 20 54 43 4c  .     return TCL
14d0: 5f 4f 4b 3b 0a 20 7d 0a 20 0c 0a 2b 0a 2b 2f 2a  _OK;. }. ..+.+/*
14e0: 0a 2b 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  .+ *------------
14f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1500: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1510: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1520: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 2b 20 2a 0a 2b  ----------.+ *.+
1530: 20 2a 20 54 63 6c 5f 52 61 6e 67 65 4f 62 6a 43   * Tcl_RangeObjC
1540: 6d 64 20 2d 2d 0a 2b 20 2a 0a 2b 20 2a 20 09 54  md --.+ *.+ * .T
1550: 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 72 65  his procedure re
1560: 74 75 72 6e 73 20 61 20 6c 69 73 74 20 77 68 65  turns a list whe
1570: 72 65 20 65 76 65 72 79 20 65 6c 65 6d 65 6e 74  re every element
1580: 20 69 73 0a 2b 20 2a 20 09 70 61 72 74 20 6f 66   is.+ * .part of
1590: 20 61 6e 20 61 72 69 74 68 6d 65 74 69 63 20 73   an arithmetic s
15a0: 65 71 75 65 6e 63 65 20 73 74 61 72 74 69 6e 67  equence starting
15b0: 20 77 69 74 68 20 74 68 65 20 6e 75 6d 62 65 72   with the number
15c0: 20 53 54 41 52 54 2c 0a 2b 20 2a 20 09 69 6e 63   START,.+ * .inc
15d0: 72 65 6d 65 6e 74 69 6e 67 20 74 68 65 20 6e 65  rementing the ne
15e0: 78 74 20 65 6c 65 6d 65 6e 74 73 20 6f 66 20 53  xt elements of S
15f0: 54 45 50 2c 20 61 6e 64 20 69 6e 63 6c 75 64 69  TEP, and includi
1600: 6e 67 0a 2b 20 2a 20 09 61 6c 6c 20 74 68 65 20  ng.+ * .all the 
1610: 65 6c 65 6d 65 6e 74 73 20 3c 20 45 4e 44 20 28  elements < END (
1620: 6f 72 20 3e 20 45 4e 44 20 66 6f 72 20 6e 65 67  or > END for neg
1630: 61 74 69 76 65 20 73 74 65 70 73 29 2e 0a 2b 20  ative steps)..+ 
1640: 2a 20 09 54 68 65 20 63 6f 6d 6d 61 6e 64 20 72  * .The command r
1650: 65 74 75 72 6e 73 20 61 20 73 70 65 63 69 61 6c  eturns a special
1660: 69 7a 65 64 20 6f 62 6a 65 63 74 20 61 62 6c 65  ized object able
1670: 20 74 6f 20 72 65 70 72 65 73 65 6e 74 0a 2b 20   to represent.+ 
1680: 2a 20 09 74 68 69 73 20 6c 69 73 74 73 20 69 6e  * .this lists in
1690: 20 63 6f 6e 73 74 61 6e 74 20 73 70 61 63 65 20   constant space 
16a0: 28 74 68 65 20 41 72 69 74 68 6d 65 74 69 63 20  (the Arithmetic 
16b0: 53 65 71 75 65 6e 63 65 20 6f 62 6a 65 63 74 20  Sequence object 
16c0: 74 79 70 65 29 2e 0a 2b 20 2a 20 09 53 65 65 20  type)..+ * .See 
16d0: 54 63 6c 5f 4c 69 73 74 4f 62 6a 2e 63 20 66 6f  Tcl_ListObj.c fo
16e0: 72 20 6d 6f 72 65 20 69 6e 66 6f 72 6d 61 74 69  r more informati
16f0: 6f 6e 20 6f 6e 20 74 68 69 73 20 6f 62 6a 65 63  on on this objec
1700: 74 2e 0a 2b 20 2a 0a 2b 20 2a 20 52 65 73 75 6c  t..+ *.+ * Resul
1710: 74 73 3a 0a 2b 20 2a 09 41 20 73 74 61 6e 64 61  ts:.+ *.A standa
1720: 72 64 20 54 63 6c 20 72 65 73 75 6c 74 2e 0a 2b  rd Tcl result..+
1730: 20 2a 0a 2b 20 2a 20 53 69 64 65 20 65 66 66 65   *.+ * Side effe
1740: 63 74 73 3a 0a 2b 20 2a 09 53 65 65 20 74 68 65  cts:.+ *.See the
1750: 20 75 73 65 72 20 64 6f 63 75 6d 65 6e 74 61 74   user documentat
1760: 69 6f 6e 2e 0a 2b 20 2a 0a 2b 20 2a 2d 2d 2d 2d  ion..+ *.+ *----
1770: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1780: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1790: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
17a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
17b0: 2d 2d 0a 2b 20 2a 2f 0a 2b 0a 2b 69 6e 74 0a 2b  --.+ */.+.+int.+
17c0: 54 63 6c 5f 52 61 6e 67 65 4f 62 6a 43 6d 64 28  Tcl_RangeObjCmd(
17d0: 20 63 6c 69 65 6e 74 44 61 74 61 2c 20 69 6e 74   clientData, int
17e0: 65 72 70 2c 20 6f 62 6a 63 2c 20 6f 62 6a 76 20  erp, objc, objv 
17f0: 29 0a 2b 20 20 20 20 43 6c 69 65 6e 74 44 61 74  ).+    ClientDat
1800: 61 20 63 6c 69 65 6e 74 44 61 74 61 3b 09 2f 2a  a clientData;./*
1810: 20 4e 6f 74 20 75 73 65 64 2e 20 2a 2f 0a 2b 20   Not used. */.+ 
1820: 20 20 20 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69     Tcl_Interp *i
1830: 6e 74 65 72 70 3b 09 09 2f 2a 20 43 75 72 72 65  nterp;../* Curre
1840: 6e 74 20 69 6e 74 65 72 70 72 65 74 65 72 2e 20  nt interpreter. 
1850: 2a 2f 0a 2b 20 20 20 20 69 6e 74 20 6f 62 6a 63  */.+    int objc
1860: 3b 09 09 09 2f 2a 20 4e 75 6d 62 65 72 20 6f 66  ;.../* Number of
1870: 20 61 72 67 75 6d 65 6e 74 73 2e 20 2a 2f 0a 2b   arguments. */.+
1880: 20 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 43 4f 4e      Tcl_Obj *CON
1890: 53 54 20 6f 62 6a 76 5b 5d 3b 09 2f 2a 20 41 72  ST objv[];./* Ar
18a0: 67 75 6d 65 6e 74 20 76 61 6c 75 65 73 2e 20 2a  gument values. *
18b0: 2f 0a 2b 7b 0a 2b 20 20 20 20 54 63 6c 5f 57 69  /.+{.+    Tcl_Wi
18c0: 64 65 49 6e 74 20 73 74 61 72 74 20 3d 20 30 2c  deInt start = 0,
18d0: 20 65 6e 64 2c 20 73 74 65 70 20 3d 20 31 3b 0a   end, step = 1;.
18e0: 2b 20 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 61 72  +    Tcl_Obj *ar
18f0: 69 74 68 53 65 72 69 65 73 50 74 72 3b 0a 2b 0a  ithSeriesPtr;.+.
1900: 2b 20 20 20 20 2f 2a 20 43 68 65 63 6b 20 70 61  +    /* Check pa
1910: 72 61 6d 65 74 65 72 20 63 6f 75 6e 74 20 2a 2f  rameter count */
1920: 0a 2b 0a 2b 20 20 20 20 69 66 20 28 6f 62 6a 63  .+.+    if (objc
1930: 20 3c 20 32 20 7c 7c 20 6f 62 6a 63 20 3e 20 34   < 2 || objc > 4
1940: 29 20 7b 0a 2b 09 54 63 6c 5f 57 72 6f 6e 67 4e  ) {.+.Tcl_WrongN
1950: 75 6d 41 72 67 73 28 69 6e 74 65 72 70 2c 20 31  umArgs(interp, 1
1960: 2c 20 6f 62 6a 76 2c 20 22 3f 73 74 61 72 74 3f  , objv, "?start?
1970: 20 65 6e 64 20 3f 73 74 65 70 3f 22 29 3b 0a 2b   end ?step?");.+
1980: 09 72 65 74 75 72 6e 20 54 43 4c 5f 45 52 52 4f  .return TCL_ERRO
1990: 52 3b 0a 2b 20 20 20 20 7d 0a 2b 0a 2b 20 20 20  R;.+    }.+.+   
19a0: 20 2f 2a 20 47 65 74 20 74 68 65 20 73 74 61 72   /* Get the star
19b0: 74 2c 20 65 6e 64 2c 20 73 74 65 70 20 70 61 72  t, end, step par
19c0: 61 6d 65 74 65 72 73 20 66 72 6f 6d 20 61 72 67  ameters from arg
19d0: 75 6d 65 6e 74 73 20 2a 2f 0a 2b 20 20 20 20 69  uments */.+    i
19e0: 66 20 28 6f 62 6a 63 20 3d 3d 20 32 29 20 7b 0a  f (objc == 2) {.
19f0: 2b 09 20 20 20 20 69 66 20 28 54 63 6c 5f 47 65  +.    if (Tcl_Ge
1a00: 74 57 69 64 65 49 6e 74 46 72 6f 6d 4f 62 6a 28  tWideIntFromObj(
1a10: 69 6e 74 65 72 70 2c 20 6f 62 6a 76 5b 31 5d 2c  interp, objv[1],
1a20: 20 26 65 6e 64 29 20 21 3d 20 54 43 4c 5f 4f 4b   &end) != TCL_OK
1a30: 29 0a 2b 09 09 20 20 20 20 72 65 74 75 72 6e 20  ).+..    return 
1a40: 54 43 4c 5f 45 52 52 4f 52 3b 0a 2b 20 20 20 20  TCL_ERROR;.+    
1a50: 7d 20 65 6c 73 65 20 69 66 20 28 6f 62 6a 63 20  } else if (objc 
1a60: 3e 3d 20 33 29 20 7b 0a 2b 09 20 20 20 20 69 66  >= 3) {.+.    if
1a70: 20 28 54 63 6c 5f 47 65 74 57 69 64 65 49 6e 74   (Tcl_GetWideInt
1a80: 46 72 6f 6d 4f 62 6a 28 69 6e 74 65 72 70 2c 20  FromObj(interp, 
1a90: 6f 62 6a 76 5b 31 5d 2c 20 26 73 74 61 72 74 29  objv[1], &start)
1aa0: 20 21 3d 20 54 43 4c 5f 4f 4b 20 7c 7c 0a 2b 09   != TCL_OK ||.+.
1ab0: 09 54 63 6c 5f 47 65 74 57 69 64 65 49 6e 74 46  .Tcl_GetWideIntF
1ac0: 72 6f 6d 4f 62 6a 28 69 6e 74 65 72 70 2c 20 6f  romObj(interp, o
1ad0: 62 6a 76 5b 32 5d 2c 20 26 65 6e 64 29 20 21 3d  bjv[2], &end) !=
1ae0: 20 54 43 4c 5f 4f 4b 29 0a 2b 09 09 20 20 20 20   TCL_OK).+..    
1af0: 72 65 74 75 72 6e 20 54 43 4c 5f 45 52 52 4f 52  return TCL_ERROR
1b00: 3b 0a 2b 09 20 20 20 20 69 66 20 28 6f 62 6a 63  ;.+.    if (objc
1b10: 20 3d 3d 20 34 20 26 26 0a 2b 09 09 54 63 6c 5f   == 4 &&.+..Tcl_
1b20: 47 65 74 57 69 64 65 49 6e 74 46 72 6f 6d 4f 62  GetWideIntFromOb
1b30: 6a 28 69 6e 74 65 72 70 2c 20 6f 62 6a 76 5b 33  j(interp, objv[3
1b40: 5d 2c 20 26 73 74 65 70 29 20 21 3d 20 54 43 4c  ], &step) != TCL
1b50: 5f 4f 4b 29 0a 2b 09 09 20 20 20 20 72 65 74 75  _OK).+..    retu
1b60: 72 6e 20 54 43 4c 5f 45 52 52 4f 52 3b 0a 2b 20  rn TCL_ERROR;.+ 
1b70: 20 20 20 7d 0a 2b 0a 2b 20 20 20 20 2f 2a 20 43     }.+.+    /* C
1b80: 72 65 61 74 65 20 74 68 65 20 61 72 69 74 68 6d  reate the arithm
1b90: 65 74 69 63 20 73 65 72 69 65 73 20 6f 62 6a 65  etic series obje
1ba0: 63 74 2c 20 63 68 65 63 6b 69 6e 67 20 69 66 20  ct, checking if 
1bb0: 74 68 65 0a 2b 20 20 20 20 20 2a 20 70 61 72 61  the.+     * para
1bc0: 6d 65 74 65 72 73 20 61 72 65 20 69 6e 76 61 6c  meters are inval
1bd0: 69 64 2e 20 2a 2f 0a 2b 0a 2b 20 20 20 20 61 72  id. */.+.+    ar
1be0: 69 74 68 53 65 72 69 65 73 50 74 72 20 3d 20 54  ithSeriesPtr = T
1bf0: 63 6c 5f 4e 65 77 41 72 69 74 68 53 65 72 69 65  cl_NewArithSerie
1c00: 73 4f 62 6a 28 73 74 61 72 74 2c 20 65 6e 64 2c  sObj(start, end,
1c10: 20 73 74 65 70 29 3b 0a 2b 20 20 20 20 69 66 20   step);.+    if 
1c20: 28 61 72 69 74 68 53 65 72 69 65 73 50 74 72 20  (arithSeriesPtr 
1c30: 3d 3d 20 4e 55 4c 4c 29 20 7b 0a 2b 09 54 63 6c  == NULL) {.+.Tcl
1c40: 5f 41 70 70 65 6e 64 52 65 73 75 6c 74 28 69 6e  _AppendResult(in
1c50: 74 65 72 70 2c 0a 2b 09 09 22 49 6e 76 61 6c 69  terp,.+.."Invali
1c60: 64 20 28 69 6e 66 69 6e 69 74 65 3f 29 20 61 72  d (infinite?) ar
1c70: 69 74 68 6d 65 74 69 63 20 73 65 71 75 65 6e 63  ithmetic sequenc
1c80: 65 20 73 70 65 63 69 66 69 65 64 22 2c 20 4e 55  e specified", NU
1c90: 4c 4c 29 3b 0a 2b 09 72 65 74 75 72 6e 20 54 43  LL);.+.return TC
1ca0: 4c 5f 45 52 52 4f 52 3b 0a 2b 20 20 20 20 7d 0a  L_ERROR;.+    }.
1cb0: 2b 0a 2b 20 20 20 20 54 63 6c 5f 49 6e 63 72 52  +.+    Tcl_IncrR
1cc0: 65 66 43 6f 75 6e 74 28 61 72 69 74 68 53 65 72  efCount(arithSer
1cd0: 69 65 73 50 74 72 29 3b 20 2f 2a 20 77 65 20 6d  iesPtr); /* we m
1ce0: 61 79 20 75 73 65 20 44 65 63 72 52 65 66 43 6f  ay use DecrRefCo
1cf0: 75 6e 74 20 74 6f 20 66 72 65 65 20 69 74 20 2a  unt to free it *
1d00: 2f 0a 2b 20 20 20 20 69 66 20 28 54 63 6c 5f 41  /.+    if (Tcl_A
1d10: 72 69 74 68 53 65 72 69 65 73 4f 62 6a 4c 65 6e  rithSeriesObjLen
1d20: 67 74 68 28 61 72 69 74 68 53 65 72 69 65 73 50  gth(arithSeriesP
1d30: 74 72 29 20 3e 20 49 4e 54 5f 4d 41 58 2f 73 69  tr) > INT_MAX/si
1d40: 7a 65 6f 66 28 54 63 6c 5f 4f 62 6a 20 2a 29 29  zeof(Tcl_Obj *))
1d50: 20 7b 0a 2b 09 54 63 6c 5f 44 65 63 72 52 65 66   {.+.Tcl_DecrRef
1d60: 43 6f 75 6e 74 28 61 72 69 74 68 53 65 72 69 65  Count(arithSerie
1d70: 73 50 74 72 29 3b 0a 2b 09 54 63 6c 5f 41 70 70  sPtr);.+.Tcl_App
1d80: 65 6e 64 52 65 73 75 6c 74 28 69 6e 74 65 72 70  endResult(interp
1d90: 2c 20 22 6f 76 65 72 66 6c 6f 77 20 6f 66 20 6d  , "overflow of m
1da0: 61 78 69 6d 75 6d 20 6c 69 73 74 20 6c 65 6e 67  aximum list leng
1db0: 74 68 22 2c 20 4e 55 4c 4c 29 3b 0a 2b 09 72 65  th", NULL);.+.re
1dc0: 74 75 72 6e 20 54 43 4c 5f 45 52 52 4f 52 3b 0a  turn TCL_ERROR;.
1dd0: 2b 20 20 20 20 7d 0a 2b 0a 2b 20 20 20 20 2f 2a  +    }.+.+    /*
1de0: 20 52 65 74 75 72 6e 20 74 68 65 20 6e 65 77 20   Return the new 
1df0: 6f 62 6a 65 63 74 2e 20 2a 2f 0a 2b 0a 2b 20 20  object. */.+.+  
1e00: 20 20 54 63 6c 5f 53 65 74 4f 62 6a 52 65 73 75    Tcl_SetObjResu
1e10: 6c 74 28 69 6e 74 65 72 70 2c 20 61 72 69 74 68  lt(interp, arith
1e20: 53 65 72 69 65 73 50 74 72 29 3b 0a 2b 20 20 20  SeriesPtr);.+   
1e30: 20 54 63 6c 5f 44 65 63 72 52 65 66 43 6f 75 6e   Tcl_DecrRefCoun
1e40: 74 28 61 72 69 74 68 53 65 72 69 65 73 50 74 72  t(arithSeriesPtr
1e50: 29 3b 0a 2b 20 20 20 20 72 65 74 75 72 6e 20 54  );.+    return T
1e60: 43 4c 5f 4f 4b 3b 0a 2b 7d 0a 2b 0a 20 2f 2a 0a  CL_OK;.+}.+. /*.
1e70: 20 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d    *-------------
1e80: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1e90: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1ea0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1eb0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20 2a 0a 49 6e  ---------.  *.In
1ec0: 64 65 78 3a 20 67 65 6e 65 72 69 63 2f 74 63 6c  dex: generic/tcl
1ed0: 44 65 63 6c 73 2e 68 0a 3d 3d 3d 3d 3d 3d 3d 3d  Decls.h.========
1ee0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1ef0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1f00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1f10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 52 43 53 20  ===========.RCS 
1f20: 66 69 6c 65 3a 20 2f 63 76 73 72 6f 6f 74 2f 74  file: /cvsroot/t
1f30: 63 6c 2f 74 63 6c 2f 67 65 6e 65 72 69 63 2f 74  cl/tcl/generic/t
1f40: 63 6c 44 65 63 6c 73 2e 68 2c 76 0a 72 65 74 72  clDecls.h,v.retr
1f50: 69 65 76 69 6e 67 20 72 65 76 69 73 69 6f 6e 20  ieving revision 
1f60: 31 2e 31 30 35 0a 64 69 66 66 20 2d 75 20 2d 72  1.105.diff -u -r
1f70: 31 2e 31 30 35 20 74 63 6c 44 65 63 6c 73 2e 68  1.105 tclDecls.h
1f80: 0a 2d 2d 2d 20 67 65 6e 65 72 69 63 2f 74 63 6c  .--- generic/tcl
1f90: 44 65 63 6c 73 2e 68 09 37 20 4a 75 6e 20 32 30  Decls.h.7 Jun 20
1fa0: 30 34 20 31 36 3a 34 38 3a 34 34 20 2d 30 30 30  04 16:48:44 -000
1fb0: 30 09 31 2e 31 30 35 0a 2b 2b 2b 20 67 65 6e 65  0.1.105.+++ gene
1fc0: 72 69 63 2f 74 63 6c 44 65 63 6c 73 2e 68 09 32  ric/tclDecls.h.2
1fd0: 34 20 4f 63 74 20 32 30 30 34 20 30 39 3a 33 31  4 Oct 2004 09:31
1fe0: 3a 34 39 20 2d 30 30 30 30 0a 40 40 20 2d 33 33  :49 -0000.@@ -33
1ff0: 31 34 2c 36 20 2b 33 33 31 34 2c 32 35 20 40 40  14,6 +3314,25 @@
2000: 0a 20 45 58 54 45 52 4e 20 69 6e 74 09 09 54 63  . EXTERN int..Tc
2010: 6c 5f 4c 69 6d 69 74 47 65 74 47 72 61 6e 75 6c  l_LimitGetGranul
2020: 61 72 69 74 79 20 5f 41 4e 53 49 5f 41 52 47 53  arity _ANSI_ARGS
2030: 5f 28 28 0a 20 09 09 09 09 54 63 6c 5f 49 6e 74  _((. ....Tcl_Int
2040: 65 72 70 20 2a 20 69 6e 74 65 72 70 2c 20 69 6e  erp * interp, in
2050: 74 20 74 79 70 65 29 29 3b 0a 20 23 65 6e 64 69  t type));. #endi
2060: 66 0a 2b 23 69 66 6e 64 65 66 20 54 63 6c 5f 4e  f.+#ifndef Tcl_N
2070: 65 77 41 72 69 74 68 53 65 72 69 65 73 4f 62 6a  ewArithSeriesObj
2080: 5f 54 43 4c 5f 44 45 43 4c 41 52 45 44 0a 2b 23  _TCL_DECLARED.+#
2090: 64 65 66 69 6e 65 20 54 63 6c 5f 4e 65 77 41 72  define Tcl_NewAr
20a0: 69 74 68 53 65 72 69 65 73 4f 62 6a 5f 54 43 4c  ithSeriesObj_TCL
20b0: 5f 44 45 43 4c 41 52 45 44 0a 2b 2f 2a 20 35 33  _DECLARED.+/* 53
20c0: 35 20 2a 2f 0a 2b 45 58 54 45 52 4e 20 54 63 6c  5 */.+EXTERN Tcl
20d0: 5f 4f 62 6a 20 2a 09 54 63 6c 5f 4e 65 77 41 72  _Obj *.Tcl_NewAr
20e0: 69 74 68 53 65 72 69 65 73 4f 62 6a 20 5f 41 4e  ithSeriesObj _AN
20f0: 53 49 5f 41 52 47 53 5f 28 28 54 63 6c 5f 57 69  SI_ARGS_((Tcl_Wi
2100: 64 65 49 6e 74 20 73 74 61 72 74 2c 20 0a 2b 09  deInt start, .+.
2110: 09 09 09 54 63 6c 5f 57 69 64 65 49 6e 74 20 65  ...Tcl_WideInt e
2120: 6e 64 2c 20 54 63 6c 5f 57 69 64 65 49 6e 74 20  nd, Tcl_WideInt 
2130: 73 74 65 70 29 29 3b 0a 2b 23 65 6e 64 69 66 0a  step));.+#endif.
2140: 2b 23 69 66 6e 64 65 66 20 54 63 6c 5f 41 72 69  +#ifndef Tcl_Ari
2150: 74 68 53 65 72 69 65 73 4f 62 6a 49 6e 64 65 78  thSeriesObjIndex
2160: 5f 54 43 4c 5f 44 45 43 4c 41 52 45 44 0a 2b 23  _TCL_DECLARED.+#
2170: 64 65 66 69 6e 65 20 54 63 6c 5f 41 72 69 74 68  define Tcl_Arith
2180: 53 65 72 69 65 73 4f 62 6a 49 6e 64 65 78 5f 54  SeriesObjIndex_T
2190: 43 4c 5f 44 45 43 4c 41 52 45 44 0a 2b 2f 2a 20  CL_DECLARED.+/* 
21a0: 35 33 36 20 2a 2f 0a 2b 45 58 54 45 52 4e 20 69  536 */.+EXTERN i
21b0: 6e 74 09 09 54 63 6c 5f 41 72 69 74 68 53 65 72  nt..Tcl_ArithSer
21c0: 69 65 73 4f 62 6a 49 6e 64 65 78 20 5f 41 4e 53  iesObjIndex _ANS
21d0: 49 5f 41 52 47 53 5f 28 28 0a 2b 09 09 09 09 54  I_ARGS_((.+....T
21e0: 63 6c 5f 4f 62 6a 20 2a 20 61 72 69 74 68 53 65  cl_Obj * arithSe
21f0: 72 69 65 73 50 74 72 2c 20 54 63 6c 5f 57 69 64  riesPtr, Tcl_Wid
2200: 65 49 6e 74 20 69 6e 64 65 78 2c 20 0a 2b 09 09  eInt index, .+..
2210: 09 09 54 63 6c 5f 57 69 64 65 49 6e 74 20 2a 20  ..Tcl_WideInt * 
2220: 65 6c 65 6d 65 6e 74 29 29 3b 0a 2b 23 65 6e 64  element));.+#end
2230: 69 66 0a 2b 23 69 66 6e 64 65 66 20 54 63 6c 5f  if.+#ifndef Tcl_
2240: 41 72 69 74 68 53 65 72 69 65 73 4f 62 6a 4c 65  ArithSeriesObjLe
2250: 6e 67 74 68 5f 54 43 4c 5f 44 45 43 4c 41 52 45  ngth_TCL_DECLARE
2260: 44 0a 2b 23 64 65 66 69 6e 65 20 54 63 6c 5f 41  D.+#define Tcl_A
2270: 72 69 74 68 53 65 72 69 65 73 4f 62 6a 4c 65 6e  rithSeriesObjLen
2280: 67 74 68 5f 54 43 4c 5f 44 45 43 4c 41 52 45 44  gth_TCL_DECLARED
2290: 0a 2b 2f 2a 20 35 33 37 20 2a 2f 0a 2b 45 58 54  .+/* 537 */.+EXT
22a0: 45 52 4e 20 54 63 6c 5f 57 69 64 65 49 6e 74 09  ERN Tcl_WideInt.
22b0: 54 63 6c 5f 41 72 69 74 68 53 65 72 69 65 73 4f  Tcl_ArithSeriesO
22c0: 62 6a 4c 65 6e 67 74 68 20 5f 41 4e 53 49 5f 41  bjLength _ANSI_A
22d0: 52 47 53 5f 28 28 0a 2b 09 09 09 09 54 63 6c 5f  RGS_((.+....Tcl_
22e0: 4f 62 6a 20 2a 20 61 72 69 74 68 53 65 72 69 65  Obj * arithSerie
22f0: 73 50 74 72 29 29 3b 0a 2b 23 65 6e 64 69 66 0a  sPtr));.+#endif.
2300: 20 0a 20 74 79 70 65 64 65 66 20 73 74 72 75 63   . typedef struc
2310: 74 20 54 63 6c 53 74 75 62 48 6f 6f 6b 73 20 7b  t TclStubHooks {
2320: 0a 20 20 20 20 20 73 74 72 75 63 74 20 54 63 6c  .     struct Tcl
2330: 50 6c 61 74 53 74 75 62 73 20 2a 74 63 6c 50 6c  PlatStubs *tclPl
2340: 61 74 53 74 75 62 73 3b 0a 40 40 20 2d 33 38 39  atStubs;.@@ -389
2350: 30 2c 36 20 2b 33 39 30 39 2c 39 20 40 40 0a 20  0,6 +3909,9 @@. 
2360: 20 20 20 20 69 6e 74 20 28 2a 74 63 6c 5f 4c 69      int (*tcl_Li
2370: 6d 69 74 47 65 74 43 6f 6d 6d 61 6e 64 73 29 20  mitGetCommands) 
2380: 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 54 63 6c  _ANSI_ARGS_((Tcl
2390: 5f 49 6e 74 65 72 70 20 2a 20 69 6e 74 65 72 70  _Interp * interp
23a0: 29 29 3b 20 2f 2a 20 35 33 32 20 2a 2f 0a 20 20  )); /* 532 */.  
23b0: 20 20 20 76 6f 69 64 20 28 2a 74 63 6c 5f 4c 69     void (*tcl_Li
23c0: 6d 69 74 47 65 74 54 69 6d 65 29 20 5f 41 4e 53  mitGetTime) _ANS
23d0: 49 5f 41 52 47 53 5f 28 28 54 63 6c 5f 49 6e 74  I_ARGS_((Tcl_Int
23e0: 65 72 70 20 2a 20 69 6e 74 65 72 70 2c 20 54 63  erp * interp, Tc
23f0: 6c 5f 54 69 6d 65 20 2a 20 74 69 6d 65 4c 69 6d  l_Time * timeLim
2400: 69 74 50 74 72 29 29 3b 20 2f 2a 20 35 33 33 20  itPtr)); /* 533 
2410: 2a 2f 0a 20 20 20 20 20 69 6e 74 20 28 2a 74 63  */.     int (*tc
2420: 6c 5f 4c 69 6d 69 74 47 65 74 47 72 61 6e 75 6c  l_LimitGetGranul
2430: 61 72 69 74 79 29 20 5f 41 4e 53 49 5f 41 52 47  arity) _ANSI_ARG
2440: 53 5f 28 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a  S_((Tcl_Interp *
2450: 20 69 6e 74 65 72 70 2c 20 69 6e 74 20 74 79 70   interp, int typ
2460: 65 29 29 3b 20 2f 2a 20 35 33 34 20 2a 2f 0a 2b  e)); /* 534 */.+
2470: 20 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 20 28 2a      Tcl_Obj * (*
2480: 74 63 6c 5f 4e 65 77 41 72 69 74 68 53 65 72 69  tcl_NewArithSeri
2490: 65 73 4f 62 6a 29 20 5f 41 4e 53 49 5f 41 52 47  esObj) _ANSI_ARG
24a0: 53 5f 28 28 54 63 6c 5f 57 69 64 65 49 6e 74 20  S_((Tcl_WideInt 
24b0: 73 74 61 72 74 2c 20 54 63 6c 5f 57 69 64 65 49  start, Tcl_WideI
24c0: 6e 74 20 65 6e 64 2c 20 54 63 6c 5f 57 69 64 65  nt end, Tcl_Wide
24d0: 49 6e 74 20 73 74 65 70 29 29 3b 20 2f 2a 20 35  Int step)); /* 5
24e0: 33 35 20 2a 2f 0a 2b 20 20 20 20 69 6e 74 20 28  35 */.+    int (
24f0: 2a 74 63 6c 5f 41 72 69 74 68 53 65 72 69 65 73  *tcl_ArithSeries
2500: 4f 62 6a 49 6e 64 65 78 29 20 5f 41 4e 53 49 5f  ObjIndex) _ANSI_
2510: 41 52 47 53 5f 28 28 54 63 6c 5f 4f 62 6a 20 2a  ARGS_((Tcl_Obj *
2520: 20 61 72 69 74 68 53 65 72 69 65 73 50 74 72 2c   arithSeriesPtr,
2530: 20 54 63 6c 5f 57 69 64 65 49 6e 74 20 69 6e 64   Tcl_WideInt ind
2540: 65 78 2c 20 54 63 6c 5f 57 69 64 65 49 6e 74 20  ex, Tcl_WideInt 
2550: 2a 20 65 6c 65 6d 65 6e 74 29 29 3b 20 2f 2a 20  * element)); /* 
2560: 35 33 36 20 2a 2f 0a 2b 20 20 20 20 54 63 6c 5f  536 */.+    Tcl_
2570: 57 69 64 65 49 6e 74 20 28 2a 74 63 6c 5f 41 72  WideInt (*tcl_Ar
2580: 69 74 68 53 65 72 69 65 73 4f 62 6a 4c 65 6e 67  ithSeriesObjLeng
2590: 74 68 29 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28  th) _ANSI_ARGS_(
25a0: 28 54 63 6c 5f 4f 62 6a 20 2a 20 61 72 69 74 68  (Tcl_Obj * arith
25b0: 53 65 72 69 65 73 50 74 72 29 29 3b 20 2f 2a 20  SeriesPtr)); /* 
25c0: 35 33 37 20 2a 2f 0a 20 7d 20 54 63 6c 53 74 75  537 */. } TclStu
25d0: 62 73 3b 0a 20 0a 20 23 69 66 64 65 66 20 5f 5f  bs;. . #ifdef __
25e0: 63 70 6c 75 73 70 6c 75 73 0a 40 40 20 2d 36 30  cplusplus.@@ -60
25f0: 37 30 2c 36 20 2b 36 30 39 32 2c 31 38 20 40 40  70,6 +6092,18 @@
2600: 0a 20 23 64 65 66 69 6e 65 20 54 63 6c 5f 4c 69  . #define Tcl_Li
2610: 6d 69 74 47 65 74 47 72 61 6e 75 6c 61 72 69 74  mitGetGranularit
2620: 79 20 5c 0a 20 09 28 74 63 6c 53 74 75 62 73 50  y \. .(tclStubsP
2630: 74 72 2d 3e 74 63 6c 5f 4c 69 6d 69 74 47 65 74  tr->tcl_LimitGet
2640: 47 72 61 6e 75 6c 61 72 69 74 79 29 20 2f 2a 20  Granularity) /* 
2650: 35 33 34 20 2a 2f 0a 20 23 65 6e 64 69 66 0a 2b  534 */. #endif.+
2660: 23 69 66 6e 64 65 66 20 54 63 6c 5f 4e 65 77 41  #ifndef Tcl_NewA
2670: 72 69 74 68 53 65 72 69 65 73 4f 62 6a 0a 2b 23  rithSeriesObj.+#
2680: 64 65 66 69 6e 65 20 54 63 6c 5f 4e 65 77 41 72  define Tcl_NewAr
2690: 69 74 68 53 65 72 69 65 73 4f 62 6a 20 5c 0a 2b  ithSeriesObj \.+
26a0: 09 28 74 63 6c 53 74 75 62 73 50 74 72 2d 3e 74  .(tclStubsPtr->t
26b0: 63 6c 5f 4e 65 77 41 72 69 74 68 53 65 72 69 65  cl_NewArithSerie
26c0: 73 4f 62 6a 29 20 2f 2a 20 35 33 35 20 2a 2f 0a  sObj) /* 535 */.
26d0: 2b 23 65 6e 64 69 66 0a 2b 23 69 66 6e 64 65 66  +#endif.+#ifndef
26e0: 20 54 63 6c 5f 41 72 69 74 68 53 65 72 69 65 73   Tcl_ArithSeries
26f0: 4f 62 6a 49 6e 64 65 78 0a 2b 23 64 65 66 69 6e  ObjIndex.+#defin
2700: 65 20 54 63 6c 5f 41 72 69 74 68 53 65 72 69 65  e Tcl_ArithSerie
2710: 73 4f 62 6a 49 6e 64 65 78 20 5c 0a 2b 09 28 74  sObjIndex \.+.(t
2720: 63 6c 53 74 75 62 73 50 74 72 2d 3e 74 63 6c 5f  clStubsPtr->tcl_
2730: 41 72 69 74 68 53 65 72 69 65 73 4f 62 6a 49 6e  ArithSeriesObjIn
2740: 64 65 78 29 20 2f 2a 20 35 33 36 20 2a 2f 0a 2b  dex) /* 536 */.+
2750: 23 65 6e 64 69 66 0a 2b 23 69 66 6e 64 65 66 20  #endif.+#ifndef 
2760: 54 63 6c 5f 41 72 69 74 68 53 65 72 69 65 73 4f  Tcl_ArithSeriesO
2770: 62 6a 4c 65 6e 67 74 68 0a 2b 23 64 65 66 69 6e  bjLength.+#defin
2780: 65 20 54 63 6c 5f 41 72 69 74 68 53 65 72 69 65  e Tcl_ArithSerie
2790: 73 4f 62 6a 4c 65 6e 67 74 68 20 5c 0a 2b 09 28  sObjLength \.+.(
27a0: 74 63 6c 53 74 75 62 73 50 74 72 2d 3e 74 63 6c  tclStubsPtr->tcl
27b0: 5f 41 72 69 74 68 53 65 72 69 65 73 4f 62 6a 4c  _ArithSeriesObjL
27c0: 65 6e 67 74 68 29 20 2f 2a 20 35 33 37 20 2a 2f  ength) /* 537 */
27d0: 0a 2b 23 65 6e 64 69 66 0a 20 0a 20 23 65 6e 64  .+#endif. . #end
27e0: 69 66 20 2f 2a 20 64 65 66 69 6e 65 64 28 55 53  if /* defined(US
27f0: 45 5f 54 43 4c 5f 53 54 55 42 53 29 20 26 26 20  E_TCL_STUBS) && 
2800: 21 64 65 66 69 6e 65 64 28 55 53 45 5f 54 43 4c  !defined(USE_TCL
2810: 5f 53 54 55 42 5f 50 52 4f 43 53 29 20 2a 2f 0a  _STUB_PROCS) */.
2820: 20 0a 49 6e 64 65 78 3a 20 67 65 6e 65 72 69 63   .Index: generic
2830: 2f 74 63 6c 45 78 65 63 75 74 65 2e 63 0a 3d 3d  /tclExecute.c.==
2840: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
2850: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
2860: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
2870: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
2880: 3d 0a 52 43 53 20 66 69 6c 65 3a 20 2f 63 76 73  =.RCS file: /cvs
2890: 72 6f 6f 74 2f 74 63 6c 2f 74 63 6c 2f 67 65 6e  root/tcl/tcl/gen
28a0: 65 72 69 63 2f 74 63 6c 45 78 65 63 75 74 65 2e  eric/tclExecute.
28b0: 63 2c 76 0a 72 65 74 72 69 65 76 69 6e 67 20 72  c,v.retrieving r
28c0: 65 76 69 73 69 6f 6e 20 31 2e 31 36 30 0a 64 69  evision 1.160.di
28d0: 66 66 20 2d 75 20 2d 72 31 2e 31 36 30 20 74 63  ff -u -r1.160 tc
28e0: 6c 45 78 65 63 75 74 65 2e 63 0a 2d 2d 2d 20 67  lExecute.c.--- g
28f0: 65 6e 65 72 69 63 2f 74 63 6c 45 78 65 63 75 74  eneric/tclExecut
2900: 65 2e 63 09 32 32 20 4f 63 74 20 32 30 30 34 20  e.c.22 Oct 2004 
2910: 31 34 3a 30 31 3a 30 30 20 2d 30 30 30 30 09 31  14:01:00 -0000.1
2920: 2e 31 36 30 0a 2b 2b 2b 20 67 65 6e 65 72 69 63  .160.+++ generic
2930: 2f 74 63 6c 45 78 65 63 75 74 65 2e 63 09 32 34  /tclExecute.c.24
2940: 20 4f 63 74 20 32 30 30 34 20 30 39 3a 33 31 3a   Oct 2004 09:31:
2950: 35 39 20 2d 30 30 30 30 0a 40 40 20 2d 32 36 31  59 -0000.@@ -261
2960: 30 2c 31 33 20 2b 32 36 31 30 2c 31 38 20 40 40  0,13 +2610,18 @@
2970: 0a 20 09 20 20 20 20 0a 20 09 20 20 20 20 76 61  . .    . .    va
2980: 6c 75 65 50 74 72 20 3d 20 2a 74 6f 73 50 74 72  luePtr = *tosPtr
2990: 3b 0a 20 0a 2d 09 20 20 20 20 72 65 73 75 6c 74  ;. .-.    result
29a0: 20 3d 20 54 63 6c 5f 4c 69 73 74 4f 62 6a 4c 65   = Tcl_ListObjLe
29b0: 6e 67 74 68 28 69 6e 74 65 72 70 2c 20 76 61 6c  ngth(interp, val
29c0: 75 65 50 74 72 2c 20 26 6c 65 6e 67 74 68 29 3b  uePtr, &length);
29d0: 0a 2d 09 20 20 20 20 69 66 20 28 72 65 73 75 6c  .-.    if (resul
29e0: 74 20 21 3d 20 54 43 4c 5f 4f 4b 29 20 7b 0a 2d  t != TCL_OK) {.-
29f0: 09 09 54 52 41 43 45 5f 57 49 54 48 5f 4f 42 4a  ..TRACE_WITH_OBJ
2a00: 28 28 22 25 2e 33 30 73 20 3d 3e 20 45 52 52 4f  (("%.30s => ERRO
2a10: 52 3a 20 22 2c 20 4f 32 53 28 76 61 6c 75 65 50  R: ", O2S(valueP
2a20: 74 72 29 29 2c 0a 2d 09 09 09 54 63 6c 5f 47 65  tr)),.-...Tcl_Ge
2a30: 74 4f 62 6a 52 65 73 75 6c 74 28 69 6e 74 65 72  tObjResult(inter
2a40: 70 29 29 3b 0a 2d 09 09 67 6f 74 6f 20 63 68 65  p));.-..goto che
2a50: 63 6b 46 6f 72 43 61 74 63 68 3b 0a 2b 09 20 20  ckForCatch;.+.  
2a60: 20 20 69 66 20 28 76 61 6c 75 65 50 74 72 2d 3e    if (valuePtr->
2a70: 74 79 70 65 50 74 72 20 3d 3d 20 26 74 63 6c 41  typePtr == &tclA
2a80: 72 69 74 68 53 65 72 69 65 73 54 79 70 65 29 20  rithSeriesType) 
2a90: 7b 0a 2b 09 20 20 20 20 20 20 20 20 6f 62 6a 52  {.+.        objR
2aa0: 65 73 75 6c 74 50 74 72 20 3d 20 54 63 6c 5f 4e  esultPtr = Tcl_N
2ab0: 65 77 57 69 64 65 49 6e 74 4f 62 6a 28 0a 2b 09  ewWideIntObj(.+.
2ac0: 09 09 09 54 63 6c 5f 41 72 69 74 68 53 65 72 69  ...Tcl_ArithSeri
2ad0: 65 73 4f 62 6a 4c 65 6e 67 74 68 28 76 61 6c 75  esObjLength(valu
2ae0: 65 50 74 72 29 29 3b 0a 2b 09 20 20 20 20 7d 20  ePtr));.+.    } 
2af0: 65 6c 73 65 20 7b 0a 2b 09 20 20 20 20 20 20 20  else {.+.       
2b00: 20 72 65 73 75 6c 74 20 3d 20 54 63 6c 5f 4c 69   result = Tcl_Li
2b10: 73 74 4f 62 6a 4c 65 6e 67 74 68 28 69 6e 74 65  stObjLength(inte
2b20: 72 70 2c 20 76 61 6c 75 65 50 74 72 2c 20 26 6c  rp, valuePtr, &l
2b30: 65 6e 67 74 68 29 3b 0a 2b 09 20 20 20 20 20 20  ength);.+.      
2b40: 20 20 69 66 20 28 72 65 73 75 6c 74 20 21 3d 20    if (result != 
2b50: 54 43 4c 5f 4f 4b 29 20 7b 0a 2b 09 09 20 20 20  TCL_OK) {.+..   
2b60: 20 54 52 41 43 45 5f 57 49 54 48 5f 4f 42 4a 28   TRACE_WITH_OBJ(
2b70: 28 22 25 2e 33 30 73 20 3d 3e 20 45 52 52 4f 52  ("%.30s => ERROR
2b80: 3a 20 22 2c 20 4f 32 53 28 76 61 6c 75 65 50 74  : ", O2S(valuePt
2b90: 72 29 29 2c 0a 2b 09 09 09 20 20 20 20 54 63 6c  r)),.+...    Tcl
2ba0: 5f 47 65 74 4f 62 6a 52 65 73 75 6c 74 28 69 6e  _GetObjResult(in
2bb0: 74 65 72 70 29 29 3b 0a 2b 09 09 20 20 20 20 67  terp));.+..    g
2bc0: 6f 74 6f 20 63 68 65 63 6b 46 6f 72 43 61 74 63  oto checkForCatc
2bd0: 68 3b 0a 2b 09 20 20 20 20 20 20 20 20 7d 0a 2b  h;.+.        }.+
2be0: 09 20 20 20 20 20 20 20 20 6f 62 6a 52 65 73 75  .        objResu
2bf0: 6c 74 50 74 72 20 3d 20 54 63 6c 5f 4e 65 77 49  ltPtr = Tcl_NewI
2c00: 6e 74 4f 62 6a 28 6c 65 6e 67 74 68 29 3b 0a 20  ntObj(length);. 
2c10: 09 20 20 20 20 7d 0a 2d 09 20 20 20 20 6f 62 6a  .    }.-.    obj
2c20: 52 65 73 75 6c 74 50 74 72 20 3d 20 54 63 6c 5f  ResultPtr = Tcl_
2c30: 4e 65 77 49 6e 74 4f 62 6a 28 6c 65 6e 67 74 68  NewIntObj(length
2c40: 29 3b 0a 20 09 20 20 20 20 54 52 41 43 45 28 28  );. .    TRACE((
2c50: 22 25 2e 32 30 73 20 3d 3e 20 25 64 5c 6e 22 2c  "%.20s => %d\n",
2c60: 20 4f 32 53 28 76 61 6c 75 65 50 74 72 29 2c 20   O2S(valuePtr), 
2c70: 6c 65 6e 67 74 68 29 29 3b 0a 20 09 20 20 20 20  length));. .    
2c80: 4e 45 58 54 5f 49 4e 53 54 5f 46 28 31 2c 20 31  NEXT_INST_F(1, 1
2c90: 2c 20 31 29 3b 0a 20 09 7d 0a 40 40 20 2d 34 35  , 1);. .}.@@ -45
2ca0: 36 32 2c 36 20 2b 34 35 36 37 2c 37 20 40 40 0a  62,6 +4567,7 @@.
2cb0: 20 09 20 20 20 20 69 6e 74 20 6e 75 6d 4c 69 73   .    int numLis
2cc0: 74 73 3b 0a 20 09 20 20 20 20 54 63 6c 5f 4f 62  ts;. .    Tcl_Ob
2cd0: 6a 20 2a 6c 69 73 74 50 74 72 2c 2a 76 61 6c 75  j *listPtr,*valu
2ce0: 65 50 74 72 2c 20 2a 76 61 6c 75 65 32 50 74 72  ePtr, *value2Ptr
2cf0: 3b 0a 20 09 20 20 20 20 4c 69 73 74 20 2a 6c 69  ;. .    List *li
2d00: 73 74 52 65 70 50 74 72 3b 0a 2b 09 20 20 20 20  stRepPtr;.+.    
2d10: 41 72 69 74 68 53 65 72 69 65 73 20 2a 61 72 69  ArithSeries *ari
2d20: 74 68 53 65 72 69 65 73 52 65 70 50 74 72 3b 0a  thSeriesRepPtr;.
2d30: 20 09 20 20 20 20 56 61 72 20 2a 69 74 65 72 56   .    Var *iterV
2d40: 61 72 50 74 72 2c 20 2a 6c 69 73 74 56 61 72 50  arPtr, *listVarP
2d50: 74 72 3b 0a 20 09 20 20 20 20 69 6e 74 20 69 74  tr;. .    int it
2d60: 65 72 4e 75 6d 2c 20 6c 69 73 74 54 6d 70 49 6e  erNum, listTmpIn
2d70: 64 65 78 2c 20 6c 69 73 74 4c 65 6e 2c 20 6e 75  dex, listLen, nu
2d80: 6d 56 61 72 73 3b 0a 20 09 20 20 20 20 69 6e 74  mVars;. .    int
2d90: 20 76 61 72 49 6e 64 65 78 2c 20 76 61 6c 49 6e   varIndex, valIn
2da0: 64 65 78 2c 20 63 6f 6e 74 69 6e 75 65 4c 6f 6f  dex, continueLoo
2db0: 70 2c 20 6a 3b 0a 40 40 20 2d 34 35 39 36 2c 37  p, j;.@@ -4596,7
2dc0: 20 2b 34 36 30 32 2c 31 32 20 40 40 0a 20 09 09   +4602,12 @@. ..
2dd0: 20 20 20 20 0a 20 09 09 6c 69 73 74 56 61 72 50      . ..listVarP
2de0: 74 72 20 3d 20 26 28 63 6f 6d 70 69 6c 65 64 4c  tr = &(compiledL
2df0: 6f 63 61 6c 73 5b 6c 69 73 74 54 6d 70 49 6e 64  ocals[listTmpInd
2e00: 65 78 5d 29 3b 0a 20 09 09 6c 69 73 74 50 74 72  ex]);. ..listPtr
2e10: 20 3d 20 6c 69 73 74 56 61 72 50 74 72 2d 3e 76   = listVarPtr->v
2e20: 61 6c 75 65 2e 6f 62 6a 50 74 72 3b 0a 2d 09 09  alue.objPtr;.-..
2e30: 72 65 73 75 6c 74 20 3d 20 54 63 6c 5f 4c 69 73  result = Tcl_Lis
2e40: 74 4f 62 6a 4c 65 6e 67 74 68 28 69 6e 74 65 72  tObjLength(inter
2e50: 70 2c 20 6c 69 73 74 50 74 72 2c 20 26 6c 69 73  p, listPtr, &lis
2e60: 74 4c 65 6e 29 3b 0a 2b 09 09 69 66 20 28 6c 69  tLen);.+..if (li
2e70: 73 74 50 74 72 2d 3e 74 79 70 65 50 74 72 20 3d  stPtr->typePtr =
2e80: 3d 20 26 74 63 6c 41 72 69 74 68 53 65 72 69 65  = &tclArithSerie
2e90: 73 54 79 70 65 29 20 7b 0a 2b 09 09 09 6c 69 73  sType) {.+...lis
2ea0: 74 4c 65 6e 20 3d 20 28 69 6e 74 29 20 54 63 6c  tLen = (int) Tcl
2eb0: 5f 41 72 69 74 68 53 65 72 69 65 73 4f 62 6a 4c  _ArithSeriesObjL
2ec0: 65 6e 67 74 68 28 6c 69 73 74 50 74 72 29 3b 0a  ength(listPtr);.
2ed0: 2b 09 09 09 72 65 73 75 6c 74 20 3d 20 54 43 4c  +...result = TCL
2ee0: 5f 4f 4b 3b 20 2f 2a 20 54 63 6c 5f 41 72 69 74  _OK; /* Tcl_Arit
2ef0: 68 53 65 72 69 65 73 4c 65 6e 67 74 68 20 63 61  hSeriesLength ca
2f00: 6e 27 74 20 66 61 69 6c 20 2a 2f 0a 2b 09 09 7d  n't fail */.+..}
2f10: 20 65 6c 73 65 20 7b 0a 2b 09 09 09 72 65 73 75   else {.+...resu
2f20: 6c 74 20 3d 20 54 63 6c 5f 4c 69 73 74 4f 62 6a  lt = Tcl_ListObj
2f30: 4c 65 6e 67 74 68 28 69 6e 74 65 72 70 2c 20 6c  Length(interp, l
2f40: 69 73 74 50 74 72 2c 20 26 6c 69 73 74 4c 65 6e  istPtr, &listLen
2f50: 29 3b 0a 2b 09 09 7d 0a 20 09 09 69 66 20 28 72  );.+..}. ..if (r
2f60: 65 73 75 6c 74 20 21 3d 20 54 43 4c 5f 4f 4b 29  esult != TCL_OK)
2f70: 20 7b 0a 20 09 09 20 20 20 20 54 52 41 43 45 5f   {. ..    TRACE_
2f80: 57 49 54 48 5f 4f 42 4a 28 28 22 25 75 20 3d 3e  WITH_OBJ(("%u =>
2f90: 20 45 52 52 4f 52 20 63 6f 6e 76 65 72 74 69 6e   ERROR convertin
2fa0: 67 20 6c 69 73 74 20 25 6c 64 2c 20 5c 22 25 73  g list %ld, \"%s
2fb0: 5c 22 3a 20 22 2c 0a 20 09 09 20 20 20 20 20 20  \": ",. ..      
2fc0: 20 20 20 20 20 20 6f 70 6e 64 2c 20 69 2c 20 4f        opnd, i, O
2fd0: 32 53 28 6c 69 73 74 50 74 72 29 29 2c 20 54 63  2S(listPtr)), Tc
2fe0: 6c 5f 47 65 74 4f 62 6a 52 65 73 75 6c 74 28 69  l_GetObjResult(i
2ff0: 6e 74 65 72 70 29 29 3b 0a 40 40 20 2d 34 36 32  nterp));.@@ -462
3000: 34 2c 32 37 20 2b 34 36 33 35 2c 37 30 20 40 40  4,27 +4635,70 @@
3010: 0a 20 09 09 20 20 20 20 6c 69 73 74 56 61 72 50  . ..    listVarP
3020: 74 72 20 3d 20 26 28 63 6f 6d 70 69 6c 65 64 4c  tr = &(compiledL
3030: 6f 63 61 6c 73 5b 6c 69 73 74 54 6d 70 49 6e 64  ocals[listTmpInd
3040: 65 78 5d 29 3b 0a 20 09 09 20 20 20 20 6c 69 73  ex]);. ..    lis
3050: 74 50 74 72 20 3d 20 6c 69 73 74 56 61 72 50 74  tPtr = listVarPt
3060: 72 2d 3e 76 61 6c 75 65 2e 6f 62 6a 50 74 72 3b  r->value.objPtr;
3070: 0a 20 09 09 20 20 20 20 6c 69 73 74 52 65 70 50  . ..    listRepP
3080: 74 72 20 3d 20 28 4c 69 73 74 20 2a 29 20 6c 69  tr = (List *) li
3090: 73 74 50 74 72 2d 3e 69 6e 74 65 72 6e 61 6c 52  stPtr->internalR
30a0: 65 70 2e 74 77 6f 50 74 72 56 61 6c 75 65 2e 70  ep.twoPtrValue.p
30b0: 74 72 31 3b 0a 2d 09 09 20 20 20 20 6c 69 73 74  tr1;.-..    list
30c0: 4c 65 6e 20 3d 20 6c 69 73 74 52 65 70 50 74 72  Len = listRepPtr
30d0: 2d 3e 65 6c 65 6d 43 6f 75 6e 74 3b 0a 2b 09 09  ->elemCount;.+..
30e0: 20 20 20 20 61 72 69 74 68 53 65 72 69 65 73 52      arithSeriesR
30f0: 65 70 50 74 72 20 3d 20 28 41 72 69 74 68 53 65  epPtr = (ArithSe
3100: 72 69 65 73 20 2a 29 20 6c 69 73 74 52 65 70 50  ries *) listRepP
3110: 74 72 3b 0a 2b 09 09 20 20 20 20 69 66 20 28 6c  tr;.+..    if (l
3120: 69 73 74 50 74 72 2d 3e 74 79 70 65 50 74 72 20  istPtr->typePtr 
3130: 3d 3d 20 26 74 63 6c 4c 69 73 74 54 79 70 65 29  == &tclListType)
3140: 20 7b 0a 2b 09 09 20 20 20 20 09 6c 69 73 74 4c   {.+..    .listL
3150: 65 6e 20 3d 20 6c 69 73 74 52 65 70 50 74 72 2d  en = listRepPtr-
3160: 3e 65 6c 65 6d 43 6f 75 6e 74 3b 0a 2b 09 09 20  >elemCount;.+.. 
3170: 20 20 20 7d 20 65 6c 73 65 20 7b 0a 2b 09 09 09     } else {.+...
3180: 6c 69 73 74 4c 65 6e 20 3d 20 61 72 69 74 68 53  listLen = arithS
3190: 65 72 69 65 73 52 65 70 50 74 72 2d 3e 6c 65 6e  eriesRepPtr->len
31a0: 3b 0a 2b 09 09 20 20 20 20 7d 0a 20 09 09 09 0a  ;.+..    }. ....
31b0: 20 09 09 20 20 20 20 76 61 6c 49 6e 64 65 78 20   ..    valIndex 
31c0: 3d 20 28 69 74 65 72 4e 75 6d 20 2a 20 6e 75 6d  = (iterNum * num
31d0: 56 61 72 73 29 3b 0a 20 09 09 20 20 20 20 66 6f  Vars);. ..    fo
31e0: 72 20 28 6a 20 3d 20 30 3b 20 20 6a 20 3c 20 6e  r (j = 0;  j < n
31f0: 75 6d 56 61 72 73 3b 20 20 6a 2b 2b 29 20 7b 0a  umVars;  j++) {.
3200: 2d 09 09 09 69 6e 74 20 73 65 74 45 6d 70 74 79  -...int setEmpty
3210: 53 74 72 20 3d 20 30 3b 0a 2d 09 09 09 69 66 20  Str = 0;.-...if 
3220: 28 76 61 6c 49 6e 64 65 78 20 3e 3d 20 6c 69 73  (valIndex >= lis
3230: 74 4c 65 6e 29 20 7b 0a 2d 09 09 09 20 20 20 20  tLen) {.-...    
3240: 73 65 74 45 6d 70 74 79 53 74 72 20 3d 20 31 3b  setEmptyStr = 1;
3250: 0a 2d 09 09 09 20 20 20 20 54 63 6c 4e 65 77 4f  .-...    TclNewO
3260: 62 6a 28 76 61 6c 75 65 50 74 72 29 3b 0a 2d 09  bj(valuePtr);.-.
3270: 09 09 7d 20 65 6c 73 65 20 7b 0a 2d 09 09 09 20  ..} else {.-... 
3280: 20 20 20 76 61 6c 75 65 50 74 72 20 3d 20 6c 69     valuePtr = li
3290: 73 74 52 65 70 50 74 72 2d 3e 65 6c 65 6d 65 6e  stRepPtr->elemen
32a0: 74 73 5b 76 61 6c 49 6e 64 65 78 5d 3b 0a 2d 09  ts[valIndex];.-.
32b0: 09 09 7d 0a 2d 09 09 09 20 20 20 20 0a 2b 09 09  ..}.-...    .+..
32c0: 09 69 6e 74 20 73 65 74 45 6d 70 74 79 53 74 72  .int setEmptyStr
32d0: 20 3d 20 30 2c 20 69 6e 6c 69 6e 65 56 61 72 41   = 0, inlineVarA
32e0: 63 63 65 73 73 20 3d 20 30 3b 0a 2b 0a 20 09 09  ccess = 0;.+. ..
32f0: 09 76 61 72 49 6e 64 65 78 20 3d 20 76 61 72 4c  .varIndex = varL
3300: 69 73 74 50 74 72 2d 3e 76 61 72 49 6e 64 65 78  istPtr->varIndex
3310: 65 73 5b 6a 5d 3b 0a 20 09 09 09 76 61 72 50 74  es[j];. ...varPt
3320: 72 20 3d 20 26 28 63 6f 6d 70 69 6c 65 64 4c 6f  r = &(compiledLo
3330: 63 61 6c 73 5b 76 61 72 49 6e 64 65 78 5d 29 3b  cals[varIndex]);
3340: 0a 20 09 09 09 70 61 72 74 31 20 3d 20 76 61 72  . ...part1 = var
3350: 50 74 72 2d 3e 6e 61 6d 65 3b 0a 20 09 09 09 77  Ptr->name;. ...w
3360: 68 69 6c 65 20 28 54 63 6c 49 73 56 61 72 4c 69  hile (TclIsVarLi
3370: 6e 6b 28 76 61 72 50 74 72 29 29 20 7b 0a 20 09  nk(varPtr)) {. .
3380: 09 09 20 20 20 20 76 61 72 50 74 72 20 3d 20 76  ..    varPtr = v
3390: 61 72 50 74 72 2d 3e 76 61 6c 75 65 2e 6c 69 6e  arPtr->value.lin
33a0: 6b 50 74 72 3b 0a 20 09 09 09 7d 0a 2d 09 09 09  kPtr;. ...}.-...
33b0: 69 66 20 28 21 28 28 76 61 72 50 74 72 2d 3e 66  if (!((varPtr->f
33c0: 6c 61 67 73 20 26 20 56 41 52 5f 49 4e 5f 48 41  lags & VAR_IN_HA
33d0: 53 48 54 41 42 4c 45 29 20 26 26 20 28 76 61 72  SHTABLE) && (var
33e0: 50 74 72 2d 3e 68 50 74 72 20 3d 3d 20 4e 55 4c  Ptr->hPtr == NUL
33f0: 4c 29 29 0a 2d 09 09 09 20 20 20 20 20 20 20 20  L)).-...        
3400: 26 26 20 28 76 61 72 50 74 72 2d 3e 74 72 61 63  && (varPtr->trac
3410: 65 50 74 72 20 3d 3d 20 4e 55 4c 4c 29 0a 2d 09  ePtr == NULL).-.
3420: 09 09 20 20 20 20 20 20 20 20 26 26 20 28 54 63  ..        && (Tc
3430: 6c 49 73 56 61 72 53 63 61 6c 61 72 28 76 61 72  lIsVarScalar(var
3440: 50 74 72 29 20 7c 7c 20 54 63 6c 49 73 56 61 72  Ptr) || TclIsVar
3450: 55 6e 64 65 66 69 6e 65 64 28 76 61 72 50 74 72  Undefined(varPtr
3460: 29 29 29 20 7b 0a 2b 09 09 09 69 66 20 28 21 28  ))) {.+...if (!(
3470: 28 76 61 72 50 74 72 2d 3e 66 6c 61 67 73 20 26  (varPtr->flags &
3480: 20 56 41 52 5f 49 4e 5f 48 41 53 48 54 41 42 4c   VAR_IN_HASHTABL
3490: 45 29 20 26 26 0a 2b 09 09 09 09 28 76 61 72 50  E) &&.+....(varP
34a0: 74 72 2d 3e 68 50 74 72 20 3d 3d 20 4e 55 4c 4c  tr->hPtr == NULL
34b0: 29 29 0a 2b 09 09 09 09 26 26 20 28 76 61 72 50  )).+....&& (varP
34c0: 74 72 2d 3e 74 72 61 63 65 50 74 72 20 3d 3d 20  tr->tracePtr == 
34d0: 4e 55 4c 4c 29 0a 2b 09 09 09 09 26 26 20 28 54  NULL).+....&& (T
34e0: 63 6c 49 73 56 61 72 53 63 61 6c 61 72 28 76 61  clIsVarScalar(va
34f0: 72 50 74 72 29 20 7c 7c 0a 2b 09 09 09 09 09 54  rPtr) ||.+.....T
3500: 63 6c 49 73 56 61 72 55 6e 64 65 66 69 6e 65 64  clIsVarUndefined
3510: 28 76 61 72 50 74 72 29 29 29 0a 2b 09 09 09 7b  (varPtr))).+...{
3520: 0a 2b 09 09 09 20 20 20 20 69 6e 6c 69 6e 65 56  .+...    inlineV
3530: 61 72 41 63 63 65 73 73 20 3d 20 31 3b 0a 2b 09  arAccess = 1;.+.
3540: 09 09 7d 0a 2b 0a 2b 09 09 09 69 66 20 28 76 61  ..}.+.+...if (va
3550: 6c 49 6e 64 65 78 20 3e 3d 20 6c 69 73 74 4c 65  lIndex >= listLe
3560: 6e 29 20 7b 0a 2b 09 09 09 20 20 20 20 73 65 74  n) {.+...    set
3570: 45 6d 70 74 79 53 74 72 20 3d 20 31 3b 0a 2b 09  EmptyStr = 1;.+.
3580: 09 09 20 20 20 20 54 63 6c 4e 65 77 4f 62 6a 28  ..    TclNewObj(
3590: 76 61 6c 75 65 50 74 72 29 3b 0a 2b 09 09 09 7d  valuePtr);.+...}
35a0: 20 65 6c 73 65 20 7b 0a 2b 09 09 09 20 20 20 20   else {.+...    
35b0: 69 66 28 6c 69 73 74 50 74 72 2d 3e 74 79 70 65  if(listPtr->type
35c0: 50 74 72 20 3d 3d 20 26 74 63 6c 4c 69 73 74 54  Ptr == &tclListT
35d0: 79 70 65 29 20 7b 0a 2b 09 09 09 20 20 20 20 20  ype) {.+...     
35e0: 20 20 20 76 61 6c 75 65 50 74 72 20 3d 20 6c 69     valuePtr = li
35f0: 73 74 52 65 70 50 74 72 2d 3e 65 6c 65 6d 65 6e  stRepPtr->elemen
3600: 74 73 5b 76 61 6c 49 6e 64 65 78 5d 3b 0a 2b 09  ts[valIndex];.+.
3610: 09 09 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 2b  ..    } else {.+
3620: 09 09 09 09 2f 2a 20 49 66 20 70 6f 73 73 69 62  ..../* If possib
3630: 6c 65 20 77 65 20 6b 69 6c 6c 20 74 68 65 20 72  le we kill the r
3640: 65 66 65 72 65 6e 63 65 0a 2b 09 09 09 09 20 2a  eference.+.... *
3650: 20 69 6e 20 74 68 65 20 76 61 72 20 41 53 41 50   in the var ASAP
3660: 2c 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 62 65  , in order to be
3670: 20 73 75 72 65 0a 2b 09 09 09 09 20 2a 20 74 68   sure.+.... * th
3680: 61 74 20 74 68 65 20 61 72 69 74 68 53 65 72 69  at the arithSeri
3690: 65 73 20 57 69 64 65 20 6f 62 6a 65 63 74 20 69  es Wide object i
36a0: 73 20 6e 6f 74 0a 2b 09 09 09 09 20 2a 20 73 68  s not.+.... * sh
36b0: 61 72 65 64 20 6a 75 73 74 20 62 65 63 61 75 65  ared just becaue
36c0: 73 20 6f 66 20 69 74 2e 20 2a 2f 0a 2b 09 09 09  s of it. */.+...
36d0: 09 69 66 20 28 69 6e 6c 69 6e 65 56 61 72 41 63  .if (inlineVarAc
36e0: 63 65 73 73 29 20 7b 0a 2b 09 09 09 09 20 20 20  cess) {.+....   
36f0: 20 69 66 20 28 76 61 72 50 74 72 2d 3e 76 61 6c   if (varPtr->val
3700: 75 65 2e 6f 62 6a 50 74 72 20 3d 3d 0a 2b 09 09  ue.objPtr ==.+..
3710: 09 09 20 20 20 20 20 20 20 20 61 72 69 74 68 53  ..        arithS
3720: 65 72 69 65 73 52 65 70 50 74 72 2d 3e 77 69 64  eriesRepPtr->wid
3730: 65 4f 62 6a 50 74 72 29 0a 2b 09 09 09 09 20 20  eObjPtr).+....  
3740: 20 20 7b 0a 2b 09 09 09 09 09 54 63 6c 5f 44 65    {.+.....Tcl_De
3750: 63 72 52 65 66 43 6f 75 6e 74 28 76 61 72 50 74  crRefCount(varPt
3760: 72 2d 3e 76 61 6c 75 65 2e 6f 62 6a 50 74 72 29  r->value.objPtr)
3770: 3b 0a 2b 09 09 09 09 09 76 61 72 50 74 72 2d 3e  ;.+.....varPtr->
3780: 76 61 6c 75 65 2e 6f 62 6a 50 74 72 20 3d 20 4e  value.objPtr = N
3790: 55 4c 4c 3b 0a 2b 09 09 09 09 20 20 20 20 7d 0a  ULL;.+....    }.
37a0: 2b 09 09 09 09 7d 0a 2b 09 09 09 09 2f 2a 20 54  +....}.+..../* T
37b0: 72 79 20 74 6f 20 72 65 75 73 65 20 74 68 65 20  ry to reuse the 
37c0: 73 61 6d 65 20 6f 62 6a 65 63 74 20 66 6f 72 20  same object for 
37d0: 65 76 65 72 79 0a 2b 09 09 09 09 20 2a 20 69 6e  every.+.... * in
37e0: 74 65 72 61 74 69 6f 6e 2e 20 2a 2f 0a 2b 09 09  teration. */.+..
37f0: 09 09 69 66 20 28 61 72 69 74 68 53 65 72 69 65  ..if (arithSerie
3800: 73 52 65 70 50 74 72 2d 3e 77 69 64 65 4f 62 6a  sRepPtr->wideObj
3810: 50 74 72 2d 3e 74 79 70 65 50 74 72 20 21 3d 0a  Ptr->typePtr !=.
3820: 2b 09 09 09 09 09 09 26 74 63 6c 57 69 64 65 49  +......&tclWideI
3830: 6e 74 54 79 70 65 20 7c 7c 0a 2b 09 09 09 09 20  ntType ||.+.... 
3840: 20 20 20 54 63 6c 5f 49 73 53 68 61 72 65 64 28     Tcl_IsShared(
3850: 61 72 69 74 68 53 65 72 69 65 73 52 65 70 50 74  arithSeriesRepPt
3860: 72 2d 3e 77 69 64 65 4f 62 6a 50 74 72 29 29 0a  r->wideObjPtr)).
3870: 2b 09 09 09 09 7b 0a 2b 09 09 09 09 20 20 20 20  +....{.+....    
3880: 54 63 6c 5f 44 65 63 72 52 65 66 43 6f 75 6e 74  Tcl_DecrRefCount
3890: 28 61 72 69 74 68 53 65 72 69 65 73 52 65 70 50  (arithSeriesRepP
38a0: 74 72 2d 3e 77 69 64 65 4f 62 6a 50 74 72 29 3b  tr->wideObjPtr);
38b0: 0a 2b 09 09 09 09 20 20 20 20 61 72 69 74 68 53  .+....    arithS
38c0: 65 72 69 65 73 52 65 70 50 74 72 2d 3e 77 69 64  eriesRepPtr->wid
38d0: 65 4f 62 6a 50 74 72 20 3d 20 54 63 6c 5f 4e 65  eObjPtr = Tcl_Ne
38e0: 77 57 69 64 65 49 6e 74 4f 62 6a 28 30 29 3b 0a  wWideIntObj(0);.
38f0: 2b 09 09 09 09 20 20 20 20 54 63 6c 5f 49 6e 63  +....    Tcl_Inc
3900: 72 52 65 66 43 6f 75 6e 74 28 61 72 69 74 68 53  rRefCount(arithS
3910: 65 72 69 65 73 52 65 70 50 74 72 2d 3e 77 69 64  eriesRepPtr->wid
3920: 65 4f 62 6a 50 74 72 29 3b 0a 2b 09 09 09 09 7d  eObjPtr);.+....}
3930: 0a 2b 09 09 09 09 76 61 6c 75 65 50 74 72 20 3d  .+....valuePtr =
3940: 20 61 72 69 74 68 53 65 72 69 65 73 52 65 70 50   arithSeriesRepP
3950: 74 72 2d 3e 77 69 64 65 4f 62 6a 50 74 72 3b 0a  tr->wideObjPtr;.
3960: 2b 09 09 09 09 76 61 6c 75 65 50 74 72 2d 3e 69  +....valuePtr->i
3970: 6e 74 65 72 6e 61 6c 52 65 70 2e 77 69 64 65 56  nternalRep.wideV
3980: 61 6c 75 65 20 3d 0a 2b 09 09 09 09 09 61 72 69  alue =.+.....ari
3990: 74 68 53 65 72 69 65 73 52 65 70 50 74 72 2d 3e  thSeriesRepPtr->
39a0: 73 74 61 72 74 2b 0a 2b 09 09 09 09 09 28 76 61  start+.+.....(va
39b0: 6c 49 6e 64 65 78 2a 61 72 69 74 68 53 65 72 69  lIndex*arithSeri
39c0: 65 73 52 65 70 50 74 72 2d 3e 73 74 65 70 29 3b  esRepPtr->step);
39d0: 0a 2b 09 20 20 20 20 09 09 09 54 63 6c 5f 49 6e  .+.    ...Tcl_In
39e0: 76 61 6c 69 64 61 74 65 53 74 72 69 6e 67 52 65  validateStringRe
39f0: 70 28 76 61 6c 75 65 50 74 72 29 3b 0a 2b 09 09  p(valuePtr);.+..
3a00: 09 20 20 20 20 7d 0a 2b 09 09 09 7d 0a 2b 09 09  .    }.+...}.+..
3a10: 09 20 20 20 20 0a 2b 09 09 09 69 66 20 28 69 6e  .    .+...if (in
3a20: 6c 69 6e 65 56 61 72 41 63 63 65 73 73 29 20 7b  lineVarAccess) {
3a30: 0a 20 09 09 09 20 20 20 20 76 61 6c 75 65 32 50  . ...    value2P
3a40: 74 72 20 3d 20 76 61 72 50 74 72 2d 3e 76 61 6c  tr = varPtr->val
3a50: 75 65 2e 6f 62 6a 50 74 72 3b 0a 20 09 09 09 20  ue.objPtr;. ... 
3a60: 20 20 20 69 66 20 28 76 61 6c 75 65 50 74 72 20     if (valuePtr 
3a70: 21 3d 20 76 61 6c 75 65 32 50 74 72 29 20 7b 0a  != value2Ptr) {.
3a80: 20 09 09 09 09 69 66 20 28 76 61 6c 75 65 32 50   ....if (value2P
3a90: 74 72 20 21 3d 20 4e 55 4c 4c 29 20 7b 0a 49 6e  tr != NULL) {.In
3aa0: 64 65 78 3a 20 67 65 6e 65 72 69 63 2f 74 63 6c  dex: generic/tcl
3ab0: 49 6e 74 2e 68 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  Int.h.==========
3ac0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
3ad0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
3ae0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
3af0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 52 43 53 20 66 69  =========.RCS fi
3b00: 6c 65 3a 20 2f 63 76 73 72 6f 6f 74 2f 74 63 6c  le: /cvsroot/tcl
3b10: 2f 74 63 6c 2f 67 65 6e 65 72 69 63 2f 74 63 6c  /tcl/generic/tcl
3b20: 49 6e 74 2e 68 2c 76 0a 72 65 74 72 69 65 76 69  Int.h,v.retrievi
3b30: 6e 67 20 72 65 76 69 73 69 6f 6e 20 31 2e 31 38  ng revision 1.18
3b40: 36 0a 64 69 66 66 20 2d 75 20 2d 72 31 2e 31 38  6.diff -u -r1.18
3b50: 36 20 74 63 6c 49 6e 74 2e 68 0a 2d 2d 2d 20 67  6 tclInt.h.--- g
3b60: 65 6e 65 72 69 63 2f 74 63 6c 49 6e 74 2e 68 09  eneric/tclInt.h.
3b70: 32 31 20 4f 63 74 20 32 30 30 34 20 31 37 3a 30  21 Oct 2004 17:0
3b80: 37 3a 33 31 20 2d 30 30 30 30 09 31 2e 31 38 36  7:31 -0000.1.186
3b90: 0a 2b 2b 2b 20 67 65 6e 65 72 69 63 2f 74 63 6c  .+++ generic/tcl
3ba0: 49 6e 74 2e 68 09 32 34 20 4f 63 74 20 32 30 30  Int.h.24 Oct 200
3bb0: 34 20 30 39 3a 33 32 3a 30 35 20 2d 30 30 30 30  4 09:32:05 -0000
3bc0: 0a 40 40 20 2d 31 35 33 37 2c 36 20 2b 31 35 33  .@@ -1537,6 +153
3bd0: 37 2c 31 39 20 40 40 0a 20 7d 20 4c 69 73 74 3b  7,19 @@. } List;
3be0: 0a 20 0a 20 2f 2a 0a 2b 20 2a 20 54 68 65 20 73  . . /*.+ * The s
3bf0: 74 72 75 63 74 75 72 65 20 75 73 65 64 20 66 6f  tructure used fo
3c00: 72 20 74 68 65 20 41 69 72 74 68 53 65 72 69 65  r the AirthSerie
3c10: 73 20 69 6e 74 65 72 6e 61 6c 20 72 65 70 72 65  s internal repre
3c20: 73 65 6e 74 61 74 69 6f 6e 2e 0a 2b 20 2a 20 4e  sentation..+ * N
3c30: 6f 74 65 20 74 68 61 74 20 74 68 65 20 6c 65 6e  ote that the len
3c40: 20 63 61 6e 20 69 6e 20 74 68 65 6f 72 79 20 62   can in theory b
3c50: 65 20 61 6c 77 61 79 73 20 63 6f 6d 70 75 74 65  e always compute
3c60: 64 20 62 79 20 73 74 61 72 74 2c 65 6e 64 2c 73  d by start,end,s
3c70: 74 65 70 0a 2b 20 2a 20 62 75 74 20 69 74 27 73  tep.+ * but it's
3c80: 20 66 61 73 74 65 72 20 74 6f 20 63 61 63 68 65   faster to cache
3c90: 20 69 74 20 69 6e 73 69 64 65 20 74 68 65 20 69   it inside the i
3ca0: 6e 74 65 72 6e 61 6c 20 72 65 70 72 65 73 65 6e  nternal represen
3cb0: 74 61 74 69 6f 6e 2e 0a 2b 20 2a 2f 0a 2b 74 79  tation..+ */.+ty
3cc0: 70 65 64 65 66 20 73 74 72 75 63 74 20 41 72 69  pedef struct Ari
3cd0: 74 68 53 65 72 69 65 73 20 7b 0a 2b 20 20 20 20  thSeries {.+    
3ce0: 54 63 6c 5f 57 69 64 65 49 6e 74 20 73 74 61 72  Tcl_WideInt star
3cf0: 74 3b 0a 2b 20 20 20 20 54 63 6c 5f 57 69 64 65  t;.+    Tcl_Wide
3d00: 49 6e 74 20 65 6e 64 3b 0a 2b 20 20 20 20 54 63  Int end;.+    Tc
3d10: 6c 5f 57 69 64 65 49 6e 74 20 73 74 65 70 3b 0a  l_WideInt step;.
3d20: 2b 20 20 20 20 54 63 6c 5f 57 69 64 65 49 6e 74  +    Tcl_WideInt
3d30: 20 6c 65 6e 3b 0a 2b 20 20 20 20 54 63 6c 5f 4f   len;.+    Tcl_O
3d40: 62 6a 20 2a 77 69 64 65 4f 62 6a 50 74 72 3b 20  bj *wideObjPtr; 
3d50: 2f 2a 20 55 73 65 64 20 74 6f 20 73 70 65 65 64  /* Used to speed
3d60: 75 70 20 5b 66 6f 72 65 61 63 68 5d 20 72 65 75  up [foreach] reu
3d70: 73 69 6e 67 20 74 68 65 20 73 61 6d 65 20 6f 62  sing the same ob
3d80: 6a 2e 20 2a 2f 0a 2b 7d 20 41 72 69 74 68 53 65  j. */.+} ArithSe
3d90: 72 69 65 73 3b 0a 2b 0a 2b 2f 2a 0a 20 20 2a 2d  ries;.+.+/*.  *-
3da0: 2d 2d 2d 2d 2d 2d 2d 2d 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 0a  ---------------.
3de0: 20 20 2a 20 44 61 74 61 20 73 74 72 75 63 74 75    * Data structu
3df0: 72 65 73 20 72 65 6c 61 74 65 64 20 74 6f 20 74  res related to t
3e00: 68 65 20 66 69 6c 65 73 79 73 74 65 6d 20 69 6e  he filesystem in
3e10: 74 65 72 6e 61 6c 73 0a 20 20 2a 2d 2d 2d 2d 2d  ternals.  *-----
3e20: 2d 2d 2d 2d 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 0a 40 40 20 2d  -----------.@@ -
3e60: 31 36 34 32 2c 36 20 2b 31 36 35 35 2c 37 20 40  1642,6 +1655,7 @
3e70: 40 0a 20 65 78 74 65 72 6e 20 54 63 6c 5f 4f 62  @. extern Tcl_Ob
3e80: 6a 54 79 70 65 09 74 63 6c 45 6e 64 4f 66 66 73  jType.tclEndOffs
3e90: 65 74 54 79 70 65 3b 0a 20 65 78 74 65 72 6e 20  etType;. extern 
3ea0: 54 63 6c 5f 4f 62 6a 54 79 70 65 09 74 63 6c 49  Tcl_ObjType.tclI
3eb0: 6e 74 54 79 70 65 3b 0a 20 65 78 74 65 72 6e 20  ntType;. extern 
3ec0: 54 63 6c 5f 4f 62 6a 54 79 70 65 09 74 63 6c 4c  Tcl_ObjType.tclL
3ed0: 69 73 74 54 79 70 65 3b 0a 2b 65 78 74 65 72 6e  istType;.+extern
3ee0: 20 54 63 6c 5f 4f 62 6a 54 79 70 65 09 74 63 6c   Tcl_ObjType.tcl
3ef0: 41 72 69 74 68 53 65 72 69 65 73 54 79 70 65 3b  ArithSeriesType;
3f00: 0a 20 65 78 74 65 72 6e 20 54 63 6c 5f 4f 62 6a  . extern Tcl_Obj
3f10: 54 79 70 65 09 74 63 6c 44 69 63 74 54 79 70 65  Type.tclDictType
3f20: 3b 0a 20 65 78 74 65 72 6e 20 54 63 6c 5f 4f 62  ;. extern Tcl_Ob
3f30: 6a 54 79 70 65 09 74 63 6c 50 72 6f 63 42 6f 64  jType.tclProcBod
3f40: 79 54 79 70 65 3b 0a 20 65 78 74 65 72 6e 20 54  yType;. extern T
3f50: 63 6c 5f 4f 62 6a 54 79 70 65 09 74 63 6c 53 74  cl_ObjType.tclSt
3f60: 72 69 6e 67 54 79 70 65 3b 0a 40 40 20 2d 32 30  ringType;.@@ -20
3f70: 36 32 2c 36 20 2b 32 30 37 36 2c 38 20 40 40 0a  62,6 +2076,8 @@.
3f80: 20 09 09 20 20 20 20 54 63 6c 5f 49 6e 74 65 72   ..    Tcl_Inter
3f90: 70 20 2a 69 6e 74 65 72 70 2c 20 69 6e 74 20 6f  p *interp, int o
3fa0: 62 6a 63 2c 20 54 63 6c 5f 4f 62 6a 20 2a 43 4f  bjc, Tcl_Obj *CO
3fb0: 4e 53 54 20 6f 62 6a 76 5b 5d 29 29 3b 0a 20 45  NST objv[]));. E
3fc0: 58 54 45 52 4e 20 69 6e 74 09 54 63 6c 5f 50 77  XTERN int.Tcl_Pw
3fd0: 64 4f 62 6a 43 6d 64 20 5f 41 4e 53 49 5f 41 52  dObjCmd _ANSI_AR
3fe0: 47 53 5f 28 28 43 6c 69 65 6e 74 44 61 74 61 20  GS_((ClientData 
3ff0: 63 6c 69 65 6e 74 44 61 74 61 2c 0a 20 09 09 20  clientData,. .. 
4000: 20 20 20 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69     Tcl_Interp *i
4010: 6e 74 65 72 70 2c 20 69 6e 74 20 6f 62 6a 63 2c  nterp, int objc,
4020: 20 54 63 6c 5f 4f 62 6a 20 2a 43 4f 4e 53 54 20   Tcl_Obj *CONST 
4030: 6f 62 6a 76 5b 5d 29 29 3b 0a 2b 45 58 54 45 52  objv[]));.+EXTER
4040: 4e 20 69 6e 74 09 54 63 6c 5f 52 61 6e 67 65 4f  N int.Tcl_RangeO
4050: 62 6a 43 6d 64 20 5f 41 4e 53 49 5f 41 52 47 53  bjCmd _ANSI_ARGS
4060: 5f 28 28 43 6c 69 65 6e 74 44 61 74 61 20 63 6c  _((ClientData cl
4070: 69 65 6e 74 44 61 74 61 2c 0a 2b 09 09 20 20 20  ientData,.+..   
4080: 20 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74   Tcl_Interp *int
4090: 65 72 70 2c 20 69 6e 74 20 6f 62 6a 63 2c 20 54  erp, int objc, T
40a0: 63 6c 5f 4f 62 6a 20 2a 43 4f 4e 53 54 20 6f 62  cl_Obj *CONST ob
40b0: 6a 76 5b 5d 29 29 3b 0a 20 45 58 54 45 52 4e 20  jv[]));. EXTERN 
40c0: 69 6e 74 09 54 63 6c 5f 52 65 61 64 4f 62 6a 43  int.Tcl_ReadObjC
40d0: 6d 64 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28  md _ANSI_ARGS_((
40e0: 43 6c 69 65 6e 74 44 61 74 61 20 63 6c 69 65 6e  ClientData clien
40f0: 74 44 61 74 61 2c 0a 20 09 09 20 20 20 20 54 63  tData,. ..    Tc
4100: 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70  l_Interp *interp
4110: 2c 20 69 6e 74 20 6f 62 6a 63 2c 20 54 63 6c 5f  , int objc, Tcl_
4120: 4f 62 6a 20 2a 43 4f 4e 53 54 20 6f 62 6a 76 5b  Obj *CONST objv[
4130: 5d 29 29 3b 0a 20 45 58 54 45 52 4e 20 69 6e 74  ]));. EXTERN int
4140: 09 54 63 6c 5f 52 65 67 65 78 70 4f 62 6a 43 6d  .Tcl_RegexpObjCm
4150: 64 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 43  d _ANSI_ARGS_((C
4160: 6c 69 65 6e 74 44 61 74 61 20 63 6c 69 65 6e 74  lientData client
4170: 44 61 74 61 2c 0a 49 6e 64 65 78 3a 20 67 65 6e  Data,.Index: gen
4180: 65 72 69 63 2f 74 63 6c 4c 69 73 74 4f 62 6a 2e  eric/tclListObj.
4190: 63 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  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 0a 52 43 53 20 66 69 6c 65 3a 20  =====.RCS file: 
41e0: 2f 63 76 73 72 6f 6f 74 2f 74 63 6c 2f 74 63 6c  /cvsroot/tcl/tcl
41f0: 2f 67 65 6e 65 72 69 63 2f 74 63 6c 4c 69 73 74  /generic/tclList
4200: 4f 62 6a 2e 63 2c 76 0a 72 65 74 72 69 65 76 69  Obj.c,v.retrievi
4210: 6e 67 20 72 65 76 69 73 69 6f 6e 20 31 2e 31 39  ng revision 1.19
4220: 0a 64 69 66 66 20 2d 75 20 2d 72 31 2e 31 39 20  .diff -u -r1.19 
4230: 74 63 6c 4c 69 73 74 4f 62 6a 2e 63 0a 2d 2d 2d  tclListObj.c.---
4240: 20 67 65 6e 65 72 69 63 2f 74 63 6c 4c 69 73 74   generic/tclList
4250: 4f 62 6a 2e 63 09 32 39 20 53 65 70 20 32 30 30  Obj.c.29 Sep 200
4260: 34 20 32 32 3a 31 37 3a 33 30 20 2d 30 30 30 30  4 22:17:30 -0000
4270: 09 31 2e 31 39 0a 2b 2b 2b 20 67 65 6e 65 72 69  .1.19.+++ generi
4280: 63 2f 74 63 6c 4c 69 73 74 4f 62 6a 2e 63 09 32  c/tclListObj.c.2
4290: 34 20 4f 63 74 20 32 30 30 34 20 30 39 3a 33 32  4 Oct 2004 09:32
42a0: 3a 30 39 20 2d 30 30 30 30 0a 40 40 20 2d 31 35  :09 -0000.@@ -15
42b0: 36 36 2c 36 20 2b 31 35 36 36 2c 33 33 20 40 40  66,6 +1566,33 @@
42c0: 0a 20 20 20 20 20 4c 69 73 74 20 2a 6c 69 73 74  .     List *list
42d0: 52 65 70 50 74 72 3b 0a 20 0a 20 20 20 20 20 2f  RepPtr;. .     /
42e0: 2a 0a 2b 20 20 20 20 20 2a 20 43 6f 6e 76 65 72  *.+     * Conver
42f0: 74 69 6f 6e 20 66 72 6f 6d 20 41 72 69 74 68 6d  tion from Arithm
4300: 65 74 69 63 20 53 65 72 69 65 73 20 69 73 20 61  etic Series is a
4310: 20 73 70 65 63 69 61 6c 20 63 61 73 65 0a 2b 20   special case.+ 
4320: 20 20 20 20 2a 20 62 65 63 61 75 73 65 20 69 74      * because it
4330: 20 63 61 6e 20 62 65 20 64 6f 6e 65 20 61 6e 20   can be done an 
4340: 6f 72 64 65 72 20 6f 66 20 6d 61 67 6e 69 74 75  order of magnitu
4350: 64 65 20 66 61 73 74 65 72 0a 2b 20 20 20 20 20  de faster.+     
4360: 2a 20 61 6e 64 20 6d 61 79 20 6f 63 63 75 72 20  * and may occur 
4370: 66 72 65 71 75 65 6e 74 6c 79 2e 0a 2b 20 20 20  frequently..+   
4380: 20 20 2a 2f 0a 2b 20 20 20 20 69 66 20 28 6f 62    */.+    if (ob
4390: 6a 50 74 72 2d 3e 74 79 70 65 50 74 72 20 3d 3d  jPtr->typePtr ==
43a0: 20 26 74 63 6c 41 72 69 74 68 53 65 72 69 65 73   &tclArithSeries
43b0: 54 79 70 65 29 20 7b 0a 2b 20 20 20 20 20 20 20  Type) {.+       
43c0: 20 54 63 6c 5f 57 69 64 65 49 6e 74 20 77 69 64   Tcl_WideInt wid
43d0: 65 4c 65 6e 20 3d 20 54 63 6c 5f 41 72 69 74 68  eLen = Tcl_Arith
43e0: 53 65 72 69 65 73 4f 62 6a 4c 65 6e 67 74 68 28  SeriesObjLength(
43f0: 6f 62 6a 50 74 72 29 2c 20 6a 3b 0a 2b 20 20 20  objPtr), j;.+   
4400: 20 20 20 20 20 41 72 69 74 68 53 65 72 69 65 73       ArithSeries
4410: 20 2a 61 72 69 74 68 53 65 72 69 65 73 52 65 70   *arithSeriesRep
4420: 50 74 72 20 3d 20 28 41 72 69 74 68 53 65 72 69  Ptr = (ArithSeri
4430: 65 73 2a 29 0a 2b 09 09 6f 62 6a 50 74 72 2d 3e  es*).+..objPtr->
4440: 69 6e 74 65 72 6e 61 6c 52 65 70 2e 74 77 6f 50  internalRep.twoP
4450: 74 72 56 61 6c 75 65 2e 70 74 72 31 3b 0a 2b 0a  trValue.ptr1;.+.
4460: 2b 09 65 6c 65 6d 50 74 72 73 20 3d 20 28 54 63  +.elemPtrs = (Tc
4470: 6c 5f 4f 62 6a 2a 2a 29 20 63 6b 61 6c 6c 6f 63  l_Obj**) ckalloc
4480: 28 73 69 7a 65 6f 66 28 54 63 6c 5f 4f 62 6a 2a  (sizeof(Tcl_Obj*
4490: 29 2a 77 69 64 65 4c 65 6e 29 3b 0a 2b 09 66 6f  )*wideLen);.+.fo
44a0: 72 20 28 6a 20 3d 20 30 3b 20 6a 20 3c 20 77 69  r (j = 0; j < wi
44b0: 64 65 4c 65 6e 3b 20 6a 2b 2b 29 20 7b 0a 2b 09  deLen; j++) {.+.
44c0: 09 65 6c 65 6d 50 74 72 73 5b 6a 5d 20 3d 20 54  .elemPtrs[j] = T
44d0: 63 6c 5f 4e 65 77 57 69 64 65 49 6e 74 4f 62 6a  cl_NewWideIntObj
44e0: 28 0a 2b 09 09 09 61 72 69 74 68 53 65 72 69 65  (.+...arithSerie
44f0: 73 52 65 70 50 74 72 2d 3e 73 74 61 72 74 2b 28  sRepPtr->start+(
4500: 6a 2a 61 72 69 74 68 53 65 72 69 65 73 52 65 70  j*arithSeriesRep
4510: 50 74 72 2d 3e 73 74 65 70 29 29 3b 0a 2b 09 7d  Ptr->step));.+.}
4520: 0a 2b 20 20 20 20 20 20 20 20 6c 69 73 74 52 65  .+        listRe
4530: 70 50 74 72 20 3d 20 28 4c 69 73 74 20 2a 29 20  pPtr = (List *) 
4540: 63 6b 61 6c 6c 6f 63 28 73 69 7a 65 6f 66 28 4c  ckalloc(sizeof(L
4550: 69 73 74 29 29 3b 0a 2b 20 20 20 20 20 20 20 20  ist));.+        
4560: 6c 69 73 74 52 65 70 50 74 72 2d 3e 6d 61 78 45  listRepPtr->maxE
4570: 6c 65 6d 43 6f 75 6e 74 20 3d 20 77 69 64 65 4c  lemCount = wideL
4580: 65 6e 3b 0a 2b 20 20 20 20 20 20 20 20 6c 69 73  en;.+        lis
4590: 74 52 65 70 50 74 72 2d 3e 65 6c 65 6d 43 6f 75  tRepPtr->elemCou
45a0: 6e 74 20 20 20 20 3d 20 77 69 64 65 4c 65 6e 3b  nt    = wideLen;
45b0: 0a 2b 20 20 20 20 20 20 20 20 6c 69 73 74 52 65  .+        listRe
45c0: 70 50 74 72 2d 3e 65 6c 65 6d 65 6e 74 73 20 20  pPtr->elements  
45d0: 20 20 20 3d 20 65 6c 65 6d 50 74 72 73 3b 0a 2b     = elemPtrs;.+
45e0: 0a 2b 20 20 20 20 20 20 20 20 54 63 6c 46 72 65  .+        TclFre
45f0: 65 49 6e 74 52 65 70 28 6f 62 6a 50 74 72 29 3b  eIntRep(objPtr);
4600: 0a 2b 20 20 20 20 20 20 20 20 6f 62 6a 50 74 72  .+        objPtr
4610: 2d 3e 69 6e 74 65 72 6e 61 6c 52 65 70 2e 74 77  ->internalRep.tw
4620: 6f 50 74 72 56 61 6c 75 65 2e 70 74 72 31 20 3d  oPtrValue.ptr1 =
4630: 20 28 56 4f 49 44 20 2a 29 20 6c 69 73 74 52 65   (VOID *) listRe
4640: 70 50 74 72 3b 0a 2b 20 20 20 20 20 20 20 20 6f  pPtr;.+        o
4650: 62 6a 50 74 72 2d 3e 69 6e 74 65 72 6e 61 6c 52  bjPtr->internalR
4660: 65 70 2e 74 77 6f 50 74 72 56 61 6c 75 65 2e 70  ep.twoPtrValue.p
4670: 74 72 32 20 3d 20 4e 55 4c 4c 3b 0a 2b 20 20 20  tr2 = NULL;.+   
4680: 20 20 20 20 20 6f 62 6a 50 74 72 2d 3e 74 79 70       objPtr->typ
4690: 65 50 74 72 20 3d 20 26 74 63 6c 4c 69 73 74 54  ePtr = &tclListT
46a0: 79 70 65 3b 0a 2b 09 72 65 74 75 72 6e 20 54 43  ype;.+.return TC
46b0: 4c 5f 4f 4b 3b 0a 2b 20 20 20 20 7d 0a 2b 0a 2b  L_OK;.+    }.+.+
46c0: 20 20 20 20 2f 2a 0a 20 20 20 20 20 20 2a 20 47      /*.      * G
46d0: 65 74 20 74 68 65 20 73 74 72 69 6e 67 20 72 65  et the string re
46e0: 70 72 65 73 65 6e 74 61 74 69 6f 6e 2e 20 4d 61  presentation. Ma
46f0: 6b 65 20 69 74 20 75 70 2d 74 6f 2d 64 61 74 65  ke it up-to-date
4700: 20 69 66 20 6e 65 63 65 73 73 61 72 79 2e 0a 20   if necessary.. 
4710: 20 20 20 20 20 2a 2f 0a 20 0a 40 40 20 2d 31 37       */. .@@ -17
4720: 33 33 2c 33 20 2b 31 37 36 30 2c 33 37 32 20 40  33,3 +1760,372 @
4730: 40 0a 20 20 20 20 20 7d 0a 20 20 20 20 20 6c 69  @.     }.     li
4740: 73 74 50 74 72 2d 3e 6c 65 6e 67 74 68 20 3d 20  stPtr->length = 
4750: 64 73 74 20 2d 20 6c 69 73 74 50 74 72 2d 3e 62  dst - listPtr->b
4760: 79 74 65 73 3b 0a 20 7d 0a 2b 0a 2b 2f 2a 20 2d  ytes;. }.+.+/* -
4770: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4780: 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 41 72 69 74 68 53  --------- ArithS
4790: 65 72 69 65 73 20 6f 62 6a 65 63 74 20 2d 2d 2d  eries object ---
47a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
47b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 2a 2f 0a 2b 0a 2b  --------- */.+.+
47c0: 2f 2a 0a 2b 20 2a 20 50 72 6f 74 6f 74 79 70 65  /*.+ * Prototype
47d0: 73 20 66 6f 72 20 70 72 6f 63 65 64 75 72 65 73  s for procedures
47e0: 20 64 65 66 69 6e 65 64 20 6c 61 74 65 72 20 69   defined later i
47f0: 6e 20 74 68 69 73 20 66 69 6c 65 3a 0a 2b 20 2a  n this file:.+ *
4800: 2f 0a 2b 0a 2b 73 74 61 74 69 63 20 76 6f 69 64  /.+.+static void
4810: 09 09 44 75 70 41 72 69 74 68 53 65 72 69 65 73  ..DupArithSeries
4820: 49 6e 74 65 72 6e 61 6c 52 65 70 20 5f 41 4e 53  InternalRep _ANS
4830: 49 5f 41 52 47 53 5f 28 28 54 63 6c 5f 4f 62 6a  I_ARGS_((Tcl_Obj
4840: 20 2a 73 72 63 50 74 72 2c 0a 2b 09 09 09 20 20   *srcPtr,.+...  
4850: 20 20 54 63 6c 5f 4f 62 6a 20 2a 63 6f 70 79 50    Tcl_Obj *copyP
4860: 74 72 29 29 3b 0a 2b 73 74 61 74 69 63 20 76 6f  tr));.+static vo
4870: 69 64 09 09 46 72 65 65 41 72 69 74 68 53 65 72  id..FreeArithSer
4880: 69 65 73 49 6e 74 65 72 6e 61 6c 52 65 70 20 5f  iesInternalRep _
4890: 41 4e 53 49 5f 41 52 47 53 5f 28 28 54 63 6c 5f  ANSI_ARGS_((Tcl_
48a0: 4f 62 6a 20 2a 6c 69 73 74 50 74 72 29 29 3b 0a  Obj *listPtr));.
48b0: 2b 73 74 61 74 69 63 20 69 6e 74 09 09 53 65 74  +static int..Set
48c0: 41 72 69 74 68 53 65 72 69 65 73 46 72 6f 6d 41  ArithSeriesFromA
48d0: 6e 79 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28  ny _ANSI_ARGS_((
48e0: 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65  Tcl_Interp *inte
48f0: 72 70 2c 0a 2b 09 09 09 20 20 20 20 54 63 6c 5f  rp,.+...    Tcl_
4900: 4f 62 6a 20 2a 6f 62 6a 50 74 72 29 29 3b 0a 2b  Obj *objPtr));.+
4910: 73 74 61 74 69 63 20 76 6f 69 64 09 09 55 70 64  static void..Upd
4920: 61 74 65 53 74 72 69 6e 67 4f 66 41 72 69 74 68  ateStringOfArith
4930: 53 65 72 69 65 73 20 5f 41 4e 53 49 5f 41 52 47  Series _ANSI_ARG
4940: 53 5f 28 28 54 63 6c 5f 4f 62 6a 20 2a 6c 69 73  S_((Tcl_Obj *lis
4950: 74 50 74 72 29 29 3b 0a 2b 0a 2b 2f 2a 0a 2b 20  tPtr));.+.+/*.+ 
4960: 2a 20 54 68 65 20 73 74 72 75 63 74 75 72 65 20  * The structure 
4970: 62 65 6c 6f 77 20 64 65 66 69 6e 65 73 20 74 68  below defines th
4980: 65 20 61 72 69 74 68 6d 65 74 69 63 20 73 65 72  e arithmetic ser
4990: 69 65 73 20 54 63 6c 20 6f 62 6a 65 63 74 20 74  ies Tcl object t
49a0: 79 70 65 20 62 79 0a 2b 20 2a 20 6d 65 61 6e 73  ype by.+ * means
49b0: 20 6f 66 20 70 72 6f 63 65 64 75 72 65 73 20 74   of procedures t
49c0: 68 61 74 20 63 61 6e 20 62 65 20 69 6e 76 6f 6b  hat can be invok
49d0: 65 64 20 62 79 20 67 65 6e 65 72 69 63 20 6f 62  ed by generic ob
49e0: 6a 65 63 74 20 63 6f 64 65 2e 0a 2b 20 2a 0a 2b  ject code..+ *.+
49f0: 20 2a 20 54 68 65 20 61 72 69 74 68 6d 65 74 69   * The arithmeti
4a00: 63 20 73 65 72 69 65 73 20 6f 62 6a 65 63 74 20  c series object 
4a10: 69 73 20 61 20 73 70 65 63 69 61 6c 20 63 61 73  is a special cas
4a20: 65 20 6f 66 20 54 63 6c 20 6c 69 73 74 20 72 65  e of Tcl list re
4a30: 70 72 65 73 65 6e 74 69 6e 67 0a 2b 20 2a 20 61  presenting.+ * a
4a40: 6e 20 69 6e 74 65 72 76 61 6c 20 6f 66 20 61 6e  n interval of an
4a50: 20 61 72 69 74 68 6d 65 74 69 63 20 73 65 72 69   arithmetic seri
4a60: 65 73 20 69 6e 20 63 6f 6e 73 74 61 6e 74 20 73  es in constant s
4a70: 70 61 63 65 2e 0a 2b 20 2a 20 0a 2b 20 2a 20 54  pace..+ * .+ * T
4a80: 68 65 20 61 72 69 74 68 6d 65 74 69 63 20 73 65  he arithmetic se
4a90: 72 69 65 73 20 69 73 20 69 6e 74 65 72 6e 61 6c  ries is internal
4aa0: 6c 79 20 72 65 70 72 65 73 65 6e 74 65 64 20 77  ly represented w
4ab0: 69 74 68 20 74 68 72 65 65 20 69 6e 74 65 67 65  ith three intege
4ac0: 72 73 2c 0a 2b 20 2a 20 2a 73 74 61 72 74 2a 2c  rs,.+ * *start*,
4ad0: 20 2a 65 6e 64 2a 2c 20 61 6e 64 20 2a 73 74 65   *end*, and *ste
4ae0: 70 2a 2c 20 57 68 65 72 65 20 74 68 65 20 6c 65  p*, Where the le
4af0: 6e 67 74 68 20 69 73 20 63 61 6c 63 75 6c 61 74  ngth is calculat
4b00: 65 64 20 77 69 74 68 0a 2b 20 2a 20 74 68 65 20  ed with.+ * the 
4b10: 66 6f 6c 6c 6f 77 69 6e 67 20 61 6c 67 6f 72 69  following algori
4b20: 74 68 6d 3a 0a 2b 20 2a 0a 2b 20 2a 20 69 66 20  thm:.+ *.+ * if 
4b30: 52 41 4e 47 45 20 3d 3d 20 30 20 54 48 45 4e 0a  RANGE == 0 THEN.
4b40: 2b 20 2a 20 20 20 45 52 52 4f 52 0a 2b 20 2a 20  + *   ERROR.+ * 
4b50: 69 66 20 52 41 4e 47 45 20 3e 20 30 0a 2b 20 2a  if RANGE > 0.+ *
4b60: 20 20 20 4c 45 4e 20 69 73 20 28 28 28 45 4e 44     LEN is (((END
4b70: 2d 53 54 41 52 54 29 2d 31 29 2f 53 54 45 50 29  -START)-1)/STEP)
4b80: 20 2b 20 31 0a 2b 20 2a 20 65 6c 73 65 20 69 66   + 1.+ * else if
4b90: 20 52 41 4e 47 45 20 3c 20 30 0a 2b 20 2a 20 20   RANGE < 0.+ *  
4ba0: 20 4c 45 4e 20 69 73 20 28 28 28 45 4e 44 2d 53   LEN is (((END-S
4bb0: 54 41 52 54 29 2d 31 29 2f 53 54 45 50 29 20 2d  TART)-1)/STEP) -
4bc0: 20 31 0a 2b 20 2a 0a 2b 20 2a 20 41 6e 64 20 77   1.+ *.+ * And w
4bd0: 68 65 72 65 20 74 68 65 20 65 71 75 69 76 61 6c  here the equival
4be0: 65 6e 74 27 73 20 6c 69 73 74 20 49 2d 74 68 20  ent's list I-th 
4bf0: 65 6c 65 6d 65 6e 74 20 69 73 20 63 61 6c 63 75  element is calcu
4c00: 6c 61 74 65 64 0a 2b 20 2a 20 61 73 3a 0a 2b 20  lated.+ * as:.+ 
4c10: 2a 0a 2b 20 2a 20 4c 49 53 54 5b 69 5d 20 3d 20  *.+ * LIST[i] = 
4c20: 53 54 41 52 54 2b 28 53 54 45 50 2a 69 29 0a 2b  START+(STEP*i).+
4c30: 20 2a 0a 2b 20 2a 20 5a 65 72 6f 20 65 6c 65 6d   *.+ * Zero elem
4c40: 65 6e 74 73 20 72 61 6e 67 65 73 2c 20 6c 69 6b  ents ranges, lik
4c50: 65 20 69 6e 20 74 68 65 20 63 61 73 65 20 6f 66  e in the case of
4c60: 20 53 54 41 52 54 3d 31 30 20 45 4e 44 3d 31 30   START=10 END=10
4c70: 20 53 54 45 50 3d 31 0a 2b 20 2a 20 61 72 65 20   STEP=1.+ * are 
4c80: 76 61 6c 69 64 20 61 6e 64 20 77 69 6c 6c 20 62  valid and will b
4c90: 65 20 65 71 75 69 76 61 6c 65 6e 74 20 74 6f 20  e equivalent to 
4ca0: 74 68 65 20 65 6d 70 74 79 20 6c 69 73 74 2e 0a  the empty list..
4cb0: 2b 20 2a 2f 0a 2b 0a 2b 54 63 6c 5f 4f 62 6a 54  + */.+.+Tcl_ObjT
4cc0: 79 70 65 20 74 63 6c 41 72 69 74 68 53 65 72 69  ype tclArithSeri
4cd0: 65 73 54 79 70 65 20 3d 20 7b 0a 2b 20 20 20 20  esType = {.+    
4ce0: 22 61 72 69 74 68 73 65 72 69 65 73 22 2c 09 09  "arithseries",..
4cf0: 09 2f 2a 20 6e 61 6d 65 20 2a 2f 0a 2b 20 20 20  ./* name */.+   
4d00: 20 46 72 65 65 41 72 69 74 68 53 65 72 69 65 73   FreeArithSeries
4d10: 49 6e 74 65 72 6e 61 6c 52 65 70 2c 09 09 2f 2a  InternalRep,../*
4d20: 20 66 72 65 65 49 6e 74 52 65 70 50 72 6f 63 20   freeIntRepProc 
4d30: 2a 2f 0a 2b 20 20 20 20 44 75 70 41 72 69 74 68  */.+    DupArith
4d40: 53 65 72 69 65 73 49 6e 74 65 72 6e 61 6c 52 65  SeriesInternalRe
4d50: 70 2c 09 09 2f 2a 20 64 75 70 49 6e 74 52 65 70  p,../* dupIntRep
4d60: 50 72 6f 63 20 2a 2f 0a 2b 20 20 20 20 55 70 64  Proc */.+    Upd
4d70: 61 74 65 53 74 72 69 6e 67 4f 66 41 72 69 74 68  ateStringOfArith
4d80: 53 65 72 69 65 73 2c 09 09 2f 2a 20 75 70 64 61  Series,../* upda
4d90: 74 65 53 74 72 69 6e 67 50 72 6f 63 20 2a 2f 0a  teStringProc */.
4da0: 2b 20 20 20 20 53 65 74 41 72 69 74 68 53 65 72  +    SetArithSer
4db0: 69 65 73 46 72 6f 6d 41 6e 79 09 09 2f 2a 20 73  iesFromAny../* s
4dc0: 65 74 46 72 6f 6d 41 6e 79 50 72 6f 63 20 2a 2f  etFromAnyProc */
4dd0: 0a 2b 7d 3b 0a 2b 0a 2b 2f 2a 0a 2b 20 2a 2d 2d  .+};.+.+/*.+ *--
4de0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4df0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4e00: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4e10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4e20: 2d 2d 2d 2d 0a 2b 20 2a 0a 2b 20 2a 20 41 72 69  ----.+ *.+ * Ari
4e30: 74 68 53 65 72 69 65 73 4c 65 6e 20 2d 2d 0a 2b  thSeriesLen --.+
4e40: 20 2a 0a 2b 20 2a 20 09 43 6f 6d 70 75 74 65 20   *.+ * .Compute 
4e50: 74 68 65 20 6c 65 6e 67 74 68 20 6f 66 20 74 68  the length of th
4e60: 65 20 65 71 75 69 76 61 6c 65 6e 74 20 6c 69 73  e equivalent lis
4e70: 74 20 77 68 65 72 65 0a 2b 20 2a 20 09 65 76 65  t where.+ * .eve
4e80: 72 79 20 65 6c 65 6d 65 6e 74 20 69 73 20 67 65  ry element is ge
4e90: 6e 65 72 61 74 65 64 20 73 74 61 72 74 69 6e 67  nerated starting
4ea0: 20 66 72 6f 6d 20 2a 73 74 61 72 74 2a 2c 0a 2b   from *start*,.+
4eb0: 20 2a 20 09 61 6e 64 20 61 64 64 69 6e 67 20 2a   * .and adding *
4ec0: 73 74 65 70 2a 20 74 6f 20 67 65 6e 65 72 61 74  step* to generat
4ed0: 65 20 65 76 65 72 79 20 73 75 63 63 65 73 73 69  e every successi
4ee0: 76 65 20 65 6c 65 6d 65 6e 74 0a 2b 20 2a 20 09  ve element.+ * .
4ef0: 74 68 61 74 27 73 20 3c 20 2a 65 6e 64 2a 20 66  that's < *end* f
4f00: 6f 72 20 70 6f 73 69 74 69 76 65 20 73 74 65 70  or positive step
4f10: 73 2c 20 6f 72 20 3e 20 2a 65 6e 64 2a 20 66 6f  s, or > *end* fo
4f20: 72 20 6e 65 67 61 74 69 76 65 0a 2b 20 2a 20 09  r negative.+ * .
4f30: 73 74 65 70 73 2e 0a 2b 20 2a 0a 2b 20 2a 20 52  steps..+ *.+ * R
4f40: 65 73 75 6c 74 73 3a 0a 2b 20 2a 0a 2b 20 2a 20  esults:.+ *.+ * 
4f50: 09 54 68 65 20 6c 65 6e 67 74 68 20 6f 66 20 74  .The length of t
4f60: 68 65 20 6c 69 73 74 20 67 65 6e 65 72 61 74 65  he list generate
4f70: 64 20 62 79 20 74 68 65 20 67 69 76 65 6e 20 72  d by the given r
4f80: 61 6e 67 65 2c 0a 2b 20 2a 20 09 74 68 61 74 20  ange,.+ * .that 
4f90: 6d 61 79 20 62 65 20 7a 65 72 6f 2e 0a 2b 20 2a  may be zero..+ *
4fa0: 20 09 54 68 65 20 66 75 6e 63 74 69 6f 6e 20 72   .The function r
4fb0: 65 74 75 72 6e 73 20 2d 31 20 69 66 20 74 68 65  eturns -1 if the
4fc0: 20 6c 69 73 74 20 69 73 20 6f 66 20 6c 65 6e 67   list is of leng
4fd0: 74 68 20 69 6e 66 69 69 74 65 2e 0a 2b 20 2a 0a  th infiite..+ *.
4fe0: 2b 20 2a 20 53 69 64 65 20 65 66 66 65 63 74 73  + * Side effects
4ff0: 3a 0a 2b 20 2a 0a 2b 20 2a 20 09 4e 6f 6e 65 2e  :.+ *.+ * .None.
5000: 0a 2b 20 2a 0a 2b 20 2a 2d 2d 2d 2d 2d 2d 2d 2d  .+ *.+ *--------
5010: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5020: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5030: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5040: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 2b  --------------.+
5050: 20 2a 2f 0a 2b 73 74 61 74 69 63 20 54 63 6c 5f   */.+static Tcl_
5060: 57 69 64 65 49 6e 74 0a 2b 41 72 69 74 68 53 65  WideInt.+ArithSe
5070: 72 69 65 73 4c 65 6e 28 54 63 6c 5f 57 69 64 65  riesLen(Tcl_Wide
5080: 49 6e 74 20 73 74 61 72 74 2c 20 54 63 6c 5f 57  Int start, Tcl_W
5090: 69 64 65 49 6e 74 20 65 6e 64 2c 20 54 63 6c 5f  ideInt end, Tcl_
50a0: 57 69 64 65 49 6e 74 20 73 74 65 70 29 0a 2b 7b  WideInt step).+{
50b0: 0a 2b 09 54 63 6c 5f 57 69 64 65 49 6e 74 20 6c  .+.Tcl_WideInt l
50c0: 65 6e 3b 0a 2b 0a 2b 09 69 66 20 28 73 74 65 70  en;.+.+.if (step
50d0: 20 3d 3d 20 30 29 20 72 65 74 75 72 6e 20 2d 31   == 0) return -1
50e0: 3b 0a 2b 09 65 6c 73 65 20 69 66 20 28 73 74 65  ;.+.else if (ste
50f0: 70 20 3e 20 30 20 26 26 20 73 74 61 72 74 20 3e  p > 0 && start >
5100: 20 65 6e 64 29 20 72 65 74 75 72 6e 20 2d 31 3b   end) return -1;
5110: 0a 2b 09 65 6c 73 65 20 69 66 20 28 73 74 65 70  .+.else if (step
5120: 20 3c 20 30 20 26 26 20 65 6e 64 20 3e 20 73 74   < 0 && end > st
5130: 61 72 74 29 20 72 65 74 75 72 6e 20 2d 31 3b 0a  art) return -1;.
5140: 2b 09 6c 65 6e 20 3d 20 28 28 73 74 65 70 20 3e  +.len = ((step >
5150: 20 30 29 20 3f 20 31 20 3a 20 2d 31 29 20 2b 20   0) ? 1 : -1) + 
5160: 28 28 28 65 6e 64 2d 73 74 61 72 74 29 2d 31 29  (((end-start)-1)
5170: 2f 73 74 65 70 29 3b 0a 2b 09 72 65 74 75 72 6e  /step);.+.return
5180: 20 28 6c 65 6e 20 3c 20 30 29 20 3f 20 2d 31 20   (len < 0) ? -1 
5190: 3a 20 6c 65 6e 3b 0a 2b 7d 0a 2b 0a 2b 2f 2a 0a  : len;.+}.+.+/*.
51a0: 2b 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  + *-------------
51b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
51c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
51d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
51e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 2b 20 2a 0a 2b 20  ---------.+ *.+ 
51f0: 2a 20 54 63 6c 5f 4e 65 77 41 72 69 74 68 53 65  * Tcl_NewArithSe
5200: 72 69 65 73 4f 62 6a 20 2d 2d 0a 2b 20 2a 0a 2b  riesObj --.+ *.+
5210: 20 2a 09 43 72 65 61 74 65 73 20 61 20 6e 65 77   *.Creates a new
5220: 20 41 72 69 74 68 53 65 72 69 65 73 20 6f 62 6a   ArithSeries obj
5230: 65 63 74 2e 20 54 68 65 20 72 65 74 75 72 6e 65  ect. The returne
5240: 64 20 6f 62 6a 65 63 74 20 68 61 73 0a 2b 20 2a  d object has.+ *
5250: 09 72 65 66 63 6f 75 6e 74 20 3d 20 30 2e 0a 2b  .refcount = 0..+
5260: 20 2a 0a 2b 20 2a 20 52 65 73 75 6c 74 73 3a 0a   *.+ * Results:.
5270: 2b 20 2a 0a 2b 20 2a 20 09 41 20 54 63 6c 5f 4f  + *.+ * .A Tcl_O
5280: 62 6a 20 70 6f 69 6e 74 65 72 20 74 6f 20 74 68  bj pointer to th
5290: 65 20 63 72 65 61 74 65 64 20 41 72 69 74 68 53  e created ArithS
52a0: 65 72 69 65 73 20 6f 62 6a 65 63 74 2e 0a 2b 20  eries object..+ 
52b0: 2a 20 09 41 20 4e 55 4c 4c 20 70 6f 69 6e 74 65  * .A NULL pointe
52c0: 72 20 6f 66 20 74 68 65 20 72 61 6e 67 65 20 69  r of the range i
52d0: 73 20 69 6e 76 61 6c 69 64 2e 0a 2b 20 2a 0a 2b  s invalid..+ *.+
52e0: 20 2a 20 53 69 64 65 20 45 66 66 65 63 74 73 3a   * Side Effects:
52f0: 0a 2b 20 2a 0a 2b 20 2a 20 09 4e 6f 6e 65 2e 0a  .+ *.+ * .None..
5300: 2b 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  + *-------------
5310: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5320: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 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 0a 2b 20 2a 2f 0a 2b  ---------.+ */.+
5350: 54 63 6c 5f 4f 62 6a 20 2a 0a 2b 54 63 6c 5f 4e  Tcl_Obj *.+Tcl_N
5360: 65 77 41 72 69 74 68 53 65 72 69 65 73 4f 62 6a  ewArithSeriesObj
5370: 28 54 63 6c 5f 57 69 64 65 49 6e 74 20 73 74 61  (Tcl_WideInt sta
5380: 72 74 2c 20 54 63 6c 5f 57 69 64 65 49 6e 74 20  rt, Tcl_WideInt 
5390: 65 6e 64 2c 20 54 63 6c 5f 57 69 64 65 49 6e 74  end, Tcl_WideInt
53a0: 20 73 74 65 70 29 0a 2b 7b 0a 2b 20 20 20 20 54   step).+{.+    T
53b0: 63 6c 5f 57 69 64 65 49 6e 74 20 6c 65 6e 20 3d  cl_WideInt len =
53c0: 20 41 72 69 74 68 53 65 72 69 65 73 4c 65 6e 28   ArithSeriesLen(
53d0: 73 74 61 72 74 2c 20 65 6e 64 2c 20 73 74 65 70  start, end, step
53e0: 29 3b 0a 2b 20 20 20 20 54 63 6c 5f 4f 62 6a 20  );.+    Tcl_Obj 
53f0: 2a 61 72 69 74 68 53 65 72 69 65 73 50 74 72 3b  *arithSeriesPtr;
5400: 0a 2b 20 20 20 20 41 72 69 74 68 53 65 72 69 65  .+    ArithSerie
5410: 73 20 2a 61 72 69 74 68 53 65 72 69 65 73 52 65  s *arithSeriesRe
5420: 70 50 74 72 3b 0a 2b 0a 2b 20 20 20 20 69 66 20  pPtr;.+.+    if 
5430: 28 6c 65 6e 20 3d 3d 20 2d 31 29 20 72 65 74 75  (len == -1) retu
5440: 72 6e 20 4e 55 4c 4c 3b 20 2f 2a 20 49 6e 76 61  rn NULL; /* Inva
5450: 6c 69 64 20 72 61 6e 67 65 20 65 72 72 6f 72 20  lid range error 
5460: 2a 2f 0a 2b 20 20 20 20 54 63 6c 4e 65 77 4f 62  */.+    TclNewOb
5470: 6a 28 61 72 69 74 68 53 65 72 69 65 73 50 74 72  j(arithSeriesPtr
5480: 29 3b 0a 2b 0a 2b 20 20 20 20 61 72 69 74 68 53  );.+.+    arithS
5490: 65 72 69 65 73 52 65 70 50 74 72 20 3d 20 28 41  eriesRepPtr = (A
54a0: 72 69 74 68 53 65 72 69 65 73 2a 29 20 63 6b 61  rithSeries*) cka
54b0: 6c 6c 6f 63 28 73 69 7a 65 6f 66 20 28 41 72 69  lloc(sizeof (Ari
54c0: 74 68 53 65 72 69 65 73 29 29 3b 0a 2b 20 20 20  thSeries));.+   
54d0: 20 61 72 69 74 68 53 65 72 69 65 73 52 65 70 50   arithSeriesRepP
54e0: 74 72 2d 3e 73 74 61 72 74 20 3d 20 73 74 61 72  tr->start = star
54f0: 74 3b 0a 2b 20 20 20 20 61 72 69 74 68 53 65 72  t;.+    arithSer
5500: 69 65 73 52 65 70 50 74 72 2d 3e 65 6e 64 20 3d  iesRepPtr->end =
5510: 20 65 6e 64 3b 0a 2b 20 20 20 20 61 72 69 74 68   end;.+    arith
5520: 53 65 72 69 65 73 52 65 70 50 74 72 2d 3e 73 74  SeriesRepPtr->st
5530: 65 70 20 3d 20 73 74 65 70 3b 0a 2b 20 20 20 20  ep = step;.+    
5540: 61 72 69 74 68 53 65 72 69 65 73 52 65 70 50 74  arithSeriesRepPt
5550: 72 2d 3e 6c 65 6e 20 3d 20 6c 65 6e 3b 0a 2b 20  r->len = len;.+ 
5560: 20 20 20 61 72 69 74 68 53 65 72 69 65 73 52 65     arithSeriesRe
5570: 70 50 74 72 2d 3e 77 69 64 65 4f 62 6a 50 74 72  pPtr->wideObjPtr
5580: 20 3d 20 54 63 6c 5f 4e 65 77 57 69 64 65 49 6e   = Tcl_NewWideIn
5590: 74 4f 62 6a 28 30 29 3b 0a 2b 20 20 20 20 54 63  tObj(0);.+    Tc
55a0: 6c 5f 49 6e 63 72 52 65 66 43 6f 75 6e 74 28 61  l_IncrRefCount(a
55b0: 72 69 74 68 53 65 72 69 65 73 52 65 70 50 74 72  rithSeriesRepPtr
55c0: 2d 3e 77 69 64 65 4f 62 6a 50 74 72 29 3b 0a 2b  ->wideObjPtr);.+
55d0: 20 20 20 20 61 72 69 74 68 53 65 72 69 65 73 50      arithSeriesP
55e0: 74 72 2d 3e 69 6e 74 65 72 6e 61 6c 52 65 70 2e  tr->internalRep.
55f0: 74 77 6f 50 74 72 56 61 6c 75 65 2e 70 74 72 31  twoPtrValue.ptr1
5600: 20 3d 20 28 56 4f 49 44 20 2a 29 20 61 72 69 74   = (VOID *) arit
5610: 68 53 65 72 69 65 73 52 65 70 50 74 72 3b 0a 2b  hSeriesRepPtr;.+
5620: 20 20 20 20 61 72 69 74 68 53 65 72 69 65 73 50      arithSeriesP
5630: 74 72 2d 3e 69 6e 74 65 72 6e 61 6c 52 65 70 2e  tr->internalRep.
5640: 74 77 6f 50 74 72 56 61 6c 75 65 2e 70 74 72 32  twoPtrValue.ptr2
5650: 20 3d 20 4e 55 4c 4c 3b 0a 2b 20 20 20 20 61 72   = NULL;.+    ar
5660: 69 74 68 53 65 72 69 65 73 50 74 72 2d 3e 74 79  ithSeriesPtr->ty
5670: 70 65 50 74 72 20 3d 20 26 74 63 6c 41 72 69 74  pePtr = &tclArit
5680: 68 53 65 72 69 65 73 54 79 70 65 3b 0a 2b 20 20  hSeriesType;.+  
5690: 20 20 69 66 20 28 6c 65 6e 20 3e 20 30 29 0a 2b    if (len > 0).+
56a0: 20 20 20 20 09 54 63 6c 5f 49 6e 76 61 6c 69 64      .Tcl_Invalid
56b0: 61 74 65 53 74 72 69 6e 67 52 65 70 28 61 72 69  ateStringRep(ari
56c0: 74 68 53 65 72 69 65 73 50 74 72 29 3b 0a 2b 0a  thSeriesPtr);.+.
56d0: 2b 20 20 20 20 72 65 74 75 72 6e 20 61 72 69 74  +    return arit
56e0: 68 53 65 72 69 65 73 50 74 72 3b 0a 2b 7d 0a 2b  hSeriesPtr;.+}.+
56f0: 0a 2b 0a 2b 2f 2a 0a 2b 20 2a 2d 2d 2d 2d 2d 2d  .+.+/*.+ *------
5700: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5710: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5720: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5730: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5740: 0a 2b 20 2a 0a 2b 20 2a 20 54 63 6c 5f 41 72 69  .+ *.+ * Tcl_Ari
5750: 74 68 53 65 72 69 65 73 4f 62 6a 49 6e 64 65 78  thSeriesObjIndex
5760: 20 2d 2d 0a 2b 20 2a 0a 2b 20 2a 09 52 65 74 75   --.+ *.+ *.Retu
5770: 72 6e 73 20 74 68 65 20 65 6c 65 6d 65 6e 74 20  rns the element 
5780: 77 69 74 68 20 74 68 65 20 73 70 65 63 69 66 69  with the specifi
5790: 65 64 20 69 6e 64 65 78 20 69 6e 20 74 68 65 20  ed index in the 
57a0: 6c 69 73 74 0a 2b 20 2a 09 72 65 70 72 65 73 65  list.+ *.represe
57b0: 6e 74 65 64 20 62 79 20 74 68 65 20 73 70 65 63  nted by the spec
57c0: 69 66 69 65 64 20 41 72 69 74 68 6d 65 6e 74 69  ified Arithmenti
57d0: 63 20 53 65 71 75 65 6e 63 65 20 6f 62 6a 65 63  c Sequence objec
57e0: 74 2e 0a 2b 20 2a 09 49 66 20 74 68 65 20 69 6e  t..+ *.If the in
57f0: 64 65 78 20 69 73 20 6f 75 74 20 6f 66 20 72 61  dex is out of ra
5800: 6e 67 65 2c 20 54 43 4c 5f 45 52 52 4f 52 20 69  nge, TCL_ERROR i
5810: 73 20 72 65 74 75 72 6e 65 64 2c 0a 2b 20 2a 09  s returned,.+ *.
5820: 6f 74 68 65 72 77 69 73 65 20 54 43 4c 5f 4f 4b  otherwise TCL_OK
5830: 20 69 73 20 72 65 74 75 72 6e 65 64 20 61 6e 64   is returned and
5840: 20 74 68 65 20 69 6e 74 65 67 65 72 20 76 61 6c   the integer val
5850: 75 65 20 6f 66 20 74 68 65 0a 2b 20 2a 09 65 6c  ue of the.+ *.el
5860: 65 6d 65 6e 74 20 69 73 20 73 74 6f 72 65 64 20  ement is stored 
5870: 69 6e 20 2a 65 6c 65 6d 65 6e 74 2e 0a 2b 20 2a  in *element..+ *
5880: 0a 2b 20 2a 20 52 65 73 75 6c 74 73 3a 0a 2b 20  .+ * Results:.+ 
5890: 2a 0a 2b 20 2a 20 09 54 43 4c 5f 4f 4b 20 6f 6e  *.+ * .TCL_OK on
58a0: 20 73 75 63 63 65 73 2c 20 54 43 4c 5f 45 52 52   succes, TCL_ERR
58b0: 4f 52 20 6f 6e 20 69 6e 64 65 78 20 6f 75 74 20  OR on index out 
58c0: 6f 66 20 72 61 6e 67 65 2e 0a 2b 20 2a 0a 2b 20  of range..+ *.+ 
58d0: 2a 20 53 69 64 65 20 45 66 66 65 63 74 73 3a 0a  * Side Effects:.
58e0: 2b 20 2a 0a 2b 20 2a 20 09 4f 6e 20 73 75 63 63  + *.+ * .On succ
58f0: 65 73 73 2c 20 74 68 65 20 69 6e 74 65 67 65 72  ess, the integer
5900: 20 70 6f 69 6e 74 65 64 20 62 79 20 2a 65 6c 65   pointed by *ele
5910: 6d 65 6e 74 20 69 73 20 6d 6f 64 69 66 69 65 64  ment is modified
5920: 2e 0a 2b 20 2a 0a 2b 20 2a 2d 2d 2d 2d 2d 2d 2d  ..+ *.+ *-------
5930: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5940: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5950: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5960: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a  ---------------.
5970: 2b 20 2a 2f 0a 2b 0a 2b 69 6e 74 0a 2b 54 63 6c  + */.+.+int.+Tcl
5980: 5f 41 72 69 74 68 53 65 72 69 65 73 4f 62 6a 49  _ArithSeriesObjI
5990: 6e 64 65 78 28 54 63 6c 5f 4f 62 6a 20 2a 61 72  ndex(Tcl_Obj *ar
59a0: 69 74 68 53 65 72 69 65 73 50 74 72 2c 20 54 63  ithSeriesPtr, Tc
59b0: 6c 5f 57 69 64 65 49 6e 74 20 69 6e 64 65 78 2c  l_WideInt index,
59c0: 20 54 63 6c 5f 57 69 64 65 49 6e 74 20 2a 65 6c   Tcl_WideInt *el
59d0: 65 6d 65 6e 74 29 0a 2b 7b 0a 2b 20 20 20 20 41  ement).+{.+    A
59e0: 72 69 74 68 53 65 72 69 65 73 20 2a 61 72 69 74  rithSeries *arit
59f0: 68 53 65 72 69 65 73 52 65 70 50 74 72 3b 0a 2b  hSeriesRepPtr;.+
5a00: 0a 2b 20 20 20 20 69 66 20 28 61 72 69 74 68 53  .+    if (arithS
5a10: 65 72 69 65 73 50 74 72 2d 3e 74 79 70 65 50 74  eriesPtr->typePt
5a20: 72 20 21 3d 20 26 74 63 6c 41 72 69 74 68 53 65  r != &tclArithSe
5a30: 72 69 65 73 54 79 70 65 29 20 7b 0a 2b 20 20 20  riesType) {.+   
5a40: 20 20 20 20 20 54 63 6c 5f 50 61 6e 69 63 28 22       Tcl_Panic("
5a50: 54 63 6c 5f 41 72 69 74 68 53 65 72 69 65 73 4f  Tcl_ArithSeriesO
5a60: 62 6a 49 6e 64 65 78 20 63 61 6c 6c 65 64 20 77  bjIndex called w
5a70: 69 74 68 20 61 20 6e 6f 74 20 41 72 69 74 68 53  ith a not ArithS
5a80: 65 72 69 65 73 20 4f 62 6a 2e 22 29 3b 0a 2b 20  eries Obj.");.+ 
5a90: 20 20 20 7d 0a 2b 20 20 20 20 61 72 69 74 68 53     }.+    arithS
5aa0: 65 72 69 65 73 52 65 70 50 74 72 20 3d 20 28 41  eriesRepPtr = (A
5ab0: 72 69 74 68 53 65 72 69 65 73 2a 29 0a 2b 09 20  rithSeries*).+. 
5ac0: 20 20 20 61 72 69 74 68 53 65 72 69 65 73 50 74     arithSeriesPt
5ad0: 72 2d 3e 69 6e 74 65 72 6e 61 6c 52 65 70 2e 74  r->internalRep.t
5ae0: 77 6f 50 74 72 56 61 6c 75 65 2e 70 74 72 31 3b  woPtrValue.ptr1;
5af0: 0a 2b 20 20 20 20 69 66 20 28 69 6e 64 65 78 20  .+    if (index 
5b00: 3c 20 30 20 7c 7c 20 69 6e 64 65 78 20 3e 3d 20  < 0 || index >= 
5b10: 61 72 69 74 68 53 65 72 69 65 73 52 65 70 50 74  arithSeriesRepPt
5b20: 72 2d 3e 6c 65 6e 29 0a 2b 09 20 20 20 20 72 65  r->len).+.    re
5b30: 74 75 72 6e 20 54 43 4c 5f 45 52 52 4f 52 3b 0a  turn TCL_ERROR;.
5b40: 2b 20 20 20 20 2f 2a 20 4c 69 73 74 5b 69 5d 20  +    /* List[i] 
5b50: 3d 20 53 74 61 72 74 20 2b 20 28 53 74 65 70 20  = Start + (Step 
5b60: 2a 20 69 29 20 2a 2f 0a 2b 20 20 20 20 2a 65 6c  * i) */.+    *el
5b70: 65 6d 65 6e 74 20 3d 20 61 72 69 74 68 53 65 72  ement = arithSer
5b80: 69 65 73 52 65 70 50 74 72 2d 3e 73 74 61 72 74  iesRepPtr->start
5b90: 2b 28 69 6e 64 65 78 2a 61 72 69 74 68 53 65 72  +(index*arithSer
5ba0: 69 65 73 52 65 70 50 74 72 2d 3e 73 74 65 70 29  iesRepPtr->step)
5bb0: 3b 0a 2b 20 20 20 20 72 65 74 75 72 6e 20 54 43  ;.+    return TC
5bc0: 4c 5f 4f 4b 3b 0a 2b 7d 0a 2b 0a 2b 2f 2a 0a 2b  L_OK;.+}.+.+/*.+
5bd0: 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d   *--------------
5be0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5bf0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5c00: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5c10: 2d 2d 2d 2d 2d 2d 2d 2d 0a 2b 20 2a 0a 2b 20 2a  --------.+ *.+ *
5c20: 20 54 63 6c 5f 41 72 69 74 68 53 65 72 69 65 73   Tcl_ArithSeries
5c30: 4f 62 6a 4c 65 6e 67 74 68 0a 2b 20 2a 0a 2b 20  ObjLength.+ *.+ 
5c40: 2a 09 52 65 74 75 72 6e 73 20 74 68 65 20 6c 65  *.Returns the le
5c50: 6e 67 74 68 20 6f 66 20 74 68 65 20 61 72 69 74  ngth of the arit
5c60: 68 6d 65 6e 74 69 63 20 73 65 72 69 65 73 2e 0a  hmentic series..
5c70: 2b 20 2a 0a 2b 20 2a 20 52 65 73 75 6c 74 73 3a  + *.+ * Results:
5c80: 0a 2b 20 2a 0a 2b 20 2a 20 09 54 68 65 20 6c 65  .+ *.+ * .The le
5c90: 6e 67 74 68 20 6f 66 20 74 68 65 20 73 65 72 69  ngth of the seri
5ca0: 65 73 20 61 73 20 54 63 6c 5f 57 69 64 65 49 6e  es as Tcl_WideIn
5cb0: 74 2e 0a 2b 20 2a 0a 2b 20 2a 20 53 69 64 65 20  t..+ *.+ * Side 
5cc0: 45 66 66 65 63 74 73 3a 0a 2b 20 2a 0a 2b 20 2a  Effects:.+ *.+ *
5cd0: 20 09 4e 6f 6e 65 2e 0a 2b 20 2a 0a 2b 20 2a 2d   .None..+ *.+ *-
5ce0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5cf0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5d00: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5d10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5d20: 2d 2d 2d 2d 2d 0a 2b 20 2a 2f 0a 2b 54 63 6c 5f  -----.+ */.+Tcl_
5d30: 57 69 64 65 49 6e 74 20 54 63 6c 5f 41 72 69 74  WideInt Tcl_Arit
5d40: 68 53 65 72 69 65 73 4f 62 6a 4c 65 6e 67 74 68  hSeriesObjLength
5d50: 28 54 63 6c 5f 4f 62 6a 20 2a 61 72 69 74 68 53  (Tcl_Obj *arithS
5d60: 65 72 69 65 73 50 74 72 29 0a 2b 7b 0a 2b 20 20  eriesPtr).+{.+  
5d70: 20 20 41 72 69 74 68 53 65 72 69 65 73 20 2a 61    ArithSeries *a
5d80: 72 69 74 68 53 65 72 69 65 73 52 65 70 50 74 72  rithSeriesRepPtr
5d90: 20 3d 20 28 41 72 69 74 68 53 65 72 69 65 73 2a   = (ArithSeries*
5da0: 29 0a 2b 09 20 20 20 20 61 72 69 74 68 53 65 72  ).+.    arithSer
5db0: 69 65 73 50 74 72 2d 3e 69 6e 74 65 72 6e 61 6c  iesPtr->internal
5dc0: 52 65 70 2e 74 77 6f 50 74 72 56 61 6c 75 65 2e  Rep.twoPtrValue.
5dd0: 70 74 72 31 3b 0a 2b 20 20 20 20 72 65 74 75 72  ptr1;.+    retur
5de0: 6e 20 61 72 69 74 68 53 65 72 69 65 73 52 65 70  n arithSeriesRep
5df0: 50 74 72 2d 3e 6c 65 6e 3b 0a 2b 7d 0a 2b 0a 2b  Ptr->len;.+}.+.+
5e00: 2f 2a 0a 2b 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  /*.+ *----------
5e10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5e20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5e30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5e40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 2b 20 2a  ------------.+ *
5e50: 0a 2b 20 2a 20 46 72 65 65 41 72 69 74 68 53 65  .+ * FreeArithSe
5e60: 72 69 65 73 49 6e 74 65 72 6e 61 6c 52 65 70 20  riesInternalRep 
5e70: 2d 2d 0a 2b 20 2a 0a 2b 20 2a 09 44 65 61 6c 6c  --.+ *.+ *.Deall
5e80: 6f 63 61 74 65 20 74 68 65 20 73 74 6f 72 61 67  ocate the storag
5e90: 65 20 61 73 73 6f 63 69 61 74 65 64 20 77 69 74  e associated wit
5ea0: 68 20 61 6e 20 61 72 69 74 68 73 65 72 69 65 73  h an arithseries
5eb0: 20 6f 62 6a 65 63 74 27 73 0a 2b 20 2a 09 69 6e   object's.+ *.in
5ec0: 74 65 72 6e 61 6c 20 72 65 70 72 65 73 65 6e 74  ternal represent
5ed0: 61 74 69 6f 6e 2e 0a 2b 20 2a 0a 2b 20 2a 20 52  ation..+ *.+ * R
5ee0: 65 73 75 6c 74 73 3a 0a 2b 20 2a 09 4e 6f 6e 65  esults:.+ *.None
5ef0: 2e 0a 2b 20 2a 0a 2b 20 2a 20 53 69 64 65 20 65  ..+ *.+ * Side e
5f00: 66 66 65 63 74 73 3a 0a 2b 20 2a 09 46 72 65 65  ffects:.+ *.Free
5f10: 73 20 61 72 69 74 68 53 65 72 69 65 73 50 74 72  s arithSeriesPtr
5f20: 27 73 20 41 72 69 74 68 53 65 72 69 65 73 2a 20  's ArithSeries* 
5f30: 69 6e 74 65 72 6e 61 6c 20 72 65 70 72 65 73 65  internal represe
5f40: 6e 74 61 74 69 6f 6e 20 61 6e 64 0a 2b 20 2a 09  ntation and.+ *.
5f50: 73 65 74 73 20 6c 69 73 74 50 74 72 27 73 09 69  sets listPtr's.i
5f60: 6e 74 65 72 6e 61 6c 52 65 70 2e 74 77 6f 50 74  nternalRep.twoPt
5f70: 72 56 61 6c 75 65 2e 70 74 72 31 20 74 6f 20 4e  rValue.ptr1 to N
5f80: 55 4c 4c 2e 0a 2b 20 2a 0a 2b 20 2a 2d 2d 2d 2d  ULL..+ *.+ *----
5f90: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5fa0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5fb0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5fc0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5fd0: 2d 2d 0a 2b 20 2a 2f 0a 2b 0a 2b 73 74 61 74 69  --.+ */.+.+stati
5fe0: 63 20 76 6f 69 64 0a 2b 46 72 65 65 41 72 69 74  c void.+FreeArit
5ff0: 68 53 65 72 69 65 73 49 6e 74 65 72 6e 61 6c 52  hSeriesInternalR
6000: 65 70 28 54 63 6c 5f 4f 62 6a 20 2a 61 72 69 74  ep(Tcl_Obj *arit
6010: 68 53 65 72 69 65 73 50 74 72 29 0a 2b 7b 0a 2b  hSeriesPtr).+{.+
6020: 20 20 20 20 41 72 69 74 68 53 65 72 69 65 73 20      ArithSeries 
6030: 2a 61 72 69 74 68 53 65 72 69 65 73 52 65 70 50  *arithSeriesRepP
6040: 74 72 20 3d 0a 2b 09 20 20 20 20 28 41 72 69 74  tr =.+.    (Arit
6050: 68 53 65 72 69 65 73 20 2a 29 20 61 72 69 74 68  hSeries *) arith
6060: 53 65 72 69 65 73 50 74 72 2d 3e 69 6e 74 65 72  SeriesPtr->inter
6070: 6e 61 6c 52 65 70 2e 74 77 6f 50 74 72 56 61 6c  nalRep.twoPtrVal
6080: 75 65 2e 70 74 72 31 3b 0a 2b 20 20 20 20 54 63  ue.ptr1;.+    Tc
6090: 6c 5f 44 65 63 72 52 65 66 43 6f 75 6e 74 28 61  l_DecrRefCount(a
60a0: 72 69 74 68 53 65 72 69 65 73 52 65 70 50 74 72  rithSeriesRepPtr
60b0: 2d 3e 77 69 64 65 4f 62 6a 50 74 72 29 3b 0a 2b  ->wideObjPtr);.+
60c0: 20 20 20 20 63 6b 66 72 65 65 28 28 63 68 61 72      ckfree((char
60d0: 20 2a 29 20 61 72 69 74 68 53 65 72 69 65 73 52   *) arithSeriesR
60e0: 65 70 50 74 72 29 3b 0a 2b 20 20 20 20 61 72 69  epPtr);.+    ari
60f0: 74 68 53 65 72 69 65 73 50 74 72 2d 3e 69 6e 74  thSeriesPtr->int
6100: 65 72 6e 61 6c 52 65 70 2e 74 77 6f 50 74 72 56  ernalRep.twoPtrV
6110: 61 6c 75 65 2e 70 74 72 31 20 3d 20 4e 55 4c 4c  alue.ptr1 = NULL
6120: 3b 0a 2b 7d 0a 2b 0a 2b 2f 2a 0a 2b 20 2a 2d 2d  ;.+}.+.+/*.+ *--
6130: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
6140: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
6150: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
6160: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
6170: 2d 2d 2d 2d 0a 2b 20 2a 0a 2b 20 2a 20 44 75 70  ----.+ *.+ * Dup
6180: 41 72 69 74 68 53 65 72 69 65 73 49 6e 74 65 72  ArithSeriesInter
6190: 6e 61 6c 52 65 70 20 2d 2d 0a 2b 20 2a 0a 2b 20  nalRep --.+ *.+ 
61a0: 2a 09 49 6e 69 74 69 61 6c 69 7a 65 20 74 68 65  *.Initialize the
61b0: 20 69 6e 74 65 72 6e 61 6c 20 72 65 70 72 65 73   internal repres
61c0: 65 6e 74 61 74 69 6f 6e 20 6f 66 20 61 20 61 72  entation of a ar
61d0: 69 74 68 73 65 72 69 65 73 20 54 63 6c 5f 4f 62  ithseries Tcl_Ob
61e0: 6a 20 74 6f 20 61 0a 2b 20 2a 09 63 6f 70 79 20  j to a.+ *.copy 
61f0: 6f 66 20 74 68 65 20 69 6e 74 65 72 6e 61 6c 20  of the internal 
6200: 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 6f  representation o
6210: 66 20 61 6e 20 65 78 69 73 74 69 6e 67 20 61 72  f an existing ar
6220: 69 74 68 73 65 72 69 65 73 20 6f 62 6a 65 63 74  ithseries object
6230: 2e 20 0a 2b 20 2a 0a 2b 20 2a 20 52 65 73 75 6c  . .+ *.+ * Resul
6240: 74 73 3a 0a 2b 20 2a 09 4e 6f 6e 65 2e 0a 2b 20  ts:.+ *.None..+ 
6250: 2a 0a 2b 20 2a 20 53 69 64 65 20 65 66 66 65 63  *.+ * Side effec
6260: 74 73 3a 0a 2b 20 2a 09 57 65 20 73 65 74 20 22  ts:.+ *.We set "
6270: 63 6f 70 79 50 74 72 22 73 20 69 6e 74 65 72 6e  copyPtr"s intern
6280: 61 6c 20 72 65 70 20 74 6f 20 61 20 70 6f 69 6e  al rep to a poin
6290: 74 65 72 20 74 6f 20 61 0a 2b 20 2a 09 6e 65 77  ter to a.+ *.new
62a0: 6c 79 20 61 6c 6c 6f 63 61 74 65 64 20 41 72 69  ly allocated Ari
62b0: 74 68 53 65 72 69 65 73 20 73 74 72 75 63 74 75  thSeries structu
62c0: 72 65 2e 0a 2b 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d  re..+ *---------
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 2f 0a 2b 0a 2b 73 74 61 74 69 63 20 76 6f 69  */.+.+static voi
6320: 64 0a 2b 44 75 70 41 72 69 74 68 53 65 72 69 65  d.+DupArithSerie
6330: 73 49 6e 74 65 72 6e 61 6c 52 65 70 28 73 72 63  sInternalRep(src
6340: 50 74 72 2c 20 63 6f 70 79 50 74 72 29 0a 2b 20  Ptr, copyPtr).+ 
6350: 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 73 72 63 50     Tcl_Obj *srcP
6360: 74 72 3b 09 09 2f 2a 20 4f 62 6a 65 63 74 20 77  tr;../* Object w
6370: 69 74 68 20 69 6e 74 65 72 6e 61 6c 20 72 65 70  ith internal rep
6380: 20 74 6f 20 63 6f 70 79 2e 20 2a 2f 0a 2b 20 20   to copy. */.+  
6390: 20 20 54 63 6c 5f 4f 62 6a 20 2a 63 6f 70 79 50    Tcl_Obj *copyP
63a0: 74 72 3b 09 09 2f 2a 20 4f 62 6a 65 63 74 20 77  tr;../* Object w
63b0: 69 74 68 20 69 6e 74 65 72 6e 61 6c 20 72 65 70  ith internal rep
63c0: 20 74 6f 20 73 65 74 2e 20 2a 2f 0a 2b 7b 0a 2b   to set. */.+{.+
63d0: 20 20 20 20 41 72 69 74 68 53 65 72 69 65 73 20      ArithSeries 
63e0: 2a 73 72 63 41 72 69 74 68 53 65 72 69 65 73 52  *srcArithSeriesR
63f0: 65 70 50 74 72 20 3d 0a 2b 09 20 20 20 20 28 41  epPtr =.+.    (A
6400: 72 69 74 68 53 65 72 69 65 73 20 2a 29 20 73 72  rithSeries *) sr
6410: 63 50 74 72 2d 3e 69 6e 74 65 72 6e 61 6c 52 65  cPtr->internalRe
6420: 70 2e 74 77 6f 50 74 72 56 61 6c 75 65 2e 70 74  p.twoPtrValue.pt
6430: 72 31 3b 0a 2b 20 20 20 20 41 72 69 74 68 53 65  r1;.+    ArithSe
6440: 72 69 65 73 20 2a 63 6f 70 79 41 72 69 74 68 53  ries *copyArithS
6450: 65 72 69 65 73 52 65 70 50 74 72 3b 0a 2b 20 20  eriesRepPtr;.+  
6460: 20 20 54 63 6c 5f 57 69 64 65 49 6e 74 20 77 69    Tcl_WideInt wi
6470: 64 65 56 61 6c 3b 0a 2b 0a 2b 20 20 20 20 2f 2a  deVal;.+.+    /*
6480: 0a 2b 20 20 20 20 20 2a 20 41 6c 6c 6f 63 61 74  .+     * Allocat
6490: 65 20 61 20 6e 65 77 20 41 72 69 74 68 53 65 72  e a new ArithSer
64a0: 69 65 73 20 73 74 72 75 63 74 75 72 65 2e 20 2a  ies structure. *
64b0: 2f 0a 2b 0a 2b 20 20 20 20 63 6f 70 79 41 72 69  /.+.+    copyAri
64c0: 74 68 53 65 72 69 65 73 52 65 70 50 74 72 20 3d  thSeriesRepPtr =
64d0: 20 28 41 72 69 74 68 53 65 72 69 65 73 2a 29 20   (ArithSeries*) 
64e0: 63 6b 61 6c 6c 6f 63 28 73 69 7a 65 6f 66 28 41  ckalloc(sizeof(A
64f0: 72 69 74 68 53 65 72 69 65 73 29 29 3b 0a 2b 20  rithSeries));.+ 
6500: 20 20 20 63 6f 70 79 41 72 69 74 68 53 65 72 69     copyArithSeri
6510: 65 73 52 65 70 50 74 72 2d 3e 73 74 61 72 74 20  esRepPtr->start 
6520: 3d 20 73 72 63 41 72 69 74 68 53 65 72 69 65 73  = srcArithSeries
6530: 52 65 70 50 74 72 2d 3e 73 74 61 72 74 3b 0a 2b  RepPtr->start;.+
6540: 20 20 20 20 63 6f 70 79 41 72 69 74 68 53 65 72      copyArithSer
6550: 69 65 73 52 65 70 50 74 72 2d 3e 65 6e 64 20 3d  iesRepPtr->end =
6560: 20 73 72 63 41 72 69 74 68 53 65 72 69 65 73 52   srcArithSeriesR
6570: 65 70 50 74 72 2d 3e 65 6e 64 3b 0a 2b 20 20 20  epPtr->end;.+   
6580: 20 63 6f 70 79 41 72 69 74 68 53 65 72 69 65 73   copyArithSeries
6590: 52 65 70 50 74 72 2d 3e 73 74 65 70 20 3d 20 73  RepPtr->step = s
65a0: 72 63 41 72 69 74 68 53 65 72 69 65 73 52 65 70  rcArithSeriesRep
65b0: 50 74 72 2d 3e 73 74 65 70 3b 0a 2b 20 20 20 20  Ptr->step;.+    
65c0: 63 6f 70 79 41 72 69 74 68 53 65 72 69 65 73 52  copyArithSeriesR
65d0: 65 70 50 74 72 2d 3e 6c 65 6e 20 3d 20 73 72 63  epPtr->len = src
65e0: 41 72 69 74 68 53 65 72 69 65 73 52 65 70 50 74  ArithSeriesRepPt
65f0: 72 2d 3e 6c 65 6e 3b 0a 2b 20 20 20 20 69 66 20  r->len;.+    if 
6600: 28 54 63 6c 5f 47 65 74 57 69 64 65 49 6e 74 46  (Tcl_GetWideIntF
6610: 72 6f 6d 4f 62 6a 28 4e 55 4c 4c 2c 20 73 72 63  romObj(NULL, src
6620: 41 72 69 74 68 53 65 72 69 65 73 52 65 70 50 74  ArithSeriesRepPt
6630: 72 2d 3e 77 69 64 65 4f 62 6a 50 74 72 2c 0a 2b  r->wideObjPtr,.+
6640: 09 09 09 20 20 20 20 26 77 69 64 65 56 61 6c 29  ...    &wideVal)
6650: 20 21 3d 20 54 43 4c 5f 4f 4b 29 0a 2b 20 20 20   != TCL_OK).+   
6660: 20 7b 0a 2b 20 20 20 20 09 54 63 6c 5f 50 61 6e   {.+    .Tcl_Pan
6670: 69 63 28 22 54 63 6c 5f 47 65 74 57 69 64 65 49  ic("Tcl_GetWideI
6680: 6e 74 46 72 6f 6d 4f 62 6a 28 29 20 66 61 69 6c  ntFromObj() fail
6690: 65 64 20 61 67 61 69 6e 73 74 20 57 69 64 65 49  ed against WideI
66a0: 6e 74 20 6f 62 6a 65 63 74 2e 22 29 3b 0a 2b 20  nt object.");.+ 
66b0: 20 20 20 7d 0a 2b 20 20 20 20 63 6f 70 79 41 72     }.+    copyAr
66c0: 69 74 68 53 65 72 69 65 73 52 65 70 50 74 72 2d  ithSeriesRepPtr-
66d0: 3e 77 69 64 65 4f 62 6a 50 74 72 20 3d 20 54 63  >wideObjPtr = Tc
66e0: 6c 5f 4e 65 77 57 69 64 65 49 6e 74 4f 62 6a 28  l_NewWideIntObj(
66f0: 77 69 64 65 56 61 6c 29 3b 0a 2b 20 20 20 20 54  wideVal);.+    T
6700: 63 6c 5f 49 6e 63 72 52 65 66 43 6f 75 6e 74 28  cl_IncrRefCount(
6710: 63 6f 70 79 41 72 69 74 68 53 65 72 69 65 73 52  copyArithSeriesR
6720: 65 70 50 74 72 2d 3e 77 69 64 65 4f 62 6a 50 74  epPtr->wideObjPt
6730: 72 29 3b 0a 2b 0a 2b 20 20 20 20 63 6f 70 79 50  r);.+.+    copyP
6740: 74 72 2d 3e 69 6e 74 65 72 6e 61 6c 52 65 70 2e  tr->internalRep.
6750: 74 77 6f 50 74 72 56 61 6c 75 65 2e 70 74 72 31  twoPtrValue.ptr1
6760: 20 3d 20 28 56 4f 49 44 20 2a 29 20 63 6f 70 79   = (VOID *) copy
6770: 41 72 69 74 68 53 65 72 69 65 73 52 65 70 50 74  ArithSeriesRepPt
6780: 72 3b 0a 2b 20 20 20 20 63 6f 70 79 50 74 72 2d  r;.+    copyPtr-
6790: 3e 69 6e 74 65 72 6e 61 6c 52 65 70 2e 74 77 6f  >internalRep.two
67a0: 50 74 72 56 61 6c 75 65 2e 70 74 72 32 20 3d 20  PtrValue.ptr2 = 
67b0: 4e 55 4c 4c 3b 0a 2b 20 20 20 20 63 6f 70 79 50  NULL;.+    copyP
67c0: 74 72 2d 3e 74 79 70 65 50 74 72 20 3d 20 26 74  tr->typePtr = &t
67d0: 63 6c 41 72 69 74 68 53 65 72 69 65 73 54 79 70  clArithSeriesTyp
67e0: 65 3b 0a 2b 7d 0a 2b 0a 2b 2f 2a 0a 2b 20 2a 2d  e;.+}.+.+/*.+ *-
67f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
6800: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
6810: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
6820: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
6830: 2d 2d 2d 2d 2d 0a 2b 20 2a 0a 2b 20 2a 20 55 70  -----.+ *.+ * Up
6840: 64 61 74 65 53 74 72 69 6e 67 4f 66 41 72 69 74  dateStringOfArit
6850: 68 53 65 72 69 65 73 20 2d 2d 0a 2b 20 2a 0a 2b  hSeries --.+ *.+
6860: 20 2a 09 55 70 64 61 74 65 20 74 68 65 20 73 74   *.Update the st
6870: 72 69 6e 67 20 72 65 70 72 65 73 65 6e 74 61 74  ring representat
6880: 69 6f 6e 20 66 6f 72 20 61 6e 20 61 72 69 74 68  ion for an arith
6890: 73 65 72 69 65 73 20 6f 62 6a 65 63 74 2e 0a 2b  series object..+
68a0: 20 2a 09 4e 6f 74 65 3a 20 54 68 69 73 20 70 72   *.Note: This pr
68b0: 6f 63 65 64 75 72 65 20 64 6f 65 73 20 6e 6f 74  ocedure does not
68c0: 20 69 6e 76 61 6c 69 64 61 74 65 20 61 6e 20 65   invalidate an e
68d0: 78 69 73 74 69 6e 67 20 6f 6c 64 20 73 74 72 69  xisting old stri
68e0: 6e 67 20 72 65 70 0a 2b 20 2a 09 73 6f 20 73 74  ng rep.+ *.so st
68f0: 6f 72 61 67 65 20 77 69 6c 6c 20 62 65 20 6c 6f  orage will be lo
6900: 73 74 20 69 66 20 74 68 69 73 20 68 61 73 20 6e  st if this has n
6910: 6f 74 20 61 6c 72 65 61 64 79 20 62 65 65 6e 20  ot already been 
6920: 64 6f 6e 65 2e 20 0a 2b 20 2a 0a 2b 20 2a 20 52  done. .+ *.+ * R
6930: 65 73 75 6c 74 73 3a 0a 2b 20 2a 09 4e 6f 6e 65  esults:.+ *.None
6940: 2e 0a 2b 20 2a 0a 2b 20 2a 20 53 69 64 65 20 65  ..+ *.+ * Side e
6950: 66 66 65 63 74 73 3a 0a 2b 20 2a 09 54 68 65 20  ffects:.+ *.The 
6960: 6f 62 6a 65 63 74 27 73 20 73 74 72 69 6e 67 20  object's string 
6970: 69 73 20 73 65 74 20 74 6f 20 61 20 76 61 6c 69  is set to a vali
6980: 64 20 73 74 72 69 6e 67 20 74 68 61 74 20 72 65  d string that re
6990: 73 75 6c 74 73 20 66 72 6f 6d 0a 2b 20 2a 09 74  sults from.+ *.t
69a0: 68 65 20 6c 69 73 74 2d 74 6f 2d 73 74 72 69 6e  he list-to-strin
69b0: 67 20 63 6f 6e 76 65 72 73 69 6f 6e 2e 20 54 68  g conversion. Th
69c0: 69 73 20 73 74 72 69 6e 67 20 77 69 6c 6c 20 62  is string will b
69d0: 65 20 65 6d 70 74 79 20 69 66 20 74 68 65 0a 2b  e empty if the.+
69e0: 20 2a 09 6c 69 73 74 20 68 61 73 20 6e 6f 20 65   *.list has no e
69f0: 6c 65 6d 65 6e 74 73 2e 20 54 68 65 20 6c 69 73  lements. The lis
6a00: 74 20 69 6e 74 65 72 6e 61 6c 20 72 65 70 72 65  t internal repre
6a10: 73 65 6e 74 61 74 69 6f 6e 0a 2b 20 2a 09 73 68  sentation.+ *.sh
6a20: 6f 75 6c 64 20 6e 6f 74 20 62 65 20 4e 55 4c 4c  ould not be NULL
6a30: 20 61 6e 64 20 77 65 20 61 73 73 75 6d 65 20 69   and we assume i
6a40: 74 20 69 73 20 6e 6f 74 20 4e 55 4c 4c 2e 0a 2b  t is not NULL..+
6a50: 20 2a 0a 2b 20 2a 20 4e 6f 74 65 73 3a 0a 2b 20   *.+ * Notes:.+ 
6a60: 2a 20 09 41 74 20 74 68 65 20 63 6f 73 74 20 6f  * .At the cost o
6a70: 66 20 6f 76 65 72 61 6c 6c 6f 63 61 74 69 6f 6e  f overallocation
6a80: 20 69 74 27 73 20 70 6f 73 73 69 62 6c 65 20 74   it's possible t
6a90: 6f 20 65 73 74 69 6d 61 74 65 0a 2b 20 2a 20 09  o estimate.+ * .
6aa0: 74 68 65 20 6c 65 6e 67 74 68 20 6f 66 20 74 68  the length of th
6ab0: 65 20 73 74 72 69 6e 67 20 72 65 70 72 65 73 65  e string represe
6ac0: 6e 74 61 74 69 6f 6e 20 61 6e 64 20 6d 61 6b 65  ntation and make
6ad0: 20 74 68 69 73 20 70 72 6f 63 65 64 75 72 65 0a   this procedure.
6ae0: 2b 20 2a 20 09 6d 75 63 68 20 66 61 73 74 65 72  + * .much faster
6af0: 2e 20 42 65 63 61 75 73 65 20 74 68 65 20 70 72  . Because the pr
6b00: 6f 67 72 61 6d 6d 65 72 20 73 68 6f 75 6c 64 6e  ogrammer shouldn
6b10: 27 74 20 65 78 70 65 63 74 20 74 68 65 0a 2b 20  't expect the.+ 
6b20: 2a 20 09 73 74 72 69 6e 67 20 63 6f 6e 76 65 72  * .string conver
6b30: 73 69 6f 6e 20 6f 66 20 61 20 62 69 67 20 61 72  sion of a big ar
6b40: 69 74 68 6d 65 74 69 63 20 73 65 71 75 65 6e 63  ithmetic sequenc
6b50: 65 20 74 6f 20 62 65 20 66 61 73 74 0a 2b 20 2a  e to be fast.+ *
6b60: 20 09 74 68 69 73 20 76 65 72 73 69 6f 6e 20 74   .this version t
6b70: 61 6b 65 73 20 6d 6f 72 65 20 63 61 72 65 20 6f  akes more care o
6b80: 66 20 73 70 61 63 65 20 74 68 61 6e 20 74 69 6d  f space than tim
6b90: 65 2e 0a 2b 20 2a 0a 2b 20 2a 2d 2d 2d 2d 2d 2d  e..+ *.+ *------
6ba0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
6bb0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
6bc0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
6bd0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
6be0: 0a 2b 20 2a 2f 0a 2b 0a 2b 73 74 61 74 69 63 20  .+ */.+.+static 
6bf0: 76 6f 69 64 0a 2b 55 70 64 61 74 65 53 74 72 69  void.+UpdateStri
6c00: 6e 67 4f 66 41 72 69 74 68 53 65 72 69 65 73 28  ngOfArithSeries(
6c10: 54 63 6c 5f 4f 62 6a 20 2a 61 72 69 74 68 53 65  Tcl_Obj *arithSe
6c20: 72 69 65 73 50 74 72 29 0a 2b 7b 0a 2b 20 20 20  riesPtr).+{.+   
6c30: 20 41 72 69 74 68 53 65 72 69 65 73 20 2a 61 72   ArithSeries *ar
6c40: 69 74 68 53 65 72 69 65 73 52 65 70 50 74 72 20  ithSeriesRepPtr 
6c50: 3d 0a 2b 09 20 20 20 20 28 41 72 69 74 68 53 65  =.+.    (ArithSe
6c60: 72 69 65 73 2a 29 20 61 72 69 74 68 53 65 72 69  ries*) arithSeri
6c70: 65 73 50 74 72 2d 3e 69 6e 74 65 72 6e 61 6c 52  esPtr->internalR
6c80: 65 70 2e 74 77 6f 50 74 72 56 61 6c 75 65 2e 70  ep.twoPtrValue.p
6c90: 74 72 31 3b 0a 2b 20 20 20 20 63 68 61 72 20 62  tr1;.+    char b
6ca0: 75 66 66 65 72 5b 54 43 4c 5f 49 4e 54 45 47 45  uffer[TCL_INTEGE
6cb0: 52 5f 53 50 41 43 45 2b 32 5d 2c 20 2a 70 3b 0a  R_SPACE+2], *p;.
6cc0: 2b 20 20 20 20 54 63 6c 5f 57 69 64 65 49 6e 74  +    Tcl_WideInt
6cd0: 20 69 3b 0a 2b 20 20 20 20 54 63 6c 5f 57 69 64   i;.+    Tcl_Wid
6ce0: 65 49 6e 74 20 6c 65 6e 67 74 68 20 3d 20 30 2c  eInt length = 0,
6cf0: 20 65 6c 65 3b 0a 2b 20 20 20 20 69 6e 74 20 73   ele;.+    int s
6d00: 6c 65 6e 3b 0a 2b 0a 2b 20 20 20 20 2f 2a 0a 2b  len;.+.+    /*.+
6d10: 20 20 20 20 20 2a 20 50 61 73 73 20 31 3a 20 65       * Pass 1: e
6d20: 73 74 69 6d 61 74 65 20 73 70 61 63 65 2e 0a 2b  stimate space..+
6d30: 20 20 20 20 20 2a 2f 0a 2b 20 20 20 20 66 6f 72       */.+    for
6d40: 20 28 69 20 3d 20 30 3b 20 69 20 3c 20 61 72 69   (i = 0; i < ari
6d50: 74 68 53 65 72 69 65 73 52 65 70 50 74 72 2d 3e  thSeriesRepPtr->
6d60: 6c 65 6e 3b 20 69 2b 2b 29 20 7b 0a 2b 09 65 6c  len; i++) {.+.el
6d70: 65 20 3d 20 61 72 69 74 68 53 65 72 69 65 73 52  e = arithSeriesR
6d80: 65 70 50 74 72 2d 3e 73 74 61 72 74 20 2b 20 28  epPtr->start + (
6d90: 69 2a 61 72 69 74 68 53 65 72 69 65 73 52 65 70  i*arithSeriesRep
6da0: 50 74 72 2d 3e 73 74 65 70 29 3b 0a 2b 20 20 20  Ptr->step);.+   
6db0: 20 2f 2a 0a 2b 20 20 20 20 20 2a 20 4e 6f 74 65   /*.+     * Note
6dc0: 20 74 68 61 74 20 73 70 72 69 6e 74 66 20 77 69   that sprintf wi
6dd0: 6c 6c 20 67 65 6e 65 72 61 74 65 20 61 20 63 6f  ll generate a co
6de0: 6d 70 69 6c 65 72 20 77 61 72 6e 69 6e 67 20 75  mpiler warning u
6df0: 6e 64 65 72 0a 2b 20 20 20 20 20 2a 20 4d 69 6e  nder.+     * Min
6e00: 67 77 20 63 6c 61 69 6d 69 6e 67 20 25 49 36 34  gw claiming %I64
6e10: 20 69 73 20 61 6e 20 75 6e 6b 6e 6f 77 6e 20 66   is an unknown f
6e20: 6f 72 6d 61 74 20 73 70 65 63 69 66 69 65 72 2e  ormat specifier.
6e30: 0a 2b 20 20 20 20 20 2a 20 4a 75 73 74 20 69 67  .+     * Just ig
6e40: 6e 6f 72 65 20 74 68 69 73 20 77 61 72 6e 69 6e  nore this warnin
6e50: 67 2e 20 57 65 20 63 61 6e 27 74 20 75 73 65 20  g. We can't use 
6e60: 25 4c 20 61 73 20 74 68 65 20 66 6f 72 6d 61 74  %L as the format
6e70: 0a 2b 20 20 20 20 20 2a 20 73 70 65 63 69 66 69  .+     * specifi
6e80: 65 72 20 73 69 6e 63 65 20 74 68 61 74 20 67 65  er since that ge
6e90: 74 73 20 70 72 69 6e 74 65 64 20 61 73 20 61 20  ts printed as a 
6ea0: 33 32 20 62 69 74 20 76 61 6c 75 65 2e 0a 2b 20  32 bit value..+ 
6eb0: 20 20 20 20 2a 2f 0a 2b 09 73 70 72 69 6e 74 66      */.+.sprintf
6ec0: 28 62 75 66 66 65 72 2c 20 22 25 22 20 54 43 4c  (buffer, "%" TCL
6ed0: 5f 4c 4c 5f 4d 4f 44 49 46 49 45 52 20 22 64 22  _LL_MODIFIER "d"
6ee0: 2c 20 65 6c 65 29 3b 0a 2b 09 73 6c 65 6e 20 3d  , ele);.+.slen =
6ef0: 20 73 74 72 6c 65 6e 28 62 75 66 66 65 72 29 20   strlen(buffer) 
6f00: 2b 20 31 3b 20 2f 2a 20 2b 20 31 20 69 73 20 66  + 1; /* + 1 is f
6f10: 6f 72 20 74 68 65 20 73 70 61 63 65 20 6f 72 20  or the space or 
6f20: 74 68 65 20 6e 75 6c 2d 74 65 72 6d 20 2a 2f 0a  the nul-term */.
6f30: 2b 09 6c 65 6e 67 74 68 20 2b 3d 20 73 6c 65 6e  +.length += slen
6f40: 3b 0a 2b 20 20 20 20 7d 0a 2b 0a 2b 20 20 20 20  ;.+    }.+.+    
6f50: 2f 2a 0a 2b 20 20 20 20 20 2a 20 50 61 73 73 20  /*.+     * Pass 
6f60: 32 3a 20 67 65 6e 65 72 61 74 65 20 74 68 65 20  2: generate the 
6f70: 73 74 72 69 6e 67 20 72 65 70 72 2e 0a 2b 20 20  string repr..+  
6f80: 20 20 20 2a 2f 0a 2b 0a 2b 20 20 20 20 70 20 3d     */.+.+    p =
6f90: 20 61 72 69 74 68 53 65 72 69 65 73 50 74 72 2d   arithSeriesPtr-
6fa0: 3e 62 79 74 65 73 20 3d 20 63 6b 61 6c 6c 6f 63  >bytes = ckalloc
6fb0: 28 6c 65 6e 67 74 68 29 3b 0a 2b 20 20 20 20 66  (length);.+    f
6fc0: 6f 72 20 28 69 20 3d 20 30 3b 20 69 20 3c 20 61  or (i = 0; i < a
6fd0: 72 69 74 68 53 65 72 69 65 73 52 65 70 50 74 72  rithSeriesRepPtr
6fe0: 2d 3e 6c 65 6e 3b 20 69 2b 2b 29 20 7b 0a 2b 09  ->len; i++) {.+.
6ff0: 65 6c 65 20 3d 20 61 72 69 74 68 53 65 72 69 65  ele = arithSerie
7000: 73 52 65 70 50 74 72 2d 3e 73 74 61 72 74 20 2b  sRepPtr->start +
7010: 20 28 69 2a 61 72 69 74 68 53 65 72 69 65 73 52   (i*arithSeriesR
7020: 65 70 50 74 72 2d 3e 73 74 65 70 29 3b 0a 2b 09  epPtr->step);.+.
7030: 73 70 72 69 6e 74 66 28 62 75 66 66 65 72 2c 20  sprintf(buffer, 
7040: 22 25 22 20 54 43 4c 5f 4c 4c 5f 4d 4f 44 49 46  "%" TCL_LL_MODIF
7050: 49 45 52 20 22 64 22 2c 20 65 6c 65 29 3b 0a 2b  IER "d", ele);.+
7060: 09 73 6c 65 6e 20 3d 20 73 74 72 6c 65 6e 28 62  .slen = strlen(b
7070: 75 66 66 65 72 29 3b 0a 2b 09 73 74 72 63 70 79  uffer);.+.strcpy
7080: 28 70 2c 20 62 75 66 66 65 72 29 3b 0a 2b 09 70  (p, buffer);.+.p
7090: 5b 73 6c 65 6e 5d 20 3d 20 27 20 27 3b 0a 2b 09  [slen] = ' ';.+.
70a0: 70 20 2b 3d 20 73 6c 65 6e 2b 31 3b 0a 2b 20 20  p += slen+1;.+  
70b0: 20 20 7d 0a 2b 20 20 20 20 69 66 20 28 6c 65 6e    }.+    if (len
70c0: 67 74 68 20 3e 20 30 29 20 61 72 69 74 68 53 65  gth > 0) arithSe
70d0: 72 69 65 73 50 74 72 2d 3e 62 79 74 65 73 5b 6c  riesPtr->bytes[l
70e0: 65 6e 67 74 68 2d 31 5d 20 3d 20 27 5c 30 27 3b  ength-1] = '\0';
70f0: 0a 2b 20 20 20 20 61 72 69 74 68 53 65 72 69 65  .+    arithSerie
7100: 73 50 74 72 2d 3e 6c 65 6e 67 74 68 20 3d 20 6c  sPtr->length = l
7110: 65 6e 67 74 68 3b 0a 2b 7d 0a 2b 0a 2b 2f 2a 0a  ength;.+}.+.+/*.
7120: 2b 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  + *-------------
7130: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
7140: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
7150: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
7160: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 2b 20 2a 0a 2b 20  ---------.+ *.+ 
7170: 2a 20 53 65 74 41 72 69 74 68 53 65 72 69 65 73  * SetArithSeries
7180: 46 72 6f 6d 41 6e 79 20 2d 2d 0a 2b 20 2a 0a 2b  FromAny --.+ *.+
7190: 20 2a 20 09 54 68 65 20 41 72 69 74 68 6d 65 74   * .The Arithmet
71a0: 69 63 20 53 65 72 69 65 73 20 6f 62 6a 65 63 74  ic Series object
71b0: 20 69 73 20 6a 75 73 74 20 61 6e 20 77 61 79 20   is just an way 
71c0: 74 6f 20 6f 70 74 69 6d 69 7a 65 0a 2b 20 2a 20  to optimize.+ * 
71d0: 09 4c 69 73 74 73 20 73 70 61 63 65 20 63 6f 6d  .Lists space com
71e0: 70 6c 65 78 69 74 79 2c 20 73 6f 20 6e 6f 20 6f  plexity, so no o
71f0: 6e 65 20 73 68 6f 75 6c 64 20 74 72 79 20 74 6f  ne should try to
7200: 20 63 6f 6e 76 65 72 74 0a 2b 20 2a 20 09 61 20   convert.+ * .a 
7210: 73 74 72 69 6e 67 20 74 6f 20 61 6e 20 41 72 69  string to an Ari
7220: 74 68 6d 65 74 69 63 20 53 65 72 69 65 73 20 6f  thmetic Series o
7230: 62 6a 65 63 74 2e 0a 2b 20 2a 0a 2b 20 2a 20 09  bject..+ *.+ * .
7240: 54 68 69 73 20 66 75 6e 63 74 69 6f 6e 20 69 73  This function is
7250: 20 68 65 72 65 20 6a 75 73 74 20 74 6f 20 70 6f   here just to po
7260: 70 75 6c 61 74 65 20 74 68 65 20 54 79 70 65 20  pulate the Type 
7270: 73 74 72 75 63 74 75 72 65 2e 0a 2b 20 2a 0a 2b  structure..+ *.+
7280: 20 2a 20 52 65 73 75 6c 74 73 3a 0a 2b 20 2a 0a   * Results:.+ *.
7290: 2b 20 2a 20 09 54 68 65 20 72 65 73 75 6c 74 20  + * .The result 
72a0: 69 73 20 61 6c 77 61 79 73 20 54 43 4c 5f 45 52  is always TCL_ER
72b0: 52 4f 52 2e 20 42 75 74 20 73 65 65 20 53 69 64  ROR. But see Sid
72c0: 65 20 45 66 66 65 63 74 73 2e 0a 2b 20 2a 0a 2b  e Effects..+ *.+
72d0: 20 2a 20 53 69 64 65 20 65 66 66 65 63 74 73 3a   * Side effects:
72e0: 0a 2b 20 2a 0a 2b 20 2a 20 09 54 63 6c 20 50 61  .+ *.+ * .Tcl Pa
72f0: 6e 69 63 20 69 66 20 63 61 6c 6c 65 64 2e 0a 2b  nic if called..+
7300: 20 2a 0a 2b 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d   *.+ *----------
7310: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
7320: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
7330: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
7340: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 2b 20 2a  ------------.+ *
7350: 2f 0a 2b 0a 2b 73 74 61 74 69 63 20 69 6e 74 0a  /.+.+static int.
7360: 2b 53 65 74 41 72 69 74 68 53 65 72 69 65 73 46  +SetArithSeriesF
7370: 72 6f 6d 41 6e 79 28 69 6e 74 65 72 70 2c 20 6f  romAny(interp, o
7380: 62 6a 50 74 72 29 0a 2b 20 20 20 20 54 63 6c 5f  bjPtr).+    Tcl_
7390: 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 3b 09  Interp *interp;.
73a0: 09 2f 2a 20 55 73 65 64 20 66 6f 72 20 65 72 72  ./* Used for err
73b0: 6f 72 20 72 65 70 6f 72 74 69 6e 67 20 69 66 20  or reporting if 
73c0: 6e 6f 74 20 4e 55 4c 4c 2e 20 2a 2f 0a 2b 20 20  not NULL. */.+  
73d0: 20 20 54 63 6c 5f 4f 62 6a 20 2a 6f 62 6a 50 74    Tcl_Obj *objPt
73e0: 72 3b 09 09 2f 2a 20 54 68 65 20 6f 62 6a 65 63  r;../* The objec
73f0: 74 20 74 6f 20 63 6f 6e 76 65 72 74 2e 20 2a 2f  t to convert. */
7400: 0a 2b 7b 0a 2b 20 20 20 20 54 63 6c 5f 50 61 6e  .+{.+    Tcl_Pan
7410: 69 63 28 22 53 65 74 41 72 69 74 68 53 65 72 69  ic("SetArithSeri
7420: 65 73 46 72 6f 6d 41 6e 79 3a 20 73 68 6f 75 6c  esFromAny: shoul
7430: 64 20 6e 65 76 65 72 20 62 65 20 63 61 6c 6c 65  d never be calle
7440: 64 22 29 3b 0a 2b 20 20 20 20 72 65 74 75 72 6e  d");.+    return
7450: 20 54 43 4c 5f 45 52 52 4f 52 3b 0a 2b 7d 0a 49   TCL_ERROR;.+}.I
7460: 6e 64 65 78 3a 20 67 65 6e 65 72 69 63 2f 74 63  ndex: generic/tc
7470: 6c 53 74 75 62 49 6e 69 74 2e 63 0a 3d 3d 3d 3d  lStubInit.c.====
7480: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7490: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
74a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
74b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a  ===============.
74c0: 52 43 53 20 66 69 6c 65 3a 20 2f 63 76 73 72 6f  RCS file: /cvsro
74d0: 6f 74 2f 74 63 6c 2f 74 63 6c 2f 67 65 6e 65 72  ot/tcl/tcl/gener
74e0: 69 63 2f 74 63 6c 53 74 75 62 49 6e 69 74 2e 63  ic/tclStubInit.c
74f0: 2c 76 0a 72 65 74 72 69 65 76 69 6e 67 20 72 65  ,v.retrieving re
7500: 76 69 73 69 6f 6e 20 31 2e 31 30 35 0a 64 69 66  vision 1.105.dif
7510: 66 20 2d 75 20 2d 72 31 2e 31 30 35 20 74 63 6c  f -u -r1.105 tcl
7520: 53 74 75 62 49 6e 69 74 2e 63 0a 2d 2d 2d 20 67  StubInit.c.--- g
7530: 65 6e 65 72 69 63 2f 74 63 6c 53 74 75 62 49 6e  eneric/tclStubIn
7540: 69 74 2e 63 09 31 34 20 4f 63 74 20 32 30 30 34  it.c.14 Oct 2004
7550: 20 31 35 3a 30 36 3a 30 33 20 2d 30 30 30 30 09   15:06:03 -0000.
7560: 31 2e 31 30 35 0a 2b 2b 2b 20 67 65 6e 65 72 69  1.105.+++ generi
7570: 63 2f 74 63 6c 53 74 75 62 49 6e 69 74 2e 63 09  c/tclStubInit.c.
7580: 32 34 20 4f 63 74 20 32 30 30 34 20 30 39 3a 33  24 Oct 2004 09:3
7590: 32 3a 31 31 20 2d 30 30 30 30 0a 40 40 20 2d 39  2:11 -0000.@@ -9
75a0: 33 32 2c 36 20 2b 39 33 32 2c 39 20 40 40 0a 20  32,6 +932,9 @@. 
75b0: 20 20 20 20 54 63 6c 5f 4c 69 6d 69 74 47 65 74      Tcl_LimitGet
75c0: 43 6f 6d 6d 61 6e 64 73 2c 20 2f 2a 20 35 33 32  Commands, /* 532
75d0: 20 2a 2f 0a 20 20 20 20 20 54 63 6c 5f 4c 69 6d   */.     Tcl_Lim
75e0: 69 74 47 65 74 54 69 6d 65 2c 20 2f 2a 20 35 33  itGetTime, /* 53
75f0: 33 20 2a 2f 0a 20 20 20 20 20 54 63 6c 5f 4c 69  3 */.     Tcl_Li
7600: 6d 69 74 47 65 74 47 72 61 6e 75 6c 61 72 69 74  mitGetGranularit
7610: 79 2c 20 2f 2a 20 35 33 34 20 2a 2f 0a 2b 20 20  y, /* 534 */.+  
7620: 20 20 54 63 6c 5f 4e 65 77 41 72 69 74 68 53 65    Tcl_NewArithSe
7630: 72 69 65 73 4f 62 6a 2c 20 2f 2a 20 35 33 35 20  riesObj, /* 535 
7640: 2a 2f 0a 2b 20 20 20 20 54 63 6c 5f 41 72 69 74  */.+    Tcl_Arit
7650: 68 53 65 72 69 65 73 4f 62 6a 49 6e 64 65 78 2c  hSeriesObjIndex,
7660: 20 2f 2a 20 35 33 36 20 2a 2f 0a 2b 20 20 20 20   /* 536 */.+    
7670: 54 63 6c 5f 41 72 69 74 68 53 65 72 69 65 73 4f  Tcl_ArithSeriesO
7680: 62 6a 4c 65 6e 67 74 68 2c 20 2f 2a 20 35 33 37  bjLength, /* 537
7690: 20 2a 2f 0a 20 7d 3b 0a 20 0a 20 2f 2a 20 21 45   */. };. . /* !E
76a0: 4e 44 21 3a 20 44 6f 20 6e 6f 74 20 65 64 69 74  ND!: Do not edit
76b0: 20 61 62 6f 76 65 20 74 68 69 73 20 6c 69 6e 65   above this line
76c0: 2e 20 2a 2f 0a                                   . */.