1 | /* ------------------------------------------------------------------- */
|
---|
2 | /* norMARC : Convert a metatag struct to NORMARC */
|
---|
3 | /* */
|
---|
4 | /* 1998-09-30: Ole Husby */
|
---|
5 | /* ------------------------------------------------------------------- */
|
---|
6 |
|
---|
7 | #include <stdio.h>
|
---|
8 | #include <string.h>
|
---|
9 | #include "d2m.h"
|
---|
10 |
|
---|
11 |
|
---|
12 |
|
---|
13 | int norMARC(struct metatag *mt, struct marcrec *mr)
|
---|
14 | {
|
---|
15 | char pre[64], creator_tag[4], title_tag[4];
|
---|
16 |
|
---|
17 | *pre = 0;
|
---|
18 |
|
---|
19 | if (strcasecmp(mt->name, "title") == 0)
|
---|
20 | {
|
---|
21 | if ( (!*mt->type)
|
---|
22 | | (strcasecmp(mt->type, "main") == 0)
|
---|
23 | | (strcasecmp(mt->type, "long") == 0) )
|
---|
24 | {
|
---|
25 | if (mr->ntitles)
|
---|
26 | strcpy(title_tag, "246");
|
---|
27 | else
|
---|
28 | strcpy(title_tag, "245");
|
---|
29 |
|
---|
30 | mr->ntitles++;
|
---|
31 |
|
---|
32 | sprintf(pre, "%s $a", title_tag);
|
---|
33 | }
|
---|
34 | else if (strcasecmp(mt->type, "subtitle") == 0)
|
---|
35 | {
|
---|
36 | if (mr->ntitles < 2)
|
---|
37 | strcpy(mr->subtitle, mt->value);
|
---|
38 | }
|
---|
39 | }
|
---|
40 |
|
---|
41 | else if (strcasecmp(mt->name, "creator") == 0)
|
---|
42 | {
|
---|
43 | if ( (!*mt->type) || (strcasecmp(mt->type, "name") == 0)
|
---|
44 | || (strcasecmp(mt->type, "personalname") == 0) )
|
---|
45 | {
|
---|
46 | if (mr->ncreators)
|
---|
47 | strcpy(creator_tag, "700");
|
---|
48 | else
|
---|
49 | strcpy(creator_tag, "100");
|
---|
50 |
|
---|
51 | mr->ncreators++;
|
---|
52 |
|
---|
53 | sprintf(pre, "%s $a", creator_tag);
|
---|
54 | }
|
---|
55 |
|
---|
56 | else if (strcasecmp(mt->type, "corporatename") == 0)
|
---|
57 | {
|
---|
58 | if (mr->ncreators)
|
---|
59 | strcpy(creator_tag, "710");
|
---|
60 | else
|
---|
61 | strcpy(creator_tag, "110");
|
---|
62 |
|
---|
63 | mr->ncreators++;
|
---|
64 |
|
---|
65 | sprintf(pre, "%s $a", creator_tag);
|
---|
66 | }
|
---|
67 | }
|
---|
68 |
|
---|
69 | else if (strcasecmp(mt->name, "publisher") == 0)
|
---|
70 | {
|
---|
71 | if (!*mt->type)
|
---|
72 | strcpy(pre, "260 $b");
|
---|
73 | else if (strcasecmp(mt->type, "name") == 0)
|
---|
74 | strcpy(pre, "260 $b");
|
---|
75 | }
|
---|
76 |
|
---|
77 | else if (strcasecmp(mt->name, "contributor") == 0)
|
---|
78 | {
|
---|
79 | if ( (!*mt->type)|| (strcasecmp(mt->type, "name") == 0)
|
---|
80 | || (strcasecmp(mt->type, "personalname") == 0) )
|
---|
81 | strcpy(pre, "700 $a");
|
---|
82 | else if (strcasecmp(mt->type, "corporatename") == 0)
|
---|
83 | strcpy(pre, "710 $a");
|
---|
84 | }
|
---|
85 |
|
---|
86 | else if (strcasecmp(mt->name, "coverage") == 0)
|
---|
87 | {
|
---|
88 | if (!*mt->scheme)
|
---|
89 | strcpy(pre, "500 $a");
|
---|
90 | else if (strcasecmp(mt->scheme, "freetext") == 0)
|
---|
91 | strcpy(pre, "500 $a");
|
---|
92 | }
|
---|
93 |
|
---|
94 | else if (strcasecmp(mt->name, "source") == 0)
|
---|
95 | {
|
---|
96 | if (!*mt->scheme)
|
---|
97 | strcpy(pre, "500 $a Kilde:");
|
---|
98 | else if (strcasecmp(mt->scheme, "freetext") == 0)
|
---|
99 | strcpy(pre, "500 $a Kilde:");
|
---|
100 | else if (strcasecmp(mt->scheme, "url") == 0)
|
---|
101 | strcpy(pre, "500 $a Kilde: URL:");
|
---|
102 | else if (strcasecmp(mt->scheme, "urn") == 0)
|
---|
103 | strcpy(pre, "500 $a Kilde: URN:");
|
---|
104 | else if (strcasecmp(mt->scheme, "isbn") == 0)
|
---|
105 | strcpy(pre, "500 $a Kilde: ISBN:");
|
---|
106 | else if (strcasecmp(mt->scheme, "issn") == 0)
|
---|
107 | strcpy(pre, "500 $a Kilde: ISSN:");
|
---|
108 | }
|
---|
109 |
|
---|
110 | else if (strcasecmp(mt->name, "rights") == 0)
|
---|
111 | {
|
---|
112 | if (!*mt->scheme)
|
---|
113 | strcpy(pre, "500 $a Copyright:");
|
---|
114 | else if (strcasecmp(mt->scheme, "freetext") == 0)
|
---|
115 | strcpy(pre, "500 $a Copyright:");
|
---|
116 | }
|
---|
117 |
|
---|
118 | else if (strcasecmp(mt->name, "identifier") == 0)
|
---|
119 | {
|
---|
120 | if (!*mt->scheme)
|
---|
121 | strcpy(mr->url, mt->value);
|
---|
122 | else if (strcasecmp(mt->scheme, "url") == 0)
|
---|
123 | strcpy(mr->url, mt->value);
|
---|
124 | else if (strcasecmp(mt->scheme, "urn") == 0)
|
---|
125 | strcpy(pre, "856 $u urn:");
|
---|
126 | else if (strcasecmp(mt->scheme, "isbn") == 0)
|
---|
127 | strcpy(pre, "020 $a");
|
---|
128 | else if (strcasecmp(mt->scheme, "issn") == 0)
|
---|
129 | strcpy(pre, "022 $a");
|
---|
130 | }
|
---|
131 |
|
---|
132 | else if (strcasecmp(mt->name, "language") == 0)
|
---|
133 | {
|
---|
134 | if (strcasecmp(mt->scheme, "z39.53") == 0)
|
---|
135 | {
|
---|
136 | if (strlen(mt->value) == 3)
|
---|
137 | put008(mr->s008, mt->value, F008_LANGUAGE);
|
---|
138 | }
|
---|
139 | }
|
---|
140 |
|
---|
141 | else if (strcasecmp(mt->name, "format") == 0)
|
---|
142 | {
|
---|
143 | if (!*mt->scheme)
|
---|
144 | strcpy(mr->fmat, mt->value);
|
---|
145 | else if (strcasecmp(mt->scheme, "imt") == 0)
|
---|
146 | strcpy(mr->fmat, mt->value);
|
---|
147 | else if (strcasecmp(mt->scheme, "mime") == 0)
|
---|
148 | strcpy(mr->fmat, mt->value);
|
---|
149 | }
|
---|
150 |
|
---|
151 | else if (strcasecmp(mt->name, "subject") == 0)
|
---|
152 | {
|
---|
153 | if (!*mt->scheme)
|
---|
154 | strcpy(pre, "691 $a");
|
---|
155 | else if (strcasecmp(mt->scheme, "internal") == 0)
|
---|
156 | strcpy(pre, "691 $a");
|
---|
157 | else if (strcasecmp(mt->scheme, "udc") == 0)
|
---|
158 | strcpy(pre, "080 $a");
|
---|
159 | else if (strcasecmp(mt->scheme, "lcsh") == 0)
|
---|
160 | strcpy(pre, "650 $a");
|
---|
161 | else if (strcasecmp(mt->scheme, "ddc") == 0)
|
---|
162 | strcpy(pre, "082 $a");
|
---|
163 | else if (strcasecmp(mt->scheme, "mesh") == 0)
|
---|
164 | strcpy(pre, "660 $a");
|
---|
165 | else if (strcasecmp(mt->scheme, "humord") == 0)
|
---|
166 | strcpy(pre, "698 $a");
|
---|
167 | else if (strcasecmp(mt->scheme, "ntub") == 0)
|
---|
168 | strcpy(pre, "699 $a");
|
---|
169 | }
|
---|
170 |
|
---|
171 | else if (strcasecmp(mt->name, "date") == 0)
|
---|
172 | {
|
---|
173 | if ( (strncasecmp(mt->scheme, "ans", 3) == 0) ||
|
---|
174 | (strncasecmp(mt->scheme, "iso", 3) == 0) )
|
---|
175 | {
|
---|
176 | if ( (!*mt->type) || ( strcasecmp(mt->type, "current") == 0) )
|
---|
177 | {
|
---|
178 | if (find_year(mt->value))
|
---|
179 | {
|
---|
180 | strcpy(mr->year, mt->value);
|
---|
181 | put008(mr->s008, mt->value, F008_DATE1);
|
---|
182 | }
|
---|
183 | }
|
---|
184 | }
|
---|
185 | }
|
---|
186 |
|
---|
187 | if (*pre)
|
---|
188 | {
|
---|
189 | strcat(mr->marcline, pre);
|
---|
190 | strcat(mr->marcline, " ");
|
---|
191 | strcat(mr->marcline, mt->value);
|
---|
192 | strcat(mr->marcline, "\n");
|
---|
193 | }
|
---|
194 | }
|
---|