/* lnkref.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 {
    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_

/* Table of constant values */

static integer c__3 = 3;
static integer c__9 = 9;
static integer c__21 = 21;
static integer c__22 = 22;
static integer c__23 = 23;
static integer c__24 = 24;

/*<       subroutine lnkref >*/
/* Subroutine */ int lnkref_()
{
    /* System generated locals */
    integer i_1, i_2, i_3;

    /* Local variables */
    static integer iref, locp, nump, i;
    extern /* Subroutine */ int fndnam_();
#define nodplc ((integer *)&blank_1)
#define cvalue ((complex *)&blank_1)
    extern /* Subroutine */ int clrmem_();
    static integer loc;

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

/*     this routine resolves all unsatisfied name references. */

/* 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=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) >*/
/*<       integer nodplc(64) >*/
/*<       complex cvalue(32) >*/
/*<       equivalence (value(1),nodplc(1),cvalue(1)) >*/

/*  mutual inductors */

/*<       loc=locate(4) >*/
    loc = cirdat_1.locate[3];
/*<   100 if (loc.eq.0) go to 200 >*/
L100:
    if (loc == 0) {
	goto L200;
    }
/*<       iref=nodplc(loc+2) >*/
    iref = nodplc[loc + 1];
/*<       call fndnam(value(iunsat+iref),loc-1,loc+2,3) >*/
    i_1 = loc - 1;
    i_2 = loc + 2;
    fndnam_(&blank_1.value[tabinf_1.iunsat + iref - 1], &i_1, &i_2, &c__3);
/*<       iref=nodplc(loc+3) >*/
    iref = nodplc[loc + 2];
/*<       call fndnam(value(iunsat+iref),loc-1,loc+3,3) >*/
    i_1 = loc - 1;
    i_2 = loc + 3;
    fndnam_(&blank_1.value[tabinf_1.iunsat + iref - 1], &i_1, &i_2, &c__3);
/*<       loc=nodplc(loc) >*/
    loc = nodplc[loc - 1];
/*<       go to 100 >*/
    goto L100;

/*  current-controlled current source */

/*<   200 loc=locate(7) >*/
L200:
    loc = cirdat_1.locate[6];
/*<   210 if (loc.eq.0) go to 300 >*/
L210:
    if (loc == 0) {
	goto L300;
    }
/*<       nump=nodplc(loc+4) >*/
    nump = nodplc[loc + 3];
/*<       locp=nodplc(loc+6) >*/
    locp = nodplc[loc + 5];
/*<       do 220 i=1,nump >*/
    i_1 = nump;
    for (i = 1; i <= i_1; ++i) {
/*<       iref=nodplc(locp+i) >*/
	iref = nodplc[locp + i - 1];
/*<       call fndnam(value(iunsat+iref),loc-1,locp+i,9) >*/
	i_2 = loc - 1;
	i_3 = locp + i;
	fndnam_(&blank_1.value[tabinf_1.iunsat + iref - 1], &i_2, &i_3, &c__9)
		;
/*<   220 continue >*/
/* L220: */
    }
/*<       loc=nodplc(loc) >*/
    loc = nodplc[loc - 1];
/*<       go to 210 >*/
    goto L210;

/*  current-controlled voltage sources */

/*<   300 loc=locate(8) >*/
L300:
    loc = cirdat_1.locate[7];
/*<   310 if (loc.eq.0) go to 400 >*/
L310:
    if (loc == 0) {
	goto L400;
    }
/*<       nump=nodplc(loc+4) >*/
    nump = nodplc[loc + 3];
/*<       locp=nodplc(loc+7) >*/
    locp = nodplc[loc + 6];
/*<       do 320 i=1,nump >*/
    i_1 = nump;
    for (i = 1; i <= i_1; ++i) {
/*<       iref=nodplc(locp+i) >*/
	iref = nodplc[locp + i - 1];
/*<       call fndnam(value(iunsat+iref),loc-1,locp+i,9) >*/
	i_2 = loc - 1;
	i_3 = locp + i;
	fndnam_(&blank_1.value[tabinf_1.iunsat + iref - 1], &i_2, &i_3, &c__9)
		;
/*<   320 continue >*/
/* L320: */
    }
/*<       loc=nodplc(loc) >*/
    loc = nodplc[loc - 1];
/*<       go to 310 >*/
    goto L310;

/*  diodes */

/*<   400 loc=locate(11) >*/
L400:
    loc = cirdat_1.locate[10];
/*<   410 if (loc.eq.0) go to 500 >*/
L410:
    if (loc == 0) {
	goto L500;
    }
/*<       iref=nodplc(loc+5) >*/
    iref = nodplc[loc + 4];
/*<       call fndnam(value(iunsat+iref),loc-1,loc+5,21) >*/
    i_1 = loc - 1;
    i_2 = loc + 5;
    fndnam_(&blank_1.value[tabinf_1.iunsat + iref - 1], &i_1, &i_2, &c__21);
/*<       loc=nodplc(loc) >*/
    loc = nodplc[loc - 1];
/*<       go to 410 >*/
    goto L410;

/*  bjts */

/*<   500 loc=locate(12) >*/
L500:
    loc = cirdat_1.locate[11];
/*<   510 if (loc.eq.0) go to 600 >*/
L510:
    if (loc == 0) {
	goto L600;
    }
/*<       iref=nodplc(loc+8) >*/
    iref = nodplc[loc + 7];
/*<       call fndnam(value(iunsat+iref),loc-1,loc+8,22) >*/
    i_1 = loc - 1;
    i_2 = loc + 8;
    fndnam_(&blank_1.value[tabinf_1.iunsat + iref - 1], &i_1, &i_2, &c__22);
/*<       loc=nodplc(loc) >*/
    loc = nodplc[loc - 1];
/*<       go to 510 >*/
    goto L510;

/*  jfets */

/*<   600 loc=locate(13) >*/
L600:
    loc = cirdat_1.locate[12];
/*<   610 if (loc.eq.0) go to 700 >*/
L610:
    if (loc == 0) {
	goto L700;
    }
/*<       iref=nodplc(loc+7) >*/
    iref = nodplc[loc + 6];
/*<       call fndnam(value(iunsat+iref),loc-1,loc+7,23) >*/
    i_1 = loc - 1;
    i_2 = loc + 7;
    fndnam_(&blank_1.value[tabinf_1.iunsat + iref - 1], &i_1, &i_2, &c__23);
/*<       loc=nodplc(loc) >*/
    loc = nodplc[loc - 1];
/*<       go to 610 >*/
    goto L610;

/*  mosfets */

/*<   700 loc=locate(14) >*/
L700:
    loc = cirdat_1.locate[13];
/*<   710 if (loc.eq.0) go to 1000 >*/
L710:
    if (loc == 0) {
	goto L1000;
    }
/*<       iref=nodplc(loc+8) >*/
    iref = nodplc[loc + 7];
/*<       call fndnam(value(iunsat+iref),loc-1,loc+8,24) >*/
    i_1 = loc - 1;
    i_2 = loc + 8;
    fndnam_(&blank_1.value[tabinf_1.iunsat + iref - 1], &i_1, &i_2, &c__24);
/*<       loc=nodplc(loc) >*/
    loc = nodplc[loc - 1];
/*<       go to 710 >*/
    goto L710;

/*  finished */

/*<  1000 call clrmem(iunsat) >*/
L1000:
    clrmem_(&tabinf_1.iunsat);
/*<       return >*/
    return 0;
/*<       end >*/
} /* lnkref_ */

#undef cvalue
#undef nodplc


