Possible compatibility problems with earlier versions marked with '*'.
+Added extended attributes for retrieval module (data1), so that data1
+records carry d1_readXML/SGML attributes.
+
On UNIX when POSIX threads are available, a separate library libyazthread
is created. Programmers should link with that library and the yaz library
when using threads. The reason for the split was that some applications
#line 2454 "configure"
#include "confdefs.h"
#include <pthread.h>
- int func(void *p) { return 0; }
+ void *func(void *p) { return 0; }
int main() {
pthread_t pthread_id;
- int r = pthread_create (&pthread_id, 0, func, 0);
+ pthread_create (&pthread_id, 0, func, 0);
; return 0; }
EOF
if { (eval echo configure:2465: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
dnl YAZ Toolkit, Index Data 1994-2000
dnl See the file LICENSE for details.
-dnl $Id: configure.in,v 1.38 2000-11-23 10:58:32 adam Exp $
+dnl $Id: configure.in,v 1.39 2000-11-29 14:22:47 adam Exp $
AC_INIT(include/yaz/yaz-version.h)
AM_INIT_AUTOMAKE(yaz, 1.7)
dnl
AC_CHECK_LIB(pthread,main)
AC_MSG_CHECKING(for working POSIX Threads)
AC_TRY_LINK([#include <pthread.h>
- int func(void *p) { return 0; }
+ void *func(void *p) { return 0; }
],[
pthread_t pthread_id;
- int r = pthread_create (&pthread_id, 0, func, 0);],
+ pthread_create (&pthread_id, 0, func, 0);],
thread_ok=yes,thread_ok=no)
if test "$thread_ok" = "yes"; then
LIBTHREAD=-lpthread
* OF THIS SOFTWARE.
*
* $Log: data1.h,v $
- * Revision 1.4 2000-02-28 11:20:06 adam
+ * Revision 1.5 2000-11-29 14:22:47 adam
+ * Implemented XML/SGML attributes for data1 so that d1_read reads them
+ * and d1_write generates proper attributes for XML/SGML records. Added
+ * register locking for threaded version.
+ *
+ * Revision 1.4 2000/02/28 11:20:06 adam
* Using autoconf. New definitions: YAZ_BEGIN_CDECL/YAZ_END_CDECL.
*
* Revision 1.3 2000/01/04 17:46:17 ian
#define d1_isspace(c) strchr(" \r\n\t\f", c)
#define d1_isdigit(c) ((c) <= '9' && (c) >= '0')
+#define DATA1_USING_XATTR 1
+
YAZ_BEGIN_CDECL
#define data1_matchstr(s1, s2) yaz_matchstr(s1, s2)
data1_element *elements;
} data1_sub_elements;
+#if DATA1_USING_XATTR
+typedef struct data1_xattr {
+ char *name;
+ char *value;
+ struct data1_xattr *next;
+} data1_xattr;
+#endif
+
typedef struct data1_absyn
{
char *name;
int get_bytes;
unsigned node_selected : 1;
unsigned make_variantlist : 1;
+#if DATA1_USING_XATTR
+ data1_xattr *attributes;
+#endif
} tag;
struct
data1_absyn *absyn,
const char *name);
YAZ_EXPORT data1_node *data1_mk_node(data1_handle dh, NMEM m);
+YAZ_EXPORT data1_node *data1_mk_node_type (data1_handle dh, NMEM m, int type);
YAZ_EXPORT data1_absyn *data1_get_absyn(data1_handle dh, const char *name);
YAZ_EXPORT data1_attset *data1_get_attset (data1_handle dh, const char *name);
YAZ_EXPORT data1_maptab *data1_read_maptab(data1_handle dh, const char *file);
/*
- * Copyright (c) 1995-1999, Index Data.
+ * Copyright (c) 1995-2000, Index Data.
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: d1_map.c,v $
- * Revision 1.17 1999-11-30 13:47:12 adam
+ * Revision 1.18 2000-11-29 14:22:47 adam
+ * Implemented XML/SGML attributes for data1 so that d1_read reads them
+ * and d1_write generates proper attributes for XML/SGML records. Added
+ * register locking for threaded version.
+ *
+ * Revision 1.17 1999/11/30 13:47:12 adam
* Improved installation. Moved header files to include/yaz.
*
* Revision 1.16 1999/10/21 12:06:29 adam
{
if (!cur || mt->new_field || !tagmatch(cur, mt))
{
- cur = data1_mk_node (dh, mem);
- cur->which = DATA1N_tag;
- cur->u.tag.element = 0;
+ cur = data1_mk_node_type (dh, mem, DATA1N_tag);
cur->u.tag.tag = mt->value.string;
- cur->u.tag.node_selected = 0;
+
cur->parent = pn;
cur->root = pn->root;
if (!pn->child)
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: d1_read.c,v $
- * Revision 1.32 2000-01-06 11:25:59 adam
+ * Revision 1.33 2000-11-29 14:22:47 adam
+ * Implemented XML/SGML attributes for data1 so that d1_read reads them
+ * and d1_write generates proper attributes for XML/SGML records. Added
+ * register locking for threaded version.
+ *
+ * Revision 1.32 2000/01/06 11:25:59 adam
* Added case to prevent warning.
*
* Revision 1.31 1999/12/21 14:16:20 ian
return r;
}
+data1_node *data1_mk_node_type (data1_handle dh, NMEM m, int type)
+{
+ data1_node *r;
+
+ r = data1_mk_node(dh, m);
+ r->which = type;
+ switch(type)
+ {
+ case DATA1N_tag:
+ r->u.tag.tag = 0;
+ r->u.tag.element = 0;
+ r->u.tag.no_data_requested = 0;
+ r->u.tag.node_selected = 0;
+ r->u.tag.make_variantlist = 0;
+ r->u.tag.get_bytes = -1;
+#if DATA1_USING_XATTR
+ r->u.tag.attributes = 0;
+#endif
+ break;
+ case DATA1N_root:
+ r->u.root.type = 0;
+ r->u.root.absyn = 0;
+ break;
+ case DATA1N_data:
+ r->u.data.data = 0;
+ r->u.data.len = 0;
+ r->u.data.what = 0;
+ r->u.data.formatted_text = 0;
+ break;
+ default:
+ logf (LOG_WARN, "data_mk_node_type. bad type = %d\n", type);
+ }
+ return r;
+}
+
void data1_free_tree (data1_handle dh, data1_node *t)
{
data1_node *p = t->child, *pn;
int first_flag, int local_allowed)
{
data1_node *partag = get_parent_tag (dh, at);
- data1_node *tagn = data1_mk_node (dh, m);
+ data1_node *tagn = data1_mk_node_type (dh, m, DATA1N_tag);
data1_element *e = NULL;
data1_node *datn;
- tagn->which = DATA1N_tag;
tagn->u.tag.tag = data1_insert_string (dh, tagn, m, tagname);
- tagn->u.tag.node_selected = 0;
- tagn->u.tag.make_variantlist = 0;
- tagn->u.tag.no_data_requested = 0;
- tagn->u.tag.get_bytes = -1;
if (partag)
e = partag->u.tag.element;
data1_getelementbytagname (dh, root->u.root.absyn, e, tagname);
if (!local_allowed && !tagn->u.tag.element)
return NULL;
- tagn->last_child = tagn->child = datn = data1_mk_node (dh, m);
+ tagn->last_child = tagn->child = datn = data1_mk_node_type (dh, m, DATA1N_data);
tagn->root = root;
datn->parent = tagn;
datn->root = root;
- datn->which = DATA1N_data;
datn->u.data.formatted_text = 0;
tagn->parent = at;
return data1_add_insert_taggeddata (dh, root, at, tagname, m, 1, 0);
}
+#if DATA1_USING_XATTR
+data1_xattr *data1_read_xattr (data1_handle dh, NMEM m,
+ int (*get_byte)(void *fh), void *fh,
+ WRBUF wrbuf, int *ch)
+{
+ data1_xattr *p_first = 0;
+ data1_xattr **pp = &p_first;
+ int c = *ch;
+ for (;;)
+ {
+ data1_xattr *p;
+ int len;
+ while (c && d1_isspace(c))
+ c = (*get_byte)(fh);
+ if (!c || c == '>' || c == '/')
+ break;
+ *pp = p = nmem_malloc (m, sizeof(*p));
+ p->next = 0;
+ pp = &p->next;
+ p->value = 0;
+
+ wrbuf_rewind(wrbuf);
+ while (c && c != '=' && c != '>' && c != '/' && !d1_isspace(c))
+ {
+ wrbuf_putc (wrbuf, c);
+ c = (*get_byte)(fh);
+ }
+ wrbuf_putc (wrbuf, '\0');
+ len = wrbuf_len(wrbuf);
+ p->name = nmem_malloc (m, len);
+ strcpy (p->name, wrbuf_buf(wrbuf));
+ if (c == '=')
+ {
+ c = (*get_byte)(fh);
+ if (c == '"')
+ c = (*get_byte)(fh);
+ wrbuf_rewind(wrbuf);
+ while (c && c != '"' && c != '>' && c != '/')
+ {
+ wrbuf_putc (wrbuf, c);
+ c = (*get_byte)(fh);
+ }
+ wrbuf_putc (wrbuf, '\0');
+ len = wrbuf_len(wrbuf);
+ p->value = nmem_malloc (m, len);
+ strcpy (p->value, wrbuf_buf(wrbuf));
+ if (c == '"')
+ c = (*get_byte)(fh);
+ }
+ }
+ *ch = c;
+ return p_first;
+}
+#endif
+
/*
* Ugh. Sometimes functions just grow and grow on you. This one reads a
* 'node' and its children.
if (c == '<') /* beginning of tag */
{
+#if DATA1_USING_XATTR
+ data1_xattr *xattr;
+#endif
char tag[64];
char args[256];
size_t i;
-
for (i = 0; (c=(*get_byte)(fh)) && c != '>' && !d1_isspace(c);)
if (i < (sizeof(tag)-1))
tag[i++] = c;
tag[i] = '\0';
+#if DATA1_USING_XATTR
+ xattr = data1_read_xattr (dh, m, get_byte, fh, wrbuf, &c);
+ args[0] = '\0';
+#else
while (d1_isspace(c))
c = (*get_byte)(fh);
for (i = 0; c && c != '>'; c = (*get_byte)(fh))
if (i < (sizeof(args)-1))
args[i++] = c;
args[i] = '\0';
+#endif
if (c != '>')
{
yaz_log(LOG_WARN, "d1: %d: Malformed tag", line);
yaz_log(LOG_WARN, "Unable to acquire abstract syntax " "for '%s'", tag);
/* It's now OK for a record not to have an absyn */
}
- res = data1_mk_node (dh, m);
- res->which = DATA1N_root;
+ res = data1_mk_node_type (dh, m, DATA1N_root);
res->u.root.type = data1_insert_string (dh, res, m, tag);
res->u.root.absyn = absyn;
res->root = res;
localtag = 1; /* our parent is a local tag */
elem = data1_getelementbytagname(dh, absyn, e, tag);
- res = data1_mk_node (dh, m);
- res->which = DATA1N_tag;
+ res = data1_mk_node_type (dh, m, DATA1N_tag);
res->u.tag.tag = data1_insert_string (dh, res, m, tag);
res->u.tag.element = elem;
- res->u.tag.node_selected = 0;
- res->u.tag.make_variantlist = 0;
- res->u.tag.no_data_requested = 0;
- res->u.tag.get_bytes = -1;
+#if DATA1_USING_XATTR
+ res->u.tag.attributes = xattr;
+#endif
}
if (parent)
{
c = (*get_byte)(fh);
continue;
}
- res = data1_mk_node(dh, m);
+ res = data1_mk_node_type (dh, m, DATA1N_data);
res->parent = parent;
- res->which = DATA1N_data;
res->u.data.what = DATA1I_text;
res->u.data.formatted_text = 0;
res->root = parent->root;
wrbuf_rewind(wrbuf);
- while (c != '<')
+ while (c && c != '<')
{
wrbuf_putc (wrbuf, c);
c = (*get_byte)(fh);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: d1_write.c,v $
- * Revision 1.8 1999-11-30 13:47:12 adam
+ * Revision 1.9 2000-11-29 14:22:47 adam
+ * Implemented XML/SGML attributes for data1 so that d1_read reads them
+ * and d1_write generates proper attributes for XML/SGML records. Added
+ * register locking for threaded version.
+ *
+ * Revision 1.8 1999/11/30 13:47:12 adam
* Improved installation. Moved header files to include/yaz.
*
* Revision 1.7 1999/10/21 12:06:29 adam
}
else
{
- sprintf(line, "%*s<%s>\n", col, "", tag);
- wrbuf_write(b, line, strlen(line));
+#if DATA1_USING_XATTR
+ data1_xattr *p;
+#endif
+ sprintf (line, "%*s<", col, "");
+ wrbuf_puts (b, line);
+ wrbuf_puts (b, tag);
+#if DATA1_USING_XATTR
+ for (p = c->u.tag.attributes; p; p = p->next)
+ {
+ wrbuf_putc (b, ' ');
+ wrbuf_puts (b, p->name);
+ wrbuf_putc (b, '=');
+ wrbuf_putc (b, '"');
+ wrbuf_puts (b, p->value);
+ wrbuf_putc (b, '"');
+ }
+#endif
+ wrbuf_puts(b, ">\n");
if (nodetoidsgml(c, select, b, (col > 40) ? 40 : col+2) < 0)
return -1;
sprintf (line, "%*s</%s>\n", col, "", tag);
* Chas Woodfield, Fretwell Downing Informatics.
*
* $Log: statserv.c,v $
- * Revision 1.67 2000-11-23 10:58:32 adam
+ * Revision 1.68 2000-11-29 14:22:47 adam
+ * Implemented XML/SGML attributes for data1 so that d1_read reads them
+ * and d1_write generates proper attributes for XML/SGML records. Added
+ * register locking for threaded version.
+ *
+ * Revision 1.67 2000/11/23 10:58:32 adam
* SSL comstack support. Separate POSIX thread support library.
*
* Revision 1.66 2000/10/06 12:00:28 adam
if (mask)
{
- yaz_log (LOG_LOG, "new_session , accept incomplete");
cs_accept_mask = mask; /* accept didn't complete */
cs_get_mask = 0;
}
else
{
- yaz_log (LOG_LOG, "new_session , accept complete");
cs_accept_mask = 0; /* accept completed. */
cs_get_mask = mask = EVENT_INPUT;
}
-## $Id: yaz.m4,v 1.1 2000-10-11 10:40:56 adam Exp $
+## $Id: yaz.m4,v 1.2 2000-11-29 14:22:47 adam Exp $
##
# Use this m4 funciton for autoconf if you use YAZ in your own
# configure script.
fi
AC_MSG_CHECKING(for YAZ)
if $yazconfig --version >/dev/null 2>&1; then
- YAZLIB=`$yazconfig --libs`
+ YAZLIB=`$yazconfig --libs $1`
# if this is empty, it's a simple version YAZ 1.6 script
# so we have to source it instead...
if test "X$YAZLIB" = "X"; then
. $yazconfig
else
- YAZLALIB=`$yazconfig --lalibs`
- YAZINC=`$yazconfig --cflags`
+ YAZLALIB=`$yazconfig --lalibs $1`
+ YAZINC=`$yazconfig --cflags $1`
YAZVERSION=`$yazconfig --version`
fi
AC_MSG_RESULT($yazconfig)