* perl5.swg
*
* Perl5 runtime library
- * $Header: /home/cvsroot/idis/perl/Attic/IDZebra_wrap.c,v 1.9 2003-03-03 12:14:27 pop Exp $
+ * $Header: /home/cvsroot/idis/perl/Attic/IDZebra_wrap.c,v 1.10 2003-03-04 19:33:52 pop Exp $
* ----------------------------------------------------------------------------- */
#define SWIGPERL
#define SWIGTYPE_p_data1_marctab swig_types[29]
#define SWIGTYPE_p_ZebraTransactionStatus swig_types[30]
#define SWIGTYPE_p_Z_BriefBib swig_types[31]
-#define SWIGTYPE_p_ScanEntry swig_types[32]
+#define SWIGTYPE_p_scanEntry swig_types[32]
#define SWIGTYPE_p_f_p_void_p_char_size_t__int swig_types[33]
#define SWIGTYPE_p_FILE swig_types[34]
#define SWIGTYPE_p_data1_element swig_types[35]
}
-XS(_wrap_ScanEntry_occurrences_set) {
+XS(_wrap_scanEntry_occurrences_set) {
char _swigmsg[SWIG_MAX_ERRMSG] = "";
const char *_swigerr = _swigmsg;
{
- ScanEntry *arg1 ;
+ scanEntry *arg1 ;
int arg2 ;
int argvi = 0;
dXSARGS;
if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: ScanEntry_occurrences_set(self,occurrences);");
+ SWIG_croak("Usage: scanEntry_occurrences_set(self,occurrences);");
}
{
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_ScanEntry,0) < 0) {
- SWIG_croak("Type error in argument 1 of ScanEntry_occurrences_set. Expected _p_ScanEntry");
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_scanEntry,0) < 0) {
+ SWIG_croak("Type error in argument 1 of scanEntry_occurrences_set. Expected _p_scanEntry");
}
}
arg2 = (int) SvIV(ST(1));
}
-XS(_wrap_ScanEntry_occurrences_get) {
+XS(_wrap_scanEntry_occurrences_get) {
char _swigmsg[SWIG_MAX_ERRMSG] = "";
const char *_swigerr = _swigmsg;
{
- ScanEntry *arg1 ;
+ scanEntry *arg1 ;
int result;
int argvi = 0;
dXSARGS;
if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: ScanEntry_occurrences_get(self);");
+ SWIG_croak("Usage: scanEntry_occurrences_get(self);");
}
{
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_ScanEntry,0) < 0) {
- SWIG_croak("Type error in argument 1 of ScanEntry_occurrences_get. Expected _p_ScanEntry");
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_scanEntry,0) < 0) {
+ SWIG_croak("Type error in argument 1 of scanEntry_occurrences_get. Expected _p_scanEntry");
}
}
result = (int) ((arg1)->occurrences);
}
-XS(_wrap_ScanEntry_term_set) {
+XS(_wrap_scanEntry_term_set) {
char _swigmsg[SWIG_MAX_ERRMSG] = "";
const char *_swigerr = _swigmsg;
{
- ScanEntry *arg1 ;
+ scanEntry *arg1 ;
char *arg2 ;
int argvi = 0;
dXSARGS;
if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: ScanEntry_term_set(self,term);");
+ SWIG_croak("Usage: scanEntry_term_set(self,term);");
}
{
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_ScanEntry,0) < 0) {
- SWIG_croak("Type error in argument 1 of ScanEntry_term_set. Expected _p_ScanEntry");
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_scanEntry,0) < 0) {
+ SWIG_croak("Type error in argument 1 of scanEntry_term_set. Expected _p_scanEntry");
}
}
if (!SvOK((SV*) ST(1))) arg2 = 0;
}
-XS(_wrap_ScanEntry_term_get) {
+XS(_wrap_scanEntry_term_get) {
char _swigmsg[SWIG_MAX_ERRMSG] = "";
const char *_swigerr = _swigmsg;
{
- ScanEntry *arg1 ;
+ scanEntry *arg1 ;
char *result;
int argvi = 0;
dXSARGS;
if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: ScanEntry_term_get(self);");
+ SWIG_croak("Usage: scanEntry_term_get(self);");
}
{
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_ScanEntry,0) < 0) {
- SWIG_croak("Type error in argument 1 of ScanEntry_term_get. Expected _p_ScanEntry");
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_scanEntry,0) < 0) {
+ SWIG_croak("Type error in argument 1 of scanEntry_term_get. Expected _p_scanEntry");
}
}
result = (char *) ((arg1)->term);
}
-XS(_wrap_new_ScanEntry) {
+XS(_wrap_new_scanEntry) {
char _swigmsg[SWIG_MAX_ERRMSG] = "";
const char *_swigerr = _swigmsg;
{
- ScanEntry *result;
+ scanEntry *result;
int argvi = 0;
dXSARGS;
if ((items < 0) || (items > 0)) {
- SWIG_croak("Usage: new_ScanEntry();");
+ SWIG_croak("Usage: new_scanEntry();");
}
- result = (ScanEntry *)(ScanEntry *) calloc(1, sizeof(ScanEntry));
+ result = (scanEntry *)(scanEntry *) calloc(1, sizeof(scanEntry));
ST(argvi) = sv_newmortal();
- SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_ScanEntry,0);
+ SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_scanEntry,0);
XSRETURN(argvi);
fail:
(void) _swigerr;
}
-XS(_wrap_delete_ScanEntry) {
+XS(_wrap_delete_scanEntry) {
char _swigmsg[SWIG_MAX_ERRMSG] = "";
const char *_swigerr = _swigmsg;
{
- ScanEntry *arg1 ;
+ scanEntry *arg1 ;
int argvi = 0;
dXSARGS;
if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: delete_ScanEntry(self);");
+ SWIG_croak("Usage: delete_scanEntry(self);");
}
{
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_ScanEntry,0) < 0) {
- SWIG_croak("Type error in argument 1 of delete_ScanEntry. Expected _p_ScanEntry");
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_scanEntry,0) < 0) {
+ SWIG_croak("Type error in argument 1 of delete_scanEntry. Expected _p_scanEntry");
}
}
free((char *) arg1);
const char *_swigerr = _swigmsg;
{
ScanObj *arg1 ;
- ScanEntry *arg2 ;
+ scanEntry *arg2 ;
int argvi = 0;
dXSARGS;
}
}
{
- if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_ScanEntry,0) < 0) {
- SWIG_croak("Type error in argument 2 of ScanObj_entries_set. Expected _p_ScanEntry");
+ if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_scanEntry,0) < 0) {
+ SWIG_croak("Type error in argument 2 of ScanObj_entries_set. Expected _p_scanEntry");
}
}
if (arg1) (arg1)->entries = arg2;
const char *_swigerr = _swigmsg;
{
ScanObj *arg1 ;
- ScanEntry *result;
+ scanEntry *result;
int argvi = 0;
dXSARGS;
SWIG_croak("Type error in argument 1 of ScanObj_entries_get. Expected _p_ScanObj");
}
}
- result = (ScanEntry *) ((arg1)->entries);
+ result = (scanEntry *) ((arg1)->entries);
ST(argvi) = sv_newmortal();
- SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_ScanEntry,0);
+ SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_scanEntry,0);
XSRETURN(argvi);
fail:
(void) _swigerr;
{
ScanObj *arg1 ;
int arg2 ;
- ScanEntry *result;
+ scanEntry *result;
int argvi = 0;
dXSARGS;
}
}
arg2 = (int) SvIV(ST(1));
- result = (ScanEntry *)getScanEntry(arg1,arg2);
+ result = (scanEntry *)getScanEntry(arg1,arg2);
ST(argvi) = sv_newmortal();
- SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_ScanEntry,0);
+ SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_scanEntry,0);
XSRETURN(argvi);
fail:
(void) _swigerr;
static swig_type_info _swigt__p_data1_marctab[] = {{"_p_data1_marctab", 0, "data1_marctab *", 0},{"_p_data1_marctab"},{0}};
static swig_type_info _swigt__p_ZebraTransactionStatus[] = {{"IDZebra::ZebraTransactionStatus", 0, "ZebraTransactionStatus *", 0},{"IDZebra::ZebraTransactionStatus"},{0}};
static swig_type_info _swigt__p_Z_BriefBib[] = {{"_p_Z_BriefBib", 0, "Z_BriefBib *", 0},{"_p_Z_BriefBib"},{0}};
-static swig_type_info _swigt__p_ScanEntry[] = {{"IDZebra::ScanEntry", 0, "ScanEntry *", 0},{"IDZebra::ScanEntry"},{0}};
+static swig_type_info _swigt__p_scanEntry[] = {{"IDZebra::scanEntry", 0, "scanEntry *", 0},{"IDZebra::scanEntry"},{0}};
static swig_type_info _swigt__p_f_p_void_p_char_size_t__int[] = {{"_p_f_p_void_p_char_size_t__int", 0, "int (*)(void *,char *,size_t)", 0},{"_p_f_p_void_p_char_size_t__int"},{0}};
static swig_type_info _swigt__p_FILE[] = {{"_p_FILE", 0, "FILE *", 0},{"_p_FILE"},{0}};
static swig_type_info _swigt__p_data1_element[] = {{"_p_data1_element", 0, "data1_element *", 0},{"_p_data1_element"},{0}};
_swigt__p_data1_marctab,
_swigt__p_ZebraTransactionStatus,
_swigt__p_Z_BriefBib,
-_swigt__p_ScanEntry,
+_swigt__p_scanEntry,
_swigt__p_f_p_void_p_char_size_t__int,
_swigt__p_FILE,
_swigt__p_data1_element,
{"IDZebrac::RetrievalRecord_buf_get", _wrap_RetrievalRecord_buf_get},
{"IDZebrac::new_RetrievalRecord", _wrap_new_RetrievalRecord},
{"IDZebrac::delete_RetrievalRecord", _wrap_delete_RetrievalRecord},
-{"IDZebrac::ScanEntry_occurrences_set", _wrap_ScanEntry_occurrences_set},
-{"IDZebrac::ScanEntry_occurrences_get", _wrap_ScanEntry_occurrences_get},
-{"IDZebrac::ScanEntry_term_set", _wrap_ScanEntry_term_set},
-{"IDZebrac::ScanEntry_term_get", _wrap_ScanEntry_term_get},
-{"IDZebrac::new_ScanEntry", _wrap_new_ScanEntry},
-{"IDZebrac::delete_ScanEntry", _wrap_delete_ScanEntry},
+{"IDZebrac::scanEntry_occurrences_set", _wrap_scanEntry_occurrences_set},
+{"IDZebrac::scanEntry_occurrences_get", _wrap_scanEntry_occurrences_get},
+{"IDZebrac::scanEntry_term_set", _wrap_scanEntry_term_set},
+{"IDZebrac::scanEntry_term_get", _wrap_scanEntry_term_get},
+{"IDZebrac::new_scanEntry", _wrap_new_scanEntry},
+{"IDZebrac::delete_scanEntry", _wrap_delete_scanEntry},
{"IDZebrac::ScanObj_num_entries_set", _wrap_ScanObj_num_entries_set},
{"IDZebrac::ScanObj_num_entries_get", _wrap_ScanObj_num_entries_get},
{"IDZebrac::ScanObj_position_set", _wrap_ScanObj_position_set},
SWIG_TypeClientData(SWIGTYPE_p_recordGroup, (void*) "IDZebra::recordGroup");
SWIG_TypeClientData(SWIGTYPE_p_RetrievalObj, (void*) "IDZebra::RetrievalObj");
SWIG_TypeClientData(SWIGTYPE_p_RetrievalRecord, (void*) "IDZebra::RetrievalRecord");
- SWIG_TypeClientData(SWIGTYPE_p_ScanEntry, (void*) "IDZebra::ScanEntry");
+ SWIG_TypeClientData(SWIGTYPE_p_scanEntry, (void*) "IDZebra::scanEntry");
SWIG_TypeClientData(SWIGTYPE_p_ScanObj, (void*) "IDZebra::ScanObj");
SWIG_TypeClientData(SWIGTYPE_p_ZebraTransactionStatus, (void*) "IDZebra::ZebraTransactionStatus");
ST(0) = &PL_sv_yes;
--- /dev/null
+# $Id: ScanList.pm,v 1.1 2003-03-04 19:33:52 pop Exp $
+#
+# Zebra perl API header
+# =============================================================================
+package IDZebra::ScanList;
+
+use strict;
+use warnings;
+
+BEGIN {
+ use IDZebra;
+ use IDZebra::Logger qw(:flags :calls);
+ use IDZebra::ScanEntry;
+ use Scalar::Util qw(weaken);
+ use Carp;
+ our $VERSION = do { my @r = (q$Revision: 1.1 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
+ our @ISA = qw(IDZebra::Logger);
+}
+
+1;
+# -----------------------------------------------------------------------------
+# Class constructors, destructor
+# -----------------------------------------------------------------------------
+sub new {
+ my ($proto,$session, %args) = @_;
+ my $class = ref($proto) || $proto;
+ my $self = {};
+ bless ($self, $class);
+
+ $self->{session} = $session;
+ weaken ($self->{session});
+
+ $self->{expression} = $args{expression};
+ $self->{databases} = $args{databases};
+
+ $self->{so} = IDZebra::ScanObj->new();
+
+ $self->{odr_stream} = IDZebra::odr_createmem($IDZebra::ODR_DECODE);
+
+ $self->entries(num_entries => 0);
+
+ return ($self);
+}
+
+sub DESTROY {
+ my $self = shift;
+
+ if ($self->{odr_stream}) {
+ IDZebra::odr_reset($self->{odr_stream});
+ IDZebra::odr_destroy($self->{odr_stream});
+ $self->{odr_stream} = undef;
+ }
+
+ delete($self->{so});
+ delete($self->{session});
+}
+
+# =============================================================================
+sub is_partial {
+ my ($self) = @_;
+ return ($self->{so}{is_partial});
+}
+
+sub position {
+ my ($self) = @_;
+ return ($self->{so}{position});
+}
+
+sub num_entries {
+ my ($self) = @_;
+ return ($self->{so}{num_entries});
+}
+
+sub errCode {
+ my ($self) = @_;
+ return ($self->{session}->errCode);
+}
+
+sub errString {
+ my ($self) = @_;
+ return ($self->{session}->errString);
+}
+
+# -----------------------------------------------------------------------------
+sub entries {
+ my ($self, %args) = @_;
+
+ unless ($self->{session}{zh}) {
+ croak ("Session is closed or out of scope");
+ }
+
+ my $so=$self->{so};
+
+ $so->{position} = defined($args{position}) ? $args{position} : 1;
+ $so->{num_entries} = defined($args{num_entries}) ? $args{num_entries} : 20;
+
+ my @origdbs;
+ if ($self->{databases}) {
+ @origdbs = $self->{session}->databases;
+ $self->{session}->databases(@{$self->{databases}});
+ }
+
+ $so->{is_partial} = 0;
+
+ my $r = IDZebra::scan_PQF($self->{session}{zh}, $so,
+ $self->{odr_stream},
+ $self->{expression});
+
+ if ($self->{session}->errCode) {
+ croak ("Error in scan, code: ".$self->{session}->errCode .
+ ", message: ".$self->{session}->errString);
+ }
+
+ my @res;
+ for (my $i=1; $i<=$so->{num_entries}; $i++) {
+
+ push (@res,
+ IDZebra::ScanEntry->new(entry => IDZebra::getScanEntry($so, $i),
+ position => $i,
+ list => $self));
+ }
+
+ if ($self->{databases}) {
+ $self->{session}->databases(@origdbs);
+ }
+
+ IDZebra::odr_reset($self->{odr_stream});
+
+ $self->{so} = $so;
+
+ return (@res);
+}
+
+
+# ============================================================================
+__END__
+
+=head1 NAME
+
+IDZebra::ScanList - Scan results
+
+=head1 SYNOPSIS
+
+=head1 DESCRIPTION
+
+=head1 PROPERTIES
+
+=head1 COPYRIGHT
+
+Fill in
+
+=head1 AUTHOR
+
+Peter Popovics, pop@technomat.hu
+
+=head1 SEE ALSO
+
+IDZebra, IDZebra::Session, Zebra documentation
+
+=cut