2 * Copyright (C) 1994-1998, Index Data
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.3 1998-10-16 08:14:36 adam
8 * Updated record control system.
10 * Revision 1.2 1996/10/29 14:03:16 adam
11 * Include zebrautl.h instead of alexutil.h.
13 * Revision 1.1 1996/10/11 10:57:24 adam
14 * New module recctrl. Used to manage records (extract/retrieval).
16 * Revision 1.5 1996/06/04 10:18:59 adam
17 * Minor changes - removed include of ctype.h.
19 * Revision 1.4 1995/12/04 17:59:24 adam
20 * More work on regular expression conversion.
22 * Revision 1.3 1995/12/04 14:22:30 adam
23 * Extra arg to recType_byName.
24 * Started work on new regular expression parsed input to
27 * Revision 1.2 1995/11/15 14:46:19 adam
28 * Started work on better record management system.
30 * Revision 1.1 1995/09/27 12:22:28 adam
31 * More work on extract in record control.
32 * Field name is not in isam keys but in prefix in dictionary words.
45 struct recTypeEntry *next;
51 struct recTypeEntry *entries;
54 RecTypes recTypes_init (data1_handle dh)
56 RecTypes p = (RecTypes) nmem_malloc (data1_nmem_get (dh), sizeof(*p));
63 void recTypes_destroy (RecTypes rts)
65 struct recTypeEntry *rte;
67 for (rte = rts->entries; rte; rte = rte->next)
69 (*(rte->recType)->destroy)(rte->recType);
72 void recTypes_add_handler (RecTypes rts, RecType rt)
74 struct recTypeEntry *rte;
76 rte = nmem_malloc (data1_nmem_get (rts->dh), sizeof(*rte));
80 rte->next = rts->entries;
84 RecType recType_byName (RecTypes rts, const char *name, char *subType)
86 struct recTypeEntry *rte;
90 strcpy (tmpname, name);
91 if ((p = strchr (tmpname, '.')))
94 strcpy (subType, p+1);
98 for (rte = rts->entries; rte; rte = rte->next)
99 if (!strcmp (rte->recType->name, tmpname))
104 (*(rte->recType)->init)(rte->recType);
111 void recTypes_default_handlers (RecTypes rts)
113 recTypes_add_handler (rts, recTypeGrs);
114 recTypes_add_handler (rts, recTypeText);