diff --git a/sch2fig/TODO b/sch2fig/TODO index 0252892..2b04da3 100644 --- a/sch2fig/TODO +++ b/sch2fig/TODO @@ -1,5 +1,4 @@ - better text size guessing -- busses and entries - recursing into sheets - unify alignment, direction - support fonts attributes ? diff --git a/sch2fig/fig.c b/sch2fig/fig.c index 8846fb1..6a6f528 100644 --- a/sch2fig/fig.c +++ b/sch2fig/fig.c @@ -62,6 +62,17 @@ void fig_wire(int sx, int sy, int ex, int ey) } +void fig_bus(int sx, int sy, int ex, int ey) +{ + // TypeStyle FillCol AreaFil Cap FwdAr + // SubTy Color Pen StyleV Rad BwdAr + // Thick Depth Join Points + printf("2 1 0 %d %d 7 %d -1 -1 0.0 1 1 -1 0 0 2\n", + WIDTH_BUS, COLOR_BUS, LAYER_BUSSES); + printf("\t%d %d %d %d\n", cx(sx), cy(sy), cx(ex), cy(ey)); +} + + void fig_line(int sx, int sy, int ex, int ey) { // TypeStyle FillCol AreaFil Cap FwdAr diff --git a/sch2fig/fig.h b/sch2fig/fig.h index 398e861..cb16b2b 100644 --- a/sch2fig/fig.h +++ b/sch2fig/fig.h @@ -29,6 +29,7 @@ enum fig_shape { /* schematics */ void fig_wire(int sx, int sy, int ex, int ey); +void fig_bus(int sx, int sy, int ex, int ey); void fig_line(int sx, int sy, int ex, int ey); /* general */ diff --git a/sch2fig/sch.c b/sch2fig/sch.c index de14261..fad5b51 100644 --- a/sch2fig/sch.c +++ b/sch2fig/sch.c @@ -450,18 +450,6 @@ bool sch_parse(struct sch_ctx *ctx, const char *line) ctx->text = dwg_label; return 1; } - if (sscanf(line, "Entry Wire Line%n", &n) == 0 && n) { - ctx->state = sch_text; - unsupported("Entry Wire Line"); - ctx->text = NULL; - return 1; - } - if (sscanf(line, "Entry Bus Bus%n", &n) == 0 && n) { - ctx->state = sch_text; - unsupported("Entry Bus Bus"); - ctx->text = NULL; - return 1; - } /* Connection */ @@ -486,8 +474,7 @@ bool sch_parse(struct sch_ctx *ctx, const char *line) } if (sscanf(line, "Wire Bus Line%n", &n) == 0 && n) { ctx->state = sch_wire; - unsupported("Wire Bus Line"); - ctx->wire = NULL; + ctx->wire = fig_bus; return 1; } if (sscanf(line, "Wire Notes Line%n", &n) == 0 && n) { @@ -495,16 +482,27 @@ bool sch_parse(struct sch_ctx *ctx, const char *line) ctx->wire = fig_line; return 1; } - if (sscanf(line, "Wire Wire Bus%n", &n) == 0 && n) { + + /* Entry */ + + /* + * Documentation mentions the following additional variants: + * + * - Entry Wire Line equivalent: + * Wire Wire Bus + * Entry Wire Bus + * + * - Entry Bus Bus equivalent: + * Wire Bus Bus + */ + if (sscanf(line, "Entry Wire Line%n", &n) == 0 && n) { ctx->state = sch_wire; - unsupported("Wire Wire Bus"); - ctx->wire = NULL; + ctx->wire = fig_wire; return 1; } - if (sscanf(line, "Wire Bus Bus%n", &n) == 0 && n) { + if (sscanf(line, "Entry Bus Bus%n", &n) == 0 && n) { ctx->state = sch_wire; - unsupported("Wire Bus Bus"); - ctx->wire = NULL; + ctx->wire = fig_bus; return 1; } diff --git a/sch2fig/style.h b/sch2fig/style.h index 6d4d081..89a97df 100644 --- a/sch2fig/style.h +++ b/sch2fig/style.h @@ -30,6 +30,7 @@ #define COLOR_SHEET_DWG COLOR_BLUE #define COLOR_TEXT COLOR_BLUE #define COLOR_WIRE COLOR_GREEN4 +#define COLOR_BUS COLOR_BLUE #define COLOR_NOCONN COLOR_BLUE #define COLOR_GLABEL COLOR_RED4 #define COLOR_HLABEL COLOR_BROWN2 /* @@@ */ @@ -49,6 +50,7 @@ #define LAYER_TEXT 30 #define LAYER_NOCONN 40 #define LAYER_WIRES 50 +#define LAYER_BUSSES LAYER_WIRES #define LAYER_FIELD 60 #define LAYER_PIN_NAME LAYER_FIELD #define LAYER_PIN_NUMBER LAYER_FIELD @@ -59,6 +61,7 @@ #define LAYER_COMP_DWG_BG 200 #define WIDTH_WIRE 2 +#define WIDTH_BUS WIDTH_WIRE #define WIDTH_LINE 2 #define WIDTH_COMP_DWG 2