Changeset 3944 for trunk/MagicSoft/Mars/mbase
- Timestamp:
- 05/03/04 15:26:23 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MRunIter.cc
r3877 r3944 72 72 Int_t MRunIter::AddRuns(const char* runrange, const char* path) 73 73 { 74 TString chcopy = runrange; 75 Ssiz_t last=0; 76 Int_t lowrun=-1; 77 Int_t upprun; 78 UInt_t totdir=0; 79 80 81 // loop over the elements of the character chain 82 for(Int_t i=0;i<chcopy.Length();i++) 74 const TString chcopy(runrange); 75 76 Ssiz_t last=0; 77 Int_t lowrun=-1; 78 UInt_t totdir=0; 79 80 // loop over the elements of the character chain 81 for (Int_t i=0;i<chcopy.Length();i++) 83 82 { 84 // look for a digit, a '-' or a ',' 85 char c=chcopy[i]; 86 if(! ((c>='0' && c<='9') || c=='-' || c==',')) 87 return totdir; 88 89 // if '-' is found, save the previous number as initial run 90 else if(c=='-' && lowrun<0 && i>last) 91 { 92 TSubString chrun = chcopy(last,i-last); 93 lowrun=atoi(chrun.Data()); 94 last=i+1; 95 } 96 // if ',' or the end of the string are found, save the previous run or run range 97 else if(c==',' && i>last) 98 { 99 TSubString chrun = chcopy(last,i-last); 100 upprun=atoi(chrun.Data()); 101 if(lowrun>=0 && lowrun<=upprun) 102 totdir+=AddRuns(lowrun,upprun,path); 103 else if(lowrun<0) 104 totdir+=AddRun(upprun,path); 105 106 lowrun=-1; 107 last=i+1; 108 } 109 // if find two contiguous separators exit 110 else if((c=='-' && i==last) || (c==',' && i==last)) 111 return totdir; 83 // look for a digit, a '-' or a ',' 84 const char c=chcopy[i]; 85 if (! ((c>='0' && c<='9') || c=='-' || c==',')) 86 return totdir; 87 88 // if '-' is found, save the previous number as initial run 89 if (c=='-' && lowrun<0 && i>last) 90 { 91 const TSubString chrun = chcopy(last,i-last); 92 lowrun=atoi(chrun.Data()); 93 last=i+1; 94 continue; 95 } 96 // if ',' or the end of the string are found, save the previous run or run range 97 if (c==',' && i>last) 98 { 99 const TSubString chrun = chcopy(last,i-last); 100 const Int_t up=atoi(chrun.Data()); 101 if(lowrun>=0 && lowrun<=up) 102 totdir+=AddRuns(lowrun,up,path); 103 else if(lowrun<0) 104 totdir+=AddRun(up,path); 105 106 lowrun=-1; 107 last=i+1; 108 continue; 109 } 110 111 // if find two continous separators exit 112 if ((c=='-' && i==last) || (c==',' && i==last)) 113 return totdir; 112 114 } 113 114 // save last run range 115 TSubString chrun = chcopy(last,chcopy.Length()-last); 116 upprun=atoi(chrun.Data()); 117 if(lowrun>=0 && lowrun<=upprun) 118 totdir+=AddRuns(lowrun,upprun,path); 119 else if(lowrun<0) 120 totdir+=AddRun(upprun,path); 121 122 return totdir; 115 116 // save last run range 117 const TSubString chrun = chcopy(last,chcopy.Length()-last); 118 const Int_t upprun=atoi(chrun.Data()); 119 if(lowrun>=0 && lowrun<=upprun) 120 { 121 totdir+=AddRuns(lowrun,upprun,path); 122 return totdir; 123 } 124 125 if(lowrun<0) 126 totdir+=AddRun(upprun,path); 127 128 return totdir; 123 129 }
Note:
See TracChangeset
for help on using the changeset viewer.