- struct perl_context *context = (struct perl_context *) p->clientData;
- char *filterClass = p->type;
-
- /* The "file" manipulation function wrappers */
- context->readf = p->readf;
- context->seekf = p->seekf;
- context->tellf = p->tellf;
- context->endf = p->endf;
-
- /* The "file", data1 and NMEM handles */
- context->fh = p->fh;
- context->dh = p->dh;
- context->mem = p->mem;
-
- /* If the class was not interpreted before... */
- /* This is not too efficient, when indexing with many different filters... */
- if (strcmp(context->filterClass,filterClass)) {
-
- char modarg[GRS_PERL_MODULE_NAME_MAXLEN + 2];
- char initarg[GRS_PERL_MODULE_NAME_MAXLEN + 2];
- char *arglist[6] = { "", "-I", "", "-M", "-e", "" };
-
- if (context->perli_ready) {
- FREETMPS;
- LEAVE;
- if (context->origi == NULL) perl_destruct(context->perli);
+ struct perl_context *context = (struct perl_context *) p->clientData;
+ char *filterClass = p->type;
+
+ /* The "file" manipulation function wrappers */
+ context->readf = p->readf;
+ context->seekf = p->seekf;
+ context->tellf = p->tellf;
+ context->endf = p->endf;
+
+ /* The "file", data1 and NMEM handles */
+ context->fh = p->fh;
+ context->dh = p->dh;
+ context->mem = p->mem;
+
+ /* If the class was not interpreted before... */
+ /* This is not too efficient, when indexing with many different filters... */
+ if (strcmp(context->filterClass,filterClass)) {
+
+ char modarg[GRS_PERL_MODULE_NAME_MAXLEN + 2];
+ char initarg[GRS_PERL_MODULE_NAME_MAXLEN + 2];
+ char *arglist[6] = { "", "-I", "", "-M", "-e", "" };
+
+ if (context->perli_ready) {
+ /*
+ FREETMPS;
+ LEAVE;
+ */
+ if (context->origi == NULL) {
+ perl_destruct(context->perli);
+ }
+ }
+ if (context->origi == NULL) {
+ perl_construct(context->perli);
+ }
+
+
+ /*
+ ENTER;
+ SAVETMPS;
+ */
+ context->perli_ready = 1;
+
+ /* parse, and run the init call */
+ if (context->origi == NULL) {
+ logf (LOG_LOG, "Interpreting filter class:%s", filterClass);
+
+ arglist[2] = (char *) data1_get_tabpath(p->dh);
+ sprintf(modarg,"-M%s",filterClass);
+ arglist[3] = (char *) &modarg;
+ sprintf(initarg,"%s->init;",filterClass);
+ arglist[5] = (char *) &initarg;
+
+ perl_parse(context->perli, PERL_XS_INIT, 6, arglist, NULL);
+ perl_run(context->perli);
+ }
+
+ strcpy(context->filterClass, filterClass);
+
+ /* create the filter object as a filterClass blessed reference */
+ Filter_create(context);
+ }
+
+ /* Wow... if calling with individual update_record calls from perl,
+ the filter object reference may go out of scope... */
+ if (!sv_isa(context->filterRef, context->filterClass)) {
+ Filter_create(context);
+ logf (LOG_DEBUG,"Filter recreated");