From: Sebastian Hammer Date: Thu, 9 Feb 1995 15:52:34 +0000 (+0000) Subject: Initial revision X-Git-Tag: YAZ.1.8~1162 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=d21336d699898344c0af816edf1064474af32b44 Initial revision --- diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..72f171e --- /dev/null +++ b/Makefile @@ -0,0 +1,51 @@ +# Copyright (C) 1994, Index Data I/S +# All rights reserved. +# Sebastian Hammer, Adam Dickmeiss +# $Id: Makefile,v 1.1 1995-02-09 15:57:16 quinn Exp $ + +#CC= +SHELL=/bin/sh +MAKE=make +SUBDIR=odr asn yazlib + +all: + for i in $(SUBDIR); do cd $$i; if $(MAKE) CFLAGS="$(CFLAGS)"; then cd ..; else exit 1; fi; done + +dep depend: + for i in $(SUBDIR); do cd $$i; if $(MAKE) depend; then cd ..; else exit 1; fi; done + +clean: + for i in $(SUBDIR); do (cd $$i; $(MAKE) clean); done + +cleanup: + rm -f `find $(SUBDIR) -name "*.[oa]" -print` + rm -f `find $(SUBDIR) -name "core" -print` + rm -f `find $(SUBDIR) -name "errlist" -print` + rm -f `find $(SUBDIR) -name "a.out" -print` + +distclean: cleanup clean + for i in $(SUBDIR); do (cd $$i; \ + mv Makefile Makefile.old; \ + sed '/^#Depend/q' Makefile; \ + rm Makefile.old); done + +usedepend1: + for i in $(SUBDIR); do (cd $$i; \ + mv Makefile Makefile.tmp; \ + sed 's/^if/#if/' Makefile; \ + rm Makefile.tmp); done + +usedepend2: + for i in $(SUBDIR); do (cd $$i; \ + mv Makefile Makefile.tmp; \ + sed '/^#Depend/q' Makefile; \ + rm Makefile.tmp); done + +wc: + wc `find . -name '*.[ch]'` + diff --git a/asn/Makefile b/asn/Makefile new file mode 100644 index 0000000..65fdd77 --- /dev/null +++ b/asn/Makefile @@ -0,0 +1,47 @@ +# Copyright (C) 1994, Index Data I/S +# All rights reserved. +# Sebastian Hammer, Adam Dickmeiss +# $Id: Makefile,v 1.1 1995-02-09 15:52:34 quinn Exp $ + +SHELL=/bin/sh +INCLUDE=-I../include -I. -I../odr +CFLAGS=-g -Wall -pedantic -ansi +DEFS=$(INCLUDE) +LIB=asn.a +PO = proto.o +CPP=cc -E + +all: $(LIB) test + +test: test.o $(LIB) ../odr/odr.a + $(CC) $(CFLAGS) $(INCLUDE) -o test test.o $(LIB) ../odr/odr.a + +alll: + +$(LIB): $(PO) + rm -f $(LIB) + ar qc $(LIB) $(PO) + ranlib $(LIB) + +.c.o: + $(CC) -c $(DEFS) $(CFLAGS) $< + +clean: + rm -f *.[oa] test core mon.out gmon.out errlist + +depend: depend2 + +depend1: + mv Makefile Makefile.tmp + sed '/^#Depend/q' Makefile + $(CPP) $(INCLUDE) -M *.c >>Makefile + -rm Makefile.tmp + +depend2: + $(CPP) $(INCLUDE) -M *.c >.depend + +ifeq (.depend,$(wildcard .depend)) +include .depend +endif + +#Depend --- DOT NOT DELETE THIS LINE diff --git a/asn/test.c b/asn/test.c new file mode 100644 index 0000000..e61e12e --- /dev/null +++ b/asn/test.c @@ -0,0 +1,68 @@ +#include +#include +#include +#include + +int main() +{ + int i; + unsigned char buf[10000]; + struct odr o; + Z_APDU apdu, *papdu, *papdu2; + Z_SearchRequest sreq; + int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10; + bool_t rep; + static char *names[] = {"Erik", "William", "George", "Bob"}; + Z_Query query; + Z_RPNQuery rpnquery; + Odr_oid att[] = { 1, 2, 3, 4, 5, 6, -1}; + Z_RPNStructure rpnstructure; + Z_Operand operand; + Z_AttributesPlusTerm apt; + Odr_oct term; + + papdu = &apdu; + apdu.which = Z_APDU_searchRequest; + apdu.u.searchRequest = &sreq; + a1 = 1000; sreq.smallSetUpperBound = &a1; + a2 = 2000; sreq.largeSetLowerBound = &a2; + a3 = 100; sreq.mediumSetPresentNumber = &a3; + rep = 1; sreq.replaceIndicator = &rep; + sreq.resultSetName = "FOOBAR"; + sreq.num_databaseNames = 4; + sreq.databaseNames = names; + sreq.smallSetElementSetNames = 0; + sreq.mediumSetElementSetNames = 0; + sreq.preferredRecordSyntax = 0; + query.which = Z_Query_type_1; + query.u.type_1 = &rpnquery; + sreq.query = &query; + rpnquery.attributeSetId = att; + rpnquery.RPNStructure = &rpnstructure; + rpnstructure.which = Z_RPNStructure_simple; + rpnstructure.u.simple = &operand; + operand.which = Z_Operand_APT; + operand.u.attributesPlusTerm = &apt; + apt.num_attributes=0; + apt.attributeList = 0; + apt.term = &term; + term.buf = "BARFOO"; + term.len = term.size = strlen(term.buf); + + o.buf = buf; + o.bp=o.buf; + o.left = o.buflen = 10000; + o.direction = ODR_PRINT; + o.print = stdout; + o.indent = 0; + o.t_class = -1; + + printf("status=%d\n", z_APDU(&o, &papdu, 0)); + + return 0; + + o.direction = ODR_DECODE; + o.bp = o.buf; + + z_APDU(&o, &papdu2, 0); +}