source: trunk/perl/Rappture.xs @ 605

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

fixed function name for octave put file function
added more error checking in rappture library core for put file functions
adjusted argument list for perl's put file function
added error checking to rapptue buffer

File size: 1.5 KB
RevLine 
[517]1#include "RpLibrary.h"
2#include "RpUnits.h"
[481]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);
[591]58
[481]59void
[605]60RpLibrary::putFile( path, fileName, compress, append )
[591]61char *path
62char *fileName
[605]63int compress
[591]64int append
65        CODE:
[605]66                THIS->putFile(path,fileName,compress,append);
[591]67
68void
[481]69RpLibrary::result()
70
71MODULE = Rappture               PACKAGE = Rappture::RpUnits
72
73const char *
74convert( fromVal, toUnitsName, showUnits = 1 )
75const char *fromVal
76const char *toUnitsName
77int 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.