/* outdef.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 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__5 = 5;
static integer c__1 = 1;
static integer c__4 = 4;
static integer c__0 = 0;
static integer c__2 = 2;
static integer c__7 = 7;
static integer c__9 = 9;

/*<       subroutine outdef(ifld,mode,loct,ltype) >*/
/* Subroutine */ int outdef_(ifld, mode, loct, ltype)
integer *ifld, *mode, *loct, *ltype;
{
    /* Initialized data */

    static struct {
	char e_1[152];
	doublereal e_2;
	} equiv_22 = { {'v', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'v', 'm', ' ',
		 ' ', ' ', ' ', ' ', ' ', 'v', 'r', ' ', ' ', ' ', ' ', ' ', 
		' ', 'v', 'i', ' ', ' ', ' ', ' ', ' ', ' ', 'v', 'p', ' ', 
		' ', ' ', ' ', ' ', ' ', 'v', 'd', 'b', ' ', ' ', ' ', ' ', 
		' ', 'i', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'i', 'm', ' ', 
		' ', ' ', ' ', ' ', ' ', 'i', 'r', ' ', ' ', ' ', ' ', ' ', 
		' ', 'i', 'i', ' ', ' ', ' ', ' ', ' ', ' ', 'i', 'p', ' ', 
		' ', ' ', ' ', ' ', ' ', 'i', 'd', 'b', ' ', ' ', ' ', ' ', 
		' ', 'o', 'n', 'o', 'i', ' ', ' ', ' ', ' ', 'i', 'n', 'o', 
		'i', ' ', ' ', ' ', ' ', 'h', 'd', '2', ' ', ' ', ' ', ' ', 
		' ', 'h', 'd', '3', ' ', ' ', ' ', ' ', ' ', 'd', 'i', 'm', 
		'2', ' ', ' ', ' ', ' ', 's', 'i', 'm', '2', ' ', ' ', ' ', 
		' ', 'd', 'i', 'm', '3', ' ', ' ', ' ', ' '}, 0. };

#define aout ((doublereal *)&equiv_22)

    static struct {
	char e_1[40];
	doublereal e_2;
	} equiv_23 = { {'m', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'r', ' ', ' ',
		 ' ', ' ', ' ', ' ', ' ', 'i', ' ', ' ', ' ', ' ', ' ', ' ', 
		' ', 'p', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'd', ' ', ' ', 
		' ', ' ', ' ', ' ', ' '}, 0. };

#define aopts ((doublereal *)&equiv_23)

    static struct {
	char e_1[8];
	doublereal e_2;
	} equiv_24 = { {'(', ' ', ' ', ' ', ' ', ' ', ' ', ' '}, 0. };

#define alprn (*(doublereal *)&equiv_24)

    static struct {
	char e_1[8];
	doublereal e_2;
	} equiv_25 = { {',', ' ', ' ', ' ', ' ', ' ', ' ', ' '}, 0. };

#define acomma (*(doublereal *)&equiv_25)

    static struct {
	char e_1[8];
	doublereal e_2;
	} equiv_26 = { {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '}, 0. };

#define ablnk (*(doublereal *)&equiv_26)

    static struct {
	char e_1[8];
	doublereal e_2;
	} equiv_27 = { {'v', ' ', ' ', ' ', ' ', ' ', ' ', ' '}, 0. };

#define aletv (*(doublereal *)&equiv_27)


    /* Local variables */
    static doublereal anam;
    extern /* Subroutine */ int find_(), move_();
    static integer ipos;
    extern integer xxor_();
    static integer i;
    static doublereal achek, avsrc;
    static integer idout, ktype, n1, n2;
    static doublereal atype;
    static integer id;
    static doublereal adelim;
#define nodplc ((integer *)&blank_1)
#define cvalue ((complex *)&blank_1)
    extern /* Subroutine */ int alfnum_();
    static doublereal outnam;

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

/*     this routine constructs the internal list element for an output */
/* variable defined on some input card. */

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

/*<       integer xxor >*/
/*<       dimension aout(19),aopts(5) >*/
/*<       data aout / 4hv   , 4hvm  , 4hvr  , 4hvi  , 4hvp  , 4hvdb , >*/
/*<      1            4hi   , 4him  , 4hir  , 4hii  , 4hip  , 4hidb , >*/
/*<      2            4honoi, 4hinoi, 4hhd2 , 4hhd3 , 4hdim2, 4hsim2, >*/
/*<      3            4hdim3 / >*/
/*<       data aopts / 1hm, 1hr, 1hi, 1hp, 1hd / >*/
/*<       data alprn, acomma, ablnk, aletv / 1h(, 1h,, 1h , 1hv / >*/

/*<       if (nodplc(icode+ifld).ne.1) go to 300 >*/
    if (nodplc[tabinf_1.icode + *ifld - 1] != 1) {
	goto L300;
    }
/*<       anam=value(ifield+ifld) >*/
    anam = blank_1.value[tabinf_1.ifield + *ifld - 1];
/*<       call move(anam,5,ablnk,1,4) >*/
    move_(&anam, &c__5, &ablnk, &c__1, &c__4);
/*<       do 10 i=1,19 >*/
    for (i = 1; i <= 19; ++i) {
/*<       if (xxor(anam,aout(i)).ne.0) go to 10 >*/
	if (xxor_(&anam, &aout[i - 1]) != 0) {
	    goto L10;
	}
/*<       idout=i >*/
	idout = i;
/*<       go to 20 >*/
	goto L20;
/*<    10 continue >*/
L10:
    ;}
/*<       go to 300 >*/
    goto L300;

/*  further error checking */

/*<    20 if (mode.ge.3) go to 25 >*/
L20:
    if (*mode >= 3) {
	goto L25;
    }
/* ...  dc or tran */
/*<       if ((idout.ne.1).and.(idout.ne.7)) go to 300 >*/
    if (idout != 1 && idout != 7) {
	goto L300;
    }
/*<       go to 38 >*/
    goto L38;
/*<    25 if (mode.ge.4) go to 30 >*/
L25:
    if (*mode >= 4) {
	goto L30;
    }
/* ...  ac */
/*<       if (idout.ge.13) go to 300 >*/
    if (idout >= 13) {
	goto L300;
    }
/*<       go to 38 >*/
    goto L38;
/*<    30 if (mode.eq.5) go to 35 >*/
L30:
    if (*mode == 5) {
	goto L35;
    }
/* ...  noise */
/*<       if ((idout.ne.13).and.(idout.ne.14)) go to 300 >*/
    if (idout != 13 && idout != 14) {
	goto L300;
    }
/*<       go to 38 >*/
    goto L38;
/* ...  distortion */
/*<    35 if (idout.lt.15) go to 300 >*/
L35:
    if (idout < 15) {
	goto L300;
    }
/*<    38 ktype=0 >*/
L38:
    ktype = 0;
/*<       ltype=idout >*/
    *ltype = idout;
/*<       if (idout.lt.7) go to 40 >*/
    if (idout < 7) {
	goto L40;
    }
/*<       ktype=1 >*/
    ktype = 1;
/*<       ltype=ltype-6 >*/
    *ltype += -6;
/*<       if (idout.lt.13) go to 40 >*/
    if (idout < 13) {
	goto L40;
    }
/*<       ktype=idout-11 >*/
    ktype = idout - 11;
/*<       ltype=1 >*/
    *ltype = 1;

/*  voltage output */

/*<    40 id=40+mode >*/
L40:
    id = *mode + 40;
/*<       if (ktype.ne.0) go to 100 >*/
    if (ktype != 0) {
	goto L100;
    }
/*<       if (nodplc(icode+ifld+1).ne.0) go to 300 >*/
    if (nodplc[tabinf_1.icode + *ifld] != 0) {
	goto L300;
    }
/*<       ifld=ifld+1 >*/
    ++(*ifld);
/*<       n1=value(ifield+ifld) >*/
    n1 = (integer) blank_1.value[tabinf_1.ifield + *ifld - 1];
/*<       if (n1.lt.0) go to 300 >*/
    if (n1 < 0) {
	goto L300;
    }
/*<       if(n1.gt.9999) go to 300 >*/
    if (n1 > 9999) {
	goto L300;
    }
/*<       n2=0 >*/
    n2 = 0;
/*<       adelim=value(idelim+ifld) >*/
    adelim = blank_1.value[tabinf_1.idelim + *ifld - 1];
/*<       if (adelim.eq.acomma) go to 45 >*/
    if (adelim == acomma) {
	goto L45;
    }
/*<       if (adelim.ne.ablnk) go to 50 >*/
    if (adelim != ablnk) {
	goto L50;
    }
/*<    45 if (nodplc(icode+ifld+1).ne.0) go to 300 >*/
L45:
    if (nodplc[tabinf_1.icode + *ifld] != 0) {
	goto L300;
    }
/*<       ifld=ifld+1 >*/
    ++(*ifld);
/*<       n2=value(ifield+ifld) >*/
    n2 = (integer) blank_1.value[tabinf_1.ifield + *ifld - 1];
/*<       if (n2.lt.0) go to 300 >*/
    if (n2 < 0) {
	goto L300;
    }
/*<       if(n2.gt.9999) go to 300 >*/
    if (n2 > 9999) {
	goto L300;
    }
/*<    50 outnam=ablnk >*/
L50:
    outnam = ablnk;
/*<       ipos=1 >*/
    ipos = 1;
/*<       call alfnum(n1,outnam,ipos) >*/
    alfnum_(&n1, &outnam, &ipos);
/*<       ipos=5 >*/
    ipos = 5;
/*<       call alfnum(n2,outnam,ipos) >*/
    alfnum_(&n2, &outnam, &ipos);
/*<       call find(outnam,id,loct,0) >*/
    find_(&outnam, &id, loct, &c__0);
/*<       nodplc(loct+2)=n1 >*/
    nodplc[*loct + 1] = n1;
/*<       nodplc(loct+3)=n2 >*/
    nodplc[*loct + 2] = n2;
/*<       go to 400 >*/
    goto L400;

/*  current output */

/*<   100 if (ktype.ne.1) go to 200 >*/
L100:
    if (ktype != 1) {
	goto L200;
    }
/*<       if (nodplc(icode+ifld+1).ne.1) go to 300 >*/
    if (nodplc[tabinf_1.icode + *ifld] != 1) {
	goto L300;
    }
/*<       ifld=ifld+1 >*/
    ++(*ifld);
/*<       avsrc=value(ifield+ifld) >*/
    avsrc = blank_1.value[tabinf_1.ifield + *ifld - 1];
/*<       achek=avsrc >*/
    achek = avsrc;
/*<       call move(achek,2,ablnk,1,7) >*/
    move_(&achek, &c__2, &ablnk, &c__1, &c__7);
/*<       if (achek.ne.aletv) go to 300 >*/
    if (achek != aletv) {
	goto L300;
    }
/*<       call find(avsrc,id,loct,0) >*/
    find_(&avsrc, &id, loct, &c__0);
/*<       call find(avsrc,9,nodplc(loct+2),0) >*/
    find_(&avsrc, &c__9, &nodplc[*loct + 1], &c__0);
/*<       nodplc(loct+5)=1 >*/
    nodplc[*loct + 4] = 1;
/*<       go to 400 >*/
    goto L400;

/*  noise or distortion outputs */

/*<   200 id=44 >*/
L200:
    id = 44;
/*<       if (ktype.ge.4) id=id+1 >*/
    if (ktype >= 4) {
	++id;
    }
/*<       if (value(idelim+ifld).ne.alprn) go to 220 >*/
    if (blank_1.value[tabinf_1.idelim + *ifld - 1] != alprn) {
	goto L220;
    }
/*<       if (nodplc(icode+ifld+1).ne.1) go to 300 >*/
    if (nodplc[tabinf_1.icode + *ifld] != 1) {
	goto L300;
    }
/*<       ifld=ifld+1 >*/
    ++(*ifld);
/*<       atype=value(ifield+ifld) >*/
    atype = blank_1.value[tabinf_1.ifield + *ifld - 1];
/*<       call move(atype,2,ablnk,1,7) >*/
    move_(&atype, &c__2, &ablnk, &c__1, &c__7);
/*<       do 210 i=1,5 >*/
    for (i = 1; i <= 5; ++i) {
/*<       if (atype.ne.aopts(i)) go to 210 >*/
	if (atype != aopts[i - 1]) {
	    goto L210;
	}
/*<       ltype=i+1 >*/
	*ltype = i + 1;
/*<       go to 220 >*/
	goto L220;
/*<   210 continue >*/
L210:
    ;}
/*<       go to 300 >*/
    goto L300;
/*<   220 call find(anam,id,loct,0) >*/
L220:
    find_(&anam, &id, loct, &c__0);
/*<       nodplc(loct+2)=0 >*/
    nodplc[*loct + 1] = 0;
/*<       nodplc(loct+5)=ktype >*/
    nodplc[*loct + 4] = ktype;
/*<       go to 400 >*/
    goto L400;

/*  errors */

/*<   300 igoof=1 >*/
L300:
    flags_1.igoof = 1;

/*  finished */

/*<   400 return >*/
L400:
    return 0;
/*<       end >*/
} /* outdef_ */

#undef cvalue
#undef nodplc
#undef aletv
#undef ablnk
#undef acomma
#undef alprn
#undef aopts
#undef aout


