75 assert (
n->name != NULL);
92 txt = o.txt ? strdup (o.txt) : NULL;
105 if (narray) free (narray);
133 n->
name = str ? strdup (str) : NULL;
140 if (root == NULL) last =
n;
168 for (prev = NULL, n = root; n != NULL; prev =
n, n = n->
next) {
175 if (n == last) last = prev;
201 if (
n->name != NULL && str != NULL && !strcmp (
n->name, str))
210 if (
n->name != NULL && str != NULL && !strcmp (
n->name, str))
219 return narray[nr + 1]->
name;
232 return narray[nr + 1];
239 if (!strcmp (name,
n->name))
return n;
246 if (txt) free (txt); txt = NULL;
250 int len = (n->
nNodes - 1) + 1;
251 txt = (
char *) malloc (len); txt[0] =
'\0';
255 txt = (
char *) realloc (txt, len);
257 if (
i != n->
nNodes - 1) strcat (txt,
",");
273 if (narray) free (narray);
279 if (!strcmp (
n->name,
"gnd")) {
315 for (j = i = 0; j < nl->
nNodes - 1; i++, j++) {
316 if (nl->
nodes[i] == n) i++;
348 int p1 = sortfunc (n1);
349 int p2 = sortfunc (n2);
350 return p1 >= 0 && (p1 <= p2 || p2 < 0);
367 for (prev = NULL, nl = root; nl != NULL; prev = nl, nl = nl->
next) {
368 if (insfunc (n, nl)) {
403 else if (sorting && sortfunc (nl) > 0) {
437 if (sorting && sortfunc (nl) > 0) {
452 int p,
i, ports, MaxPorts, len =
length ();
455 for (i = 0; i < len; i++) {
458 for (MaxPorts = -1, p = 0, nl = root; nl != NULL; nl = nl->
next) {
459 ports = sortfunc (nl);
460 if (ports > MaxPorts || MaxPorts < 0 || ports == -1) {
464 if (ports == -1)
break;
483 assert (root->
nNodes == 2);
484 *node1 = root->
nodes[0];
485 *node2 = root->
nodes[1];