2 * Copyright (c) 1995-1999, Index Data.
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
6 * $Log: d1_handle.c,v $
7 * Revision 1.6 1999-11-30 13:47:12 adam
8 * Improved installation. Moved header files to include/yaz.
10 * Revision 1.5 1999/08/27 09:40:32 adam
11 * Renamed logf function to yaz_log. Removed VC++ project files.
13 * Revision 1.4 1998/05/18 13:07:05 adam
14 * Changed the way attribute sets are handled by the retriaval module.
15 * Extended Explain conversion / schema.
16 * Modified server and client to work with ASN.1 compiled protocol handlers.
18 * Revision 1.3 1998/02/11 11:53:35 adam
19 * Changed code so that it compiles as C++.
21 * Revision 1.2 1997/09/30 11:50:04 adam
22 * Added handler data1_get_map_buf that is used by data1_nodetomarc.
24 * Revision 1.1 1997/09/17 12:28:24 adam
25 * Introduced new 'global' data1 handle.
33 #include <yaz/data1.h>
35 struct data1_handle_info {
42 data1_absyn_cache absyn_cache;
43 data1_attset_cache attset_cache;
51 data1_handle data1_create (void)
53 data1_handle p = (data1_handle)xmalloc (sizeof(*p));
57 p->wrbuf = wrbuf_alloc();
62 p->absyn_cache = NULL;
63 p->attset_cache = NULL;
64 p->mem = nmem_create ();
68 NMEM data1_nmem_get (data1_handle dh)
73 data1_absyn_cache *data1_absyn_cache_get (data1_handle dh)
75 return &dh->absyn_cache;
78 data1_attset_cache *data1_attset_cache_get (data1_handle dh)
80 return &dh->attset_cache;
83 void data1_destroy (data1_handle dh)
87 wrbuf_free (dh->wrbuf, 1);
94 nmem_destroy (dh->mem);
99 WRBUF data1_get_wrbuf (data1_handle dp)
104 char **data1_get_read_buf (data1_handle dp, int **lenp)
106 *lenp = &dp->read_len;
107 yaz_log (LOG_DEBUG, "data1_get_read_buf lenp=%u", **lenp);
108 return &dp->read_buf;
111 char **data1_get_map_buf (data1_handle dp, int **lenp)
113 *lenp = &dp->map_len;
114 yaz_log (LOG_DEBUG, "data1_get_map_buf lenp=%u", **lenp);
118 void data1_set_tabpath (data1_handle dp, const char *p)
122 xfree (dp->tab_path);
127 dp->tab_path = (char *)xmalloc (strlen(p)+1);
128 strcpy (dp->tab_path, p);
132 const char *data1_get_tabpath (data1_handle dp)