comparison ueda/libuschem/schemobj.c @ 0:cd92449fdb51

initial import of ueda and ifctf-part-lib from ifctfvax CVS
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 20 Jul 2015 00:24:37 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:cd92449fdb51
1 /*
2 * Schematic object utility functions
3 */
4
5 #include <sys/types.h>
6 #include <stdio.h>
7 #include "schemstruct.h"
8
9 schemobj_insert_after(oldobj, newobj)
10 register struct schemobj *oldobj, *newobj;
11 {
12 newobj->obj_next = oldobj->obj_next;
13 newobj->obj_prev = oldobj;
14 oldobj->obj_next = newobj;
15 newobj->obj_next->obj_prev = newobj;
16 }
17
18 schemobj_insert_before(oldobj, newobj)
19 register struct schemobj *oldobj, *newobj;
20 {
21 newobj->obj_next = oldobj;
22 newobj->obj_prev = oldobj->obj_prev;
23 oldobj->obj_prev = newobj;
24 newobj->obj_prev->obj_next = newobj;
25 }
26
27 schemobj_unlink(delobj)
28 register struct schemobj *delobj;
29 {
30 if (!delobj->obj_type) {
31 fprintf(stderr,
32 "Fatal internal error: attempt to unlink sentinel object\n");
33 abort();
34 }
35 delobj->obj_prev->obj_next = delobj->obj_next;
36 delobj->obj_next->obj_prev = delobj->obj_prev;
37 }