diff --git a/configure.ac b/configure.ac index 210dc8e89..a7ef508bc 100644 --- a/configure.ac +++ b/configure.ac @@ -932,11 +932,6 @@ fi # Recapitulate settings: AC_MSG_RESULT([Settings which were chosen:]) -if test "x$enable_sense2" = xyes; then - AC_DEFINE([WANT_SENSE2], [], [Define if we want spice2 sensitivity analysis]) - AC_MSG_RESULT([Spice2 sensitivity analysis enabled]) - AC_MSG_WARN([This feature is UNSUPPORTED]) -fi if test "x$enable_nobypass" = xyes; then AC_DEFINE([NOBYPASS], [], [Define if we want NOBYPASS]) AC_MSG_RESULT([NOBYPASS option enabled]) @@ -1309,7 +1304,6 @@ AC_CONFIG_FILES([Makefile src/xspice/enh/Makefile src/xspice/ipc/Makefile src/xspice/idn/Makefile - src/unsupported/Makefile tests/Makefile tests/bsim1/Makefile tests/bsim2/Makefile diff --git a/src/Makefile.am b/src/Makefile.am index 03ded012e..826d0f90f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,7 +1,7 @@ ## Process this file with automake to produce Makefile.in SUBDIRS = include/ngspice misc maths frontend spicelib -DIST_SUBDIRS = include/ngspice misc maths frontend spicelib xspice ciderlib unsupported +DIST_SUBDIRS = include/ngspice misc maths frontend spicelib xspice ciderlib if XSPICE_WANTED SUBDIRS += xspice @@ -11,10 +11,6 @@ if CIDER_WANTED SUBDIRS += ciderlib endif -if SENSE2_WANTED -SUBDIRS += unsupported -endif - if !TCL_MODULE if !SHARED_MODULE bin_PROGRAMS = ngspice @@ -154,10 +150,6 @@ ngspice_LDADD += \ spicelib/analysis/libckt.la \ spicelib/devices/libdev.la -if SENSE2_WANTED -ngspice_LDADD += unsupported/libunsupported.la -endif - if XSPICE_WANTED ngspice_LDADD += \ xspice/cm/libcmxsp.la \ diff --git a/src/unsupported/Makefile.am b/src/unsupported/Makefile.am deleted file mode 100644 index 650630841..000000000 --- a/src/unsupported/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ -## Process this file with automake to produce Makefile.in - -EXTRA_DIST = readme spiced.c - -noinst_LTLIBRARIES = libunsupported.la - -libunsupported_la_SOURCES = \ - cktsenac.c \ - cktsenup.c \ - cktsncom.c \ - cktsndct.c \ - cktsnset.c \ - cktsnld.c \ - cktsnprt.c \ - sen2dest.c \ - sen2setp.c \ - snaskq.c \ - snstart.c - - -AM_CPPFLAGS = @AM_CPPFLAGS@ -I$(top_srcdir)/src/include -AM_CFLAGS = $(STATIC) -MAINTAINERCLEANFILES = Makefile.in diff --git a/src/unsupported/cktsenac.c b/src/unsupported/cktsenac.c deleted file mode 100644 index dd7d5a618..000000000 --- a/src/unsupported/cktsenac.c +++ /dev/null @@ -1,46 +0,0 @@ -/********** -Copyright 1990 Regents of the University of California. All rights reserved. -Author: 1985 Thomas L. Quarles -**********/ - -#include "ngspice/ngspice.h" -#include -#include "ngspice/smpdefs.h" -#include "ngspice/cktdefs.h" -#include "ngspice/devdefs.h" -#include "ngspice/sperror.h" -#include "ngspice/trandefs.h" -#include "ngspice/suffix.h" - - -/* CKTsenAC(ckt) - * this is a routine for AC sensitivity calculations - */ - -int -CKTsenAC(CKTcircuit *ckt) -{ - int error; - -#ifdef SENSDEBUG - printf("CKTsenAC\n"); -#endif - - error = CKTsenLoad(ckt); - if (error) - return error; - -#ifdef SENSDEBUG - printf("after CKTsenLoad\n"); -#endif - - error = CKTsenComp(ckt); - if (error) - return error; - -#ifdef SENSDEBUG - printf("after CKTsenComp\n"); -#endif - - return OK; -} diff --git a/src/unsupported/cktsenup.c b/src/unsupported/cktsenup.c deleted file mode 100644 index 0ce1acfbd..000000000 --- a/src/unsupported/cktsenup.c +++ /dev/null @@ -1,36 +0,0 @@ -/********** -Copyright 1990 Regents of the University of California. All rights reserved. -Author: 1985 Thomas L. Quarles -**********/ - -/* CKTsenUpdate(ckt) - * this is a driver program to iterate through all the various - * sensitivity update functions provided for the circuit elements - * in the given circuit - */ - -#include "ngspice/ngspice.h" -#include -#include "ngspice/smpdefs.h" -#include "ngspice/cktdefs.h" -#include "ngspice/devdefs.h" -#include "ngspice/sperror.h" -#include "ngspice/trandefs.h" -#include "ngspice/suffix.h" - - -int -CKTsenUpdate(CKTcircuit *ckt) -{ - int i; - int error; - - for (i = 0; i < DEVmaxnum; i++) - if (DEVices[i] && DEVices[i]->DEVsenUpdate && ckt->CKThead[i]) { - error = DEVices[i]->DEVsenUpdate (ckt->CKThead[i], ckt); - if (error) - return error; - } - - return OK; -} diff --git a/src/unsupported/cktsncom.c b/src/unsupported/cktsncom.c deleted file mode 100644 index 5fc0b905e..000000000 --- a/src/unsupported/cktsncom.c +++ /dev/null @@ -1,191 +0,0 @@ -/********** -Copyright 1990 Regents of the University of California. All rights reserved. -Author: 1985 Thomas L. Quarles -**********/ - -/* CKTsenComp(ckt) - * this is a program to solve the sensitivity equation - * of the given circuit - */ - -#include "ngspice/ngspice.h" -#include -#include "ngspice/smpdefs.h" -#include "ngspice/cktdefs.h" -#include "ngspice/devdefs.h" -#include "ngspice/sperror.h" -#include "ngspice/trandefs.h" -#include "ngspice/suffix.h" - -// #include "../maths/sparse/spdefs.h" -// -// this include file from `sparse' is incompatible -// with the rest of ngspice -// so we can unfortunatly not include here -// instead we cheat a bit and -// introduce the opaque struct MatrixElement here -// (only the first struct members which are of importance to us) - -struct MatrixElement -{ - double Real; - double Imag; - // ... -}; - - -int -CKTsenComp(CKTcircuit *ckt) -{ - int size; - int row; - int col; - SENstruct *info; - -#ifdef SENSDEBUG - char *rowe; - SMPelement *elt; -#endif - -#ifdef SENSDEBUG - printf("CKTsenComp\n"); -#endif - - size = SMPmatSize(ckt->CKTmatrix); - info = ckt->CKTsenInfo; - - if ((info->SENmode == DCSEN) || (info->SENmode == TRANSEN)) { - - /* loop throgh all the columns of RHS - matrix - each column corresponding to a design - parameter */ - - for (col = 1; col <= info->SENparms; col++) { - - for (row = 1; row <= size; row++) { - ckt->CKTsenRhs[row] = info->SEN_RHS[row][col]; - } - - /* solve for the sensitivity values */ - SMPsolve(ckt->CKTmatrix, ckt->CKTsenRhs, ckt->CKTrhsSpare); - - /* store the sensitivity values */ - for (row = 1; row <= size; row++) { - info->SEN_Sap[row][col] = ckt->CKTsenRhs[row]; - info->SEN_RHS[row][col] = ckt->CKTsenRhs[row]; - } - } - -#ifdef SENSDEBUG - printf("\n"); - printf("Sensitivity matrix :\n"); - - for (row = 1; row <= size; row++) { - rowe = CKTnodName(ckt, row); -// if (strcmp("4", rowe) == 0) { - for (col = 1; col <= info->SENparms; col++) { - printf("\t"); - printf("Sap(%s,%d) = %.5e\t", rowe, col, - info->SEN_Sap[row][col]); - } - printf("\n\n"); -// } - } - - printf(" RHS matrix :\n"); - for (row = 1; row <= size; row++) { - for (col = 1; col <= info->SENparms; col++) { - printf(" "); - printf("RHS(%d,%d) = %.7e ", row, col, - info->SEN_RHS[row][col]); - } - printf("\n"); - } - - printf(" Jacobian matrix :\n"); - for (row = 1; row <= size; row++) { - for (col = 1; col <= size; col++) { - elt = SMPfindElt(ckt->CKTmatrix, row , col , 0); - if (elt) - printf("%.7e ", elt->Real); - else - printf("0.0000000e+00 "); - } - printf("\n"); - } -#endif - - } - - if (info->SENmode == ACSEN) { - - /* loop throgh all the columns of RHS - matrix - each column corresponding to a design - parameter */ - - for (col = 1; col <= info->SENparms; col++) { - - for (row = 1; row <= size; row++) { - ckt->CKTsenRhs[row] = info->SEN_RHS[row][col]; - ckt->CKTseniRhs[row] = info->SEN_iRHS[row][col]; - } - - /* solve for the sensitivity values ( both real and imag parts)*/ - SMPcSolve(ckt->CKTmatrix, ckt->CKTsenRhs, ckt->CKTseniRhs, - ckt->CKTrhsSpare, ckt->CKTirhsSpare); - - /* store the sensitivity values ( both real and imag parts)*/ - for (row = 1; row <= size; row++) { - info->SEN_RHS[row][col] = ckt->CKTsenRhs[row]; - info->SEN_iRHS[row][col] = ckt->CKTseniRhs[row]; - } - } - -#ifdef SENSDEBUG - printf("\n"); - printf("CKTomega = %.7e rad/sec\t\n", ckt->CKTomega); - printf("Sensitivity matrix :\n"); - for (row = 1; row <= size; row++) { - rowe = CKTnodName(ckt, row); - for (col = 1; col <= info->SENparms; col++) { - printf("\t"); - printf("RHS(%s,%d) = %.5e", rowe, col, - info->SEN_RHS[row][col]); - printf(" + j %.5e\t", info->SEN_iRHS[row][col]); - printf("\n\n"); - } - printf("\n"); - } - - printf("CKTomega = %.7e rad/sec\t\n", ckt->CKTomega); - printf(" RHS matrix :\n"); - for (row = 1; row <= size; row++) { - for (col = 1; col <= info->SENparms; col++) { - printf(" "); - printf("RHS(%d,%d) = %.7e ", row, col, - info->SEN_RHS[row][col]); - printf("+j %.7e ", info->SEN_iRHS[row][col]); - } - printf("\n"); - } - - printf(" Jacobian matrix for AC :\n"); - for (row = 1; row <= size; row++) { - for (col = 1; col <= size; col++) { - elt = SMPfindElt(ckt->CKTmatrix, row , col , 0); - if (elt) { - printf("%.7e ", elt->Real); - printf("+j%.7e\t", elt->Imag); - } else{ - printf("0.0000000e+00 "); - printf("+j0.0000000e+00\t"); - } - } - printf("\n\n"); - } -#endif - - } - - return OK; -} diff --git a/src/unsupported/cktsndct.c b/src/unsupported/cktsndct.c deleted file mode 100644 index fbb697c50..000000000 --- a/src/unsupported/cktsndct.c +++ /dev/null @@ -1,85 +0,0 @@ -/********** -Copyright 1990 Regents of the University of California. All rights reserved. -Author: 1985 Thomas L. Quarles -**********/ - -/* - * This routine performs the DC and Transient sensitivity - * calculations - */ - -#include "ngspice/ngspice.h" -#include -#include "ngspice/smpdefs.h" -#include "ngspice/cktdefs.h" -#include "ngspice/devdefs.h" -#include "ngspice/sperror.h" -#include "ngspice/trandefs.h" -#include "ngspice/suffix.h" - - -int -CKTsenDCtran(CKTcircuit *ckt) -{ - int error; - -#ifdef SENSDEBUG - printf("time = %.7e\n", ckt->CKTtime); - printf("CKTsenDCtran\n"); -#endif - - if (ckt->CKTsenInfo && (ckt->CKTsenInfo->SENmode & TRANSEN) && - (ckt->CKTmode & MODEINITTRAN)) - { - error = CKTsenLoad(ckt); - if (error) - return error; - -#ifdef SENSDEBUG - printf("after inittran senload\n"); -#endif - error = CKTsenUpdate(ckt); - if (error) - return error; - -#ifdef SENSDEBUG - printf("after inittran senupdate\n"); -#endif - - } - - if (ckt->CKTsenInfo && (ckt->CKTsenInfo->SENmode & TRANSEN) && - !(ckt->CKTmode & MODETRANOP)) - { - ckt->CKTmode = (ckt->CKTmode & (~INITF)) | MODEINITFLOAT; - } - - error = CKTsenLoad(ckt); - if (error) - return error; - -#ifdef SENSDEBUG - printf("after CKTsenLoad\n"); -#endif - - error = CKTsenComp(ckt); - if (error) - return error; - -#ifdef SENSDEBUG - printf("after CKTsenComp\n"); -#endif - - if (ckt->CKTsenInfo && (ckt->CKTsenInfo->SENmode & TRANSEN)) { - error = CKTsenUpdate(ckt); - if (error) - return error; - -#ifdef SENSDEBUG - printf("after CKTsenUpdate\n"); -#endif - - } - - return OK; -} diff --git a/src/unsupported/cktsnld.c b/src/unsupported/cktsnld.c deleted file mode 100644 index 7afeaf3a5..000000000 --- a/src/unsupported/cktsnld.c +++ /dev/null @@ -1,67 +0,0 @@ -/********** -Copyright 1990 Regents of the University of California. All rights reserved. -Author: 1985 Thomas L. Quarles -**********/ - -/* - * CKTsenLoad(ckt) - * this is a driver program to iterate through all the various - * sensitivity load functions provided for the circuit elements - * in the given circuit - */ - -#include "ngspice/ngspice.h" -#include -#include "ngspice/smpdefs.h" -#include "ngspice/cktdefs.h" -#include "ngspice/devdefs.h" -#include "ngspice/sperror.h" -#include "ngspice/trandefs.h" -#include "ngspice/suffix.h" - - -int -CKTsenLoad(CKTcircuit *ckt) -{ - int i; - int size,row,col; - int error; - - size = SMPmatSize(ckt->CKTmatrix); - -#ifdef SENSDEBUG - printf("CKTsenLoad\n"); -#endif - - if ((ckt->CKTsenInfo->SENmode == DCSEN) || - (ckt->CKTsenInfo->SENmode == TRANSEN)) - { - for (col = 0; col <= ckt->CKTsenInfo->SENparms; col++) - for (row = 0; row <= size; row++) - ckt->CKTsenInfo->SEN_RHS[row][col] = 0; - - for (i = 0; i < DEVmaxnum; i++) - if (DEVices[i] && DEVices[i]->DEVsenLoad && ckt->CKThead[i]) { - error = DEVices[i]->DEVsenLoad (ckt->CKThead[i], ckt); - if (error) - return error; - } - - } else { - - for (col = 0; col <= ckt->CKTsenInfo->SENparms; col++) - for (row = 0; row <= size; row++) { - ckt->CKTsenInfo->SEN_RHS[row][col] = 0; - ckt->CKTsenInfo->SEN_iRHS[row][col] = 0; - } - - for (i = 0; i < DEVmaxnum; i++) - if (DEVices[i] && DEVices[i]->DEVsenAcLoad && ckt->CKThead[i]) { - error = DEVices[i]->DEVsenAcLoad (ckt->CKThead[i], ckt); - if (error) - return error; - } - } - - return OK; -} diff --git a/src/unsupported/cktsnprt.c b/src/unsupported/cktsnprt.c deleted file mode 100644 index c0a6801c8..000000000 --- a/src/unsupported/cktsnprt.c +++ /dev/null @@ -1,30 +0,0 @@ -/********** -Copyright 1990 Regents of the University of California. All rights reserved. -Author: 1985 Thomas L. Quarles -**********/ - -#include "ngspice/ngspice.h" -#include -#include "ngspice/smpdefs.h" -#include "ngspice/cktdefs.h" -#include "ngspice/devdefs.h" -#include "ngspice/sperror.h" -#include "ngspice/trandefs.h" -#include "ngspice/suffix.h" - - -/* CKTsenPrint(ckt) - * this is a driver program to iterate through all the - * various sensitivity print functions provided for - * the circuit elements in the given circuit - */ - -void -CKTsenPrint(CKTcircuit *ckt) -{ - int i; - - for (i = 0; i < DEVmaxnum; i++) - if (DEVices[i] && DEVices[i]->DEVsenPrint && ckt->CKThead[i]) - DEVices[i]->DEVsenPrint (ckt->CKThead[i], ckt); -} diff --git a/src/unsupported/cktsnset.c b/src/unsupported/cktsnset.c deleted file mode 100644 index d2984acce..000000000 --- a/src/unsupported/cktsnset.c +++ /dev/null @@ -1,50 +0,0 @@ -/********** -Copyright 1990 Regents of the University of California. All rights reserved. -Author: 1985 Thomas L. Quarles -**********/ - - -/* - * CKTsenSetup(ckt) - * this is a driver program to iterate through all the various - * sensitivity setup functions provided for the circuit elements - * in the given circuit - */ - -#include "ngspice/ngspice.h" -#include -#include "ngspice/smpdefs.h" -#include "ngspice/cktdefs.h" -#include "ngspice/devdefs.h" -#include "ngspice/sperror.h" -#include "ngspice/trandefs.h" -#include "ngspice/suffix.h" - - -int -CKTsenSetup(CKTcircuit *ckt) -{ - int i; - int error; - SENstruct *info; - -#ifdef SENSDEBUG - printf("CKTsenSetup\n"); -#endif - - info = ckt->CKTsenInfo; - info->SENparms = 0; - - for (i = 0; i < DEVmaxnum; i++) - if (DEVices[i] && DEVices[i]->DEVsenSetup && ckt->CKThead[i]) { - error = DEVices[i]->DEVsenSetup (info, ckt->CKThead[i]); - if (error) - return error; - } - -#ifdef SENSDEBUG - printf("CKTsenSetup end\n"); -#endif - - return OK; -} diff --git a/src/unsupported/readme b/src/unsupported/readme deleted file mode 100644 index 85678fdb8..000000000 --- a/src/unsupported/readme +++ /dev/null @@ -1,5 +0,0 @@ - -This directory contains code for an old, unsupported sensitivity analysis. -It is not used in the current distribution and will be removed in the -future. - diff --git a/src/unsupported/sen2dest.c b/src/unsupported/sen2dest.c deleted file mode 100644 index fa9f4be7d..000000000 --- a/src/unsupported/sen2dest.c +++ /dev/null @@ -1,73 +0,0 @@ -/********** -Copyright 1990 Regents of the University of California. All rights reserved. -Author: 1985 Thomas L. Quarles -**********/ - -/* SENdestroy(ckt) - * this is a driver program to iterate through all the various - * destroy functions provided for the circuit elements in the - * given circuit - */ - -#include "ngspice/ngspice.h" -#include -#include "ngspice/cktdefs.h" -#include "ngspice/devdefs.h" -#include "ngspice/ifsim.h" -#include "ngspice/sperror.h" -#include "ngspice/suffix.h" - -void -SENdestroy(SENstruct *info) -{ - int i; - int size; - - size = info->SENsize; - -#ifdef SENSDEBUG - printf("size = %d\n", size); - printf("freeing sensitivity structure in SENdestroy\n"); -#endif - - /* - if (info->SENdevices) FREE(info->SENdevices); - if (info->SENparmNames) FREE(info->SENparmNames); - */ - - if (info->SEN_Sap) { - -#ifdef SENSDEBUG - printf("freeing SEN_Sap in SENdestroy\n"); -#endif - - for (i = 0; i <= size; i++) - if (info->SEN_Sap[i]) - FREE(info->SEN_Sap[i]); - FREE(info->SEN_Sap); - } - - if (info->SEN_RHS) { - for (i = 0; i <= size; i++) - if (info->SEN_RHS[i]) - FREE(info->SEN_RHS[i]); - FREE(info->SEN_RHS); - } - - if (info->SEN_iRHS) { - for (i = 0; i <= size; i++) - if (info->SEN_iRHS[i]) - FREE(info->SEN_iRHS[i]); - FREE(info->SEN_Sap); - } - - /* - FREE(info); - */ - -#ifdef SENSDEBUG - printf("SENdestroy end\n"); -#endif - - return; -} diff --git a/src/unsupported/sen2setp.c b/src/unsupported/sen2setp.c deleted file mode 100644 index a571afea1..000000000 --- a/src/unsupported/sen2setp.c +++ /dev/null @@ -1,96 +0,0 @@ -/********** -Copyright 1990 Regents of the University of California. All rights reserved. -Author: 1985 Thomas L. Quarles -**********/ - -#include "ngspice/ngspice.h" -#include -#include "ngspice/ifsim.h" -#include "ngspice/iferrmsg.h" -#include "ngspice/sen2defs.h" -#include "ngspice/cktdefs.h" -#include "ngspice/suffix.h" -#include "../spicelib/analysis/analysis.h" - - -int -SENsetParm(CKTcircuit *ckt, JOB *anal, int which, IFvalue *value) -{ - SENstruct *job = (SENstruct *) anal; - - NG_IGNORE(ckt); - - switch(which) { - - case SEN_DC: - if (value->iValue) - job->SENmode |= DCSEN; - break; - - case SEN_AC: - if (value->iValue) - job->SENmode |= ACSEN; - break; - - case SEN_TRAN: - if (value->iValue) - job->SENmode |= TRANSEN; - break; - - case SEN_DEV: - job->SENnumVal += 1; - if (!job->SENdevices) { - job->SENdevices = TMALLOC(char *, job->SENnumVal); - if (job->SENdevices == NULL) - return E_NOMEM; - job->SENparmNames = TMALLOC(char *, job->SENnumVal); - if (job->SENparmNames == NULL) - return E_NOMEM; - } else { - job->SENdevices = TREALLOC(char *, job->SENdevices, job->SENnumVal); - if (job->SENdevices == NULL) - return E_NOMEM; - job->SENparmNames = TREALLOC(char *, job->SENparmNames, job->SENnumVal); - if (job->SENparmNames == NULL) - return E_NOMEM; - } - job->SENdevices [job->SENnumVal - 1] = value->sValue; - break; - - case SEN_PARM: - job->SENparmNames [job->SENnumVal - 1] = value->sValue; - break; - - default: - return E_BADPARM; - } - - return OK; -} - - -static IFparm SENparms[] = { - { "dc", SEN_DC, IF_SET|IF_FLAG, "sensitivity in DC analysis" }, - { "op", SEN_DC, IF_SET|IF_FLAG, "sensitivity in DCop analysis" }, - { "ac", SEN_AC, IF_SET|IF_FLAG, "sensitivity in AC analysis" }, - { "tran", SEN_TRAN, IF_SET|IF_FLAG, "sensitivity in transient analysis"}, - { "dev", SEN_DEV, IF_SET|IF_INSTANCE, "instance with design param." }, - { "parm", SEN_PARM, IF_SET|IF_STRING, "name of design parameter" }, -}; - -SPICEanalysis SEN2info = { - { - "SENS2", - "Sensitivity analysis", - - NUMELEMS(SENparms), - SENparms - }, - sizeof(SENstruct), - NODOMAIN, - 0, - SENsetParm, - SENaskQuest, - NULL, - SENstartup -}; diff --git a/src/unsupported/snaskq.c b/src/unsupported/snaskq.c deleted file mode 100644 index adb123315..000000000 --- a/src/unsupported/snaskq.c +++ /dev/null @@ -1,29 +0,0 @@ -/********** -Copyright 1990 Regents of the University of California. All rights reserved. -Author: 1985 Thomas L. Quarles -**********/ - -#include "ngspice/ngspice.h" -#include -#include "ngspice/ifsim.h" -#include "ngspice/iferrmsg.h" -#include "ngspice/sen2defs.h" -#include "ngspice/cktdefs.h" -#include "ngspice/suffix.h" - - -int -SENaskQuest(CKTcircuit *ckt, JOB *anal, int which, IFvalue *value) -{ - NG_IGNORE(ckt); - NG_IGNORE(anal); - NG_IGNORE(value); - - switch(which) { - - default: - break; - } - - return E_BADPARM; -} diff --git a/src/unsupported/snstart.c b/src/unsupported/snstart.c deleted file mode 100644 index 6147d6cd4..000000000 --- a/src/unsupported/snstart.c +++ /dev/null @@ -1,67 +0,0 @@ -/********** -Copyright 1990 Regents of the University of California. All rights reserved. -Author: 1985 Thomas L. Quarles -**********/ - -#include "ngspice/ngspice.h" -#include -#include "ngspice/ifsim.h" -#include "ngspice/cktdefs.h" -#include "ngspice/const.h" -#include "ngspice/sperror.h" -#include "ngspice/suffix.h" - -/* This is a routine to initialize the sensitivity - * data structure - */ - -int -SENstartup(CKTcircuit *ckt, int restart) -{ - int i; - int err; - IFvalue parmtemp; - int type; - GENinstance *fast; - - if (restart) { - fprintf(stdout, "Sensitivity-2 analysis: unsupported code\n"); - } - -#ifdef SENSDEBUG - printf("SENstartup\n"); -#endif - - ckt->CKTsenInfo->SENstatus = NORMAL; - ckt->CKTsenInfo->SENpertfac = 1e-4; - ckt->CKTsenInfo->SENinitflag = ON; /* allocate memory in NIsenReinit */ - - parmtemp.rValue = 1.0; - - for (i = 0; i < ckt->CKTsenInfo->SENnumVal; i++) { - - fast = CKTfndDev(ckt, ckt->CKTsenInfo->SENdevices[i]); - if (!fast) - return E_NODEV; - - type = fast->GENmodPtr->GENmodType; - -#ifdef SENSDEBUG - printf("SENstartup Instance: %s Design parameter: %s\n", ckt->CKTsenInfo->SENdevices[i], - ckt->CKTsenInfo->SENparmNames[i]); -#endif - err = CKTpName( - ckt->CKTsenInfo->SENparmNames[i], - &parmtemp, ckt, type, - ckt->CKTsenInfo->SENdevices[i], - &fast); - if (err != OK) - return err; - } - -#ifdef SENSDEBUG - printf("SENstartup end\n"); -#endif - - return OK; -} diff --git a/src/unsupported/spiced.c b/src/unsupported/spiced.c deleted file mode 100644 index e8e99c1b3..000000000 --- a/src/unsupported/spiced.c +++ /dev/null @@ -1,286 +0,0 @@ -/********** -Copyright 1990 Regents of the University of California. All rights reserved. -Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group -**********/ - -/* - * Do remote spice jobs. The first line transmitted will be of the - * format: "user host program". The program field may be left out, - * in which case it defaults to SPICE_PATH. The program is then - * executed, with the single argument "-S". The remote host should - * wait for a response from spiced before sending any data -- so - * far the only response sent is "ok". - * Eventually we will want to deal with load-balancing - * of spice jobs. - */ - -#include "spice.h" -#include -#include "strext.h" -#include -#include - -#ifdef HAS_BSDSOCKETS -#include -#include -#include - -#ifdef HAS_BSDRUSAGE -#include -#include -#else - -#ifdef HAS_SYSVRUSAGE -#include -#include -#endif -#endif - -#include -#include - -/* Better have #ifdef HAS_UNIX_SIGS XXX */ -#include -/* Better have #ifdef HAS_WAIT XXX */ -#include - -#include "ngspice/suffix.h" - -#define MAXJOBS 2 - -int nrunning = 0; -int maxjobs = MAXJOBS; - -extern int errno; -extern char *sys_errlist[]; -extern char **environ; - -/* ARGSUSED */ -void -main(ac, av) - char **av; -{ - int s, inetd = 0; - struct servent *sp; - struct protoent *pp; - struct sockaddr_in from, sin; - int g, i, len = sizeof (struct sockaddr_in); - void dostuff(); - int sigchild(); - FILE *fp; - char *datestring(); - - /* Process arguments. */ - - ivars(NULL); - - av++; - while (*av) { - if (!strcmp(*av, "-i")) - inetd++; - else - maxjobs = atoi(av[1]); - av++; - } - - if (inetd == 0) { - /* Find out who we are. */ - sp = getservbyname("spice", "tcp"); - if (sp == NULL) { - fprintf(stderr, "Error: spice/tcp: unknown service\n"); - exit(1); - } - pp = getprotobyname("tcp"); - if (pp == NULL) { - fprintf(stderr, "Error: tcp: unknown protocol\n"); - exit(1); - } - - /* Create the socket. */ - s = socket(AF_INET, SOCK_STREAM, pp->p_proto); - if (s < 0) { - perror("spiced: socket"); - exit(1); - } - sin.sin_port = sp->s_port; - if (bind(s, (struct sockaddr *) &sin, sizeof - (struct sockaddr_in)) < 0) { - perror("spiced: bind"); - exit(1); - } - -#ifndef DEBUG - /* Disconnect from the controlling terminal. */ - if (fork()) - exit(0); - for (i = 0; i < 10; i++) - if (i != s) - (void) close(i); - (void) open("/", O_RDONLY); - (void) dup2(0, 1); - (void) dup2(0, 2); - i = open("/dev/tty", O_RDWR); - if (i > 0) { - (void) ioctl(i, TIOCNOTTY, NULL); - (void) close(i); - } - -#endif - -#ifdef SIGCHLD - (void) signal(SIGCHLD, sigchild); -#else -#ifdef SIGCLD - (void) signal(SIGCLD, sigchild); -#endif -#endif - fp = fopen(Spiced_Log, "a"); - fprintf(fp, "\n-- new daemon, pid = %d, date = %s\n\n", - getpid(), datestring()); - (void) fclose(fp); - - /* Start (void) listening for requests. */ - (void) listen(s, 5); - for (;;) { - g = accept(s, (struct sockaddr *) &from, &len); - if (g < 0) { - if (errno != EINTR) { - fp = fopen(Spiced_Log, "a"); - fprintf(fp, "\n>>> accept: %s\n\n", - sys_errlist[errno]); - exit(1); - } - continue; - } - if (!fork()) { - (void) close(s); -#ifdef SIGCHLD - (void) signal(SIGCHLD, SIG_IGN); -#else -#ifdef SIGCLD - (void) signal(SIGCLD, SIG_IGN); -#endif -#endif - dostuff(g); - } - nrunning++; - (void) close(g); - } - } else { - /* All this is already done for us. */ - dostuff(0); - } -} - -void -dostuff(s) -{ - FILE *fp; - char *datestring(); - char buf[BUFSIZ], user[16], host[32], program[128]; - char *argv[3], *t; - int i, rc; -#ifdef HAS_INTWAITSTATUS - int stats; -#else - union wait stats; -#endif -#ifdef HAS_BSDRUSAGE - struct rusage ru; -#endif - - /* Should do some sort of verification */ - i = read(s, buf, BUFSIZ); - if (i < 0) { - perror("spiced: read"); - exit(1); - } - i = sscanf(buf, "%s %s %s", user, host, program); - if (i < 2) { - fprintf(stderr, "Error: bad init line: %s\n", buf); - exit(1); - } - if (i == 2) - (void) strcpy(program, tilde_expand(Spice_Path)); - - if (nrunning > maxjobs - 1) { - /* Too many people. */ - (void) write(s, "toomany", 8); - fp = fopen(Spiced_Log, "a"); - fprintf(fp, "%s: %s@%s: turned down - %d jobs now\n", - datestring(), user, host, nrunning); - (void) fclose(fp); - exit(0); - } - (void) write(s, "ok", 3); - - if ((i = fork()) == 0) { - (void) dup2(s, 0); - (void) dup2(s, 1); - (void) dup2(s, 2); - argv[0] = program; - argv[1] = "-S"; - argv[2] = NULL; - (void) execve(program, argv, environ); - perror(program); - exit(1); - } -#ifdef HAS_BSDRUSAGE - /* Assume BSDRUSAGE -> wait3( ) XXX */ - if (wait3(&stats, 0, &ru) != i) { - perror("wait"); - exit(1); - } -#else -#ifdef HAS_WAIT - wait(&stats); - rc = 0; - rc = WEXITSTATUS(stats); -#endif -#endif - - /* Write a log entry. */ -#ifdef HAS_BSDRUSAGE - (void) sprintf(buf, "%d:%d.%6d", ru.ru_utime.tv_sec / 60, - ru.ru_utime.tv_sec % 60, ru.ru_utime.tv_usec); - for (t = buf; *t; t++) - ; - for (t--; *t == '0'; *t-- = '\0') - ; -#else - (void) strcpy(buf, "unknown"); -#endif - fp = fopen(Spiced_Log, "a"); - fprintf(fp, "%s: %s@%s: %s - \n\texit %d, time %s\n", - datestring(), user, host, program, rc, - buf); - (void) fclose(fp); - exit(0); -} - -/* Don't care what happens to the child */ - -int -sigchild() -{ - int pid; - FILE *fp; - - pid = wait(NULL); - if (pid == -1) { - fp = fopen(Spiced_Log, "a"); - fprintf(fp, "\n>>>spiced: wait: %s\n\n", sys_errlist[errno]); - (void) fclose(fp); - } else - nrunning--; - return; -} - -#else /* not HAS_BSDSOCKETS */ -main( ) -{ - fprintf(stderr, - "The program \"spiced\" is not available on this system.\n"); - exit(1); -} -#endif /* HAS_BSDSOCKETS */