2 * FML interpreter. Europagate, 1995
5 * Revision 1.5 1995/03/30 14:22:02 adam
6 * Uses MARC anchor functions now.
8 * Revision 1.4 1995/02/23 08:32:05 adam
11 * Revision 1.2 1995/02/10 16:52:08 adam
12 * Indicator field moved in MARC structure. The FML list representation
13 * of a MARC record has changed.
15 * Revision 1.1 1995/02/10 15:50:56 adam
16 * MARC interface implemented. Minor bugs fixed. fmltest can
17 * be used to format single MARC records. New function '\list'
31 static void add_string (const char *str, char **buf, int *max, int *size)
33 if (*size + strlen(str) >= *max)
36 int nsize = *size + strlen(str) + 2048;
38 nbuf = malloc (nsize);
48 strcpy (*buf + *size, str);
52 char *marc_to_str (Fml fml, Iso2709Rec rec)
54 static char *buf = NULL;
58 char *tag, *indicator, *identifier, *data;
60 add_string ("{", &buf, &max, &size);
61 a = iso2709_a_mk (rec);
64 if (!iso2709_a_info_line (a, &tag, &indicator))
66 add_string ("{\'", &buf, &max, &size);
67 add_string (tag, &buf, &max, &size);
68 add_string ("\'",&buf, &max, &size);
71 add_string ("\'", &buf, &max, &size);
72 add_string (indicator, &buf, &max, &size);
73 add_string ("\'", &buf, &max, &size);
76 add_string ("{}", &buf, &max, &size);
77 add_string ("{", &buf, &max, &size);
80 iso2709_a_info_field (a, NULL, NULL, &identifier, &data);
81 add_string ("{", &buf, &max, &size);
84 add_string ("\'", &buf, &max, &size);
85 add_string (identifier, &buf, &max, &size);
86 add_string ("\'", &buf, &max, &size);
89 add_string ("{}", &buf, &max, &size);
90 add_string (" \'", &buf, &max, &size);
91 add_string (data, &buf, &max, &size);
92 add_string ("\'}", &buf, &max, &size);
93 } while (iso2709_a_next_field (a));
94 add_string ("}}\n", &buf, &max, &size);
95 } while (iso2709_a_next_line (a));
96 add_string ("}", &buf, &max, &size);