/**********
Copyright © 1996 Norlinvest Ltd. All rights reserved.
Visual Code Model Generator, EDSpice, EDWin, EE Designer, CompCAD,
CAD 1000, CAD ABC and Visionics are trade marks of Norlinvest Ltd.
Copyright © 1983 - 1996.
*
*
Copyright 1990 Regents of the University of California.  All rights reserved.
Author: 1985 Thomas L. Quarles
**********/

#ifndef DEV
#define DEV

#include "optdefs.h"
#include "gendefs.h"
#include "ifsim.h"
#include "cktdefs.h"
#include "noisedef.h"
#include "complex.h"

#ifdef __STDC__
double DEVlimvds(double,double);
double DEVpnjlim(double,double,double,double,int*);
double DEVfetlim(double,double,double);
void DEVcmeyer(double,double,double,double,double,double,double,double,double,
        double,double,double*,double*,double*,double,double,double,double);
void DEVqmeyer(double,double,double,double,double,double*,double*,double*,
        double,double);
#ifdef notdef
void DEVcap(CKTcircuit*, double, double, double, double, double, double,
        double, double, double, double, double, double, double, double,
        double*, double*, double*, double*, double*, double*, double*,
        double*, double*, double*, double*, double*, double, double,
        double, double*, double*, double);
#endif
double DEVpred(CKTcircuit*,int);
#else /* stdc */
double DEVlimvds();
double DEVpnjlim();
double DEVfetlim();
void DEVcmeyer();
void DEVqmeyer();
#ifdef notdef
void DEVcap();
#endif
double DEVpred();
#endif /* stdc */

typedef struct SPICEdev {
    IFdevice DEVpublic;

#ifdef __STDC__
    int (*DEVparam)(int,IFvalue*,GENinstance*,IFvalue *);  
    int (*DEVmodParam)(int,IFvalue*,GENmodel*);   
    int (*DEVload)(GENmodel*,CKTcircuit*);   
    int (*DEVsetup)(SMPmatrix*,GENmodel*,CKTcircuit*,int*);  
    int (*DEVunsetup)(GENmodel*,CKTcircuit*);
    int (*DEVpzSetup)(SMPmatrix*,GENmodel*,CKTcircuit*,int*);  
    int (*DEVtemperature)(GENmodel*,CKTcircuit*);    
    int (*DEVtrunc)(GENmodel*,CKTcircuit*,double*);  
    int (*DEVfindBranch)(CKTcircuit*,GENmodel*,IFuid); 
    int (*DEVacLoad)(GENmodel*,CKTcircuit*); 
    int (*DEVaccept)(CKTcircuit*,GENmodel*); 
    void (*DEVdestroy)(GENmodel**);   
    int (*DEVmodDelete)(GENmodel**,IFuid,GENmodel*);  
    int (*DEVdelete)(GENmodel*,IFuid,GENinstance**); 
    int (*DEVsetic)(GENmodel*,CKTcircuit*);  
    int (*DEVask)(CKTcircuit*,GENinstance*,int,IFvalue*,IFvalue*);    
    int (*DEVmodAsk)(CKTcircuit*,GENmodel*,int,IFvalue*); 
    int (*DEVpzLoad)(GENmodel*,CKTcircuit*,SPcomplex*); 
    int (*DEVconvTest)(GENmodel*,CKTcircuit*);  
    int (*DEVsenSetup)(SENstruct*,GENmodel*);
    int (*DEVsenLoad)(GENmodel*,CKTcircuit*);   
    int (*DEVsenUpdate)(GENmodel*,CKTcircuit*); 
    int (*DEVsenAcLoad)(GENmodel*,CKTcircuit*); 
    void (*DEVsenPrint)(GENmodel*,CKTcircuit*);   
    int (*DEVsenTrunc)(GENmodel*,CKTcircuit*,double*);   
    int (*DEVdisto)(int,GENmodel*,CKTcircuit*);  
    int (*DEVnoise)(int, int, GENmodel*,CKTcircuit*, Ndata *, double *);
#else /* stdc */

    int (*DEVparam)();  
    int (*DEVmodParam)();
    int (*DEVload)();   
    int (*DEVsetup)(); 
    int (*DEVunsetup)(); 
    int (*DEVpzSetup)(); 
    int (*DEVtemperature)();
    int (*DEVtrunc)(); 
    int (*DEVfindBranch)(); 
    int (*DEVacLoad)(); 
    int (*DEVaccept)(); 
    void (*DEVdestroy)(); 
    int (*DEVmodDelete)();
    int (*DEVdelete)(); 
    int (*DEVsetic)(); 
    int (*DEVask)();   
    int (*DEVmodAsk)();
    int (*DEVpzLoad)(); 
    int (*DEVconvTest)();

    int (*DEVsenSetup)(); 
    int (*DEVsenLoad)(); 
    int (*DEVsenUpdate)(); 
    int (*DEVsenAcLoad)();
    void (*DEVsenPrint)();
    int (*DEVsenTrunc)();
    int (*DEVdisto)();
    int (*DEVnoise)();

#endif /* stdc */

    int *DEVinstSize;
    int *DEVmodSize;

} SPICEdev;

#ifndef HAS_MINDATA

# define IOP(a,b,c,d)   { a, b, c|IF_SET|IF_ASK,			d }
# define IOPU(a,b,c,d)   { a, b, c|IF_SET|IF_ASK|IF_UNINTERESTING,	d }
# define IOPP(a,b,c,d)  { a, b, c|IF_SET|IF_ASK|IF_PRINCIPAL,		d }
# define IOPA(a,b,c,d)  { a, b, c|IF_SET|IF_ASK|IF_AC,			d }
# define IOPAU(a,b,c,d) { a, b, c|IF_SET|IF_ASK|IF_AC|IF_UNINTERESTING,d }
# define IOPAP(a,b,c,d) { a, b, c|IF_SET|IF_ASK|IF_AC|IF_PRINCIPAL,	d }
# define IOPAA(a,b,c,d) { a, b, c|IF_SET|IF_ASK|IF_AC_ONLY,		d }
# define IOPAAU(a,b,c,d) { a, b, c|IF_SET|IF_ASK|IF_AC_ONLY|IF_UNINTERESTING,d}
# define IOPPA(a,b,c,d) { a, b, c|IF_SET|IF_ASK|IF_AC_ONLY|IF_PRINCIPAL, d }
# define IOPN(a,b,c,d)  { a, b, c|IF_SET|IF_ASK|IF_NOISE,		d }
# define IOPR(a,b,c,d)  { a, b, c|IF_SET|IF_ASK|IF_REDUNDANT,		NULL }
# define IOPX(a,b,c,d)  { a, b, c|IF_SET|IF_ASK|IF_NONSENSE,		d }
# define IOPXU(a,b,c,d)  { a, b, c|IF_SET|IF_ASK|IF_NONSENSE|IF_UNINTERESTING,\
									d }
# define IOPQ(a,b,c,d)  { a, b, c|IF_SET|IF_ASK|IF_SETQUERY,		d }
# define IOPQU(a,b,c,d)  { a, b, c|IF_SET|IF_ASK|IF_SETQUERY|IF_UNINTERESTING,\
									d }
# define IOPZ(a,b,c,d)  { a, b, c|IF_SET|IF_ASK|IF_CHKQUERY,		d }
# define IOPZU(a,b,c,d)  { a, b, c|IF_SET|IF_ASK|IF_CHKQUERY|IF_UNINTERESTING,\
									d }
# define IOPQO(a,b,c,d) { a, b, c|IF_SET|IF_ASK|IF_ORQUERY,		d }

# define IP(a,b,c,d) { a , b , c|IF_SET , d }
# define OP(a,b,c,d) { a , b , c|IF_ASK , d }
# define OPU(a,b,c,d) { a , b , c|IF_ASK|IF_UNINTERESTING , d }
# define OPR(a,b,c,d) { a , b , c|IF_ASK|IF_REDUNDANT , d }
# define P(a,b,c,d) { a , b , c , d }

#else /* HAS_MINDATA */

# define IOP(a,b,c,d)   { a, b, c|IF_SET|IF_ASK,			NULL }
# define IOPU(a,b,c,d)   { a, b, c|IF_SET|IF_ASK|IF_UNINTERESTING,	NULL }
# define IOPP(a,b,c,d)  { a, b, c|IF_SET|IF_ASK|IF_PRINCIPAL,		NULL }
# define IOPA(a,b,c,d)  { a, b, c|IF_SET|IF_ASK|IF_AC,			NULL }
# define IOPAU(a,b,c,d) { a, b, c|IF_SET|IF_ASK|IF_AC|IF_UNINTERESTING, NULL }
# define IOPAP(a,b,c,d) { a, b, c|IF_SET|IF_ASK|IF_AC|IF_PRINCIPAL,	NULL }
# define IOPAA(a,b,c,d) { a, b, c|IF_SET|IF_ASK|IF_AC_ONLY,		NULL }
# define IOPAAU(a,b,c,d) { a, b, c|IF_SET|IF_ASK|IF_AC_ONLY|IF_UNINTERESTING,\
									NULL }
# define IOPPA(a,b,c,d) { a, b, c|IF_SET|IF_ASK|IF_AC_ONLY|IF_PRINCIPAL,NULL }
# define IOPN(a,b,c,d)  { a, b, c|IF_SET|IF_ASK|IF_NOISE,		NULL }
# define IOPR(a,b,c,d)  { a, b, c|IF_SET|IF_ASK|IF_REDUNDANT,		NULL }
# define IOPX(a,b,c,d)  { a, b, c|IF_SET|IF_ASK|IF_NONSENSE,		NULL }
# define IOPXU(a,b,c,d)  { a, b, c|IF_SET|IF_ASK|IF_NONSENSE|IF_UNINTERESTING,\
									NULL }
# define IOPQ(a,b,c,d)  { a, b, c|IF_SET|IF_ASK|IF_SETQUERY,		NULL }
# define IOPQU(a,b,c,d)  { a, b, c|IF_SET|IF_ASK|IF_SETQUERY|IF_UNINTERESTING,\
									NULL }
# define IOPZ(a,b,c,d)  { a, b, c|IF_SET|IF_ASK|IF_CHKQUERY,		NULL }
# define IOPZU(a,b,c,d)  { a, b, c|IF_SET|IF_ASK|IF_CHKQUERY|IF_UNINTERESTING,\
									NULL }
# define IOPQO(a,b,c,d) { a, b, c|IF_SET|IF_ASK|IF_ORQUERY,		NULL }

# define IP(a,b,c,d) { a, b, c|IF_SET , NULL }
# define OP(a,b,c,d) { a, b, c|IF_ASK , NULL }
# define OPU(a,b,c,d) { a , b , c|IF_ASK|IF_UNINTERESTING , NULL }
# define OPR(a,b,c,d) { a , b , c|IF_ASK|IF_REDUNDANT , NULL }
# define P(a,b,c,d) { a, b, c , NULL }

#endif /* HAS_MINDATA */

#define DEV_DEFAULT	0x1

#endif /*DEV*/
