2 * Copyright (C) 1994-1999, Index Data
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.5 1999-05-26 07:49:14 adam
10 * Revision 1.4 1999/05/20 12:57:18 adam
11 * Implemented TCL filter. Updated recctrl system.
13 * Revision 1.3 1998/10/16 08:14:36 adam
14 * Updated record control system.
16 * Revision 1.2 1996/10/29 14:03:16 adam
17 * Include zebrautl.h instead of alexutil.h.
19 * Revision 1.1 1996/10/11 10:57:24 adam
20 * New module recctrl. Used to manage records (extract/retrieval).
22 * Revision 1.5 1996/06/04 10:18:59 adam
23 * Minor changes - removed include of ctype.h.
25 * Revision 1.4 1995/12/04 17:59:24 adam
26 * More work on regular expression conversion.
28 * Revision 1.3 1995/12/04 14:22:30 adam
29 * Extra arg to recType_byName.
30 * Started work on new regular expression parsed input to
33 * Revision 1.2 1995/11/15 14:46:19 adam
34 * Started work on better record management system.
36 * Revision 1.1 1995/09/27 12:22:28 adam
37 * More work on extract in record control.
38 * Field name is not in isam keys but in prefix in dictionary words.
51 struct recTypeEntry *next;
58 struct recTypeEntry *entries;
61 RecTypes recTypes_init (data1_handle dh)
63 RecTypes p = (RecTypes) nmem_malloc (data1_nmem_get (dh), sizeof(*p));
70 void recTypes_destroy (RecTypes rts)
72 struct recTypeEntry *rte;
74 for (rte = rts->entries; rte; rte = rte->next)
76 (*(rte->recType)->destroy)(rte->clientData);
79 void recTypes_add_handler (RecTypes rts, RecType rt)
81 struct recTypeEntry *rte;
83 rte = (struct recTypeEntry *)
84 nmem_malloc (data1_nmem_get (rts->dh), sizeof(*rte));
89 rte->next = rts->entries;
93 RecType recType_byName (RecTypes rts, const char *name, char *subType,
96 struct recTypeEntry *rte;
100 strcpy (tmpname, name);
101 if ((p = strchr (tmpname, '.')))
104 strcpy (subType, p+1);
108 for (rte = rts->entries; rte; rte = rte->next)
109 if (!strcmp (rte->recType->name, tmpname))
115 (*(rte->recType)->init)(rte->recType);
117 *clientDataP = rte->clientData;
123 void recTypes_default_handlers (RecTypes rts)
125 recTypes_add_handler (rts, recTypeGrs);
126 recTypes_add_handler (rts, recTypeText);