- Timestamp:
- Jan 12, 2017, 11:35:17 AM (10 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- b57479d
- Parents:
- a52bf16
- File:
-
- 1 edited
-
rtol/source/tolRlink.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
rtol/source/tolRlink.cpp
ra52bf16 ra53fb9c 195 195 196 196 //---------------------------------------------------------------------------- 197 extern "C" DLLEXPORT(void) RTolSetReal(char **name, int *type, double *value )197 extern "C" DLLEXPORT(void) RTolSetReal(char **name, int *type, double *value, int *ok) 198 198 //---------------------------------------------------------------------------- 199 199 { … … 215 215 BList* aux = NIL; 216 216 LstFastAppend(result, aux, so); 217 } 218 } 219 220 //---------------------------------------------------------------------------- 221 extern "C" DLLEXPORT(void) RTolSetText(char **name, char **value) 217 R_concat(&R_stack, result); 218 *ok = 1; 219 } 220 else { 221 *ok = 0; 222 } 223 } 224 225 //---------------------------------------------------------------------------- 226 extern "C" DLLEXPORT(void) RTolSetText(char **name, char **value, int *ok) 222 227 //---------------------------------------------------------------------------- 223 228 { … … 230 235 BList* aux = NIL; 231 236 LstFastAppend(result, aux, so); 232 } 233 } 234 235 //---------------------------------------------------------------------------- 236 extern "C" DLLEXPORT(void) RTolSetDate(char **name, int *type, double *value) 237 R_concat(&R_stack, result); 238 *ok = 1; 239 } 240 else { 241 *ok = 0; 242 } 243 } 244 245 //---------------------------------------------------------------------------- 246 extern "C" DLLEXPORT(void) RTolSetDate(char **name, int *type, double *value, int *ok) 237 247 //---------------------------------------------------------------------------- 238 248 { … … 243 253 d.PutIndex(*value); 244 254 } else if(*type == 2) { 255 d.PutIndex(219147); // End 256 } else if(*type == 3) { 245 257 d.PutIndex(-115782); // Begin 246 } else if(*type == 3) {247 d.PutIndex(219147); // End248 258 } else { // type 1 249 259 d.PutIndex(-300000); // Unknown … … 254 264 BList* aux = NIL; 255 265 LstFastAppend(result, aux, so); 256 } 257 } 258 259 ////////////////////////////////////////////////////////////////////////////// 260 266 R_concat(&R_stack, result); 267 *ok = 1; 268 } 269 else { 270 *ok = 0; 271 } 272 } 273 274 //---------------------------------------------------------------------------- 275 extern "C" DLLEXPORT(void) RTolSetMatrix(char **name, int *rows, int *cols, 276 bool *mask, int *type, double *value, int *ok) 277 //---------------------------------------------------------------------------- 278 { 279 if(TOLHasBeenInitialized()==0) RInitTolKernel(); 280 char* str_name = (char*)*name; 281 BMat d(*rows, *cols); 282 for (int c=0; c< (*cols); ++c) { 283 for (int r=0; r< (*rows); ++r) { 284 int p = c * (*rows) + r; 285 if(*mask) { 286 if(type[p] == 0) { 287 d(r, c).PutValue(value[p]); 288 } else if(type[p] == 2) { 289 d(r, c).PutValue(BDat::PosInf()); 290 } else if(type[p] == 3) { 291 d(r, c).PutValue(BDat::NegInf()); 292 } else { // type 1 293 d(r, c).PutKnown(BUNKNOWN); 294 } 295 } else { 296 d(r, c).PutValue(value[p]); 297 } 298 } 299 } 300 BSyntaxObject * so = new BContensMat(str_name, d, ""); 301 if (so) { 302 BList* result = NIL; 303 BList* aux = NIL; 304 LstFastAppend(result, aux, so); 305 R_concat(&R_stack, result); 306 *ok = 1; 307 } 308 else { 309 *ok = 0; 310 } 311 } 312 313 ////////////////////////////////////////////////////////////////////////////// 314
Note: See TracChangeset
for help on using the changeset viewer.
