view ueda/libuschem/schemobj.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 cd92449fdb51
children
line wrap: on
line source

/*
 * Schematic object utility functions
 */

#include <sys/types.h>
#include <stdio.h>
#include "schemstruct.h"

schemobj_insert_after(oldobj, newobj)
	register struct schemobj *oldobj, *newobj;
{
	newobj->obj_next = oldobj->obj_next;
	newobj->obj_prev = oldobj;
	oldobj->obj_next = newobj;
	newobj->obj_next->obj_prev = newobj;
}

schemobj_insert_before(oldobj, newobj)
	register struct schemobj *oldobj, *newobj;
{
	newobj->obj_next = oldobj;
	newobj->obj_prev = oldobj->obj_prev;
	oldobj->obj_prev = newobj;
	newobj->obj_prev->obj_next = newobj;
}

schemobj_unlink(delobj)
	register struct schemobj *delobj;
{
	if (!delobj->obj_type) {
		fprintf(stderr,
		"Fatal internal error: attempt to unlink sentinel object\n");
		abort();
	}
	delobj->obj_prev->obj_next = delobj->obj_next;
	delobj->obj_next->obj_prev = delobj->obj_prev;
}