Changeset 83 for trunk/src/fortran
- Timestamp:
- Oct 5, 2005, 8:17:26 AM (19 years ago)
- Location:
- trunk/src/fortran
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/fortran/RpFortranCommon.c
r77 r83 1 /* 2 * ---------------------------------------------------------------------- 3 * INTERFACE: Fortran Rappture Common Functions Source 4 * 5 * Fortran functions common to all interfaces. 6 * 7 * ====================================================================== 8 * AUTHOR: Derrick Kearney, Purdue University 9 * Copyright (c) 2005 10 * Purdue Research Foundation, West Lafayette, IN 11 * ====================================================================== 12 */ 13 14 1 15 #include "RpFortranCommon.h" 2 16 -
trunk/src/fortran/RpLibraryFInterface.cc
r77 r83 1 /* 2 * ---------------------------------------------------------------------- 3 * INTERFACE: Fortran Rappture Library Source 4 * 5 * ====================================================================== 6 * AUTHOR: Derrick Kearney, Purdue University 7 * Copyright (c) 2005 8 * Purdue Research Foundation, West Lafayette, IN 9 * ====================================================================== 10 */ 11 1 12 #include "RpLibraryFInterface.h" 2 13 … … 8 19 9 20 inFilePath = null_terminate_str(filePath, filePath_len); 10 21 11 22 // create a RapptureIO object and store in dictionary 12 23 lib = new RpLibrary(inFilePath); … … 37 48 if (lib) { 38 49 retObj = lib->element(inPath); 39 50 40 51 if (retObj) { 41 52 newObjHandle = storeObject_Lib(retObj); … … 68 79 } 69 80 } 70 81 71 82 } 72 83 … … 95 106 96 107 void rp_lib_element_type( int* handle, /* integer handle of library */ 97 char* path, /* null terminated path*/108 char* path, /* search path inside xml */ 98 109 char* retText, /* return buffer for fortran*/ 99 110 int path_len, … … 113 124 fortranify(retStr.c_str(),retText,retText_len); 114 125 } 126 } 127 128 int rp_lib_children ( int* handle, /* integer handle of library */ 129 char* path, /* search path of the xml */ 130 int* childHandle, /*integer hanlde of last returned child*/ 131 int path_len /* length of the search path buffer */ 132 ) { 133 134 std::string inPath = ""; 135 RpLibrary* lib = NULL; 136 RpLibrary* childNode = NULL; 137 int newObjHandle = -1; 138 139 inPath = null_terminate_str(path,path_len); 140 141 if (handle && (*handle >= 0) ) { 142 lib = getObject_Lib(*handle); 143 if (lib) { 144 if (*childHandle < 1) { 145 // check to see if there were any previously returned children 146 childNode = getObject_Lib(*childHandle); 147 } 148 149 // call the children base method 150 childNode = lib->children(path,childNode); 151 152 // store the childNode in the dictionary. 153 // 154 // because the base method is using static memory to get store the 155 // children we should be able to chekc and see if the childHandle 156 // was valud. 157 // if so, then we can just return the childHandle back to the user 158 // if not, store the object in the dictionary and return the new 159 // handle. 160 161 if (childNode) { 162 if (*childHandle < 1) { 163 newObjHandle = storeObject_Lib(childNode); 164 } 165 else { 166 newObjHandle = *childHandle; 167 } 168 } 169 } 170 } 171 172 return newObjHandle; 173 115 174 } 116 175 … … 128 187 129 188 inPath = null_terminate(path,path_len); 130 189 131 190 if (rapptureStarted) { 132 191 if ((handle) && (*handle != 0)) { … … 140 199 } 141 200 else { 142 201 143 202 } 144 203 } … … 394 453 395 454 RpLibrary* lib = NULL; 396 455 397 456 std::string inPath = ""; 398 457 … … 401 460 if ((handle) && (*handle != 0)) { 402 461 lib = getObject_Lib(*handle); 403 462 404 463 if (lib) { 405 464 xmlText = lib->getString(inPath); … … 420 479 421 480 RpLibrary* lib = NULL; 422 481 423 482 std::string inPath = ""; 424 483 … … 427 486 if ((handle) && (*handle != 0)) { 428 487 lib = getObject_Lib(*handle); 429 488 430 489 if (lib) { 431 490 retVal = lib->getDouble(inPath); … … 443 502 int path_len, 444 503 int value_len 445 ) 504 ) 446 505 { 447 506 std::string inPath = ""; … … 459 518 } 460 519 } 461 520 462 521 return; 463 522 464 523 } 465 524 … … 476 535 { 477 536 RpLibrary* lib = NULL; 478 537 479 538 std::string inPath = ""; 480 539 std::string inValue = ""; … … 487 546 if ((handle) && (*handle != 0)) { 488 547 lib = getObject_Lib(*handle); 489 548 490 549 if (lib) { 491 550 lib->put(inPath,inValue,inId,*append); … … 586 645 PyObject* lib = NULL; 587 646 PyObject* removedObj = NULL; 588 647 589 648 char* inPath = NULL; 590 649 … … 597 656 if (lib) { 598 657 removedObj = rpRemove(lib, inPath); 599 658 600 659 if (removedObj) { 601 660 newObjHandle = storeObject_Lib(removedObj); … … 606 665 } 607 666 } 608 667 609 668 if (inPath) { 610 669 free(inPath); … … 643 702 } 644 703 */ 645 646 void rp_lib_xml(int* handle, char* retText, int retText_len)647 {648 std::string xmlText = "";649 650 RpLibrary* lib = NULL;651 652 if ((handle) && (*handle != 0)) {653 lib = getObject_Lib(*handle);654 655 if (lib) {656 xmlText = lib->xml();657 if (!xmlText.empty()) {658 fortranify(xmlText.c_str(), retText, retText_len);659 }660 }661 }662 }663 704 664 705 int rp_lib_write_xml(int* handle, char* outFile, int outFile_len) … … 695 736 } 696 737 738 void rp_lib_xml(int* handle, char* retText, int retText_len) 739 { 740 std::string xmlText = ""; 741 742 RpLibrary* lib = NULL; 743 744 if ((handle) && (*handle != 0)) { 745 lib = getObject_Lib(*handle); 746 747 if (lib) { 748 xmlText = lib->xml(); 749 if (!xmlText.empty()) { 750 fortranify(xmlText.c_str(), retText, retText_len); 751 } 752 } 753 } 754 } 755 756 void rp_lib_node_comp ( int* handle, char* retText, int retText_len ) { 757 758 std::string retStr = ""; 759 RpLibrary* node = NULL; 760 761 if ((handle) && (*handle != 0)) { 762 node = getObject_Lib(*handle); 763 764 if (node) { 765 retStr = node->nodeComp(); 766 if (!retStr.empty()) { 767 fortranify(retStr.c_str(), retText, retText_len); 768 } 769 } 770 } 771 } 772 773 void rp_lib_node_type ( int* handle, char* retText, int retText_len ) { 774 775 std::string retStr = ""; 776 RpLibrary* node = NULL; 777 778 if ((handle) && (*handle != 0)) { 779 node = getObject_Lib(*handle); 780 781 if (node) { 782 retStr = node->nodeType(); 783 if (!retStr.empty()) { 784 fortranify(retStr.c_str(), retText, retText_len); 785 } 786 } 787 } 788 } 789 790 void rp_lib_node_id ( int* handle, char* retText, int retText_len ) { 791 792 std::string retStr = ""; 793 RpLibrary* node = NULL; 794 795 if ((handle) && (*handle != 0)) { 796 node = getObject_Lib(*handle); 797 798 if (node) { 799 retStr = node->nodeId(); 800 if (!retStr.empty()) { 801 fortranify(retStr.c_str(), retText, retText_len); 802 } 803 } 804 } 805 } 806 697 807 void rp_quit() 698 808 { … … 701 811 702 812 RpDictEntry DICT_TEMPLATE *hPtr; 703 // RpDictIterator DICT_TEMPLATE iter((RpDict&)*this); 813 // RpDictIterator DICT_TEMPLATE iter((RpDict&)*this); 704 814 RpDictIterator DICT_TEMPLATE iter(fortObjDict_Lib); 705 706 hPtr = iter.first(); 707 815 816 hPtr = iter.first(); 817 708 818 while (hPtr) { 709 819 // Py_DECREF(*(hPtr->getValue())); 710 820 hPtr->erase(); 711 hPtr = iter.next(); 821 hPtr = iter.next(); 712 822 } 713 823 … … 717 827 } 718 828 829 } 830 831 void rp_result(int* handle) { 832 RpLibrary* lib = NULL; 833 834 if (handle && *handle != 0) { 835 lib = getObject_Lib(*handle); 836 if (lib) { 837 lib->result(); 838 } 839 } 719 840 } 720 841 … … 756 877 fortObjDict_Lib.set(dictKey,objectName, &newEntry); 757 878 } 758 879 759 880 retVal = dictKey; 760 881 return retVal; -
trunk/src/fortran/RpUnitsFInterface.cc
r76 r83 1 /* 2 * ---------------------------------------------------------------------- 3 * INTERFACE: Fortran Rappture Units Source 4 * 5 * ====================================================================== 6 * AUTHOR: Derrick Kearney, Purdue University 7 * Copyright (c) 2005 8 * Purdue Research Foundation, West Lafayette, IN 9 * ====================================================================== 10 */ 11 1 12 #include "RpUnits.h" 2 13 #include "RpDict.h"
Note: See TracChangeset
for help on using the changeset viewer.