projects
/
idzebra-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added support of the complex indexing for MARC records (whithout documentation yet).
[idzebra-moved-to-github.git]
/
recctrl
/
perlread.c
diff --git
a/recctrl/perlread.c
b/recctrl/perlread.c
index
3a08826
..
ac09ed5
100644
(file)
--- a/
recctrl/perlread.c
+++ b/
recctrl/perlread.c
@@
-1,4
+1,4
@@
-/* $Id: perlread.c,v 1.3 2002-11-16 00:24:36 pop Exp $
+/* $Id: perlread.c,v 1.6 2003-02-27 23:21:40 pop Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
@@
-70,7
+70,7
@@
void Filter_create (struct perl_context *context)
sv_setref_pv(msv, "_p_perl_context", (void*)context);
XPUSHs(msv) ;
PUTBACK ;
sv_setref_pv(msv, "_p_perl_context", (void*)context);
XPUSHs(msv) ;
PUTBACK ;
- call_method("new", 0);
+ call_method("new", G_EVAL);
SPAGAIN ;
context->filterRef = POPs;
SPAGAIN ;
context->filterRef = POPs;
@@
-92,6
+92,9
@@
int Filter_process (struct perl_context *context)
dSP;
dSP;
+ ENTER;
+ SAVETMPS;
+
PUSHMARK(SP) ;
XPUSHs(context->filterRef);
PUTBACK ;
PUSHMARK(SP) ;
XPUSHs(context->filterRef);
PUTBACK ;
@@
-99,6
+102,9
@@
int Filter_process (struct perl_context *context)
SPAGAIN ;
res = POPi;
PUTBACK ;
SPAGAIN ;
res = POPi;
PUTBACK ;
+
+ FREETMPS;
+ LEAVE;
return (res);
}
return (res);
}
@@
-138,6
+144,10
@@
int Filter_process (struct perl_context *context)
*/
void Filter_store_buff (struct perl_context *context, char *buff, size_t len) {
dSP;
*/
void Filter_store_buff (struct perl_context *context, char *buff, size_t len) {
dSP;
+
+ ENTER;
+ SAVETMPS;
+
PUSHMARK(SP) ;
XPUSHs(context->filterRef);
XPUSHs(sv_2mortal(newSVpv(buff, len)));
PUSHMARK(SP) ;
XPUSHs(context->filterRef);
XPUSHs(sv_2mortal(newSVpv(buff, len)));
@@
-145,6
+155,9
@@
void Filter_store_buff (struct perl_context *context, char *buff, size_t len) {
call_method("_store_buff", 0);
SPAGAIN ;
PUTBACK ;
call_method("_store_buff", 0);
SPAGAIN ;
PUTBACK ;
+
+ FREETMPS;
+ LEAVE;
}
/* The "file" manipulation function wrappers */
int grs_perl_readf(struct perl_context *context, size_t len) {
}
/* The "file" manipulation function wrappers */
int grs_perl_readf(struct perl_context *context, size_t len) {
@@
-169,12
+182,12
@@
void grs_perl_endf(struct perl_context *context, off_t offset) {
}
/* Get pointers from the context. Easyer to wrap this by SWIG */
}
/* Get pointers from the context. Easyer to wrap this by SWIG */
-data1_handle grs_perl_get_dh(struct perl_context *context) {
- return(context->dh);
+data1_handle *grs_perl_get_dh(struct perl_context *context) {
+ return(&context->dh);
}
}
-NMEM grs_perl_get_mem(struct perl_context *context) {
- return(context->mem);
+NMEM *grs_perl_get_mem(struct perl_context *context) {
+ return(&context->mem);
}
/* Set the result in the context */
}
/* Set the result in the context */
@@
-209,8
+222,10
@@
void grs_destroy_perl(void *clientData)
logf (LOG_LOG, "Destroying perl interpreter context");
if (context->perli_ready) {
logf (LOG_LOG, "Destroying perl interpreter context");
if (context->perli_ready) {
+ /*
FREETMPS;
LEAVE;
FREETMPS;
LEAVE;
+ */
if (context->origi == NULL) perl_destruct(context->perli);
}
if (context->origi == NULL) perl_free(context->perli);
if (context->origi == NULL) perl_destruct(context->perli);
}
if (context->origi == NULL) perl_free(context->perli);
@@
-242,13
+257,17
@@
static data1_node *grs_read_perl (struct grs_read_info *p)
char *arglist[6] = { "", "-I", "", "-M", "-e", "" };
if (context->perli_ready) {
char *arglist[6] = { "", "-I", "", "-M", "-e", "" };
if (context->perli_ready) {
+ /*
FREETMPS;
LEAVE;
FREETMPS;
LEAVE;
+ */
if (context->origi == NULL) perl_destruct(context->perli);
}
if (context->origi == NULL) perl_construct(context->perli);
if (context->origi == NULL) perl_destruct(context->perli);
}
if (context->origi == NULL) perl_construct(context->perli);
+ /*
ENTER;
SAVETMPS;
ENTER;
SAVETMPS;
+ */
context->perli_ready = 1;
/* parse, and run the init call */
context->perli_ready = 1;
/* parse, and run the init call */
@@
-275,6
+294,10
@@
static data1_node *grs_read_perl (struct grs_read_info *p)
the filter object reference may go out of scope... */
if (!SvOK(context->filterRef)) Filter_create(context);
the filter object reference may go out of scope... */
if (!SvOK(context->filterRef)) Filter_create(context);
+ if (!SvTRUE(context->filterRef)) {
+ logf (LOG_WARN,"Failed to initialize perl filter %s",context->filterClass);
+ return (0);
+ }
/* call the process method */
Filter_process(context);
/* call the process method */
Filter_process(context);