1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-23 05:48:06 +02:00

sch2fig/: support busses and entries

This commit is contained in:
Werner Almesberger 2016-07-30 21:07:07 -03:00
parent 97a1d46659
commit 402e14d78f
5 changed files with 33 additions and 21 deletions

View File

@ -1,5 +1,4 @@
- better text size guessing
- busses and entries
- recursing into sheets
- unify alignment, direction
- support fonts attributes ?

View File

@ -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

View File

@ -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 */

View File

@ -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;
}

View File

@ -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