source: trunk/src/core/RpLibraryFInterface.cc @ 1105

Last change on this file since 1105 was 1105, checked in by dkearney, 16 years ago

adding grabdata to makefiles, changes to use a generic dictionary for objects in fortran bindings, updates to fortran progress function

File size: 26.7 KB
Line 
1/*
2 * ----------------------------------------------------------------------
3 *  INTERFACE: Fortran Rappture Library Source
4 *
5 * ======================================================================
6 *  AUTHOR:  Derrick Kearney, Purdue University
7 *  Copyright (c) 2004-2007  Purdue Research Foundation
8 *
9 *  See the file "license.terms" for information on usage and
10 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
11 * ======================================================================
12 */
13
14#include "RpLibraryFInterface.h"
15#include "RpBindingsDict.h"
16#include "RpLibraryFStubs.c"
17#include "RpDXWriter.h"
18
19/**********************************************************************/
20// FUNCTION: rp_lib(const char* filePath, int filePath_len)
21/// Open the file at 'filePath' and return Rappture Library Object.
22/**
23 */
24
25int rp_lib(const char* filePath, int filePath_len) {
26
27    RpLibrary* lib = NULL;
28    int handle = -1;
29    std::string inFilePath = "";
30
31    inFilePath = null_terminate_str(filePath, filePath_len);
32
33    // create a RapptureIO object and store in dictionary
34    lib = new RpLibrary(inFilePath);
35
36    if (lib) {
37        handle = storeObject_Void((void*)lib);
38    }
39
40    return handle;
41}
42
43/**********************************************************************/
44// FUNCTION: rp_lib_element_obj()
45/// Return the node located at 'path'.
46/**
47 */
48int rp_lib_element_obj(int* handle,     /* integer handle of library */
49                          char* path,     /* null terminated path */
50                          int path_len
51                        )
52{
53    int newObjHandle = -1;
54
55    std::string inPath = "";
56
57    RpLibrary* lib = NULL;
58    RpLibrary* retObj = NULL;
59
60    inPath = null_terminate_str(path,path_len);
61
62    if ((handle) && (*handle != 0)) {
63        lib = (RpLibrary*) getObject_Void(*handle);
64        if (lib) {
65            retObj = lib->element(inPath);
66
67            if (retObj) {
68                newObjHandle = storeObject_Void((void*)retObj);
69            }
70        }
71    }
72
73    return newObjHandle;
74}
75
76/**********************************************************************/
77// FUNCTION: rp_lib_element_comp()
78/// Return the component name of the node located at 'path'.
79/**
80 */
81void rp_lib_element_comp( int* handle, /* integer handle of library */
82                            char* path,      /* null terminated path */
83                            char* retText,   /* return buffer for fortran*/
84                            int path_len,
85                            int retText_len /* length of return text buffer */
86                          )
87{
88    std::string inPath = "";
89    RpLibrary* lib = NULL;
90    std::string retStr = "";
91
92    inPath = null_terminate_str(path,path_len);
93
94    lib = (RpLibrary*) getObject_Void(*handle);
95
96    if (lib) {
97        retStr = lib->element(inPath)->nodeComp();
98        if (!retStr.empty()) {
99            fortranify(retStr.c_str(),retText,retText_len);
100        }
101    }
102
103}
104
105/**********************************************************************/
106// FUNCTION: rp_lib_element_id()
107/// Return the 'id' of node located at 'path'.
108/**
109 */
110void rp_lib_element_id(   int* handle,       /* integer handle of library    */
111                            char* path,      /* path of element within xml   */
112                            char* retText,   /* return buffer for fortran    */
113                            int path_len,
114                            int retText_len  /* length of return text buffer */
115                        )
116{
117    std::string inPath = "";
118    RpLibrary* lib = NULL;
119    std::string retStr = "";
120
121    inPath = null_terminate_str(path,path_len);
122
123    lib = (RpLibrary*) getObject_Void(*handle);
124
125    if (lib) {
126        retStr = lib->element(inPath)->nodeId();
127        if (!retStr.empty()) {
128            fortranify(retStr.c_str(),retText,retText_len);
129        }
130    }
131}
132
133/**********************************************************************/
134// FUNCTION: rp_lib_element_type()
135/// Return the type of the node located at 'path'.
136/**
137 */
138void rp_lib_element_type( int* handle,       /* integer handle of library */
139                            char* path,      /* search path inside xml */
140                            char* retText,   /* return buffer for fortran*/
141                            int path_len,
142                            int retText_len  /* length of return text buffer */
143                          )
144{
145    std::string inPath = "";
146    RpLibrary* lib = NULL;
147    std::string retStr = "";
148
149    inPath = null_terminate_str(path,path_len);
150
151    lib = (RpLibrary*) getObject_Void(*handle);
152
153    if (lib) {
154        retStr = lib->element(inPath)->nodeType();
155        fortranify(retStr.c_str(),retText,retText_len);
156    }
157}
158
159/**********************************************************************/
160// FUNCTION: rp_lib_children(const char* filePath, int filePath_len)
161/// Retrieve the next child of 'path' from the Rappture Library Object.
162/**
163 */
164int rp_lib_children (   int* handle, /* integer handle of library */
165                        char* path, /* search path of the xml */
166                        int* childHandle, /*integer hanlde of last returned child*/
167                        int path_len  /* length of the search path buffer */
168                    ) {
169
170    std::string inPath = "";
171    RpLibrary* lib = NULL;
172    RpLibrary* childNode = NULL;
173    int newObjHandle = -1;
174
175    inPath = null_terminate_str(path,path_len);
176
177    if (handle && (*handle >= 0) ) {
178        lib = (RpLibrary*) getObject_Void(*handle);
179        if (lib) {
180
181            if (*childHandle > 0) {
182                // check to see if there were any previously returned children
183                childNode = (RpLibrary*) getObject_Void(*childHandle);
184            }
185
186            // call the children base method
187            childNode = lib->children(inPath,childNode);
188
189            // store the childNode in the dictionary.
190            //
191            // because the base method is using static memory to get store the
192            // children we should be able to check and see if the childHandle
193            // was valid.
194            // if so, then we can just return the childHandle back to the user
195            // if not, store the object in the dictionary and return the new
196            // handle.
197
198            if (childNode) {
199                if (*childHandle < 1) {
200                    newObjHandle = storeObject_Void((void*)childNode);
201                }
202                else {
203                    newObjHandle = storeObject_Void((void*)childNode,*childHandle);
204                }
205            }
206        }
207    }
208
209    return newObjHandle;
210
211}
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_len
257                               );
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_len
315                               );
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_len
373                               );
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/*
390int rp_lib_child_obj ( int* handle,
391                            char* path,
392                            char* type,
393                            int path_len,
394                            int type_len
395                          )
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 nodes
417                    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/**********************************************************************/
443// FUNCTION: rp_lib_get()
444/// Get data located at 'path' and return it as a string value.
445/**
446 */
447void 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                 )
453{
454    std::string xmlText = "";
455
456    RpLibrary* lib = NULL;
457
458    std::string inPath = "";
459
460    inPath = null_terminate_str(path,path_len);
461
462    if ((handle) && (*handle != 0)) {
463        lib = (RpLibrary*) getObject_Void(*handle);
464
465        if (lib) {
466            xmlText = lib->get(inPath);
467            if (!xmlText.empty()) {
468                fortranify(xmlText.c_str(),retText,retText_len);
469            }
470
471        }
472    }
473}
474
475/**********************************************************************/
476// FUNCTION: rp_lib_get_str()
477/// Get data located at 'path' and return it as a string value.
478/**
479 */
480void 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                 )
486{
487    std::string xmlText = "";
488
489    RpLibrary* lib = NULL;
490
491    std::string inPath = "";
492
493    inPath = null_terminate_str(path,path_len);
494
495    if ((handle) && (*handle != 0)) {
496        lib = (RpLibrary*) getObject_Void(*handle);
497
498        if (lib) {
499            xmlText = lib->getString(inPath);
500            if (!xmlText.empty()) {
501                fortranify(xmlText.c_str(),retText,retText_len);
502            }
503
504        }
505    }
506}
507
508
509/**********************************************************************/
510// FUNCTION: rp_lib_get_double()
511/// Get data located at 'path' and return it as a double precision value.
512/**
513 */
514double rp_lib_get_double( int* handle,   /* integer handle of library */
515                            char* path,    /* null terminated path */
516                            int path_len
517                          )
518{
519    double retVal = 0.0;
520
521    RpLibrary* lib = NULL;
522
523    std::string inPath = "";
524
525    inPath = null_terminate_str(path,path_len);
526
527    if ((handle) && (*handle != 0)) {
528        lib = (RpLibrary*) getObject_Void(*handle);
529
530        if (lib) {
531            retVal = lib->getDouble(inPath);
532        }
533    }
534
535    return retVal;
536}
537
538
539/**********************************************************************/
540// FUNCTION: rp_lib_get_integer()
541/// Get data located at 'path' and return it as an integer value.
542/**
543 */
544int rp_lib_get_integer( int* handle,   /* integer handle of library */
545                        char* path,    /* null terminated path */
546                        int path_len
547                      )
548{
549    int retVal = 0;
550
551    RpLibrary* lib = NULL;
552
553    std::string inPath = "";
554
555    inPath = null_terminate_str(path,path_len);
556
557    if ((handle) && (*handle != 0)) {
558        lib = (RpLibrary*) getObject_Void(*handle);
559
560        if (lib) {
561            retVal = lib->getInt(inPath);
562        }
563    }
564
565    return retVal;
566}
567
568
569/**********************************************************************/
570// FUNCTION: rp_lib_get_boolean()
571/// Get data located at 'path' and return it as an integer value.
572/**
573 */
574int rp_lib_get_boolean( int* handle,   /* integer handle of library */
575                        char* path,    /* null terminated path */
576                        int path_len
577                      )
578{
579    bool value = false;
580    int retVal = 0;
581
582    RpLibrary* lib = NULL;
583
584    std::string inPath = "";
585
586    inPath = null_terminate_str(path,path_len);
587
588    if ((handle) && (*handle != 0)) {
589        lib = (RpLibrary*) getObject_Void(*handle);
590
591        if (lib) {
592            value = lib->getBool(inPath);
593            if (value == true) {
594                retVal = 1;
595            }
596            else {
597                retVal = 0;
598            }
599        }
600    }
601
602    return retVal;
603}
604
605
606/**********************************************************************/
607// FUNCTION: rp_lib_put_str()
608/// Put string into Rappture Library Object at location 'path'.
609/**
610 */
611void rp_lib_put_str( int* handle,
612                        char* path,
613                        char* value,
614                        int* append,
615                        int path_len,
616                        int value_len
617                      )
618{
619    std::string inPath = "";
620    std::string inValue = "";
621    RpLibrary* lib = NULL;
622
623    inPath = null_terminate_str(path,path_len);
624    inValue = null_terminate_str(value,value_len);
625
626    if ((handle) && (*handle != 0)) {
627        lib = (RpLibrary*) getObject_Void(*handle);
628
629        if (lib) {
630            lib->put(inPath,inValue,"",*append);
631        }
632    }
633
634    return;
635
636}
637
638
639/**********************************************************************/
640// FUNCTION: rp_lib_put_id_str()
641/// Put string into Rappture Library Object at location 'path' with id = 'id'
642/**
643 */
644void rp_lib_put_id_str ( int* handle,
645                        char* path,
646                        char* value,
647                        char* id,
648                        int* append,
649                        int path_len,
650                        int value_len,
651                        int id_len
652                      )
653{
654    RpLibrary* lib = NULL;
655
656    std::string inPath = "";
657    std::string inValue = "";
658    std::string inId = "";
659
660    inPath = null_terminate_str(path,path_len);
661    inValue = null_terminate_str(value,value_len);
662    inId = null_terminate_str(id,id_len);
663
664    if ((handle) && (*handle != 0)) {
665        lib = (RpLibrary*) getObject_Void(*handle);
666
667        if (lib) {
668            lib->put(inPath,inValue,inId,*append);
669        }
670    }
671
672}
673
674
675/**********************************************************************/
676// FUNCTION: rp_lib_put_data()
677/// Put string into Rappture Library Object at location 'path'.
678/**
679 */
680void 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                      )
688{
689    std::string inPath = "";
690    RpLibrary* lib = NULL;
691    int bufferSize = 0;
692
693    inPath = null_terminate_str(path,path_len);
694
695    if (*nbytes < bytes_len) {
696        bufferSize = *nbytes;
697    }
698    else {
699        bufferSize = bytes_len;
700    }
701
702    if ((handle) && (*handle != 0)) {
703        lib = (RpLibrary*) getObject_Void(*handle);
704
705        if (lib) {
706            lib->putData(inPath,bytes,bufferSize,*append);
707        }
708    }
709
710    return;
711
712}
713
714
715/**********************************************************************/
716// FUNCTION: rp_lib_put_file()
717/// Put string into Rappture Library Object at location 'path'.
718/**
719 */
720void 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                      )
728{
729    std::string inPath = "";
730    std::string inFileName = "";
731    RpLibrary* lib = NULL;
732
733    inPath = null_terminate_str(path,path_len);
734    inFileName = null_terminate_str(fileName,fileName_len);
735
736    if ((handle) && (*handle != 0)) {
737        lib = (RpLibrary*) getObject_Void(*handle);
738
739        if (lib) {
740            lib->putFile(inPath,inFileName,*compress,*append);
741        }
742    }
743
744    return;
745
746}
747
748
749void rp_lib_put_obj( int* handle,
750                        char* path,
751                        int* valHandle,
752                        int* append,
753                        int path_len
754                      )
755{
756    std::string inPath = "";
757    RpLibrary* lib = NULL;
758    // Rp_Obj does not currently exist
759    Rappture::DXWriter* obj = NULL;
760    char* objStr = NULL;
761
762
763    inPath = null_terminate_str(path,path_len);
764
765    if ((handle) && (*handle != 0)) {
766        lib = (RpLibrary*) getObject_Void(*handle);
767        if (!lib) {
768            // return error, lib was not found
769        }
770
771        obj = (Rappture::DXWriter*) getObject_Void(*valHandle);
772        if (!obj) {
773            // return error, obj was not found
774        }
775
776        // textsize function does not currently exist
777        objStr = (char*) malloc(obj->size()*sizeof(char));
778        obj->write(objStr);
779        lib->put(inPath,objStr,"",*append);
780        free(objStr);
781    }
782}
783
784
785/*
786void 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_len
793                      )
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 object
811                // whose contents must not be modified
812                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/*
831int 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/*
868int 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 pointer
881                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
895/**********************************************************************/
896// FUNCTION: rp_lib_write_xml()
897/// Write the xml text into a file.
898/**
899 * \sa {rp_result}
900 */
901int rp_lib_write_xml(int* handle, char* outFile, int outFile_len)
902{
903    int retVal = -1;
904    RpLibrary* lib = NULL;
905    std::string inOutFile = "";
906    std::string xmlText = "";
907    std::fstream file;
908
909    inOutFile = null_terminate_str(outFile, outFile_len);
910
911    if (!inOutFile.empty() ) {
912        file.open(inOutFile.c_str(),std::ios::out);
913    }
914
915    if ( file.is_open() ) {
916        if ((handle) && (*handle != 0)) {
917            lib = (RpLibrary*) getObject_Void(*handle);
918
919            if (lib) {
920                xmlText = lib->xml();
921                if (!xmlText.empty()) {
922                    file << xmlText;
923                    retVal = 0;
924                }
925            }
926        }
927
928        file.close();
929    }
930
931    return retVal;
932}
933
934/**********************************************************************/
935// FUNCTION: rp_lib_xml()
936/// Return this node's xml text
937/**
938 */
939void  rp_lib_xml(int* handle, char* retText, int retText_len)
940{
941    std::string xmlText = "";
942
943    RpLibrary* lib = NULL;
944
945    if ((handle) && (*handle != 0)) {
946        lib = (RpLibrary*) getObject_Void(*handle);
947
948        if (lib) {
949            xmlText = lib->xml();
950            if (!xmlText.empty()) {
951                fortranify(xmlText.c_str(), retText, retText_len);
952            }
953        }
954    }
955}
956
957/**********************************************************************/
958// FUNCTION: rp_lib_node_comp()
959/// Return this node's component name
960/**
961 */
962void rp_lib_node_comp ( int* handle, char* retText, int retText_len ) {
963
964    std::string retStr = "";
965    RpLibrary* node = NULL;
966
967    if ((handle) && (*handle != 0)) {
968        node = (RpLibrary*) getObject_Void(*handle);
969
970        if (node) {
971            retStr = node->nodeComp();
972            if (!retStr.empty()) {
973                fortranify(retStr.c_str(), retText, retText_len);
974            }
975        }
976    }
977}
978
979/**********************************************************************/
980// FUNCTION: rp_lib_node_type()
981/// Return this node's type
982/**
983 */
984void rp_lib_node_type ( int* handle, char* retText, int retText_len ) {
985
986    std::string retStr = "";
987    RpLibrary* node = NULL;
988
989    if ((handle) && (*handle != 0)) {
990        node = (RpLibrary*) getObject_Void(*handle);
991
992        if (node) {
993            retStr = node->nodeType();
994            if (!retStr.empty()) {
995                fortranify(retStr.c_str(), retText, retText_len);
996            }
997        }
998    }
999}
1000
1001/**********************************************************************/
1002// FUNCTION: rp_lib_node_id()
1003/// Return this node's id.
1004/**
1005 */
1006void rp_lib_node_id ( int* handle, char* retText, int retText_len ) {
1007
1008    std::string retStr = "";
1009    RpLibrary* node = NULL;
1010
1011    if ((handle) && (*handle != 0)) {
1012        node = (RpLibrary*) getObject_Void(*handle);
1013
1014        if (node) {
1015            retStr = node->nodeId();
1016            if (!retStr.empty()) {
1017                fortranify(retStr.c_str(), retText, retText_len);
1018            }
1019        }
1020    }
1021}
1022
1023/**********************************************************************/
1024// FUNCTION: rp_result()
1025/// Write xml text to a run.xml file and signal the program has completed
1026/**
1027 */
1028void rp_result(int* handle) {
1029    RpLibrary* lib = NULL;
1030
1031    if (handle && *handle != 0) {
1032        lib = (RpLibrary*) getObject_Void(*handle);
1033        if (lib) {
1034            lib->put("tool.version.rappture.language", "fortran");
1035            lib->result();
1036        }
1037    }
1038
1039    // do no delete this, still working on testing this
1040    cleanLibDict();
1041}
1042
Note: See TracBrowser for help on using the repository browser.