currently each and every device specific instance and model structure
duplicates the memory layout of a struct GENmodel / GENinstance
further the first structure elements behind a GENinstance header
are reinterpreted as a sort of a generic "node" array.
This business is very error prone, and makes it difficult to
extend struct GENmodel / struct GENinstance.
This patch makes this business much more bearable.
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.