source:
trunk/lang/perl/Rappture.xs
@
1722
Last change on this file since 1722 was 1716, checked in by mmc, 14 years ago | |
---|---|
File size: 2.0 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 | |
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 | |
40 | SV * |
41 | RpLibrary::get( path ) |
42 | const char *path |
43 | CODE: |
44 | string result; |
45 | result = THIS->get(path); |
46 | RETVAL = newSVpvn(result.data(),result.length()); |
47 | OUTPUT: |
48 | RETVAL |
49 | |
50 | void |
51 | RpLibrary::put( path, value, append ) |
52 | const char *path |
53 | const char *value |
54 | int append |
55 | CODE: |
56 | THIS->put(path,value,"",append); |
57 | |
58 | void |
59 | RpLibrary::putFile( path, fileName, compress, append ) |
60 | const char *path |
61 | const char *fileName |
62 | int compress |
63 | int append |
64 | CODE: |
65 | THIS->putFile(path,fileName,compress,append); |
66 | |
67 | void |
68 | RpLibrary::result() |
69 | CODE: |
70 | THIS->put("tool.version.rappture.language", "perl"); |
71 | THIS->result(); |
72 | |
73 | MODULE = Rappture PACKAGE = Rappture::RpUnits |
74 | |
75 | const char * |
76 | convert( fromVal, toUnitsName, showUnits = 1 ) |
77 | const char *fromVal |
78 | const char *toUnitsName |
79 | int showUnits |
80 | CODE: |
81 | string result; |
82 | result = RpUnits::convert(fromVal,toUnitsName,showUnits); |
83 | |
84 | if (result.empty()) |
85 | XSRETURN_UNDEF; |
86 | |
87 | RETVAL = result.c_str(); |
88 | OUTPUT: |
89 | RETVAL |
90 | |
91 | MODULE = Rappture PACKAGE = Rappture::Utils |
92 | |
93 | int |
94 | progress( percent, message ) |
95 | int percent |
96 | const char *message |
97 | CODE: |
98 | RETVAL = Rappture::Utils::progress(percent,message); |
99 | OUTPUT: |
100 | RETVAL |
Note: See TracBrowser
for help on using the repository browser.