/* topchk.f -- translated by f2c (version of 3 February 1990  3:36:42).
   You must link the resulting object file with the libraries:
	-lF77 -lI77 -lm -lc   (in that order)
*/

#include "f2c.h"

/* Common Block Declarations */

struct {
    integer ielmnt, isbckt, nsbckt, iunsat, nunsat, itemps, numtem, isens, 
	    nsens, ifour, nfour, ifield, icode, idelim, icolum, insize, 
	    junode, lsbkpt, numbkp, iorder, jmnode, iur, iuc, ilc, ilr, 
	    numoff, isr, nmoffc, iseq, iseq1, neqn, nodevs, ndiag, iswap, 
	    iequa, macins, lvnim1, lx0, lvn, lynl, lyu, lyl, lx1, lx2, lx3, 
	    lx4, lx5, lx6, lx7, ld0, ld1, ltd, imynl, imvn, lcvn, nsnod, 
	    nsmat, nsval, icnod, icmat, icval, loutpt, lpol, lzer, irswpf, 
	    irswpr, icswpf, icswpr, irpt, jcpt, irowno, jcolno, nttbr, nttar, 
	    lvntmp;
} tabinf_;

#define tabinf_1 tabinf_

struct {
    doublereal atime, aprog[3], adate, atitle[10], defl, defw, defad, defas, 
	    rstats[50];
    integer iwidth, lwidth, nopage;
} miscel_;

#define miscel_1 miscel_

struct {
    integer locate[50], jelcnt[50], nunods, ncnods, numnod, nstop, nut, nlt, 
	    nxtrm, ndist, ntlin, ibr, numvs, numalt, numcyc;
} cirdat_;

#define cirdat_1 cirdat_

struct {
    integer iprnta, iprntl, iprntm, iprntn, iprnto, limtim, limpts, lvlcod, 
	    lvltim, itl1, itl2, itl3, itl4, itl5, itl6, igoof, nogo, keof;
} flags_;

#define flags_1 flags_

struct {
    doublereal value[200000];
} blank_;

#define blank_1 blank_

struct {
    doublereal omega, time, delta, delold[7], ag[7], vt, xni, egfet, xmu, 
	    sfactr;
    integer mode, modedc, icalc, initf, method, iord, maxord, noncon, iterno, 
	    itemno, nosolv, modac, ipiv, ivmflg, ipostp, iscrch, iofile;
} status_;

#define status_1 status_

/* Table of constant values */

static integer c__0 = 0;
static integer c__1 = 1;

/*<       subroutine topchk >*/
/* Subroutine */ int topchk_()
{
    /* Initialized data */

    static struct {
	char e_1[32];
	doublereal e_2;
	} equiv_41 = { {'e', 'l', 'e', 'm', 'e', 'n', 't', ' ', 'n', 'o', 'd',
		 'e', ' ', 't', 'a', 'b', 'l', 'e', ' ', ' ', ' ', ' ', ' ', 
		' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '}, 0. };

#define toptit ((doublereal *)&equiv_41)

    static integer idlist[4] = { 3,6,8,9 };
    static integer idlis2[4] = { 14,14,14,11 };
    static struct {
	char e_1[8];
	doublereal e_2;
	char e_3[8];
	doublereal e_4[2];
	char e_5[8];
	doublereal e_6;
	char e_7[16];
	doublereal e_8;
	char e_9[32];
	doublereal e_10[2];
	char e_11[8];
	doublereal e_12[3];
	} equiv_42 = { {'r', ' ', ' ', ' ', ' ', ' ', ' ', ' '}, 0., {'l', ' '
		, ' ', ' ', ' ', ' ', ' ', ' '}, 0., 0., {'e', ' ', ' ', ' ', 
		' ', ' ', ' ', ' '}, 0., {'h', ' ', ' ', ' ', ' ', ' ', ' ', 
		' ', 'v', ' ', ' ', ' ', ' ', ' ', ' ', ' '}, 0., {'d', ' ', 
		' ', ' ', ' ', ' ', ' ', ' ', 'q', ' ', ' ', ' ', ' ', ' ', 
		' ', ' ', 'j', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'm', ' ', 
		' ', ' ', ' ', ' ', ' ', ' '}, 0., 0., {'t', ' ', ' ', ' ', 
		' ', ' ', ' ', ' '}, 0., 0., 0. };

#define aide ((doublereal *)&equiv_42)

    static integer nnods[20] = { 2,2,2,0,2,2,2,2,2,2,2,4,3,4,4,4,4,0,0,0 };

    /* Format strings */
    static char fmt_1511[] = "(\0020\002,i7)";
    static char fmt_1521[] = "(\0020\002,i7,3x,12(1x,a8))";
    static char fmt_1526[] = "(11x,12(1x,a8))";
    static char fmt_1557[] = "(\0020*error*:  less than 2 connections at nod\
e \002,i6/)";
    static char fmt_1561[] = "(\0020*error*:  no dc path to ground from node\
 \002,i6/)";
    static char fmt_1711[] = "(\0020*error*:  inductor/voltage source loop f\
ound, containing \002,a8/)";

    /* System generated locals */
    integer i_1, i_2, i_3;

    /* Builtin functions */
    integer s_wsfe(), do_fio(), e_wsfe();

    /* Local variables */
    static integer node, nloc, locv, kntr, node1, node2;
    extern /* Subroutine */ int getm4_(), copy4_(), zero4_();
    static integer i, j, k, iflag, jflag, istop, jstop, ispot, kstop;
    extern /* Subroutine */ int title_();
    static integer id, change;
    static doublereal atable[12];
    static integer itabid, itable;
#define nodplc ((integer *)&blank_1)
#define cvalue ((complex *)&blank_1)
    static integer kntlim;
    extern /* Subroutine */ int extmem_();
    static integer jstart, idcntr;
    extern /* Subroutine */ int clrmem_();
    static integer loc;

    /* Fortran I/O blocks */
    static cilist io__25 = { 0, 0, 0, fmt_1511, 0 };
    static cilist io__30 = { 0, 0, 0, fmt_1521, 0 };
    static cilist io__31 = { 0, 0, 0, fmt_1526, 0 };
    static cilist io__32 = { 0, 0, 0, fmt_1521, 0 };
    static cilist io__33 = { 0, 0, 0, fmt_1526, 0 };
    static cilist io__34 = { 0, 0, 0, fmt_1557, 0 };
    static cilist io__35 = { 0, 0, 0, fmt_1561, 0 };
    static cilist io__40 = { 0, 0, 0, fmt_1711, 0 };


/*<       implicit double precision (a-h,o-z) >*/

/*     this routine constructs the element node table.  it also checks */
/* for voltage source/inductor loops, current source/capacitor cutsets, */

/* and that every node has a dc (conductive) path to ground */

/* spice version 2g.6  sccsid=tabinf 3/15/83 */
/*<       common /tabinf/ ielmnt,isbckt,nsbckt,iunsat,nunsat,itemps,numtem, >*/
/*<      1   isens,nsens,ifour,nfour,ifield,icode,idelim,icolum,insize, >*/
/*<      2   junode,lsbkpt,numbkp,iorder,jmnode,iur,iuc,ilc,ilr,numoff,isr, >*/
/*<      3   nmoffc,iseq,iseq1,neqn,nodevs,ndiag,iswap,iequa,macins,lvnim1, >*/
/*<      4   lx0,lvn,lynl,lyu,lyl,lx1,lx2,lx3,lx4,lx5,lx6,lx7,ld0,ld1,ltd, >*/
/*<      5   imynl,imvn,lcvn,nsnod,nsmat,nsval,icnod,icmat,icval, >*/
/*<      6   loutpt,lpol,lzer,irswpf,irswpr,icswpf,icswpr,irpt,jcpt, >*/
/*<      7   irowno,jcolno,nttbr,nttar,lvntmp >*/
/* spice version 2g.6  sccsid=miscel 3/15/83 */
/*<       common /miscel/ atime,aprog(3),adate,atitle(10),defl,defw,defad, >*/
/*<      1  defas,rstats(50),iwidth,lwidth,nopage >*/
/* spice version 2g.6  sccsid=cirdat 3/15/83 */
/*<       common /cirdat/ locate(50),jelcnt(50),nunods,ncnods,numnod,nstop, >*/
/*<      1   nut,nlt,nxtrm,ndist,ntlin,ibr,numvs,numalt,numcyc >*/
/* spice version 2g.6  sccsid=flags 3/15/83 */
/*<       common /flags/ iprnta,iprntl,iprntm,iprntn,iprnto,limtim,limpts, >*/
/*<      1   lvlcod,lvltim,itl1,itl2,itl3,itl4,itl5,itl6,igoof,nogo,keof >*/
/* spice version 2g.6  sccsid=blank 3/15/83 */
/*<       common /blank/ value(200000) >*/
/* spice version 2g.6  sccsid=status 3/15/83 */
/*<       common /status/ omega,time,delta,delold(7),ag(7),vt,xni,egfet, >*/
/*<      1   xmu,sfactr,mode,modedc,icalc,initf,method,iord,maxord,noncon, >*/
/*<      2   iterno,itemno,nosolv,modac,ipiv,ivmflg,ipostp,iscrch,iofile >*/
/*<       integer nodplc(64) >*/
/*<       complex cvalue(32) >*/
/*<       equivalence (value(1),nodplc(1),cvalue(1)) >*/
/*<       integer change >*/


/*<       dimension atable(12),aide(20),nnods(20) >*/
/*<       dimension idlist(4),idlis2(4) >*/
/*<       dimension toptit(4) >*/
/*<       data toptit / 8helement , 8hnode tab, 8hle      , 8h         / >*/
/*<       data idlist / 3, 6, 8, 9 / >*/
/*<       data idlis2 /14,14,14,11 / >*/
/*<       data aide / 1hr,0.0d0,1hl,2*0.0d0,1he,0.0d0,1hh,1hv,0.0d0,1hd, >*/
/*<      1   1hq,1hj,1hm,0.0d0,0.0d0,1ht,0.0d0,0.0d0,0.0d0 / >*/
/*<       data nnods / 2,2,2,0,2,2,2,2,2,2,2,4,3,4,4,4,4,0,0,0 / >*/
/*<       data ablnk /1h / >*/

/*  allocate storage */

/*<       call getm4(iorder,ncnods) >*/
    getm4_(&tabinf_1.iorder, &cirdat_1.ncnods);
/*<       call getm4(iur,ncnods+1) >*/
    i_1 = cirdat_1.ncnods + 1;
    getm4_(&tabinf_1.iur, &i_1);

/*  construct node table */

/*<       kntlim=lwidth/11 >*/
    kntlim = miscel_1.lwidth / 11;
/*<  1300 call getm4(itable,0) >*/
/* L1300: */
    getm4_(&itable, &c__0);
/*<       call getm4(itabid,0) >*/
    getm4_(&itabid, &c__0);
/*<       istop=ncnods+1 >*/
    istop = cirdat_1.ncnods + 1;
/*<       do 1310 i=1,istop >*/
    i_1 = istop;
    for (i = 1; i <= i_1; ++i) {
/*<  1310 nodplc(iur+i)=1 >*/
/* L1310: */
	nodplc[tabinf_1.iur + i - 1] = 1;
    }
/*<       do 1370 id=1,18 >*/
    for (id = 1; id <= 18; ++id) {
/*<       if (nnods(id).eq.0) go to 1370 >*/
	if (nnods[id - 1] == 0) {
	    goto L1370;
	}
/*<       loc=locate(id) >*/
	loc = cirdat_1.locate[id - 1];
/*<  1320 if (loc.eq.0) go to 1370 >*/
L1320:
	if (loc == 0) {
	    goto L1370;
	}
/*<       nloc=loc+1 >*/
	nloc = loc + 1;
/*<       jstop=nnods(id) >*/
	jstop = nnods[id - 1];
/*<  1330 do 1360 j=1,jstop >*/
/* L1330: */
	i_1 = jstop;
	for (j = 1; j <= i_1; ++j) {
/*<       node=nodplc(nloc+j) >*/
	    node = nodplc[nloc + j - 1];
/*<       ispot=nodplc(iur+node+1) >*/
	    ispot = nodplc[tabinf_1.iur + node];
/*<       k=nodplc(iur+ncnods+1) >*/
	    k = nodplc[tabinf_1.iur + cirdat_1.ncnods];
/*<       call extmem(itable,1) >*/
	    extmem_(&itable, &c__1);
/*<       call extmem(itabid,1) >*/
	    extmem_(&itabid, &c__1);
/*<       if (k.le.ispot) go to 1340 >*/
	    if (k <= ispot) {
		goto L1340;
	    }
/*<       call copy4(nodplc(itable+ispot),nodplc(itable+ispot+1),k-ispot) >*/
	    i_2 = k - ispot;
	    copy4_(&nodplc[itable + ispot - 1], &nodplc[itable + ispot], &i_2)
		    ;
/*<       call copy4(nodplc(itabid+ispot),nodplc(itabid+ispot+1),k-ispot) >*/
	    i_2 = k - ispot;
	    copy4_(&nodplc[itabid + ispot - 1], &nodplc[itabid + ispot], &i_2)
		    ;
/*<  1340 nodplc(itable+ispot)=loc >*/
L1340:
	    nodplc[itable + ispot - 1] = loc;
/*<       nodplc(itabid+ispot)=id >*/
	    nodplc[itabid + ispot - 1] = id;
/* ...  treat the substrate node of a mosfet as if it were a 
transmission */
/* ...  line node, i.e. let it dangle if desired */
/*<       if(id.eq.14.and.j.eq.4) nodplc(itabid+ispot)=17 >*/
	    if (id == 14 && j == 4) {
		nodplc[itabid + ispot - 1] = 17;
	    }
/*<       k=node >*/
	    k = node;
/*<       kstop=ncnods+1 >*/
	    kstop = cirdat_1.ncnods + 1;
/*<  1350 k=k+1 >*/
L1350:
	    ++k;
/*<       if (k.gt.kstop) go to 1360 >*/
	    if (k > kstop) {
		goto L1360;
	    }
/*<       nodplc(iur+k)=nodplc(iur+k)+1 >*/
	    ++nodplc[tabinf_1.iur + k - 1];
/*<       go to 1350 >*/
	    goto L1350;
/*<  1360 continue >*/
L1360:
	;}
/*<       loc=nodplc(loc) >*/
	loc = nodplc[loc - 1];
/*<       go to 1320 >*/
	goto L1320;
/*<  1370 continue >*/
L1370:
    ;}

/*  check that every node has a dc path to ground */

/*<       call zero4(nodplc(iorder+1),ncnods) >*/
    zero4_(&nodplc[tabinf_1.iorder], &cirdat_1.ncnods);
/*<       nodplc(iorder+1)=1 >*/
    nodplc[tabinf_1.iorder] = 1;
/*<  1420 iflag=0 >*/
L1420:
    iflag = 0;
/*<       do 1470 i=2,ncnods >*/
    i_1 = cirdat_1.ncnods;
    for (i = 2; i <= i_1; ++i) {
/*<       if (nodplc(iorder+i).eq.1) go to 1470 >*/
	if (nodplc[tabinf_1.iorder + i - 1] == 1) {
	    goto L1470;
	}
/*<       jstart=nodplc(iur+i) >*/
	jstart = nodplc[tabinf_1.iur + i - 1];
/*<       jstop=nodplc(iur+i+1)-1 >*/
	jstop = nodplc[tabinf_1.iur + i] - 1;
/*<       if (jstart.gt.jstop) go to 1470 >*/
	if (jstart > jstop) {
	    goto L1470;
	}
/*<       do 1450 j=jstart,jstop >*/
	i_2 = jstop;
	for (j = jstart; j <= i_2; ++j) {
/*<       loc=nodplc(itable+j) >*/
	    loc = nodplc[itable + j - 1];
/*<       id=nodplc(itabid+j) >*/
	    id = nodplc[itabid + j - 1];
/*<       if (aide(id).eq.0.0d0) go to 1450 >*/
	    if (aide[id - 1] == 0.) {
		goto L1450;
	    }
/*<       if (id.eq.17) go to 1445 >*/
	    if (id == 17) {
		goto L1445;
	    }
/*<       kstop=loc+nnods(id)-1 >*/
	    kstop = loc + nnods[id - 1] - 1;
/*<       do 1440 k=loc,kstop >*/
	    i_3 = kstop;
	    for (k = loc; k <= i_3; ++k) {
/*<       node=nodplc(k+2) >*/
		node = nodplc[k + 1];
/*<       if (nodplc(iorder+node).eq.1) go to 1460 >*/
		if (nodplc[tabinf_1.iorder + node - 1] == 1) {
		    goto L1460;
		}
/*<  1440 continue >*/
/* L1440: */
	    }
/*<       go to 1450 >*/
	    goto L1450;
/*<  1445 if (nodplc(loc+2).eq.i) node=nodplc(loc+3) >*/
L1445:
	    if (nodplc[loc + 1] == i) {
		node = nodplc[loc + 2];
	    }
/*<       if (nodplc(loc+3).eq.i) node=nodplc(loc+2) >*/
	    if (nodplc[loc + 2] == i) {
		node = nodplc[loc + 1];
	    }
/*<       if (nodplc(loc+4).eq.i) node=nodplc(loc+5) >*/
	    if (nodplc[loc + 3] == i) {
		node = nodplc[loc + 4];
	    }
/*<       if (nodplc(loc+5).eq.i) node=nodplc(loc+4) >*/
	    if (nodplc[loc + 4] == i) {
		node = nodplc[loc + 3];
	    }
/*<       if (nodplc(iorder+node).eq.1) go to 1460 >*/
	    if (nodplc[tabinf_1.iorder + node - 1] == 1) {
		goto L1460;
	    }
/*<  1450 continue >*/
L1450:
	;}
/*<       go to 1470 >*/
	goto L1470;
/*<  1460 nodplc(iorder+i)=1 >*/
L1460:
	nodplc[tabinf_1.iorder + i - 1] = 1;
/*<       iflag=1 >*/
	iflag = 1;
/*<  1470 continue >*/
L1470:
    ;}
/*<       if (iflag.eq.1) go to 1420 >*/
    if (iflag == 1) {
	goto L1420;
    }

/*  print node table and topology error messages */

/*<       if (iprntn.eq.0) go to 1510 >*/
    if (flags_1.iprntn == 0) {
	goto L1510;
    }
/*<       call title(0,lwidth,1,toptit) >*/
    title_(&c__0, &miscel_1.lwidth, &c__1, toptit);
/*<  1510 do 1590 i=1,ncnods >*/
L1510:
    i_1 = cirdat_1.ncnods;
    for (i = 1; i <= i_1; ++i) {
/*<       jstart=nodplc(iur+i) >*/
	jstart = nodplc[tabinf_1.iur + i - 1];
/*<       jstop=nodplc(iur+i+1)-1 >*/
	jstop = nodplc[tabinf_1.iur + i] - 1;
/*<       if (iprntn.eq.0) go to 1550 >*/
	if (flags_1.iprntn == 0) {
	    goto L1550;
	}
/*<       if (jstart.le.jstop) go to 1520 >*/
	if (jstart <= jstop) {
	    goto L1520;
	}
/*<       write (iofile,1511) nodplc(junode+i) >*/
	io__25.ciunit = status_1.iofile;
	s_wsfe(&io__25);
	do_fio(&c__1, (char *)&nodplc[tabinf_1.junode + i - 1], (ftnlen)
		sizeof(integer));
	e_wsfe();
/*<  1511 format(1h0,i7) >*/
/*<       go to 1550 >*/
	goto L1550;
/*<  1520 kntr=0 >*/
L1520:
	kntr = 0;
/*<       jflag=1 >*/
	jflag = 1;
/*<       do 1540 j=jstart,jstop >*/
	i_2 = jstop;
	for (j = jstart; j <= i_2; ++j) {
/*<       loc=nodplc(itable+j) >*/
	    loc = nodplc[itable + j - 1];
/*<       locv=nodplc(loc+1) >*/
	    locv = nodplc[loc];
/*<       kntr=kntr+1 >*/
	    ++kntr;
/*<       atable(kntr)=value(locv) >*/
	    atable[kntr - 1] = blank_1.value[locv - 1];
/*<       if (kntr.lt.kntlim) go to 1540 >*/
	    if (kntr < kntlim) {
		goto L1540;
	    }
/*<       if (jflag.eq.0) go to 1525 >*/
	    if (jflag == 0) {
		goto L1525;
	    }
/*<       jflag=0 >*/
	    jflag = 0;
/*<       write (iofile,1521) nodplc(junode+i),(atable(k),k=1,kntr) >*/
	    io__30.ciunit = status_1.iofile;
	    s_wsfe(&io__30);
	    do_fio(&c__1, (char *)&nodplc[tabinf_1.junode + i - 1], (ftnlen)
		    sizeof(integer));
	    i_3 = kntr;
	    for (k = 1; k <= i_3; ++k) {
		do_fio(&c__1, (char *)&atable[k - 1], (ftnlen)sizeof(
			doublereal));
	    }
	    e_wsfe();
/*<  1521 format(1h0,i7,3x,12(1x,a8)) >*/
/*<       go to 1530 >*/
	    goto L1530;
/*<  1525 write (iofile,1526) (atable(k),k=1,kntr) >*/
L1525:
	    io__31.ciunit = status_1.iofile;
	    s_wsfe(&io__31);
	    i_3 = kntr;
	    for (k = 1; k <= i_3; ++k) {
		do_fio(&c__1, (char *)&atable[k - 1], (ftnlen)sizeof(
			doublereal));
	    }
	    e_wsfe();
/*<  1526 format(11x,12(1x,a8)) >*/
/*<  1530 kntr=0 >*/
L1530:
	    kntr = 0;
/*<  1540 continue >*/
L1540:
	;}
/*<       if (kntr.eq.0) go to 1550 >*/
	if (kntr == 0) {
	    goto L1550;
	}
/*<       if (jflag.eq.0) go to 1545 >*/
	if (jflag == 0) {
	    goto L1545;
	}
/*<       write (iofile,1521) nodplc(junode+i),(atable(k),k=1,kntr) >*/
	io__32.ciunit = status_1.iofile;
	s_wsfe(&io__32);
	do_fio(&c__1, (char *)&nodplc[tabinf_1.junode + i - 1], (ftnlen)
		sizeof(integer));
	i_2 = kntr;
	for (k = 1; k <= i_2; ++k) {
	    do_fio(&c__1, (char *)&atable[k - 1], (ftnlen)sizeof(doublereal));

	}
	e_wsfe();
/*<       go to 1550 >*/
	goto L1550;
/*<  1545 write (iofile,1526) (atable(k),k=1,kntr) >*/
L1545:
	io__33.ciunit = status_1.iofile;
	s_wsfe(&io__33);
	i_2 = kntr;
	for (k = 1; k <= i_2; ++k) {
	    do_fio(&c__1, (char *)&atable[k - 1], (ftnlen)sizeof(doublereal));

	}
	e_wsfe();
/*<  1550 if (jstart-jstop) 1560,1552,1556 >*/
L1550:
	if ((i_2 = jstart - jstop) < 0) {
	    goto L1560;
	} else if (i_2 == 0) {
	    goto L1552;
	} else {
	    goto L1556;
	}

/*  allow node with only one connection iff element is a t-line */

/*<  1552 if (nodplc(itabid+jstart).eq.17) go to 1560 >*/
L1552:
	if (nodplc[itabid + jstart - 1] == 17) {
	    goto L1560;
	}
/*<  1556 nogo=1 >*/
L1556:
	flags_1.nogo = 1;
/*<       write (iofile,1557) nodplc(junode+i) >*/
	io__34.ciunit = status_1.iofile;
	s_wsfe(&io__34);
	do_fio(&c__1, (char *)&nodplc[tabinf_1.junode + i - 1], (ftnlen)
		sizeof(integer));
	e_wsfe();
/*<  1557 format('0*error*:  less than 2 connections at node ',i6/) >*/
/*<       go to 1590 >*/
	goto L1590;
/*<  1560 if (nodplc(iorder+i).eq.1) go to 1590 >*/
L1560:
	if (nodplc[tabinf_1.iorder + i - 1] == 1) {
	    goto L1590;
	}
/*<       nogo=1 >*/
	flags_1.nogo = 1;
/*<       write (iofile,1561) nodplc(junode+i) >*/
	io__35.ciunit = status_1.iofile;
	s_wsfe(&io__35);
	do_fio(&c__1, (char *)&nodplc[tabinf_1.junode + i - 1], (ftnlen)
		sizeof(integer));
	e_wsfe();
/*<  1561 format('0*error*:  no dc path to ground from node ',i6/) >*/
/*<  1590 continue >*/
L1590:
    ;}

/*  check for inductor/voltage source loops */

/*<       do 1700 i=1,ncnods >*/
    i_1 = cirdat_1.ncnods;
    for (i = 1; i <= i_1; ++i) {
/*<       call zero4(nodplc(iorder+1),ncnods) >*/
	zero4_(&nodplc[tabinf_1.iorder], &cirdat_1.ncnods);
/*<       nodplc(iorder+i)=-1 >*/
	nodplc[tabinf_1.iorder + i - 1] = -1;
/*<  1605 change=0 >*/
L1605:
	change = 0;
/*<       do 1690 idcntr=1,4 >*/
	for (idcntr = 1; idcntr <= 4; ++idcntr) {
/*<       id=idlist(idcntr) >*/
	    id = idlist[idcntr - 1];
/*<       loc=locate(id) >*/
	    loc = cirdat_1.locate[id - 1];
/*<  1610 if ((loc.eq.0).or.(nodplc(loc+idlis2(idcntr)).ne.0)) go to 1690 >*/
L1610:
	    if (loc == 0 || nodplc[loc + idlis2[idcntr - 1] - 1] != 0) {
		goto L1690;
	    }
/*<       node1=nodplc(loc+2) >*/
	    node1 = nodplc[loc + 1];
/*<       node2=nodplc(loc+3) >*/
	    node2 = nodplc[loc + 2];
/*<       if (nodplc(iorder+node1).eq.loc.or. >*/
/*<      1   nodplc(iorder+node2).eq.loc) go to 1680 >*/
	    if (nodplc[tabinf_1.iorder + node1 - 1] == loc || nodplc[
		    tabinf_1.iorder + node2 - 1] == loc) {
		goto L1680;
	    }
/*<       if (nodplc(iorder+node1)) 1620,1640,1630 >*/
	    if ((i_2 = nodplc[tabinf_1.iorder + node1 - 1]) < 0) {
		goto L1620;
	    } else if (i_2 == 0) {
		goto L1640;
	    } else {
		goto L1630;
	    }
/*<  1620 nodplc(iorder+node1)=loc >*/
L1620:
	    nodplc[tabinf_1.iorder + node1 - 1] = loc;
/*<       change=1 >*/
	    change = 1;
/*<  1630 node=node2 >*/
L1630:
	    node = node2;
/*<       go to 1670 >*/
	    goto L1670;
/*<  1640 if (nodplc(iorder+node2)) 1650,1680,1660 >*/
L1640:
	    if ((i_2 = nodplc[tabinf_1.iorder + node2 - 1]) < 0) {
		goto L1650;
	    } else if (i_2 == 0) {
		goto L1680;
	    } else {
		goto L1660;
	    }
/*<  1650 nodplc(iorder+node2)=loc >*/
L1650:
	    nodplc[tabinf_1.iorder + node2 - 1] = loc;
/*<       change=1 >*/
	    change = 1;
/*<  1660 node=node1 >*/
L1660:
	    node = node1;
/*<  1670 if (nodplc(iorder+node).ne.0) go to 1710 >*/
L1670:
	    if (nodplc[tabinf_1.iorder + node - 1] != 0) {
		goto L1710;
	    }
/*<       nodplc(iorder+node)=loc >*/
	    nodplc[tabinf_1.iorder + node - 1] = loc;
/*<       change=1 >*/
	    change = 1;
/*<  1680 loc=nodplc(loc) >*/
L1680:
	    loc = nodplc[loc - 1];
/*<       go to 1610 >*/
	    goto L1610;
/*<  1690 continue >*/
L1690:
	;}
/*<       if (change.eq.1) go to 1605 >*/
	if (change == 1) {
	    goto L1605;
	}
/*<  1700 continue >*/
/* L1700: */
    }
/*<       go to 1900 >*/
    goto L1900;
/* ... loop found */
/*<  1710 locv=nodplc(loc+1) >*/
L1710:
    locv = nodplc[loc];
/*<       write (iofile,1711) value(locv) >*/
    io__40.ciunit = status_1.iofile;
    s_wsfe(&io__40);
    do_fio(&c__1, (char *)&blank_1.value[locv - 1], (ftnlen)sizeof(doublereal)
	    );
    e_wsfe();
/*<  1711 format('0*error*:  inductor/voltage source loop found, containing >*/
/*<      1',a8/) >*/
/*<       nogo=1 >*/
    flags_1.nogo = 1;


/*<  1900 call clrmem(iorder) >*/
L1900:
    clrmem_(&tabinf_1.iorder);
/*<       call clrmem(iur) >*/
    clrmem_(&tabinf_1.iur);
/*<       call clrmem(itable) >*/
    clrmem_(&itable);
/*<       call clrmem(itabid) >*/
    clrmem_(&itabid);
/*<  2000 return >*/
/* L2000: */
    return 0;
/*<       end >*/
} /* topchk_ */

#undef cvalue
#undef nodplc
#undef aide
#undef toptit


