Changeset 240ad0a in tol
- Timestamp:
- Mar 4, 2011, 5:14:20 PM (16 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- 4ea7b59
- Parents:
- c92025e
- File:
-
- 1 edited
-
tol/btol/set_type/setgra.cpp (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tol/btol/set_type/setgra.cpp
rc92025e r240ad0a 131 131 BSyntaxObject* Evaluator(BList* arg) const 132 132 { 133 //InitTotalTime("BSetAppend::Evaluator"); 133 134 if(CheckNonDeclarativeAction("Append")) { return(NULL); } 134 135 BList* lst = arg; … … 143 144 uSet1->Contens().Append(uSet2->Contens(),incrementalIndexByName); 144 145 SAFE_DESTROY(arg, uSet1); 146 //SumPartialTime; 145 147 return(uSet1); 146 148 } … … 157 159 : BExternalOperator 158 160 ( 159 "Remove", GraSet(), "Set Real Real", NIL, 3, 3,160 "(Set set, Real n , Real deleteOld)",161 "Remove", GraSet(), "Set Real Real", NIL, 2, 3, 162 "(Set set, Real n [, Real deleteOld=True])", 161 163 I2("Removes the n-th element of a set and tries to delete it " 162 164 "from memory if deleteOld is true. Returns the own set " … … 182 184 BUserSet* uSet = USet(lst->Car()); lst = lst->Cdr(); 183 185 BUserDat* uDat = UDat(lst->Car()); lst = lst->Cdr(); 184 BUserDat* uDel = UDat(lst->Car()); 186 bool do_deletion = true; 187 if(lst) 188 { 189 Deprecated("Optional argument deleteOld of function Set Remove " 190 "will be eliminated taken true value"); 191 BUserDat* uDel = UDat(lst->Car()); 192 do_deletion = uDel->Contens().Value()!=0.0; 193 } 185 194 uSet->Contens().Remove( 186 195 (int)(uDat->Contens().Value())-1, 187 uDel->Contens().Value()!=0.0);196 do_deletion); 188 197 SAFE_DESTROY(arg, uSet); 189 198 return(uSet); … … 201 210 : BExternalOperator 202 211 ( 203 "Replace", GraSet(), "Set Real Anything Real", NIL, 4, 4,204 "(Set set, Real n, Anything new , Real deleteOld)",212 "Replace", GraSet(), "Set Real Anything Real", NIL, 3, 4, 213 "(Set set, Real n, Anything new [, Real deleteOld])", 205 214 I2("Replaces the n-th element of a set by a another new one " 206 215 "and tries to delete the old one from memory if deleteOld " … … 228 237 BUserDat* uDat = UDat(lst->Car()); lst = lst->Cdr(); 229 238 BSyntaxObject* uNew = (BSyntaxObject*)(lst->Car()); lst = lst->Cdr(); 230 BUserDat* uDel = UDat(lst->Car()); 239 bool do_deletion = true; 240 if(lst) 241 { 242 Deprecated("Optional argument deleteOld of function Set Replace " 243 "will be eliminated taken true value"); 244 BUserDat* uDel = UDat(lst->Car()); 245 do_deletion = uDel->Contens().Value()!=0.0; 246 } 231 247 uSet->Contens().Replace( 232 248 (int)(uDat->Contens().Value())-1, 233 249 uNew, 234 uDel->Contens().Value()!=0.0);250 do_deletion); 235 251 SAFE_DESTROY(arg, uSet); 236 252 return(uSet); … … 1802 1818 //-------------------------------------------------------------------- 1803 1819 { 1820 //InitTotalTime("BSetFor::CalcContens"); 1804 1821 BStandardOperator* opr = (BStandardOperator*)GetOperator(UCode(Arg(3))); 1805 1822 int from = (int)Real(Arg(1)); … … 1809 1826 int n; 1810 1827 1811 if(from>until) { return; } 1812 contens_.PrepareStore(until-from+1); 1813 if(!opr || (opr->MaxArg()!=1) || (opr->GrammarForArg(1)!=GraReal())) 1814 { 1815 Error(I2("Wrong argument function in For function calling." 1816 "It must have just one argument of Real type.", 1817 "Función argumento errónea en llamada a la función For." 1818 "Ésta debe tener exactamente un argumento de tipo Real.")); 1819 return; 1820 } 1821 for(n = from; n<=until; n++) 1822 { 1823 arg = new BContensDat(n); 1824 BCore::MemAssignInfo mai(arg); 1825 if(objCode = opr->Evaluator(NCons(arg))) 1826 { 1827 contens_.AddElement(objCode); 1828 if(from<=until) 1829 { 1830 contens_.PrepareStore(until-from+1); 1831 if(!opr || (opr->MaxArg()!=1) || (opr->GrammarForArg(1)!=GraReal())) 1832 { 1833 Error(I2("Wrong argument function in For function calling." 1834 "It must have just one argument of Real type.", 1835 "Función argumento errónea en llamada a la función For." 1836 "Ésta debe tener exactamente un argumento de tipo Real.")); 1828 1837 } 1829 1838 else 1830 1839 { 1831 mai.SafeDestroy(); 1832 char es[64]; 1833 char en[64]; 1834 sprintf(en, "<For> function failed at iteration %d.", n); 1835 sprintf(es, "Fallo en función <For> en iteración %d.", n); 1836 Error(I2(en ,es)); 1837 return; 1838 } 1839 } 1840 for(n = from; n<=until; n++) 1841 { 1842 arg = new BContensDat(n); 1843 BCore::MemAssignInfo mai(arg); 1844 if(objCode = opr->Evaluator(NCons(arg))) 1845 { 1846 contens_.AddElement(objCode); 1847 } 1848 else 1849 { 1850 mai.SafeDestroy(); 1851 char es[64]; 1852 char en[64]; 1853 sprintf(en, "<For> function failed at iteration %d.", n); 1854 sprintf(es, "Fallo en función <For> en iteración %d.", n); 1855 Error(I2(en ,es)); 1856 } 1857 } 1858 } 1859 } 1860 //SumPartialTime; 1840 1861 } 1841 1862 … … 2154 2175 //-------------------------------------------------------------------- 2155 2176 { 2156 BMat mat = Mat (Arg(1)); 2157 BUserTimeSet* dating = Tms (Arg(2)); if(!dating) { return; } 2158 BDate first = Date(Arg(3)); 2159 BDate last = dating->Next(first,mat.Columns()-1); 2160 BList* result = NIL; 2161 BList* aux = NIL; 2162 BInt i; 2163 for(i = 0; i < mat.Rows(); i++) 2164 { 2165 BTsrPrimary* serie = new BTsrPrimary("","",dating,first,last, 2166 mat.SubRow(i).Data()); 2167 serie->PutName(BText("S")+(i+1)); 2168 LstFastAppend(result, aux, serie); 2169 } 2170 contens_.RobStruct(result,NIL,BSet::Table); 2177 BMat& mat = Mat (Arg(1)); 2178 BUserTimeSet* dating = Tms (Arg(2)); 2179 if(!dating) { return; } 2180 BDate& first = Date(Arg(3)); 2181 BDate last = dating->Next(first,mat.Columns()-1); 2182 BList* result = NIL; 2183 BList* aux = NIL; 2184 BInt i; 2185 for(i=0; i<mat.Rows(); i++) 2186 { 2187 BTsrPrimary* serie = new BTsrPrimary( 2188 "","",dating,first,last,mat.SubRow(i).Data()); 2189 serie->PutName(BText("S")+(i+1)); 2190 LstFastAppend(result, aux, serie); 2191 } 2192 contens_.RobStruct(result,NIL,BSet::Table); 2171 2193 } 2172 2194
Note: See TracChangeset
for help on using the changeset viewer.
