Added mdel, del and dest functions to interface.

This commit is contained in:
pnenzi 2006-03-01 14:30:24 +00:00
parent 1b2a22a9a9
commit 38e68869a2
5 changed files with 322 additions and 8 deletions

View File

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
$Id$
$Log$
Revision 1.1 2006-03-01 14:30:24 pnenzi
Added mdel, del and dest functions to interface.
-->
<!--
Written by Laurent Lemaitre - r29173@users.sourceforge.net
Documentation:
http://sourceforge.net/docman/display_doc.php?docid=18993&group_id=84289
Target Interface: ngspice
Supported by adms-1.x.x
This file is used by adms - http://sourceforge.net/projects/mot-adms.
adms is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
adms is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with adms; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-->
<!DOCTYPE admst SYSTEM "admst.dtd">
<admst version="2.1.3" xmlns:admst="http://mot-adms.sourceforge.net/xml-files/admst">
<admst:template match="dectype">
<admst:choose>
<admst:when test="[type='real']">
<admst:text format=" double "/>
</admst:when>
<admst:when test="[type='integer']">
<admst:text format=" int "/>
</admst:when>
<admst:otherwise>
<admst:text format=" char* "/>
</admst:otherwise>
</admst:choose>
</admst:template>
<admst:template match="code">
<admst:value-of select="attribute[name='ngspicename']/value"/>
<admst:variable name="module" select="%s"/>
#include &quot;ngspice.h&quot;
#include &quot;$(module)defs.h&quot;
#include &quot;sperror.h&quot;
#include &quot;suffix.h&quot;
int $(module)delete(GENmodel *inModel, IFuid name, GENinstance **inInst)
{
register $(module)model *model = ($(module)model*)inModel;
register $(module)instance **fast =($(module)instance**)inInst;
$(module)instance **prev = NULL;
$(module)instance *here;
for ( ; model ; model = model->$(module)nextModel ) {
prev = &amp;(model->$(module)instances);
for (here = *prev; here ; here = *prev) {
if(here->$(module)name == name || (fast &amp;&amp; here==*fast) ) {
*prev = here->$(module)nextInstance;
FREE(here);
return(OK);
}
}
}
return(E_NODEV);
}
</admst:template>
<admst:for-each select="/module">
<admst:value-of select="attribute[name='ngspicename']/value"/>
<admst:open file="%sdel.c">
<admst:value-of select="/simulator/package_string"/>
<admst:text format="/***\n*** Interface: %s\n"/>
<admst:value-of select="/simulator/currentdate"/>
<admst:value-of select="/simulator/fullname"/>
<admst:text format=" *** created by: %s - %s ***/\n"/>
<admst:apply-templates select="." match="code"/>
</admst:open>
<admst:value-of select="attribute[name='ngspicename']/value"/>
<admst:message format="%sdel.c: file created\n"/>
</admst:for-each>
</admst>

View File

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
$Id$
$Log$
Revision 1.1 2006-03-01 14:30:24 pnenzi
Added mdel, del and dest functions to interface.
-->
<!--
Written by Laurent Lemaitre - r29173@users.sourceforge.net
Documentation:
http://sourceforge.net/docman/display_doc.php?docid=18993&group_id=84289
Target Interface: ngspice
Supported by adms-1.x.x
This file is used by adms - http://sourceforge.net/projects/mot-adms.
adms is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
adms is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with adms; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-->
<!DOCTYPE admst SYSTEM "admst.dtd">
<admst version="2.1.3" xmlns:admst="http://mot-adms.sourceforge.net/xml-files/admst">
<admst:template match="dectype">
<admst:choose>
<admst:when test="[type='real']">
<admst:text format=" double "/>
</admst:when>
<admst:when test="[type='integer']">
<admst:text format=" int "/>
</admst:when>
<admst:otherwise>
<admst:text format=" char* "/>
</admst:otherwise>
</admst:choose>
</admst:template>
<admst:template match="code">
<admst:value-of select="attribute[name='ngspicename']/value"/>
<admst:variable name="module" select="%s"/>
#include &quot;ngspice.h&quot;
#include &quot;$(module)defs.h&quot;
#include &quot;suffix.h&quot;
void $(module)destroy(GENmodel **inModel)
{
register $(module)model **model = ($(module)model**)inModel;
register $(module)instance *here;
$(module)instance *prev = NULL;
$(module)model *mod = *model;
$(module)model *oldmod = NULL;
for ( ; mod ; mod = mod->$(module)nextModel ) {
if (oldmod) FREE(oldmod);
oldmod = mod;
prev = ($(module)instance *)NULL;
for (here = mod->$(module)instances; here ; here = here->$(module)nextInstance) {
if(prev) FREE(prev);
prev = here;
}
if(prev) FREE(prev);
}
if(oldmod) FREE(oldmod);
*model = NULL;
return;
}
</admst:template>
<admst:for-each select="/module">
<admst:value-of select="attribute[name='ngspicename']/value"/>
<admst:open file="%sdest.c">
<admst:value-of select="/simulator/package_string"/>
<admst:text format="/***\n*** Interface: %s\n"/>
<admst:value-of select="/simulator/currentdate"/>
<admst:value-of select="/simulator/fullname"/>
<admst:text format=" *** created by: %s - %s ***/\n"/>
<admst:apply-templates select="." match="code"/>
</admst:open>
<admst:value-of select="attribute[name='ngspicename']/value"/>
<admst:message format="%sdest.c: file created\n"/>
</admst:for-each>
</admst>

View File

@ -3,7 +3,11 @@
<!--
$Id$
$Log$
Revision 1.4 2006-02-26 22:09:02 pnenzi
Revision 1.5 2006-03-01 14:30:24 pnenzi
Added mdel, del and dest functions to interface.
Revision 1.4 2006/02/26 22:09:02 pnenzi
Added support for pole-zero analysis (experimental).
@ -92,9 +96,9 @@ SPICEdev $(module)info = {
NULL, /* DEVfindBranch */
$(module)acLoad, /* DEVacLoad */
NULL, /* DEVaccept */
NULL, /* DEVdestroy */
NULL, /* DEVmodDelete */
NULL, /* DEVdelete */
$(module)destroy, /* DEVdestroy */
$(module)mDelete, /* DEVmodDelete */
$(module)delete, /* DEVdelete */
NULL, /* DEVsetic */
$(module)ask, /* DEVask */
$(module)mAsk, /* DEVmodAsk */

View File

@ -0,0 +1,103 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
$Id$
$Log$
Revision 1.1 2006-03-01 14:30:24 pnenzi
Added mdel, del and dest functions to interface.
-->
<!--
Written by Laurent Lemaitre - r29173@users.sourceforge.net
Documentation:
http://sourceforge.net/docman/display_doc.php?docid=18993&group_id=84289
Target Interface: ngspice
Supported by adms-1.x.x
This file is used by adms - http://sourceforge.net/projects/mot-adms.
adms is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
adms is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with adms; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-->
<!DOCTYPE admst SYSTEM "admst.dtd">
<admst version="2.1.3" xmlns:admst="http://mot-adms.sourceforge.net/xml-files/admst">
<admst:template match="dectype">
<admst:choose>
<admst:when test="[type='real']">
<admst:text format=" double "/>
</admst:when>
<admst:when test="[type='integer']">
<admst:text format=" int "/>
</admst:when>
<admst:otherwise>
<admst:text format=" char* "/>
</admst:otherwise>
</admst:choose>
</admst:template>
<admst:template match="code">
<admst:value-of select="attribute[name='ngspicename']/value"/>
<admst:variable name="module" select="%s"/>
#include &quot;ngspice.h&quot;
#include &quot;$(module)defs.h&quot;
#include &quot;sperror.h&quot;
#include &quot;suffix.h&quot;
int $(module)mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{
register $(module)model **model = ($(module)model**)inModel;
register $(module)model *modfast =($(module)model*)kill;
$(module)instance *here;
$(module)instance *prev = NULL;
$(module)model **oldmod;
oldmod = model;
for ( ; *model ; model = &amp;((*model)->$(module)nextModel)) {
if ((*model)->$(module)modName == modname ||
(modfast &amp;&amp; *model == modfast))
goto delgot;
oldmod = model;
}
return(E_NOMOD);
delgot:
*oldmod = (*model)->$(module)nextModel; /* cut deleted device out of list */
for (here = (*model)->$(module)instances; here; here = here->$(module)nextInstance)
{ if(prev) FREE(prev);
prev = here;
}
if(prev) FREE(prev);
FREE(*model);
return(OK);
}
</admst:template>
<admst:for-each select="/module">
<admst:value-of select="attribute[name='ngspicename']/value"/>
<admst:open file="%smdel.c">
<admst:value-of select="/simulator/package_string"/>
<admst:text format="/***\n*** Interface: %s\n"/>
<admst:value-of select="/simulator/currentdate"/>
<admst:value-of select="/simulator/fullname"/>
<admst:text format=" *** created by: %s - %s ***/\n"/>
<admst:apply-templates select="." match="code"/>
</admst:open>
<admst:value-of select="attribute[name='ngspicename']/value"/>
<admst:message format="%smdel.c: file created\n"/>
</admst:for-each>
</admst>

View File

@ -3,7 +3,11 @@
<!--
$Id$
$Log$
Revision 1.8 2006-02-26 22:09:01 pnenzi
Revision 1.9 2006-03-01 14:30:24 pnenzi
Added mdel, del and dest functions to interface.
Revision 1.8 2006/02/26 22:09:01 pnenzi
Added support for pole-zero analysis (experimental).
@ -82,6 +86,9 @@ $(module).c:
-e \$(ADMSXMLINTERFACE)/ngspiceMODULEpzld.c.xml \\
-e \$(ADMSXMLINTERFACE)/ngspiceMODULEtemp.c.xml \\
-e \$(ADMSXMLINTERFACE)/ngspiceMODULEsetup.c.xml \\
-e \$(ADMSXMLINTERFACE)/ngspiceMODULEdel.c.xml \\
-e \$(ADMSXMLINTERFACE)/ngspiceMODULEmdel.c.xml \\
-e \$(ADMSXMLINTERFACE)/ngspiceMODULEdest.c.xml \\
-e \$(ADMSXMLINTERFACE)/ngspiceMODULEguesstopology.c.xml \\
-e \$(ADMSXMLINTERFACE)/ngspiceMODULE.c.xml
perl -p -i.bak -e 's/IOP\\("(\\w+)"/IOP("\\L\\1"/' $(module).c
@ -93,6 +100,8 @@ lib$(module)_a_SOURCES = \\
$(module)acld.c \\
$(module)ask.c \\
$(module)defs.h \\
$(module)del.c \\
$(module)dest.c \\
$(module)ext.h \\
$(module)guesstopology.c \\
$(module)init.c \\
@ -100,6 +109,7 @@ lib$(module)_a_SOURCES = \\
$(module)itf.h \\
$(module)load.c \\
$(module)mask.c \\
$(module)mdel.c \\
$(module)mpar.c \\
$(module)par.c \\
$(module)pzld.c \\
@ -111,6 +121,8 @@ BUILT_SOURCES = \\
$(module)acld.c \\
$(module)ask.c \\
$(module)defs.h \\
$(module)del.c \\
$(module)dest.c \\
$(module)ext.h \\
$(module)guesstopology.c \\
$(module)init.c \\
@ -118,6 +130,7 @@ BUILT_SOURCES = \\
$(module)itf.h \\
$(module)load.c \\
$(module)mask.c \\
$(module)mdel.c \\
$(module)mpar.c \\
$(module)par.c \\
$(module)pzld.c \\
@ -130,6 +143,8 @@ CLEANFILES = \\
$(module)acld.c \\
$(module)ask.c \\
$(module)defs.h \\
$(module)del.c \\
$(module)dest.c \\
$(module)ext.h \\
$(module)guesstopology.c \\
$(module)init.c \\
@ -137,6 +152,7 @@ CLEANFILES = \\
$(module)itf.h \\
$(module)load.c \\
$(module)mask.c \\
$(module)mdel.c \\
$(module)mpar.c \\
$(module)par.c \\
$(module)pzld.c \\
@ -146,10 +162,7 @@ CLEANFILES = \\
#TODO (not implemented) \\
$(module)conv.c \\
$(module)del.c \\
$(module)dest.c \\
$(module)getic.c \\
$(module)mdel.c \\
$(module)noise.c \\
$(module)trunc.c