Index: trunk/src_plugins/io_lihata/io_lihata.c =================================================================== --- trunk/src_plugins/io_lihata/io_lihata.c (revision 32898) +++ trunk/src_plugins/io_lihata/io_lihata.c (revision 32899) @@ -95,6 +95,7 @@ plug_io_lihata_v7.parse_footprint = io_lihata_parse_subc; plug_io_lihata_v7.parse_font = io_lihata_parse_font; plug_io_lihata_v7.parse_buffer = io_lihata_parse_buffer; + plug_io_lihata_v7.parse_padstack = io_lihata_parse_padstack; plug_io_lihata_v7.write_font = io_lihata_write_font; plug_io_lihata_v7.write_buffer = io_lihata_write_buffer; plug_io_lihata_v7.write_padstack = io_lihata_write_padstack; Index: trunk/src_plugins/io_lihata/read.c =================================================================== --- trunk/src_plugins/io_lihata/read.c (revision 32898) +++ trunk/src_plugins/io_lihata/read.c (revision 32899) @@ -2006,8 +2006,10 @@ dst->in_use = 1; if (subc_parent != NULL) dst->parent = subc_parent; + else if (pcb != NULL) + dst->parent = pcb->Data; else - dst->parent = pcb->Data; + dst->parent = NULL; /* read shapes */ nshape = lht_dom_hash_get(nproto, "shape"); @@ -2680,7 +2682,46 @@ return res; } +int io_lihata_parse_padstack(pcb_plug_io_t *ctx, pcb_pstk_proto_t *proto, const char *filename) +{ + int res; + char *errmsg = NULL, *realfn; + lht_doc_t *doc = NULL; + lht_read_t rctx = {0}; + rctx.cfg_dest = RND_CFR_invalid; + + realfn = rnd_fopen_check(NULL, filename, "r"); + if (realfn != NULL) + doc = lht_dom_load(realfn, &errmsg); + free(realfn); + + if (doc == NULL) { + rnd_message(RND_MSG_ERROR, "Error loading '%s': %s\n", filename, errmsg); + free(errmsg); + return -1; + } + + if ((doc->root->type == LHT_HASH) && (strncmp(doc->root->name, "pcb-rnd-padstack-v", 18) == 0)) { + lht_node_t *datand = lht_dom_hash_get(doc->root, "ps_proto_v6.0"); + if (datand == NULL) { + iolht_error(doc->root, "Error loading '%s': padstack has no ps_proto_v6\n", filename); + res = -1; + } + else + res = parse_data_pstk_proto(&rctx, NULL, proto, datand, NULL, 6); + } + else { + iolht_error(doc->root, "Error loading '%s': not a pcb-rnd paste buffer\n", filename); + res = -1; + } + + lht_dom_uninit(doc); + free(errmsg); + return res; +} + + typedef enum { TPS_UNDECIDED, TPS_GOOD, @@ -2698,6 +2739,8 @@ *state = TPS_GOOD; else if ((nt == LHT_LIST) && (strncmp(name, "pcb-rnd-subcircuit-v", 20) == 0)) *state = TPS_GOOD; + else if ((nt == LHT_HASH) && (strncmp(name, "pcb-rnd-padstack-v", 18) == 0)) + *state = TPS_GOOD; else *state = TPS_BAD; } Index: trunk/src_plugins/io_lihata/read.h =================================================================== --- trunk/src_plugins/io_lihata/read.h (revision 32898) +++ trunk/src_plugins/io_lihata/read.h (revision 32899) @@ -30,6 +30,7 @@ int io_lihata_parse_pcb(pcb_plug_io_t *ctx, pcb_board_t *Ptr, const char *Filename, rnd_conf_role_t settings_dest); int io_lihata_parse_font(pcb_plug_io_t *ctx, pcb_font_t *Ptr, const char *Filename); int io_lihata_parse_subc(pcb_plug_io_t *ctx, pcb_data_t *Ptr, const char *name, const char *subfpname); +int io_lihata_parse_padstack(pcb_plug_io_t *ctx, pcb_pstk_proto_t *proto, const char *filename); int io_lihata_parse_buffer(pcb_plug_io_t *ctx, pcb_buffer_t *buff, const char *filename); pcb_plug_fp_map_t *io_lihata_map_footprint(pcb_plug_io_t *ctx, FILE *f, const char *fn, pcb_plug_fp_map_t *head, int need_tags);