From: Ben Pfaff Date: Mon, 15 Feb 2010 23:15:03 +0000 (-0800) Subject: perl-module: Automatically update PSPP.pm version number check. X-Git-Tag: v0.7.5~151 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3bb1629e0b8ef14c9e3c9459239335b81f7f8204;p=pspp-builds.git perl-module: Automatically update PSPP.pm version number check. Until now the $PSPP::VERSION variable was hard-coded in the source tree and had to be manually updated whenever configure.ac was updated to specify a new version number. This is easy to forget. So this commit makes perl-module/lib/PSPP.pm a generated file, with the value of $PSPP::VERSION automatically expanded from the @VERSION_FOR_PERL@ variable already set up by "configure". --- diff --git a/configure.ac b/configure.ac index a1f5f655..491cfeac 100644 --- a/configure.ac +++ b/configure.ac @@ -229,7 +229,7 @@ RELOCATABLE_STRIP=: PSPP_CHECK_PREREQS -AC_CONFIG_FILES([Makefile gl/Makefile tests/atlocal]) +AC_CONFIG_FILES([Makefile gl/Makefile tests/atlocal perl-module/lib/PSPP.pm]) AC_OUTPUT echo "PSPP configured successfully." diff --git a/perl-module/lib/PSPP.pm b/perl-module/lib/PSPP.pm deleted file mode 100644 index fd2f5a5f..00000000 --- a/perl-module/lib/PSPP.pm +++ /dev/null @@ -1,562 +0,0 @@ -use 5.008008; -use strict; -use warnings; - -=head1 NAME - -PSPP-Perl - Perl extension to PSPP - -=head1 SYNOPSIS - - use PSPP; - -=head1 DESCRIPTION - -PSPP-Perl provides an interface to the libraries used by pspp to read and -write system files. - -=head1 EXPORT - -None by default. - -=cut -BEGIN { - $PSPP::VERSION='0.7.3'; - require XSLoader; - XSLoader::load('PSPP', $PSPP::VERSION); -} - -PSPP::onBoot($PSPP::VERSION); - -=pod - -=head1 PROGRAMMER'S INTERFACE - -The subroutines in this package return zero or unref on error. -When errors occur, a string describing the error is written -to C<$PSPP::errstr>. - -=cut - -package PSPP; -use POSIX ; - -use constant { SYSMIS => -(POSIX::DBL_MAX), - PERL_EPOCH => 12219379200 # Number of seconds between - # 14th October 1582 - # and - # 1st January 1970 - }; - - - -package PSPP::Dict; - -=pod - -=head2 PSPP::Dict::new - -Creates a new dictionary. This returned dictionary will be empty. -Returns undef on failure. - -=head3 set_documents ($string) - -Sets the documents (comments) to C. - -=head3 add_document ($string) - -Appends C to the documents. - -=head3 clear_documents () - -Removes all documents. - -=head3 set_weight ($var) - -Sets the weighting variable to C. - -=cut - -sub new -{ - my $class = shift; - my $self = pxs_dict_new (); - bless ($self, $class); - return $self; -} - -=pod - -=head3 get_var_cnt () - -Returns the number of variables in the dictionary. - -=head3 get_var ($idx) - -Returns the Cth variable from the dictionary. -Returns undef if C is greater than or equal to the number -of variables in the dictionary. - -=cut - -sub get_var -{ - my $dict = shift; - my $idx = shift; - my $var = pxs_get_variable ($dict, $idx); - - if ( ref $var ) - { - bless ($var, "PSPP::Var"); - } - return $var; -} - -=pod - -=head3 get_var_by_name ($name) - -Returns the variable from the dictionary whose name is C. -If there is no such variable, a null reference will be returned. - -=cut - -sub get_var_by_name -{ - my $dict = shift; - my $name = shift; - my $var = pxs_get_var_by_name ($dict, $name); - - if ( ref $var ) - { - bless ($var, "PSPP::Var"); - } - return $var; -} - - -package PSPP::Fmt; - -=pod - -=head2 PSPP::Fmt - -Contains constants used to denote variable format types. -The identifiers are the same as those used in pspp to denote formats. -For example C defines floating point format, and -C denotes string format. - -=cut - -# These must correspond to the values in src/data/format.h -use constant { - F => 0, - COMMA => 1, - DOT => 2, - DOLLAR => 3, - PCT => 4, - E => 5, - CCA => 6, - CCB => 7, - CCC => 8, - CCD => 9, - CCE => 10, - N => 11, - Z => 12, - P => 13, - PK => 14, - IB => 15, - PIB => 16, - PIBHEX => 17, - RB => 18, - RBHEX => 19, - DATE => 20, - ADATE => 21, - EDATE => 22, - JDATE => 23, - SDATE => 24, - QYR => 25, - MOYR => 26, - WKYR => 27, - DATETIME => 28, - TIME => 29, - DTIME => 30, - WKDAY => 31, - MONTH => 32, - A => 33, - AHEX => 34 -}; - - -=head2 PSPP::Var - -=cut - -package PSPP::Var; - -=head3 new ($dict, $name, %input_fmt) - -Creates and returns a new variable in the dictionary C. The -new variable will have the name C. C must be a valid UTF8 string. -The input format is set by the C parameter -(See L). -By default, the write and print formats are the same as the input format. -The write and print formats may be changed (See L), -L). The input format may not be changed after -the variable has been created. -If the variable cannot be created, undef is returned. - -=cut - -sub new -{ - my $class = shift; - my $dict = shift; - my $name = shift; - my %format = @_; - my $self = pxs_dict_create_var ($dict, $name, \%format); - if ( ref $self ) - { - bless ($self, $class); - } - return $self; -} - -=pod - -=head3 set_label ($label) - -Sets the variable label to C