-/* $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
#ifndef CQL_H_INCLUDED
#define CQL_H_INCLUDED
#include <stdio.h>
+#include <yaz/yconfig.h>
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);
/**
* Destroy CQL parser. This function does nothing if
* NULL pointer is received.
*/
+YAZ_EXPORT
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);
/**
* 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),
* 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
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);
/*
-# 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
# 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"
ILLDIR=$(SRCDIR)\ill
CCLDIR=$(SRCDIR)\ccl
ZOOMDIR=$(SRCDIR)\zoom
+CQLDIR=$(SRCDIR)\cql
+
CLIENTDIR=$(SRCDIR)\CLIENT
SERVERDIR=$(SRCDIR)\SERVER
ZOOMTST7=$(BINDIR)\zoomtst7.exe
ZOOMTST8=$(BINDIR)\zoomtst8.exe
+CQL2PQF=$(BINDIR)\cql2pqf.exe
+CQL2XCQL=$(BINDIR)\cql2xcql.exe
+
# shortcut names defined here
dll : $(DLL)
client: $(CLIENT)
zoomsh: $(ZOOMSH) $(ZOOMTST1) $(ZOOMTST2) $(ZOOMTST3) \
$(ZOOMTST4) $(ZOOMTST5) $(ZOOMTST6) $(ZOOMTST7) $(ZOOMTST8)
+cqlprog: $(CQL2PQF) $(CQL2XCQL)
+
###########################################################
############### Compiler and linker options
###########################################################
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
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" \
$(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) \
$(YAZ_ZUTIL_OBJS) \
$(YAZ_CCL_OBJS) \
$(YAZ_SERVER_OBJS) \
- $(YAZ_ZOOM_OBJS)
+ $(YAZ_ZOOM_OBJS) \
+ $(YAZ_CQL_OBJS)
YAZ_OBJS= \
$(Z3950_OBJS) \
{$(ZOOMDIR)}.c{$(OBJDIR)}.obj:
$(CPP) $(COPT) $<
+{$(CQLDIR)}.c{$(OBJDIR)}.obj:
+ $(CPP) $(COPT) $<
+
############### ASN-generated files
!if $(HAVE_TCL)
!endif
+!if $(HAVE_BISON)
+$(CQLDIR)\cql.c: $(CQLDIR)\cql.y
+ @cd $(CQLDIR)
+ $(BISON) -y -p cql_ -o cql.c cql.y
+
+!endif
###########################################################
############### Resources
/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) @<<
/out:$(ZTEST)
<<
-
# note that this links a lib, so it uses completely different options.
###########################################################
-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
###########################################################
#
# $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