2 * Copyright (C) 1994-1999, Index Data
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.10 1999-11-30 13:48:04 adam
8 * Improved installation. Updated for inclusion of YAZ header files.
10 * Revision 1.9 1999/07/14 10:56:16 adam
11 * Filter handles multiple records in one file.
13 * Revision 1.8 1999/06/25 13:47:25 adam
14 * Minor change that prevents MSVC warning.
16 * Revision 1.7 1999/05/21 12:00:17 adam
17 * Better diagnostics for extraction process.
19 * Revision 1.6 1999/05/20 12:57:18 adam
20 * Implemented TCL filter. Updated recctrl system.
22 * Revision 1.5 1999/02/02 14:51:31 adam
23 * Updated WIN32 code specific sections. Changed header.
25 * Revision 1.4 1997/09/17 12:19:22 adam
26 * Zebra version corresponds to YAZ version 1.4.
27 * Changed Zebra server so that it doesn't depend on global common_resource.
29 * Revision 1.3 1997/09/04 13:54:41 adam
30 * Added MARC filter - type grs.marc.<syntax> where syntax refers
31 * to abstract syntax. New method tellf in retrieve/extract method.
33 * Revision 1.2 1997/04/30 08:56:08 quinn
36 * Revision 1.1 1996/10/11 10:57:32 adam
37 * New module recctrl. Used to manage records (extract/retrieval).
45 struct sgml_getc_info {
52 int (*readf)(void *, char *, size_t);
56 int sgml_getc (void *clientData)
58 struct sgml_getc_info *p = (struct sgml_getc_info *) clientData;
62 return p->buf[(p->off)++];
63 if (p->size < p->buf_size)
68 res = (*p->readf)(p->fh, p->buf, p->buf_size);
72 return p->buf[(p->off)++];
77 static data1_node *grs_read_sgml (struct grs_read_info *p)
79 struct sgml_getc_info *sgi = (struct sgml_getc_info *) p->clientData;
83 sgi->moffset = p->offset;
85 sgi->readf = p->readf;
88 res = (*sgi->readf)(sgi->fh, sgi->buf, sgi->buf_size);
93 node = data1_read_nodex (p->dh, p->mem, sgml_getc, sgi, sgi->wrbuf);
95 (*p->endf)(sgi->fh, sgi->moffset + sgi->off);
99 static void *grs_init_sgml(void)
101 struct sgml_getc_info *p = (struct sgml_getc_info *) xmalloc (sizeof(*p));
103 p->buf = xmalloc (p->buf_size);
104 p->wrbuf = wrbuf_alloc();
108 static void grs_destroy_sgml(void *clientData)
110 struct sgml_getc_info *p = (struct sgml_getc_info *) clientData;
112 wrbuf_free(p->wrbuf, 1);
117 static struct recTypeGrs sgml_type = {
124 RecTypeGrs recTypeGrs_sgml = &sgml_type;