Changeset 2544 for branches/blt4/src/core/RpLibraryFInterface.cc
- Timestamp:
- Sep 21, 2011, 2:28:26 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/blt4/src/core/RpLibraryFInterface.cc
r1105 r2544 211 211 } 212 212 213 214 //int rp_lib_child_comp ( int* handle, /* integer handle of library */215 // char* path, /* DOM path of requested object */216 // char* type, /* specific name of element */217 // int* childNum, /* child number for iteration */218 // char* retText, /* buffer to store return text */219 // int path_len, /* length of path */220 // int type_len, /* length of type */221 // int retText_len /* length of return text buffer */222 // )223 /*224 {225 int retVal = 0;226 227 char* inPath = NULL;228 char* inType = NULL;229 230 inPath = null_terminate(path,path_len);231 inType = null_terminate(type,type_len);232 233 if (inPath) {234 path_len = strlen(inPath) + 1;235 }236 else {237 path_len = 0;238 }239 240 if (inType) {241 type_len = strlen(inType) + 1;242 }243 else {244 type_len = 0;245 }246 247 retVal = rp_lib_child_str( handle,248 inPath,249 "component",250 inType,251 childNum,252 retText,253 path_len,254 10,255 type_len,256 retText_len257 );258 259 if (inPath) {260 free(inPath);261 inPath = NULL;262 }263 264 if (inType) {265 free(inType);266 inType = NULL;267 }268 269 return retVal;270 }271 */272 273 //int rp_lib_child_id( int* handle, /* integer handle of library */274 // char* path, /* DOM path of requested object */275 // char* type, /* specific name of element */276 // int* childNum, /* child number for iteration */277 // char* retText, /* buffer to store return text */278 // int path_len, /* length of path */279 // int type_len, /* length of type */280 // int retText_len /* length of return text buffer */281 // )282 /*283 {284 int retVal = 0;285 char* inPath = NULL;286 char* inType = NULL;287 288 inPath = null_terminate(path,path_len);289 inType = null_terminate(type,type_len);290 291 if (inPath) {292 path_len = strlen(inPath) + 1;293 }294 else {295 path_len = 0;296 }297 298 if (inType) {299 type_len = strlen(inType) + 1;300 }301 else {302 type_len = 0;303 }304 305 retVal = rp_lib_child_str( handle,306 inPath,307 "id",308 inType,309 childNum,310 retText,311 path_len,312 3,313 type_len,314 retText_len315 );316 317 if (inPath) {318 free(inPath);319 inPath = NULL;320 }321 322 if (inType) {323 free(inType);324 inType = NULL;325 }326 327 return retVal;328 }329 */330 331 //int rp_lib_child_type ( int* handle, /* integer handle of library */332 // char* path, /* DOM path of requested object */333 // char* type, /* specific name of element */334 // int* childNum, /* child number for iteration */335 // char* retText, /* buffer to store return text */336 // int path_len, /* length of path */337 // int type_len, /* length of type */338 // int retText_len /* length of return text buffer */339 // )340 /*341 {342 int retVal = 0;343 char* inPath = NULL;344 char* inType = NULL;345 346 inPath = null_terminate(path,path_len);347 inType = null_terminate(type,type_len);348 349 if (inPath) {350 path_len = strlen(inPath) + 1;351 }352 else {353 path_len = 0;354 }355 356 if (inType) {357 type_len = strlen(inType) + 1;358 }359 else {360 type_len = 0;361 }362 363 retVal = rp_lib_child_str( handle,364 inPath,365 "type",366 inType,367 childNum,368 retText,369 path_len,370 5,371 type_len,372 retText_len373 );374 375 if (inPath) {376 free(inPath);377 inPath = NULL;378 }379 380 if (inType) {381 free(inType);382 inType = NULL;383 }384 385 return retVal;386 }387 */388 389 /*390 int rp_lib_child_obj ( int* handle,391 char* path,392 char* type,393 int path_len,394 int type_len395 )396 {397 int newObjHandle = -1;398 399 PyObject* lib = NULL;400 PyObject* list = NULL;401 402 char* inPath = NULL;403 char* inType = NULL;404 405 inPath = null_terminate(path,path_len);406 inType = null_terminate(type,type_len);407 408 if (rapptureStarted) {409 if ((handle) && (*handle != 0)) {410 lib = (RpLibrary*) getObject_Void(*handle);411 412 if (lib) {413 list = rpChildren_f(lib, inPath, "object");414 if (list) {415 // store the whole list,416 // need to make a way to read the nodes417 newObjHandle = storeObject_Void((void*)list);418 // Py_DECREF(list);419 }420 else {421 422 }423 }424 }425 }426 427 if (inPath) {428 free(inPath);429 inPath = NULL;430 }431 432 if (inType) {433 free(inType);434 inType = NULL;435 }436 437 return newObjHandle;438 439 }440 */441 442 213 /**********************************************************************/ 443 214 // FUNCTION: rp_lib_get() … … 445 216 /** 446 217 */ 447 void rp_lib_get( int* handle, /* integer handle of library */ 448 char* path, /* null terminated path */ 449 char* retText, /* return text buffer for fortran*/ 450 int path_len, 451 int retText_len /* length of return text buffer */ 452 ) 218 void 219 rp_lib_get( 220 int* handle, /* integer handle of library */ 221 char* path, /* null terminated path */ 222 char* retText, /* return text buffer for fortran*/ 223 224 int retText_len) /* length of return text buffer */ 453 225 { 454 226 std::string xmlText = ""; … … 478 250 /** 479 251 */ 480 void rp_lib_get_str( int* handle, /* integer handle of library */ 481 char* path, /* null terminated path */ 482 char* retText, /* return text buffer for fortran*/ 483 int path_len, 484 int retText_len /* length of return text buffer */ 485 ) 252 void 253 rp_lib_get_str( 254 int* handle, /* integer handle of library */ 255 char* path, /* null terminated path */ 256 char* retText, /* return text buffer for fortran*/ 257 int path_len, 258 int retText_len) /* length of return text buffer */ 486 259 { 487 260 std::string xmlText = ""; … … 512 285 /** 513 286 */ 514 double rp_lib_get_double( int* handle, /* integer handle of library */ 515 char* path, /* null terminated path */ 516 int path_len 517 ) 287 double 288 rp_lib_get_double( 289 int* handle, /* integer handle of library */ 290 char* path, /* null terminated path */ 291 int path_len) 518 292 { 519 293 double retVal = 0.0; … … 602 376 return retVal; 603 377 } 378 379 380 /**********************************************************************/ 381 // FUNCTION: rp_lib_get_file() 382 /// Get data located at 'path' and write it to the file 'fileName'. 383 /** 384 * Returns if any bytes were written to the file 385 */ 386 int rp_lib_get_file ( int* handle, /* integer handle of library */ 387 char* path, /* null terminated path */ 388 char* fileName, /* name of file to write data to */ 389 int path_len, /* length of the path variable */ 390 int fileName_len /* length of the fileName variable */ 391 ) 392 { 393 size_t nbytes = 0; 394 395 RpLibrary* lib = NULL; 396 397 std::string inPath = ""; 398 std::string filePath = ""; 399 400 inPath = null_terminate_str(path,path_len); 401 filePath = null_terminate_str(fileName,fileName_len); 402 403 if ((handle) && (*handle != 0)) { 404 lib = (RpLibrary*) getObject_Void(*handle); 405 406 if (lib) { 407 nbytes = lib->getFile(inPath, filePath); 408 } 409 } 410 411 return nbytes; 412 } 413 604 414 605 415 … … 678 488 /** 679 489 */ 680 void rp_lib_put_data( int* handle, 681 char* path, 682 char* bytes, 683 int* nbytes, 684 int* append, 685 int path_len, 686 int bytes_len 687 ) 490 void 491 rp_lib_put_data( 492 int* handle, 493 char* path, 494 char* bytes, 495 int* nbytes, 496 int* append, 497 int path_len, 498 int bytes_len) 688 499 { 689 500 std::string inPath = ""; … … 718 529 /** 719 530 */ 720 void rp_lib_put_file( int* handle, 721 char* path, 722 char* fileName, 723 int* compress, 724 int* append, 725 int path_len, 726 int fileName_len 727 ) 531 void 532 rp_lib_put_file( 533 int* handle, 534 char* path, 535 char* fileName, 536 int* compress, 537 int* append, 538 int path_len, 539 int fileName_len) 728 540 { 729 541 std::string inPath = ""; … … 747 559 748 560 749 void rp_lib_put_obj( int* handle, 750 char* path, 751 int* valHandle, 752 int* append, 753 int path_len 754 ) 561 void 562 rp_lib_put_obj( 563 int* handle, 564 char* path, 565 int* valHandle, 566 int* append, 567 int path_len) 755 568 { 756 569 std::string inPath = ""; … … 781 594 } 782 595 } 783 784 785 /*786 void rp_lib_put_id_obj ( int* handle,787 char* path,788 int* valHandle,789 char* id,790 int* append,791 int path_len,792 int id_len793 )794 {795 PyObject* lib = NULL;796 PyObject* value = NULL;797 798 char* inPath = NULL;799 char* inId = NULL;800 801 inPath = null_terminate(path,path_len);802 inId = null_terminate(id,id_len);803 804 if (rapptureStarted) {805 if ((handle) && (*handle != 0)) {806 lib = (RpLibrary*) getObject_Void(*handle);807 value = (RpLibrary*) getObject_Void(*valHandle);808 809 if (lib && value) {810 // retObj is a borrowed object811 // whose contents must not be modified812 rpPutObj(lib, inPath, value, inId, *append);813 }814 }815 }816 817 if (inPath) {818 free(inPath);819 inPath = NULL;820 }821 822 if (inId) {823 free(inId);824 inId = NULL;825 }826 827 }828 */829 830 /*831 int rp_lib_remove (int* handle, char* path, int path_len)832 {833 int newObjHandle = -1;834 835 PyObject* lib = NULL;836 PyObject* removedObj = NULL;837 838 char* inPath = NULL;839 840 inPath = null_terminate(path,path_len);841 842 if (rapptureStarted) {843 if ((handle) && (*handle != 0)) {844 lib = (RpLibrary*) getObject_Void(*handle);845 846 if (lib) {847 removedObj = rpRemove(lib, inPath);848 849 if (removedObj) {850 newObjHandle = storeObject_Void((void*)removedObj);851 // Py_DECREF(removedObj);852 }853 854 }855 }856 }857 858 if (inPath) {859 free(inPath);860 inPath = NULL;861 }862 863 return newObjHandle;864 }865 */866 867 /*868 int rp_lib_xml_len (int* handle)869 {870 int length = -1;871 char* xmlText = NULL;872 873 PyObject* lib = NULL;874 875 if (rapptureStarted) {876 if ((handle) && (*handle != 0)) {877 lib = (RpLibrary*) getObject_Void(*handle);878 879 if (lib) {880 // dont modify xmlText, borrowed pointer881 xmlText = rpXml(lib);882 883 if (xmlText) {884 length = strlen(xmlText) + 1;885 free(xmlText);886 // printf("len = :%d:\n",length);887 }888 }889 }890 }891 return length;892 }893 */894 596 895 597 /**********************************************************************/
Note: See TracChangeset
for help on using the changeset viewer.