/* alter.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 {
    doublereal atime, aprog[3], adate, atitle[10], defl, defw, defad, defas, 
	    rstats[50];
    integer iwidth, lwidth, nopage;
} miscel_;

#define miscel_1 miscel_

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__0 = 0;
static integer c__1 = 1;

/*<       subroutine alter >*/
/* Subroutine */ int alter_()
{
    /* Initialized data */

    static struct {
	char e_1[32];
	doublereal e_2;
	} equiv_16 = { {'c', 'h', 'a', 'n', 'g', 'e', ' ', 'f', 'o', 'l', 'l',
		 'o', 'w', 'i', 'n', 'g', ' ', 'p', 'a', 'r', 'a', 'm', 'e', 
		't', 'e', 'r', 's', ' ', ' ', ' ', ' ', ' '}, 0. };

#define chtitl ((doublereal *)&equiv_16)

    static integer lnod[50] = { 10,14,16,8,15,16,15,16,13,8,18,38,27,35,8,8,
	    35,5,5,5,5,5,5,5,0,0,0,0,0,0,21,21,21,21,21,21,21,21,21,21,8,8,8,
	    8,8,0,0,0,0,0 };
    static integer lval[50] = { 5,4,4,2,1,1,1,1,4,4,3,4,4,16,1,1,9,2,1,1,19,
	    55,17,46,0,0,0,0,0,0,1,1,1,1,1,17,17,17,17,17,1,1,1,1,1,0,0,0,0,0 
	    };

    /* Format strings */
    static char fmt_110[] = "(\002********      \002,a8,\002      *******\
*\002)";
    static char fmt_360[] = "(//)";
    static char fmt_401[] = "(\0020*error*:  parameter change failed\002,/\
,\0020*******:  \002,a8,\002 is not in the original circuit\002)";

    /* System generated locals */
    integer i_1, i_2;

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

    /* Local variables */
    static integer itab, locv, nogo;
    extern integer xxor_();
    static integer locv1;
    extern /* Subroutine */ int copy8_(), title_(), cpytb4_(), cpytb8_();
    static integer id;
#define nodplc ((integer *)&blank_1)
#define cvalue ((complex *)&blank_1)
    extern logical memptr_();
    extern /* Subroutine */ int clrmem_();
    static integer loc, loc1;

    /* Fortran I/O blocks */
    static cilist io__11 = { 0, 0, 0, fmt_110, 0 };
    static cilist io__13 = { 0, 0, 0, fmt_360, 0 };
    static cilist io__14 = { 0, 0, 0, fmt_401, 0 };


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

/*     this routine changes the element or device parameters */

/* 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=miscel 3/15/83 */
/*<       common /miscel/ atime,aprog(3),adate,atitle(10),defl,defw,defad, >*/
/*<      1  defas,rstats(50),iwidth,lwidth,nopage >*/
/* 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)) >*/
/*<       logical memptr >*/

/*<       integer xxor >*/
/*<       dimension lnod(50),lval(50) >*/
/*<       dimension chtitl(4) >*/
/*<       data chtitl / 8hchange f,8hollowing,8h paramet,8hers     / >*/
/*<       data lnod /10,14,16, 8,15,16,15,16,13, 8, >*/
/*<      1           18,38,27,35, 8, 8,35, 5, 5, 5, >*/
/*<      2            5, 5, 5, 5, 0, 0, 0, 0, 0, 0, >*/
/*<      3           21,21,21,21,21,21,21,21,21,21, >*/
/*<      4            8, 8, 8, 8, 8, 0, 0, 0, 0, 0 / >*/
/*<       data lval / 5, 4, 4, 2, 1, 1, 1, 1, 4, 4, >*/
/*<      1            3, 4, 4,16, 1, 1, 9, 2, 1, 1, >*/
/*<      2           19,55,17,46, 0, 0, 0, 0, 0, 0, >*/
/*<      3            1, 1, 1, 1, 1,17,17,17,17,17, >*/
/*<      4            1, 1, 1, 1, 1, 0, 0, 0, 0, 0 / >*/

/*<       call title (0,lwidth,1,chtitl) >*/
    title_(&c__0, &miscel_1.lwidth, &c__1, chtitl);
/*<       do 350 id=1,24 >*/
    for (id = 1; id <= 24; ++id) {
/*<       loc=locate(id) >*/
	loc = cirdat_1.locate[id - 1];
/*<    10 if (loc.eq.0) go to 350 >*/
L10:
	if (loc == 0) {
	    goto L350;
	}
/*<       if (nodplc(loc+lnod(id)-2).ne.numcyc) go to 300 >*/
	if (nodplc[loc + lnod[id - 1] - 3] != cirdat_1.numcyc) {
	    goto L300;
	}
/*<       locv=nodplc(loc+1) >*/
	locv = nodplc[loc];
/*<       loc1=locate(id) >*/
	loc1 = cirdat_1.locate[id - 1];
/*<    50 if (loc1.eq.0) go to 400 >*/
L50:
	if (loc1 == 0) {
	    goto L400;
	}
/*<       if (nodplc(loc1+lnod(id)-2).ne.0) go to 400 >*/
	if (nodplc[loc1 + lnod[id - 1] - 3] != 0) {
	    goto L400;
	}
/*<       locv1=nodplc(loc1+1) >*/
	locv1 = nodplc[loc1];
/*<       if (xxor(value(locv),value(locv1)).eq.0) go to 100 >*/
	if (xxor_(&blank_1.value[locv - 1], &blank_1.value[locv1 - 1]) == 0) {

	    goto L100;
	}
/*<       loc1=nodplc(loc1) >*/
	loc1 = nodplc[loc1 - 1];
/*<       go to 50 >*/
	goto L50;

/*  copy changed values to the original tables */

/*  copy real part */

/*<   100 call copy8(value(locv),value(locv1),lval(id)) >*/
L100:
	copy8_(&blank_1.value[locv - 1], &blank_1.value[locv1 - 1], &lval[id 
		- 1]);
/*<       write (iofile,110) value(locv1) >*/
	io__11.ciunit = status_1.iofile;
	s_wsfe(&io__11);
	do_fio(&c__1, (char *)&blank_1.value[locv1 - 1], (ftnlen)sizeof(
		doublereal));
	e_wsfe();
/*<   110 format ('********      ',a8,'      ********') >*/

/*  treat non-node tables specially */

/*<   200 if (id.ge.11) go to 300 >*/
/* L200: */
	if (id >= 11) {
	    goto L300;
	}
/*<       go to (300,210,220,300,230,240,230,240,260,260), id >*/
	switch (id) {
	    case 1:  goto L300;
	    case 2:  goto L210;
	    case 3:  goto L220;
	    case 4:  goto L300;
	    case 5:  goto L230;
	    case 6:  goto L240;
	    case 7:  goto L230;
	    case 8:  goto L240;
	    case 9:  goto L260;
	    case 10:  goto L260;
	}
/*<   210 if (nodplc(loc+4).eq.1) go to 300 >*/
L210:
	if (nodplc[loc + 3] == 1) {
	    goto L300;
	}
/*<       if (memptr(nodplc(loc1+7))) call clrmem(nodplc(loc1+7)) >*/
	if (memptr_(&nodplc[loc1 + 6])) {
	    clrmem_(&nodplc[loc1 + 6]);
	}
/*<       call cpytb8(loc+7,loc1+7) >*/
	i_1 = loc + 7;
	i_2 = loc1 + 7;
	cpytb8_(&i_1, &i_2);
/*<       go to 300 >*/
	goto L300;
/*<   220 if (nodplc(loc+4).eq.1) go to 300 >*/
L220:
	if (nodplc[loc + 3] == 1) {
	    goto L300;
	}
/*<       if (memptr(nodplc(loc1+10))) call clrmem(nodplc(loc1+10)) >*/
	if (memptr_(&nodplc[loc1 + 9])) {
	    clrmem_(&nodplc[loc1 + 9]);
	}
/*<       call cpytb8(loc+10,loc1+10) >*/
	i_1 = loc + 10;
	i_2 = loc1 + 10;
	cpytb8_(&i_1, &i_2);
/*<       go to 300 >*/
	goto L300;
/*<   230 itab=5 >*/
L230:
	itab = 5;
/*<       go to 250 >*/
	goto L250;
/*<   240 itab=6 >*/
L240:
	itab = 6;
/*<   250 if (id.le.6) go to 255 >*/
L250:
	if (id <= 6) {
	    goto L255;
	}
/*<       if (memptr(nodplc(loc1+itab+1))) call clrmem(nodplc(loc1+itab+1)) >*/
	if (memptr_(&nodplc[loc1 + itab])) {
	    clrmem_(&nodplc[loc1 + itab]);
	}
/*<       call cpytb4(loc+itab+1,loc1+itab+1) >*/
	i_1 = loc + itab + 1;
	i_2 = loc1 + itab + 1;
	cpytb4_(&i_1, &i_2);
/*<   255 if (memptr(nodplc(loc1+itab+2))) call clrmem(nodplc(loc1+itab+2)) >*/
L255:
	if (memptr_(&nodplc[loc1 + itab + 1])) {
	    clrmem_(&nodplc[loc1 + itab + 1]);
	}
/*<       call cpytb4(loc+itab+2,loc1+itab+2) >*/
	i_1 = loc + itab + 2;
	i_2 = loc1 + itab + 2;
	cpytb4_(&i_1, &i_2);
/*<       if (memptr(nodplc(loc1+itab+3))) call clrmem(nodplc(loc1+itab+3)) >*/
	if (memptr_(&nodplc[loc1 + itab + 2])) {
	    clrmem_(&nodplc[loc1 + itab + 2]);
	}
/*<       call cpytb8(loc+itab+3,loc1+itab+3) >*/
	i_1 = loc + itab + 3;
	i_2 = loc1 + itab + 3;
	cpytb8_(&i_1, &i_2);
/*<       if (memptr(nodplc(loc1+itab+4))) call clrmem(nodplc(loc1+itab+4)) >*/
	if (memptr_(&nodplc[loc1 + itab + 3])) {
	    clrmem_(&nodplc[loc1 + itab + 3]);
	}
/*<       call cpytb8(loc+itab+4,loc1+itab+4) >*/
	i_1 = loc + itab + 4;
	i_2 = loc1 + itab + 4;
	cpytb8_(&i_1, &i_2);
/*<       if (memptr(nodplc(loc1+itab+5))) call clrmem(nodplc(loc1+itab+5)) >*/
	if (memptr_(&nodplc[loc1 + itab + 4])) {
	    clrmem_(&nodplc[loc1 + itab + 4]);
	}
/*<       call cpytb4(loc+itab+5,loc1+itab+5) >*/
	i_1 = loc + itab + 5;
	i_2 = loc1 + itab + 5;
	cpytb4_(&i_1, &i_2);
/*<       if (memptr(nodplc(loc1+itab+6))) call clrmem(nodplc(loc1+itab+6)) >*/
	if (memptr_(&nodplc[loc1 + itab + 5])) {
	    clrmem_(&nodplc[loc1 + itab + 5]);
	}
/*<       call cpytb8(loc+itab+6,loc1+itab+6) >*/
	i_1 = loc + itab + 6;
	i_2 = loc1 + itab + 6;
	cpytb8_(&i_1, &i_2);
/*<       go to 300 >*/
	goto L300;
/*<   260 if (memptr(nodplc(loc1+5))) call clrmem(nodplc(loc1+5)) >*/
L260:
	if (memptr_(&nodplc[loc1 + 4])) {
	    clrmem_(&nodplc[loc1 + 4]);
	}
/*<       call cpytb8(loc+5,loc1+5) >*/
	i_1 = loc + 5;
	i_2 = loc1 + 5;
	cpytb8_(&i_1, &i_2);

/*<   300 loc=nodplc(loc) >*/
L300:
	loc = nodplc[loc - 1];
/*<       go to 10 >*/
	goto L10;
/*<   350 continue >*/
L350:
    ;}
/*<       write (iofile,360) >*/
    io__13.ciunit = status_1.iofile;
    s_wsfe(&io__13);
    e_wsfe();
/*<   360 format (//) >*/
/*<       go to 500 >*/
    goto L500;

/*<   400 write (iofile,401) value(nodplc(loc1+1)) >*/
L400:
    io__14.ciunit = status_1.iofile;
    s_wsfe(&io__14);
    do_fio(&c__1, (char *)&blank_1.value[nodplc[loc1] - 1], (ftnlen)sizeof(
	    doublereal));
    e_wsfe();
/*<   401 format ('0*error*:  parameter change failed',/, >*/
/*<      1        '0*******:  ',a8,' is not in the original circuit') >*/
/*<       nogo=1 >*/
    nogo = 1;

/*<   500 return >*/
L500:
    return 0;
/*<       end >*/
} /* alter_ */

#undef cvalue
#undef nodplc
#undef chtitl


