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 | |
---|
10 | using namespace std; |
---|
11 | |
---|
12 | MODULE = Rappture PACKAGE = Rappture::RpLibrary |
---|
13 | PROTOTYPES: ENABLE |
---|
14 | |
---|
15 | RpLibrary * |
---|
16 | RpLibrary::new(filename = "") |
---|
17 | const char *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 | |
---|
35 | void * |
---|
36 | RpLibrary::DESTROY() |
---|
37 | CODE: |
---|
38 | RETVAL = 0; |
---|
39 | OUTPUT: |
---|
40 | RETVAL |
---|
41 | |
---|
42 | SV * |
---|
43 | RpLibrary::get( path ) |
---|
44 | const char *path |
---|
45 | CODE: |
---|
46 | string result; |
---|
47 | result = THIS->get(path); |
---|
48 | RETVAL = newSVpvn(result.data(),result.length()); |
---|
49 | OUTPUT: |
---|
50 | RETVAL |
---|
51 | |
---|
52 | void |
---|
53 | RpLibrary::put( path, value, append ) |
---|
54 | const char *path |
---|
55 | const char *value |
---|
56 | int append |
---|
57 | CODE: |
---|
58 | THIS->put(path,value,"",append); |
---|
59 | |
---|
60 | void |
---|
61 | RpLibrary::putFile( path, fileName, compress, append ) |
---|
62 | const char *path |
---|
63 | const char *fileName |
---|
64 | int compress |
---|
65 | int append |
---|
66 | CODE: |
---|
67 | THIS->putFile(path,fileName,compress,append); |
---|
68 | |
---|
69 | void |
---|
70 | RpLibrary::result() |
---|
71 | CODE: |
---|
72 | THIS->put("tool.version.rappture.language", "perl"); |
---|
73 | THIS->result(); |
---|
74 | |
---|
75 | MODULE = Rappture PACKAGE = Rappture::RpUnits |
---|
76 | |
---|
77 | const char * |
---|
78 | convert( fromVal, toUnitsName, showUnits = 1 ) |
---|
79 | const char *fromVal |
---|
80 | const char *toUnitsName |
---|
81 | int showUnits |
---|
82 | CODE: |
---|
83 | string result; |
---|
84 | result = RpUnits::convert(fromVal,toUnitsName,showUnits); |
---|
85 | |
---|
86 | if (result.empty()) |
---|
87 | XSRETURN_UNDEF; |
---|
88 | |
---|
89 | RETVAL = result.c_str(); |
---|
90 | OUTPUT: |
---|
91 | RETVAL |
---|
92 | |
---|
93 | MODULE = Rappture PACKAGE = Rappture::Utils |
---|
94 | |
---|
95 | int |
---|
96 | progress( percent, message ) |
---|
97 | int percent |
---|
98 | const char *message |
---|
99 | CODE: |
---|
100 | RETVAL = Rappture::Utils::progress(percent,message); |
---|
101 | OUTPUT: |
---|
102 | RETVAL |
---|