1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-23 12:53:09 +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_fields(struct sch_field *fields, int m[6]) static void dump_field(const struct sch_field *field, int m[6])
{ {
struct text txt = field->txt;
while (fields) {
struct text *txt = &fields->txt;
struct sch_field *next;
int dx, dy; int dx, dy;
next = fields->next; dx = txt.x - m[0];
dy = txt.y - m[3];
txt.x = mx(dx, dy, m);
txt.y = my(dx, dy, m);
dx = txt->x - m[0]; text_rot(&txt, matrix_to_angle(m));
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) {
switch (txt->rot) {
case 180: case 180:
text_rot(txt, 180); text_rot(&txt, 180);
txt->hor = text_flip(txt->hor); txt.hor = text_flip(txt.hor);
txt->vert = text_flip(txt->vert); txt.vert = text_flip(txt.vert);
break; break;
case 270: case 270:
text_rot(txt, 180); text_rot(&txt, 180);
txt->vert = text_flip(txt->vert); txt.vert = text_flip(txt.vert);
txt->hor = text_flip(txt->hor); txt.hor = text_flip(txt.hor);
break; break;
default: default:
break; break;
} }
text_fig(txt, COLOR_FIELD, LAYER_FIELD); text_fig(&txt, COLOR_FIELD, LAYER_FIELD);
}
static void dump_fields(struct sch_field *fields, int m[6])
{
while (fields) {
struct text *txt = &fields->txt;
struct sch_field *next = fields->next;
dump_field(fields, m);
text_free(txt); text_free(txt);
free(fields); free(fields);
fields = next; fields = next;
} }
} }