loop over DEVmodDelete() and DEVdelete() in CKTdestroy()
instead of doing this business in the DEVdestroy() functions.
As a consequence, most DEVdestroy() functions
collapse completely.
This patch itself is not valid until all invokers of DEVdestroy()
(currently this is CKTdestroy() exclusively)
are rewritten to invoke DEVmodDelete() and DEVdelete()
Instead of searching and then deleting a given device-model,
just delete the given model.
The search shall be done somewhere else.
Don't free the model struct itself,
this shall be done by the invoker himself.
Don't free the device instrance list,
this shall be done by the invoker himself.
As a consequence, most DEVmodDelete() functions
collapse almost completely.
This change is of no consequence,
because DEVmodDelete() is currently nowhere used.
Instead of searching and then deleting a given device-instance,
just delete the given instance.
The search shall be done somewhere else.
Don't free the instance struct itself,
this shall be done by the invoker.
As a consequence most DEVdelete() functions
collapse almost completely.
This change is of no consequence,
because DEVdelete() is currently nowhere used.
A missing update of "prev" would cause endless looping
when searching for a device instance.
introduced in commit:
> commit 38e68869a2
> Date: Wed Mar 1 14:30:24 2006 +0000
>
> Added mdel, del and dest functions to interface.
Dependent on given R and L parameter values,
"txl" models might be transformed to "cpl" models in INPdomodel().
This would cause a "unrecognized parameter" warning in create_model()
when searching for the "txl" flag in the "cpl" model,
which is avoided with some awkward extra processing in inpgmod.c
This commit removes this special processing
by addition of an "alias" parameter "txl" to the
"cpl" module parameter description CPLmPTable[] in "cpl.c"
Note,
setModelParm() is a no-op for "cpl" and "txl"
see case CPL_MOD_R in
function CPLmParam()
and case TXL_MOD_R in
function TXLmParam()
When 'level' is a valid model parameter,
then it was processed like any other parameter,
but additionally the
`if (strcmp(parm, "level") == 0)'
invoked INPgetValue() a second time.
This special processing is meant to allow "level" for all models
whether they make use of it or not.
The excess invocation of INPgetValue() didn't cause harm,
merely because the next token after the "level=number"
almost necessarily is a string (the beginning "name=" of the next assignment)
thus not a parse-able number,
thus the second INPgetValue() didn't modify the 'line' pointer.
To sanitise the code invoke the "level" skipping only if "level"
is not recognised as a valid model parameter.
MIFdelete() might be called with third arg being NULL,
searching for the instance to be deleted by name only.
Need to invoke the callback in this case too.
Prevent a crash of example/FFT_test.cir.
Buffer 'buf' in function drawlingrid() has been too small.
Increase 'buf' size, and add some protection.
The example file examples/plot/test-small-plot.cir
shows the limits of plotting:
difference in two numbers at digit 14 is plotted well.
at digit 15 is plotted with bugs.
at digit 16 is reduced to integer.
consider compiling with
-O1 -D_FORTIFY_SOURCE=2
for gcc, and
/GS
for visual studio.
Fix a very old bug in the implementation of the
gummel-poon model formulas for the junction capacities.
(already in spice3f4)
For unknown reasons, the same formulas in the
diode mos1 mos2 mos6 jfet models
have been implemented correctly right from the beginning,
the typo was bjt specific.
Many Thanks for the concise and precise Bug Report
provided by Schabo Rumanus on the ngspice-users mailing list
> To: ngspice-users@lists.sourceforge.net
> Subject: [Ngspice-users] Temperatursimulation von Sperrschichtkapazitäten
Many Thanks to Dietmar Warning for his thorough verification
of this commit.
overwriting SPICE_DSTRING `dstr_p' may invalidate `s'
This bug was injected with the introduction of SPICE_DSTRING in :
> commit 76feebbbfa
> Date: Thu Feb 25 21:43:03 2010 +0000
> various bug fixes
cider relied on our broken ngspice variant of erfc() which behaved as
erfc_ngspice(x) = erfc(fabs(x))
Note:
apart from cider, erfc is used in
devices/ltra/ltramisc.c
always with positive argument
and
src/frontend/spec.c
again always with positive argument
Thus, the difference in implementation
never mathered anywhere except in cider
which these days is guaranteed to be provided by <math.h>
note,
our own implementation was incorrect anyway.
it evaluated to
erfc_ngspice(x) = erfc(fabs(x))
which moved processing of several parameters into a new function
ACM_SourceDrainResistances()
but did so incompletely.
As a consequence the matrix footprint was not correctly modified
when source or drainresistance is zero
Thanks for the bug report by "Sto" in message
> bug: mosfet models with deliberate NRD=0 (ngspice-27)
https://sourceforge.net/p/ngspice/discussion/133842/thread/fa39228d