Lines Matching defs:node
153 static int trytop (struct rnndb *db, char *file, xmlNode *node);
155 static int trydoc (struct rnndb *db, char *file, xmlNode *node) {
156 if (!strcmp(node->name, "brief")) {
158 } else if (!strcmp(node->name, "doc")) {
164 static struct rnnvalue *parsevalue(struct rnndb *db, char *file, xmlNode *node);
165 static struct rnnbitfield *parsebitfield(struct rnndb *db, char *file, xmlNode *node);
167 static int trytypetag (struct rnndb *db, char *file, xmlNode *node, struct rnntypeinfo *ti) {
168 if (!strcmp(node->name, "value")) {
169 struct rnnvalue *val = parsevalue(db, file, node);
173 } else if (!strcmp(node->name, "bitfield")) {
174 struct rnnbitfield *bf = parsebitfield(db, file, node);
181 static int trytypeattr (struct rnndb *db, char *file, xmlNode *node, xmlAttr *attr, struct rnntypeinfo *ti) {
183 ti->shr = getnumattrib(db, file, node->line, attr);
186 ti->min = getnumattrib(db, file, node->line, attr);
190 ti->max = getnumattrib(db, file, node->line, attr);
194 ti->align = getnumattrib(db, file, node->line, attr);
198 ti->name = strdup(getattrib(db, file, node->line, attr));;
201 ti->radix = getnumattrib(db, file, node->line, attr);
205 ti->high = ti->low = getnumattrib(db, file, node->line, attr);
208 ti->low = getnumattrib(db, file, node->line, attr);
211 ti->high = getnumattrib(db, file, node->line, attr);
214 ti->addvariant = getboolattrib(db, file, node->line, attr);
220 static struct rnnvalue *parsevalue(struct rnndb *db, char *file, xmlNode *node) {
223 xmlAttr *attr = node->properties;
226 val->name = strdup(getattrib(db, file, node->line, attr));
228 val->value = getnumattrib(db, file, node->line, attr);
231 val->varinfo.varsetstr = strdup(getattrib(db, file, node->line, attr));
233 val->varinfo.variantsstr = strdup(getattrib(db, file, node->line, attr));
235 rnn_err(db, "%s:%d: wrong attribute \"%s\" for value\n", file, node->line, attr->name);
239 xmlNode *chain = node->children;
243 rnn_err(db, "%s:%d: wrong tag in %s: <%s>\n", file, chain->line, node->name, chain->name);
248 rnn_err(db, "%s:%d: nameless value\n", file, node->line);
255 static void parsespectype(struct rnndb *db, char *file, xmlNode *node) {
258 xmlAttr *attr = node->properties;
262 res->name = strdup(getattrib(db, file, node->line, attr));
263 } else if (!trytypeattr(db, file, node, attr, &res->typeinfo)) {
264 rnn_err(db, "%s:%d: wrong attribute \"%s\" for spectype\n", file, node->line, attr->name);
269 rnn_err(db, "%s:%d: nameless spectype\n", file, node->line);
274 rnn_err(db, "%s:%d: duplicated spectype name %s\n", file, node->line, res->name);
278 xmlNode *chain = node->children;
288 static void parseenum(struct rnndb *db, char *file, xmlNode *node) {
289 xmlAttr *attr = node->properties;
299 name = getattrib(db, file, node->line, attr);
301 bare = getboolattrib(db, file, node->line, attr);
303 isinline = getboolattrib(db, file, node->line, attr);
305 prefixstr = strdup(getattrib(db, file, node->line, attr));
307 varsetstr = strdup(getattrib(db, file, node->line, attr));
309 variantsstr = strdup(getattrib(db, file, node->line, attr));
311 rnn_err(db, "%s:%d: wrong attribute \"%s\" for enum\n", file, node->line, attr->name);
316 rnn_err(db, "%s:%d: nameless enum\n", file, node->line);
330 rnn_err(db, "%s:%d: merge fail for enum %s\n", file, node->line, node->name);
343 xmlNode *chain = node->children;
357 static struct rnnbitfield *parsebitfield(struct rnndb *db, char *file, xmlNode *node) {
360 xmlAttr *attr = node->properties;
364 bf->name = strdup(getattrib(db, file, node->line, attr));
366 bf->varinfo.varsetstr = strdup(getattrib(db, file, node->line, attr));
368 bf->varinfo.variantsstr = strdup(getattrib(db, file, node->line, attr));
369 } else if (!trytypeattr(db, file, node, attr, &bf->typeinfo)) {
370 rnn_err(db, "%s:%d: wrong attribute \"%s\" for bitfield\n", file, node->line, attr->name);
374 xmlNode *chain = node->children;
378 rnn_err(db, "%s:%d: wrong tag in %s: <%s>\n", file, chain->line, node->name, chain->name);
383 rnn_err(db, "%s:%d: nameless bitfield\n", file, node->line);
386 rnn_err(db, "%s:%d: bitfield has wrong placement\n", file, node->line);
393 static void parsebitset(struct rnndb *db, char *file, xmlNode *node) {
394 xmlAttr *attr = node->properties;
404 name = getattrib(db, file, node->line, attr);
406 bare = getboolattrib(db, file, node->line, attr);
408 isinline = getboolattrib(db, file, node->line, attr);
410 prefixstr = strdup(getattrib(db, file, node->line, attr));
412 varsetstr = strdup(getattrib(db, file, node->line, attr));
414 variantsstr = strdup(getattrib(db, file, node->line, attr));
416 rnn_err(db, "%s:%d: wrong attribute \"%s\" for bitset\n", file, node->line, attr->name);
421 rnn_err(db, "%s:%d: nameless bitset\n", file, node->line);
435 rnn_err(db, "%s:%d: merge fail for bitset %s\n", file, node->line, node->name);
448 xmlNode *chain = node->children;
462 static struct rnndelem *trydelem(struct rnndb *db, char *file, xmlNode *node) {
463 if (!strcmp(node->name, "use-group")) {
467 xmlAttr *attr = node->properties;
470 res->name = strdup(getattrib(db, file, node->line, attr));
472 rnn_err(db, "%s:%d: wrong attribute \"%s\" for %s\n", file, node->line, attr->name, node->name);
477 rnn_err(db, "%s:%d: nameless use-group\n", file, node->line);
481 } else if (!strcmp(node->name, "stripe") || !strcmp(node->name, "array")) {
483 if (!strcmp(node->name, "array"))
485 res->type = (strcmp(node->name, "stripe")?RNN_ETYPE_ARRAY:RNN_ETYPE_STRIPE);
488 xmlAttr *attr = node->properties;
491 res->name = strdup(getattrib(db, file, node->line, attr));
493 res->offset = getnumattrib(db, file, node->line, attr);
495 char *str = strdup(getattrib(db, file, node->line, attr));
498 uint64_t offset = getnum(db, file, node->line, attr, tok);
503 fprintf(stderr, "%s:%d: invalid offsets: %s\n", file, node->line, str);
507 res->doffset = strdup(getattrib(db, file, node->line, attr));
510 char *str = strdup(getattrib(db, file, node->line, attr));
518 fprintf(stderr, "%s:%d: invalid offsets: %s\n", file, node->line, str);
521 res->length = getnumattrib(db, file, node->line, attr);
523 res->stride = getnumattrib(db, file, node->line, attr);
525 res->varinfo.prefixstr = strdup(getattrib(db, file, node->line, attr));
527 res->varinfo.varsetstr = strdup(getattrib(db, file, node->line, attr));
529 res->varinfo.variantsstr = strdup(getattrib(db, file, node->line, attr));
531 const char *enumname = getattrib(db, file, node->line, attr);
534 rnn_err(db, "%s:%d: invalid enum name \"%s\"\n", file, node->line, enumname);
537 rnn_err(db, "%s:%d: wrong attribute \"%s\" for %s\n", file, node->line, attr->name, node->name);
541 xmlNode *chain = node->children;
548 rnn_err(db, "%s:%d: wrong tag in %s: <%s>\n", file, chain->line, node->name, chain->name);
562 if (!strcmp(node->name, "reg8"))
564 else if (!strcmp(node->name, "reg16"))
566 else if (!strcmp(node->name, "reg32"))
568 else if (!strcmp(node->name, "reg64"))
578 xmlAttr *attr = node->properties;
583 res->name = strdup(getattrib(db, file, node->line, attr));
585 res->offset = getnumattrib(db, file, node->line, attr);
587 res->length = getnumattrib(db, file, node->line, attr);
589 res->stride = getnumattrib(db, file, node->line, attr);
591 res->varinfo.varsetstr = strdup(getattrib(db, file, node->line, attr));
593 res->varinfo.variantsstr = strdup(getattrib(db, file, node->line, attr));
595 char *str = getattrib(db, file, node->line, attr);
603 fprintf (stderr, "%s:%d: wrong access type \"%s\" for register\n", file, node->line, str);
604 } else if (!trytypeattr(db, file, node, attr, &res->typeinfo)) {
605 rnn_err(db, "%s:%d: wrong attribute \"%s\" for register\n", file, node->line, attr->name);
609 xmlNode *chain = node->children;
613 rnn_err(db, "%s:%d: wrong tag in %s: <%s>\n", file, chain->line, node->name, chain->name);
618 rnn_err(db, "%s:%d: nameless register\n", file, node->line);
625 static void parsegroup(struct rnndb *db, char *file, xmlNode *node) {
626 xmlAttr *attr = node->properties;
631 name = getattrib(db, file, node->line, attr);
633 rnn_err(db, "%s:%d: wrong attribute \"%s\" for group\n", file, node->line, attr->name);
638 rnn_err(db, "%s:%d: nameless group\n", file, node->line);
652 xmlNode *chain = node->children;
665 static void parsedomain(struct rnndb *db, char *file, xmlNode *node) {
666 xmlAttr *attr = node->properties;
676 name = getattrib(db, file, node->line, attr);
678 bare = getboolattrib(db, file, node->line, attr);
680 size = getnumattrib(db, file, node->line, attr);
682 width = getnumattrib(db, file, node->line, attr);
684 prefixstr = strdup(getattrib(db, file, node->line, attr));
686 varsetstr = strdup(getattrib(db, file, node->line, attr));
688 variantsstr = strdup(getattrib(db, file, node->line, attr));
690 rnn_err(db, "%s:%d: wrong attribute \"%s\" for domain\n", file, node->line, attr->name);
695 rnn_err(db, "%s:%d: nameless domain\n", file, node->line);
711 rnn_err(db, "%s:%d: merge fail for domain %s\n", file, node->line, node->name);
728 xmlNode *chain = node->children;
741 static void parsecopyright(struct rnndb *db, char *file, xmlNode *node) {
743 xmlAttr *attr = node->properties;
746 unsigned firstyear = getnumattrib(db, file, node->line, attr);
750 rnn_err(db, "%s:%d: wrong attribute \"%s\" for copyright\n", file, node->line, attr->name);
754 xmlNode *chain = node->children;
759 if(strcmp(copyright->license, node->content)) {
810 static int trytop (struct rnndb *db, char *file, xmlNode *node) {
811 if (!strcmp(node->name, "enum")) {
812 parseenum(db, file, node);
814 } else if (!strcmp(node->name, "bitset")) {
815 parsebitset(db, file, node);
817 } else if (!strcmp(node->name, "group")) {
818 parsegroup(db, file, node);
820 } else if (!strcmp(node->name, "domain")) {
821 parsedomain(db, file, node);
823 } else if (!strcmp(node->name, "spectype")) {
824 parsespectype(db, file, node);
826 } else if (!strcmp(node->name, "import")) {
827 xmlAttr *attr = node->properties;
831 subfile = getattrib(db, file, node->line, attr);
833 rnn_err(db, "%s:%d: wrong attribute \"%s\" for import\n", file, node->line, attr->name);
838 rnn_err(db, "%s:%d: missing \"file\" attribute for import\n", file, node->line);
843 } else if (!strcmp(node->name, "copyright")) {
844 parsecopyright(db, file, node);