From: Adam Dickmeiss Date: Tue, 18 Feb 2003 21:27:53 +0000 (+0000) Subject: CQL w/bison on WIN32 X-Git-Tag: YAZ.2.0~30 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=f512aa33473ae86f8e8efd8da749a82c398e87f0 CQL w/bison on WIN32 --- diff --git a/include/yaz/cql.h b/include/yaz/cql.h index 87bcb5d..4b75df2 100644 --- a/include/yaz/cql.h +++ b/include/yaz/cql.h @@ -1,4 +1,4 @@ -/* $Id: cql.h,v 1.2 2003-02-14 18:49:23 adam Exp $ +/* $Id: cql.h,v 1.3 2003-02-18 21:27:53 adam Exp $ Copyright (C) 2002-2003 Index Data Aps @@ -10,6 +10,7 @@ See the file LICENSE. #ifndef CQL_H_INCLUDED #define CQL_H_INCLUDED #include +#include typedef struct cql_parser *CQL_parser; @@ -20,6 +21,7 @@ typedef struct cql_parser *CQL_parser; * * Returns CQL parser or NULL if parser could not be created. */ +YAZ_EXPORT CQL_parser cql_parser_create(void); /** @@ -29,6 +31,7 @@ CQL_parser cql_parser_create(void); * Destroy CQL parser. This function does nothing if * NULL pointer is received. */ +YAZ_EXPORT void cql_parser_destroy(CQL_parser cp); /** @@ -41,6 +44,7 @@ void cql_parser_destroy(CQL_parser cp); * Returns 0 if parsing was succesful; non-zero (error code) if * unsuccesful. */ +YAZ_EXPORT int cql_parser_string(CQL_parser cp, const char *str); /** @@ -55,6 +59,7 @@ int cql_parser_string(CQL_parser cp, const char *str); * Returns 0 if parsing was succesful; non-zero (error code) if * unsuccesful. */ +YAZ_EXPORT int cql_parser_stream(CQL_parser cp, int (*getbyte)(void *client_data), void (*ungetbyte)(int b, void *client_data), @@ -70,6 +75,7 @@ int cql_parser_stream(CQL_parser cp, * Returns 0 if parsing was succesful; non-zero (error code) if * unsuccesful. */ +YAZ_EXPORT int cql_parser_stdio(CQL_parser cp, FILE *f); #define CQL_NODE_ST 1 @@ -108,52 +114,74 @@ struct cql_buf_write_info { char *buf; }; +YAZ_EXPORT void cql_buf_write_handler (const char *b, void *client_data); +YAZ_EXPORT void cql_node_print(struct cql_node *cn); +YAZ_EXPORT struct cql_node *cql_node_mk_sc(const char *index, const char *relation, const char *term); +YAZ_EXPORT struct cql_node *cql_node_mk_boolean(const char *op); +YAZ_EXPORT void cql_node_destroy(struct cql_node *cn); -struct cql_node *cql_node_prefix(struct cql_node *n, const char *prefix, +YAZ_EXPORT +struct cql_node *cql_node_prefix(struct cql_node *n, + const char *prefix, const char *uri); +YAZ_EXPORT struct cql_node *cql_node_mk_mod(const char *name, const char *value); +YAZ_EXPORT struct cql_node *cql_node_dup (struct cql_node *cp); +YAZ_EXPORT struct cql_node *cql_parser_result(CQL_parser cp); +YAZ_EXPORT void cql_to_xml(struct cql_node *cn, void (*pr)(const char *buf, void *client_data), void *client_data); +YAZ_EXPORT void cql_to_xml_stdio(struct cql_node *cn, FILE *f); +YAZ_EXPORT int cql_to_xml_buf(struct cql_node *cn, char *out, int max); +YAZ_EXPORT struct cql_node *cql_node_mk_proxargs(const char *relation, const char *distance, const char *unit, const char *ordering); +YAZ_EXPORT void cql_fputs(const char *buf, void *client_data); typedef struct cql_transform_t_ *cql_transform_t; +YAZ_EXPORT cql_transform_t cql_transform_open_FILE (FILE *f); +YAZ_EXPORT cql_transform_t cql_transform_open_fname(const char *fname); +YAZ_EXPORT void cql_transform_close(cql_transform_t ct); +YAZ_EXPORT void cql_transform_pr(cql_transform_t ct, struct cql_node *cn, void (*pr)(const char *buf, void *client_data), void *client_data); +YAZ_EXPORT int cql_transform_FILE(cql_transform_t ct, struct cql_node *cn, FILE *f); +YAZ_EXPORT int cql_transform_buf(cql_transform_t ct, struct cql_node *cn, char *out, int max); +YAZ_EXPORT int cql_transform_error(cql_transform_t ct, const char **addinfo); /* diff --git a/server/statserv.c b/server/statserv.c index 2e01fbb..5a71da0 100644 --- a/server/statserv.c +++ b/server/statserv.c @@ -6,7 +6,7 @@ * NT threaded server code by * Chas Woodfield, Fretwell Downing Informatics. * - * $Id: statserv.c,v 1.93 2003-02-17 21:23:31 adam Exp $ + * $Id: statserv.c,v 1.94 2003-02-18 21:27:53 adam Exp $ */ #include @@ -598,7 +598,7 @@ static void inetd_connection(int what) if ((assoc = create_association(chan, line))) { iochan_setdata(chan, assoc); - iochan_settimeout(chan, control_block.idle_timeout * 60); + iochan_settimeout(chan, 60); addr = cs_addrstr(line); yaz_log(LOG_LOG, "Inetd association from %s", addr ? addr : "[UNKNOWN]"); diff --git a/win/makefile b/win/makefile index e919875..acf94db 100644 --- a/win/makefile +++ b/win/makefile @@ -1,24 +1,10 @@ -# makefile.mak - makefile for MS NMAKE -# $Id: makefile,v 1.54 2003-02-18 09:11:50 adam Exp $ +# Copyright (C) 1994-2003, Index Data +# All rights reserved. +# $Id: makefile,v 1.55 2003-02-18 21:27:53 adam Exp $ # # Programmed by # HL: Heikki Levanto, Index Data # -# Log at the end of the file -# -# Missing -# - Move MS-C's whatnots into win direcotry -# - The TCL script produces C and H files in the same dir as the -# ASN files. H's are copied to INCL, C's are left there. -# They should be produced into OBJ... -# -# Envoronment problems -# - You need to have the proper path and environment for VC set -# up. There is a bat file VCVARS32.BAT that sets most of it up -# for you. You can find this somewhere near DevStudio\VC\BIN -# - RegSvr32 must also be along the path, often in WINDOWS\SYSTEM -# - TCL has to be available too, if compiling for NEW_Z3950 -# - You may have to edit the path to tcl below ########################################################### ############### Parameters @@ -42,9 +28,13 @@ LIBXML2_DIR=c:\libxml2-2.5.3.win32 # WIN32 binaries libxml2 & iconv from here: # http://www.zlatkovic.com/projects/libxml/binaries.html +# bison +HAVE_BISON=1 +BISON=bison + default: all -all: dirs generate dll client ztest zoomsh iconv libxml2 +all: dirs generate dll client ztest zoomsh cqlprog iconv libxml2 NSIS="c:\program files\nsis\makensis-bz2.exe" @@ -81,6 +71,8 @@ Z3950DIR=$(SRCDIR)\Z39.50 ILLDIR=$(SRCDIR)\ill CCLDIR=$(SRCDIR)\ccl ZOOMDIR=$(SRCDIR)\zoom +CQLDIR=$(SRCDIR)\cql + CLIENTDIR=$(SRCDIR)\CLIENT SERVERDIR=$(SRCDIR)\SERVER @@ -109,6 +101,9 @@ ZOOMTST6=$(BINDIR)\zoomtst6.exe ZOOMTST7=$(BINDIR)\zoomtst7.exe ZOOMTST8=$(BINDIR)\zoomtst8.exe +CQL2PQF=$(BINDIR)\cql2pqf.exe +CQL2XCQL=$(BINDIR)\cql2xcql.exe + # shortcut names defined here dll : $(DLL) client: $(CLIENT) @@ -117,6 +112,8 @@ ztest: $(ZTEST) zoomsh: $(ZOOMSH) $(ZOOMTST1) $(ZOOMTST2) $(ZOOMTST3) \ $(ZOOMTST4) $(ZOOMTST5) $(ZOOMTST6) $(ZOOMTST7) $(ZOOMTST8) +cqlprog: $(CQL2PQF) $(CQL2XCQL) + ########################################################### ############### Compiler and linker options ########################################################### @@ -219,6 +216,9 @@ CLIENT_LINK_OPTIONS = /subsystem:console ZOOMSH_LINK_OPTIONS = /subsystem:console SERVER_LINK_OPTIONS = -lib ZTEST_LINK_OPTIONS = /subsystem:console +CQL2PQF_LINK_OPTIONS = /subsystem:console +CQL2XCQL_LINK_OPTIONS = /subsystem:console + COMMON_TCL_OPTIONS= ..\util\yaz-comp -I$(INCLDIR) -i yaz @@ -273,6 +273,11 @@ YAZ_ZOOMTST7_OBJS = \ YAZ_ZOOMTST8_OBJS = \ $(OBJDIR)\zoomtst8.obj +YAZ_CQL2PQF_OBJS = \ + $(OBJDIR)\cql2pqf.obj +YAZ_CQL2XCQL_OBJS = \ + $(OBJDIR)\cql2xcql.obj + YAZ_SERVER_OBJS= \ "$(OBJDIR)\eventl.obj" \ "$(OBJDIR)\requestq.obj" \ @@ -399,6 +404,14 @@ YAZ_ZOOM_OBJS = \ $(OBJDIR)\zoom-c.obj \ $(OBJDIR)\zoom-opt.obj +YAZ_CQL_OBJS = \ + $(OBJDIR)\cql.obj \ + $(OBJDIR)\cqlstdio.obj \ + $(OBJDIR)\cqlstring.obj \ + $(OBJDIR)\cqltransform.obj \ + $(OBJDIR)\cqlutil.obj \ + $(OBJDIR)\xcqlutil.obj + COMMON_YAZ_OBJS= \ $(YAZ_UTIL_OBJS) \ $(YAZ_ODR_OBJS) \ @@ -406,7 +419,8 @@ COMMON_YAZ_OBJS= \ $(YAZ_ZUTIL_OBJS) \ $(YAZ_CCL_OBJS) \ $(YAZ_SERVER_OBJS) \ - $(YAZ_ZOOM_OBJS) + $(YAZ_ZOOM_OBJS) \ + $(YAZ_CQL_OBJS) YAZ_OBJS= \ $(Z3950_OBJS) \ @@ -583,6 +597,9 @@ generated_files: \ {$(ZOOMDIR)}.c{$(OBJDIR)}.obj: $(CPP) $(COPT) $< +{$(CQLDIR)}.c{$(OBJDIR)}.obj: + $(CPP) $(COPT) $< + ############### ASN-generated files !if $(HAVE_TCL) @@ -638,6 +655,12 @@ $(UTILDIR)\marc8.c: $(UTILDIR)\charconv.sgm !endif +!if $(HAVE_BISON) +$(CQLDIR)\cql.c: $(CQLDIR)\cql.y + @cd $(CQLDIR) + $(BISON) -y -p cql_ -o cql.c cql.y + +!endif ########################################################### ############### Resources @@ -809,6 +832,32 @@ $(ZOOMTST8) : "$(BINDIR)" $(YAZ_ZOOMTST8_OBJS) /out:$(ZOOMTST8) << +$(CQL2PQF) : "$(BINDIR)" $(YAZ_CQL2PQF_OBJS) + @echo Linking $(CQL2PQF) + $(LINK) @<< + $(LNKOPT) + $(CQL2PQF_LINK_OPTIONS) + $(LINK_LIBS) + $(IMPLIB) + $(YAZ_CQL2PQF_OBJS) + /pdb:"$(LIBDIR)\cql2pqf.pdb" + /map:"$(LIBDIR)\cql2pqf.map" + /out:$(CQL2PQF) +<< + +$(CQL2XCQL) : "$(BINDIR)" $(YAZ_CQL2XCQL_OBJS) + @echo Linking $(CQL2XCQL) + $(LINK) @<< + $(LNKOPT) + $(CQL2XCQL_LINK_OPTIONS) + $(LINK_LIBS) + $(IMPLIB) + $(YAZ_CQL2XCQL_OBJS) + /pdb:"$(LIBDIR)\cql2xcql.pdb" + /map:"$(LIBDIR)\cql2xcql.map" + /out:$(CQL2XCQL) +<< + $(ZTEST) : "$(BINDIR)" $(ZTEST_OBJS) $(DLL) @echo Linking the ztest $(ZTEST) $(LINK) @<< @@ -824,7 +873,6 @@ $(ZTEST) : "$(BINDIR)" $(ZTEST_OBJS) $(DLL) /out:$(ZTEST) << - # note that this links a lib, so it uses completely different options. ########################################################### @@ -837,13 +885,12 @@ clean: -del $(BINDIR)\*.exe -del $(BINDIR)\*.dll -del $(TMPDIR)\*. - -del $(LIBDIR)\*.MAP - -del $(LIBDIR)\*.LIB -del $(OBJDIR)\*.OBJ realclean: clean + -del $(CQLDIR)\cql.c -del $(Z3950_C_DIR)\z*.c -del $(INCLDIR)\yaz\z-accdes1.h -del $(INCLDIR)\yaz\z-core.h @@ -881,7 +928,10 @@ $(ILL_OBJS): $(ILL_CORE_FILES) $(ITEM_REQ_FILES) ########################################################### # # $Log: makefile,v $ -# Revision 1.54 2003-02-18 09:11:50 adam +# Revision 1.55 2003-02-18 21:27:53 adam +# CQL w/bison on WIN32 +# +# Revision 1.54 2003/02/18 09:11:50 adam # Prepare for external utilties: iconv, libxml2 on WIN32 # # Revision 1.53 2003/02/17 22:34:39 adam diff --git a/win/yaz.nsi b/win/yaz.nsi index e2b6033..ee6b3f6 100644 --- a/win/yaz.nsi +++ b/win/yaz.nsi @@ -1,4 +1,4 @@ -; $Id: yaz.nsi,v 1.17 2003-02-10 08:59:14 adam Exp $ +; $Id: yaz.nsi,v 1.18 2003-02-18 21:27:53 adam Exp $ !define VERSION "1.9.3" @@ -108,6 +108,9 @@ Section "YAZ Source" File ..\ill\*.c File ..\ill\*.asn File ..\ill\*.tcl + SetOutPath $INSTDIR\cql + File ..\cql\*.c + File ..\cql\*.y SetOutPath $INSTDIR\zutil File ..\zutil\*.c File ..\zutil\*.h