1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-23 08:57:10 +02:00

sch2fig/sch.c (dump_fields): break into two functions; make more "const"

"const" may come in handy at a later stage, when we want to keep things
around for a bit longer.
This commit is contained in:
Werner Almesberger 2016-07-25 14:43:59 -03:00
parent 1e36f32c0f
commit ed02cafaf5

View File

@ -150,45 +150,49 @@ static bool parse_field(struct sch_ctx *ctx, const char *line)
} }
static void dump_field(const struct sch_field *field, int m[6])
{
struct text txt = field->txt;
int dx, dy;
dx = txt.x - m[0];
dy = txt.y - m[3];
txt.x = mx(dx, dy, m);
txt.y = my(dx, dy, m);
text_rot(&txt, matrix_to_angle(m));
switch (txt.rot) {
case 180:
text_rot(&txt, 180);
txt.hor = text_flip(txt.hor);
txt.vert = text_flip(txt.vert);
break;
case 270:
text_rot(&txt, 180);
txt.vert = text_flip(txt.vert);
txt.hor = text_flip(txt.hor);
break;
default:
break;
}
text_fig(&txt, COLOR_FIELD, LAYER_FIELD);
}
static void dump_fields(struct sch_field *fields, int m[6]) static void dump_fields(struct sch_field *fields, int m[6])
{ {
while (fields) { while (fields) {
struct text *txt = &fields->txt; struct text *txt = &fields->txt;
struct sch_field *next; struct sch_field *next = fields->next;
int dx, dy;
next = fields->next; dump_field(fields, m);
dx = txt->x - m[0];
dy = txt->y - m[3];
txt->x = mx(dx, dy, m);
txt->y = my(dx, dy, m);
text_rot(txt, matrix_to_angle(m));
switch (txt->rot) {
case 180:
text_rot(txt, 180);
txt->hor = text_flip(txt->hor);
txt->vert = text_flip(txt->vert);
break;
case 270:
text_rot(txt, 180);
txt->vert = text_flip(txt->vert);
txt->hor = text_flip(txt->hor);
break;
default:
break;
}
text_fig(txt, COLOR_FIELD, LAYER_FIELD);
text_free(txt); text_free(txt);
free(fields); free(fields);
fields = next; fields = next;
} }
} }