/* outnam.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 value[200000];
} blank_;

#define blank_1 blank_

/* Table of constant values */

static integer c__1 = 1;

/*<       subroutine outnam(loc,ktype,string,ipos) >*/
/* Subroutine */ int outnam_(loc, ktype, string, ipos)
integer *loc, *ktype;
doublereal *string;
integer *ipos;
{
    /* Initialized data */

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

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

    static struct {
	char e_1[152];
	doublereal e_2;
	} equiv_20 = { {'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', 's', 'e', ' ', ' ', 'i', 'n', 'o', 
		'i', 's', 'e', ' ', ' ', 'h', 'd', '2', ' ', ' ', ' ', ' ', 
		' ', 'h', 'd', '3', ' ', ' ', ' ', ' ', ' ', 'd', 'i', 'm', 
		'2', ' ', ' ', ' ', ' ', 's', 'i', 'm', '2', ' ', ' ', ' ', 
		' ', 'd', 'i', 'm', '3', ' ', ' ', ' ', ' '}, 0. };

#define aout ((doublereal *)&equiv_20)

    static integer lenout[19] = { 1,2,2,2,2,3,1,2,2,2,2,3,6,6,3,3,4,4,4 };
    static struct {
	char e_1[40];
	doublereal e_2;
	} equiv_21 = { {'m', 'a', 'g', ' ', ' ', ' ', ' ', ' ', 'r', 'e', 'a',
		 'l', ' ', ' ', ' ', ' ', 'i', 'm', 'a', 'g', ' ', ' ', ' ', 
		' ', 'p', 'h', 'a', 's', 'e', ' ', ' ', ' ', 'd', 'b', ' ', 
		' ', ' ', ' ', ' ', ' '}, 0. };

#define aopt ((doublereal *)&equiv_21)

    static integer lenopt[5] = { 3,4,4,5,2 };
    static struct {
	char e_1[8];
	doublereal e_2;
	} equiv_22 = { {'(', ' ', ' ', ' ', ' ', ' ', ' ', ' '}, 0. };

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

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

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

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

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


    /* Local variables */
    static doublereal anam;
    static integer locv;
    extern /* Subroutine */ int move_();
    static integer lout, node1, node2, i;
    static doublereal achar;
#define nodplc ((integer *)&blank_1)
#define cvalue ((complex *)&blank_1)
    extern /* Subroutine */ int alfnum_();
    static integer ioutyp;

    /* Parameter adjustments */
    --string;

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

/*     this routine constructs the 'name' for the output variable indi- */

/* cated by loc, adding the characters to the character array 'string', */

/* beginning with the position marked by ipos. */

/* 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=blank 3/15/83 */
/*<       common /blank/ value(200000) >*/
/*<       integer nodplc(64) >*/
/*<       complex cvalue(32) >*/
/*<       equivalence (value(1),nodplc(1),cvalue(1)) >*/

/*<       dimension string(1) >*/
/*<       dimension aout(19),lenout(19),aopt(5),lenopt(5) >*/
/*<       data aout / 6hv     , 6hvm    , 6hvr    , 6hvi    , 6hvp    , >*/
/*<      1            6hvdb   , 6hi     , 6him    , 6hir    , 6hii    , >*/
/*<      2            6hip    , 6hidb   , 6honoise, 6hinoise, 6hhd2   , >*/
/*<      1            6hhd3   , 6hdim2  , 6hsim2  , 6hdim3   / >*/
/*<       data lenout / 1,2,2,2,2,3,1,2,2,2,2,3,6,6,3,3,4,4,4 / >*/
/*<       data aopt / 5hmag  , 5hreal , 5himag , 5hphase, 5hdb    / >*/
/*<       data lenopt / 3,4,4,5,2 / >*/
/*<       data alprn, acomma, arprn, ablnk / 1h(, 1h,, 1h), 1h  / >*/


/*<       ioutyp=nodplc(loc+5) >*/
    ioutyp = nodplc[*loc + 4];
/*<       if (ioutyp.ge.2) go to 10 >*/
    if (ioutyp >= 2) {
	goto L10;
    }
/*<       lout=ktype+ioutyp*6 >*/
    lout = *ktype + ioutyp * 6;
/*<       go to 20 >*/
    goto L20;
/*<    10 lout=ioutyp+11 >*/
L10:
    lout = ioutyp + 11;
/*<    20 call move(string,ipos,aout(lout),1,lenout(lout)) >*/
L20:
    move_(&string[1], ipos, &aout[lout - 1], &c__1, &lenout[lout - 1]);
/*<       ipos=ipos+lenout(lout) >*/
    *ipos += lenout[lout - 1];
/*<       if (ioutyp.ge.2) go to 200 >*/
    if (ioutyp >= 2) {
	goto L200;
    }
/*<       call move(string,ipos,alprn,1,1) >*/
    move_(&string[1], ipos, &alprn, &c__1, &c__1);
/*<       ipos=ipos+1 >*/
    ++(*ipos);
/*<       if (ioutyp.ne.0) go to 100 >*/
    if (ioutyp != 0) {
	goto L100;
    }
/*<       node1=nodplc(loc+2) >*/
    node1 = nodplc[*loc + 1];
/*<       call alfnum(nodplc(junode+node1),string,ipos) >*/
    alfnum_(&nodplc[tabinf_1.junode + node1 - 1], &string[1], ipos);
/*<       node2=nodplc(loc+3) >*/
    node2 = nodplc[*loc + 2];
/*<       if (node2.eq.1) go to 30 >*/
    if (node2 == 1) {
	goto L30;
    }
/*<       call move(string,ipos,acomma,1,1) >*/
    move_(&string[1], ipos, &acomma, &c__1, &c__1);
/*<       ipos=ipos+1 >*/
    ++(*ipos);
/*<       call alfnum(nodplc(junode+node2),string,ipos) >*/
    alfnum_(&nodplc[tabinf_1.junode + node2 - 1], &string[1], ipos);
/*<    30 call move(string,ipos,arprn,1,1) >*/
L30:
    move_(&string[1], ipos, &arprn, &c__1, &c__1);
/*<       ipos=ipos+1 >*/
    ++(*ipos);
/*<       go to 1000 >*/
    goto L1000;

/*<   100 locv=nodplc(loc+1) >*/
L100:
    locv = nodplc[*loc];
/*<       anam=value(locv) >*/
    anam = blank_1.value[locv - 1];
/*<       achar=ablnk >*/
    achar = ablnk;
/*<       do 110 i=1,8 >*/
    for (i = 1; i <= 8; ++i) {
/*<       call move(achar,1,anam,i,1) >*/
	move_(&achar, &c__1, &anam, &i, &c__1);
/*<       if (achar.eq.ablnk) go to 120 >*/
	if (achar == ablnk) {
	    goto L120;
	}
/*<       call move(string,ipos,achar,1,1) >*/
	move_(&string[1], ipos, &achar, &c__1, &c__1);
/*<       ipos=ipos+1 >*/
	++(*ipos);
/*<   110 continue >*/
/* L110: */
    }
/*<   120 call move(string,ipos,arprn,1,1) >*/
L120:
    move_(&string[1], ipos, &arprn, &c__1, &c__1);
/*<       ipos=ipos+1 >*/
    ++(*ipos);
/*<       go to 1000 >*/
    goto L1000;

/*<   200 if (ktype.eq.1) go to 1000 >*/
L200:
    if (*ktype == 1) {
	goto L1000;
    }
/*<       call move(string,ipos,alprn,1,1) >*/
    move_(&string[1], ipos, &alprn, &c__1, &c__1);
/*<       ipos=ipos+1 >*/
    ++(*ipos);
/*<       call move(string,ipos,aopt(ktype-1),1,lenopt(ktype-1)) >*/
    move_(&string[1], ipos, &aopt[*ktype - 2], &c__1, &lenopt[*ktype - 2]);
/*<       ipos=ipos+lenopt(ktype-1) >*/
    *ipos += lenopt[*ktype - 2];
/*<       call move(string,ipos,arprn,1,1) >*/
    move_(&string[1], ipos, &arprn, &c__1, &c__1);
/*<       ipos=ipos+1 >*/
    ++(*ipos);

/*  finished */

/*<  1000 return >*/
L1000:
    return 0;
/*<       end >*/
} /* outnam_ */

#undef cvalue
#undef nodplc
#undef arprn
#undef acomma
#undef alprn
#undef aopt
#undef aout
#undef ablnk


