comparison ueda/uschem-netlist/netobj.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 #include <sys/types.h>
2 #include <stdio.h>
3 #include "netlist.h"
4 #include "../libuschem/schemstruct.h"
5
6 extern struct net *alloc_nethead();
7 extern struct net *get_nethead_for_netname();
8
9 extern struct schem *curschem;
10 extern int global_errflag;
11
12 static struct net *curnet;
13 static struct schemobj *cur_grouphead;
14
15 process_netobj(obj)
16 register struct schemobj *obj;
17 {
18 register struct netpoint *netpt;
19
20 if (!obj->netobj_grouphead || obj->netobj_grouphead != cur_grouphead) {
21 curnet = NULL;
22 cur_grouphead = obj->netobj_grouphead;
23 }
24 if (!curnet && obj->netobj_netname)
25 curnet = get_nethead_for_netname(obj->netobj_netname);
26 for (netpt = obj->netobj_points; netpt; netpt = netpt->netpt_next)
27 if (netpt->netpt_type == NETPT_TYPE_PIN)
28 process_netpoint(obj, netpt);
29 }
30
31 process_netpoint(netobj, netpt)
32 struct schemobj *netobj;
33 register struct netpoint *netpt;
34 {
35 struct schemobj *comp;
36 char *soughtpin;
37 int bynum;
38
39 if (!netpt->netpt_pin_nameref) {
40 fprintf(stderr,
41 "%s: line %d: Pin connection specified by coordinates only not netlistable\n",
42 curschem->orig_filename, netobj->obj_lineno);
43 fprintf(stderr, "Run uschem-rewrite -g %s to fix\n",
44 curschem->orig_filename);
45 global_errflag++;
46 return;
47 }
48 if (parse_pin_nameref(curschem, netobj->obj_lineno,
49 netpt->netpt_pin_nameref, &comp, &soughtpin,
50 &bynum) < 0) {
51 /* error msg already printed */
52 global_errflag++;
53 return;
54 }
55 /* handle unnamed nets -- point of no return */
56 if (!curnet) {
57 curnet = alloc_nethead();
58 add_unnamed_net(curnet);
59 }
60 do_connect(curnet, comp, soughtpin, bynum, netobj->obj_lineno);
61 }