/* getnod.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 getnod(node) >*/
/* Subroutine */ int getnod_(node)
integer *node;
{
    /* Format strings */
    static char fmt_21[] = "(\0020warning:  attempt to reference undefined n\
ode \002,i5,\002 -- node reset to 0\002/)";

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

    /* Local variables */
    static integer jknt;
#define nodplc ((integer *)&blank_1)
#define cvalue ((complex *)&blank_1)

    /* Fortran I/O blocks */
    static cilist io__4 = { 0, 0, 0, fmt_21, 0 };


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

/*     this routine converts from the user node number to the internal */
/* (compact) node number. */

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


/*<       if (nogo.ne.0) go to 100 >*/
    if (flags_1.nogo != 0) {
	goto L100;
    }
/*<       jknt=0 >*/
    jknt = 0;
/*<    10 jknt=jknt+1 >*/
L10:
    ++jknt;
/*<       if (jknt.gt.nunods) go to 20 >*/
    if (jknt > cirdat_1.nunods) {
	goto L20;
    }
/*<       if (nodplc(junode+jknt).ne.node) go to 10 >*/
    if (nodplc[tabinf_1.junode + jknt - 1] != *node) {
	goto L10;
    }
/*<       node=jknt >*/
    *node = jknt;
/*<       go to 100 >*/
    goto L100;

/*  unknown node -- must be implied by .print and/or .plot */

/*<    20 if (node.eq.0) go to 30 >*/
L20:
    if (*node == 0) {
	goto L30;
    }
/*<       write (iofile,21) node >*/
    io__4.ciunit = status_1.iofile;
    s_wsfe(&io__4);
    do_fio(&c__1, (char *)&(*node), (ftnlen)sizeof(integer));
    e_wsfe();
/*<    21 format('0warning:  attempt to reference undefined node ',i5, >*/
/*<      1   ' -- node reset to 0'/) >*/
/*<    30 node=1 >*/
L30:
    *node = 1;

/*  finished */

/*<   100 return >*/
L100:
    return 0;
/*<       end >*/
} /* getnod_ */

#undef cvalue
#undef nodplc


