Index: trunk/src_plugins/drc_query/drc_lht.c =================================================================== --- trunk/src_plugins/drc_query/drc_lht.c (revision 31492) +++ trunk/src_plugins/drc_query/drc_lht.c (revision 31493) @@ -82,3 +82,43 @@ return res; } + +static int drc_query_lht_load_rules(rnd_hidlib_t *hl, const char *fn) +{ + FILE *f; + lht_doc_t *doc; + lht_node_t *ndefs, *nrules; + + f = rnd_fopen(hl, fn, "r"); + if (f == NULL) + return -1; + + doc = lht_dom_load_stream(f, fn, NULL); + fclose(f); + if (doc == NULL) + return -1; + + if ((doc->root->type != LHT_LIST) || (strcmp(doc->root->name, "pcb-rnd-drc-query-v1"))) + goto error; + + ndefs = doc->root->data.list.first; + if (ndefs == NULL) + goto error; + nrules = ndefs->next; + if (nrules == NULL) + goto error; + + if ((ndefs->type != LHT_LIST) || (strcmp(ndefs->name, "definitions"))) + goto error; + if ((nrules->type != LHT_LIST) || (strcmp(nrules->name, "rules"))) + goto error; + +rnd_trace("defs and rules found\n"); + + return 0; + + error:; + lht_dom_uninit(doc); + return -1; +} + Index: trunk/src_plugins/drc_query/drc_query.c =================================================================== --- trunk/src_plugins/drc_query/drc_query.c (revision 31492) +++ trunk/src_plugins/drc_query/drc_query.c (revision 31493) @@ -737,7 +737,8 @@ sep++; switch(*sep) { case 't': case 'T': ires = rnd_actionva(hl, "loadtedaxfrom", "drc_query", fn, "", "0", NULL); break; - case 'l': case 'L': rnd_message(RND_MSG_ERROR, "Can not load in format '%s'\n", sep); ires = -1; break; + case 'l': case 'L': ires = drc_query_lht_load_rules(hl, fn); break; + default: rnd_message(RND_MSG_ERROR, "Can not load in format '%s'\n", sep); ires = -1; break; } }