Index: plugins/io_eeschema/read_disp.c =================================================================== --- plugins/io_eeschema/read_disp.c (revision 11336) +++ plugins/io_eeschema/read_disp.c (revision 11337) @@ -1470,6 +1470,107 @@ return 0; } +static int eechema_parse__sht_pin(read_ctx_t* const ctx, + csch_cgrp_t* const dst, gsxl_node_t* const node) +{ + float x, y; + int rot; + + csch_cgrp_t* grp; + csch_text_t* text; + + const char* shape = node->next->str; + + const char* const stroke = "term-decor"; + + static const char* shtpin_ignore_list[] = { NULL }; + + /* fetch (at) for further processing */ + { + gsxl_node_t* n = node->next->next; + gsxl_node_t* at = NULL; + + for(;n && !at;n=n->next) + { + if(strcmp(n->str, "at")==0) + { + at = n; + } + } + + if(!at) + { + eechema_error(ctx, node->parent, + "missing 'at' node from 'pin' object"); + return -1; + } + + if(eechema_parse_at(ctx, at->children, &x, &y, &rot)!=0) + { + return -1; + } + } + + grp = csch_cgrp_alloc(ctx->sheet, &ctx->sheet->direct, + csch_oid_new(ctx->sheet, &ctx->sheet->direct)); + + { + csch_source_arg_t* src; + + src = make_src_attrib(ctx, node->parent); + csch_attrib_set(&grp->attr, CSCH_ATP_USER_DEFAULT, "role", + "symbol", src, NULL); + csch_attr_side_effects(grp, "role"); + + src = make_src_attrib(ctx, node); + csch_attrib_set(&grp->attr, CSCH_ATP_USER_DEFAULT, "name", + node->str, src, NULL); + } + + text = eechema_parse_text__impl(ctx, grp, node->next->next, "pin", + node->str, stroke, shtpin_ignore_list); + + if(!text) + { + return -1; + } + + /* swap input/output shapes */ + if(strcmp(shape, "input")==0) + { + shape = "output"; + } + else + if(strcmp(shape, "output")==0) + { + shape = "input"; + } + + /* rotation: ouch */ + if(0!=eeschema_render_hierarchical_decor(ctx, grp, node, text, shape, + x, y, (rot+180)%360, stroke)) + { + return -1; + } + + text->dyntext = 1; + free(text->text); + text->text = rnd_strdup("%../A.name%"); + csch_text_dyntext_render(text); + + { + csch_source_arg_t* const src = make_src_attrib(ctx, node); + + if(!csch_alien_mkpin_line(&ctx->alien, src, grp, x, y, x, y)) + { + eechema_error(ctx, node->parent, "could not create pin line"); + return -1; + } + } + + return 0; +} + static int eechema_parse__sch_sheet(read_ctx_t* ctx, csch_cgrp_t* dst, gsxl_node_t* node) { @@ -1560,7 +1661,10 @@ else if(strcmp(n->str, "pin")==0) { - TODO("TODO"); + if(eechema_parse__sht_pin(ctx, grp, n->children)!=0) + { + return -1; + } } } }