source: trunk/perl/Rappture.xs @ 546

Last change on this file since 546 was 517, checked in by dkearney, 18 years ago

removed references to core directory

File size: 1.3 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
11using namespace std;
12
13MODULE = Rappture               PACKAGE = Rappture::RpLibrary
14PROTOTYPES: ENABLE
15
16RpLibrary *
17RpLibrary::new(filename = "")
18char *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
36void *
37RpLibrary::DESTROY()
38        CODE:
39                RETVAL = 0;
40
41const char *
42RpLibrary::get( path )
43char *path
44        CODE:
45                string result;
46                result = THIS->get(path);
47                RETVAL = result.c_str();
48        OUTPUT:
49                RETVAL
50
51void
52RpLibrary::put( path, value, append )
53char *path
54char *value
55int append
56        CODE:
57                THIS->put(path,value,"",append);
58               
59void
60RpLibrary::result()
61
62MODULE = Rappture               PACKAGE = Rappture::RpUnits
63
64const char *
65convert( fromVal, toUnitsName, showUnits = 1 )
66const char *fromVal
67const char *toUnitsName
68int showUnits
69        CODE:
70                string result;
71                result = RpUnits::convert(fromVal,toUnitsName,showUnits);
72
73                if (result.empty())
74                    XSRETURN_UNDEF;
75
76                RETVAL = result.c_str();
77        OUTPUT:
78                RETVAL
Note: See TracBrowser for help on using the repository browser.