Last change
on this file since 591 was
591,
checked in by dkearney, 17 years ago
|
Added putFile capability to octave, matlab, fortran, perl bindings
Adjusted the core putFile function and all put functions to accept unsigned ints
added enum flags for binary and text file for the putFile function in c/c++
|
File size:
1.5 KB
|
Line | |
---|
1 | #include "RpLibrary.h" |
---|
2 | #include "RpUnits.h" |
---|
3 | #include <string> |
---|
4 | |
---|
5 | #include "EXTERN.h" |
---|
6 | #include "perl.h" |
---|
7 | #include "XSUB.h" |
---|
8 | |
---|
9 | #include "ppport.h" |
---|
10 | |
---|
11 | using namespace std; |
---|
12 | |
---|
13 | MODULE = Rappture PACKAGE = Rappture::RpLibrary |
---|
14 | PROTOTYPES: ENABLE |
---|
15 | |
---|
16 | RpLibrary * |
---|
17 | RpLibrary::new(filename = "") |
---|
18 | char *filename |
---|
19 | CODE: |
---|
20 | RpLibrary *library; |
---|
21 | if ((filename == NULL) || (*filename == '\0')) |
---|
22 | library = new RpLibrary(); |
---|
23 | else |
---|
24 | library = new RpLibrary(filename); |
---|
25 | |
---|
26 | if (library->isNull()) |
---|
27 | { |
---|
28 | delete library; |
---|
29 | XSRETURN_UNDEF; |
---|
30 | } |
---|
31 | else |
---|
32 | RETVAL = library; |
---|
33 | OUTPUT: |
---|
34 | RETVAL |
---|
35 | |
---|
36 | void * |
---|
37 | RpLibrary::DESTROY() |
---|
38 | CODE: |
---|
39 | RETVAL = 0; |
---|
40 | |
---|
41 | const char * |
---|
42 | RpLibrary::get( path ) |
---|
43 | char *path |
---|
44 | CODE: |
---|
45 | string result; |
---|
46 | result = THIS->get(path); |
---|
47 | RETVAL = result.c_str(); |
---|
48 | OUTPUT: |
---|
49 | RETVAL |
---|
50 | |
---|
51 | void |
---|
52 | RpLibrary::put( path, value, append ) |
---|
53 | char *path |
---|
54 | char *value |
---|
55 | int append |
---|
56 | CODE: |
---|
57 | THIS->put(path,value,"",append); |
---|
58 | |
---|
59 | void |
---|
60 | RpLibrary::putFile( path, fileName, fileType, append ) |
---|
61 | char *path |
---|
62 | char *fileName |
---|
63 | int fileType |
---|
64 | int append |
---|
65 | CODE: |
---|
66 | THIS->putFile(path,fileName,fileType,append); |
---|
67 | |
---|
68 | void |
---|
69 | RpLibrary::result() |
---|
70 | |
---|
71 | MODULE = Rappture PACKAGE = Rappture::RpUnits |
---|
72 | |
---|
73 | const char * |
---|
74 | convert( fromVal, toUnitsName, showUnits = 1 ) |
---|
75 | const char *fromVal |
---|
76 | const char *toUnitsName |
---|
77 | int showUnits |
---|
78 | CODE: |
---|
79 | string result; |
---|
80 | result = RpUnits::convert(fromVal,toUnitsName,showUnits); |
---|
81 | |
---|
82 | if (result.empty()) |
---|
83 | XSRETURN_UNDEF; |
---|
84 | |
---|
85 | RETVAL = result.c_str(); |
---|
86 | OUTPUT: |
---|
87 | RETVAL |
---|
Note: See
TracBrowser
for help on using the repository browser.