view ueda/uschem-netlist/netobj.c @ 69:a7f0e9bb3fb7

pads2gpcb: struct coord_pair introduced
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Sun, 31 Jan 2016 23:41:00 +0000
parents cd92449fdb51
children
line wrap: on
line source

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

extern struct net *alloc_nethead();
extern struct net *get_nethead_for_netname();

extern struct schem *curschem;
extern int global_errflag;

static struct net *curnet;
static struct schemobj *cur_grouphead;

process_netobj(obj)
	register struct schemobj *obj;
{
	register struct netpoint *netpt;

	if (!obj->netobj_grouphead || obj->netobj_grouphead != cur_grouphead) {
		curnet = NULL;
		cur_grouphead = obj->netobj_grouphead;
	}
	if (!curnet && obj->netobj_netname)
		curnet = get_nethead_for_netname(obj->netobj_netname);
	for (netpt = obj->netobj_points; netpt; netpt = netpt->netpt_next)
		if (netpt->netpt_type == NETPT_TYPE_PIN)
			process_netpoint(obj, netpt);
}

process_netpoint(netobj, netpt)
	struct schemobj *netobj;
	register struct netpoint *netpt;
{
	struct schemobj *comp;
	char *soughtpin;
	int bynum;

	if (!netpt->netpt_pin_nameref) {
		fprintf(stderr,
"%s: line %d: Pin connection specified by coordinates only not netlistable\n",
			curschem->orig_filename, netobj->obj_lineno);
		fprintf(stderr, "Run uschem-rewrite -g %s to fix\n",
			curschem->orig_filename);
		global_errflag++;
		return;
	}
	if (parse_pin_nameref(curschem, netobj->obj_lineno,
				netpt->netpt_pin_nameref, &comp, &soughtpin,
				&bynum) < 0) {
		/* error msg already printed */
		global_errflag++;
		return;
	}
	/* handle unnamed nets -- point of no return */
	if (!curnet) {
		curnet = alloc_nethead();
		add_unnamed_net(curnet);
	}
	do_connect(curnet, comp, soughtpin, bynum, netobj->obj_lineno);
}