dnl YAZ++ Toolkit, Index Data 1994-2006
dnl See the file LICENSE for details.
-dnl $Id: configure.ac,v 1.13 2007-01-25 18:36:48 adam Exp $
+dnl $Id: configure.ac,v 1.14 2007-03-20 07:54:11 adam Exp $
AC_PREREQ(2.59)
AC_INIT([yazpp],[1.0.2],[adam@indexdata.dk])
AC_CONFIG_SRCDIR(configure.ac)
AC_HEADER_STDC
AM_PROG_LIBTOOL
-YAZ_INIT(threads,2.1.23)
+YAZ_INIT(threads,2.1.50)
if test -z "$YAZLIB"; then
AC_MSG_ERROR([YAZ development libraries missing])
fi
* Copyright (c) 1998-2005, Index Data.
* See the file LICENSE for details.
*
- * $Id: query.h,v 1.1 2006-03-29 13:14:15 adam Exp $
+ * $Id: query.h,v 1.2 2007-03-20 07:54:11 adam Exp $
*/
#ifndef YAZ_PP_QUERY_H
#define YAZ_PP_QUERY_H
+#include <stddef.h>
#include <yaz/yconfig.h>
namespace yazpp_1 {
class YAZ_EXPORT Yaz_Query {
public:
/// Print query in buffer described by str and len
- virtual void print (char *str, int len) = 0;
+ virtual void print (char *str, size_t len) = 0;
virtual ~Yaz_Query();
};
};
* Copyright (c) 1998-2005, Index Data.
* See the file LICENSE for details.
*
- * $Id: z-query.h,v 1.2 2006-06-19 13:12:06 adam Exp $
+ * $Id: z-query.h,v 1.3 2007-03-20 07:54:11 adam Exp $
*/
#ifndef YAZPP_Z_QUERY_INCLUDED
/// Get Z Query
Z_Query *get_Z_Query ();
/// print query
- void print(char *str, int len);
+ void print(char *str, size_t len);
/// match query
int match(const Yaz_Z_Query *other);
/// Copy
ODR odr_decode;
ODR odr_encode;
ODR odr_print;
- WRBUF zquery2pquery(Z_Query *q);
};
};
#endif
* Copyright (c) 1998-2004, Index Data.
* See the file LICENSE for details.
*
- * $Id: yaz-cql2rpn.cpp,v 1.13 2007-01-16 11:54:55 adam Exp $
+ * $Id: yaz-cql2rpn.cpp,v 1.14 2007-03-20 07:54:11 adam Exp $
*/
#include <yaz/log.h>
{
size_t off;
const char *pqf_msg;
- int code = yaz_pqf_error(pp, &pqf_msg, &off);
+ yaz_pqf_error(pp, &pqf_msg, &off);
r = -1;
}
yaz_pqf_destroy(pp);
* Copyright (c) 1998-2004, Index Data.
* See the file LICENSE for details.
*
- * $Id: yaz-my-client.cpp,v 1.24 2006-10-10 13:31:49 adam Exp $
+ * $Id: yaz-my-client.cpp,v 1.25 2007-03-20 07:54:11 adam Exp $
*/
#include <stdlib.h>
}
if (r->which == Z_External_octet && record->u.octet_aligned->len)
{
+ yaz_marc_t mt = yaz_marc_create();
switch (ent->value)
{
case VAL_ISO2709:
case VAL_SIGLEMARC:
case VAL_ISDSMARC:
case VAL_RUSMARC:
- marc_display((char*) record->u.octet_aligned->buf,0);
+ const char *result_buf;
+ size_t result_size;
+ yaz_marc_decode_buf(mt, (const char *)
+ record->u.octet_aligned->buf,
+ record->u.octet_aligned->len,
+ &result_buf, &result_size);
+ fwrite(result_buf, 1, result_size, stdout);
break;
default:
recv_textRecord((int) ent->value,
(const char *) record->u.octet_aligned->buf,
(size_t) record->u.octet_aligned->len);
}
+ yaz_marc_destroy(mt);
}
else if (ent && ent->value == VAL_SUTRS && r->which == Z_External_sutrs)
recv_textRecord((int) VAL_SUTRS, (const char *) r->u.sutrs->buf,
/*
- * Copyright (c) 1998-2005, Index Data.
+ * Copyright (c) 1998-2007, Index Data.
* See the file LICENSE for details.
*
- * $Id: yaz-z-query.cpp,v 1.20 2006-06-19 13:12:07 adam Exp $
+ * $Id: yaz-z-query.cpp,v 1.21 2007-03-20 07:54:11 adam Exp $
*/
-#include <yaz/logrpn.h>
+#include <yaz/querytowrbuf.h>
#include <yazpp/z-query.h>
#include <yaz/pquery.h>
#include <assert.h>
return query;
}
-void Yaz_Z_Query::print(char *str, int len)
+void Yaz_Z_Query::print(char *str, size_t len)
{
Z_Query *query;
*str = 0;
odr_setbuf(odr_decode, m_buf, m_len, 0);
if (!z_Query(odr_decode, &query, 0, 0))
return;
- WRBUF wbuf = zquery2pquery(query);
- if (wbuf)
+ WRBUF wbuf = wrbuf_alloc();
+ yaz_query_to_wrbuf(wbuf, query);
+ if (wrbuf_len(wbuf) > len-1)
{
- if (wrbuf_len(wbuf) > len-1)
- {
- memcpy(str, wrbuf_buf(wbuf), len-1);
- str[len-1] = '\0';
- }
- else
- strcpy(str, wrbuf_buf(wbuf));
- wrbuf_free(wbuf,1);
+ memcpy(str, wrbuf_buf(wbuf), len-1);
+ str[len-1] = '\0';
}
+ else
+ strcpy(str, wrbuf_cstr(wbuf));
+ wrbuf_destroy(wbuf);
odr_reset(odr_decode);
}
return 1;
}
-WRBUF Yaz_Z_Query::zquery2pquery(Z_Query *q)
-{
- WRBUF w = wrbuf_alloc();
- wrbuf_put_zquery(w, q);
- return w;
-}
-
/*
* Local variables:
* c-basic-offset: 4