X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=bindings%2Fperl-shared%2FRRDs.xs;h=b2a70d951b8b2174abdb2d50a9f4932a9955a199;hb=8d278938aef5adefa2915dd446abc028cc764550;hp=217482ce4bf716ead7bb47ddcc045962509586f7;hpb=96f1f53dc8975dd55dfb956ef81cea9794bd0629;p=rrdtool.git diff --git a/bindings/perl-shared/RRDs.xs b/bindings/perl-shared/RRDs.xs index 217482c..b2a70d9 100644 --- a/bindings/perl-shared/RRDs.xs +++ b/bindings/perl-shared/RRDs.xs @@ -10,7 +10,25 @@ extern "C" { } #endif +/* + * rrd_tool.h includes config.h, but at least on Ubuntu Breezy Badger + * 5.10 with gcc 4.0.2, the C preprocessor picks up Perl's config.h + * which is included from the Perl includes and never reads rrdtool's + * config.h. Without including rrdtool's config.h, this module does + * not compile, so include it here with an explicit path. + * + * Because rrdtool's config.h redefines VERSION which is originally + * set via Perl's Makefile.PL and passed down to the C compiler's + * command line, save the original value and reset it after the + * includes. + */ +#define VERSION_SAVED VERSION +#undef VERSION +#include "../../rrd_config.h" #include "../../src/rrd_tool.h" +#undef VERSION +#define VERSION VERSION_SAVED +#undef VERSION_SAVED /* perl 5.004 compatibility */ #if PERLPATCHLEVEL < 5 @@ -29,7 +47,6 @@ extern "C" { argv[i+1] = (char *) malloc((strlen(handle)+1)*sizeof(char)); \ strcpy(argv[i+1],handle); \ } \ - optind=0; opterr=0; \ rrd_clear_error();\ RETVAL=name(items+1,argv); \ for (i=0; i < items; i++) {\ @@ -53,7 +70,6 @@ extern "C" { argv[i+1] = (char *) malloc((strlen(handle)+1)*sizeof(char)); \ strcpy(argv[i+1],handle); \ } \ - optind=0; opterr=0; \ rrd_clear_error(); \ data=name(items+1, argv); \ for (i=0; i < items; i++) { \ @@ -83,6 +99,10 @@ extern "C" { hvs(newSVpv(data->value.u_str,0)); \ rrd_freemem(data->value.u_str); \ break; \ + case RD_I_BLO: \ + hvs(newSVpv(data->value.u_blo.ptr,data->value.u_blo.size)); \ + rrd_freemem(data->value.u_blo.ptr); \ + break; \ } \ rrd_freemem(data->key); \ data = data->next; \ @@ -203,7 +223,6 @@ rrd_graph(...) argv[i+1] = (char *) malloc((strlen(handle)+1)*sizeof(char)); strcpy(argv[i+1],handle); } - optind=0; opterr=0; rrd_clear_error(); rrd_graph(items+1,argv,&calcpr,&xsize,&ysize,NULL,&ymin,&ymax); for (i=0; i < items; i++) { @@ -251,7 +270,6 @@ rrd_fetch(...) argv[i+1] = (char *) malloc((strlen(handle)+1)*sizeof(char)); strcpy(argv[i+1],handle); } - optind=0; opterr=0; rrd_clear_error(); rrd_fetch(items+1,argv,&start,&end,&step,&ds_cnt,&ds_namv,&data); for (i=0; i < items; i++) { @@ -289,20 +307,20 @@ rrd_times(start, end) char *start char *end PREINIT: - struct rrd_time_value start_tv, end_tv; + rrd_time_value_t start_tv, end_tv; char *parsetime_error = NULL; time_t start_tmp, end_tmp; PPCODE: rrd_clear_error(); - if( (parsetime_error = parsetime( start, &start_tv))) { - rrd_set_error( "start time: %s", parsetime_error); + if ((parsetime_error = rrd_parsetime(start, &start_tv))) { + rrd_set_error("start time: %s", parsetime_error); XSRETURN_UNDEF; } - if( (parsetime_error = parsetime( end, &end_tv))) { - rrd_set_error( "end time: %s", parsetime_error); + if ((parsetime_error = rrd_parsetime(end, &end_tv))) { + rrd_set_error("end time: %s", parsetime_error); XSRETURN_UNDEF; } - if( proc_start_end( &start_tv, &end_tv, &start_tmp, &end_tmp) == -1) { + if (rrd_proc_start_end(&start_tv, &end_tv, &start_tmp, &end_tmp) == -1) { XSRETURN_UNDEF; } EXTEND(sp,2); @@ -330,7 +348,6 @@ rrd_xport(...) argv[i+1] = (char *) malloc((strlen(handle)+1)*sizeof(char)); strcpy(argv[i+1],handle); } - optind=0; opterr=0; rrd_clear_error(); rrd_xport(items+1,argv,&xsize,&start,&end,&step,&col_cnt,&legend_v,&data); for (i=0; i < items; i++) { @@ -372,7 +389,7 @@ SV* rrd_info(...) PROTOTYPE: @ PREINIT: - info_t *data,*save; + rrd_info_t *data,*save; int i; char **argv; HV *hash; @@ -385,7 +402,7 @@ SV* rrd_updatev(...) PROTOTYPE: @ PREINIT: - info_t *data,*save; + rrd_info_t *data,*save; int i; char **argv; HV *hash; @@ -394,6 +411,19 @@ rrd_updatev(...) OUTPUT: RETVAL +SV* +rrd_graphv(...) + PROTOTYPE: @ + PREINIT: + rrd_info_t *data,*save; + int i; + char **argv; + HV *hash; + CODE: + rrdinfocode(rrd_graph_v); + OUTPUT: + RETVAL + int rrd_dump(...) PROTOTYPE: @