diff --git a/src/spicelib/devices/ChangeLog b/src/spicelib/devices/ChangeLog index 348eeb55c..20b474099 100644 --- a/src/spicelib/devices/ChangeLog +++ b/src/spicelib/devices/ChangeLog @@ -1,6 +1,13 @@ +2000-07-09 Arno W. Peters + + * devlist.c, devlist.h, test_devlist.c: Removed. This idea is not + yet ready to be implemented. The dependency of the analysis code + on CKThead for storing the device parameters at the same index as + the device model in the DEVices variable caused trouble. + 2000-07-08 Arno W. Peters - * devlist.c, test-devlist: Additional checks revealed a bug, + * devlist.c, test_devlist.c: Additional checks revealed a bug, first_device() and next_device() should now do what they are supposed to do. diff --git a/src/spicelib/devices/Makefile.am b/src/spicelib/devices/Makefile.am index c11cd6711..3e6c6c143 100644 --- a/src/spicelib/devices/Makefile.am +++ b/src/spicelib/devices/Makefile.am @@ -37,8 +37,6 @@ lib_LIBRARIES = libdev.a libdev_a_SOURCES = \ dev.c \ dev.h \ - devlist.c \ - devlist.h \ devsup.c \ cktaccept.c \ cktaccept.h \ @@ -48,15 +46,6 @@ libdev_a_SOURCES = \ cktfinddev.c \ cktinit.c -bin_PROGRAMS = test_devlist - -test_devlist_SOURCES = \ - devlist.c \ - devlist.h \ - test_devlist.c - -TESTS = test_devlist - EXTRA_DIST = README INCLUDES = -I$(top_srcdir)/src/include diff --git a/src/spicelib/devices/devlist.c b/src/spicelib/devices/devlist.c deleted file mode 100644 index 491d85915..000000000 --- a/src/spicelib/devices/devlist.c +++ /dev/null @@ -1,63 +0,0 @@ -/* NG-SPICE -- An electrical circuit simulator - * - * Copyright (c) 1990 University of California - * Copyright (c) 2000 Arno W. Peters - * - * Permission to use, copy, modify, and distribute this software and - * its documentation without fee, and without a written agreement is - * hereby granted, provided that the above copyright notice, this - * paragraph and the following three paragraphs appear in all copies. - * - * This software program and documentation are copyrighted by their - * authors. The software program and documentation are supplied "as - * is", without any accompanying services from the authors. The - * authors do not warrant that the operation of the program will be - * uninterrupted or error-free. The end-user understands that the - * program was developed for research purposes and is advised not to - * rely exclusively on the program for any reason. - * - * IN NO EVENT SHALL THE AUTHORS BE LIABLE TO ANY PARTY FOR DIRECT, - * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING - * LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS - * DOCUMENTATION, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. THE AUTHORS SPECIFICALLY DISCLAIMS ANY - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE - * SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE AUTHORS - * HAVE NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, - * ENHANCEMENTS, OR MODIFICATIONS. */ - -#include - -#include -#include - -#include "dev.h" - - - -/* Returns the first device in the list, or NULL if the list is empty */ -SPICEdev ** -first_device(void) -{ - return devices(); -} - - -/* Returns the next device on the list, or NULL if no more devices - left. */ -SPICEdev ** -next_device(SPICEdev **current) -{ - int index; - SPICEdev **ret; - - index = current - devices(); - if (index < num_devices()) { - ret = current + 1; - } else { - ret = NULL; - } - - return ret; -} diff --git a/src/spicelib/devices/devlist.h b/src/spicelib/devices/devlist.h deleted file mode 100644 index 25d660786..000000000 --- a/src/spicelib/devices/devlist.h +++ /dev/null @@ -1,35 +0,0 @@ -/* NG-SPICE -- An electrical circuit simulator - * - * Copyright (c) 2000 Arno W. Peters - * - * Permission to use, copy, modify, and distribute this software and - * its documentation without fee, and without a written agreement is - * hereby granted, provided that the above copyright notice, this - * paragraph and the following three paragraphs appear in all copies. - * - * This software program and documentation are copyrighted by their - * authors. The software program and documentation are supplied "as - * is", without any accompanying services from the authors. The - * authors do not warrant that the operation of the program will be - * uninterrupted or error-free. The end-user understands that the - * program was developed for research purposes and is advised not to - * rely exclusively on the program for any reason. - * - * IN NO EVENT SHALL THE AUTHORS BE LIABLE TO ANY PARTY FOR DIRECT, - * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING - * LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS - * DOCUMENTATION, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. THE AUTHORS SPECIFICALLY DISCLAIMS ANY - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE - * SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE AUTHORS - * HAVE NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, - * ENHANCEMENTS, OR MODIFICATIONS. */ - -#ifndef _DEVLIST_H -#define _DEVLIST_H - -SPICEdev **first_device(void); -SPICEdev **next_device(SPICEdev **current); - -#endif diff --git a/src/spicelib/devices/res/resload.c b/src/spicelib/devices/res/resload.c index b2754c136..3682d7296 100644 --- a/src/spicelib/devices/res/resload.c +++ b/src/spicelib/devices/res/resload.c @@ -11,21 +11,20 @@ Modified: Apr 2000 - Paolo Nenzi #include "sperror.h" +/* actually load the current resistance value into the sparse matrix + * previously provided */ int RESload(GENmodel *inModel, CKTcircuit *ckt) - /* actually load the current resistance value into the - * sparse matrix previously provided - */ { RESmodel *model = (RESmodel *)inModel; - RESinstance *here; /* loop through all the resistor models */ for( ; model != NULL; model = model->RESnextModel ) { + RESinstance *here; /* loop through all the instances of the model */ for (here = model->RESinstances; here != NULL ; - here=here->RESnextInstance) { + here = here->RESnextInstance) { *(here->RESposPosptr) += here->RESconduct; *(here->RESnegNegptr) += here->RESconduct; @@ -36,21 +35,21 @@ RESload(GENmodel *inModel, CKTcircuit *ckt) return(OK); } + +/* actually load the current resistance value into the sparse matrix + * previously provided */ int RESacload(GENmodel *inModel, CKTcircuit *ckt) - /* actually load the current resistance value into the - * sparse matrix previously provided - */ { RESmodel *model = (RESmodel *)inModel; - RESinstance *here; /* loop through all the resistor models */ for( ; model != NULL; model = model->RESnextModel ) { + RESinstance *here; /* loop through all the instances of the model */ for (here = model->RESinstances; here != NULL ; - here=here->RESnextInstance) { + here = here->RESnextInstance) { if(here->RESacresGiven) { *(here->RESposPosptr) += here->RESacConduct; diff --git a/src/spicelib/devices/test_devlist.c b/src/spicelib/devices/test_devlist.c deleted file mode 100644 index 70ba3a126..000000000 --- a/src/spicelib/devices/test_devlist.c +++ /dev/null @@ -1,76 +0,0 @@ -#include -#include - -#include -#include - -#include "devlist.h" - - -SPICEdev dummy = { - { - "Dummy", - "A dummy element", - - NULL, - NULL, - NULL, - - NULL, - NULL, - - NULL, - NULL, - 0 - }, - - NULL, -}; - - -SPICEdev *DEVices[] = { - &dummy, - &dummy, - &dummy, - &dummy -}; - - -int -num_devices(void) -{ - return sizeof(DEVices)/sizeof(SPICEdev *); -} - -SPICEdev ** -devices(void) -{ - return DEVices; -} - - -int -main(void) -{ - SPICEdev **dev; - int count = 0; - int ret; - - ret = EXIT_SUCCESS; - for (dev = first_device(); dev != NULL; dev = next_device(dev)) { - if (*dev != DEVices[count]) { - ret = EXIT_FAILURE; - } - count++; - } - - if (ret == EXIT_SUCCESS && count == num_devices() + 1) { - printf("PASSED"); - ret = EXIT_SUCCESS; - } else { - printf("FAILED"); - ret = EXIT_FAILURE; - } - printf(": test_devlist\n"); - return ret; -}