Lines Matching refs:mt

66 	struct mystate *mt;
71 mt = userData;
72 mt->level++;
73 mt->sbuf[mt->level] = sbuf_new_auto();
79 mt->nident++;
84 mt->level + 1, mt->level + 1, "",
87 if (!strcmp(name, "class") && mt->class == NULL) {
88 mt->class = calloc(1, sizeof *mt->class);
89 if (mt->class == NULL) {
90 mt->error = errno;
91 XML_StopParser(mt->parser, 0);
96 mt->class->lg_id = id;
97 LIST_INSERT_HEAD(&mt->mesh->lg_class, mt->class, lg_class);
98 LIST_INIT(&mt->class->lg_geom);
99 LIST_INIT(&mt->class->lg_config);
102 if (!strcmp(name, "geom") && mt->geom == NULL) {
103 mt->geom = calloc(1, sizeof *mt->geom);
104 if (mt->geom == NULL) {
105 mt->error = errno;
106 XML_StopParser(mt->parser, 0);
111 mt->geom->lg_id = id;
112 LIST_INSERT_HEAD(&mt->class->lg_geom, mt->geom, lg_geom);
113 LIST_INIT(&mt->geom->lg_provider);
114 LIST_INIT(&mt->geom->lg_consumer);
115 LIST_INIT(&mt->geom->lg_config);
118 if (!strcmp(name, "class") && mt->geom != NULL) {
119 mt->geom->lg_class = ref;
122 if (!strcmp(name, "consumer") && mt->consumer == NULL) {
123 mt->consumer = calloc(1, sizeof *mt->consumer);
124 if (mt->consumer == NULL) {
125 mt->error = errno;
126 XML_StopParser(mt->parser, 0);
131 mt->consumer->lg_id = id;
132 LIST_INSERT_HEAD(&mt->geom->lg_consumer, mt->consumer,
134 LIST_INIT(&mt->consumer->lg_config);
137 if (!strcmp(name, "geom") && mt->consumer != NULL) {
138 mt->consumer->lg_geom = ref;
141 if (!strcmp(name, "provider") && mt->consumer != NULL) {
142 mt->consumer->lg_provider = ref;
145 if (!strcmp(name, "provider") && mt->provider == NULL) {
146 mt->provider = calloc(1, sizeof *mt->provider);
147 if (mt->provider == NULL) {
148 mt->error = errno;
149 XML_StopParser(mt->parser, 0);
154 mt->provider->lg_id = id;
155 LIST_INSERT_HEAD(&mt->geom->lg_provider, mt->provider,
157 LIST_INIT(&mt->provider->lg_consumers);
158 LIST_INIT(&mt->provider->lg_config);
161 if (!strcmp(name, "geom") && mt->provider != NULL) {
162 mt->provider->lg_geom = ref;
166 if (mt->provider != NULL) {
167 mt->config = &mt->provider->lg_config;
170 if (mt->consumer != NULL) {
171 mt->config = &mt->consumer->lg_config;
174 if (mt->geom != NULL) {
175 mt->config = &mt->geom->lg_config;
178 if (mt->class != NULL) {
179 mt->config = &mt->class->lg_config;
188 struct mystate *mt;
193 mt = userData;
195 if (sbuf_finish(mt->sbuf[mt->level]) == 0)
196 p = strdup(sbuf_data(mt->sbuf[mt->level]));
197 sbuf_delete(mt->sbuf[mt->level]);
198 mt->sbuf[mt->level] = NULL;
199 mt->level--;
201 mt->error = errno;
202 XML_StopParser(mt->parser, 0);
213 if (mt->provider != NULL) {
214 mt->provider->lg_name = p;
216 } else if (mt->geom != NULL) {
217 mt->geom->lg_name = p;
219 } else if (mt->class != NULL) {
220 mt->class->lg_name = p;
224 if (!strcmp(name, "rank") && mt->geom != NULL) {
225 mt->geom->lg_rank = strtoul(p, NULL, 0);
229 if (!strcmp(name, "mode") && mt->provider != NULL) {
230 mt->provider->lg_mode = p;
233 if (!strcmp(name, "mode") && mt->consumer != NULL) {
234 mt->consumer->lg_mode = p;
237 if (!strcmp(name, "mediasize") && mt->provider != NULL) {
238 mt->provider->lg_mediasize = strtoumax(p, NULL, 0);
242 if (!strcmp(name, "sectorsize") && mt->provider != NULL) {
243 mt->provider->lg_sectorsize = strtoul(p, NULL, 0);
247 if (!strcmp(name, "stripesize") && mt->provider != NULL) {
248 mt->provider->lg_stripesize = strtoumax(p, NULL, 0);
252 if (!strcmp(name, "stripeoffset") && mt->provider != NULL) {
253 mt->provider->lg_stripeoffset = strtoumax(p, NULL, 0);
259 mt->config = NULL;
264 if (mt->config != NULL || (!strcmp(name, "wither") &&
265 (mt->provider != NULL || mt->geom != NULL))) {
266 if (mt->config != NULL)
267 c = mt->config;
268 else if (mt->provider != NULL)
269 c = &mt->provider->lg_config;
271 c = &mt->geom->lg_config;
274 mt->error = errno;
275 XML_StopParser(mt->parser, 0);
283 mt->error = errno;
284 XML_StopParser(mt->parser, 0);
303 if (!strcmp(name, "consumer") && mt->consumer != NULL) {
304 mt->consumer = NULL;
307 if (!strcmp(name, "provider") && mt->provider != NULL) {
308 mt->provider = NULL;
311 if (!strcmp(name, "geom") && mt->consumer != NULL) {
314 if (!strcmp(name, "geom") && mt->provider != NULL) {
317 if (!strcmp(name, "geom") && mt->geom != NULL) {
318 mt->geom = NULL;
321 if (!strcmp(name, "class") && mt->geom != NULL) {
324 if (!strcmp(name, "class") && mt->class != NULL) {
325 mt->class = NULL;
333 struct mystate *mt;
336 mt = userData;
345 sbuf_bcat(mt->sbuf[mt->level], b, e - b + 1);
363 struct mystate *mt;
375 mt = calloc(1, sizeof *mt);
376 if (mt == NULL) {
380 mt->mesh = gmp;
381 mt->parser = parser;
383 XML_SetUserData(parser, mt);
387 if (mt->error != 0)
388 error = mt->error;
395 free(mt);
398 gmp->lg_ident = calloc(sizeof *gmp->lg_ident, mt->nident + 1);
399 free(mt);