Changeset a49be3d in tol
- Timestamp:
- Jan 9, 2012, 9:44:49 AM (15 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- 6ff8ce3
- Parents:
- 5fbda58
- File:
-
- 1 edited
-
tol/btol/set_type/setgra.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tol/btol/set_type/setgra.cpp
r5fbda58 ra49be3d 1891 1891 DeclareNoLazzyClass(BSet, BSetTemporary, BSetEvalSet); 1892 1892 DefExtOpr(1, BSetEvalSet, "EvalSet", 2, 2, "Set Code", 1893 I2("(Set set, Code doit)", "(Set cto, Code hacer)"),1893 "(Set set, Code doit)", 1894 1894 I2("Returns the set of the successive evaluations of a " 1895 1895 "function, taking as argument each element of a set.", … … 1906 1906 BSet& set = Set (Arg(1)); 1907 1907 BCode& code = Code(Arg(2)); 1908 BGrammar* gra = code.Grammar();1908 BGrammar* gra = code.Grammar(); 1909 1909 BList* aux = NIL; 1910 1910 BList* result = NIL; … … 1935 1935 } 1936 1936 while(n<=set.Card()); 1937 } 1938 contens_.RobElement(result); 1939 } 1940 1941 //-------------------------------------------------------------------- 1942 DeclareNoLazzyClass(BSet, BSetTemporary, BSetEvalSetNth); 1943 DefExtOpr(1, BSetEvalSetNth, "EvalSetNth", 4, 4, "Real Set Set Code", 1944 "(Real nth, Set args, Set set, Code doit)", 1945 I2("Returns the set of the successive evaluations of a " 1946 "function, taking as the k-th argument each element of a set." 1947 "The rest of arguments are fixed.", 1948 "Devuelve el conjunto de las evaluaciones sucesivas de " 1949 "una función, tomando como k-ésimo argumento cada elemento de " 1950 "un conjunto. El resto de argumentos permanecen fijos."), 1951 BOperClassify::SetAlgebra_); 1952 1953 //-------------------------------------------------------------------- 1954 void BSetEvalSetNth::CalcContens() 1955 //-------------------------------------------------------------------- 1956 { 1957 BSyntaxObject* objCode, *arg; 1958 int n = (int)Real (Arg(1)); 1959 BSet& args = Set (Arg(2)); 1960 BSet& set = Set (Arg(3)); 1961 BCode& code = Code(Arg(4)); 1962 BGrammar* gra = code.Grammar(); 1963 BList* aux1 = NIL; 1964 BList* aux2 = NIL; 1965 BList* aux3 = NIL; 1966 BList* result = NIL; 1967 int i; 1968 int k = 1; 1969 int m = args.Card(); 1970 int K = set.Card(); 1971 bool okArg = code.Operator()!=NULL; 1972 int minArg = 0; 1973 int maxArg = 0; 1974 if(okArg) 1975 { 1976 minArg = code.Operator()->MinArg(); 1977 maxArg = code.Operator()->MaxArg(); 1978 okArg = (minArg<=m) && (m<=maxArg); 1979 } 1980 if(!okArg) 1981 { 1982 Error(I2("Wrong argument function in EvalSetNth function calling." 1983 "It must admit "+m+" arguments.", 1984 "Función argumento errónea en llamada a la función EvalSetNth." 1985 "Ésta debe admitir "+m+" argumentos.")); 1986 return; 1987 } 1988 if(K) 1989 { 1990 do 1991 { 1992 aux1 = NIL; 1993 aux2 = NIL; 1994 for(i=1;i<=m;i++) 1995 { 1996 if(i==n) { arg = set[k]; } 1997 else { arg = args[i]; } 1998 LstFastAppend(aux1, aux2, arg); 1999 } 2000 objCode = code.Evaluator(aux1); 2001 if(!objCode) 2002 { 2003 Error(I2("EvalSetNth failed.","Fallo en EvalSetNth.")); 2004 DESTROY(result); 2005 return; 2006 } 2007 LstFastAppend(result, aux3, objCode); 2008 k++; 2009 } 2010 while(k<=K); 1937 2011 } 1938 2012 contens_.RobElement(result);
Note: See TracChangeset
for help on using the changeset viewer.
