source: trunk/lang/perl/Rappture.xs @ 4346

Last change on this file since 4346 was 2549, checked in by gah, 13 years ago
File size: 2.0 KB
RevLine 
[665]1#include "rappture.h"
[481]2#include <string>
3
4#include "EXTERN.h"
5#include "perl.h"
6#include "XSUB.h"
7
8#include "ppport.h"
9
10using namespace std;
11
[1089]12MODULE = Rappture        PACKAGE = Rappture::RpLibrary
[481]13PROTOTYPES: ENABLE
14
15RpLibrary *
16RpLibrary::new(filename = "")
[1095]17const char *filename
[1089]18    CODE:
[481]19        RpLibrary *library;
[1089]20        if ((filename == NULL) || (*filename == '\0'))
21            library = new RpLibrary();
22        else
23            library = new RpLibrary(filename);
[481]24
[1089]25        if (library->isNull())
[481]26                {
27                        delete library;
[1089]28            XSRETURN_UNDEF;
[481]29                }
[1089]30        else
31            RETVAL = library;
32    OUTPUT:
33        RETVAL
[481]34
35void *
36RpLibrary::DESTROY()
[1089]37    CODE:
38        RETVAL = 0;
[2549]39    OUTPUT:
40        RETVAL
[481]41
[1716]42SV *
[481]43RpLibrary::get( path )
[1095]44const char *path
[1089]45    CODE:
46        string result;
47        result = THIS->get(path);
[1716]48        RETVAL = newSVpvn(result.data(),result.length());
[1089]49    OUTPUT:
50        RETVAL
[481]51
52void
53RpLibrary::put( path, value, append )
[1095]54const char *path
55const char *value
[481]56int append
[1089]57    CODE:
58        THIS->put(path,value,"",append);
[591]59
[481]60void
[605]61RpLibrary::putFile( path, fileName, compress, append )
[1095]62const char *path
63const char *fileName
[605]64int compress
[591]65int append
[1089]66    CODE:
67        THIS->putFile(path,fileName,compress,append);
[591]68
69void
[481]70RpLibrary::result()
[1089]71    CODE:
72        THIS->put("tool.version.rappture.language", "perl");
73        THIS->result();
[481]74
[1089]75MODULE = Rappture        PACKAGE = Rappture::RpUnits
[481]76
77const char *
78convert( fromVal, toUnitsName, showUnits = 1 )
79const char *fromVal
80const char *toUnitsName
81int showUnits
[1089]82    CODE:
83        string result;
84        result = RpUnits::convert(fromVal,toUnitsName,showUnits);
[481]85
86                if (result.empty())
87                    XSRETURN_UNDEF;
88
[1089]89        RETVAL = result.c_str();
90    OUTPUT:
91        RETVAL
[665]92
[1089]93MODULE = Rappture        PACKAGE = Rappture::Utils
[665]94
95int
96progress( percent, message )
97int percent
98const char *message
[1089]99    CODE:
100        RETVAL = Rappture::Utils::progress(percent,message);
101    OUTPUT:
102        RETVAL
Note: See TracBrowser for help on using the repository browser.