view pads2gpcb/fpmanip.c @ 154:2328205328a9 default tip

m4-fp: WR-FPC 1mm pitch FFC/FPC connectors
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 25 Oct 2022 07:36:09 +0000
parents a9a20c85140e
children
line wrap: on
line source

#include <stdio.h>
#include <stdlib.h>
#include "struct.h"

static void
do_footprint_pad(obj, func)
	struct footprint_pad *obj;
	void (*func)();
{
	func(&obj->end1);
	func(&obj->end2);
}

static void
do_element_line(obj, func)
	struct element_line *obj;
	void (*func)();
{
	func(&obj->end1);
	func(&obj->end2);
}

static void
do_element_arc(obj, func)
	struct element_arc *obj;
	void (*func)();
{
	func(&obj->centre);
}

manipulate_footprint_coord_pairs(fpbody, func)
	struct footprint_body *fpbody;
	void (*func)();
{
	int i;

	for (i = 0; i < fpbody->npins; i++)
		do_footprint_pad(fpbody->pins + i, func);
	for (i = 0; i < fpbody->num_silk_lines; i++)
		do_element_line(fpbody->silk_lines + i, func);
	for (i = 0; i < fpbody->num_silk_arcs; i++)
		do_element_arc(fpbody->silk_arcs + i, func);
}

coordpair_mirror_x(cp)
	struct coord_pair *cp;
{
	cp->x = -cp->x;
}

coordpair_rot_90(cp)
	struct coord_pair *cp;
{
	long newx, newy;

	newx = -cp->y;
	newy = cp->x;
	cp->x = newx;
	cp->y = newy;
}

coordpair_rot_180(cp)
	struct coord_pair *cp;
{
	cp->x = -cp->x;
	cp->y = -cp->y;
}

coordpair_rot_270(cp)
	struct coord_pair *cp;
{
	long newx, newy;

	newx = cp->y;
	newy = -cp->x;
	cp->x = newx;
	cp->y = newy;
}