Changeset 2f63f77 in tol for tol/contrib/cint/tolCint.cpp
- Timestamp:
- Dec 11, 2010, 1:49:59 PM (16 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- efb66ad
- Parents:
- 07dc080
- File:
-
- 1 edited
-
tol/contrib/cint/tolCint.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tol/contrib/cint/tolCint.cpp
r07dc080 r2f63f77 28 28 #include <tol/tol_blanguag.h> 29 29 #include <tol/tol_bdatgra.h> 30 #include <tol/tol_bmatgra.h> 30 31 #include <tol/tol_bdtegra.h> 31 32 #include <tol/tol_btxtgra.h> … … 178 179 } 179 180 181 //-------------------------------------------------------------------- 182 DeclareContensClass(BDat, BDatTemporary, BDatCINT_import_tol_var); 183 DefExtOpr(1, BDatCINT_import_tol_var, 184 "Cint.import_tol_var", 1, 0, "Anything Anything", 185 "(Anything var1 [, Anything var2, ...])", 186 I2("Imports TOL variables, global or local, into CINT global scope.\n" 187 "Returns the number of imported variables\n" 188 "TOL variables must have a valid name in TOL and C languages.\n" 189 "At this moment these are the available TOL types :\n" 190 " TOL CINT\n" 191 " Real double\n" 192 " Matrix class Matrix\n" 193 " Text class Text\n" 194 "You can view the declaration of corresponding C/C++ types at ", 195 "Importa variables TOL, globales o locales, al ámbito global de CINT\n" 196 "Devuelve el número total de variables correctamen te importadas.\n" 197 "Las variables TOL deben tener un nombre válido en los lenguajes " 198 "TOL y C\n" 199 "Los tipos TOL admitidos para la importación son los siguientes:\n" 200 " TOL CINT\n" 201 " Real double\n" 202 " Matrix class Matrix\n" 203 " Text class Text\n" 204 "Puede ver la declaración de los correspondientes tipos C/C++ en ")+ 205 "\nhttps://www.tol-project.org/browser/tolp/trunk/tol/" 206 "stdlib/general/TolCint/tol_cint_casting.cpp"+ 207 cint_url_link, 208 BOperClassify::Conversion_); 209 void BDatCINT_import_tol_var::CalcContens() 210 //-------------------------------------------------------------------- 211 { 212 if(CheckNonDeclarativeAction("Cint.import_tol_var")) { return; } 213 214 BSyntaxObject* var = NULL; 215 int numArg; 216 contens_ = 0; 217 218 for(numArg = 1; var=Arg(numArg); numArg++) 219 { 220 BGrammar* gra = var->Grammar(); 221 if(gra==GraReal()) 222 { 223 BDat& dat = Dat(var); 224 double* ptr = (double*)(&dat); 225 int ptrNum = (int)ptr; 226 BText expression = BText("double& ")+var->Name()+" = *((double *)("<<ptrNum<<"))"; 227 //Std(BText("TRACE [Cint.import_tol_variable] ")+expression); 228 G__exec_text(expression); 229 contens_ += 1; 230 } 231 else if(gra==GraMatrix()) 232 { 233 BMat& mat = Mat(var); 234 double* ptr = (double*)(mat.GetData().GetBuffer()); 235 int ptrNum = (int)ptr; 236 BText expression = BText("Matrix ")+var->Name()+" ( "<< 237 mat.Rows()<<","<< 238 mat.Columns()<<","<< 239 " ((double *)("<<ptrNum<<")) ); 0;"; 240 //Std(BText("TRACE [Cint.import_tol_variable] ")+expression); 241 G__exec_text(expression); 242 contens_ += 1; 243 } 244 else 245 { 246 Warning(BText("[Cint.import_tol_variable] ")+ 247 "Cannot import TOL variables of type "<<gra->Name()); 248 } 249 } 250 } 251
Note: See TracChangeset
for help on using the changeset viewer.
