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

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__1 = 1;

/*<       subroutine fndnam(anam,jsbptr,ispot,id) >*/
/* Subroutine */ int fndnam_(anam, jsbptr, ispot, id)
doublereal *anam;
integer *jsbptr, *ispot, *id;
{
    /* Format strings */
    static char fmt_91[] = "(\0020*error*:  unable to find \002,a8/)";

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

    /* Local variables */
    static integer isub, locv;
    extern integer xxor_();
#define nodplc ((integer *)&blank_1)
#define cvalue ((complex *)&blank_1)
    static integer isbptr, loc;

    /* Fortran I/O blocks */
    static cilist io__7 = { 0, 0, 0, fmt_91, 0 };


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

/*     this routine searches for an element with id 'id' by tracing back 
*/
/* up the subcircuit definition list.  if the element is not found, the */

/* nominal element list is searched. */

/* 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) >*/
/* 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 xxor >*/


/*<       isbptr=nodplc(jsbptr) >*/
    isbptr = nodplc[*jsbptr - 1];
/*<    10 if (isbptr.eq.0) go to 50 >*/
L10:
    if (isbptr == 0) {
	goto L50;
    }
/*<       isub=nodplc(isbptr+3) >*/
    isub = nodplc[isbptr + 2];
/*<       loc=nodplc(isub+3) >*/
    loc = nodplc[isub + 2];
/*<    20 if (loc.eq.0) go to 40 >*/
L20:
    if (loc == 0) {
	goto L40;
    }
/*<       if (id.ne.nodplc(loc-1)) go to 30 >*/
    if (*id != nodplc[loc - 2]) {
	goto L30;
    }
/*<       locv=nodplc(loc+1) >*/
    locv = nodplc[loc];
/*<       if (xxor(anam,value(locv)).ne.0) go to 30 >*/
    if (xxor_(anam, &blank_1.value[locv - 1]) != 0) {
	goto L30;
    }
/*<       if (id.ne.20) go to 50 >*/
    if (*id != 20) {
	goto L50;
    }
/*<       go to 65 >*/
    goto L65;
/*<    30 loc=nodplc(loc) >*/
L30:
    loc = nodplc[loc - 1];
/*<       go to 20 >*/
    goto L20;
/*<    40 isbptr=nodplc(isbptr-1) >*/
L40:
    isbptr = nodplc[isbptr - 2];
/*<       go to 10 >*/
    goto L10;

/*<    50 loc=locate(id) >*/
L50:
    loc = cirdat_1.locate[*id - 1];
/*<    60 if (loc.eq.0) go to 90 >*/
L60:
    if (loc == 0) {
	goto L90;
    }
/*<       if (nodplc(loc-1).ne.isbptr) go to 70 >*/
    if (nodplc[loc - 2] != isbptr) {
	goto L70;
    }
/*<       locv=nodplc(loc+1) >*/
    locv = nodplc[loc];
/*<       if (xxor(anam,value(locv)).ne.0) go to 70 >*/
    if (xxor_(anam, &blank_1.value[locv - 1]) != 0) {
	goto L70;
    }
/*<    65 nodplc(ispot)=loc >*/
L65:
    nodplc[*ispot - 1] = loc;
/*<       go to 100 >*/
    goto L100;
/*<    70 loc=nodplc(loc) >*/
L70:
    loc = nodplc[loc - 1];
/*<       go to 60 >*/
    goto L60;
/*<    90 write (iofile,91) anam >*/
L90:
    io__7.ciunit = status_1.iofile;
    s_wsfe(&io__7);
    do_fio(&c__1, (char *)&(*anam), (ftnlen)sizeof(doublereal));
    e_wsfe();
/*<    91 format('0*error*:  unable to find ',a8/) >*/
/*<       nogo=1 >*/
    flags_1.nogo = 1;
/*<   100 return >*/
L100:
    return 0;
/*<       end >*/
} /* fndnam_ */

#undef cvalue
#undef nodplc


