2 * This file was generated automatically by xsubpp version 1.9507 from the
3 * contents of SimpleServer.xs. Do not edit this file, edit SimpleServer.xs instead.
5 * ANY CHANGES MADE HERE WILL BE LOST!
9 #line 1 "SimpleServer.xs"
11 * Copyright (c) 2000, Index Data.
13 * Permission to use, copy, modify, distribute, and sell this software and
14 * its documentation, in whole or in part, for any purpose, is hereby granted,
17 * 1. This copyright and permission notice appear in all copies of the
18 * software and its documentation. Notices of copyright or attribution
19 * which appear at the beginning of any file must remain unchanged.
21 * 2. The name of Index Data or the individual authors may not be used to
22 * endorse or promote products derived from this software without specific
23 * prior written permission.
25 * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,
26 * EXPRESS, IMPLIED, OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
27 * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
28 * IN NO EVENT SHALL INDEX DATA BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
29 * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES
30 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR
31 * NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
32 * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
36 /*$Log: SimpleServer.c,v $
37 /*Revision 1.11 2001-08-24 14:00:20 sondberg
38 /*Added support for scan.
40 /*Revision 1.8 2001/05/21 11:07:02 sondberg
41 /*Extended maximum numbers of GRS-1 elements. Should be done dynamically.
43 /*Revision 1.7 2001/03/13 14:17:15 sondberg
44 /*Added support for GRS-1.
51 #include <yaz/backend.h>
53 #include <yaz/wrbuf.h>
58 #define GRS_MAX_FIELDS 500
62 #ifndef sv_undef /* To fix the problem with Perl 5.6.0 */
63 #define sv_undef PL_sv_undef
83 SV *search_ref = NULL;
85 SV *present_ref = NULL;
86 SV *esrequest_ref = NULL;
87 SV *delete_ref = NULL;
92 Z_GenericRecord *read_grs1(char *str, ODR o)
95 char line[512], *buf, *ptr, *original;
97 Z_GenericRecord *r = 0;
105 ptr = strchr(str, '\n');
109 strncpy(line, str, ptr - str);
113 while (*buf && isspace(*buf))
116 memmove(original, str, strlen(str));
119 if (sscanf(buf, "(%d,%[^)])", &type, value) != 2)
121 yaz_log(LOG_WARN, "Bad data in '%s'", buf);
124 if (!type && *value == '0')
126 if (!(buf = strchr(buf, ')')))
129 while (*buf && isspace(*buf))
135 r = (Z_GenericRecord *)odr_malloc(o, sizeof(*r));
136 r->elements = (Z_TaggedElement **)
137 odr_malloc(o, sizeof(Z_TaggedElement*) * GRS_MAX_FIELDS);
140 if (r->num_elements > GRS_MAX_FIELDS)
142 yaz_log(LOG_WARN, "Max number of GRS-1 elements exceeded [GRS_MAX_FIELDS=%d]", GRS_MAX_FIELDS);
145 r->elements[r->num_elements] = t = (Z_TaggedElement *) odr_malloc(o, sizeof(Z_TaggedElement));
146 t->tagType = (int *)odr_malloc(o, sizeof(int));
148 t->tagValue = (Z_StringOrNumeric *)
149 odr_malloc(o, sizeof(Z_StringOrNumeric));
150 if ((ivalue = atoi(value)))
152 t->tagValue->which = Z_StringOrNumeric_numeric;
153 t->tagValue->u.numeric = (int *)odr_malloc(o, sizeof(int));
154 *t->tagValue->u.numeric = ivalue;
158 t->tagValue->which = Z_StringOrNumeric_string;
159 t->tagValue->u.string = (char *)odr_malloc(o, strlen(value)+1);
160 strcpy(t->tagValue->u.string, value);
162 t->tagOccurrence = 0;
164 t->appliedVariant = 0;
165 t->content = c = (Z_ElementData *)odr_malloc(o, sizeof(Z_ElementData));
168 c->which = Z_ElementData_subtree;
169 c->u.subtree = read_grs1(str, o);
173 c->which = Z_ElementData_string;
174 /* buf[strlen(buf)-1] = '\0';*/
175 buf[strlen(buf)] = '\0';
176 c->u.string = odr_strdup(o, buf);
185 static void oid2str(Odr_oid *o, WRBUF buf)
187 for (; *o >= 0; o++) {
189 sprintf(ibuf, "%d", *o);
190 wrbuf_puts(buf, ibuf);
192 wrbuf_putc(buf, '.');
197 static int rpn2pquery(Z_RPNStructure *s, WRBUF buf)
200 case Z_RPNStructure_simple: {
201 Z_Operand *o = s->u.simple;
204 case Z_Operand_APT: {
205 Z_AttributesPlusTerm *at = o->u.attributesPlusTerm;
207 if (at->attributes) {
211 for (i = 0; i < at->attributes->num_attributes; i++) {
212 wrbuf_puts(buf, "@attr ");
213 if (at->attributes->attributes[i]->attributeSet) {
214 oid2str(at->attributes->attributes[i]->attributeSet, buf);
215 wrbuf_putc(buf, ' ');
217 sprintf(ibuf, "%d=", *at->attributes->attributes[i]->attributeType);
218 assert(at->attributes->attributes[i]->which == Z_AttributeValue_numeric);
219 wrbuf_puts(buf, ibuf);
220 sprintf(ibuf, "%d ", *at->attributes->attributes[i]->value.numeric);
221 wrbuf_puts(buf, ibuf);
224 switch (at->term->which) {
225 case Z_Term_general: {
226 wrbuf_putc(buf, '"');
227 wrbuf_write(buf, (char*) at->term->u.general->buf, at->term->u.general->len);
228 wrbuf_puts(buf, "\" ");
239 case Z_RPNStructure_complex: {
240 Z_Complex *c = s->u.complex;
242 switch (c->roperator->which) {
243 case Z_Operator_and: wrbuf_puts(buf, "@and "); break;
244 case Z_Operator_or: wrbuf_puts(buf, "@or "); break;
245 case Z_Operator_and_not: wrbuf_puts(buf, "@not "); break;
246 case Z_Operator_prox: abort();
249 if (!rpn2pquery(c->s1, buf))
251 if (!rpn2pquery(c->s2, buf))
261 WRBUF zquery2pquery(Z_Query *q)
263 WRBUF buf = wrbuf_alloc();
265 if (q->which != Z_Query_type_1 && q->which != Z_Query_type_101)
267 if (q->u.type_1->attributeSetId) {
268 /* Output attribute set ID */
269 wrbuf_puts(buf, "@attrset ");
270 oid2str(q->u.type_1->attributeSetId, buf);
271 wrbuf_putc(buf, ' ');
273 return rpn2pquery(q->u.type_1->RPNStructure, buf) ? buf : 0;
277 int bend_sort(void *handle, bend_sort_rr *rr)
288 char **input_setnames;
289 Zfront_handle *zhandle = (Zfront_handle *)handle;
297 input_setnames = rr->input_setnames;
298 for (i = 0; i < rr->num_input_setnames; i++)
300 av_push(aref, newSVpv(*input_setnames++, 0));
303 hv_store(href, "INPUT", 5, newRV( (SV*) aref), 0);
304 hv_store(href, "OUTPUT", 6, newSVpv(rr->output_setname, 0), 0);
305 hv_store(href, "HANDLE", 6, zhandle->handle, 0);
306 hv_store(href, "STATUS", 6, newSViv(0), 0);
310 XPUSHs(sv_2mortal(newRV( (SV*) href)));
314 perl_call_sv(sort_ref, G_SCALAR | G_DISCARD);
318 temp = hv_fetch(href, "ERR_CODE", 8, 1);
319 err_code = newSVsv(*temp);
321 temp = hv_fetch(href, "ERR_STR", 7, 1);
322 err_str = newSVsv(*temp);
324 temp = hv_fetch(href, "STATUS", 6, 1);
325 status = newSVsv(*temp);
336 rr->errcode = SvIV(err_code);
337 rr->sort_status = SvIV(status);
338 ptr = SvPV(err_str, len);
339 ODR_err_str = (char *)odr_malloc(rr->stream, len + 1);
340 strcpy(ODR_err_str, ptr);
341 rr->errstring = ODR_err_str;
351 int bend_search(void *handle, bend_search_rr *rr)
368 Zfront_handle *zhandle = (Zfront_handle *)handle;
375 basenames = rr->basenames;
376 for (i = 0; i < rr->num_bases; i++)
378 av_push(aref, newSVpv(*basenames++, 0));
381 hv_store(href, "SETNAME", 7, newSVpv(rr->setname, 0), 0);
382 hv_store(href, "REPL_SET", 8, newSViv(rr->replace_set), 0);
383 hv_store(href, "ERR_CODE", 8, newSViv(0), 0);
384 hv_store(href, "ERR_STR", 7, newSVpv("", 0), 0);
385 hv_store(href, "HITS", 4, newSViv(0), 0);
386 hv_store(href, "DATABASES", 9, newRV( (SV*) aref), 0);
387 hv_store(href, "HANDLE", 6, zhandle->handle, 0);
388 hv_store(href, "PID", 3, newSViv(getpid()), 0);
389 query = zquery2pquery(rr->query);
392 hv_store(href, "QUERY", 5, newSVpv((char *)query->buf, query->pos), 0);
400 XPUSHs(sv_2mortal(newRV( (SV*) href)));
404 n = perl_call_sv(search_ref, G_SCALAR | G_DISCARD);
408 temp = hv_fetch(href, "HITS", 4, 1);
409 hits = newSVsv(*temp);
411 temp = hv_fetch(href, "ERR_CODE", 8, 1);
412 err_code = newSVsv(*temp);
414 temp = hv_fetch(href, "ERR_STR", 7, 1);
415 err_str = newSVsv(*temp);
417 temp = hv_fetch(href, "HANDLE", 6, 1);
418 point = newSVsv(*temp);
426 rr->hits = SvIV(hits);
427 rr->errcode = SvIV(err_code);
428 ptr = SvPV(err_str, len);
429 ODR_errstr = (char *)odr_malloc(rr->stream, len + 1);
430 strcpy(ODR_errstr, ptr);
431 rr->errstring = ODR_errstr;
432 /* ODR_point = (SV *)odr_malloc(rr->stream, sizeof(*point));
433 memcpy(ODR_point, point, sizeof(*point));
434 zhandle->handle = ODR_point;*/
435 zhandle->handle = point;
440 sv_free( (SV*) aref);
441 sv_free( (SV*) href);
443 wrbuf_free(query, 1);
448 WRBUF oid2dotted(int *oid)
451 WRBUF buf = wrbuf_alloc();
454 for (; *oid != -1 ; oid++)
459 wrbuf_putc(buf, '.');
465 sprintf(ibuf, "%d", *oid);
466 wrbuf_puts(buf, ibuf);
472 int dotted2oid(char *dotted, int *buffer)
486 if (n == MAX_OID) /* Terminate if more than MAX_OID entries */
492 sscanf(ibuf, "%d", oid++);
505 sscanf(ibuf, "%d", oid++);
512 int bend_fetch(void *handle, bend_fetch_rr *rr)
531 Zfront_handle *zhandle = (Zfront_handle *)handle;
533 Z_RecordComposition *composition;
534 Z_ElementSetNames *simple;
543 hv_store(href, "SETNAME", 7, newSVpv(rr->setname, 0), 0);
544 temp = hv_store(href, "OFFSET", 6, newSViv(rr->number), 0);
545 oid_dotted = oid2dotted(rr->request_format_raw);
546 hv_store(href, "REQ_FORM", 8, newSVpv((char *)oid_dotted->buf, oid_dotted->pos), 0);
547 hv_store(href, "REP_FORM", 8, newSVpv((char *)oid_dotted->buf, oid_dotted->pos), 0);
548 hv_store(href, "BASENAME", 8, newSVpv("", 0), 0);
549 hv_store(href, "RECORD", 6, newSVpv("", 0), 0);
550 hv_store(href, "LAST", 4, newSViv(0), 0);
551 hv_store(href, "ERR_CODE", 8, newSViv(0), 0);
552 hv_store(href, "ERR_STR", 7, newSVpv("", 0), 0);
553 hv_store(href, "SUR_FLAG", 8, newSViv(0), 0);
554 hv_store(href, "HANDLE", 6, zhandle->handle, 0);
555 hv_store(href, "PID", 3, newSViv(getpid()), 0);
558 composition = rr->comp;
559 if (composition->which == Z_RecordComp_simple)
561 simple = composition->u.simple;
562 if (simple->which == Z_ElementSetNames_generic)
564 hv_store(href, "COMP", 4, newSVpv(simple->u.generic, 0), 0);
579 XPUSHs(sv_2mortal(newRV( (SV*) href)));
583 perl_call_sv(fetch_ref, G_SCALAR | G_DISCARD);
587 temp = hv_fetch(href, "BASENAME", 8, 1);
588 basename = newSVsv(*temp);
590 temp = hv_fetch(href, "RECORD", 6, 1);
591 record = newSVsv(*temp);
593 temp = hv_fetch(href, "LAST", 4, 1);
594 last = newSVsv(*temp);
596 temp = hv_fetch(href, "ERR_CODE", 8, 1);
597 err_code = newSVsv(*temp);
599 temp = hv_fetch(href, "ERR_STR", 7, 1),
600 err_string = newSVsv(*temp);
602 temp = hv_fetch(href, "SUR_FLAG", 8, 1);
603 sur_flag = newSVsv(*temp);
605 temp = hv_fetch(href, "REP_FORM", 8, 1);
606 rep_form = newSVsv(*temp);
608 temp = hv_fetch(href, "HANDLE", 6, 1);
609 point = newSVsv(*temp);
617 ptr = SvPV(basename, length);
618 ODR_basename = (char *)odr_malloc(rr->stream, length + 1);
619 strcpy(ODR_basename, ptr);
620 rr->basename = ODR_basename;
622 ptr = SvPV(rep_form, length);
623 ODR_oid_buf = (int *)odr_malloc(rr->stream, (MAX_OID + 1) * sizeof(int));
624 if (dotted2oid(ptr, ODR_oid_buf) == -1) /* Maximum number of OID elements exceeded */
626 printf("Net::Z3950::SimpleServer: WARNING: OID structure too long, max length is %d\n", MAX_OID);
628 rr->output_format_raw = ODR_oid_buf;
630 ptr = SvPV(record, length);
631 oid = oid_getentbyoid(ODR_oid_buf);
632 if (oid->value == VAL_GRS1) /* Treat GRS-1 records separately */
634 rr->record = (char *) read_grs1(ptr, rr->stream);
639 ODR_record = (char *)odr_malloc(rr->stream, length + 1);
640 strcpy(ODR_record, ptr);
641 rr->record = ODR_record;
644 zhandle->handle = point;
646 rr->last_in_set = SvIV(last);
650 rr->errcode = SvIV(err_code);
651 ptr = SvPV(err_string, length);
652 ODR_errstr = (char *)odr_malloc(rr->stream, length + 1);
653 strcpy(ODR_errstr, ptr);
654 rr->errstring = ODR_errstr;
656 rr->surrogate_flag = SvIV(sur_flag);
658 wrbuf_free(oid_dotted, 1);
672 int bend_present(void *handle, bend_present_rr *rr)
682 Z_RecordComposition *composition;
683 Z_ElementSetNames *simple;
686 Zfront_handle *zhandle = (Zfront_handle *)handle;
688 /* WRBUF oid_dotted; */
695 hv_store(href, "HANDLE", 6, zhandle->handle, 0);
696 hv_store(href, "ERR_CODE", 8, newSViv(0), 0);
697 hv_store(href, "ERR_STR", 7, newSVpv("", 0), 0);
698 hv_store(href, "START", 5, newSViv(rr->start), 0);
699 hv_store(href, "SETNAME", 7, newSVpv(rr->setname, 0), 0);
700 hv_store(href, "NUMBER", 6, newSViv(rr->number), 0);
701 /*oid_dotted = oid2dotted(rr->request_format_raw);
702 hv_store(href, "REQ_FORM", 8, newSVpv((char *)oid_dotted->buf, oid_dotted->pos), 0);*/
703 hv_store(href, "HITS", 4, newSViv(0), 0);
704 hv_store(href, "PID", 3, newSViv(getpid()), 0);
707 composition = rr->comp;
708 if (composition->which == Z_RecordComp_simple)
710 simple = composition->u.simple;
711 if (simple->which == Z_ElementSetNames_generic)
713 hv_store(href, "COMP", 4, newSVpv(simple->u.generic, 0), 0);
730 XPUSHs(sv_2mortal(newRV( (SV*) href)));
734 perl_call_sv(present_ref, G_SCALAR | G_DISCARD);
738 temp = hv_fetch(href, "ERR_CODE", 8, 1);
739 err_code = newSVsv(*temp);
741 temp = hv_fetch(href, "ERR_STR", 7, 1);
742 err_string = newSVsv(*temp);
744 temp = hv_fetch(href, "HITS", 4, 1);
745 hits = newSVsv(*temp);
747 temp = hv_fetch(href, "HANDLE", 6, 1);
748 point = newSVsv(*temp);
755 rr->errcode = SvIV(err_code);
756 rr->hits = SvIV(hits);
758 ptr = SvPV(err_string, len);
759 ODR_errstr = (char *)odr_malloc(rr->stream, len + 1);
760 strcpy(ODR_errstr, ptr);
761 rr->errstring = ODR_errstr;
762 /* wrbuf_free(oid_dotted, 1);*/
763 zhandle->handle = point;
768 sv_free( (SV*) href);
774 int bend_esrequest(void *handle, bend_esrequest_rr *rr)
776 perl_call_sv(esrequest_ref, G_VOID | G_DISCARD | G_NOARGS);
781 int bend_delete(void *handle, bend_delete_rr *rr)
783 perl_call_sv(delete_ref, G_VOID | G_DISCARD | G_NOARGS);
788 int bend_scan(void *handle, bend_scan_rr *rr)
795 struct scan_entry *scan_list;
796 struct scan_entry *buffer;
797 int *step_size = rr->step_size;
801 SV *list_ref = sv_newmortal();
802 SV *err_code = sv_newmortal();
803 SV *err_str = sv_newmortal();
804 SV *point = sv_newmortal();
805 SV *status = sv_newmortal();
806 SV *number = sv_newmortal();
811 Zfront_handle *zhandle = (Zfront_handle *)handle;
818 if (rr->term->term->which == Z_Term_general)
820 hv_store(href, "TERM", 4, newSVpv(rr->term->term->u.general->buf, 0), 0);
822 rr->errcode = 229; /* Unsupported term type */
825 hv_store(href, "STEP", 4, newSViv(*step_size), 0);
826 hv_store(href, "NUMBER", 6, newSViv(rr->num_entries), 0);
827 hv_store(href, "POS", 3, newSViv(rr->term_position), 0);
828 hv_store(href, "ERR_CODE", 8, newSViv(0), 0);
829 hv_store(href, "ERR_STR", 7, newSVpv("", 0), 0);
830 hv_store(href, "HANDLE", 6, zhandle->handle, 0);
831 hv_store(href, "STATUS", 6, newSViv(BEND_SCAN_SUCCESS), 0);
832 hv_store(href, "ENTRIES", 7, newRV((SV *) list), 0);
834 basenames = rr->basenames;
835 for (i = 0; i < rr->num_bases; i++)
837 av_push(aref, newSVpv(*basenames++, 0));
839 hv_store(href, "DATABASES", 9, newRV( (SV*) aref), 0);
843 XPUSHs(sv_2mortal(newRV( (SV*) href)));
847 perl_call_sv(scan_ref, G_SCALAR | G_DISCARD);
851 temp = hv_fetch(href, "ERR_CODE", 8, 1);
852 err_code = newSVsv(*temp);
854 temp = hv_fetch(href, "ERR_STR", 7, 1);
855 err_str = newSVsv(*temp);
857 temp = hv_fetch(href, "HANDLE", 6, 1);
858 point = newSVsv(*temp);
860 temp = hv_fetch(href, "STATUS", 6, 1);
861 status = newSVsv(*temp);
863 temp = hv_fetch(href, "NUMBER", 6, 1);
864 number = newSVsv(*temp);
866 temp = hv_fetch(href, "ENTRIES", 7, 1);
867 list_ref = newSVsv(*temp);
868 entries = (AV *)SvRV(list_ref);
874 ptr = SvPV(err_str, len);
875 ODR_errstr = (char *)odr_malloc(rr->stream, len + 1);
876 strcpy(ODR_errstr, ptr);
877 rr->errstring = ODR_errstr;
878 rr->errcode = SvIV(err_code);
879 rr->num_entries = SvIV(number);
880 rr->status = SvIV(status);
881 scan_list = (struct scan_entry *) odr_malloc (rr->stream, rr->num_entries * sizeof(*scan_list));
883 for (i = 0; i < rr->num_entries; i++)
885 scan_item = (HV *)SvRV(sv_2mortal(av_shift(entries)));
886 temp = hv_fetch(scan_item, "TERM", 4, 1);
887 ptr = SvPV(*temp, len);
888 buffer->term = (char *) odr_malloc (rr->stream, len + 1);
889 strcpy(buffer->term, ptr);
890 temp = hv_fetch(scan_item, "OCCURRENCE", 10, 1);
891 buffer->occurrences = SvIV(*temp);
895 rr->entries = scan_list;
896 zhandle->handle = point;
898 /*sv_free(list_ref);*/
913 bend_initresult *bend_init(bend_initrequest *q)
915 bend_initresult *r = (bend_initresult *) odr_malloc (q->stream, sizeof(*r));
922 Zfront_handle *zhandle = (Zfront_handle *) xmalloc (sizeof(*zhandle));
934 /*q->bend_sort = bend_sort;*/
937 q->bend_search = bend_search;
941 q->bend_present = bend_present;
943 /*q->bend_esrequest = bend_esrequest;*/
944 /*q->bend_delete = bend_delete;*/
947 q->bend_fetch = bend_fetch;
951 q->bend_scan = bend_scan;
954 hv_store(href, "IMP_NAME", 8, newSVpv("", 0), 0);
955 hv_store(href, "IMP_VER", 7, newSVpv("", 0), 0);
956 hv_store(href, "ERR_CODE", 8, newSViv(0), 0);
957 hv_store(href, "PEER_NAME", 9, newSVpv(q->peer_name, 0), 0);
958 hv_store(href, "HANDLE", 6, newSVsv(&sv_undef), 0);
959 hv_store(href, "PID", 3, newSViv(getpid()), 0);
963 XPUSHs(sv_2mortal(newRV( (SV*) href)));
967 if (init_ref != NULL)
969 perl_call_sv(init_ref, G_SCALAR | G_DISCARD);
974 temp = hv_fetch(href, "IMP_NAME", 8, 1);
975 name = newSVsv(*temp);
977 temp = hv_fetch(href, "IMP_VER", 7, 1);
978 ver = newSVsv(*temp);
980 temp = hv_fetch(href, "ERR_CODE", 8, 1);
981 status = newSVsv(*temp);
983 temp = hv_fetch(href, "HANDLE", 6, 1);
984 handle= newSVsv(*temp);
990 zhandle->handle = handle;
991 r->errcode = SvIV(status);
993 ptr = SvPV(name, len);
994 q->implementation_name = (char *)xmalloc(len + 1);
995 strcpy(q->implementation_name, ptr);
996 /* q->implementation_name = SvPV(name, len);*/
997 ptr = SvPV(ver, len);
998 q->implementation_version = (char *)xmalloc(len + 1);
999 strcpy(q->implementation_version, ptr);
1005 void bend_close(void *handle)
1008 Zfront_handle *zhandle = (Zfront_handle *)handle;
1015 if (close_ref == NULL)
1021 hv_store(href, "HANDLE", 6, zhandle->handle, 0);
1025 XPUSHs(sv_2mortal(newRV((SV *)href)));
1029 perl_call_sv(close_ref, G_SCALAR | G_DISCARD);
1043 #line 1041 "SimpleServer.c"
1044 XS(XS_Net__Z3950__SimpleServer_set_init_handler)
1048 croak("Usage: Net::Z3950::SimpleServer::set_init_handler(arg)");
1051 #line 1037 "SimpleServer.xs"
1052 init_ref = newSVsv(arg);
1053 #line 1051 "SimpleServer.c"
1058 XS(XS_Net__Z3950__SimpleServer_set_close_handler)
1062 croak("Usage: Net::Z3950::SimpleServer::set_close_handler(arg)");
1065 #line 1044 "SimpleServer.xs"
1066 close_ref = newSVsv(arg);
1067 #line 1065 "SimpleServer.c"
1072 XS(XS_Net__Z3950__SimpleServer_set_sort_handler)
1076 croak("Usage: Net::Z3950::SimpleServer::set_sort_handler(arg)");
1079 #line 1051 "SimpleServer.xs"
1080 sort_ref = newSVsv(arg);
1081 #line 1079 "SimpleServer.c"
1086 XS(XS_Net__Z3950__SimpleServer_set_search_handler)
1090 croak("Usage: Net::Z3950::SimpleServer::set_search_handler(arg)");
1093 #line 1057 "SimpleServer.xs"
1094 search_ref = newSVsv(arg);
1095 #line 1093 "SimpleServer.c"
1100 XS(XS_Net__Z3950__SimpleServer_set_fetch_handler)
1104 croak("Usage: Net::Z3950::SimpleServer::set_fetch_handler(arg)");
1107 #line 1064 "SimpleServer.xs"
1108 fetch_ref = newSVsv(arg);
1109 #line 1107 "SimpleServer.c"
1114 XS(XS_Net__Z3950__SimpleServer_set_present_handler)
1118 croak("Usage: Net::Z3950::SimpleServer::set_present_handler(arg)");
1121 #line 1071 "SimpleServer.xs"
1122 present_ref = newSVsv(arg);
1123 #line 1121 "SimpleServer.c"
1128 XS(XS_Net__Z3950__SimpleServer_set_esrequest_handler)
1132 croak("Usage: Net::Z3950::SimpleServer::set_esrequest_handler(arg)");
1135 #line 1078 "SimpleServer.xs"
1136 esrequest_ref = newSVsv(arg);
1137 #line 1135 "SimpleServer.c"
1142 XS(XS_Net__Z3950__SimpleServer_set_delete_handler)
1146 croak("Usage: Net::Z3950::SimpleServer::set_delete_handler(arg)");
1149 #line 1085 "SimpleServer.xs"
1150 delete_ref = newSVsv(arg);
1151 #line 1149 "SimpleServer.c"
1156 XS(XS_Net__Z3950__SimpleServer_set_scan_handler)
1160 croak("Usage: Net::Z3950::SimpleServer::set_scan_handler(arg)");
1163 #line 1092 "SimpleServer.xs"
1164 scan_ref = newSVsv(arg);
1165 #line 1163 "SimpleServer.c"
1170 XS(XS_Net__Z3950__SimpleServer_start_server)
1174 #line 1098 "SimpleServer.xs"
1180 #line 1178 "SimpleServer.c"
1182 #line 1104 "SimpleServer.xs"
1183 argv_buf = (char **)xmalloc((items + 1) * sizeof(char *));
1185 for (i = 0; i < items; i++)
1187 ptr = SvPV(ST(i), len);
1188 *argv_buf = (char *)xmalloc(len + 1);
1189 strcpy(*argv_buf++, ptr);
1193 RETVAL = statserv_main(items, argv, bend_init, bend_close);
1194 #line 1192 "SimpleServer.c"
1195 ST(0) = sv_newmortal();
1196 sv_setiv(ST(0), (IV)RETVAL);
1204 XS(boot_Net__Z3950__SimpleServer)
1207 char* file = __FILE__;
1209 XS_VERSION_BOOTCHECK ;
1211 newXS("Net::Z3950::SimpleServer::set_init_handler", XS_Net__Z3950__SimpleServer_set_init_handler, file);
1212 newXS("Net::Z3950::SimpleServer::set_close_handler", XS_Net__Z3950__SimpleServer_set_close_handler, file);
1213 newXS("Net::Z3950::SimpleServer::set_sort_handler", XS_Net__Z3950__SimpleServer_set_sort_handler, file);
1214 newXS("Net::Z3950::SimpleServer::set_search_handler", XS_Net__Z3950__SimpleServer_set_search_handler, file);
1215 newXS("Net::Z3950::SimpleServer::set_fetch_handler", XS_Net__Z3950__SimpleServer_set_fetch_handler, file);
1216 newXS("Net::Z3950::SimpleServer::set_present_handler", XS_Net__Z3950__SimpleServer_set_present_handler, file);
1217 newXS("Net::Z3950::SimpleServer::set_esrequest_handler", XS_Net__Z3950__SimpleServer_set_esrequest_handler, file);
1218 newXS("Net::Z3950::SimpleServer::set_delete_handler", XS_Net__Z3950__SimpleServer_set_delete_handler, file);
1219 newXS("Net::Z3950::SimpleServer::set_scan_handler", XS_Net__Z3950__SimpleServer_set_scan_handler, file);
1220 newXS("Net::Z3950::SimpleServer::start_server", XS_Net__Z3950__SimpleServer_start_server, file);