source: trunk/perl/Rappture.xs @ 829

Last change on this file since 829 was 665, checked in by dkearney, 17 years ago

Updates to Rappture::Utils::progress for all languages
removed the dependancy on Rappture.Units from within number.py, it should only depend on Rappture which will include Rappture.Units
added Rappture.Units as a module to load when people import Rappture in python.
added -V pbs variable to queue.py to include qsub environment variables in the submitted job.
updated setup.py.in to install Rappture.Utils
added progress bar to all app-fermi examples showing how to use the Rappture::Utils::progress function in all languages.
added destructor definitions to Node classes in src2/core

File size: 1.6 KB
Line 
1#include "rappture.h"
2#include <string>
3
4#include "EXTERN.h"
5#include "perl.h"
6#include "XSUB.h"
7
8#include "ppport.h"
9
10using namespace std;
11
12MODULE = Rappture               PACKAGE = Rappture::RpLibrary
13PROTOTYPES: ENABLE
14
15RpLibrary *
16RpLibrary::new(filename = "")
17char *filename
18        CODE:
19        RpLibrary *library;
20                if ((filename == NULL) || (*filename == '\0'))
21                        library = new RpLibrary();
22                else
23                        library = new RpLibrary(filename);
24
25                if (library->isNull())
26                {
27                        delete library;
28                        XSRETURN_UNDEF;
29                }
30                else
31                        RETVAL = library;
32        OUTPUT:
33                RETVAL
34
35void *
36RpLibrary::DESTROY()
37        CODE:
38                RETVAL = 0;
39
40const char *
41RpLibrary::get( path )
42char *path
43        CODE:
44                string result;
45                result = THIS->get(path);
46                RETVAL = result.c_str();
47        OUTPUT:
48                RETVAL
49
50void
51RpLibrary::put( path, value, append )
52char *path
53char *value
54int append
55        CODE:
56                THIS->put(path,value,"",append);
57
58void
59RpLibrary::putFile( path, fileName, compress, append )
60char *path
61char *fileName
62int compress
63int append
64        CODE:
65                THIS->putFile(path,fileName,compress,append);
66
67void
68RpLibrary::result()
69
70MODULE = Rappture               PACKAGE = Rappture::RpUnits
71
72const char *
73convert( fromVal, toUnitsName, showUnits = 1 )
74const char *fromVal
75const char *toUnitsName
76int showUnits
77        CODE:
78                string result;
79                result = RpUnits::convert(fromVal,toUnitsName,showUnits);
80
81                if (result.empty())
82                    XSRETURN_UNDEF;
83
84                RETVAL = result.c_str();
85        OUTPUT:
86                RETVAL
87
88MODULE = Rappture               PACKAGE = Rappture::Utils
89
90int
91progress( percent, message )
92int percent
93const char *message
94        CODE:
95                RETVAL = Rappture::Utils::progress(percent,message);
96        OUTPUT:
97                RETVAL
Note: See TracBrowser for help on using the repository browser.