Index: trunk/src_plugins/import_mentor_sch/mentor_sch.c =================================================================== --- trunk/src_plugins/import_mentor_sch/mentor_sch.c (revision 7417) +++ trunk/src_plugins/import_mentor_sch/mentor_sch.c (revision 7418) @@ -94,8 +94,10 @@ { gsxl_node_t *n, *p; const char *netname = get_by_name(net, "rename", 1); + nethlp_net_ctx_t nctx; - printf("net %s\n", netname); + nethlp_net_new(nhctx, &nctx, netname); + for(n = net->children; n != NULL; n = n->next) { if (strcmp(n->str, "joined") == 0) { for(p = n->children; p != NULL; p = p->next) { @@ -103,12 +105,15 @@ const char *part, *pin; pin = p->children->str; part = get_by_name(p, "instanceRef", 0); - if ((part != NULL) && (pin != NULL)) - printf(" %s %s\n", part, pin); + if ((part != NULL) && (pin != NULL)) { + nethlp_net_add_term(&nctx, part, pin); + } } } } } + + nethlp_net_destroy(&nctx); return 0; } Index: trunk/src_plugins/import_mentor_sch/netlist_helper.c =================================================================== --- trunk/src_plugins/import_mentor_sch/netlist_helper.c (revision 7417) +++ trunk/src_plugins/import_mentor_sch/netlist_helper.c (revision 7418) @@ -25,6 +25,7 @@ #include "config.h" #include +#include #include #include "netlist_helper.h" @@ -84,7 +85,7 @@ { htsp_entry_t *e; - printf("Elem '%s' -> '%s'\n", ectx->id, htsp_get(&ectx->nhctx->id2refdes, ectx->id)); + printf("Elem '%s' -> '%s'\n", ectx->id, (char *)htsp_get(&ectx->nhctx->id2refdes, ectx->id)); for (e = htsp_first(&ectx->attr); e; e = htsp_next(&ectx->attr, e)) { free(e->key); @@ -97,3 +98,29 @@ } +nethlp_net_ctx_t *nethlp_net_new(nethlp_ctx_t *nhctx, nethlp_net_ctx_t *prealloc, const char *netname) +{ + if (prealloc == NULL) { + prealloc = malloc(sizeof(nethlp_net_ctx_t)); + prealloc->alloced = 1; + } + else + prealloc->alloced = 0; + prealloc->nhctx = nhctx; + + prealloc->netname = pcb_strdup(netname); + return prealloc; +} + +void nethlp_net_add_term(nethlp_net_ctx_t *nctx, const char *part, const char *pin) +{ + +} + +void nethlp_net_destroy(nethlp_net_ctx_t *nctx) +{ + free(nctx->netname); + if (nctx->alloced) + free(nctx); +} + Index: trunk/src_plugins/import_mentor_sch/netlist_helper.h =================================================================== --- trunk/src_plugins/import_mentor_sch/netlist_helper.h (revision 7417) +++ trunk/src_plugins/import_mentor_sch/netlist_helper.h (revision 7418) @@ -12,7 +12,13 @@ int alloced; } nethlp_elem_ctx_t; +typedef struct { + char *netname; + nethlp_ctx_t *nhctx; + int alloced; +} nethlp_net_ctx_t; + nethlp_ctx_t *nethlp_new(nethlp_ctx_t *prealloc); void nethlp_destroy(nethlp_ctx_t *nhctx); @@ -21,3 +27,7 @@ void nethlp_elem_attr(nethlp_elem_ctx_t *ectx, const char *key, const char *val); void nethlp_elem_done(nethlp_elem_ctx_t *ectx); + +nethlp_net_ctx_t *nethlp_net_new(nethlp_ctx_t *nhctx, nethlp_net_ctx_t *prealloc, const char *netname); +void nethlp_net_add_term(nethlp_net_ctx_t *nctx, const char *part, const char *pin); +void nethlp_net_destroy(nethlp_net_ctx_t *nctx);