1 /* $Id: d1_handle.c,v 1.10 2006-05-05 17:18:50 adam Exp $
2 Copyright (C) 1995-2005
5 This file is part of the Zebra server.
7 Zebra is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
12 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with Zebra; see the file LICENSE.zebra. If not, write to the
19 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
27 #include <idzebra/data1.h>
29 #define DATA1_FLAG_XML 1
31 struct data1_handle_info {
39 data1_absyn_cache absyn_cache;
40 data1_attset_cache attset_cache;
48 data1_handle data1_create(void)
50 data1_handle p = (data1_handle)xmalloc (sizeof(*p));
55 p->wrbuf = wrbuf_alloc();
60 p->absyn_cache = NULL;
61 p->attset_cache = NULL;
62 p->mem = nmem_create ();
66 NMEM data1_nmem_get (data1_handle dh)
71 data1_absyn_cache *data1_absyn_cache_get (data1_handle dh)
73 return &dh->absyn_cache;
76 data1_attset_cache *data1_attset_cache_get (data1_handle dh)
78 return &dh->attset_cache;
81 void data1_destroy (data1_handle dh)
87 We need to destroy DFAs, in xp_element (xelm) definitions
90 data1_absyn_destroy(dh);
92 wrbuf_free (dh->wrbuf, 1);
101 nmem_destroy (dh->mem);
106 WRBUF data1_get_wrbuf (data1_handle dp)
111 char **data1_get_read_buf (data1_handle dp, int **lenp)
113 *lenp = &dp->read_len;
114 yaz_log (YLOG_DEBUG, "data1_get_read_buf lenp=%u", **lenp);
115 return &dp->read_buf;
118 char **data1_get_map_buf (data1_handle dp, int **lenp)
120 *lenp = &dp->map_len;
121 yaz_log (YLOG_DEBUG, "data1_get_map_buf lenp=%u", **lenp);
125 void data1_set_tabpath (data1_handle dp, const char *p)
127 xfree (dp->tab_path);
130 dp->tab_path = xstrdup (p);
133 void data1_set_tabroot (data1_handle dp, const char *p)
135 xfree (dp->tab_root);
138 dp->tab_root = xstrdup (p);
141 const char *data1_get_tabpath (data1_handle dp)
146 const char *data1_get_tabroot (data1_handle dp)
151 FILE *data1_path_fopen (data1_handle dh, const char *file, const char *mode)
153 const char *path = data1_get_tabpath(dh);
154 const char *root = data1_get_tabroot(dh);
155 yaz_log(YLOG_DEBUG, "data1_fath_fopen file=%s mode=%s", file, mode);
156 return yaz_fopen (path, file, "r", root);
159 int data1_is_xmlmode(data1_handle dh)